国外MOSE官网
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.

165 lines
3.0 KiB

2 days ago
17 hours ago
2 days ago
17 hours ago
2 days ago
17 hours ago
2 days ago
17 hours ago
2 days ago
17 hours ago
2 days ago
  1. <template>
  2. <view class="page">
  3. <!-- 收藏列表 -->
  4. <view class="content">
  5. <view v-if="favoritesList.length > 0" class="list">
  6. <view v-for="item in favoritesList" :key="item.id" class="record-item" @click="viewGoodsDetail(item)">
  7. <image class="record-image" :src="item.image" mode="aspectFit"></image>
  8. <view class="record-content">
  9. <view class="record-info">
  10. <view class="title-row">
  11. <text class="record-title">{{ item.title }}</text>
  12. </view>
  13. <view class="record-points">
  14. <uv-icon name="integral" size="16" color="#218cdd"></uv-icon>
  15. <text class="points-text">{{ item.price }}积分</text>
  16. </view>
  17. <view class="record-time">
  18. <uv-icon name="heart-fill" size="14" color="#ff6b6b"></uv-icon>
  19. <text class="time-text">收藏时间{{ item.createTime }}</text>
  20. </view>
  21. </view>
  22. <view class="record-action">
  23. <uv-button
  24. type="primary"
  25. size="small"
  26. text="查看详情"
  27. shape="circle"
  28. @click.stop="viewGoodsDetail(item)"
  29. ></uv-button>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view v-else class="empty">
  35. <uv-empty mode="data" text="暂无收藏商品"></uv-empty>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. favoritesList: [],
  45. pageNo: 1,
  46. pageSize: 10
  47. }
  48. },
  49. methods: {
  50. // 查看商品详情
  51. viewGoodsDetail(item) {
  52. uni.navigateTo({
  53. url: `/subPages/shop/goodsDetail?id=${item.id}`
  54. })
  55. },
  56. // 获取收藏的商品列表
  57. async getGoodsList() {
  58. const res = await this.$api.shop.queryGoodsCollectionList({
  59. pageNo: this.pageNo,
  60. pageSize: this.pageSize
  61. })
  62. this.favoritesList = res.result.records
  63. }
  64. },
  65. async onShow() {
  66. this.initData()
  67. // 刷新收藏列表
  68. await this.getGoodsList()
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .page {
  74. background-color: #f5f5f5;
  75. min-height: 100vh;
  76. }
  77. .content {
  78. padding: 0;
  79. }
  80. .list {
  81. padding: 20rpx;
  82. }
  83. .record-item {
  84. display: flex;
  85. align-items: flex-start;
  86. margin-bottom: 30rpx;
  87. background: #fff;
  88. border-radius: 12rpx;
  89. padding: 20rpx;
  90. }
  91. .record-image {
  92. width: 215rpx;
  93. height: 215rpx;
  94. border-radius: 8rpx;
  95. margin-right: 20rpx;
  96. flex-shrink: 0;
  97. }
  98. .record-content {
  99. flex: 1;
  100. display: flex;
  101. flex-direction: column;
  102. }
  103. .record-info {
  104. display: flex;
  105. flex-direction: column;
  106. margin-bottom: 20rpx;
  107. }
  108. .title-row {
  109. margin-bottom: 10rpx;
  110. }
  111. .record-title {
  112. font-size: 22rpx;
  113. color: #000;
  114. line-height: 1.4;
  115. display: -webkit-box;
  116. -webkit-box-orient: vertical;
  117. -webkit-line-clamp: 2;
  118. overflow: hidden;
  119. }
  120. .record-points {
  121. display: flex;
  122. align-items: center;
  123. margin-bottom: 8rpx;
  124. }
  125. .points-text {
  126. font-size: 26rpx;
  127. color: #218cdd;
  128. font-weight: bold;
  129. margin-left: 6rpx;
  130. }
  131. .record-time {
  132. display: flex;
  133. align-items: center;
  134. }
  135. .time-text {
  136. font-size: 22rpx;
  137. color: #999;
  138. margin-left: 6rpx;
  139. }
  140. .record-action {
  141. display: flex;
  142. justify-content: flex-end;
  143. border-top: 1rpx solid #f0f0f0;
  144. }
  145. .empty {
  146. margin-top: 200rpx;
  147. }
  148. </style>