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.

equity-list.vue 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="selectCar-box">
  3. <view v-if="state.list&&state.list.length>0" class="item" v-for="(item,i) in state.list" :key="i">
  4. <view class="iten-left">
  5. <view>权益名称:{{item.productName}}</view>
  6. <view>权益金额:{{item.discountPrice * 0.01}}</view>
  7. </view>
  8. </view>
  9. <view style="text-align: center;margin: 20rpx;font-size: 30rpx;" v-if="state.flags">我是有底线的~</view>
  10. <view v-else>
  11. <empty title='暂无权益记录' />
  12. </view>
  13. </view>
  14. </template>
  15. <script lang="ts" setup>
  16. import empty from "@/components/empty/empty.vue";
  17. import {
  18. reactive,
  19. ref
  20. } from "vue"
  21. import {
  22. msg,
  23. navTo
  24. } from "@/utils/utils"
  25. import {
  26. onLoad, onReachBottom
  27. } from "@dcloudio/uni-app";
  28. import {
  29. showEquityListApi
  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. list: [],//车辆list,
  43. equtyId: "",//权益id
  44. flags: false,
  45. pageSize: 1,
  46. pageNo: 10
  47. });
  48. const flag = ref('0') //默认选择0
  49. onLoad((option) => {
  50. showEquityListRequest()
  51. });
  52. const showEquityListRequest = () => {
  53. const options = {
  54. type: 2,
  55. data: {
  56. "openId": getItem(StorageKeys.OpenId),
  57. "pageNo": state.pageNo,
  58. "pageSize": state.pageSize,
  59. },
  60. method: 'POST',
  61. showLoading: true,
  62. }
  63. request(showEquityListApi, options).then((res) => {
  64. const data = stringToJson(res.bizContent);
  65. console.log("购买2", data.data)
  66. state.list = data.data
  67. })
  68. }
  69. // 触底加载
  70. onReachBottom(() => {
  71. if (state.list.length < state.pageSize * 10) return state.flags = true
  72. console.log("触底了")
  73. state.pageSize++
  74. showEquityListRequest()
  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. .selectCar-box {
  86. padding: 30rpx;
  87. .item {
  88. padding: 0 20rpx;
  89. display: flex;
  90. justify-content: space-between;
  91. align-items: center;
  92. height: 130rpx;
  93. background: #FFFFFF;
  94. box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8);
  95. border-radius: 20rpx;
  96. margin-bottom: 30rpx;
  97. .iten-left {
  98. align-items: center;
  99. font-size: 30rpx;
  100. text {
  101. margin-left: 20rpx;
  102. font-size: 32rpx;
  103. font-family: Noto Sans S Chinese;
  104. font-weight: 400;
  105. color: #333333;
  106. }
  107. }
  108. .choose-item {
  109. width: 44rpx;
  110. height: 44rpx;
  111. background: #FFFFFF;
  112. border: 2rpx solid #00B38B;
  113. border-radius: 50%;
  114. margin-right: 20rpx;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. box-sizing: content-box;
  119. }
  120. .active {
  121. width: 34rpx;
  122. height: 34rpx;
  123. background: #00B38B;
  124. border-radius: 50%;
  125. }
  126. }
  127. }
  128. </style>