2024-01-13 11:08:55 +00:00
|
|
|
<!-- 拼团活动列表 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
<template>
|
|
|
|
<s-layout navbar="inner" :bgStyle="{ color: '#FE832A' }">
|
2024-01-13 11:08:55 +00:00
|
|
|
<view class="page-bg" :style="[{ marginTop: '-' + Number(statusBarHeight + 88) + 'rpx' }]" />
|
2022-11-22 07:45:36 +00:00
|
|
|
<view class="list-content">
|
2024-01-10 14:57:06 +00:00
|
|
|
<!-- 参团会员统计 -->
|
2022-11-22 07:45:36 +00:00
|
|
|
<view class="content-header ss-flex-col ss-col-center ss-row-center">
|
2024-01-10 14:57:06 +00:00
|
|
|
<view class="content-header-title ss-flex ss-row-center">
|
2024-01-13 11:08:55 +00:00
|
|
|
<view
|
|
|
|
v-for="(item, index) in state.summaryData.avatars"
|
|
|
|
:key="index"
|
|
|
|
class="picture"
|
|
|
|
:style="index === 6 ? 'position: relative' : 'position: static'"
|
|
|
|
>
|
|
|
|
<span class="avatar" :style="`background-image: url(${item})`" />
|
2024-01-10 14:57:06 +00:00
|
|
|
<span v-if="index === 6 && state.summaryData.avatars.length > 3" class="mengceng">
|
|
|
|
<i>···</i>
|
|
|
|
</span>
|
2022-11-22 07:45:36 +00:00
|
|
|
</view>
|
2024-01-10 14:57:06 +00:00
|
|
|
<text class="pic_count">{{ state.summaryData.userCount || 0 }}人参与</text>
|
2022-11-22 07:45:36 +00:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<scroll-view
|
|
|
|
class="scroll-box"
|
|
|
|
:style="{ height: pageHeight + 'rpx' }"
|
|
|
|
scroll-y="true"
|
|
|
|
:scroll-with-animation="false"
|
|
|
|
:enable-back-to-top="true"
|
|
|
|
>
|
2024-01-13 11:08:55 +00:00
|
|
|
<view class="goods-box ss-m-b-20" v-for="item in state.pagination.list" :key="item.id">
|
2022-11-22 07:45:36 +00:00
|
|
|
<s-goods-column
|
|
|
|
class=""
|
|
|
|
size="lg"
|
|
|
|
:data="item"
|
|
|
|
:grouponTag="true"
|
2024-01-10 14:57:06 +00:00
|
|
|
@click="sheep.$router.go('/pages/goods/groupon', { id: item.id })"
|
2022-11-22 07:45:36 +00:00
|
|
|
>
|
|
|
|
<template v-slot:cart>
|
|
|
|
<button class="ss-reset-button cart-btn">去拼团</button>
|
|
|
|
</template>
|
|
|
|
</s-goods-column>
|
|
|
|
</view>
|
|
|
|
<uni-load-more
|
|
|
|
v-if="state.pagination.total > 0"
|
|
|
|
:status="state.loadStatus"
|
|
|
|
:content-text="{
|
|
|
|
contentdown: '上拉加载更多',
|
|
|
|
}"
|
2024-01-10 14:57:06 +00:00
|
|
|
@tap="loadMore"
|
2022-11-22 07:45:36 +00:00
|
|
|
/>
|
|
|
|
</scroll-view>
|
|
|
|
</view>
|
|
|
|
</s-layout>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
2024-01-10 14:57:06 +00:00
|
|
|
import { reactive } from 'vue';
|
2022-11-22 07:45:36 +00:00
|
|
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
|
|
|
import sheep from '@/sheep';
|
2024-01-13 11:08:55 +00:00
|
|
|
import CombinationApi from '@/sheep/api/promotion/combination';
|
2022-11-22 07:45:36 +00:00
|
|
|
|
2024-01-10 14:57:06 +00:00
|
|
|
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
|
|
|
const sysNavBar = sheep.$platform.navbar;
|
2022-11-22 07:45:36 +00:00
|
|
|
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
2024-01-13 11:08:55 +00:00
|
|
|
const pageHeight =
|
|
|
|
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sysNavBar - 350;
|
2023-01-29 07:26:45 +00:00
|
|
|
const headerBg = sheep.$url.css('/static/img/shop/goods/groupon-header.png');
|
2022-11-22 07:45:36 +00:00
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
pagination: {
|
2024-01-13 11:08:55 +00:00
|
|
|
list: [],
|
|
|
|
total: 0,
|
2024-01-10 14:57:06 +00:00
|
|
|
pageNo: 1,
|
2024-01-13 11:08:55 +00:00
|
|
|
pageSize: 10,
|
2022-11-22 07:45:36 +00:00
|
|
|
},
|
|
|
|
loadStatus: '',
|
2024-01-13 11:08:55 +00:00
|
|
|
summaryData: {},
|
2022-11-22 07:45:36 +00:00
|
|
|
});
|
|
|
|
|
2024-01-10 14:57:06 +00:00
|
|
|
// 加载统计数据
|
|
|
|
const getSummary = async () => {
|
2024-01-13 11:08:55 +00:00
|
|
|
const { data } = await CombinationApi.getCombinationRecordSummary();
|
|
|
|
state.summaryData = data;
|
|
|
|
};
|
2024-01-10 14:57:06 +00:00
|
|
|
|
|
|
|
// 加载活动列表
|
2024-01-13 11:08:55 +00:00
|
|
|
async function getList() {
|
2022-11-22 07:45:36 +00:00
|
|
|
state.loadStatus = 'loading';
|
2024-01-10 14:57:06 +00:00
|
|
|
const { data } = await CombinationApi.getCombinationActivityPage({
|
2024-01-13 11:08:55 +00:00
|
|
|
pageNo: state.pagination.pageNo,
|
|
|
|
pageSize: state.pagination.pageSize,
|
|
|
|
});
|
|
|
|
data.list.forEach((activity) => {
|
|
|
|
state.pagination.list.push({ ...activity, price: activity.combinationPrice });
|
2022-11-22 07:45:36 +00:00
|
|
|
});
|
2024-01-10 14:57:06 +00:00
|
|
|
state.pagination.total = data.total;
|
2024-01-13 11:08:55 +00:00
|
|
|
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore';
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
2024-01-10 14:57:06 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
// 加载更多
|
2024-01-10 14:57:06 +00:00
|
|
|
function loadMore() {
|
2024-01-13 11:08:55 +00:00
|
|
|
if (state.loadStatus === 'noMore') {
|
|
|
|
return;
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
2024-01-13 11:08:55 +00:00
|
|
|
state.pagination.pageNo++;
|
|
|
|
getList();
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
2024-01-13 11:08:55 +00:00
|
|
|
|
2022-11-22 07:45:36 +00:00
|
|
|
// 上拉加载更多
|
2024-01-10 14:57:06 +00:00
|
|
|
onReachBottom(() => loadMore());
|
2024-01-13 11:08:55 +00:00
|
|
|
|
2024-01-10 14:57:06 +00:00
|
|
|
// 页面初始化
|
2024-01-13 11:08:55 +00:00
|
|
|
onLoad(() => {
|
2024-01-10 14:57:06 +00:00
|
|
|
getSummary();
|
|
|
|
getList();
|
2022-11-22 07:45:36 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.page-bg {
|
|
|
|
width: 100%;
|
|
|
|
height: 458rpx;
|
|
|
|
margin-top: -88rpx;
|
2023-01-17 07:34:16 +00:00
|
|
|
background: v-bind(headerBg) no-repeat;
|
2022-11-22 07:45:36 +00:00
|
|
|
background-size: 100% 100%;
|
|
|
|
}
|
|
|
|
.list-content {
|
|
|
|
position: relative;
|
|
|
|
z-index: 3;
|
|
|
|
margin: -190rpx 20rpx 0 20rpx;
|
|
|
|
background: #fff;
|
|
|
|
border-radius: 20rpx 20rpx 0 0;
|
|
|
|
.content-header {
|
|
|
|
width: 100%;
|
|
|
|
border-radius: 20rpx 20rpx 0 0;
|
2024-01-10 14:57:06 +00:00
|
|
|
height: 100rpx;
|
2022-11-22 07:45:36 +00:00
|
|
|
background: linear-gradient(180deg, #fff4f7, #ffe4d1);
|
|
|
|
.content-header-title {
|
|
|
|
width: 100%;
|
|
|
|
font-size: 30rpx;
|
|
|
|
font-weight: 500;
|
|
|
|
color: #ff2923;
|
|
|
|
line-height: 30rpx;
|
|
|
|
position: relative;
|
|
|
|
.more {
|
|
|
|
position: absolute;
|
|
|
|
right: 30rpx;
|
|
|
|
top: 0;
|
|
|
|
font-size: 24rpx;
|
|
|
|
font-weight: 400;
|
|
|
|
color: #999999;
|
|
|
|
line-height: 30rpx;
|
|
|
|
}
|
2024-01-10 14:57:06 +00:00
|
|
|
|
|
|
|
.picture {
|
|
|
|
display: inline-table;
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
2024-01-10 14:57:06 +00:00
|
|
|
|
|
|
|
.avatar {
|
|
|
|
width: 38rpx;
|
|
|
|
height: 38rpx;
|
|
|
|
display: inline-table;
|
|
|
|
vertical-align: middle;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
border-radius: 50%;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: 0 0;
|
|
|
|
margin-right: -10rpx;
|
|
|
|
box-shadow: 0 0 0 1px #fe832a;
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
2024-01-10 14:57:06 +00:00
|
|
|
|
|
|
|
.pic_count {
|
|
|
|
margin-left: 30rpx;
|
|
|
|
font-size: 22rpx;
|
2022-11-22 07:45:36 +00:00
|
|
|
font-weight: 500;
|
2024-01-10 14:57:06 +00:00
|
|
|
width: auto;
|
|
|
|
height: auto;
|
|
|
|
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
2024-01-13 11:08:55 +00:00
|
|
|
color: #ffffff;
|
2024-01-10 14:57:06 +00:00
|
|
|
border-radius: 19rpx;
|
|
|
|
padding: 4rpx 14rpx;
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
|
|
|
|
2024-01-10 14:57:06 +00:00
|
|
|
.mengceng {
|
|
|
|
width: 40rpx;
|
|
|
|
height: 40rpx;
|
|
|
|
line-height: 36rpx;
|
|
|
|
background: rgba(51, 51, 51, 0.6);
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 50%;
|
|
|
|
opacity: 1;
|
|
|
|
position: absolute;
|
|
|
|
left: -2rpx;
|
2024-01-13 11:08:55 +00:00
|
|
|
color: #fff;
|
2024-01-10 14:57:06 +00:00
|
|
|
top: 2rpx;
|
2024-01-13 11:08:55 +00:00
|
|
|
i {
|
2024-01-10 14:57:06 +00:00
|
|
|
font-style: normal;
|
|
|
|
font-size: 20rpx;
|
2022-11-22 07:45:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.scroll-box {
|
|
|
|
height: 900rpx;
|
|
|
|
.goods-box {
|
|
|
|
position: relative;
|
|
|
|
.cart-btn {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 10rpx;
|
|
|
|
right: 20rpx;
|
|
|
|
z-index: 11;
|
|
|
|
height: 50rpx;
|
|
|
|
line-height: 50rpx;
|
|
|
|
padding: 0 20rpx;
|
|
|
|
border-radius: 25rpx;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #fff;
|
|
|
|
background: linear-gradient(90deg, #ff6600 0%, #fe832a 100%);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|