@pisell/pisellos 2.3.38 → 2.3.39
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +3 -7
- package/dist/solution/BookingTicket/index.js +49 -132
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +3 -7
- package/lib/solution/BookingTicket/index.js +9 -62
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -12,8 +12,6 @@ export declare const PROMOTION_ACTION_TYPES: {
|
|
|
12
12
|
readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
|
|
13
13
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
14
14
|
readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
|
|
15
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
16
|
-
readonly ITEM_REWARD: "ITEM_REWARD";
|
|
17
15
|
/** 固定折扣 */
|
|
18
16
|
readonly DISCOUNT_RATE: "DISCOUNT_RATE";
|
|
19
17
|
/** 固定减价 */
|
|
@@ -68,59 +66,6 @@ export interface BuyXGetYFreeConfig {
|
|
|
68
66
|
/** 可选的赠品列表 */
|
|
69
67
|
giftProducts?: ProductIdentifier[];
|
|
70
68
|
}
|
|
71
|
-
/**
|
|
72
|
-
* 商品奖励优惠方式
|
|
73
|
-
*
|
|
74
|
-
* - free: 目标商品最终价为 0
|
|
75
|
-
* - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
|
|
76
|
-
* - amount_off: 每个目标商品固定减免 rewardValue
|
|
77
|
-
* - fixed_price: 目标商品改为固定价 rewardValue
|
|
78
|
-
*/
|
|
79
|
-
export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
|
|
80
|
-
/**
|
|
81
|
-
* 商品奖励数量规则
|
|
82
|
-
*
|
|
83
|
-
* - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
|
|
84
|
-
* - all_targets: 满足条件后奖励全部目标商品
|
|
85
|
-
* - max_per_order: 满足条件后每单最多奖励固定数量目标商品
|
|
86
|
-
*/
|
|
87
|
-
export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
|
|
88
|
-
/** 商品奖励目标选择规则 */
|
|
89
|
-
export type ItemRewardTargetSelection = 'consumer_best';
|
|
90
|
-
/**
|
|
91
|
-
* 商品奖励 - Action Value
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* value: {
|
|
95
|
-
* rewardMethod: 'free',
|
|
96
|
-
* quantityRule: 'per_condition_quantity',
|
|
97
|
-
* triggerQuantity: 1,
|
|
98
|
-
* rewardQuantity: 1,
|
|
99
|
-
* }
|
|
100
|
-
*/
|
|
101
|
-
export interface ItemRewardValue {
|
|
102
|
-
/** 奖励方式 */
|
|
103
|
-
rewardMethod: ItemRewardMethod;
|
|
104
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
|
|
105
|
-
rewardValue?: number;
|
|
106
|
-
/** 奖励数量规则 */
|
|
107
|
-
quantityRule: ItemRewardQuantityRule;
|
|
108
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
109
|
-
triggerQuantity?: number;
|
|
110
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
111
|
-
rewardQuantity?: number;
|
|
112
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
113
|
-
maxRewardQuantity?: number;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* 商品奖励 - Action Config
|
|
117
|
-
*/
|
|
118
|
-
export interface ItemRewardConfig {
|
|
119
|
-
/** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
|
|
120
|
-
rewardTargets?: ProductIdentifier[];
|
|
121
|
-
/** 目标商品超额时的选择规则;本期支持 consumer_best */
|
|
122
|
-
targetSelection?: ItemRewardTargetSelection;
|
|
123
|
-
}
|
|
124
69
|
/**
|
|
125
70
|
* 商品标识
|
|
126
71
|
*
|
|
@@ -157,19 +102,10 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
|
|
|
157
102
|
valueType: 'object';
|
|
158
103
|
config?: BuyXGetYFreeConfig;
|
|
159
104
|
}
|
|
160
|
-
/**
|
|
161
|
-
* 商品奖励 Action
|
|
162
|
-
*/
|
|
163
|
-
export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
|
|
164
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
165
|
-
value: ItemRewardValue;
|
|
166
|
-
valueType: 'object';
|
|
167
|
-
config?: ItemRewardConfig;
|
|
168
|
-
}
|
|
169
105
|
/**
|
|
170
106
|
* 促销活动 Action 联合类型
|
|
171
107
|
*/
|
|
172
|
-
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction
|
|
108
|
+
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
|
|
173
109
|
/**
|
|
174
110
|
* 促销相关运算符
|
|
175
111
|
*/
|
|
@@ -234,8 +170,6 @@ export interface PromotionProduct {
|
|
|
234
170
|
quantity: number;
|
|
235
171
|
/** 原价 */
|
|
236
172
|
original_price?: number;
|
|
237
|
-
/** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
|
|
238
|
-
_promotionOnlyForItemReward?: boolean;
|
|
239
173
|
}
|
|
240
174
|
/**
|
|
241
175
|
* 促销活动适配器转换结果
|
|
@@ -261,7 +195,7 @@ export interface PromotionTransformResult {
|
|
|
261
195
|
/**
|
|
262
196
|
* Action 详情联合类型
|
|
263
197
|
*/
|
|
264
|
-
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail
|
|
198
|
+
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
|
|
265
199
|
/**
|
|
266
200
|
* X件Y元 Action 详情
|
|
267
201
|
*/
|
|
@@ -292,28 +226,6 @@ export interface BuyXGetYFreeActionDetail {
|
|
|
292
226
|
/** 可选的赠品列表 */
|
|
293
227
|
giftProducts: ProductIdentifier[];
|
|
294
228
|
}
|
|
295
|
-
/**
|
|
296
|
-
* 商品奖励 Action 详情
|
|
297
|
-
*/
|
|
298
|
-
export interface ItemRewardActionDetail {
|
|
299
|
-
type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
|
|
300
|
-
/** 奖励方式 */
|
|
301
|
-
rewardMethod: ItemRewardMethod;
|
|
302
|
-
/** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
|
|
303
|
-
rewardValue: number;
|
|
304
|
-
/** 奖励数量规则 */
|
|
305
|
-
quantityRule: ItemRewardQuantityRule;
|
|
306
|
-
/** 每满足 N 个条件商品;默认 1 */
|
|
307
|
-
triggerQuantity: number;
|
|
308
|
-
/** 奖励 Y 个目标商品;默认 1 */
|
|
309
|
-
rewardQuantity: number;
|
|
310
|
-
/** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
|
|
311
|
-
maxRewardQuantity?: number;
|
|
312
|
-
/** 奖励对象,本期支持指定商品/变体 */
|
|
313
|
-
rewardTargets: ProductIdentifier[];
|
|
314
|
-
/** 目标商品超额时的选择规则 */
|
|
315
|
-
targetSelection: ItemRewardTargetSelection;
|
|
316
|
-
}
|
|
317
229
|
/**
|
|
318
230
|
* X件Y元 - 业务层计算结果
|
|
319
231
|
*
|
|
@@ -16,8 +16,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
16
16
|
X_ITEMS_FOR_Y_PRICE: 'X_ITEMS_FOR_Y_PRICE',
|
|
17
17
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
18
18
|
BUY_X_GET_Y_FREE: 'BUY_X_GET_Y_FREE',
|
|
19
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
20
|
-
ITEM_REWARD: 'ITEM_REWARD',
|
|
21
19
|
/** 固定折扣 */
|
|
22
20
|
DISCOUNT_RATE: 'DISCOUNT_RATE',
|
|
23
21
|
/** 固定减价 */
|
|
@@ -56,41 +54,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
56
54
|
* 买X送Y - Action Config
|
|
57
55
|
*/
|
|
58
56
|
|
|
59
|
-
/**
|
|
60
|
-
* 商品奖励优惠方式
|
|
61
|
-
*
|
|
62
|
-
* - free: 目标商品最终价为 0
|
|
63
|
-
* - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
|
|
64
|
-
* - amount_off: 每个目标商品固定减免 rewardValue
|
|
65
|
-
* - fixed_price: 目标商品改为固定价 rewardValue
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 商品奖励数量规则
|
|
70
|
-
*
|
|
71
|
-
* - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
|
|
72
|
-
* - all_targets: 满足条件后奖励全部目标商品
|
|
73
|
-
* - max_per_order: 满足条件后每单最多奖励固定数量目标商品
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/** 商品奖励目标选择规则 */
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* 商品奖励 - Action Value
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* value: {
|
|
83
|
-
* rewardMethod: 'free',
|
|
84
|
-
* quantityRule: 'per_condition_quantity',
|
|
85
|
-
* triggerQuantity: 1,
|
|
86
|
-
* rewardQuantity: 1,
|
|
87
|
-
* }
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 商品奖励 - Action Config
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
57
|
// ============================================
|
|
95
58
|
// 商品标识
|
|
96
59
|
// ============================================
|
|
@@ -115,10 +78,6 @@ export var PROMOTION_ACTION_TYPES = {
|
|
|
115
78
|
* 买X送Y Action
|
|
116
79
|
*/
|
|
117
80
|
|
|
118
|
-
/**
|
|
119
|
-
* 商品奖励 Action
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
81
|
/**
|
|
123
82
|
* 促销活动 Action 联合类型
|
|
124
83
|
*/
|
|
@@ -187,10 +146,6 @@ var obj = {
|
|
|
187
146
|
* 买X送Y Action 详情
|
|
188
147
|
*/
|
|
189
148
|
|
|
190
|
-
/**
|
|
191
|
-
* 商品奖励 Action 详情
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
149
|
// ============================================
|
|
195
150
|
// 业务层输出类型(供参考)
|
|
196
151
|
// ============================================
|
|
@@ -190,7 +190,7 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
190
190
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
191
191
|
*/
|
|
192
192
|
export function buildCacheItemFromOrderLine(input) {
|
|
193
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$
|
|
193
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref12, _booking$id;
|
|
194
194
|
var product = input.product,
|
|
195
195
|
booking = input.booking,
|
|
196
196
|
sourceProduct = input.sourceProduct;
|
|
@@ -257,7 +257,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
257
257
|
if (Array.isArray(booking.relation_forms)) {
|
|
258
258
|
extend.relation_forms = booking.relation_forms;
|
|
259
259
|
}
|
|
260
|
-
var base = _objectSpread(_objectSpread(_objectSpread(
|
|
260
|
+
var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
261
261
|
id: resolvedId,
|
|
262
262
|
product_id: resolvedId,
|
|
263
263
|
extension_type: (_ref11 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
@@ -265,9 +265,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
265
265
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
266
266
|
selling_price: product.selling_price,
|
|
267
267
|
original_price: product.original_price
|
|
268
|
-
},
|
|
269
|
-
product_sku: JSON.parse(JSON.stringify(product.product_sku))
|
|
270
|
-
} : {}), productOptionString ? {
|
|
268
|
+
}, productOptionString ? {
|
|
271
269
|
product_option_string: productOptionString
|
|
272
270
|
} : {}), {}, {
|
|
273
271
|
_extend: extend,
|
|
@@ -75,7 +75,7 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
78
|
-
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail
|
|
78
|
+
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail;
|
|
79
79
|
var product = input.product,
|
|
80
80
|
sourceProduct = input.sourceProduct;
|
|
81
81
|
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
@@ -127,7 +127,7 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
127
127
|
extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
|
|
128
128
|
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
129
129
|
}
|
|
130
|
-
return _objectSpread(_objectSpread(_objectSpread(
|
|
130
|
+
return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
131
131
|
id: resolvedId,
|
|
132
132
|
product_id: resolvedId,
|
|
133
133
|
_id: uid,
|
|
@@ -141,10 +141,7 @@ export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
141
141
|
} : {}), {}, {
|
|
142
142
|
note: product.note,
|
|
143
143
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
144
|
-
discount_list: discountList
|
|
145
|
-
}, Number(((_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1 ? {
|
|
146
|
-
product_sku: JSON.parse(JSON.stringify(product.product_sku))
|
|
147
|
-
} : {}), {}, {
|
|
144
|
+
discount_list: discountList,
|
|
148
145
|
new: 0,
|
|
149
146
|
autoClose: true,
|
|
150
147
|
_extend: extend
|
|
@@ -32,6 +32,7 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
32
32
|
customerId?: number;
|
|
33
33
|
orderId?: number;
|
|
34
34
|
}): Promise<DiscountWithReason>;
|
|
35
|
+
batchSearchByProductIds(productIds: number[]): Promise<any>;
|
|
35
36
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
36
37
|
private checkUsageCreditsLimit;
|
|
37
38
|
filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
|
|
@@ -244,6 +244,35 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
244
244
|
}
|
|
245
245
|
return batchSearch;
|
|
246
246
|
}()
|
|
247
|
+
}, {
|
|
248
|
+
key: "batchSearchByProductIds",
|
|
249
|
+
value: function () {
|
|
250
|
+
var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(productIds) {
|
|
251
|
+
var result;
|
|
252
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
253
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
254
|
+
case 0:
|
|
255
|
+
_context6.next = 2;
|
|
256
|
+
return this.request.get("/machinecode/batch-search", {
|
|
257
|
+
ids: productIds,
|
|
258
|
+
translate_flag: 1,
|
|
259
|
+
tags: ['good_pass', 'product_discount_card'],
|
|
260
|
+
relation_product: 1
|
|
261
|
+
});
|
|
262
|
+
case 2:
|
|
263
|
+
result = _context6.sent;
|
|
264
|
+
return _context6.abrupt("return", (result === null || result === void 0 ? void 0 : result.data) || []);
|
|
265
|
+
case 4:
|
|
266
|
+
case "end":
|
|
267
|
+
return _context6.stop();
|
|
268
|
+
}
|
|
269
|
+
}, _callee6, this);
|
|
270
|
+
}));
|
|
271
|
+
function batchSearchByProductIds(_x8) {
|
|
272
|
+
return _batchSearchByProductIds.apply(this, arguments);
|
|
273
|
+
}
|
|
274
|
+
return batchSearchByProductIds;
|
|
275
|
+
}()
|
|
247
276
|
}, {
|
|
248
277
|
key: "filterEnabledDiscountList",
|
|
249
278
|
value: function filterEnabledDiscountList(discountList) {
|
|
@@ -430,22 +459,22 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
430
459
|
}, {
|
|
431
460
|
key: "destroy",
|
|
432
461
|
value: function () {
|
|
433
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
434
|
-
return _regeneratorRuntime().wrap(function
|
|
435
|
-
while (1) switch (
|
|
462
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
463
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
464
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
436
465
|
case 0:
|
|
437
466
|
this.store.discountList = [];
|
|
438
467
|
this.core.effects.offByModuleDestroy(this.name);
|
|
439
|
-
|
|
468
|
+
_context7.next = 4;
|
|
440
469
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
441
470
|
case 4:
|
|
442
471
|
console.log('[Discount] 已销毁');
|
|
443
472
|
_get(_getPrototypeOf(DiscountModule.prototype), "destroy", this).call(this);
|
|
444
473
|
case 6:
|
|
445
474
|
case "end":
|
|
446
|
-
return
|
|
475
|
+
return _context7.stop();
|
|
447
476
|
}
|
|
448
|
-
},
|
|
477
|
+
}, _callee7, this);
|
|
449
478
|
}));
|
|
450
479
|
function destroy() {
|
|
451
480
|
return _destroy.apply(this, arguments);
|
|
@@ -455,18 +484,18 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
455
484
|
}, {
|
|
456
485
|
key: "clear",
|
|
457
486
|
value: function () {
|
|
458
|
-
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
459
|
-
return _regeneratorRuntime().wrap(function
|
|
460
|
-
while (1) switch (
|
|
487
|
+
var _clear = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
488
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
489
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
461
490
|
case 0:
|
|
462
491
|
this.store.discountList = [];
|
|
463
492
|
this.store.originalDiscountList = [];
|
|
464
493
|
console.log('[Discount] clear');
|
|
465
494
|
case 3:
|
|
466
495
|
case "end":
|
|
467
|
-
return
|
|
496
|
+
return _context8.stop();
|
|
468
497
|
}
|
|
469
|
-
},
|
|
498
|
+
}, _callee8, this);
|
|
470
499
|
}));
|
|
471
500
|
function clear() {
|
|
472
501
|
return _clear.apply(this, arguments);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { IFormInfo, IFormRecord, IFormItemData, IFetchFormInfoParams, IFetchFormRecordsParams, IAddFormRecordParams, IAppendFormRecordParams, IEnsureFormDataParams, IEnsureFormByProductParams, IRefreshAllFormRecordsParams, HolderModuleAPI, HolderFormMap } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export declare class HolderModule extends BaseModule implements Module, HolderModuleAPI {
|
|
7
|
+
protected defaultName: string;
|
|
8
|
+
protected defaultVersion: string;
|
|
9
|
+
private store;
|
|
10
|
+
private request;
|
|
11
|
+
private cacheId;
|
|
12
|
+
private openCache;
|
|
13
|
+
private fatherModule;
|
|
14
|
+
private isLoading;
|
|
15
|
+
private error;
|
|
16
|
+
/** 已加载过表单数据的 form_id 缓存标记 */
|
|
17
|
+
private loadedFormIds;
|
|
18
|
+
private window;
|
|
19
|
+
constructor(name?: string, version?: string);
|
|
20
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
21
|
+
/** 统一提交 formMap,仅此处触发 store changed */
|
|
22
|
+
private commitFormMap;
|
|
23
|
+
/** 通知 UI 刷新(数据未变但需要 re-read 的场景) */
|
|
24
|
+
private notifyFormMapChanged;
|
|
25
|
+
getHolderFormMap(): HolderFormMap;
|
|
26
|
+
getHolderFormData(formId: number | string): IFormItemData | undefined;
|
|
27
|
+
setFormData(formId: number | string, data: Partial<IFormItemData>): void;
|
|
28
|
+
private ensureFormItem;
|
|
29
|
+
private hasFormData;
|
|
30
|
+
private patchFormMap;
|
|
31
|
+
fetchFormInfo(params: IFetchFormInfoParams): Promise<IFormInfo | IFormInfo[]>;
|
|
32
|
+
fetchRecords(params: IFetchFormRecordsParams): Promise<any>;
|
|
33
|
+
ensureFormData(params: IEnsureFormDataParams): Promise<IFormItemData>;
|
|
34
|
+
ensureFormByProduct(params: IEnsureFormByProductParams): Promise<IFormItemData | null>;
|
|
35
|
+
addFormRecord(params: IAddFormRecordParams): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* UI 层自行请求添加接口后,将返回记录合并到 holderMap 对应 form_id 的 records 中
|
|
38
|
+
*/
|
|
39
|
+
appendFormRecord(params: IAppendFormRecordParams): IFormRecord;
|
|
40
|
+
removeFormRecord(formId: number | string, formRecordId: number): void;
|
|
41
|
+
clearFormData(formId?: number | string): void;
|
|
42
|
+
/**
|
|
43
|
+
* 登录后按当前 holderMap 批量刷新所有表单的 records。
|
|
44
|
+
* 遍历 holderMap,从 form.form 中读取 form_id、shop_id,结合 customer_id 重新拉取记录。
|
|
45
|
+
*/
|
|
46
|
+
refreshAllFormRecords(params?: IRefreshAllFormRecordsParams): Promise<HolderFormMap>;
|
|
47
|
+
storeChange(path?: string): void;
|
|
48
|
+
}
|