@yorkjs/hive-biz 0.1.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hive-biz.esm.js +1 -1
- package/dist/hive-biz.esm.js.map +1 -1
- package/dist/hive-biz.esm.min.js +1 -1
- package/dist/hive-biz.esm.min.js.map +1 -1
- package/dist/hive-biz.js +1 -1
- package/dist/hive-biz.js.map +1 -1
- package/dist/hive-biz.min.js +1 -1
- package/dist/hive-biz.min.js.map +1 -1
- package/package.json +1 -1
- package/types/coupon/constant.d.ts +12 -0
- package/types/coupon/couponUtil.d.ts +11 -4
- package/types/coupon/type.d.ts +7 -5
package/package.json
CHANGED
|
@@ -36,6 +36,18 @@ export declare const COUPON_STATUS_EXPIRED = 4;
|
|
|
36
36
|
export declare const COUPON_STATUS_CANCELED = 5;
|
|
37
37
|
/** 券实例状态:已锁定。对齐 coupon.status */
|
|
38
38
|
export declare const COUPON_STATUS_LOCKED = 6;
|
|
39
|
+
/** 券模板状态:草稿。对齐 coupon_template.status */
|
|
40
|
+
export declare const COUPON_TEMPLATE_STATUS_DRAFT = 1;
|
|
41
|
+
/** 券模板状态:已上线。对齐 coupon_template.status */
|
|
42
|
+
export declare const COUPON_TEMPLATE_STATUS_ONLINE = 2;
|
|
43
|
+
/** 券模板状态:已下线。对齐 coupon_template.status */
|
|
44
|
+
export declare const COUPON_TEMPLATE_STATUS_OFFLINE = 3;
|
|
45
|
+
/** 券模板状态:已过期。对齐 coupon_template.status */
|
|
46
|
+
export declare const COUPON_TEMPLATE_STATUS_EXPIRED = 4;
|
|
47
|
+
/** 接口没给 available_error 时,按已知状态补不可用原因 */
|
|
48
|
+
export declare const COUPON_TEMPLATE_STATUS_UNAVAILABLE_ERROR: Record<number, string>;
|
|
49
|
+
/** 券实例独有状态:已注销 / 已锁定。数字不与模板冲突 */
|
|
50
|
+
export declare const COUPON_STATUS_UNAVAILABLE_ERROR: Record<number, string>;
|
|
39
51
|
/** 可用券展开:使用规则等额外信息 */
|
|
40
52
|
export declare const COUPON_EXPAND_TYPE_EXTRA = "extra";
|
|
41
53
|
/** 不可用券展开:本单不可用原因 */
|
|
@@ -2,10 +2,17 @@ import { CouponExpandType, CouponExpireMode, CouponFormatItem, ICoupon, ICouponK
|
|
|
2
2
|
/** id 统一转字符串再比,避免 number / string 回显对不上 */
|
|
3
3
|
export declare function isSameCouponId(a?: string | number, b?: string | number): boolean;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 可用态。
|
|
6
|
+
* 1. availableError 有值:一定不可用
|
|
7
|
+
* 2. 带了 status 则只有 2(已上线 / 已生效)可用
|
|
8
|
+
* 3. 没带 status:没有 availableError 则可用(兼容列表只筛 status、项上不回传该字段)
|
|
7
9
|
*/
|
|
8
|
-
export declare function resolveCouponAvailable(coupon: Pick<ICoupon, 'availableError'>): boolean;
|
|
10
|
+
export declare function resolveCouponAvailable(coupon: Pick<ICoupon, 'availableError' | 'status'>): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 展开用的不可用原因。
|
|
13
|
+
* 接口 availableError 优先;没有时按已知状态补文案(草稿/下线/过期/注销/锁定),其它灰态不展开。
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveCouponAvailableError(coupon: Pick<ICoupon, 'availableError' | 'status'>): string;
|
|
9
16
|
/**
|
|
10
17
|
* 原始列表 → 标准 ICoupon。
|
|
11
18
|
* 有 formatItem 就逐项转换(返回空则跳过);没有则把项当作已是 ICoupon。
|
|
@@ -62,7 +69,7 @@ export declare function getCouponExpandType(coupon: ICoupon): CouponExpandType;
|
|
|
62
69
|
export declare function getCouponExpandLines(coupon: ICoupon): string[];
|
|
63
70
|
/**
|
|
64
71
|
* ICoupon → 票面数据。选券弹层和单独挂 CouponCard 共用。
|
|
65
|
-
* selected / expanded 由调用方控制,available 由 availableError 推出。
|
|
72
|
+
* selected / expanded 由调用方控制,available 由 availableError + status 推出。
|
|
66
73
|
*/
|
|
67
74
|
export declare function formatCouponViewItem(coupon: ICoupon, state?: {
|
|
68
75
|
selected?: boolean;
|
package/types/coupon/type.d.ts
CHANGED
|
@@ -29,9 +29,10 @@ export interface ICoupon {
|
|
|
29
29
|
/** 券名称,对齐 title */
|
|
30
30
|
title: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
* 1
|
|
34
|
-
*
|
|
32
|
+
* 券状态,对齐 coupon.status / coupon_template.status。
|
|
33
|
+
* 模板:1 草稿 / 2 已上线 / 3 已下线 / 4 已过期。
|
|
34
|
+
* 仅在带了 status 时:为 2 且没有 availableError 才可选;availableError 优先于 status。
|
|
35
|
+
* 没带 status 且没有 availableError 时视为可用。
|
|
35
36
|
*/
|
|
36
37
|
status: number;
|
|
37
38
|
/**
|
|
@@ -93,7 +94,8 @@ export interface ICoupon {
|
|
|
93
94
|
useLimitCountMonthly?: number;
|
|
94
95
|
/**
|
|
95
96
|
* 本单不可用原因,对齐 available_error。
|
|
96
|
-
*
|
|
97
|
+
* 有值则一定不可用(优先于 status),并作为展开原因。
|
|
98
|
+
* 接口没返回时,按 status 补原因(草稿 / 已下线 / 已过期 / 已注销 / 已锁定)。
|
|
97
99
|
*/
|
|
98
100
|
availableError?: string;
|
|
99
101
|
/**
|
|
@@ -125,7 +127,7 @@ export interface ICouponViewItem {
|
|
|
125
127
|
selected: boolean;
|
|
126
128
|
/** 当前是否展开详情 */
|
|
127
129
|
expanded: boolean;
|
|
128
|
-
/**
|
|
130
|
+
/** 是否可选、非灰态。availableError 优先,否则 status 为 2 才可用 */
|
|
129
131
|
available: boolean;
|
|
130
132
|
/** 票面左侧前缀,满减为 ¥,折扣为空 */
|
|
131
133
|
amountPrefix: string;
|