index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="group-list">
  3. <view class="swiper" v-if="bannerList.length">
  4. <swiper indicator-dots="true" :autoplay="true" :circular="circular"
  5. :interval="interval" :duration="duration" indicator-color="rgba(0,0,0,0.3)">
  6. <block v-for="(item,index) in bannerList" :key="index">
  7. <swiper-item>
  8. <view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
  9. <image :src="item.img" class="slide-image"></image>
  10. </view>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. </view>
  15. <view class="groupMember acea-row row-center-wrapper">
  16. <view class="line"><image src="../static/groupLine.png"></image></view>
  17. <view class="member acea-row row-center-wrapper">
  18. <view class="pictrue" v-for="(item,index) in pinkPeople" :key="index" v-if="index<6"><image :src="item"></image></view>
  19. <view class="pictrue" v-if="pinkPeople.length>5">
  20. <image :src="pinkPeople[pinkPeople.length-1]"></image>
  21. <view class="iconfont icon-gengduo1"></view>
  22. </view>
  23. </view>
  24. <view class="line right"><image src="../static/groupLine.png"></image></view>
  25. </view>
  26. <view class="list">
  27. <view class="item acea-row row-between-wrapper" v-for="(item,index) in combinationList" :key='index' @tap="openSubcribe(item)">
  28. <view class="pictrue"><image :src="item.image"></image></view>
  29. <view class="text">
  30. <view class="name line2">{{item.title}}</view>
  31. <view class="bottom acea-row row-between row-bottom">
  32. <view class="y_money">
  33. <view class="price">¥{{item.product_price}}</view>
  34. <view class="money">¥<text class="num">{{item.price}}</text></view>
  35. </view>
  36. <view class="bnt acea-row row-center-wrapper" v-if="item.stock>0&&item.quota>0">
  37. <view class="light"><image src="../static/lightning.png"></image></view>
  38. <view class="num">{{item.people}}人团</view>
  39. <view class="go">去拼团</view>
  40. </view>
  41. <view class="bnt gray acea-row row-center-wrapper" v-else>已售罄</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <home></home>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. getCombinationList,getCombinationBannerList,getPink
  52. } from '@/api/activity.js';
  53. import {
  54. openPinkSubscribe
  55. } from '../../../utils/SubscribeMessage.js';
  56. import home from '@/components/home/index.vue'
  57. let app = getApp();
  58. export default {
  59. components: {
  60. home
  61. },
  62. data() {
  63. return {
  64. pinkPeople:[],
  65. bannerList:[],
  66. circular: true,
  67. autoplay: true,
  68. interval: 3000,
  69. duration: 500,
  70. combinationList: [],
  71. limit: 10,
  72. page: 1,
  73. loading: false,
  74. loadend: false
  75. }
  76. },
  77. onLoad() {
  78. uni.setNavigationBarTitle({
  79. title:"拼团列表"
  80. })
  81. this.getCombinationList();
  82. this.getBannerList();
  83. this.getPink();
  84. },
  85. methods: {
  86. getPink:function(){
  87. getPink().then(res=>{
  88. this.pinkPeople = res.data.avatars;
  89. })
  90. },
  91. getBannerList: function(){
  92. getCombinationBannerList().then(res=>{
  93. this.bannerList = res.data;
  94. })
  95. },
  96. goDetail(item) {
  97. uni.navigateTo({
  98. url: item.link
  99. })
  100. },
  101. openSubcribe: function(item) {
  102. let page = item;
  103. // #ifndef MP
  104. uni.navigateTo({
  105. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  106. });
  107. // #endif
  108. // #ifdef MP
  109. uni.showLoading({
  110. title: '正在加载',
  111. })
  112. openPinkSubscribe().then(res => {
  113. uni.hideLoading();
  114. uni.navigateTo({
  115. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  116. });
  117. }).catch(() => {
  118. uni.hideLoading();
  119. });
  120. // #endif
  121. },
  122. getCombinationList: function() {
  123. var that = this;
  124. if (that.loadend) return;
  125. if (that.loading) return;
  126. var data = {
  127. page: that.page,
  128. limit: that.limit
  129. };
  130. this.loading = true
  131. getCombinationList(data).then(function(res) {
  132. var combinationList = that.combinationList;
  133. var limit = that.limit;
  134. that.page++;
  135. that.loadend = limit > res.data.length;
  136. that.combinationList = combinationList.concat(res.data);
  137. that.page = that.data.page;
  138. that.loading = false;
  139. }).catch(() => {
  140. that.loading = false
  141. })
  142. },
  143. },
  144. onReachBottom: function() {
  145. this.getCombinationList();
  146. },
  147. }
  148. </script>
  149. <style lang="scss">
  150. page {
  151. background-color: #E93323 !important;
  152. }
  153. .group-list{
  154. .swiper{
  155. width: 100%;
  156. position: relative;
  157. box-sizing: border-box;
  158. padding: 0 30rpx;
  159. margin-top: 30rpx;
  160. swiper{
  161. width: 100%;
  162. height: 300rpx;
  163. .slide-image{
  164. width: 100%;
  165. height: 300rpx;
  166. border-radius: 20rpx;
  167. }
  168. /deep/.uni-swiper-dot {
  169. width: 8rpx !important;
  170. height: 8rpx !important;
  171. border-radius: 50%;
  172. }
  173. /deep/.uni-swiper-dot-active{
  174. width: 18rpx !important;
  175. border-radius: 4rpx;
  176. background-color: #E93323!important;
  177. }
  178. }
  179. }
  180. .groupMember{
  181. height: 100rpx;
  182. .line{
  183. width: 102rpx;
  184. height: 4rpx;
  185. &.right{
  186. transform:rotate(180deg);
  187. }
  188. image{
  189. width: 100%;
  190. height: 100%;
  191. display: block;
  192. }
  193. }
  194. .member{
  195. margin: 0 30rpx;
  196. .pictrue{
  197. width: 46rpx;
  198. height: 46rpx;
  199. position: relative;
  200. image{
  201. border:2rpx solid #fff;
  202. width: 100%;
  203. height: 100%;
  204. border-radius: 50%;
  205. }
  206. &~.pictrue{
  207. margin-left: -8rpx;
  208. }
  209. .iconfont{
  210. position: absolute;
  211. width: 43rpx;
  212. height: 43rpx;
  213. background: rgba(51, 51, 51, 0.6);
  214. border-radius: 50%;
  215. top: 2rpx;
  216. left:2rpx;
  217. color: #fff;
  218. font-size: 10rpx;
  219. text-align: center;
  220. line-height: 43rpx;
  221. }
  222. }
  223. }
  224. }
  225. .list{
  226. .item{
  227. width: 690rpx;
  228. height: 230rpx;
  229. background-color: #fff;
  230. border-radius: 14rpx;
  231. padding: 0 22rpx;
  232. margin: 0 auto 18rpx auto;
  233. .pictrue{
  234. width: 186rpx;
  235. height: 186rpx;
  236. image{
  237. width: 100%;
  238. height: 100%;
  239. border-radius: 10rpx;
  240. }
  241. }
  242. .text{
  243. width: 440rpx;
  244. .name{
  245. color: #333333;
  246. font-size: 30rpx;
  247. height: 82rpx;
  248. }
  249. .bottom{
  250. margin-top: 10rpx;
  251. .y_money{
  252. font-size: 24rpx;
  253. color: #999999;
  254. .price{
  255. text-decoration: line-through;
  256. }
  257. .money{
  258. color: #E93323;
  259. font-weight: 600;
  260. .num{
  261. font-size: 34rpx;
  262. }
  263. }
  264. }
  265. .bnt{
  266. height: 58rpx;
  267. font-size: 24rpx;
  268. text-align: center;
  269. position: relative;
  270. background-color: #E93323;
  271. border-radius: 28rpx;
  272. .light{
  273. position: absolute;
  274. width: 28rpx;
  275. height: 58rpx;
  276. top:0;
  277. left:50%;
  278. margin-left: -8rpx;
  279. image{
  280. width: 100%;
  281. height: 100%;
  282. }
  283. }
  284. .num{
  285. width: 120rpx;
  286. background-color: #ffefdb;
  287. color: #E93323;
  288. height: 100%;
  289. line-height: 58rpx;
  290. border-radius: 28rpx 0 14rpx 28rpx;
  291. }
  292. .go{
  293. width: 112rpx;
  294. background-color: #E93323;
  295. height: 100%;
  296. line-height: 58rpx;
  297. border-radius: 0 28rpx 28rpx 0;
  298. color: #fff;
  299. }
  300. &.gray{
  301. width: 148rpx;
  302. background-color: #CCCCCC;
  303. color: #fff;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. </style>