1234567891011121314151617181920212223242526272829303132333435363738394041 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- 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 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.getTimeStatusEnum = getTimeStatusEnum;
|