2023-11-22 08:57:59 +00:00
|
|
|
// ========== MALL - 营销模块 ==========
|
|
|
|
|
2024-01-11 03:08:14 +00:00
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
2023-11-22 08:57:59 +00:00
|
|
|
/**
|
|
|
|
* 优惠类型枚举
|
|
|
|
*/
|
|
|
|
export const PromotionDiscountTypeEnum = {
|
|
|
|
PRICE: {
|
|
|
|
type: 1,
|
|
|
|
name: '满减'
|
|
|
|
},
|
|
|
|
PERCENT: {
|
|
|
|
type: 2,
|
|
|
|
name: '折扣'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 优惠劵模板的有限期类型的枚举
|
|
|
|
*/
|
|
|
|
export const CouponTemplateValidityTypeEnum = {
|
|
|
|
DATE: {
|
|
|
|
type: 1,
|
|
|
|
name: '固定日期可用'
|
|
|
|
},
|
|
|
|
TERM: {
|
|
|
|
type: 2,
|
|
|
|
name: '领取之后可用'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 营销的商品范围枚举
|
|
|
|
*/
|
|
|
|
export const PromotionProductScopeEnum = {
|
|
|
|
ALL: {
|
|
|
|
scope: 1,
|
|
|
|
name: '通用劵'
|
|
|
|
},
|
|
|
|
SPU: {
|
|
|
|
scope: 2,
|
|
|
|
name: '商品劵'
|
|
|
|
},
|
|
|
|
CATEGORY: {
|
|
|
|
scope: 3,
|
|
|
|
name: '品类劵'
|
|
|
|
}
|
|
|
|
}
|
2024-01-11 03:08:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
// 时间段的状态枚举
|
|
|
|
export const TimeStatusEnum = {
|
|
|
|
WAIT_START: '即将开始',
|
|
|
|
STARTED: '进行中',
|
|
|
|
END: '已结束',
|
|
|
|
}
|
|
|
|
|
2024-07-24 09:17:44 +00:00
|
|
|
// TODO 订阅模版枚举
|
|
|
|
export const SubscribeTemplate = {
|
|
|
|
ORDER_AFTERSALE_CHANGE: "售后进度通知",
|
2024-07-30 09:44:55 +00:00
|
|
|
WALLET_RECHARGER_PAID: "充值成功通知",
|
|
|
|
WALLET_RECHARGE_REFUNDED: "退款申请通知",
|
|
|
|
DELIVERY_ORDER: "订单发货通知",
|
2024-07-24 09:17:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-01-11 03:08:14 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|