1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

通过微信开发者工具 商城模板 创建新小程序

This commit is contained in:
2023-03-06 23:52:24 +08:00
parent ada464a8cc
commit c21ff901d5
393 changed files with 52952 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/**
* 优惠券
*
* @typedef {'default'|'useless'|'disabled'} CouponCardStatus
* @typedef {'discount'|'price'} CouponCardType
*
* @param {number} [id]
* @param {CouponCardStatus} [status]
* @param {CouponCardType} [type]
*/
export function getCoupon(id = 0, status = 'default', type = (id % 2) + 1) {
return {
/** key */
key: `${id}`,
/** 优惠券状态 */
status,
/** 优惠券类型 */
type,
/** 折扣或者满减值 */
value: type === 2 ? 5.5 : 1800,
/** 标签 */
tag: '',
/** 描述 */
desc: parseInt(id) > 0 ? `${parseInt(id) * 100}元可用` : '无门槛使用',
/** 订单底价,满n元 */
base: 10000 * (parseInt(id) || 0),
/** 标题 */
title: type === 2 ? `生鲜折扣券 - ${id}` : `生鲜满减券 - ${id}`,
/** 有效时间限制 */
timeLimit: '2019.11.18-2023.12.18',
/** 货币符号 */
currency: '¥',
};
}
/** 优惠券列表 */
export function getCouponList(status = 'default', length = 10) {
return new Array(length).fill(0).map((_, idx) => getCoupon(idx, status));
}