75 lines
1.8 KiB
JavaScript
75 lines
1.8 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const TerminalEnum = {
|
|
UNKNOWN: 0,
|
|
// 未知, 目的:在无法解析到 terminal 时,使用它
|
|
WECHAT_MINI_PROGRAM: 10,
|
|
// 微信小程序
|
|
WECHAT_WAP: 11,
|
|
// 微信公众号
|
|
H5: 20,
|
|
// H5 网页
|
|
APP: 31
|
|
// 手机 App
|
|
};
|
|
const getTerminal = () => {
|
|
const platformType = common_vendor.index.getSystemInfoSync().uniPlatform;
|
|
switch (platformType) {
|
|
case "app":
|
|
return TerminalEnum.APP;
|
|
case "web":
|
|
return TerminalEnum.H5;
|
|
case "mp-weixin":
|
|
return TerminalEnum.WECHAT_MINI_PROGRAM;
|
|
default:
|
|
return TerminalEnum.UNKNOWN;
|
|
}
|
|
};
|
|
const PromotionDiscountTypeEnum = {
|
|
PRICE: {
|
|
type: 1,
|
|
name: "满减"
|
|
},
|
|
PERCENT: {
|
|
type: 2,
|
|
name: "折扣"
|
|
}
|
|
};
|
|
const CouponTemplateValidityTypeEnum = {
|
|
DATE: {
|
|
type: 1,
|
|
name: "固定日期可用"
|
|
},
|
|
TERM: {
|
|
type: 2,
|
|
name: "领取之后可用"
|
|
}
|
|
};
|
|
const TimeStatusEnum = {
|
|
WAIT_START: "即将开始",
|
|
STARTED: "进行中",
|
|
END: "已结束"
|
|
};
|
|
const WxaSubscribeTemplate = {
|
|
TRADE_ORDER_DELIVERY: "订单发货通知",
|
|
PROMOTION_COMBINATION_SUCCESS: "拼团结果通知",
|
|
PAY_WALLET_RECHARGER_SUCCESS: "充值成功通知"
|
|
};
|
|
const getTimeStatusEnum = (startTime, endTime) => {
|
|
const now = common_vendor.dayjs();
|
|
if (now.isBefore(startTime)) {
|
|
return TimeStatusEnum.WAIT_START;
|
|
} else if (now.isAfter(endTime)) {
|
|
return TimeStatusEnum.END;
|
|
} else {
|
|
return TimeStatusEnum.STARTED;
|
|
}
|
|
};
|
|
exports.CouponTemplateValidityTypeEnum = CouponTemplateValidityTypeEnum;
|
|
exports.PromotionDiscountTypeEnum = PromotionDiscountTypeEnum;
|
|
exports.TimeStatusEnum = TimeStatusEnum;
|
|
exports.WxaSubscribeTemplate = WxaSubscribeTemplate;
|
|
exports.getTerminal = getTerminal;
|
|
exports.getTimeStatusEnum = getTimeStatusEnum;
|
|
//# sourceMappingURL=const.js.map
|