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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. const state = reactive({
  54. customerIdNum: "",
  55. list: [] //车辆list
  56. });
  57. const flag = ref('0') //默认选择0
  58. onLoad(() => {
  59. getUserinfo()
  60. });
  61. const choose = (i, item) => {
  62. console.log("item", item)
  63. flag.value = i
  64. uni.navigateTo({
  65. url: `/subpackage/after-sale/progress-query/progress-query-business?vehiclePlate=${item.vehiclePlate}&vehiclePlateColor=${item.vehiclePlateColor}`
  66. })
  67. }
  68. const getUserinfo = () => {
  69. const options = {
  70. type: 2,
  71. data: { openId: getItem('openId') },
  72. method: "POST",
  73. showLoading: true,
  74. };
  75. request(getUserMsg, options).then((res) => {
  76. const data = stringToJson(res.bizContent);
  77. console.log(data, "用户信息");
  78. state.customerIdNum = data.customerIdNum
  79. searchVehicleInfoQuery()
  80. });
  81. }
  82. const searchVehicleInfoQuery = () => {
  83. const options = {
  84. type: 2,
  85. data: {
  86. customerIdNum: state.customerIdNum
  87. },
  88. method: "POST",
  89. showLoading: true,
  90. };
  91. request(searchVehicleInfo, options).then((res) => {
  92. const data = stringToJson(res.bizContent);
  93. console.log(data, "车辆信息");
  94. state.list = data.vehicles
  95. });
  96. }
  97. </script>
  98. <style>
  99. page {
  100. width: 100%;
  101. height: 100%;
  102. background-color: #EEF7F7;
  103. }
  104. </style>
  105. <style lang="scss" scoped>
  106. .flex {
  107. display: flex;
  108. justify-content: center;
  109. }
  110. .selectCar-box {
  111. // width: 100%;
  112. height: 100%;
  113. padding: 30rpx;
  114. .item {
  115. padding: 20rpx;
  116. display: flex;
  117. justify-content: space-between;
  118. align-items: center;
  119. // height: 130rpx;
  120. background: #FFFFFF;
  121. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  122. border-radius: 20rpx;
  123. margin-bottom: 30rpx;
  124. .iten-left {
  125. display: flex;
  126. align-items: center;
  127. image {
  128. width: 150rpx;
  129. height: 90rpx;
  130. }
  131. text {
  132. margin-left: 20rpx;
  133. font-size: 32rpx;
  134. font-family: Noto Sans S Chinese;
  135. font-weight: 400;
  136. color: #333333;
  137. }
  138. }
  139. .choose-item {
  140. width: 44rpx;
  141. height: 44rpx;
  142. background: #FFFFFF;
  143. border: 2rpx solid #00B38B;
  144. border-radius: 50%;
  145. margin-right: 20rpx;
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. box-sizing: content-box;
  150. }
  151. .active {
  152. width: 34rpx;
  153. height: 34rpx;
  154. background: #00B38B;
  155. border-radius: 50%;
  156. }
  157. }
  158. }
  159. .message{
  160. font-size: 26rpx;
  161. margin-left: 6rpx;
  162. }
  163. </style>