接入拼团
This commit is contained in:
@@ -51,8 +51,7 @@
|
||||
const typePath = type === 1 ? 'seckill' :
|
||||
type === 2 ? 'TODO 拼团' : 'groupon';
|
||||
sheep.$router.go(`/pages/goods/${typePath}`, {
|
||||
id: activity.spuId,
|
||||
activity_id: activity.id,
|
||||
id: activity.id,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
});
|
||||
const value = computed(() => {
|
||||
if (!props.sku.id) {
|
||||
if (!props.sku?.id) {
|
||||
return '请选择商品规格';
|
||||
}
|
||||
let str = '';
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
<!-- 拼团活动参团记录卡片 -->
|
||||
<template>
|
||||
<view v-if="state.list.length > 0" class="groupon-list detail-card ss-p-x-20">
|
||||
<view class="join-activity ss-flex ss-row-between ss-m-t-30">
|
||||
<view class="">已有{{ modelValue.sales }}人参与活动</view>
|
||||
<!-- todo: 接口缺少总数 -->
|
||||
<view class="">已有{{ state.list.length }}人参与活动</view>
|
||||
<text class="cicon-forward"></text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(item, index) in state.list"
|
||||
@tap="sheep.$router.go('/pages/activity/groupon/detail', { id: item.id })"
|
||||
v-for="(record, index) in state.list"
|
||||
@tap="sheep.$router.go('/pages/activity/groupon/detail', { id: record.id })"
|
||||
:key="index"
|
||||
class="ss-m-t-40 ss-flex ss-row-between border-bottom ss-p-b-30"
|
||||
>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<image :src="sheep.$url.cdn(item.leader.avatar)" class="user-avatar"></image>
|
||||
<view class="user-nickname ss-m-l-20 ss-line-1">{{ item.leader.nickname }}</view>
|
||||
<image :src="sheep.$url.cdn(record.avatar)" class="user-avatar"></image>
|
||||
<view class="user-nickname ss-m-l-20 ss-line-1">{{ record.nickname }}</view>
|
||||
</view>
|
||||
<view class="ss-flex ss-col-center">
|
||||
<view class="ss-flex-col ss-col-bottom ss-m-r-20">
|
||||
<view class="title ss-flex ss-m-b-14">
|
||||
还差
|
||||
<view class="num">{{ item.num - item.current_num }}人</view>
|
||||
<view class="num">{{ record.userSize - record.userCount }}人</view>
|
||||
成团
|
||||
</view>
|
||||
<view class="end-time">{{ endTime(item.expire_time) }}</view>
|
||||
<view class="end-time">{{ endTime(record.expireTime) }}</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<button class="ss-reset-button go-btn" @tap.stop="onJoinGroupon(item)"> 去参团 </button>
|
||||
<button class="ss-reset-button go-btn" @tap.stop="onJoinGroupon(record)"> 去参团 </button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -35,6 +37,7 @@
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import { useDurationTime } from '@/sheep/hooks/useGoods';
|
||||
import CombinationApi from "@/sheep/api/promotion/combination";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@@ -45,13 +48,14 @@
|
||||
const state = reactive({
|
||||
list: [],
|
||||
});
|
||||
const emits = defineEmits(['join']);
|
||||
|
||||
function onJoinGroupon(groupon) {
|
||||
emits('join', groupon);
|
||||
// 去参团
|
||||
const emits = defineEmits(['join']);
|
||||
function onJoinGroupon(record) {
|
||||
emits('join', record);
|
||||
}
|
||||
|
||||
// 倒计时
|
||||
// 结束时间或状态
|
||||
function endTime(time) {
|
||||
const durationTime = useDurationTime(time);
|
||||
|
||||
@@ -66,12 +70,11 @@
|
||||
return timeText;
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(async () => {
|
||||
const { data } = await sheep.$api.activity.getGrouponList({
|
||||
goods_id: props.modelValue.id,
|
||||
activity_id: props.modelValue.activity.id,
|
||||
});
|
||||
state.list = data.data;
|
||||
// 查询参团记录
|
||||
const { data } = await CombinationApi.getHeadCombinationRecordList(props.modelValue.id, 1 , 10);
|
||||
state.list = data;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user