diff --git a/pages/activity/seckill/list.vue b/pages/activity/seckill/list.vue
index 6130eab8..a1714bba 100644
--- a/pages/activity/seckill/list.vue
+++ b/pages/activity/seckill/list.vue
@@ -106,13 +106,7 @@
import { useDurationTime } from '@/sheep/hooks/useGoods';
import SeckillApi from "@/sheep/api/promotion/seckill";
import dayjs from "dayjs";
-
- // 时间段的状态枚举
- const TimeStatusEnum = {
- WAIT_START: '即将开始',
- STARTED: '进行中',
- END: '已结束',
- }
+ import {TimeStatusEnum} from "@/sheep/util/const";
// 计算页面高度
const { safeAreaInsets, safeArea } = sheep.$platform.device;
diff --git a/pages/goods/groupon.vue b/pages/goods/groupon.vue
index 6bd3da5a..e30e9cb0 100644
--- a/pages/goods/groupon.vue
+++ b/pages/goods/groupon.vue
@@ -133,7 +133,6 @@
-
diff --git a/pages/goods/seckill.vue b/pages/goods/seckill.vue
index 29091f0f..060609f5 100644
--- a/pages/goods/seckill.vue
+++ b/pages/goods/seckill.vue
@@ -5,7 +5,7 @@
-
+
-
+
- {{ state.goodsInfo.name }}
+ {{ state.goodsInfo?.name }}
{{ state.goodsInfo.introduction }}
@@ -108,30 +107,27 @@
-
@@ -154,6 +150,7 @@
import detailProgress from './components/detail/detail-progress.vue';
import SeckillApi from "@/sheep/api/promotion/seckill";
import SpuApi from "@/sheep/api/product/spu";
+ import {getTimeStatusEnum, TimeStatusEnum} from "@/sheep/util/const";
const headerBg = sheep.$url.css('/static/img/shop/goods/seckill-bg.png');
const btnBg = sheep.$url.css('/static/img/shop/goods/seckill-btn.png');
@@ -186,49 +183,51 @@
}
// 立即购买
- function onBuy(e) {
+ function onBuy(sku) {
sheep.$router.go('/pages/order/confirm', {
data: JSON.stringify({
order_type: 'goods',
buy_type: 'seckill',
- activityId: activity.value.id,
- goods_list: [
+ seckillActivityId: activity.value.id,
+ items: [
{
- goods_id: e.goods_id,
- goods_num: e.goods_num,
- goods_sku_price_id: e.id,
+ skuId: sku.id,
+ count: sku.count,
},
],
}),
});
}
+ // 分享信息
const shareInfo = computed(() => {
- if (isEmpty(state.goodsInfo?.activity)) return {};
+ if (isEmpty(activity)) return {};
return sheep.$platform.share.getShareInfo(
{
- title: state.goodsInfo.name,
+ title: activity.value.name,
image: sheep.$url.cdn(state.goodsInfo.picUrl),
params: {
page: '4',
- query: state.goodsInfo.id + ',' + activity.value.id,
+ query: activity.value.id,
},
},
{
type: 'goods', // 商品海报
- title: state.goodsInfo.name, // 商品标题
+ title: activity.value.name, // 商品标题
image: sheep.$url.cdn(state.goodsInfo.picUrl), // 商品主图
- price: state.goodsInfo.price[0], // 商品价格
+ price: state.goodsInfo.price, // 商品价格
marketPrice: state.goodsInfo.marketPrice, // 商品原价
},
);
});
const activity = ref()
+ const timeStatusEnum = ref('')
// 查询活动
const getActivity = async (id) => {
const { data } = await SeckillApi.getSeckillActivity(id)
activity.value = data
+ timeStatusEnum.value = getTimeStatusEnum(activity.startTime, activity.endTime)
// 查询商品
await getSpu(data.spuId)
@@ -247,7 +246,6 @@
// 价格、库存使用活动的
data.skus.forEach(sku => {
- debugger
const product = activity.value.products.find(product => product.skuId === sku.id);
if (product) {
sku.price = product.seckillPrice;
diff --git a/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue b/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue
index eee87401..1764035f 100644
--- a/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue
+++ b/sheep/components/s-select-seckill-sku/s-select-seckill-sku.vue
@@ -281,7 +281,7 @@
// 判断所有 property 大类是否选择完成
if (choosePropertyId.length === propertyList.length && newSkuList.length) {
- newSkuList[0].goods_num = state.selectedSku.goods_num || 1;
+ newSkuList[0].count = state.selectedSku.count || 1;
state.selectedSku = newSkuList[0];
} else {
state.selectedSku = {};
diff --git a/sheep/util/const.js b/sheep/util/const.js
index 9bf6ae22..e5eba0c2 100644
--- a/sheep/util/const.js
+++ b/sheep/util/const.js
@@ -1,5 +1,7 @@
// ========== MALL - 营销模块 ==========
+import dayjs from "dayjs";
+
/**
* 优惠类型枚举
*/
@@ -45,3 +47,22 @@ export const PromotionProductScopeEnum = {
name: '品类劵'
}
}
+
+
+// 时间段的状态枚举
+export const TimeStatusEnum = {
+ WAIT_START: '即将开始',
+ STARTED: '进行中',
+ END: '已结束',
+}
+
+export const getTimeStatusEnum = (startTime, endTime) => {
+ const now = dayjs();
+ if (now.isBefore(startTime)) {
+ return TimeStatusEnum.WAIT_START;
+ } else if (now.isAfter(endTime)) {
+ return TimeStatusEnum.END;
+ } else {
+ return TimeStatusEnum.STARTED;
+ }
+}