Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

select-card.vue 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="selectCar-box">
  3. <view v-if="state.cards.length>0" @click="choose(i,item)" class="item" v-for="(item,i) in state.cards" :key="i">
  4. <view class="iten-left">
  5. <image :src="`${$imgUrl}card2.png`" mode=""></image>
  6. <text>{{item.cardId}}</text>
  7. </view>
  8. <view class="choose-item">
  9. <view class="active" v-if="flag==i">
  10. </view>
  11. </view>
  12. </view>
  13. <view v-else class="flex">
  14. 暂无该车辆卡信息
  15. </view>
  16. </view>
  17. </template>
  18. <script setup>
  19. import {
  20. reactive,
  21. ref
  22. } from "vue"
  23. import {
  24. navTo
  25. } from "@/utils/utils"
  26. import {
  27. onLoad,
  28. onShow
  29. } from "@dcloudio/uni-app";
  30. import {
  31. cardList,
  32. } from "@/utils/network/api.js";
  33. import {
  34. request
  35. } from "@/utils/network/request.js";
  36. import {
  37. msg
  38. } from "@/utils/utils";
  39. import {
  40. getItem,
  41. StorageKeys,
  42. setItem
  43. } from "@/utils/storage";
  44. import {
  45. stringToJson
  46. } from "@/utils/network/encryption";
  47. const state = reactive({
  48. cards: [],
  49. });
  50. onLoad((option) => {
  51. getCardList(option.vehicleId)
  52. });
  53. const flag = ref('0')
  54. const choose = (i, item) => {
  55. console.log(item, i)
  56. console.log(item.vehicleId);
  57. navTo(`/subpackage/personal-center/search/etcFlowingWater?cardId=${item.cardId}`)
  58. }
  59. const getCardList = (vehicleId) => {
  60. var data = {
  61. vehicleId: vehicleId
  62. };
  63. const options = {
  64. type: 2,
  65. data: data,
  66. method: "POST",
  67. showLoading: true,
  68. };
  69. request(cardList, options).then((res) => {
  70. console.log("152", stringToJson(res.bizContent))
  71. let result = stringToJson(res.bizContent);
  72. state.cards = result.data ? result.data : null;
  73. console.log(result.data);
  74. })
  75. }
  76. </script>
  77. <style>
  78. page {
  79. width: 100%;
  80. height: 100%;
  81. background-color: #EEF7F7;
  82. }
  83. </style>
  84. <style lang="scss" scoped>
  85. .flex {
  86. display: flex;
  87. justify-content: center;
  88. }
  89. .selectCar-box {
  90. // width: 100%;
  91. height: 100%;
  92. padding: 30rpx;
  93. .item {
  94. padding: 20rpx;
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. height: 130rpx;
  99. background: #FFFFFF;
  100. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  101. border-radius: 20rpx;
  102. margin-bottom: 30rpx;
  103. .iten-left {
  104. display: flex;
  105. align-items: center;
  106. image {
  107. width: 150rpx;
  108. height: 120rpx;
  109. }
  110. text {
  111. margin-left: 20rpx;
  112. font-size: 32rpx;
  113. font-family: Noto Sans S Chinese;
  114. font-weight: 400;
  115. color: #333333;
  116. }
  117. }
  118. .choose-item {
  119. width: 44rpx;
  120. height: 44rpx;
  121. background: #FFFFFF;
  122. border: 2rpx solid #00B38B;
  123. border-radius: 50%;
  124. margin-right: 20rpx;
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. box-sizing: content-box;
  129. }
  130. .active {
  131. width: 34rpx;
  132. height: 34rpx;
  133. background: #00B38B;
  134. border-radius: 50%;
  135. }
  136. }
  137. }
  138. </style>