国外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.

204 lines
4.1 KiB

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.points }}积分</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.favoriteTime }}</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. <!-- 操作菜单 -->
  39. <uv-action-sheet :show="showActionSheet" :actions="actions" @close="showActionSheet = false" @select="onActionSelect"></uv-action-sheet>
  40. </view>
  41. </template>
  42. <script>
  43. export default {
  44. data() {
  45. return {
  46. showActionSheet: false,
  47. actions: [
  48. { name: '清空收藏', color: '#ff4757' }
  49. ],
  50. favoritesList: [
  51. {
  52. id: 1,
  53. title: '咖啡之魅惑调制饮料袋装咖啡内容学生小礼品',
  54. image: '/static/商城_商品1.png',
  55. points: 100,
  56. favoriteTime: '2025-06-12 14:30:12'
  57. },
  58. {
  59. id: 2,
  60. title: '咖啡之魅惑调制饮料袋装咖啡内容学生小礼品',
  61. image: '/static/商城_商品2.png',
  62. points: 100,
  63. favoriteTime: '2025-06-12 14:30:12'
  64. },
  65. {
  66. id: 3,
  67. title: '咖啡之魅惑调制饮料袋装咖啡内容学生小礼品',
  68. image: '/static/商城_商品1.png',
  69. points: 100,
  70. favoriteTime: '2025-06-12 14:30:12'
  71. },
  72. {
  73. id: 4,
  74. title: '咖啡之魅惑调制饮料袋装咖啡内容学生小礼品',
  75. image: '/static/商城_商品2.png',
  76. points: 100,
  77. favoriteTime: '2025-06-12 14:30:12'
  78. }
  79. ]
  80. }
  81. },
  82. methods: {
  83. // 查看商品详情
  84. viewGoodsDetail(item) {
  85. uni.navigateTo({
  86. url: `/subPages/shop/goodsDetail?id=${item.id}`
  87. })
  88. },
  89. // 操作菜单选择
  90. onActionSelect(item) {
  91. if (item.name === '清空收藏') {
  92. uni.showModal({
  93. title: '提示',
  94. content: '确定要清空所有收藏商品吗?',
  95. success: (res) => {
  96. if (res.confirm) {
  97. this.favoritesList = []
  98. uni.showToast({
  99. title: '已清空收藏',
  100. icon: 'success'
  101. })
  102. }
  103. }
  104. })
  105. }
  106. this.showActionSheet = false
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .page {
  113. background-color: #f5f5f5;
  114. min-height: 100vh;
  115. }
  116. .content {
  117. padding: 0;
  118. }
  119. .list {
  120. padding: 20rpx;
  121. }
  122. .record-item {
  123. display: flex;
  124. align-items: flex-start;
  125. margin-bottom: 30rpx;
  126. background: #fff;
  127. border-radius: 12rpx;
  128. padding: 20rpx;
  129. }
  130. .record-image {
  131. width: 215rpx;
  132. height: 215rpx;
  133. border-radius: 8rpx;
  134. margin-right: 20rpx;
  135. flex-shrink: 0;
  136. }
  137. .record-content {
  138. flex: 1;
  139. display: flex;
  140. flex-direction: column;
  141. }
  142. .record-info {
  143. display: flex;
  144. flex-direction: column;
  145. margin-bottom: 20rpx;
  146. }
  147. .title-row {
  148. margin-bottom: 10rpx;
  149. }
  150. .record-title {
  151. font-size: 22rpx;
  152. color: #000;
  153. line-height: 1.4;
  154. display: -webkit-box;
  155. -webkit-box-orient: vertical;
  156. -webkit-line-clamp: 2;
  157. overflow: hidden;
  158. }
  159. .record-points {
  160. display: flex;
  161. align-items: center;
  162. margin-bottom: 8rpx;
  163. }
  164. .points-text {
  165. font-size: 26rpx;
  166. color: #218cdd;
  167. font-weight: bold;
  168. margin-left: 6rpx;
  169. }
  170. .record-time {
  171. display: flex;
  172. align-items: center;
  173. }
  174. .time-text {
  175. font-size: 22rpx;
  176. color: #999;
  177. margin-left: 6rpx;
  178. }
  179. .record-action {
  180. display: flex;
  181. justify-content: flex-end;
  182. border-top: 1rpx solid #f0f0f0;
  183. }
  184. .empty {
  185. margin-top: 200rpx;
  186. }
  187. </style>