collection.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="container">
  3. <uv-navbar title="我的收藏" placeholder autoBack></uv-navbar>
  4. <view class="navbar">
  5. <view class="goodsProduct">
  6. <view class="u-flex-center-sb u-mt15 u-flex-warp">
  7. <view
  8. class="item-productsBottom u-mt20"
  9. @click="goProductDetails(item.entityId, item.productPaymentMode)"
  10. v-for="item in goodsList"
  11. :key="item.id"
  12. >
  13. <image class="u-goods336" :src="item.coverImage" mode="aspectFill"></image>
  14. <view class="botbox u-flex-column-start">
  15. <view class="u-text2 u-font24 u-1A1A1A" style="height: 64rpx">
  16. <!-- {{item.title}} -->
  17. <uv-text :lines="2" :text="item.title" color="#1A1A1A" size="24rpx"></uv-text>
  18. </view>
  19. <!-- <view class="u-font20 u-999 u-mt5">已售<text class="u-FF0000">{{item.result_sale_num}}</text>件</view> -->
  20. <view
  21. class="u-font32 u-FF0000 u-bold u-flex-center-sb u-flex1 u-mt10"
  22. v-if="!item.productPaymentMode"
  23. >
  24. <rich-text
  25. :nodes="$mUtil.priceBigSmall(item.minSalePrice)"
  26. ></rich-text>
  27. </view>
  28. <view
  29. class="u-font32 u-FF0000 u-bold u-flex-center-sb u-flex1 u-mt10"
  30. v-else
  31. >
  32. {{ item.minPoints }}积分
  33. </view>
  34. <view
  35. class="u-font22 u-flex-center-sb u-flex1 u-mt10 u-999"
  36. style="width: 100%"
  37. >
  38. <text>已有{{ item.collectNum }}人收藏</text>
  39. <view class="iconfont u-font40" style="color: #fa6138"
  40. >&#xe613;</view
  41. >
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <loadMore
  47. v-if="goodsList && goodsList.length > 0"
  48. :status="status"
  49. ></loadMore>
  50. <noData v-else :config="{ top: 15, content: '暂无商品~' }"></noData>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup>
  56. import { ref } from "vue";
  57. import { onShow, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
  58. import { userCollectPage_Api } from "@/api/shop";
  59. const goodsList = ref([]);
  60. const params = ref({
  61. pageNum: 1,
  62. pageSize: 10,
  63. });
  64. const status = ref("more");
  65. const getList = () => {
  66. userCollectPage_Api(params.value).then((res) => {
  67. if (res && res.code == 200) {
  68. goodsList.value = goodsList.value.concat(res.rows);
  69. if (res.total <= goodsList.value.length) {
  70. status.value = "noMore";
  71. } else {
  72. status.value = "more";
  73. }
  74. }
  75. });
  76. };
  77. // 跳转商品详情
  78. const goProductDetails = (id, type) => {
  79. uni.navigateTo({
  80. url: "/pages/shop/goodsDetails?id=" + id,
  81. });
  82. };
  83. onShow(() => {
  84. params.value.page = 1;
  85. goodsList.value = [];
  86. getList();
  87. });
  88. onReachBottom(() => {
  89. if (status.value === "more") {
  90. status.value = "loading";
  91. params.value.page++;
  92. getList();
  93. }
  94. });
  95. onPullDownRefresh(() => {
  96. params.value.page = 1;
  97. goodsList.value = [];
  98. getList();
  99. uni.stopPullDownRefresh();
  100. });
  101. </script>
  102. <style>
  103. page {
  104. background-color: #f4f4f4;
  105. }
  106. </style>
  107. <style lang="scss" scoped>
  108. .love-color {
  109. width: 40rpx;
  110. height: 40rpx;
  111. }
  112. .goodsProduct {
  113. padding: 0 30rpx 30rpx 30rpx;
  114. }
  115. .item-productsBottom {
  116. background-color: #fff;
  117. border-radius: 16rpx;
  118. overflow: hidden;
  119. width: 336rpx;
  120. margin-bottom: 20rpx;
  121. .botbox {
  122. padding: 15rpx 20rpx;
  123. }
  124. }
  125. .u-goods336 {
  126. height: 267rpx;
  127. }
  128. </style>