index.vue 7.8 KB

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