pointsList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view>
  3. <uv-navbar title="我的积分" placeholder autoBack></uv-navbar>
  4. <view class="points-main">
  5. <view class="points-main-item" v-for="v in pointsList" :key="v.id">
  6. <image class="item-img" v-if="v.businessVo && v.businessVo.image" :src="v.businessVo.image" alt="" />
  7. <view class="item-info">
  8. <view class="item-name" v-if="v.businessVo">{{ v.businessVo.businessName }}</view>
  9. <view class="item-address">
  10. <text class="iconfont">&#xe990;</text>
  11. <text class="address" v-if="v.businessVo">{{ v.businessVo.address }}</text>
  12. </view>
  13. <view class="item-integral">
  14. <text>剩余积分:</text>
  15. <text class="integral">{{ v.integralAble }}</text>
  16. </view>
  17. <view class="item-more">
  18. <view class="item-more-text" @click="itemClick(v)">积分明细</view>
  19. </view>
  20. </view>
  21. </view>
  22. <noData v-if="pointsList.length == 0" :config="{ top: 2, content: '暂无数据~' }"></noData>
  23. <loadMore v-if="pointsList.length > 0" :status="status"></loadMore>
  24. </view>
  25. </view>
  26. </template>
  27. <script setup>
  28. import { ref } from "vue";
  29. import { onLoad, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
  30. import { userBusinessRolePage_Api } from "@/api/userInfo";
  31. const params = ref({ pageNum: 1, pageSize: 15 });
  32. const pointsList = ref([]);
  33. const status = ref("loading");
  34. // 获取店铺积分
  35. const getList = () => {
  36. status.value = "loading";
  37. uni.showLoading({
  38. title: "加载中...",
  39. mask: true,
  40. });
  41. userBusinessRolePage_Api(params.value)
  42. .then((res) => {
  43. uni.hideLoading();
  44. if (res && res.code == 200) {
  45. uni.stopPullDownRefresh();
  46. pointsList.value = pointsList.value.concat(res.rows);
  47. if (res.total <= pointsList.value.length) {
  48. status.value = "noMore";
  49. } else {
  50. status.value = "more";
  51. }
  52. }
  53. })
  54. .catch((err) => {
  55. uni.hideLoading();
  56. });
  57. };
  58. const itemClick = (v) => {
  59. uni.navigateTo({
  60. url: `/pages/user/pointsDetails?id=${v.id}`,
  61. });
  62. };
  63. onLoad((options) => {
  64. console.log(options);
  65. params.value.pageNum = 1;
  66. pointsList.value = [];
  67. getList();
  68. });
  69. onReachBottom(() => {
  70. if (status.value !== "loading" && status.value !== "noMore") {
  71. params.value.pageNum++;
  72. getList();
  73. }
  74. });
  75. onPullDownRefresh(() => {
  76. params.value.pageNum = 1;
  77. pointsList.value = [];
  78. getList();
  79. });
  80. </script>
  81. <style>
  82. page{
  83. background: #f7f7f7;
  84. }
  85. </style>
  86. <style lang="scss" scoped>
  87. .points-main {
  88. padding: 30rpx;
  89. background: #f7f7f7;
  90. // min-height: 100vh;
  91. box-sizing: border-box;
  92. .points-main-item {
  93. display: flex;
  94. background: #ffffff;
  95. border-radius: 20rpx;
  96. padding: 30rpx 20rpx;
  97. margin-bottom: 30rpx;
  98. .item-img {
  99. width: 210rpx;
  100. height: 210rpx;
  101. border-radius: 10rpx;
  102. flex-shrink: 0;
  103. }
  104. .item-info {
  105. flex: 1;
  106. padding-left: 30rpx;
  107. .item-name {
  108. font-size: 28rpx;
  109. font-weight: 700;
  110. }
  111. .item-address {
  112. font-size: 24rpx;
  113. color: #999999;
  114. margin: 6rpx 0;
  115. }
  116. .item-integral {
  117. font-size: 26rpx;
  118. .integral {
  119. color: #ff8000;
  120. }
  121. }
  122. .item-more {
  123. text-align: right;
  124. margin-top: 20rpx;
  125. .item-more-text {
  126. display: inline-block;
  127. width: 165rpx;
  128. height: 60rpx;
  129. line-height: 60rpx;
  130. background: #eb5153;
  131. border-radius: 30rpx;
  132. text-align: center;
  133. font-size: 24rpx;
  134. color: #ffffff;
  135. }
  136. }
  137. }
  138. }
  139. }
  140. </style>