Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

select-car.vue 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <view class="container">
  3. <!-- 搜索框 -->
  4. <view class="as-layout-horizontal as-gravity-center-start search-layout">
  5. <view class="search-box">
  6. <image
  7. :src="`${$imgUrl}service/icon-search.png`"
  8. class="icon"
  9. mode="aspectFill"
  10. @click="search()"
  11. ></image>
  12. <input
  13. class="search"
  14. placeholder="请输入车牌号"
  15. v-model="state.vehiclePlate"
  16. />
  17. </view>
  18. </view>
  19. <view class="title">车辆列表</view>
  20. <scroll-view
  21. class="selectCar-box"
  22. scroll-y="true"
  23. style="height: 60vh"
  24. @scrolltolower="list"
  25. >
  26. <template v-if="state.list.length > 0">
  27. <view
  28. class="list"
  29. @click="choose(i, item)"
  30. v-for="(item, i) in state.list"
  31. :key="i"
  32. >
  33. <view style="height: 134rpx">
  34. <image
  35. class="car"
  36. :src="`${$imgUrl}issuance/car.png`"
  37. mode=""
  38. ></image>
  39. <text class="yanse" :style="{ background: item.showColor }">{{
  40. getVehiclePlateColor(item.vehiclePlateColor)
  41. }}</text>
  42. </view>
  43. <view class="content">
  44. <view class="content-top">
  45. <text class="vehiclePlate">{{ item.vehiclePlate }}</text>
  46. </view>
  47. </view>
  48. <image
  49. class="arrow"
  50. :src="`${$imgUrl}issuance/arrow.png`"
  51. mode=""
  52. ></image>
  53. </view>
  54. </template>
  55. <NoDataView v-else />
  56. <!-- <EmptyView v-else :mode="list" :content="'暂无数据'" /> -->
  57. <!-- <view v-else class="flex"> 暂无车辆订单信息 </view> -->
  58. <view v-if="state.loading" class="flex">加载中...</view>
  59. <view v-if="state.finished && state.list.length > 0" class="flex"
  60. >没有更多了</view
  61. >
  62. </scroll-view>
  63. <!-- view class="action">
  64. <button type="default" class="ui-btn" @click="add()">
  65. 新增车辆
  66. </button>
  67. </view> -->
  68. </view>
  69. </template>
  70. <script lang="ts" setup>
  71. import { reactive, ref } from "vue";
  72. import { navTo } from "@/utils/utils";
  73. import { onLoad, onShow } from "@dcloudio/uni-app";
  74. import { queryVehicleBind, rePage } from "@/utils/network/api.js";
  75. import { requestNew } from "@/utils/network/request.js";
  76. import { getItem, StorageKeys } from "@/utils/storage";
  77. import { jump } from "@/datas/9901Jump.js";
  78. import { deviceType } from "@/utils/network/difference";
  79. import {
  80. getVehiclePlateColor,
  81. vehiclePlateColorPai,
  82. } from "@/datas/vehiclePlateColor";
  83. import { getCodeName } from "@/datas/queryKey.js";
  84. import useOrderListItem from "@/composables/order/useOrderListItem";
  85. import NoDataView from "@/components/no-data-view/no-data-view.vue";
  86. const props = defineProps({
  87. index: {
  88. type: Number,
  89. default() {
  90. return 0;
  91. },
  92. },
  93. refresh: {
  94. //是否刷新列表
  95. type: Boolean,
  96. default: true,
  97. },
  98. });
  99. const state = reactive({
  100. vehiclePlate: "",
  101. list: [],
  102. type: "",
  103. pageNo: 1,
  104. pageSize: 10,
  105. total: 0,
  106. loading: false,
  107. finished: false,
  108. });
  109. onLoad((options) => {
  110. console.log("options", options);
  111. state.type = options.type;
  112. if (options.type == "2") {
  113. uni.setNavigationBarTitle({
  114. title: "ETC注销-选择车辆",
  115. });
  116. } else if (options.type == "3") {
  117. uni.setNavigationBarTitle({
  118. title: "更换ETC设备-选择车辆",
  119. });
  120. } else if (options.type == "4") {
  121. uni.setNavigationBarTitle({
  122. title: "卡签续期-选择车辆",
  123. });
  124. } else if (options.type == "5") {
  125. uni.setNavigationBarTitle({
  126. title: "卡签挂失/解除挂失-选择车辆",
  127. });
  128. } else if (options.type == "6") {
  129. uni.setNavigationBarTitle({
  130. title: "增补设备-选择车辆",
  131. });
  132. } else if (options.type == "7") {
  133. uni.setNavigationBarTitle({
  134. title: "补卡补签-选择车辆",
  135. });
  136. } else if (options.type == "8") {
  137. uni.setNavigationBarTitle({
  138. title: "解除挂起-选择车辆",
  139. });
  140. } else if (options.type == "30") {
  141. uni.setNavigationBarTitle({
  142. title: "储值卡转记账卡-选择车辆",
  143. });
  144. } else if (options.type == "31") {
  145. uni.setNavigationBarTitle({
  146. title: "卡pin码解锁-选择车辆",
  147. });
  148. } else if (options.type == "32") {
  149. uni.setNavigationBarTitle({
  150. title: "ETC车牌过户-选择车辆",
  151. });
  152. } else if (options.type == "33") {
  153. uni.setNavigationBarTitle({
  154. title: "卡签停用/卡签启用-选择车辆",
  155. });
  156. } else if (options.type == "34") {
  157. uni.setNavigationBarTitle({
  158. title: "月结单查询-选择车辆",
  159. });
  160. } else if (options.type == "35") {
  161. uni.setNavigationBarTitle({
  162. title: "ETC通行流水-选择车辆",
  163. });
  164. } else if (options.type == "36") {
  165. uni.setNavigationBarTitle({
  166. title: "黑名单查询",
  167. });
  168. } else if (options.type == "37") {
  169. uni.setNavigationBarTitle({
  170. title: "恢复签约-选择车辆",
  171. });
  172. } else if (options.type == "38") {
  173. uni.setNavigationBarTitle({
  174. title: "车辆列表",
  175. });
  176. }
  177. });
  178. onShow(() => {
  179. if (state.type == "37") {
  180. list(true);
  181. } else {
  182. quanCheckActionTrue(state.vehiclePlate);
  183. }
  184. });
  185. const list = (reset = false) => {
  186. if (state.loading || state.finished) return;
  187. state.loading = true;
  188. if (reset) {
  189. state.pageNo = 1;
  190. state.list = [];
  191. state.finished = false;
  192. }
  193. // const customerId = getItem('customerObj');
  194. const options = {
  195. type: 2,
  196. data: {
  197. pageNo: state.pageNo,
  198. pageSize: state.pageSize,
  199. // customerId,
  200. // vehiclePlate: state.vehiclePlate,
  201. },
  202. method: "POST",
  203. showLoading: true,
  204. };
  205. return requestNew(rePage, options)
  206. .then((res) => {
  207. const data = res?.result || res?.data || [];
  208. state.total = res.total || 0;
  209. if (reset) {
  210. state.list = data;
  211. } else {
  212. state.list = state.list.concat(data);
  213. }
  214. if (state.list.length >= state.total || data.length < state.pageSize) {
  215. state.finished = true;
  216. } else {
  217. state.pageNo += 1;
  218. }
  219. state.loading = false;
  220. })
  221. .catch(() => {
  222. state.loading = false;
  223. });
  224. };
  225. const quanCheckActionTrue = (vehiclePlate) => {
  226. const options = {
  227. type: 2,
  228. data: {
  229. vehiclePlate,
  230. },
  231. method: "POST",
  232. showLoading: true,
  233. };
  234. requestNew(queryVehicleBind, options)
  235. .then((res) => {
  236. const data = res.result;
  237. for (var i = 0; i < data.length; i++) {
  238. for (var j = 0; j < vehiclePlateColorPai.length; j++) {
  239. if (data[i].vehiclePlateColor == vehiclePlateColorPai[j]["id"]) {
  240. data[i].color = vehiclePlateColorPai[j]["color"];
  241. data[i].showColor = vehiclePlateColorPai[j]["showColor"];
  242. }
  243. }
  244. }
  245. console.log("车辆列表", data);
  246. if (state.type == "32") {
  247. for (var k = 0; k < data.length; k++) {
  248. if (data[k]["orderStatus"] != "99999") {
  249. state.list.push(data[k]);
  250. }
  251. }
  252. } else {
  253. state.list = data;
  254. }
  255. })
  256. .catch((err) => {
  257. console.log(err);
  258. });
  259. };
  260. const flag = ref("0");
  261. const choose = (i, item) => {
  262. console.log(item);
  263. if (state.type === '37') {
  264. uni.navigateTo({
  265. url: `/subpackage/orders/sign-up?vehicleId=${item.vehicleId}&channelSing=1&from=37`,
  266. });
  267. } else {
  268. // 跳转到车辆详情页面,携带item.id参数
  269. uni.navigateTo({
  270. url: `/subpackage/after-sale/activation-once-again/vehicle-details?id=${item.id}`,
  271. });
  272. }
  273. };
  274. const add = () => {
  275. navTo(`/subpackage/after-sale/blacklist-query/addCar`);
  276. };
  277. const search = () => {
  278. list(true);
  279. };
  280. </script>
  281. <style lang="scss" scoped>
  282. .flex {
  283. display: flex;
  284. justify-content: center;
  285. }
  286. .selectCar-box {
  287. width: 93%;
  288. height: 100%;
  289. padding: 30rpx;
  290. padding-top: 0;
  291. padding-bottom: 200rpx;
  292. }
  293. .message {
  294. font-size: 26rpx;
  295. margin-left: 6rpx;
  296. }
  297. .search-layout {
  298. .search-box {
  299. margin: 30rpx 30rpx 0rpx 30rpx;
  300. height: 80rpx;
  301. background: #ffffff;
  302. border-radius: 40rpx;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. box-sizing: border-box;
  307. flex: 1;
  308. }
  309. .search-box .icon {
  310. width: 48rpx;
  311. height: 48rpx;
  312. margin: 0 20rpx;
  313. }
  314. .search-box .search {
  315. flex: 1;
  316. margin-right: 20rpx;
  317. height: 100%;
  318. padding: 0 10rpx;
  319. font-size: 28rpx;
  320. }
  321. .search-btn {
  322. color: white;
  323. background-color: #00b38b;
  324. width: 140rpx;
  325. height: 75rpx;
  326. line-height: 75rpx;
  327. font-size: 32rpx;
  328. border-radius: 40rpx;
  329. text-align: center;
  330. margin-right: 30rpx;
  331. margin-top: 30rpx;
  332. }
  333. }
  334. .title {
  335. font-weight: 400;
  336. font-size: 34rpx;
  337. color: #01243a;
  338. margin: 30rpx 30rpx 0rpx 30rpx;
  339. }
  340. .list {
  341. background: #ffffff;
  342. border-radius: 12rpx;
  343. border: 1px solid #ffffff;
  344. width: 98%;
  345. margin: 30rpx auto;
  346. padding: 20rpx;
  347. box-sizing: border-box;
  348. display: flex;
  349. align-items: center;
  350. .content {
  351. font-weight: 400;
  352. width: 76%;
  353. margin-left: 20rpx;
  354. .content-top {
  355. margin-bottom: 20rpx;
  356. .vehiclePlate {
  357. font-size: 30rpx;
  358. color: #01243a;
  359. }
  360. }
  361. .content-time {
  362. font-size: 26rpx;
  363. color: #999999;
  364. }
  365. }
  366. .yanse {
  367. display: inline-block;
  368. position: relative;
  369. width: 64rpx;
  370. height: 30rpx;
  371. background: red;
  372. color: white;
  373. border-radius: 15rpx 0 15rpx 0;
  374. text-align: center;
  375. line-height: 30rpx;
  376. font-size: 24rpx;
  377. top: -147rpx;
  378. }
  379. .car {
  380. width: 134rpx;
  381. height: 134rpx;
  382. }
  383. .arrow {
  384. width: 18rpx;
  385. height: 34rpx;
  386. }
  387. }
  388. .action {
  389. position: fixed;
  390. bottom: 0rpx;
  391. left: 0;
  392. height: 188rpx;
  393. background-color: #fff;
  394. border-radius: 30rpx 30rpx 0 0;
  395. width: 100vw;
  396. display: flex;
  397. align-items: center;
  398. justify-content: center;
  399. flex-direction: column;
  400. }
  401. </style>