@pisell/pisellos 2.3.38 → 2.3.40
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 +4 -8
- package/dist/solution/BookingTicket/index.js +51 -134
- 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/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- 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 -2
- 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 +4 -8
- package/lib/solution/BookingTicket/index.js +19 -64
- 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/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- 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
|
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var examples_exports = {};
|
|
21
21
|
__export(examples_exports, {
|
|
22
22
|
BUY_X_GET_Y_FREE_STRATEGY: () => BUY_X_GET_Y_FREE_STRATEGY,
|
|
23
|
-
ITEM_REWARD_STRATEGY: () => ITEM_REWARD_STRATEGY,
|
|
24
23
|
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(examples_exports);
|
|
@@ -186,98 +185,8 @@ var BUY_X_GET_Y_FREE_STRATEGY = {
|
|
|
186
185
|
}
|
|
187
186
|
]
|
|
188
187
|
};
|
|
189
|
-
var ITEM_REWARD_STRATEGY = {
|
|
190
|
-
metadata: {
|
|
191
|
-
id: "STRATEGY_003",
|
|
192
|
-
name: {
|
|
193
|
-
en: "Infant ticket free with child ticket",
|
|
194
|
-
"zh-CN": "儿童票触发婴儿票免费",
|
|
195
|
-
"zh-HK": "兒童票觸發嬰兒票免費"
|
|
196
|
-
},
|
|
197
|
-
type: "promotion",
|
|
198
|
-
custom: {
|
|
199
|
-
display: {
|
|
200
|
-
product_card: {
|
|
201
|
-
text: {
|
|
202
|
-
en: "Infant ticket free",
|
|
203
|
-
"zh-CN": "婴儿票免费",
|
|
204
|
-
"zh-HK": "嬰兒票免費"
|
|
205
|
-
},
|
|
206
|
-
type: "tag"
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
conditions: {
|
|
212
|
-
operator: "and",
|
|
213
|
-
rules: [
|
|
214
|
-
{
|
|
215
|
-
type: "operator",
|
|
216
|
-
field: "currentDateTime",
|
|
217
|
-
value: "2023-01-01 00:00:00",
|
|
218
|
-
operator: ">="
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
type: "operator",
|
|
222
|
-
field: "currentDateTime",
|
|
223
|
-
value: "2030-01-01 00:00:00",
|
|
224
|
-
operator: "<="
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
type: "operator",
|
|
228
|
-
field: "productIdAndVariantId",
|
|
229
|
-
value: [
|
|
230
|
-
{
|
|
231
|
-
product_id: 1001,
|
|
232
|
-
// 条件商品:儿童票
|
|
233
|
-
product_variant_id: 0
|
|
234
|
-
// 0 = 匹配任意变体
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
operator: "product_match"
|
|
238
|
-
}
|
|
239
|
-
],
|
|
240
|
-
actionIds: ["1"]
|
|
241
|
-
},
|
|
242
|
-
actions: [
|
|
243
|
-
{
|
|
244
|
-
id: "1",
|
|
245
|
-
type: "ITEM_REWARD",
|
|
246
|
-
value: {
|
|
247
|
-
rewardMethod: "free",
|
|
248
|
-
// free | percent_off | amount_off | fixed_price
|
|
249
|
-
rewardValue: 0,
|
|
250
|
-
// free 可省略;其他 rewardMethod 使用
|
|
251
|
-
quantityRule: "per_condition_quantity",
|
|
252
|
-
// per_condition_quantity | all_targets | max_per_order
|
|
253
|
-
triggerQuantity: 1,
|
|
254
|
-
// N:每满足 N 个条件商品
|
|
255
|
-
rewardQuantity: 1,
|
|
256
|
-
// Y:奖励 Y 个目标商品
|
|
257
|
-
maxRewardQuantity: 1
|
|
258
|
-
// max_per_order 使用;本例保留为配置示意
|
|
259
|
-
},
|
|
260
|
-
valueType: "object",
|
|
261
|
-
target: "product",
|
|
262
|
-
priority: 1,
|
|
263
|
-
config: {
|
|
264
|
-
rewardTargets: [
|
|
265
|
-
{
|
|
266
|
-
product_id: 2001,
|
|
267
|
-
// 奖励对象:婴儿票
|
|
268
|
-
product_variant_id: 0
|
|
269
|
-
// 0 = 匹配任意变体
|
|
270
|
-
}
|
|
271
|
-
],
|
|
272
|
-
targetSelection: "consumer_best"
|
|
273
|
-
// consumer_best = 按可节省金额从高到低选择
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
};
|
|
278
188
|
// Annotate the CommonJS export names for ESM import in node:
|
|
279
189
|
0 && (module.exports = {
|
|
280
190
|
BUY_X_GET_Y_FREE_STRATEGY,
|
|
281
|
-
ITEM_REWARD_STRATEGY,
|
|
282
191
|
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
283
192
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PromotionEvaluator } from './evaluator';
|
|
2
2
|
export { PromotionAdapter } from './adapter';
|
|
3
3
|
export { default } from './adapter';
|
|
4
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY,
|
|
4
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, } from './examples';
|
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
var promotion_exports = {};
|
|
31
31
|
__export(promotion_exports, {
|
|
32
32
|
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
33
|
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
34
|
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
35
|
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
@@ -44,7 +43,6 @@ var import_examples = require("./examples");
|
|
|
44
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
44
|
0 && (module.exports = {
|
|
46
45
|
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
46
|
PromotionAdapter,
|
|
49
47
|
PromotionEvaluator,
|
|
50
48
|
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
@@ -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
|
*
|
|
@@ -28,8 +28,6 @@ var PROMOTION_ACTION_TYPES = {
|
|
|
28
28
|
X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE",
|
|
29
29
|
/** 买X送Y(买X件送Y件,可累计) */
|
|
30
30
|
BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE",
|
|
31
|
-
/** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
|
|
32
|
-
ITEM_REWARD: "ITEM_REWARD",
|
|
33
31
|
/** 固定折扣 */
|
|
34
32
|
DISCOUNT_RATE: "DISCOUNT_RATE",
|
|
35
33
|
/** 固定减价 */
|
|
@@ -184,7 +184,7 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
function buildCacheItemFromOrderLine(input) {
|
|
187
|
-
var _a, _b, _c, _d, _e, _f
|
|
187
|
+
var _a, _b, _c, _d, _e, _f;
|
|
188
188
|
const { product, booking, sourceProduct } = input;
|
|
189
189
|
const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
|
|
190
190
|
const selling = Number(product.selling_price ?? 0);
|
|
@@ -259,7 +259,6 @@ function buildCacheItemFromOrderLine(input) {
|
|
|
259
259
|
price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
|
|
260
260
|
selling_price: product.selling_price,
|
|
261
261
|
original_price: product.original_price,
|
|
262
|
-
...Number(((_g = product.product_sku) == null ? void 0 : _g.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
|
|
263
262
|
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
264
263
|
_extend: extend,
|
|
265
264
|
new: 0,
|
|
@@ -78,7 +78,7 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function buildNormalProductCacheItemFromOrderLine(input) {
|
|
81
|
-
var _a, _b, _c, _d, _e
|
|
81
|
+
var _a, _b, _c, _d, _e;
|
|
82
82
|
const { product, sourceProduct } = input;
|
|
83
83
|
const resolvedId = product.product_id ?? (sourceProduct == null ? void 0 : sourceProduct.id);
|
|
84
84
|
const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
|
|
@@ -144,7 +144,6 @@ function buildNormalProductCacheItemFromOrderLine(input) {
|
|
|
144
144
|
note: product.note,
|
|
145
145
|
order_detail_id: product.order_detail_id ?? null,
|
|
146
146
|
discount_list: discountList,
|
|
147
|
-
...Number(((_f = product.product_sku) == null ? void 0 : _f.open_sold_weight) || 0) === 1 ? { product_sku: JSON.parse(JSON.stringify(product.product_sku)) } : {},
|
|
148
147
|
new: 0,
|
|
149
148
|
autoClose: true,
|
|
150
149
|
_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;
|
|
@@ -147,6 +147,15 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
147
147
|
const resultDiscountWithReason = this.filterEnabledDiscountListWithReason((result == null ? void 0 : result.data) || []) || [];
|
|
148
148
|
return resultDiscountWithReason;
|
|
149
149
|
}
|
|
150
|
+
async batchSearchByProductIds(productIds) {
|
|
151
|
+
const result = await this.request.get(`/machinecode/batch-search`, {
|
|
152
|
+
ids: productIds,
|
|
153
|
+
translate_flag: 1,
|
|
154
|
+
tags: ["good_pass", "product_discount_card"],
|
|
155
|
+
relation_product: 1
|
|
156
|
+
});
|
|
157
|
+
return (result == null ? void 0 : result.data) || [];
|
|
158
|
+
}
|
|
150
159
|
filterEnabledDiscountList(discountList) {
|
|
151
160
|
return discountList.filter(
|
|
152
161
|
(discount) => discount.limit_status === "enable" && new import_decimal.default((discount == null ? void 0 : discount.par_value) || 0).minus(new import_decimal.default((discount == null ? void 0 : discount.used_par_value) || 0)).greaterThan(0) && this.checkUsageCreditsLimit(discount)
|
|
@@ -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
|
+
}
|