選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

select-car.vue 10KB

2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
1年前
2ヶ月前
2ヶ月前
2ヶ月前
2週間前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
2ヶ月前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. type="text"
  14. class="search"
  15. placeholder="请输入车牌号"
  16. v-model="state.vehiclePlate"
  17. @confirm="search"
  18. confirm-type="search"
  19. />
  20. </view>
  21. </view>
  22. <view class="title">车辆列表</view>
  23. <scroll-view
  24. class="selectCar-box"
  25. scroll-y="true"
  26. style="height: 80vh"
  27. @scrolltolower="getList"
  28. >
  29. <template v-if="state.list.length > 0">
  30. <view
  31. class="list"
  32. @click="choose(i, item)"
  33. v-for="(item, i) in state.list"
  34. :key="i"
  35. >
  36. <view class="yanse-out">
  37. <image class="car" :src="`${$imgUrl}issuance/car.png`" mode=""></image>
  38. <text
  39. class="yanse">
  40. {{ getVehiclePlateColorPai(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, objectToQueryString } 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. vehiclePlateColorPai,
  81. getVehiclePlateColorPai,
  82. getVehiclePlateStyle
  83. } from "@/datas/vehiclePlateColor";
  84. import { getCodeName } from "@/datas/queryKey.js";
  85. import useOrderListItem from "@/composables/order/useOrderListItem";
  86. import NoDataView from "@/components/no-data-view/no-data-view.vue";
  87. const props = defineProps({
  88. index: {
  89. type: Number,
  90. default() {
  91. return 0;
  92. },
  93. },
  94. refresh: {
  95. //是否刷新列表
  96. type: Boolean,
  97. default: true,
  98. },
  99. });
  100. const state = reactive({
  101. vehiclePlate: "",
  102. list: [],
  103. type: "",
  104. pageNo: 1,
  105. pageSize: 10,
  106. total: 0,
  107. loading: false,
  108. finished: false,
  109. });
  110. const titleMap = [
  111. {name: 'ETC注销-选择车辆', key: '2', router: '/subpackage/after-sale/ETC-log-off/guide'},
  112. {name: '更换ETC设备-选择车辆', key: '3', router: ''},
  113. {name: '卡签续期-选择车辆', key: '4', router: '/subpackage/after-sale/renewalContral/car-detail'},
  114. {name: '卡签挂失/解除挂失-选择车辆', key: '5', router: '/subpackage/after-sale/reportLossCard/detail'},
  115. {name: '增补设备-选择车辆', key: '6', router: ''},
  116. {name: '补卡补签-选择车辆', key: '7', router: ''},
  117. {name: '解除挂起-选择车辆', key: '8', router: '/subpackage/after-sale/releaseSuspension/cardloss-confirm'},
  118. {name: '储值卡转记账卡-选择车辆', key: '30', router: ''},
  119. {name: '卡pin码解锁-选择车辆', key: '31', router: ''},
  120. {name: 'ETC车牌过户-选择车辆', key: '32', router: ''},
  121. {name: '卡签停用/卡签启用-选择车辆', key: '33', router: ''},
  122. {name: '月结单查询-选择车辆', key: '34', router: ''},
  123. {name: 'ETC通行流水-选择车辆', key: '35', router: '/subpackage/search/refund-info-run-water/list'},
  124. {name: '黑名单查询', key: '36', router: '/subpackage/after-sale/blacklist-query/list'},
  125. {name: '恢复签约-选择车辆', key: '37', router: '/subpackage/orders/sign-up'},
  126. {name: '签约信息变更-选择车辆', key: '38', router: '/subpackage/after-sale/sign-info-change/project-detail'},
  127. ]
  128. onLoad((options) => {
  129. console.log("options", options);
  130. state.type = options.type;
  131. serTitle() // 设置页面标题
  132. });
  133. onShow(() => {
  134. if (state.type == "37") {
  135. list(true);
  136. } else {
  137. quanCheckActionTrue(state.vehiclePlate, true);
  138. }
  139. });
  140. const getList = () => {
  141. if (state.type == "37") {
  142. list();
  143. } else {
  144. quanCheckActionTrue(state.vehiclePlate);
  145. }
  146. }
  147. const list = (reset = false) => {
  148. if (reset) {
  149. state.pageNo = 1;
  150. state.list = [];
  151. state.finished = false;
  152. }
  153. if (state.loading || state.finished) return;
  154. state.loading = true;
  155. // const customerId = getItem('customerObj');
  156. const options = {
  157. type: 2,
  158. data: {
  159. pageNo: state.pageNo,
  160. pageSize: state.pageSize,
  161. // customerId,
  162. vehiclePlate: state.vehiclePlate,
  163. },
  164. method: "POST",
  165. showLoading: true,
  166. };
  167. return requestNew(rePage, options)
  168. .then((res) => {
  169. const data = res?.result || res?.data || [];
  170. state.total = res.total || 0;
  171. if (reset) {
  172. state.list = data;
  173. } else {
  174. state.list = state.list.concat(data);
  175. }
  176. if (state.list.length >= state.total || data.length < state.pageSize) {
  177. state.finished = true;
  178. } else {
  179. state.pageNo += 1;
  180. }
  181. state.loading = false;
  182. })
  183. .catch(() => {
  184. state.loading = false;
  185. });
  186. };
  187. // 设置页面title
  188. const serTitle = () => {
  189. let titleInfo = titleMap.find(item => item.key == state.type)
  190. uni.setNavigationBarTitle({
  191. title: titleInfo ? titleInfo.name : '选择车辆'
  192. });
  193. }
  194. const quanCheckActionTrue = (vehiclePlate, reset = false) => {
  195. if (reset) {
  196. state.pageNo = 1;
  197. state.list = [];
  198. state.finished = false;
  199. }
  200. if (state.loading || state.finished) return;
  201. state.loading = true;
  202. const options = {
  203. type: 2,
  204. data: {
  205. vehiclePlate,
  206. pageNo: state.pageNo,
  207. pageSize: state.pageSize,
  208. },
  209. method: "POST",
  210. showLoading: true,
  211. };
  212. requestNew(queryVehicleBind, options)
  213. .then((res) => {
  214. const data = res.result;
  215. state.total = res.totalCount || 0;
  216. for (var i = 0; i < data.length; i++) {
  217. for (var j = 0; j < vehiclePlateColorPai.length; j++) {
  218. if (data[i].vehiclePlateColor == vehiclePlateColorPai[j]["id"]) {
  219. data[i].color = vehiclePlateColorPai[j]["color"];
  220. data[i].showColor = vehiclePlateColorPai[j]["showColor"];
  221. }
  222. }
  223. }
  224. console.log("车辆列表", data);
  225. if (state.type == "32") {
  226. for (var k = 0; k < data.length; k++) {
  227. if (data[k]["orderStatus"] != "99999") {
  228. state.list.push(data[k]);
  229. }
  230. }
  231. } else {
  232. if (reset) {
  233. state.list = data;
  234. } else {
  235. state.list = state.list.concat(data);
  236. }
  237. }
  238. if (state.list.length >= state.total || data.length < state.pageSize) {
  239. state.finished = true;
  240. } else {
  241. state.pageNo += 1;
  242. }
  243. state.loading = false;
  244. })
  245. .catch((err) => {
  246. console.log(err);
  247. state.loading = false;
  248. });
  249. };
  250. const flag = ref("0");
  251. const choose = (i, item) => {
  252. console.log(item);
  253. // 4 卡签续签 5: 挂失解挂 36:黑名单查询 37:回复签约
  254. let pageInfo = titleMap.find(item => item.key == state.type)
  255. let routerParams = {
  256. vehicleId: item.vehicleId
  257. }
  258. if (state.type === '37') {
  259. routerParams = Object.assign(routerParams, {channelSing: 1, from: 37})
  260. }
  261. let paramsStr = objectToQueryString(routerParams)
  262. if (pageInfo && pageInfo.router) {
  263. navTo(`${pageInfo.router}?${paramsStr}`)
  264. } else {
  265. navTo(`/subpackage/after-sale/activation-once-again/vehicle-details?${paramsStr}`)
  266. }
  267. };
  268. const add = () => {
  269. navTo(`/subpackage/after-sale/blacklist-query/addCar`);
  270. };
  271. const search = () => {
  272. if (state.type == "37") {
  273. list(true);
  274. } else {
  275. quanCheckActionTrue(state.vehiclePlate, true);
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. .flex {
  281. display: flex;
  282. justify-content: center;
  283. }
  284. .selectCar-box {
  285. width: 93%;
  286. height: 100%;
  287. padding: 30rpx;
  288. padding-top: 0;
  289. padding-bottom: 50rpx;
  290. }
  291. .message {
  292. font-size: 26rpx;
  293. margin-left: 6rpx;
  294. }
  295. .search-layout {
  296. .search-box {
  297. margin: 30rpx 30rpx 0rpx 30rpx;
  298. height: 80rpx;
  299. background: #ffffff;
  300. border-radius: 40rpx;
  301. display: flex;
  302. justify-content: center;
  303. align-items: center;
  304. box-sizing: border-box;
  305. flex: 1;
  306. }
  307. .search-box .icon {
  308. width: 48rpx;
  309. height: 48rpx;
  310. margin: 0 20rpx;
  311. }
  312. .search-box .search {
  313. flex: 1;
  314. margin-right: 20rpx;
  315. height: 100%;
  316. padding: 0 10rpx;
  317. font-size: 28rpx;
  318. }
  319. .search-btn {
  320. color: white;
  321. background-color: #00b38b;
  322. width: 140rpx;
  323. height: 75rpx;
  324. line-height: 75rpx;
  325. font-size: 32rpx;
  326. border-radius: 40rpx;
  327. text-align: center;
  328. margin-right: 30rpx;
  329. margin-top: 30rpx;
  330. }
  331. }
  332. .title {
  333. font-weight: 400;
  334. font-size: 34rpx;
  335. color: #01243a;
  336. margin: 30rpx 30rpx 0rpx 30rpx;
  337. }
  338. .list {
  339. background: #ffffff;
  340. border-radius: 12rpx;
  341. border: 1px solid #ffffff;
  342. width: 98%;
  343. margin: 30rpx auto;
  344. padding: 20rpx;
  345. box-sizing: border-box;
  346. display: flex;
  347. align-items: center;
  348. .content {
  349. font-weight: 400;
  350. width: 76%;
  351. margin-left: 20rpx;
  352. .content-top {
  353. margin-bottom: 20rpx;
  354. .vehiclePlate {
  355. font-size: 30rpx;
  356. color: #01243a;
  357. }
  358. }
  359. .content-time {
  360. font-size: 26rpx;
  361. color: #999999;
  362. }
  363. }
  364. .yanse-out{
  365. position: relative;
  366. }
  367. .yanse {
  368. position: absolute;
  369. background: red;
  370. color: white;
  371. border-radius: 15rpx 0 15rpx 0;
  372. text-align: center;
  373. font-size: 24rpx;
  374. top: 0;
  375. left: 0;
  376. padding: 2rpx 6rpx;
  377. background-color: rgb(56,139,252);
  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>