list.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <!-- 拼购列表 -->
  2. <template>
  3. <view class="groupon-wrap">
  4. <view class="group-head u-flex u-row-between">
  5. <text class="group-head__title">爆款推荐</text>
  6. <text class="group-head__notice">省钱省心限时拼</text>
  7. </view>
  8. <view class="group-box">
  9. <view class="goods-item u-m-b-16" v-for="(item, index) in grouponList" :key="item.id" @tap="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })">
  10. <view class="big-goods u-p-20 u-flex u-col-top">
  11. <image v-if="index < 3" class="top-tag" :src="tagMap[index]" mode=""></image>
  12. <image class="goods-img" lazy-load fade-show :src="item.image" mode="aspectFill"></image>
  13. <view class=" card-right u-m-l-20 u-flex-col u-row-between">
  14. <view class="">
  15. <view class="goods-title u-ellipsis-1 u-m-t-10 u-m-b-10">
  16. <view class="title-tag cu-tag bg-orange sm radius u-m-r-10">拼团</view>
  17. {{ item.title }}
  18. </view>
  19. <view v-show="item.subtitle" class="subtitle-text u-m-b-10 u-ellipsis-1">{{ item.subtitle }}</view>
  20. </view>
  21. <view class="u-flex u-m-y-20">
  22. <view class="sell-box">
  23. <text class=" hot-icon iconfont icon-icon-test"></text>
  24. <text class="sell-num">已拼{{ item.sales }}件</text>
  25. </view>
  26. <text class="group-num">{{ item.activity.rules.team_num || 0 }}人团</text>
  27. </view>
  28. <view class=" u-flex u-row-between u-col-center">
  29. <view class="u-flex u-col-bottom font-OPPOSANS">
  30. <view class="price u-m-r-10">{{ item.groupon_price }}</view>
  31. <view class="origin-price">{{ item.original_price }}</view>
  32. </view>
  33. <button class="u-reset-button buy-btn">马上拼</button>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 空白 -->
  39. <shopro-empty
  40. v-if="!grouponList.length && !isLoading"
  41. style="padding-top: 200rpx;"
  42. marginTop="0"
  43. :image="$IMG_URL + '/imgs/empty/empty_goods.png'"
  44. tipText="暂无拼团商品,敬请期待~"
  45. ></shopro-empty>
  46. <!-- 加载更多 -->
  47. </view>
  48. <u-loadmore v-if="grouponList.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. components: {},
  54. data() {
  55. return {
  56. tagMap: {
  57. 0: this.$IMG_URL + '/imgs/group/groupon_top1.png',
  58. 1: this.$IMG_URL + '/imgs/group/groupon_top2.png',
  59. 2: this.$IMG_URL + '/imgs/group/groupon_top3.png'
  60. },
  61. isLoading: true,
  62. loadStatus: 'loadmore', //loadmore:加载前的状态,loading:加载中的状态,nomore:没有更多的状态
  63. lastPage: 1,
  64. currentPage: 1,
  65. grouponList: []
  66. };
  67. },
  68. onLoad() {
  69. this.getGrouponList();
  70. },
  71. onReachBottom() {
  72. this.loadMore();
  73. },
  74. onPullDownRefresh() {
  75. this.currentPage = 1;
  76. this.lastPage = 1;
  77. this.grouponList = [];
  78. this.getGrouponList();
  79. },
  80. computed: {},
  81. methods: {
  82. // 路由跳转
  83. jump(path, parmas) {
  84. this.$Router.push({
  85. path: path,
  86. query: parmas
  87. });
  88. },
  89. // 加载更多
  90. loadMore() {
  91. if (this.currentPage < this.lastPage) {
  92. this.currentPage += 1;
  93. this.getGrouponList();
  94. }
  95. },
  96. // 拼团列表
  97. getGrouponList() {
  98. let that = this;
  99. that.isLoading = true;
  100. that.loadStatus = 'loading';
  101. that.$http('goods.grouponList', {
  102. page: that.currentPage
  103. }).then(res => {
  104. that.isLoading = false;
  105. uni.stopPullDownRefresh();
  106. if (res.code === 1) {
  107. that.grouponList = [...that.grouponList, ...res.data.data];
  108. that.lastPage = res.data.last_page;
  109. that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
  110. }
  111. });
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss">
  117. // 背景
  118. .groupon-wrap {
  119. background: url($IMG_URL+'/imgs/group/group_list_bg.png') no-repeat;
  120. background-size: 100% 374rpx;
  121. }
  122. .group-head {
  123. padding: 0 25rpx;
  124. height: 100rpx;
  125. .group-head__title {
  126. font-size: 32rpx;
  127. font-weight: 500;
  128. color: rgba(255, 255, 255, 1);
  129. }
  130. .group-head__notice {
  131. font-size: 26rpx;
  132. font-weight: 500;
  133. color: rgba(255, 255, 255, 1);
  134. }
  135. }
  136. .group-box {
  137. width: 710rpx;
  138. background: linear-gradient(#fff, #f5f5f5);
  139. border-radius: 20rpx;
  140. margin: 0 auto;
  141. min-height: 800rpx;
  142. .goods-item {
  143. border-radius: 20rpx;
  144. background-color: #fff;
  145. // 大商品卡片
  146. .big-goods {
  147. width: 710rpx;
  148. height: 260rpx;
  149. background: #ffffff;
  150. box-shadow: 0px 7rpx 8rpx 1rpx rgba(254, 76, 29, 0.05);
  151. border-radius: 20rpx;
  152. position: relative;
  153. .goods-img {
  154. width: 220rpx;
  155. height: 220rpx;
  156. border-radius: 6rpx;
  157. }
  158. .top-tag {
  159. position: absolute;
  160. z-index: 3;
  161. top: 20rpx;
  162. left: 20rpx;
  163. width: 84rpx;
  164. height: 36rpx;
  165. }
  166. .card-right {
  167. width: 430rpx;
  168. height: 220rpx;
  169. }
  170. .goods-title {
  171. font-size: 26rpx;
  172. font-weight: 600;
  173. width: 400rpx;
  174. color: #000000;
  175. vertical-align: middle;
  176. }
  177. .subtitle-text {
  178. font-size: 22rpx;
  179. width: 400rpx;
  180. font-weight: 500;
  181. color: #666666;
  182. }
  183. .buy-btn {
  184. width: 120rpx;
  185. line-height: 50rpx;
  186. background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
  187. border-radius: 25rpx;
  188. font-size: 24rpx;
  189. font-weight: 500;
  190. color: #ffffff;
  191. }
  192. // 拼团
  193. .sell-box {
  194. background: rgba(#f9efd6, 0.3);
  195. border-radius: 16rpx;
  196. line-height: 32rpx;
  197. .sell-num {
  198. font-size: 20rpx;
  199. font-weight: 400;
  200. color: #ff6904;
  201. }
  202. .hot-icon {
  203. font-size: 26rpx;
  204. color: #ff6904;
  205. margin-right: 8rpx;
  206. }
  207. }
  208. .group-num {
  209. font-size: 20rpx;
  210. font-weight: 500;
  211. color: rgba(153, 153, 153, 1);
  212. margin-left: 20rpx;
  213. }
  214. // 价格
  215. .price {
  216. color: #ff0000;
  217. font-weight: 600;
  218. &::before {
  219. content: '¥';
  220. font-size: 20rpx;
  221. }
  222. }
  223. .origin-price {
  224. color: #c4c4c4;
  225. font-size: 24rpx;
  226. text-decoration: line-through;
  227. &::before {
  228. content: '¥';
  229. font-size: 20rpx;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>