index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <view :style="viewColor" class="page-container">
  3. <view class='flash-sale'>
  4. <view class="fixed-head">
  5. <view class="sys-head" :style="{height:statusBarHeight}"></view>
  6. <view class="tool-bar">
  7. <view class='iconfont icon-xiangzuo' @tap='goBack' v-if="returnShow"></view>
  8. <user-name-swiper class="name-swiper" :style="'top:'+ (navH/2) +'rpx'" :combinationUserList="combinationUserList"></user-name-swiper>
  9. </view>
  10. </view>
  11. <view class='head' :style="{ 'background-image': `url(${domain}/static/diy/combination${keyColor}.png)` }">
  12. <view class="sys-head" :style="{height:statusBarHeight}"></view>
  13. <view class="tool-bar"></view>
  14. <view class='header'>
  15. <view class="success_per">
  16. <view class="success_num">{{combinationUserCount}}人已参与拼团</view>
  17. <view class="activity_pic" v-if="combinationUserList.length > 0">
  18. <view v-for="(item,index) in combinationUserList.slice(0,10)" class="picture" :key="index">
  19. <image v-if="index != 9" class="avatar" :src='item.avatar ? item.avatar : "/static/images/f.png"'></image>
  20. <span v-else class="avatar" style="background:#fff;"><text class="iconfont icon-gengduo1"></text></span>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="main_count">
  27. <tabNav class="tabNav" :class="{'fixed':isFixed}" :tabTitle="navTop" @changeTab='changeTab'></tabNav>
  28. <view class='list'>
  29. <block v-for="(item,index) in combinationList" :key='index'>
  30. <view class='item acea-row row-between-wrapper' @tap='goDetails(item)'>
  31. <view class='pictrue'>
  32. <image :src='item.product.image'></image>
  33. </view>
  34. <view class='text acea-row row-column-around'>
  35. <view class='name line1'>{{item.product.store_name}}</view>
  36. <view class='booking'>
  37. <text class="count">
  38. <text class="iconfont icon-pintuan"></text>
  39. {{item.buying_count_num}}人团 <text class="line"></text>
  40. 已拼{{item.sales ? item.sales : 0}}{{item.product.unit_name}}
  41. </text>
  42. </view>
  43. <view class="progress">
  44. <view class='combination_price'>
  45. <text class="combination_text">拼团价</text>
  46. <text class="price">¥ <text>{{ item.price }}</text></text>
  47. </view>
  48. <view class='order_btn' :style="{ 'background-image': `url(${domain}/static/diy/pink_btn${keyColor}.png)` }">去拼团</view>
  49. </view>
  50. </view>
  51. </view>
  52. </block>
  53. </view>
  54. </view>
  55. </view>
  56. <home></home>
  57. <!-- #ifndef H5 -->
  58. <passwordPopup></passwordPopup>
  59. <!-- #endif -->
  60. </view>
  61. </template>
  62. <script>
  63. // +----------------------------------------------------------------------
  64. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  65. // +----------------------------------------------------------------------
  66. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  67. // +----------------------------------------------------------------------
  68. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  69. // +----------------------------------------------------------------------
  70. // | Author: CRMEB Team <admin@crmeb.com>
  71. // +----------------------------------------------------------------------
  72. import { getCombinationList, getCombinationUser, getActivitycategory } from '../../../api/activity.js';
  73. import home from '@/components/home/index.vue'
  74. import tabNav from '@/components/combinNav'
  75. import userNameSwiper from '@/components/userNameSwiper/userNameSwiper.vue'
  76. import { getIndexData } from '@/api/api.js';
  77. import { configMap } from "@/utils";
  78. import { HTTP_REQUEST_URL } from '@/config/app';
  79. // #ifndef H5
  80. import passwordPopup from '@/components/passwordPopup';
  81. // #endif
  82. import { mapGetters } from "vuex";
  83. let app = getApp();
  84. export default {
  85. components: {
  86. // #ifndef H5
  87. passwordPopup,
  88. // #endif
  89. home,
  90. tabNav,
  91. userNameSwiper
  92. },
  93. computed: configMap({statusBarHeight:0},mapGetters(['viewColor','keyColor'])),
  94. data() {
  95. return {
  96. domain: HTTP_REQUEST_URL,
  97. navH: '',
  98. topImage: '',
  99. combinationList: [],
  100. combinationUserList: [],
  101. combinationUserCount: 0,
  102. navTop: [{
  103. 'cate_name': '精选',
  104. store_category_id: ''
  105. }],
  106. active: 1,
  107. type: 0,
  108. scrollLeft: 0,
  109. interval: 0,
  110. status: 1,
  111. page: 1,
  112. limit: 8,
  113. loading: false,
  114. loadend: false,
  115. pageloading: false,
  116. isFixed: false,
  117. navIndex: 0,
  118. returnShow: true,
  119. avatar: '../../../static/images/f.png',
  120. headBg: '../static/images/comHead'
  121. }
  122. },
  123. /**
  124. * 用户点击右上角分享
  125. */
  126. // #ifdef MP
  127. onShareAppMessage: function() {
  128. wx.showShareMenu({
  129. withShareTicket: true,
  130. menus: ['shareAppMessage', 'shareTimeline']
  131. })
  132. return {
  133. title: '拼团',
  134. path: 'pages/activity/combination/index',
  135. }
  136. },
  137. onShareTimeline: function() {
  138. return {
  139. title: '拼团活动',
  140. query: {
  141. key: ''
  142. },
  143. imageUrl: ''
  144. }
  145. },
  146. // #endif
  147. onLoad() {
  148. var pages = getCurrentPages();
  149. // this.returnShow = pages.length===1?false:true;
  150. uni.setNavigationBarTitle({
  151. title: "拼团列表"
  152. })
  153. this.navH = app.globalData.navHeight;
  154. this.getCombinationProductList('');
  155. this.getIndexConfig();
  156. this.getCombinationUser();
  157. },
  158. methods: {
  159. goBack: function() {
  160. uni.navigateBack();
  161. },
  162. getCombinationProductList: function(store_category_id) {
  163. var that = this;
  164. var data = {
  165. page: that.page,
  166. limit: that.limit,
  167. store_category_id: store_category_id
  168. };
  169. // if (that.loadend) return;
  170. if (that.pageloading) return;
  171. this.pageloading = true
  172. getCombinationList(data).then(res => {
  173. console.log(res);
  174. var combinationList = res.data.list;
  175. that.page++;
  176. that.combinationList = that.combinationList.concat(combinationList),
  177. that.page = that.page;
  178. that.pageloading = false;
  179. // that.loadend = loadend;
  180. }).catch(err => {
  181. that.pageloading = false
  182. });
  183. },
  184. // 首页数据
  185. getIndexConfig: function() {
  186. let that = this;
  187. getActivitycategory(4).then(res => {
  188. that.navTop = that.navTop.concat(res.data)
  189. })
  190. },
  191. //获取参与拼团用户
  192. getCombinationUser: function() {
  193. let that = this;
  194. getCombinationUser({
  195. limit: 30
  196. }).then(res => {
  197. that.$set(that, "combinationUserCount", res.data.count);
  198. that.$set(that, "combinationUserList", res.data.list);
  199. console.log(this.combinationUserList)
  200. })
  201. },
  202. // 导航分类切换
  203. changeTab(e) {
  204. let that = this
  205. if (that.navIndex == e.index) return
  206. that.navIndex = e.index;
  207. that.page = 1;
  208. that.limit = 8;
  209. that.combinationList = [];
  210. that.getCombinationProductList(e.pid)
  211. },
  212. goDetails(item) {
  213. uni.navigateTo({
  214. url: '/pages/activity/combination_details/index?id=' + item.product_group_id
  215. })
  216. }
  217. },
  218. /**
  219. * 页面上拉触底事件的处理函数
  220. */
  221. onReachBottom: function() {
  222. this.getCombinationProductList('');
  223. },
  224. // 滚动监听
  225. onPageScroll(e) {
  226. // #ifdef H5
  227. let self = this
  228. if (e.scrollTop >= self.searchH) {
  229. self.isFixed = true
  230. } else {
  231. self.isFixed = false
  232. }
  233. // #endif
  234. }
  235. }
  236. </script>
  237. <style lang="scss">
  238. .page-container{
  239. min-height: 100vh;
  240. background-color: var(--view-theme);
  241. }
  242. .icon-xiangzuo {
  243. margin-right: 40rpx;
  244. margin-left: 20rpx;
  245. font-size: 40rpx;
  246. color: #fff;
  247. }
  248. .head {
  249. display: flex;
  250. flex-direction: column;
  251. /* #ifdef MP || APP-PLUS */
  252. height: 576rpx;
  253. /* #endif */
  254. /* #ifdef H5 */
  255. height: 490rpx;
  256. /* #endif */
  257. background-repeat: no-repeat;
  258. background-size: 100% 100%;
  259. width: 100%;
  260. }
  261. .header {
  262. flex: 1;
  263. display: flex;
  264. flex-direction: column;
  265. align-items: center;
  266. justify-content: center;
  267. .success_per {
  268. width: 100%;
  269. text-align: center;
  270. left: 0;
  271. .success_num {
  272. color: #FFF1BF;
  273. font-size: 26rpx;
  274. }
  275. }
  276. }
  277. .activity_pic {
  278. margin-left: 20rpx;
  279. padding-left: 20rpx;
  280. position: relative;
  281. display: inline-block;
  282. margin-top: 17rpx;
  283. background: rgba(0, 0, 0, .15);
  284. padding: 13rpx 24rpx 13rpx 14rpx;
  285. border-radius: 33rpx;
  286. .picture {
  287. display: inline-block;
  288. }
  289. .avatar {
  290. width: 42rpx;
  291. height: 42rpx;
  292. line-height: 20rem;
  293. display: inline-block;
  294. background-repeat: no-repeat;
  295. background-size: center/cover;
  296. position: relative;
  297. text-align: center;
  298. color: #fff;
  299. font-weight: 600;
  300. vertical-align: bottom;
  301. font-size: .875rem;
  302. -webkit-user-select: none;
  303. -moz-user-select: none;
  304. -ms-user-select: none;
  305. user-select: none;
  306. border-radius: 50%;
  307. background-repeat: no-repeat;
  308. background-size: cover;
  309. background-position: 0 0;
  310. margin-right: -10rpx;
  311. box-shadow: 0 0 0 1px #fff;
  312. position: relative;
  313. text {
  314. position: absolute;
  315. line-height: 42rpx;
  316. color: #8E8E8E;
  317. width: 42rpx;
  318. left: 0;
  319. }
  320. }
  321. }
  322. .noCommodity {
  323. border-top: none;
  324. }
  325. .flash-sale .header {
  326. width: 100%;
  327. position: relative;
  328. }
  329. .flash-sale .main_count {
  330. position: relative;
  331. top: 10rpx;
  332. }
  333. .flash-sale .timeList {
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. margin: 0 auto;
  338. }
  339. .flash-sale .timeList .item {
  340. font-size: 20rpx;
  341. color: #666;
  342. text-align: center;
  343. box-sizing: border-box;
  344. width: 224rpx;
  345. }
  346. .flash-sale .timeList .item .time {
  347. font-size: 26rpx;
  348. color: #AAAAAA;
  349. }
  350. .flash-sale .timeList .item.on .time {
  351. color: #FD6523;
  352. font-weight: 600;
  353. span {
  354. position: relative;
  355. &::after {
  356. content: '';
  357. display: inline-block;
  358. width: 100%;
  359. height: 4rpx;
  360. background: #FD6523;
  361. position: absolute;
  362. left: 0;
  363. bottom: -4rpx;
  364. border-radius: 2rpx;
  365. }
  366. }
  367. }
  368. .flash-sale .list {
  369. margin-top: 24rpx;
  370. }
  371. .flash-sale .list .item {
  372. height: 278rpx;
  373. position: relative;
  374. width: 90%;
  375. margin: 0 auto 20rpx auto;
  376. background-color: #fff;
  377. border-radius: 20rpx;
  378. padding: 0 25rpx;
  379. }
  380. .flash-sale .list .item .pictrue {
  381. width: 240rpx;
  382. height: 240rpx;
  383. border-radius: 10rpx;
  384. }
  385. .flash-sale .list .item .pictrue image {
  386. width: 100%;
  387. height: 100%;
  388. border-radius: 10rpx;
  389. }
  390. .flash-sale .list .item .text {
  391. width: 380rpx;
  392. font-size: 30rpx;
  393. color: #333;
  394. }
  395. .flash-sale .list .item .text .name {
  396. width: 100%;
  397. color: #282828;
  398. font-weight: bold;
  399. font-size: 28rpx;
  400. }
  401. .flash-sale .list .item .text .booking {
  402. margin-top: 17rpx;
  403. }
  404. .flash-sale .list .item .text .booking .count {
  405. font-size: 22rpx;
  406. color: var(--view-priceColor);
  407. border-radius: 18rpx;
  408. background-color: var(--view-bgColor);
  409. line-height: 36rpx;
  410. padding: 5rpx 12rpx;
  411. .iconfont {
  412. margin-right: 10rpx;
  413. }
  414. .line {
  415. display: inline-block;
  416. width: 1rpx;
  417. height: 14rpx;
  418. background: #F49088;
  419. margin: 0 9rpx;
  420. position: relative;
  421. top: -3rpx;
  422. }
  423. }
  424. .flash-sale .list .item .text .limit {
  425. font-size: 22rpx;
  426. color: #999;
  427. margin-bottom: 5rpx;
  428. }
  429. .flash-sale .list .item .text .limit .limitPrice {
  430. margin-left: 10rpx;
  431. }
  432. .flash-sale .list .item .text .progress {
  433. margin-top: 20rpx;
  434. overflow: hidden;
  435. .combination_price {
  436. line-height: 15px;
  437. padding: 8rpx 0;
  438. color: #282828;
  439. float: left;
  440. position: relative;
  441. top: 10rpx;
  442. .combination_text {
  443. font-size: 22rpx;
  444. }
  445. .price {
  446. font-size: 24rpx;
  447. font-weight: bold;
  448. }
  449. }
  450. .order_btn {
  451. float: right;
  452. width: 145rpx;
  453. height: 62rpx;
  454. text-align: center;
  455. color: #FFFFFF;
  456. font-size: 26rpx;
  457. line-height: 72rpx;
  458. background-size: 100%;
  459. }
  460. }
  461. .tool-bar{
  462. display: flex;
  463. align-items: center;
  464. height: 40px;
  465. }
  466. .fixed-head{
  467. position: fixed;
  468. left: 0;
  469. top: 20px;
  470. width: 100%;
  471. }
  472. </style>