index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. if (url.indexOf("http") != -1) {
  119. // #ifdef H5
  120. location.href = url
  121. // #endif
  122. } else {
  123. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index',
  124. '/pages/index/index'
  125. ]
  126. .indexOf(url) == -1) {
  127. uni.navigateTo({
  128. url: url
  129. })
  130. } else {
  131. uni.switchTab({
  132. url: url
  133. })
  134. }
  135. }
  136. },
  137. openSubcribe: function(item) {
  138. let page = item;
  139. // #ifndef MP
  140. uni.navigateTo({
  141. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  142. });
  143. // #endif
  144. // #ifdef MP
  145. uni.showLoading({
  146. title: this.$t(`正在加载中`),
  147. })
  148. openPinkSubscribe().then(res => {
  149. uni.hideLoading();
  150. uni.navigateTo({
  151. url: `/pages/activity/goods_combination_details/index?id=${item.id}`
  152. });
  153. }).catch(() => {
  154. uni.hideLoading();
  155. });
  156. // #endif
  157. },
  158. getCombinationList: function() {
  159. var that = this;
  160. if (that.loadend) return;
  161. if (that.loading) return;
  162. var data = {
  163. page: that.page,
  164. limit: that.limit
  165. };
  166. this.loading = true
  167. getCombinationList(data).then(function(res) {
  168. var combinationList = that.combinationList;
  169. var limit = that.limit;
  170. that.page++;
  171. that.loadend = limit > res.data.length;
  172. that.combinationList = combinationList.concat(res.data);
  173. that.page = that.data.page;
  174. that.loading = false;
  175. }).catch(() => {
  176. that.loading = false
  177. })
  178. },
  179. },
  180. onReachBottom: function() {
  181. this.getCombinationList();
  182. },
  183. }
  184. </script>
  185. <style lang="scss">
  186. page {
  187. // background-color: var(--view-theme) !important;
  188. }
  189. .group-list {
  190. min-height: 100vh;
  191. background-color: var(--view-theme) !important;
  192. padding: 30rpx 0;
  193. .swiper {
  194. width: 100%;
  195. position: relative;
  196. box-sizing: border-box;
  197. padding: 0 30rpx;
  198. swiper {
  199. width: 100%;
  200. height: 300rpx;
  201. .slide-image {
  202. width: 100%;
  203. height: 300rpx;
  204. border-radius: 20rpx;
  205. }
  206. /deep/.uni-swiper-dot {
  207. width: 8rpx !important;
  208. height: 8rpx !important;
  209. border-radius: 50%;
  210. }
  211. /deep/.uni-swiper-dot-active {
  212. width: 18rpx !important;
  213. border-radius: 4rpx;
  214. background-color: var(--view-theme) !important;
  215. }
  216. }
  217. }
  218. .groupMember {
  219. height: 100rpx;
  220. .line {
  221. width: 102rpx;
  222. height: 4rpx;
  223. &.right {
  224. transform: rotate(180deg);
  225. }
  226. image {
  227. width: 100%;
  228. height: 100%;
  229. display: block;
  230. }
  231. }
  232. .member {
  233. margin: 0 30rpx;
  234. color: #fff;
  235. .pictrue {
  236. width: 46rpx;
  237. height: 46rpx;
  238. position: relative;
  239. image {
  240. border: 2rpx solid #fff;
  241. width: 100%;
  242. height: 100%;
  243. border-radius: 50%;
  244. }
  245. &~.pictrue {
  246. margin-left: -8rpx;
  247. }
  248. .iconfont {
  249. position: absolute;
  250. width: 43rpx;
  251. height: 43rpx;
  252. background: rgba(51, 51, 51, 0.6);
  253. border-radius: 50%;
  254. top: 2rpx;
  255. left: 2rpx;
  256. color: #fff;
  257. font-size: 10rpx;
  258. text-align: center;
  259. line-height: 43rpx;
  260. }
  261. }
  262. }
  263. }
  264. .list {
  265. .item {
  266. width: 690rpx;
  267. height: 230rpx;
  268. background-color: #fff;
  269. border-radius: 14rpx;
  270. padding: 0 22rpx;
  271. margin: 0 auto 18rpx auto;
  272. .pictrue {
  273. width: 186rpx;
  274. height: 186rpx;
  275. image {
  276. width: 100%;
  277. height: 100%;
  278. border-radius: 10rpx;
  279. }
  280. }
  281. .text {
  282. width: 440rpx;
  283. .name {
  284. color: #333;
  285. font-size: 30rpx;
  286. line-height: 38rpx;
  287. height: 70rpx;
  288. }
  289. .bottom {
  290. margin-top: 10rpx;
  291. .y_money {
  292. font-size: 24rpx;
  293. color: #999;
  294. .price {
  295. text-decoration: line-through;
  296. }
  297. .money {
  298. color: var(--view-priceColor);
  299. font-weight: 600;
  300. .num {
  301. font-size: 34rpx;
  302. }
  303. }
  304. }
  305. .bnt {
  306. height: 58rpx;
  307. font-size: 24rpx;
  308. text-align: center;
  309. position: relative;
  310. background-color: var(--view-theme);
  311. border-radius: 28rpx;
  312. .light {
  313. position: absolute;
  314. width: 28rpx;
  315. height: 58rpx;
  316. top: 0;
  317. left: 50%;
  318. margin-left: -8rpx;
  319. image {
  320. width: 100%;
  321. height: 100%;
  322. }
  323. }
  324. .num {
  325. width: 120rpx;
  326. background-color: rgba(255, 255, 255, 0.85);
  327. color: var(--view-theme);
  328. height: 100%;
  329. line-height: 58rpx;
  330. border-radius: 28rpx 0 14rpx 28rpx;
  331. }
  332. .go {
  333. width: 112rpx;
  334. background-color: var(--view-theme);
  335. height: 100%;
  336. line-height: 58rpx;
  337. border-radius: 0 28rpx 28rpx 0;
  338. color: #fff;
  339. }
  340. &.gray {
  341. width: 148rpx;
  342. background-color: #cccccc;
  343. color: #fff;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. }
  350. }
  351. </style>