list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <s-layout navbar="inner" :bgStyle="{ color: '#FE832A' }">
  3. <view
  4. class="page-bg"
  5. :style="[{ marginTop: '-' + Number(statusBarHeight + 88) + 'rpx' }]"
  6. ></view>
  7. <view class="list-content">
  8. <!-- 参团会员统计 -->
  9. <view class="content-header ss-flex-col ss-col-center ss-row-center">
  10. <view class="content-header-title ss-flex ss-row-center">
  11. <view v-for="(item, index) in state.summaryData.avatars" :key="index" class="picture"
  12. :style='index === 6 ? "position: relative" : "position: static"'>
  13. <span class="avatar" :style='`background-image: url(${item})`'></span>
  14. <span v-if="index === 6 && state.summaryData.avatars.length > 3" class="mengceng">
  15. <i>···</i>
  16. </span>
  17. </view>
  18. <text class="pic_count">{{ state.summaryData.userCount || 0 }}人参与</text>
  19. </view>
  20. </view>
  21. <scroll-view
  22. class="scroll-box"
  23. :style="{ height: pageHeight + 'rpx' }"
  24. scroll-y="true"
  25. :scroll-with-animation="false"
  26. :enable-back-to-top="true"
  27. >
  28. <view class="goods-box ss-m-b-20" v-for="item in state.pagination.data" :key="item.id">
  29. <s-goods-column
  30. class=""
  31. size="lg"
  32. :data="item"
  33. :grouponTag="true"
  34. @click="sheep.$router.go('/pages/goods/groupon', { id: item.id })"
  35. >
  36. <template v-slot:cart>
  37. <button class="ss-reset-button cart-btn">去拼团</button>
  38. </template>
  39. </s-goods-column>
  40. </view>
  41. <uni-load-more
  42. v-if="state.pagination.total > 0"
  43. :status="state.loadStatus"
  44. :content-text="{
  45. contentdown: '上拉加载更多',
  46. }"
  47. @tap="loadMore"
  48. />
  49. </scroll-view>
  50. </view>
  51. </s-layout>
  52. </template>
  53. <script setup>
  54. import { reactive } from 'vue';
  55. import { onLoad, onReachBottom } from '@dcloudio/uni-app';
  56. import sheep from '@/sheep';
  57. import CombinationApi from "@/sheep/api/promotion/combination";
  58. const { safeAreaInsets, safeArea } = sheep.$platform.device;
  59. const sysNavBar = sheep.$platform.navbar;
  60. const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
  61. const pageHeight = (safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sysNavBar - 350;
  62. const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-header.png');
  63. const state = reactive({
  64. pagination: {
  65. data: [],
  66. pageNo: 1,
  67. total: 1,
  68. },
  69. loadStatus: '',
  70. summaryData: {}
  71. });
  72. // 加载统计数据
  73. const getSummary = async () => {
  74. const { data } = await CombinationApi.getCombinationRecordSummary()
  75. state.summaryData = data
  76. }
  77. // 加载活动列表
  78. async function getList(pageNo = 1, pageSize = 10) {
  79. state.loadStatus = 'loading';
  80. const { data } = await CombinationApi.getCombinationActivityPage({
  81. pageNo,
  82. pageSize,
  83. });
  84. data.list.forEach(activity => {
  85. state.pagination.data.push({...activity, price: activity.combinationPrice})
  86. })
  87. state.pagination.total = data.total;
  88. state.pagination.pageNo = pageNo;
  89. state.loadStatus = state.pagination.data.length < state.pagination.total ? 'more' : 'noMore';
  90. }
  91. // 加载更多
  92. function loadMore() {
  93. if (state.loadStatus !== 'noMore') {
  94. getList(state.pagination.pageNo + 1);
  95. }
  96. }
  97. // 上拉加载更多
  98. onReachBottom(() => loadMore());
  99. // 页面初始化
  100. onLoad( () => {
  101. getSummary();
  102. getList();
  103. });
  104. </script>
  105. <style lang="scss" scoped>
  106. .page-bg {
  107. width: 100%;
  108. height: 458rpx;
  109. margin-top: -88rpx;
  110. background: v-bind(headerBg) no-repeat;
  111. background-size: 100% 100%;
  112. }
  113. .list-content {
  114. position: relative;
  115. z-index: 3;
  116. margin: -190rpx 20rpx 0 20rpx;
  117. background: #fff;
  118. border-radius: 20rpx 20rpx 0 0;
  119. .content-header {
  120. width: 100%;
  121. border-radius: 20rpx 20rpx 0 0;
  122. height: 100rpx;
  123. background: linear-gradient(180deg, #fff4f7, #ffe4d1);
  124. .content-header-title {
  125. width: 100%;
  126. font-size: 30rpx;
  127. font-weight: 500;
  128. color: #ff2923;
  129. line-height: 30rpx;
  130. position: relative;
  131. .more {
  132. position: absolute;
  133. right: 30rpx;
  134. top: 0;
  135. font-size: 24rpx;
  136. font-weight: 400;
  137. color: #999999;
  138. line-height: 30rpx;
  139. }
  140. .picture {
  141. display: inline-table;
  142. }
  143. .avatar {
  144. width: 38rpx;
  145. height: 38rpx;
  146. display: inline-table;
  147. vertical-align: middle;
  148. -webkit-user-select: none;
  149. -moz-user-select: none;
  150. -ms-user-select: none;
  151. user-select: none;
  152. border-radius: 50%;
  153. background-repeat: no-repeat;
  154. background-size: cover;
  155. background-position: 0 0;
  156. margin-right: -10rpx;
  157. box-shadow: 0 0 0 1px #fe832a;
  158. }
  159. .pic_count {
  160. margin-left: 30rpx;
  161. font-size: 22rpx;
  162. font-weight: 500;
  163. width: auto;
  164. height: auto;
  165. background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
  166. color: #FFFFFF;
  167. border-radius: 19rpx;
  168. padding: 4rpx 14rpx;
  169. }
  170. .mengceng {
  171. width: 40rpx;
  172. height: 40rpx;
  173. line-height: 36rpx;
  174. background: rgba(51, 51, 51, 0.6);
  175. text-align: center;
  176. border-radius: 50%;
  177. opacity: 1;
  178. position: absolute;
  179. left: -2rpx;
  180. color: #FFF;
  181. top: 2rpx;
  182. i{
  183. font-style: normal;
  184. font-size: 20rpx;
  185. }
  186. }
  187. }
  188. }
  189. .scroll-box {
  190. height: 900rpx;
  191. .goods-box {
  192. position: relative;
  193. .cart-btn {
  194. position: absolute;
  195. bottom: 10rpx;
  196. right: 20rpx;
  197. z-index: 11;
  198. height: 50rpx;
  199. line-height: 50rpx;
  200. padding: 0 20rpx;
  201. border-radius: 25rpx;
  202. font-size: 24rpx;
  203. color: #fff;
  204. background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
  205. }
  206. }
  207. }
  208. }
  209. </style>