index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <div>
  3. <view class="combinationBj"></view>
  4. <div class="combinationList">
  5. <view class='group-list'>
  6. <!-- #ifdef H5 -->
  7. <view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+ (navH/2) +'rpx'" v-if="returnShow"></view>
  8. <!-- #endif -->
  9. <!-- banner -->
  10. <view class="swiper" v-if="bannerList.length">
  11. <swiper indicator-dots="true" :autoplay="true" :circular="circular" :interval="interval"
  12. :duration="duration" indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff">
  13. <block v-for="(item,index) in bannerList" :key="index">
  14. <swiper-item>
  15. <navigator :url='item.value' class='slide-navigator acea-row row-between-wrapper'
  16. hover-class='none'>
  17. <image :src="item.value" class="slide-image" lazy-load></image>
  18. </navigator>
  19. </swiper-item>
  20. </block>
  21. </swiper>
  22. </view>
  23. <view class="nav acea-row row-between-wrapper">
  24. <image src="../static/zuo.png"></image>
  25. <view class="title acea-row row-center">
  26. <view class="spike-bd">
  27. <view v-if="avatarList.length > 0" class="activity_pic">
  28. <view v-for="(item,index) in avatarList" :key="index" class="picture"
  29. :style='index===6?"position: relative":"position: static"'>
  30. <span class="avatar" :style='"background-image: url("+item+")"'></span>
  31. <span v-if="index===6 && Number(avatarList.length) > 3" class="mengceng">
  32. <i>···</i>
  33. </span>
  34. </view>
  35. </view>
  36. </view>
  37. <text class="pic_count">{{totalPeople}}人参与</text>
  38. </view>
  39. <image src="../static/you.png"></image>
  40. </view>
  41. <view class='list'>
  42. <block v-for="(item,index) in combinationList" :key='index'>
  43. <view class='item acea-row row-between-wrapper' @tap="openSubcribe(item)"
  44. data-url=''>
  45. <view class='pictrue'>
  46. <image :src='item.image'></image>
  47. </view>
  48. <view class='text'>
  49. <view class='line2'>{{item.title}}</view>
  50. <text class='y-money'>¥{{item.otPrice}}</text>
  51. <view class='bottom acea-row row-between-wrapper'>
  52. <view class='money'>¥<text class='num'>{{item.price}}</text></view>
  53. <view class="btn acea-row">
  54. <view class="num">{{item.people}}人团</view>
  55. <view class="goBye">去拼团</view>
  56. </view>
  57. <!-- <view class="nothing">已售罄</view> -->
  58. </view>
  59. </view>
  60. </view>
  61. </block>
  62. <view class='loadingicon acea-row row-center-wrapper' v-if='combinationList.length > 0'>
  63. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  64. </view>
  65. </view>
  66. </view>
  67. <home></home>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import {
  73. getCombinationList,
  74. combinationHeaderApi
  75. } from '@/api/activity.js';
  76. import {
  77. openPinkSubscribe
  78. } from '../../../utils/SubscribeMessage.js';
  79. import home from '@/components/home/index.vue'
  80. let app = getApp();
  81. export default {
  82. components: {
  83. home
  84. },
  85. data() {
  86. return {
  87. indicatorDots: false,
  88. circular: true,
  89. autoplay: true,
  90. interval: 3000,
  91. duration: 500,
  92. navH: '',
  93. combinationList: [],
  94. limit: 10,
  95. page: 1,
  96. loading: false,
  97. loadend: false,
  98. returnShow: true,
  99. loadTitle: '',
  100. avatarList: [],
  101. bannerList: [],
  102. totalPeople: 0
  103. }
  104. },
  105. onShow() {
  106. this.getCombinationList();
  107. },
  108. onLoad() {
  109. var pages = getCurrentPages();
  110. this.returnShow = pages.length===1?false:true;
  111. uni.setNavigationBarTitle({
  112. title:"拼团列表"
  113. })
  114. // #ifdef MP
  115. this.navH = app.globalData.navH;
  116. // #endif
  117. // #ifdef H5
  118. this.navH = app.globalData.navHeight;
  119. // #endif
  120. this.getCombinationList();
  121. this.getCombinationHeader();
  122. },
  123. methods: {
  124. goBack: function() {
  125. uni.navigateBack();
  126. },
  127. openSubcribe: function(item) {
  128. let page = item;
  129. // #ifndef MP
  130. uni.navigateTo({
  131. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  132. });
  133. // #endif
  134. // #ifdef MP
  135. uni.showLoading({
  136. title: '正在加载',
  137. })
  138. openPinkSubscribe().then(res => {
  139. uni.hideLoading();
  140. uni.navigateTo({
  141. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  142. });
  143. }).catch(() => {
  144. uni.hideLoading();
  145. });
  146. // #endif
  147. },
  148. getCombinationHeader: function() {
  149. combinationHeaderApi().then(res => {
  150. this.avatarList = res.data.avatarList || [];
  151. this.bannerList = res.data.bannerList || [];
  152. this.totalPeople = res.data.totalPeople;
  153. }).catch(() => {
  154. this.loading = false;
  155. this.loadTitle = '加载更多';
  156. })
  157. },
  158. getCombinationList: function() {
  159. var that = this;
  160. if (that.loadend) return;
  161. if (that.loading) return;
  162. that.loadTitle = '';
  163. var data = {
  164. page: that.page,
  165. limit: that.limit
  166. };
  167. this.loading = true
  168. getCombinationList(data).then(function(res) {
  169. let list = res.data.list;
  170. let combinationList = that.$util.SplitArray(list, that.combinationList);
  171. let loadend = list.length < that.limit;
  172. that.loadend = loadend;
  173. that.loading = false;
  174. that.loadTitle = loadend ? '已全部加载' : '加载更多';
  175. that.$set(that, 'combinationList', combinationList);
  176. that.$set(that, 'page', that.page + 1);
  177. }).catch(() => {
  178. that.loading = false;
  179. that.loadTitle = '加载更多';
  180. })
  181. },
  182. },
  183. onReachBottom: function() {
  184. this.getCombinationList();
  185. },
  186. }
  187. </script>
  188. <style lang="scss">
  189. page {
  190. background-color: #E93323 !important;
  191. }
  192. </style>
  193. <style lang="scss" scoped>
  194. .combinationBj{
  195. position: absolute;
  196. width: 100%;
  197. height: 990rpx;
  198. background: url(../static/pinbei.png) no-repeat;
  199. background-size: 100% 100%;
  200. }
  201. .mengceng {
  202. width: 40rpx;
  203. height: 40rpx;
  204. line-height: 36rpx;
  205. background: rgba(51, 51, 51, 0.6);
  206. text-align: center;
  207. border-radius: 50%;
  208. opacity: 1;
  209. position: absolute;
  210. left: -2rpx;
  211. color: #FFF;
  212. top: 2rpx;
  213. i{
  214. font-style: normal;
  215. font-size: 20rpx;
  216. }
  217. }
  218. .activity_pic {
  219. .picture {
  220. display: inline-table;
  221. }
  222. .avatar {
  223. width: 38rpx;
  224. height: 38rpx;
  225. display: inline-table;
  226. vertical-align: middle;
  227. -webkit-user-select: none;
  228. -moz-user-select: none;
  229. -ms-user-select: none;
  230. user-select: none;
  231. border-radius: 50%;
  232. background-repeat: no-repeat;
  233. background-size: cover;
  234. background-position: 0 0;
  235. margin-right: -10rpx;
  236. box-shadow: 0 0 0 1px #fff;
  237. }
  238. }
  239. .combinationList{
  240. width: 100%;
  241. height: 100%;
  242. padding: 25rpx 30rpx;
  243. .swiper{
  244. width: 100%;
  245. height: 300rpx;
  246. border-radius: 14rpx;
  247. margin-bottom: 34rpx;
  248. swiper,
  249. .swiper-item,
  250. image {
  251. width: 100%;
  252. height: 300rpx;
  253. border-radius: 10rpx;
  254. }
  255. }
  256. .nav{
  257. width: 100%;
  258. margin-bottom: 34rpx;
  259. image{
  260. width: 102rpx;
  261. height: 4rpx;
  262. }
  263. }
  264. .title {
  265. width: 68%;
  266. .pic_count {
  267. margin-left: 30rpx;
  268. color: $theme-color;
  269. font-size: 22rpx;
  270. font-weight: 500;
  271. width: auto;
  272. height: auto;
  273. background: #C6483C;
  274. color: #FFFFFF;
  275. border-radius: 19rpx;
  276. padding: 4rpx 14rpx;
  277. }
  278. }
  279. }
  280. .icon-xiangzuo {
  281. font-size: 40rpx;
  282. color: #fff;
  283. position: fixed;
  284. left: 30rpx;
  285. z-index: 99;
  286. transform: translateY(-20%);
  287. }
  288. .group-list .list .item {
  289. background-color: #fff;
  290. border-radius: 14rpx;
  291. padding: 22rpx;
  292. box-sizing: border-box;
  293. margin: 0 auto 20rpx auto;
  294. }
  295. .group-list .list .item .pictrue {
  296. width: 186rpx;
  297. height: 186rpx;
  298. }
  299. .group-list .list .item .pictrue image {
  300. width: 100%;
  301. height: 100%;
  302. border-radius: 6rpx;
  303. }
  304. .group-list .list .item .text {
  305. width: 440rpx;
  306. font-size: 30rpx;
  307. color: #333333;
  308. margin-left: 20rpx;
  309. .line2{
  310. height: 86rpx;
  311. }
  312. .btn{
  313. .num{
  314. width: auto;
  315. height: 58rpx;
  316. line-height: 58rpx;
  317. background-color:#FFEFDB;
  318. padding-left: 22rpx;
  319. padding-right: 36rpx;
  320. color: $theme-color;
  321. font-size: 24rpx;
  322. -webkit-border-top-left-radius: 15px;
  323. -webkit-border-bottom-left-radius: 15px;
  324. }
  325. .goBye{
  326. width: 130rpx;
  327. height: 58rpx;
  328. z-index: 11;
  329. background: url(../static/shandian.png) no-repeat;
  330. background-size: 100% 100%;
  331. line-height: 58rpx;
  332. font-size: 24rpx;
  333. padding-left: 36rpx;
  334. padding-right: 10rpx;
  335. color: #fff;
  336. margin-left: -28rpx;
  337. }
  338. }
  339. .nothing{
  340. width: 148rpx;
  341. height: 58rpx;
  342. text-align: center;
  343. line-height: 58rpx;
  344. background: #CCCCCC;
  345. opacity: 1;
  346. color: #FFFFFF;
  347. border-radius: 30rpx;
  348. font-size: 24rpx;
  349. }
  350. }
  351. .group-list .list .item .text .team {
  352. height: 38rpx;
  353. border-radius: 4rpx;
  354. font-size: 22rpx;
  355. margin-top: 20rpx;
  356. }
  357. .group-list .list .item .text .team .iconfont {
  358. width: 54rpx;
  359. background-color: #ffdcd9;
  360. text-align: center;
  361. color: #dd3823;
  362. height: 100%;
  363. }
  364. .group-list .list .item .text .team .num {
  365. text-align: center;
  366. padding: 0 6rpx;
  367. height: 100%;
  368. }
  369. .group-list .list .item .text .bottom .money {
  370. font-size: 24rpx;
  371. font-weight: bold;
  372. color: $theme-color;
  373. }
  374. .group-list .list .item .text .bottom .money .num {
  375. font-size: 32rpx;
  376. }
  377. .group-list .list .item .text .y-money {
  378. font-size: 24rpx;
  379. color: #999;
  380. font-weight: normal;
  381. text-decoration: line-through;
  382. }
  383. .group-list .list .item .text .bottom .groupBnt {
  384. font-size: 26rpx;
  385. color: #fff;
  386. width: 146rpx;
  387. height: 54rpx;
  388. text-align: center;
  389. line-height: 54rpx;
  390. border-radius: 4rpx;
  391. }
  392. .group-list .list .item .text .bottom .groupBnt .iconfont {
  393. font-size: 25rpx;
  394. vertical-align: 2rpx;
  395. margin-left: 10rpx;
  396. }
  397. </style>