index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <view class="w-full bg-top relative" :style="{backgroundImage:headerBg}">
  4. <view class="fixed-lt w-full z-20" :style="{'padding-top': sysHeight + 'px','background': pageScrollStatus ? '#e93323' : 'transparent'}">
  5. <view class="w-full px-20 pl-20 h-80 flex-between-center">
  6. <text class="iconfont icon-ic_leftarrow fs-40 text--w111-fff" @tap="backPage"></text>
  7. <text class="fs-34 fw-500 text--w111-fff">拼团活动</text>
  8. <text></text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="relative rd-t-40rpx bg--w111-f5f5f5 w-full content">
  13. <view class="" v-if="combinationList.length">
  14. <view class="pt-32 pl-20 pr-20">
  15. <view class="card w-full bg--w111-fff rd-24rpx p-20 flex"
  16. v-for="(item,index) in combinationList" :key="index"
  17. @tap="openSubcribe(item)">
  18. <easy-loadimage
  19. mode="widthFix"
  20. :image-src="item.image"
  21. width="240rpx"
  22. height="240rpx"
  23. borderRadius="20rpx"></easy-loadimage>
  24. <view class="flex-1 h-240 pl-20 flex-col justify-between">
  25. <view class="w-full">
  26. <view class="w-full fs-28 lh-40rpx line2">{{item.title}}</view>
  27. <view class="flex fs-20 mt-14">
  28. <view class="tuan-num text--w111-fff flex-center">{{item.people}}人团</view>
  29. <view class="complete font-red flex-center">已拼{{item.pink_count}}份</view>
  30. </view>
  31. </view>
  32. <view class="w-full flex-between-center">
  33. <view>
  34. <view class="flex items-baseline">
  35. <text class="fs-22 lh-30rpx font-red fw-500">拼团价:</text>
  36. <baseMoney :money="item.price" symbolSize="24" integerSize="40" decimalSize="24" color="#e93323" weight></baseMoney>
  37. </view>
  38. <view class="text-line text--w111-999 fs-22 lh-30rpx mt-12">¥{{item.product_price}}</view>
  39. </view>
  40. <view class="w-144 h-56 rd-30rpx flex-center fs-24 bg-gradient text--w111-fff" v-if="item.stock > 0 && item.quota > 0">参与拼团</view>
  41. <view class="w-144 h-56 rd-30rpx flex-center fs-24 bg-gray text--w111-fff" v-else>参与拼团</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="p-20" v-if="!combinationList.length">
  48. <emptyPage title="暂无拼团商品,去看看其他商品吧~" src="/statics/images/noActivity.gif"></emptyPage>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. let sysHeight = uni.getSystemInfoSync().statusBarHeight;
  55. import {
  56. getCombinationList,
  57. getCombinationBannerList,
  58. getPink
  59. } from '@/api/activity.js';
  60. import { openPinkSubscribe } from '@/utils/SubscribeMessage.js';
  61. import {
  62. HTTP_REQUEST_URL
  63. } from '@/config/app';
  64. import emptyPage from '@/components/emptyPage.vue';
  65. let app = getApp();
  66. export default {
  67. data() {
  68. return {
  69. sysHeight:sysHeight,
  70. pinkPeople: [],
  71. pinkCount: 0,
  72. bannerList: [],
  73. circular: true,
  74. autoplay: true,
  75. interval: 3000,
  76. duration: 500,
  77. combinationList: [],
  78. limit: 10,
  79. page: 1,
  80. loading: false,
  81. loadend: false,
  82. isBanner: false,
  83. pageScrollStatus:false,
  84. }
  85. },
  86. components:{ emptyPage },
  87. computed:{
  88. headerBg(){
  89. return 'url('+ HTTP_REQUEST_URL +'/statics/images/product/combination_header.png'+')'
  90. }
  91. },
  92. onPageScroll(object) {
  93. if (object.scrollTop > 130) {
  94. this.pageScrollStatus = true;
  95. } else if (object.scrollTop < 130) {
  96. this.pageScrollStatus = false;
  97. }
  98. uni.$emit('scroll');
  99. },
  100. onLoad() {
  101. uni.setNavigationBarTitle({
  102. title: "拼团列表"
  103. })
  104. this.getCombinationList();
  105. this.getBannerList();
  106. this.getPink();
  107. },
  108. onShow() {
  109. uni.removeStorageSync('form_type_cart');
  110. },
  111. methods: {
  112. getPink: function() {
  113. getPink({
  114. type: 2
  115. }).then(res => {
  116. this.pinkPeople = res.data.avatars;
  117. this.pinkCount = res.data.pink_count;
  118. })
  119. },
  120. getBannerList: function() {
  121. getCombinationBannerList().then(res => {
  122. this.bannerList = res.data;
  123. this.isBanner = true;
  124. })
  125. },
  126. goDetail(item) {
  127. let url = item.link;
  128. this.$util.JumpPath(url);
  129. },
  130. openSubcribe: function(item) {
  131. let page = item;
  132. // #ifndef MP
  133. uni.navigateTo({
  134. url: `/pages/activity/goods_details/index?id=${item.id}&type=3`
  135. });
  136. // #endif
  137. // #ifdef MP
  138. uni.showLoading({
  139. title: '正在加载',
  140. })
  141. openPinkSubscribe().then(res => {
  142. uni.hideLoading();
  143. uni.navigateTo({
  144. url: `/pages/activity/goods_details/index?id=${item.id}&type=3`
  145. });
  146. }).catch(() => {
  147. uni.hideLoading();
  148. });
  149. // #endif
  150. },
  151. getCombinationList: function() {
  152. var that = this;
  153. if (that.loadend) return;
  154. if (that.loading) return;
  155. var data = {
  156. page: that.page,
  157. limit: that.limit
  158. };
  159. this.loading = true
  160. getCombinationList(data).then(function(res) {
  161. var combinationList = that.combinationList;
  162. var limit = that.limit;
  163. that.page++;
  164. that.loadend = limit > res.data.length;
  165. that.combinationList = combinationList.concat(res.data);
  166. that.page = that.data.page;
  167. that.loading = false;
  168. }).catch(() => {
  169. that.loading = false
  170. })
  171. },
  172. backPage(){
  173. uni.navigateBack()
  174. }
  175. },
  176. onReachBottom: function() {
  177. this.getCombinationList();
  178. },
  179. }
  180. </script>
  181. <style lang="scss">
  182. .h-470{
  183. height: 470rpx;;
  184. }
  185. .w-624{
  186. width: 624rpx;
  187. }
  188. .bg-gradient {
  189. background: linear-gradient( 270deg, #FF7931 0%, #E93323 100%);
  190. }
  191. .active-tab{
  192. width: 132rpx;
  193. height: 52rpx;
  194. background: #FFF8E4;
  195. color: #F85517;
  196. border-radius: 30rpx;
  197. font-weight: 500;
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. }
  202. .bg-top{
  203. height: 547rpx;
  204. background-size: 100% 100%;
  205. background-repeat: no-repeat;
  206. }
  207. .content{
  208. top: -80rpx;
  209. }
  210. ._box{
  211. padding: 40rpx 20rpx 32rpx;
  212. background: #f5f5f5;
  213. position: sticky;
  214. z-index: 99;
  215. }
  216. .font-red{
  217. color: #e93323;
  218. }
  219. .bg-red{
  220. background-color: #e93323;
  221. }
  222. .bg-gray{
  223. background-color: #ccc;
  224. }
  225. .con_border{
  226. border: 1px solid #e93323;
  227. }
  228. .card ~ .card{
  229. margin-top: 20rpx;
  230. }
  231. .tuan-num{
  232. width: 70rpx;
  233. height: 32rpx;
  234. background: #E93323;
  235. border-radius: 8rpx 0 0 8rpx;
  236. }
  237. .complete{
  238. width: 110rpx;
  239. height: 32rpx;
  240. background: rgba(233, 51, 35, 0.1);
  241. border-radius: 0 8rpx 8rpx 0;
  242. }
  243. </style>