{"version":3,"file":"const.js","sources":["../../../../../src/sheep/util/const.js"],"sourcesContent":["// ========== COMMON - 公共模块 ==========\r\n\r\n/**\r\n * 与后端Terminal枚举一一对应\r\n */\r\n// ========== MALL - 营销模块 ==========\r\n\r\nimport dayjs from 'dayjs'\r\n\r\nexport const TerminalEnum = {\r\n UNKNOWN: 0, // 未知, 目的:在无法解析到 terminal 时,使用它\r\n WECHAT_MINI_PROGRAM: 10, // 微信小程序\r\n WECHAT_WAP: 11, // 微信公众号\r\n H5: 20, // H5 网页\r\n APP: 31, // 手机 App\r\n}\r\n\r\n/**\r\n * 将 uni-app 提供的平台转换为后端所需的 terminal值\r\n *\r\n * @return 终端\r\n */\r\nexport const getTerminal = () => {\r\n const platformType = uni.getSystemInfoSync().uniPlatform\r\n // 与后端terminal枚举一一对应\r\n switch (platformType) {\r\n case 'app':\r\n return TerminalEnum.APP\r\n case 'web':\r\n return TerminalEnum.H5\r\n case 'mp-weixin':\r\n return TerminalEnum.WECHAT_MINI_PROGRAM\r\n default:\r\n return TerminalEnum.UNKNOWN\r\n }\r\n}\r\n\r\n/**\r\n * 优惠类型枚举\r\n */\r\nexport const PromotionDiscountTypeEnum = {\r\n PRICE: {\r\n type: 1,\r\n name: '满减',\r\n },\r\n PERCENT: {\r\n type: 2,\r\n name: '折扣',\r\n },\r\n}\r\n\r\n/**\r\n * 优惠劵模板的有限期类型的枚举\r\n */\r\nexport const CouponTemplateValidityTypeEnum = {\r\n DATE: {\r\n type: 1,\r\n name: '固定日期可用',\r\n },\r\n TERM: {\r\n type: 2,\r\n name: '领取之后可用',\r\n },\r\n}\r\n\r\n/**\r\n * 营销的商品范围枚举\r\n */\r\nexport const PromotionProductScopeEnum = {\r\n ALL: {\r\n scope: 1,\r\n name: '通用劵',\r\n },\r\n SPU: {\r\n scope: 2,\r\n name: '商品劵',\r\n },\r\n CATEGORY: {\r\n scope: 3,\r\n name: '品类劵',\r\n },\r\n}\r\n\r\n// 时间段的状态枚举\r\nexport const TimeStatusEnum = {\r\n WAIT_START: '即将开始',\r\n STARTED: '进行中',\r\n END: '已结束',\r\n}\r\n\r\n/**\r\n * 微信小程序的订阅模版\r\n */\r\nexport const WxaSubscribeTemplate = {\r\n TRADE_ORDER_DELIVERY: '订单发货通知',\r\n PROMOTION_COMBINATION_SUCCESS: '拼团结果通知',\r\n PAY_WALLET_RECHARGER_SUCCESS: '充值成功通知',\r\n}\r\n\r\nexport const getTimeStatusEnum = (startTime, endTime) => {\r\n const now = dayjs()\r\n if (now.isBefore(startTime)) {\r\n return TimeStatusEnum.WAIT_START\r\n } else if (now.isAfter(endTime)) {\r\n return TimeStatusEnum.END\r\n } else {\r\n return TimeStatusEnum.STARTED\r\n }\r\n}\r\n"],"names":["uni","dayjs"],"mappings":";;AASO,MAAM,eAAe;AAAA,EAC1B,SAAS;AAAA;AAAA,EACT,qBAAqB;AAAA;AAAA,EACrB,YAAY;AAAA;AAAA,EACZ,IAAI;AAAA;AAAA,EACJ,KAAK;AAAA;AACP;AAOY,MAAC,cAAc,MAAM;AAC/B,QAAM,eAAeA,cAAAA,MAAI,kBAAiB,EAAG;AAE7C,UAAQ,cAAY;AAAA,IAClB,KAAK;AACH,aAAO,aAAa;AAAA,IACtB,KAAK;AACH,aAAO,aAAa;AAAA,IACtB,KAAK;AACH,aAAO,aAAa;AAAA,IACtB;AACE,aAAO,aAAa;AAAA,EACvB;AACH;AAKY,MAAC,4BAA4B;AAAA,EACvC,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AAAA,EACD,SAAS;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AACH;AAKY,MAAC,iCAAiC;AAAA,EAC5C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AAAA,EACD,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AACH;AAqBY,MAAC,iBAAiB;AAAA,EAC5B,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,KAAK;AACP;AAKY,MAAC,uBAAuB;AAAA,EAClC,sBAAsB;AAAA,EACtB,+BAA+B;AAAA,EAC/B,8BAA8B;AAChC;AAEY,MAAC,oBAAoB,CAAC,WAAW,YAAY;AACvD,QAAM,MAAMC,cAAAA,MAAO;AACnB,MAAI,IAAI,SAAS,SAAS,GAAG;AAC3B,WAAO,eAAe;AAAA,EACvB,WAAU,IAAI,QAAQ,OAAO,GAAG;AAC/B,WAAO,eAAe;AAAA,EAC1B,OAAS;AACL,WAAO,eAAe;AAAA,EACvB;AACH;;;;;;;"}