index.vue 10 KB

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