You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

select-car.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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 } 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. onLoad((options) => {
  113. console.log("options", options);
  114. state.type = options.type;
  115. if (options.type == "2") {
  116. uni.setNavigationBarTitle({
  117. title: "ETC注销-选择车辆",
  118. });
  119. } else if (options.type == "3") {
  120. uni.setNavigationBarTitle({
  121. title: "更换ETC设备-选择车辆",
  122. });
  123. } else if (options.type == "4") {
  124. uni.setNavigationBarTitle({
  125. title: "卡签续期-选择车辆",
  126. });
  127. } else if (options.type == "5") {
  128. uni.setNavigationBarTitle({
  129. title: "卡签挂失/解除挂失-选择车辆",
  130. });
  131. } else if (options.type == "6") {
  132. uni.setNavigationBarTitle({
  133. title: "增补设备-选择车辆",
  134. });
  135. } else if (options.type == "7") {
  136. uni.setNavigationBarTitle({
  137. title: "补卡补签-选择车辆",
  138. });
  139. } else if (options.type == "8") {
  140. uni.setNavigationBarTitle({
  141. title: "解除挂起-选择车辆",
  142. });
  143. } else if (options.type == "30") {
  144. uni.setNavigationBarTitle({
  145. title: "储值卡转记账卡-选择车辆",
  146. });
  147. } else if (options.type == "31") {
  148. uni.setNavigationBarTitle({
  149. title: "卡pin码解锁-选择车辆",
  150. });
  151. } else if (options.type == "32") {
  152. uni.setNavigationBarTitle({
  153. title: "ETC车牌过户-选择车辆",
  154. });
  155. } else if (options.type == "33") {
  156. uni.setNavigationBarTitle({
  157. title: "卡签停用/卡签启用-选择车辆",
  158. });
  159. } else if (options.type == "34") {
  160. uni.setNavigationBarTitle({
  161. title: "月结单查询-选择车辆",
  162. });
  163. } else if (options.type == "35") {
  164. uni.setNavigationBarTitle({
  165. title: "ETC通行流水-选择车辆",
  166. });
  167. } else if (options.type == "36") {
  168. uni.setNavigationBarTitle({
  169. title: "黑名单查询",
  170. });
  171. } else if (options.type == "37") {
  172. uni.setNavigationBarTitle({
  173. title: "恢复签约-选择车辆",
  174. });
  175. } else if (options.type == "38") {
  176. uni.setNavigationBarTitle({
  177. title: "车辆列表",
  178. });
  179. }
  180. });
  181. onShow(() => {
  182. if (state.type == "37") {
  183. list(true);
  184. } else {
  185. quanCheckActionTrue(state.vehiclePlate, true);
  186. }
  187. });
  188. const getList = () => {
  189. if (state.type == "37") {
  190. list();
  191. } else {
  192. quanCheckActionTrue(state.vehiclePlate);
  193. }
  194. }
  195. const list = (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 customerId = getItem('customerObj');
  204. const options = {
  205. type: 2,
  206. data: {
  207. pageNo: state.pageNo,
  208. pageSize: state.pageSize,
  209. // customerId,
  210. vehiclePlate: state.vehiclePlate,
  211. },
  212. method: "POST",
  213. showLoading: true,
  214. };
  215. return requestNew(rePage, options)
  216. .then((res) => {
  217. const data = res?.result || res?.data || [];
  218. state.total = res.total || 0;
  219. if (reset) {
  220. state.list = data;
  221. } else {
  222. state.list = state.list.concat(data);
  223. }
  224. if (state.list.length >= state.total || data.length < state.pageSize) {
  225. state.finished = true;
  226. } else {
  227. state.pageNo += 1;
  228. }
  229. state.loading = false;
  230. })
  231. .catch(() => {
  232. state.loading = false;
  233. });
  234. };
  235. const quanCheckActionTrue = (vehiclePlate, reset = false) => {
  236. if (reset) {
  237. state.pageNo = 1;
  238. state.list = [];
  239. state.finished = false;
  240. }
  241. if (state.loading || state.finished) return;
  242. state.loading = true;
  243. const options = {
  244. type: 2,
  245. data: {
  246. vehiclePlate,
  247. pageNo: state.pageNo,
  248. pageSize: state.pageSize,
  249. },
  250. method: "POST",
  251. showLoading: true,
  252. };
  253. requestNew(queryVehicleBind, options)
  254. .then((res) => {
  255. const data = res.result;
  256. state.total = res.totalCount || 0;
  257. for (var i = 0; i < data.length; i++) {
  258. for (var j = 0; j < vehiclePlateColorPai.length; j++) {
  259. if (data[i].vehiclePlateColor == vehiclePlateColorPai[j]["id"]) {
  260. data[i].color = vehiclePlateColorPai[j]["color"];
  261. data[i].showColor = vehiclePlateColorPai[j]["showColor"];
  262. }
  263. }
  264. }
  265. console.log("车辆列表", data);
  266. if (state.type == "32") {
  267. for (var k = 0; k < data.length; k++) {
  268. if (data[k]["orderStatus"] != "99999") {
  269. state.list.push(data[k]);
  270. }
  271. }
  272. } else {
  273. if (reset) {
  274. state.list = data;
  275. } else {
  276. state.list = state.list.concat(data);
  277. }
  278. }
  279. if (state.list.length >= state.total || data.length < state.pageSize) {
  280. state.finished = true;
  281. } else {
  282. state.pageNo += 1;
  283. }
  284. state.loading = false;
  285. })
  286. .catch((err) => {
  287. console.log(err);
  288. state.loading = false;
  289. });
  290. };
  291. const flag = ref("0");
  292. const choose = (i, item) => {
  293. console.log(item);
  294. if (state.type === '37') {
  295. uni.navigateTo({
  296. url: `/subpackage/orders/sign-up?vehicleId=${item.vehicleId}&channelSing=1&from=37`,
  297. });
  298. } else {
  299. // 跳转到车辆详情页面,携带item.vehicleId参数
  300. uni.navigateTo({
  301. url: `/subpackage/after-sale/activation-once-again/vehicle-details?id=${item.vehicleId}`,
  302. });
  303. }
  304. };
  305. const add = () => {
  306. navTo(`/subpackage/after-sale/blacklist-query/addCar`);
  307. };
  308. const search = () => {
  309. console.log(1112222, state.type);
  310. if (state.type == "37") {
  311. list(true);
  312. } else {
  313. console.log(111, state.type);
  314. quanCheckActionTrue(state.vehiclePlate, true);
  315. }
  316. };
  317. </script>
  318. <style lang="scss" scoped>
  319. .flex {
  320. display: flex;
  321. justify-content: center;
  322. }
  323. .selectCar-box {
  324. width: 93%;
  325. height: 100%;
  326. padding: 30rpx;
  327. padding-top: 0;
  328. padding-bottom: 50rpx;
  329. }
  330. .message {
  331. font-size: 26rpx;
  332. margin-left: 6rpx;
  333. }
  334. .search-layout {
  335. .search-box {
  336. margin: 30rpx 30rpx 0rpx 30rpx;
  337. height: 80rpx;
  338. background: #ffffff;
  339. border-radius: 40rpx;
  340. display: flex;
  341. justify-content: center;
  342. align-items: center;
  343. box-sizing: border-box;
  344. flex: 1;
  345. }
  346. .search-box .icon {
  347. width: 48rpx;
  348. height: 48rpx;
  349. margin: 0 20rpx;
  350. }
  351. .search-box .search {
  352. flex: 1;
  353. margin-right: 20rpx;
  354. height: 100%;
  355. padding: 0 10rpx;
  356. font-size: 28rpx;
  357. }
  358. .search-btn {
  359. color: white;
  360. background-color: #00b38b;
  361. width: 140rpx;
  362. height: 75rpx;
  363. line-height: 75rpx;
  364. font-size: 32rpx;
  365. border-radius: 40rpx;
  366. text-align: center;
  367. margin-right: 30rpx;
  368. margin-top: 30rpx;
  369. }
  370. }
  371. .title {
  372. font-weight: 400;
  373. font-size: 34rpx;
  374. color: #01243a;
  375. margin: 30rpx 30rpx 0rpx 30rpx;
  376. }
  377. .list {
  378. background: #ffffff;
  379. border-radius: 12rpx;
  380. border: 1px solid #ffffff;
  381. width: 98%;
  382. margin: 30rpx auto;
  383. padding: 20rpx;
  384. box-sizing: border-box;
  385. display: flex;
  386. align-items: center;
  387. .content {
  388. font-weight: 400;
  389. width: 76%;
  390. margin-left: 20rpx;
  391. .content-top {
  392. margin-bottom: 20rpx;
  393. .vehiclePlate {
  394. font-size: 30rpx;
  395. color: #01243a;
  396. }
  397. }
  398. .content-time {
  399. font-size: 26rpx;
  400. color: #999999;
  401. }
  402. }
  403. .yanse {
  404. display: inline-block;
  405. position: relative;
  406. width: 64rpx;
  407. height: 30rpx;
  408. background: red;
  409. color: white;
  410. border-radius: 15rpx 0 15rpx 0;
  411. text-align: center;
  412. line-height: 30rpx;
  413. font-size: 24rpx;
  414. top: -147rpx;
  415. }
  416. .car {
  417. width: 134rpx;
  418. height: 134rpx;
  419. }
  420. .arrow {
  421. width: 18rpx;
  422. height: 34rpx;
  423. }
  424. }
  425. .action {
  426. position: fixed;
  427. bottom: 0rpx;
  428. left: 0;
  429. height: 188rpx;
  430. background-color: #fff;
  431. border-radius: 30rpx 30rpx 0 0;
  432. width: 100vw;
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. flex-direction: column;
  437. }
  438. </style>