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

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