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

select-car.vue 10KB

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