您最多选择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 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: ''},
  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: ''},
  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: ''},
  124. {name: '黑名单查询', key: '36', router: '/subpackage/after-sale/blacklist-query/list'},
  125. {name: '恢复签约-选择车辆', key: '37', router: '/subpackage/orders/sign-up'},
  126. ]
  127. onLoad((options) => {
  128. console.log("options", options);
  129. state.type = options.type;
  130. serTitle() // 设置页面标题
  131. });
  132. onShow(() => {
  133. if (state.type == "37") {
  134. list(true);
  135. } else {
  136. quanCheckActionTrue(state.vehiclePlate, true);
  137. }
  138. });
  139. const getList = () => {
  140. if (state.type == "37") {
  141. list();
  142. } else {
  143. quanCheckActionTrue(state.vehiclePlate);
  144. }
  145. }
  146. const list = (reset = false) => {
  147. if (reset) {
  148. state.pageNo = 1;
  149. state.list = [];
  150. state.finished = false;
  151. }
  152. if (state.loading || state.finished) return;
  153. state.loading = true;
  154. // const customerId = getItem('customerObj');
  155. const options = {
  156. type: 2,
  157. data: {
  158. pageNo: state.pageNo,
  159. pageSize: state.pageSize,
  160. // customerId,
  161. vehiclePlate: state.vehiclePlate,
  162. },
  163. method: "POST",
  164. showLoading: true,
  165. };
  166. return requestNew(rePage, options)
  167. .then((res) => {
  168. const data = res?.result || res?.data || [];
  169. state.total = res.total || 0;
  170. if (reset) {
  171. state.list = data;
  172. } else {
  173. state.list = state.list.concat(data);
  174. }
  175. if (state.list.length >= state.total || data.length < state.pageSize) {
  176. state.finished = true;
  177. } else {
  178. state.pageNo += 1;
  179. }
  180. state.loading = false;
  181. })
  182. .catch(() => {
  183. state.loading = false;
  184. });
  185. };
  186. // 设置页面title
  187. const serTitle = () => {
  188. let titleInfo = titleMap.find(item => item.key == state.type)
  189. uni.setNavigationBarTitle({
  190. title: titleInfo ? titleInfo.name : '选择车辆'
  191. });
  192. }
  193. const quanCheckActionTrue = (vehiclePlate, reset = false) => {
  194. if (reset) {
  195. state.pageNo = 1;
  196. state.list = [];
  197. state.finished = false;
  198. }
  199. if (state.loading || state.finished) return;
  200. state.loading = true;
  201. const options = {
  202. type: 2,
  203. data: {
  204. vehiclePlate,
  205. pageNo: state.pageNo,
  206. pageSize: state.pageSize,
  207. },
  208. method: "POST",
  209. showLoading: true,
  210. };
  211. requestNew(queryVehicleBind, options)
  212. .then((res) => {
  213. const data = res.result;
  214. state.total = res.totalCount || 0;
  215. for (var i = 0; i < data.length; i++) {
  216. for (var j = 0; j < vehiclePlateColorPai.length; j++) {
  217. if (data[i].vehiclePlateColor == vehiclePlateColorPai[j]["id"]) {
  218. data[i].color = vehiclePlateColorPai[j]["color"];
  219. data[i].showColor = vehiclePlateColorPai[j]["showColor"];
  220. }
  221. }
  222. }
  223. console.log("车辆列表", data);
  224. if (state.type == "32") {
  225. for (var k = 0; k < data.length; k++) {
  226. if (data[k]["orderStatus"] != "99999") {
  227. state.list.push(data[k]);
  228. }
  229. }
  230. } else {
  231. if (reset) {
  232. state.list = data;
  233. } else {
  234. state.list = state.list.concat(data);
  235. }
  236. }
  237. if (state.list.length >= state.total || data.length < state.pageSize) {
  238. state.finished = true;
  239. } else {
  240. state.pageNo += 1;
  241. }
  242. state.loading = false;
  243. })
  244. .catch((err) => {
  245. console.log(err);
  246. state.loading = false;
  247. });
  248. };
  249. const flag = ref("0");
  250. const choose = (i, item) => {
  251. console.log(item);
  252. // 4 卡签续签 5: 挂失解挂 36:黑名单查询 37:回复签约
  253. let pageInfo = titleMap.find(item => item.key == state.type)
  254. let routerParams = {
  255. vehicleId: item.vehicleId
  256. }
  257. if (state.type === '37') {
  258. routerParams = Object.assign(routerParams, {channelSing: 1, from: 37})
  259. }
  260. let paramsStr = objectToQueryString(routerParams)
  261. if (pageInfo && pageInfo.router) {
  262. navTo(`${pageInfo.router}?${paramsStr}`)
  263. } else {
  264. navTo(`/subpackage/after-sale/activation-once-again/vehicle-details?${paramsStr}`)
  265. }
  266. };
  267. const add = () => {
  268. navTo(`/subpackage/after-sale/blacklist-query/addCar`);
  269. };
  270. const search = () => {
  271. if (state.type == "37") {
  272. list(true);
  273. } else {
  274. quanCheckActionTrue(state.vehiclePlate, true);
  275. }
  276. };
  277. </script>
  278. <style lang="scss" scoped>
  279. .flex {
  280. display: flex;
  281. justify-content: center;
  282. }
  283. .selectCar-box {
  284. width: 93%;
  285. height: 100%;
  286. padding: 30rpx;
  287. padding-top: 0;
  288. padding-bottom: 50rpx;
  289. }
  290. .message {
  291. font-size: 26rpx;
  292. margin-left: 6rpx;
  293. }
  294. .search-layout {
  295. .search-box {
  296. margin: 30rpx 30rpx 0rpx 30rpx;
  297. height: 80rpx;
  298. background: #ffffff;
  299. border-radius: 40rpx;
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. box-sizing: border-box;
  304. flex: 1;
  305. }
  306. .search-box .icon {
  307. width: 48rpx;
  308. height: 48rpx;
  309. margin: 0 20rpx;
  310. }
  311. .search-box .search {
  312. flex: 1;
  313. margin-right: 20rpx;
  314. height: 100%;
  315. padding: 0 10rpx;
  316. font-size: 28rpx;
  317. }
  318. .search-btn {
  319. color: white;
  320. background-color: #00b38b;
  321. width: 140rpx;
  322. height: 75rpx;
  323. line-height: 75rpx;
  324. font-size: 32rpx;
  325. border-radius: 40rpx;
  326. text-align: center;
  327. margin-right: 30rpx;
  328. margin-top: 30rpx;
  329. }
  330. }
  331. .title {
  332. font-weight: 400;
  333. font-size: 34rpx;
  334. color: #01243a;
  335. margin: 30rpx 30rpx 0rpx 30rpx;
  336. }
  337. .list {
  338. background: #ffffff;
  339. border-radius: 12rpx;
  340. border: 1px solid #ffffff;
  341. width: 98%;
  342. margin: 30rpx auto;
  343. padding: 20rpx;
  344. box-sizing: border-box;
  345. display: flex;
  346. align-items: center;
  347. .content {
  348. font-weight: 400;
  349. width: 76%;
  350. margin-left: 20rpx;
  351. .content-top {
  352. margin-bottom: 20rpx;
  353. .vehiclePlate {
  354. font-size: 30rpx;
  355. color: #01243a;
  356. }
  357. }
  358. .content-time {
  359. font-size: 26rpx;
  360. color: #999999;
  361. }
  362. }
  363. .yanse-out{
  364. position: relative;
  365. }
  366. .yanse {
  367. position: absolute;
  368. background: red;
  369. color: white;
  370. border-radius: 15rpx 0 15rpx 0;
  371. text-align: center;
  372. font-size: 24rpx;
  373. top: 0;
  374. left: 0;
  375. padding: 2rpx 6rpx;
  376. background-color: rgb(56,139,252);
  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>