index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="activity-box">
  3. <view class="activity_header"
  4. :style="{'background-image':`url(${urlDomain+'crmebimage/presets/group_list_bg.png'})`}">
  5. <view class='cart_nav'>
  6. <nav-bar navTitle="拼团列表" iconColor='#fff' :backgroundColor="backgroundColor"
  7. :isBackgroundColor="isBackgroundColor" ref="navBarRef"></nav-bar>
  8. </view>
  9. </view>
  10. <view class="list-box" :style="{'z-index':listZindex}" @touchstart="touchStart">
  11. <view class="list-item" v-for="(item, index) in groupGood" :key="index">
  12. <view class="group-bottom acea-row row-between" @click="toGroupDeatil(item)">
  13. <view class="group-bottom-left">
  14. <view class="img acea-row row-center row-middle relative">
  15. <view v-show="item.quota===0" class="sellOut">已售罄</view>
  16. <easy-loadimage :image-src="item.imageUrl" width="240rpx" height="240rpx"
  17. :radius="10"></easy-loadimage>
  18. <!-- <image :src="item.imageUrl" mode=""></image> -->
  19. </view>
  20. </view>
  21. <view class="group-bottom-right acea-row row-column row-between">
  22. <view class="right-top">
  23. <view class="title line2">
  24. {{item.productName}}
  25. </view>
  26. <view class="pink acea-row">
  27. <view class="people">{{item.buyCount}}人团</view>
  28. <view class="groupNum">已拼{{item.latestBuyCount}}份</view>
  29. </view>
  30. </view>
  31. <view class="right-bottom acea-row row-between">
  32. <view class="price">
  33. <view class="pinkNum"><text class="pinkNum-title">拼团价</text>
  34. <priceStyle :price="item.activePrice"></priceStyle>
  35. </view>
  36. <view class="num regular num-icon">¥{{item.price}}</view>
  37. </view>
  38. <view class="btnBox">
  39. <view class="btn">参与拼团</view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <emptyPage :mTop="'30%'" v-if="groupGood.length==0" title="暂无拼团商品,去看看其他商品吧~~"
  46. :imgSrc="urlDomain+'crmebimage/presets/noActivity.png'"></emptyPage>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import {
  52. silenceBindingSpread,
  53. getUserSpread
  54. } from '@/utils/index.js';
  55. import navBar from '@/components/navBar';
  56. import priceStyle from '@/components/priceStyle'
  57. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  58. import {
  59. groupBuySkuListApi,
  60. groupbuyMerchantListApi
  61. } from '@/api/group';
  62. import {
  63. mapGetters
  64. } from "vuex";
  65. import emptyPage from '@/components/emptyPage.vue'
  66. import useActivity from "@/mixins/useActivity";
  67. import onShare from "@/mixins/onShare";
  68. let app = getApp();
  69. export default {
  70. mixins: [useActivity,onShare],
  71. computed: mapGetters(['isLogin', 'uid', 'globalData']),
  72. components: {
  73. navBar,
  74. priceStyle,
  75. easyLoadimage,
  76. emptyPage
  77. },
  78. data() {
  79. return {
  80. urlDomain: this.$Cache.get("imgHost"),
  81. theme: this.$Cache.get("theme"),
  82. backgroundColor: 'transparent',
  83. isBackgroundColor: false,
  84. listZindex: 99,
  85. where: {
  86. page: 1,
  87. limit: 10,
  88. merId: ''
  89. },
  90. loadend: false,
  91. loading: false,
  92. loadTitle: '加载更多',
  93. groupGood: [],
  94. merId: 0, //商户id
  95. title: '拼团列表'
  96. }
  97. },
  98. onLoad(options) {
  99. //分销码
  100. getUserSpread(options);
  101. if (options.merId) {
  102. this.merId = Number(options.merId)
  103. this.where.merId = this.merId
  104. }
  105. this.getGroupList()
  106. },
  107. onShow() {
  108. //分销绑定
  109. silenceBindingSpread(this.isLogin, this.globalData.spread);
  110. },
  111. onPageScroll(object) {
  112. if (object.scrollTop > 200) {
  113. this.pageScrollStatus = true;
  114. } else if (object.scrollTop < 200) {
  115. this.pageScrollStatus = false;
  116. }
  117. uni.$emit('scroll');
  118. },
  119. methods: {
  120. //滚动
  121. touchStart() {
  122. this.$refs.navBarRef.currentPage = false;
  123. },
  124. //拼团商品列表
  125. getGroupList() {
  126. if (this.loadend) return;
  127. if (this.loading) return;
  128. this.loading = true;
  129. if (this.merId != 0) {
  130. groupbuyMerchantListApi(this.where).then(res => {
  131. let list = res.data.list;
  132. let limit = this.where.limit;
  133. this.where.page++;
  134. this.loadend = limit > list.length;
  135. this.groupGood = this.groupGood.concat(list);
  136. this.loading = false;
  137. this.loadTitle = this.loadend ? '没有更多内容啦~' : '加载更多';
  138. }).catch(err => {
  139. this.loading = false;
  140. this.loadTitle = '加载更多';
  141. return this.$util.Tips({
  142. title: err
  143. });
  144. })
  145. } else {
  146. groupBuySkuListApi(this.where).then(res => {
  147. let list = res.data;
  148. let limit = this.where.limit;
  149. this.where.page++;
  150. this.loadend = limit > list.length;
  151. this.groupGood = this.groupGood.concat(list);
  152. this.loading = false;
  153. this.loadTitle = this.loadend ? '没有更多内容啦~' : '加载更多';
  154. }).catch(err => {
  155. this.loading = false;
  156. this.loadTitle = '加载更多';
  157. return this.$util.Tips({
  158. title: err
  159. });
  160. })
  161. }
  162. },
  163. //to拼团详情
  164. toGroupDeatil(item) {
  165. uni.navigateTo({
  166. url: `/pages/goods/goods_details/index?id=${item.productId}&mt=2&gd=${item.groupActivityId}`
  167. })
  168. },
  169. onReachBottom() {
  170. this.getGroupList();
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. @import "../static/css/activity.scss";
  177. .num-icon,
  178. .icon-num {
  179. font-size: 24rpx !important;
  180. line-height: 32rpx !important;
  181. margin-top: 12rpx !important;
  182. }
  183. .empty-box {
  184. padding-top: 30% !important;
  185. }
  186. </style>