list.vue 9.0 KB

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