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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view class="content" v-if="state.list">
  3. <!-- <view class="item" v-for="(item,index) in state.list" :key='index'>
  4. <view class="title">
  5. <view>
  6. <text><text>{{item.productName}}</text>&nbsp;&nbsp;<text>¥{{item.discountPrice * 0.01}}</text></text>
  7. </view>
  8. <text class="add" @click="add(item.equtyId)">加购</text>
  9. </view>
  10. </view> -->
  11. <view v-for="(item, index) in state.list" :key="index" @click="onClick(item)" :data-code="item" class="item"
  12. style="justify-content: flex-start; display: flex; font-size: 28rpx; min-height: 20px; background-color: #22dbc8; color: white; border-radius: 20rpx; padding: 20px; margin: 20px;">
  13. <view style="display: flex; flex-direction: column; flex: 1;">
  14. <text>{{ item.equityName }}</text>
  15. </view>
  16. <view>></view>
  17. </view>
  18. <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
  19. </view>
  20. <view v-else>
  21. <empty title='暂无权益列表' />
  22. </view>
  23. </template>
  24. <script setup lang="ts">
  25. import empty from "@/components/empty/empty.vue";
  26. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  27. import { reactive } from "vue";
  28. import { requestNew } from "@/utils/network/request";
  29. import { msg, navTo } from "@/utils/utils";
  30. import { equitypage } from "@/utils/network/api";
  31. const state = reactive({
  32. list: [], //权益数据
  33. pageNo: 1,
  34. pageSize: 15,
  35. flags: false
  36. })
  37. onLoad((option : any) => {
  38. // 获取全部权益列表
  39. getList();
  40. console.log("option", option)
  41. })
  42. const getList = () => {
  43. const options = {
  44. type: 2,
  45. data: {
  46. "pageNo": state.pageNo,
  47. "pageSize": state.pageSize,
  48. 'status': "ENABLE" //可使用
  49. },
  50. method: 'POST',
  51. showLoading: true,
  52. }
  53. requestNew(equitypage, options).then((res) => {
  54. state.list = [...state.list, ...res.result]
  55. })
  56. }
  57. const add = (equtyId) => {
  58. navTo(`/subpackage/after-sale/add-equity/choice-order?equtyId=${equtyId}`, true)
  59. }
  60. const onClick = (item) => {
  61. const params = encodeURIComponent(JSON.stringify(item))
  62. navTo(`/subpackage/after-sale/add-equity/add-equity-details?params=${params}`, true)
  63. }
  64. // 触底加载
  65. onReachBottom(() => {
  66. if (state.list.length < state.pageNo * 15) return state.flags = true
  67. console.log("触底了")
  68. state.pageNo++
  69. getList()
  70. })
  71. </script>
  72. <style scoped lang="scss">
  73. .content {
  74. width: 100%;
  75. }
  76. .item {
  77. width: 90%;
  78. margin: 20rpx auto;
  79. background-color: rgb(41, 199, 207);
  80. border-radius: 20rpx;
  81. padding: 20rpx;
  82. box-sizing: border-box;
  83. color: white;
  84. font-size: 32rpx;
  85. }
  86. .item>.title {
  87. width: 100%;
  88. display: flex;
  89. justify-content: space-between;
  90. align-items: center;
  91. }
  92. .add {
  93. background: white;
  94. border-radius: 10rpx;
  95. padding: 6rpx 14rpx;
  96. color: #000;
  97. white-space: nowrap;
  98. display: inline-block;
  99. margin-left: 20rpx;
  100. }
  101. .bottom-line {
  102. text-align: center;
  103. margin: 30rpx 0 50rpx 0;
  104. font-size: 32rpx;
  105. padding-bottom: 10rpx;
  106. }
  107. </style>