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

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