groupList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view class="group-list">
  3. <navbar ref="navbar" :config="config"></navbar>
  4. <view class="today">
  5. <view class="today-item">
  6. <view class="today-left"> 今日必拼 </view>
  7. <!-- <view class="line">
  8. </view>
  9. <view class="surplus">
  10. 16点场次仅剩
  11. </view>
  12. <view class="time">
  13. <text>00</text>:<text>07</text>:<text>43</text>
  14. </view> -->
  15. </view>
  16. </view>
  17. <!-- <view class="commodity" > -->
  18. <swiper
  19. class="commodity"
  20. v-if="groupList && groupList.length > 0"
  21. :indicator-dots="false"
  22. :autoplay="false"
  23. @change="imgActiveFun"
  24. >
  25. <!-- <view class="commodity-item"> -->
  26. <swiper-item
  27. v-for="(item, index) in groupList"
  28. :key="index"
  29. @click="
  30. goProductDetails('/pages/product/goods/puzzleGoods?id=' + item.id)
  31. "
  32. >
  33. <view class="commodity-item">
  34. <image :src="item.cover" mode=""></image>
  35. <view class="number">
  36. <text>{{ item.group_people_num}}人团 </text>
  37. <view class="u-FF0000 " style="font-weight: Bold;">
  38. <rich-text
  39. :nodes="$mUtil.priceBigSmall(item.min_price)"
  40. ></rich-text>
  41. </view>
  42. </view>
  43. <view class="completed" v-if="item.result_sale_num/10000>1">
  44. 已有<text>{{ (item.result_sale_num/10000).toFixed(1)}}万</text> 人拼
  45. </view>
  46. <view class="completed" v-else>
  47. 已有<text>{{ item.result_sale_num}}</text> 人拼
  48. </view>
  49. </view>
  50. </swiper-item>
  51. <!-- </view> -->
  52. </swiper>
  53. <!-- </view> -->
  54. <nodata v-else :config="{ top: 1, content: '暂无商品~' }"></nodata>
  55. <view class="option" v-if="groupList && groupList.length > 0">
  56. <!-- <view class="option-item active">
  57. </view> -->
  58. <view
  59. class="option-item"
  60. :class="{ active: activeBannerIndex == index }"
  61. v-for="(item, index) in groupList"
  62. :key="index"
  63. >
  64. </view>
  65. </view>
  66. <view class="content">
  67. <view class="content-top">
  68. <view class="content-left"> 精选商品 </view>
  69. <view class="line"> </view>
  70. <view class="content-right"> 热销优品快来拼购 </view>
  71. </view>
  72. <view class="middle" v-if="hotGroupList && hotGroupList.length > 0">
  73. <view
  74. class="middle-item"
  75. v-for="(item, index) in hotGroupList"
  76. :key="index"
  77. @click="
  78. goProductDetails('/pages/product/goods/puzzleGoods?id=' + item.id)
  79. "
  80. >
  81. <view class="image">
  82. <image :src="item.cover" mode=""></image>
  83. </view>
  84. <view class="middle-right">
  85. <view class="title u-text2">
  86. {{ item.title }}
  87. </view>
  88. <view class="large-box">
  89. <view class="box">
  90. <view class="number">
  91. <view class="large">
  92. <rich-text
  93. :nodes="$mUtil.priceBigSmall(item.min_price)"
  94. ></rich-text>
  95. </view>
  96. <view class="small">
  97. <rich-text
  98. :nodes="$mUtil.priceBigSmall(item.min_sale_price)"
  99. ></rich-text>
  100. </view>
  101. </view>
  102. <view class="three-people">
  103. {{ item.group_people_num }}人拼,已拼<text>{{
  104. item.result_sale_num
  105. }}</text
  106. >件
  107. </view>
  108. </view>
  109. <view class="go-group-work"> 去拼团 </view>
  110. </view>
  111. </view>
  112. </view>
  113. <loadMore v-if="hotGroupList.length > 0" :status="status"></loadMore>
  114. </view>
  115. <nodata v-else :config="{ top: 1, content: '暂无商品~' }"></nodata>
  116. </view>
  117. </view>
  118. </template>
  119. <script>
  120. export default {
  121. data() {
  122. return {
  123. config: {
  124. back: true, //false是tolbar页面 是则不写
  125. title: "拼团",
  126. color: "#FFFFFF",
  127. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  128. backgroundColor: [1, '#FA6138'],
  129. // statusBarFontColor: "#1A1A1A",
  130. },
  131. groupList: [],
  132. page: 1,
  133. hotGroupList: [],
  134. status: "more",
  135. activeBannerIndex: 0,
  136. params:{}
  137. };
  138. },
  139. onLoad(options) {
  140. if(options.shopid){
  141. this.params.shop_id=options.shopid
  142. }
  143. },
  144. onShow() {
  145. this.getGroup();
  146. this.getHotGroup();
  147. },
  148. onPullDownRefresh() {
  149. this.page = 1;
  150. this.hotGroupList = [];
  151. this.groupList = [];
  152. this.getGroup();
  153. this.getHotGroup();
  154. uni.stopPullDownRefresh();
  155. },
  156. onReachBottom() {
  157. this.page++;
  158. this.getHotGroup();
  159. },
  160. methods: {
  161. goProductDetails(url) {
  162. uni.navigateTo({
  163. url: url,
  164. });
  165. },
  166. imgActiveFun(e) {
  167. this.activeBannerIndex = e.detail.current;
  168. },
  169. getGroup() {
  170. this.$http
  171. .get(
  172. `/groupbuy/activitygoods/will-you-spell`,
  173. { limit: 12, page: 1 ,...this.params},
  174. false
  175. )
  176. .then((res) => {
  177. if (res && res.code == 200) {
  178. this.groupList = res.list;
  179. }
  180. });
  181. },
  182. getHotGroup() {
  183. this.$http
  184. .get(
  185. `/groupbuy/activitygoods/will-you-spell-page`,
  186. { limit: 10, page: this.page,...this.params },
  187. false
  188. )
  189. .then((res) => {
  190. if (res && res.code == 200) {
  191. this.hotGroupList =this.page==1? res.page.list:this.hotGroupList.concat(res.page.list);
  192. if (res.page.totalPage <= res.page.currPage) {
  193. this.status = "noMore";
  194. } else {
  195. this.status = "more";
  196. }
  197. }
  198. });
  199. },
  200. },
  201. };
  202. </script>
  203. <style lang="scss" scoped>
  204. .middle {
  205. margin: 0 20rpx 0 0;
  206. .middle-item {
  207. display: flex;
  208. padding: 20rpx 0rpx 25rpx 16rpx;
  209. .image {
  210. image {
  211. width: 187rpx;
  212. height: 187rpx;
  213. border-radius: 18rpx;
  214. }
  215. }
  216. .middle-right {
  217. margin-left: 30rpx;
  218. display: flex;
  219. flex-direction: column;
  220. justify-content: space-between;
  221. width: 100%;
  222. .title {
  223. font-size: 28rpx;
  224. font-weight: 400;
  225. color: #181818;
  226. }
  227. .large-box {
  228. display: flex;
  229. align-items: flex-end;
  230. justify-content: space-between;
  231. .box {
  232. .number {
  233. display: flex;
  234. align-items: flex-end;
  235. margin-top: 25rpx;
  236. .large {
  237. font-size: 36rpx;
  238. color: #ff0000;
  239. font-weight: bold;
  240. text {
  241. font-size: 36rpx;
  242. color: 700;
  243. }
  244. }
  245. .small {
  246. font-size: 22rpx;
  247. font-weight: 500;
  248. color: #cccccc;
  249. text-decoration: line-through;
  250. margin-left: 16rpx;
  251. }
  252. }
  253. .three-people {
  254. font-size: 24rpx;
  255. color: #333333;
  256. font-weight: 400;
  257. text {
  258. color: #fe9000;
  259. }
  260. }
  261. }
  262. .go-group-work {
  263. color: #ffffff;
  264. font-size: 28rpx;
  265. font-weight: 500;
  266. padding: 12rpx 27rpx;
  267. background-color: #FA6138;
  268. border-radius: 32rpx;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. .content {
  275. padding: 0 30rpx;
  276. background-color: #ffffff;
  277. overflow: hidden;
  278. .content-top {
  279. display: flex;
  280. align-items: center;
  281. margin-top: 36rpx;
  282. margin-bottom: 22rpx;
  283. .content-left {
  284. font-size: 36rpx;
  285. color: #1a1a1a;
  286. font-weight: 700;
  287. }
  288. .line {
  289. width: 1rpx;
  290. height: 33rpx;
  291. margin: 0 15rpx;
  292. background-color: #707070;
  293. }
  294. .content-right {
  295. font-size: 24rpx;
  296. color: #666666;
  297. font-weight: 400;
  298. }
  299. }
  300. }
  301. .option {
  302. margin: 30rpx 0;
  303. display: flex;
  304. justify-content: center;
  305. .option-item {
  306. background-color: #d9d9d9;
  307. margin: 0 8rpx;
  308. width: 14rpx;
  309. height: 14rpx;
  310. border-radius: 7rpx;
  311. }
  312. .active {
  313. background-color: #FA6138;
  314. width: 35rpx;
  315. height: 14rpx;
  316. border-radius: 7rpx;
  317. }
  318. }
  319. .commodity {
  320. margin-top: -195rpx;
  321. margin-left: 30rpx;
  322. margin-right: 30rpx;
  323. height: 367rpx;
  324. /deep/ .uni-swiper-slide-frame {
  325. width: 42% !important;
  326. }
  327. .commodity-item {
  328. // margin-right: 30rpx;
  329. border-radius: 16rpx;
  330. background-color: #ffffff;
  331. padding: 18rpx;
  332. text-align: center;
  333. display: flex;
  334. flex-direction: column;
  335. align-items: center;
  336. image {
  337. width: 232rpx;
  338. height: 232rpx;
  339. border-radius: 16rpx;
  340. }
  341. .completed {
  342. font-size: 22rpx;
  343. margin-top: 2rpx;
  344. font-weight: 400;
  345. color: #333333;
  346. text {
  347. color: #ff0000;
  348. }
  349. }
  350. .number {
  351. margin-top: 20rpx;
  352. font-size: 22rpx;
  353. color: #333333;
  354. font-weight: 500;
  355. display: flex;
  356. align-items: center;
  357. .zero {
  358. margin-left: 20rpx;
  359. font-size: 22rpx;
  360. color: #ff0000;
  361. font-weight: 500;
  362. }
  363. .one {
  364. color: #ff0000;
  365. font-size: 34rpx;
  366. font-weight: 700;
  367. }
  368. .two {
  369. color: #ff0000;
  370. font-size: 18rpx;
  371. font-weight: 700;
  372. }
  373. }
  374. }
  375. }
  376. .today {
  377. background-color: #FA6138;
  378. overflow: hidden;
  379. height: 300rpx;
  380. .today-item {
  381. display: flex;
  382. align-items: center;
  383. margin: 30rpx;
  384. .today-left {
  385. font-size: 36rpx;
  386. color: #ffffff;
  387. font-weight: 700;
  388. }
  389. .line {
  390. width: 1rpx;
  391. height: 33rpx;
  392. background-color: #ffffff;
  393. margin: 0 15rpx;
  394. }
  395. .surplus {
  396. font-size: 24rpx;
  397. color: #ffffff;
  398. font-weight: 400;
  399. margin-right: 14rpx;
  400. }
  401. .time {
  402. font-size: 24rpx;
  403. font-weight: 500;
  404. color: #ffffff;
  405. text {
  406. color: #ff0000;
  407. padding: 0 4rpx;
  408. background-color: #dccda4;
  409. border-radius: 4rpx;
  410. margin: 0 4rpx;
  411. }
  412. }
  413. }
  414. }
  415. .group-list {
  416. background-color: #f6f6f6;
  417. }
  418. </style>