Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

select-car.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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 === '36') {
  295. uni.navigateTo({
  296. url: `/subpackage/after-sale/blacklist-query/list?vehicleId=${item.vehicleId}`,
  297. });
  298. } else if (state.type === '37') {
  299. uni.navigateTo({
  300. url: `/subpackage/orders/sign-up?vehicleId=${item.vehicleId}&channelSing=1&from=37`,
  301. });
  302. } else {
  303. // 跳转到车辆详情页面,携带item.vehicleId参数
  304. uni.navigateTo({
  305. url: `/subpackage/after-sale/activation-once-again/vehicle-details?id=${item.vehicleId}`,
  306. });
  307. }
  308. };
  309. const add = () => {
  310. navTo(`/subpackage/after-sale/blacklist-query/addCar`);
  311. };
  312. const search = () => {
  313. console.log(1112222, state.type);
  314. if (state.type == "37") {
  315. list(true);
  316. } else {
  317. console.log(111, state.type);
  318. quanCheckActionTrue(state.vehiclePlate, true);
  319. }
  320. };
  321. </script>
  322. <style lang="scss" scoped>
  323. .flex {
  324. display: flex;
  325. justify-content: center;
  326. }
  327. .selectCar-box {
  328. width: 93%;
  329. height: 100%;
  330. padding: 30rpx;
  331. padding-top: 0;
  332. padding-bottom: 50rpx;
  333. }
  334. .message {
  335. font-size: 26rpx;
  336. margin-left: 6rpx;
  337. }
  338. .search-layout {
  339. .search-box {
  340. margin: 30rpx 30rpx 0rpx 30rpx;
  341. height: 80rpx;
  342. background: #ffffff;
  343. border-radius: 40rpx;
  344. display: flex;
  345. justify-content: center;
  346. align-items: center;
  347. box-sizing: border-box;
  348. flex: 1;
  349. }
  350. .search-box .icon {
  351. width: 48rpx;
  352. height: 48rpx;
  353. margin: 0 20rpx;
  354. }
  355. .search-box .search {
  356. flex: 1;
  357. margin-right: 20rpx;
  358. height: 100%;
  359. padding: 0 10rpx;
  360. font-size: 28rpx;
  361. }
  362. .search-btn {
  363. color: white;
  364. background-color: #00b38b;
  365. width: 140rpx;
  366. height: 75rpx;
  367. line-height: 75rpx;
  368. font-size: 32rpx;
  369. border-radius: 40rpx;
  370. text-align: center;
  371. margin-right: 30rpx;
  372. margin-top: 30rpx;
  373. }
  374. }
  375. .title {
  376. font-weight: 400;
  377. font-size: 34rpx;
  378. color: #01243a;
  379. margin: 30rpx 30rpx 0rpx 30rpx;
  380. }
  381. .list {
  382. background: #ffffff;
  383. border-radius: 12rpx;
  384. border: 1px solid #ffffff;
  385. width: 98%;
  386. margin: 30rpx auto;
  387. padding: 20rpx;
  388. box-sizing: border-box;
  389. display: flex;
  390. align-items: center;
  391. .content {
  392. font-weight: 400;
  393. width: 76%;
  394. margin-left: 20rpx;
  395. .content-top {
  396. margin-bottom: 20rpx;
  397. .vehiclePlate {
  398. font-size: 30rpx;
  399. color: #01243a;
  400. }
  401. }
  402. .content-time {
  403. font-size: 26rpx;
  404. color: #999999;
  405. }
  406. }
  407. .yanse {
  408. display: inline-block;
  409. position: relative;
  410. width: 64rpx;
  411. height: 30rpx;
  412. background: red;
  413. color: white;
  414. border-radius: 15rpx 0 15rpx 0;
  415. text-align: center;
  416. line-height: 30rpx;
  417. font-size: 24rpx;
  418. top: -147rpx;
  419. }
  420. .car {
  421. width: 134rpx;
  422. height: 134rpx;
  423. }
  424. .arrow {
  425. width: 18rpx;
  426. height: 34rpx;
  427. }
  428. }
  429. .action {
  430. position: fixed;
  431. bottom: 0rpx;
  432. left: 0;
  433. height: 188rpx;
  434. background-color: #fff;
  435. border-radius: 30rpx 30rpx 0 0;
  436. width: 100vw;
  437. display: flex;
  438. align-items: center;
  439. justify-content: center;
  440. flex-direction: column;
  441. }
  442. </style>