GroupBuy.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="group-work u-skeleton-fillet">
  3. <view
  4. class="head-item"
  5. @click="goDetail('/pages/groupBuying/list')"
  6. :style="{ backgroundImage: `url(${bgImage || ''})` }"
  7. >
  8. <view class="top-left">
  9. <view class="top-left-title">拼团购</view>
  10. <view class="top-left-tip">精选好物推荐</view>
  11. </view>
  12. <view class="top-right" style="color: #75c27a">
  13. <text>查看更多</text>
  14. <!-- <text class="iconfont u-font24">&#xe6c7;</text> -->
  15. <uv-icon name="arrow-right" size="24rpx" color="#75c27a"></uv-icon>
  16. </view>
  17. </view>
  18. <view
  19. class="group-work-main"
  20. v-if="(groupList && groupList.length > 0) || skeletonShow"
  21. >
  22. <view
  23. class="middle_item"
  24. v-for="item in skeletonShow ? 1 : groupList"
  25. :key="item.id"
  26. >
  27. <view
  28. class="middle"
  29. @click="goProductDetails('/pages/groupBuying/details?id=' + item.id)"
  30. >
  31. <view class="middle-left">
  32. <!-- ?x-oss-process=style/w_350 -->
  33. <image
  34. v-if="item && item.coverImage"
  35. :src="`${item.coverImage}`"
  36. mode="aspectFill"
  37. >
  38. </image>
  39. </view>
  40. <view class="middle-right">
  41. <view class="middle-title u-text2">{{ item.title }}</view>
  42. <view class="division">
  43. <view class="middle-num">
  44. <view class="contain">
  45. <view class="large">
  46. <rich-text
  47. :nodes="$mUtil.priceBigSmall(item.minPrice)"
  48. ></rich-text>
  49. </view>
  50. <view class="small">¥ {{ item.minSalePrice }}</view>
  51. </view>
  52. <view class="three"
  53. >{{ item.groupPeopleNum }}人团,已拼
  54. <text style="color: red"> {{ item.resultSaleNum }}</text>
  55. 件</view
  56. >
  57. </view>
  58. <view class="button">去拼团</view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <noData v-else :config="{ top: 1, content: '暂无商品~' }"></noData>
  65. </view>
  66. </template>
  67. <script setup>
  68. import { ref, onMounted } from "vue";
  69. import { activitygoodswillYouSpellPage_Api } from "@/api/groupbuy";
  70. const props = defineProps({
  71. skeletonShow: {
  72. type: Boolean,
  73. default: false,
  74. },
  75. bgImage: {
  76. type: String,
  77. default: "",
  78. },
  79. });
  80. const emit = defineEmits(["goDetail", "goProductDetails"]);
  81. const groupList = ref([]);
  82. const goDetail = (url) => {
  83. emit("goDetail", url);
  84. };
  85. const goProductDetails = (url) => {
  86. emit("goProductDetails", url);
  87. };
  88. /**团购 */
  89. const getgroupList = () => {
  90. activitygoodswillYouSpellPage_Api({
  91. pageSize: 10,
  92. pageNum: 1,
  93. }).then((res) => {
  94. if (res && res.code == 200) {
  95. groupList.value = res.rows || [];
  96. }
  97. });
  98. };
  99. onMounted(() => {
  100. getgroupList();
  101. });
  102. defineExpose({
  103. init: getgroupList,
  104. });
  105. </script>
  106. <style scoped lang="scss">
  107. .group-work {
  108. margin: 30rpx 0;
  109. background: #d4f2e8;
  110. padding-bottom: 30rpx;
  111. border-radius: 10rpx;
  112. box-sizing: border-box;
  113. overflow: hidden;
  114. .group-work-main {
  115. padding: 30rpx;
  116. margin: 20rpx 30rpx 0 30rpx;
  117. box-sizing: border-box;
  118. background-color: #ffffff;
  119. border-radius: 10rpx;
  120. }
  121. }
  122. .head-item {
  123. display: flex;
  124. align-items: center;
  125. justify-content: space-between;
  126. padding: 27rpx 30rpx;
  127. box-sizing: border-box;
  128. overflow: hidden;
  129. background-size: 100% 100%;
  130. background-repeat: no-repeat;
  131. .top-left {
  132. .top-left-title {
  133. font-size: 36rpx;
  134. font-family: PingFang SC, PingFang SC-Bold;
  135. font-weight: 700;
  136. }
  137. .top-left-tip {
  138. font-size: 24rpx;
  139. font-family: PingFang SC, PingFang SC-Regular;
  140. font-weight: 400;
  141. margin-top: 5rpx;
  142. }
  143. }
  144. .top-right {
  145. width: 165rpx;
  146. height: 67rpx;
  147. line-height: 67rpx;
  148. background: #ffffff;
  149. border-radius: 34rpx;
  150. box-sizing: border-box;
  151. font-size: 24rpx;
  152. font-family: PingFang SC, PingFang SC-Regular;
  153. font-weight: 400;
  154. text-align: center;
  155. display: flex;
  156. align-items: center;
  157. justify-content: center;
  158. }
  159. }
  160. .middle_item {
  161. padding: 0 30rpx;
  162. }
  163. .middle_item:last-child {
  164. border: none;
  165. }
  166. .middle {
  167. display: flex;
  168. border-bottom: 1rpx solid #f7f7f7;
  169. padding-bottom: 40rpx;
  170. padding-top: 42rpx;
  171. .middle-left {
  172. margin-right: 20rpx;
  173. image {
  174. width: 226rpx;
  175. height: 226rpx;
  176. border-radius: 10rpx;
  177. }
  178. }
  179. .middle-right {
  180. width: 100%;
  181. display: flex;
  182. flex-direction: column;
  183. justify-content: space-between;
  184. margin-top: 10rpx;
  185. padding-bottom: 10rpx;
  186. .middle-title {
  187. font-size: 28rpx;
  188. margin-top: 10rpx;
  189. color: #181818;
  190. font-weight: 400;
  191. line-height: 36rpx;
  192. }
  193. .division {
  194. display: flex;
  195. width: 100%;
  196. padding-bottom: 10rpx;
  197. justify-content: space-between;
  198. }
  199. .middle-num {
  200. flex: 1;
  201. .contain {
  202. display: flex;
  203. align-items: flex-end;
  204. }
  205. .three {
  206. font-size: 24rpx;
  207. font-weight: Regular;
  208. color: #333333;
  209. line-height: 24rpx;
  210. margin-top: 8rpx;
  211. }
  212. .large {
  213. color: #00bf5a;
  214. font-size: 36rpx;
  215. font-weight: Bold;
  216. line-height: 24rpx;
  217. }
  218. .small {
  219. margin-left: 16rpx;
  220. font-size: 22rpx;
  221. font-weight: 500;
  222. color: #cccccc;
  223. line-height: 24rpx;
  224. text-decoration: line-through;
  225. }
  226. }
  227. .button {
  228. width: 130rpx;
  229. height: 60rpx;
  230. text-align: center;
  231. line-height: 60rpx;
  232. color: #ffffff;
  233. font-size: 28rpx;
  234. background: #069d4d;
  235. border-radius: 32rpx;
  236. }
  237. }
  238. }
  239. </style>