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 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="selectCar-box">
  3. <view v-if="state.list&&state.list.length>0" @click="choose(i,item)" class="item" v-for="(item,i) in state.list"
  4. :key="i">
  5. <view class="iten-left">
  6. <image :src="`${$imgUrl}che.png`" mode="aspectFill"></image>
  7. <view class="message">
  8. <view>车牌号:{{ item.vehiclePlate }}</view>
  9. <view>车牌颜色:{{ getVehiclePlateColor(item.vehiclePlateColor) }}</view>
  10. <view v-if="item.cardId">卡号:{{ item.cardId }}</view>
  11. <view v-if="item.cardStatus">卡状态:{{getCodeName('CARD_STATE_TYPE',item.cardStatus)}}</view>
  12. <view v-if="item.obuId">签号:{{ item.obuId }}</view>
  13. <view v-if="item.obuStatus">签状态:{{ getCodeName('OBU_STATE_TYPE',item.obuStatus) }}</view>
  14. </view>
  15. </view>
  16. <view class="choose-item">
  17. <view class="active" v-if="flag==i">
  18. </view>
  19. </view>
  20. </view>
  21. <view v-else>
  22. <empty title='暂无找到相关车辆信息' />
  23. </view>
  24. </view>
  25. </template>
  26. <script lang="ts" setup>
  27. import empty from "@/components/empty/empty.vue";
  28. import {
  29. reactive,
  30. ref
  31. } from "vue"
  32. import {
  33. onLoad,
  34. } from "@dcloudio/uni-app";
  35. import {
  36. getUserMsg, searchVehicleInfo
  37. } from "@/utils/network/api.js";
  38. import {
  39. request
  40. } from "@/utils/network/request.js";
  41. import {
  42. getItem
  43. } from "@/utils/storage";
  44. import {
  45. stringToJson
  46. } from "@/utils/network/encryption";
  47. import {
  48. getCodeName
  49. } from "@/datas/queryKey.js";
  50. import {
  51. getVehiclePlateColor
  52. } from "@/datas/vehiclePlateColor";
  53. import {interceptND} from "@/utils/utils";
  54. const state = reactive({
  55. customerIdNum: "",
  56. list: [] //车辆list
  57. });
  58. const flag = ref('0') //默认选择0
  59. onLoad(() => {
  60. getUserinfo()
  61. });
  62. const choose = (i, item) => {
  63. interceptND(item.vehicleId).then(()=>{
  64. console.log("item", item)
  65. flag.value = i
  66. uni.navigateTo({
  67. url: `/subpackage/after-sale/progress-query/progress-query-business?vehiclePlate=${item.vehiclePlate}&vehiclePlateColor=${item.vehiclePlateColor}`
  68. })
  69. })
  70. }
  71. const getUserinfo = () => {
  72. const options = {
  73. type: 2,
  74. data: { openId: getItem('openId') },
  75. method: "POST",
  76. showLoading: true,
  77. };
  78. request(getUserMsg, options).then((res) => {
  79. const data = stringToJson(res.bizContent);
  80. console.log(data, "用户信息");
  81. state.customerIdNum = data.customerIdNum
  82. searchVehicleInfoQuery()
  83. });
  84. }
  85. const searchVehicleInfoQuery = () => {
  86. const options = {
  87. type: 2,
  88. data: {
  89. customerIdNum: state.customerIdNum
  90. },
  91. method: "POST",
  92. showLoading: true,
  93. };
  94. request(searchVehicleInfo, options).then((res) => {
  95. const data = stringToJson(res.bizContent);
  96. console.log(data, "车辆信息");
  97. state.list = data.vehicles
  98. });
  99. }
  100. </script>
  101. <style>
  102. page {
  103. width: 100%;
  104. height: 100%;
  105. background-color: #EEF7F7;
  106. }
  107. </style>
  108. <style lang="scss" scoped>
  109. .flex {
  110. display: flex;
  111. justify-content: center;
  112. }
  113. .selectCar-box {
  114. // width: 100%;
  115. height: 100%;
  116. padding: 30rpx;
  117. .item {
  118. padding: 20rpx;
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. // height: 130rpx;
  123. background: #FFFFFF;
  124. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  125. border-radius: 20rpx;
  126. margin-bottom: 30rpx;
  127. .iten-left {
  128. display: flex;
  129. align-items: center;
  130. image {
  131. width: 150rpx;
  132. height: 90rpx;
  133. }
  134. text {
  135. margin-left: 20rpx;
  136. font-size: 32rpx;
  137. font-family: Noto Sans S Chinese;
  138. font-weight: 400;
  139. color: #333333;
  140. }
  141. }
  142. .choose-item {
  143. width: 44rpx;
  144. height: 44rpx;
  145. background: #FFFFFF;
  146. border: 2rpx solid #00B38B;
  147. border-radius: 50%;
  148. margin-right: 20rpx;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. box-sizing: content-box;
  153. }
  154. .active {
  155. width: 34rpx;
  156. height: 34rpx;
  157. background: #00B38B;
  158. border-radius: 50%;
  159. }
  160. }
  161. }
  162. .message{
  163. font-size: 26rpx;
  164. margin-left: 6rpx;
  165. }
  166. </style>