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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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=""></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. orderList
  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. list: [] ,//车辆list,
  46. });
  47. const flag = ref('0') //默认选择0
  48. onLoad((option) => {
  49. quanCheckActionTrue().then((item: any) => {
  50. state.list = item.data
  51. })
  52. console.log("1",option)
  53. });
  54. const quanCheckActionTrue = () => {
  55. var data = {
  56. opId: getItem(StorageKeys.OpenId),
  57. source: 'WECHAT', //渠道为小程序
  58. tabIndex: '0', //0全部
  59. orderStep: '11', //11 为已完成”
  60. };
  61. const options = {
  62. type: 2,
  63. data: data,
  64. method: "POST",
  65. showLoading: true,
  66. };
  67. return new Promise(async (resolve, reject) => {
  68. const res = await request(orderList, options);
  69. const data = stringToJson(res.bizContent);
  70. resolve(data);
  71. }).catch((error) => {
  72. reject(error);
  73. });
  74. }
  75. const choose = (i, item) => {
  76. flag.value = i
  77. navTo(`/pages/recharge/recharge?cardId=${item.cardId}`)
  78. }
  79. </script>
  80. <style>
  81. page {
  82. width: 100%;
  83. height: 100%;
  84. background-color: #EEF7F7;
  85. }
  86. </style>
  87. <style lang="scss" scoped>
  88. .flex {
  89. display: flex;
  90. justify-content: center;
  91. }
  92. .selectCar-box {
  93. // width: 100%;
  94. height: 100%;
  95. padding: 30rpx;
  96. .item {
  97. padding: 20rpx;
  98. display: flex;
  99. justify-content: space-between;
  100. align-items: center;
  101. height: 130rpx;
  102. background: #FFFFFF;
  103. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  104. border-radius: 20rpx;
  105. margin-bottom: 30rpx;
  106. .iten-left {
  107. display: flex;
  108. align-items: center;
  109. image {
  110. width: 150rpx;
  111. height: 90rpx;
  112. }
  113. text {
  114. margin-left: 20rpx;
  115. font-size: 32rpx;
  116. font-family: Noto Sans S Chinese;
  117. font-weight: 400;
  118. color: #333333;
  119. }
  120. }
  121. .choose-item {
  122. width: 44rpx;
  123. height: 44rpx;
  124. background: #FFFFFF;
  125. border: 2rpx solid #00B38B;
  126. border-radius: 50%;
  127. margin-right: 20rpx;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. box-sizing: content-box;
  132. }
  133. .active {
  134. width: 34rpx;
  135. height: 34rpx;
  136. background: #00B38B;
  137. border-radius: 50%;
  138. }
  139. }
  140. }
  141. </style>