您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

select-car.vue 10KB

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