@pisell/pisellos 2.3.39 → 2.3.41
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 +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +7 -3
- package/dist/solution/BookingTicket/index.js +132 -49
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +7 -3
- package/lib/solution/BookingTicket/index.js +62 -9
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -136,3 +136,89 @@ export declare const BUY_X_GET_Y_FREE_STRATEGY: {
|
|
|
136
136
|
};
|
|
137
137
|
}[];
|
|
138
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* ITEM_REWARD 策略配置示例:儿童票触发婴儿票免费
|
|
141
|
+
*
|
|
142
|
+
* 业务规则:
|
|
143
|
+
* - 条件商品:儿童票(conditions.rules.productIdAndVariantId)
|
|
144
|
+
* - 奖励商品:购物车/订单内已经存在的婴儿票(actions[0].config.rewardTargets)
|
|
145
|
+
* - 本 action 不自动新增婴儿票;每次购物车变更后由统一促销链路重算
|
|
146
|
+
*
|
|
147
|
+
* 字段说明:
|
|
148
|
+
* - type: "ITEM_REWARD" 表示商品奖励 action
|
|
149
|
+
* - target: "product" 表示本期只奖励商品行
|
|
150
|
+
* - config.rewardTargets: 奖励对象数组,支持 { product_id, product_variant_id }
|
|
151
|
+
* - config.targetSelection: "consumer_best" 表示目标商品超额时选择节省金额最高的商品
|
|
152
|
+
* - value.rewardMethod:
|
|
153
|
+
* - "free": 目标商品最终价为 0
|
|
154
|
+
* - "percent_off": 百分比折扣,rewardValue 为 0-100
|
|
155
|
+
* - "amount_off": 每个目标商品固定减免 rewardValue
|
|
156
|
+
* - "fixed_price": 目标商品最终单价为 rewardValue
|
|
157
|
+
* - value.quantityRule:
|
|
158
|
+
* - "per_condition_quantity": 每满足 triggerQuantity 个条件商品,奖励 rewardQuantity 个目标商品
|
|
159
|
+
* - "all_targets": 满足条件后奖励全部目标商品
|
|
160
|
+
* - "max_per_order": 满足条件后每单最多奖励 maxRewardQuantity 个目标商品
|
|
161
|
+
*/
|
|
162
|
+
export declare const ITEM_REWARD_STRATEGY: {
|
|
163
|
+
metadata: {
|
|
164
|
+
id: string;
|
|
165
|
+
name: {
|
|
166
|
+
en: string;
|
|
167
|
+
'zh-CN': string;
|
|
168
|
+
'zh-HK': string;
|
|
169
|
+
};
|
|
170
|
+
type: string;
|
|
171
|
+
custom: {
|
|
172
|
+
display: {
|
|
173
|
+
product_card: {
|
|
174
|
+
text: {
|
|
175
|
+
en: string;
|
|
176
|
+
'zh-CN': string;
|
|
177
|
+
'zh-HK': string;
|
|
178
|
+
};
|
|
179
|
+
type: string;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
conditions: {
|
|
185
|
+
operator: string;
|
|
186
|
+
rules: ({
|
|
187
|
+
type: string;
|
|
188
|
+
field: string;
|
|
189
|
+
value: string;
|
|
190
|
+
operator: string;
|
|
191
|
+
} | {
|
|
192
|
+
type: string;
|
|
193
|
+
field: string;
|
|
194
|
+
value: {
|
|
195
|
+
product_id: number;
|
|
196
|
+
product_variant_id: number;
|
|
197
|
+
}[];
|
|
198
|
+
operator: string;
|
|
199
|
+
})[];
|
|
200
|
+
actionIds: string[];
|
|
201
|
+
};
|
|
202
|
+
actions: {
|
|
203
|
+
id: string;
|
|
204
|
+
type: string;
|
|
205
|
+
value: {
|
|
206
|
+
rewardMethod: string;
|
|
207
|
+
rewardValue: number;
|
|
208
|
+
quantityRule: string;
|
|
209
|
+
triggerQuantity: number;
|
|
210
|
+
rewardQuantity: number;
|
|
211
|
+
maxRewardQuantity: number;
|
|
212
|
+
};
|
|
213
|
+
valueType: string;
|
|
214
|
+
target: string;
|
|
215
|
+
priority: number;
|
|
216
|
+
config: {
|
|
217
|
+
rewardTargets: {
|
|
218
|
+
product_id: number;
|
|
219
|
+
product_variant_id: number;
|
|
220
|
+
}[];
|
|
221
|
+
targetSelection: string;
|
|
222
|
+
};
|
|
223
|
+
}[];
|
|
224
|
+
};
|
|
@@ -20,6 +20,7 @@ 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,
|
|
23
24
|
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(examples_exports);
|
|
@@ -185,8 +186,98 @@ var BUY_X_GET_Y_FREE_STRATEGY = {
|
|
|
185
186
|
}
|
|
186
187
|
]
|
|
187
188
|
};
|
|
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
|
+
};
|
|
188
278
|
// Annotate the CommonJS export names for ESM import in node:
|
|
189
279
|
0 && (module.exports = {
|
|
190
280
|
BUY_X_GET_Y_FREE_STRATEGY,
|
|
281
|
+
ITEM_REWARD_STRATEGY,
|
|
191
282
|
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
192
283
|
});
|
|
@@ -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, } from './examples';
|
|
4
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY, } from './examples';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
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
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
+
default: () => import_adapter2.default
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
+
var import_evaluator = require("./evaluator");
|
|
41
|
+
var import_adapter = require("./adapter");
|
|
42
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
+
var import_examples = require("./examples");
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
+
ITEM_REWARD_STRATEGY,
|
|
48
|
+
PromotionAdapter,
|
|
49
|
+
PromotionEvaluator,
|
|
50
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
+
});
|
|
@@ -12,6 +12,8 @@ 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";
|
|
15
17
|
/** 固定折扣 */
|
|
16
18
|
readonly DISCOUNT_RATE: "DISCOUNT_RATE";
|
|
17
19
|
/** 固定减价 */
|
|
@@ -66,6 +68,59 @@ export interface BuyXGetYFreeConfig {
|
|
|
66
68
|
/** 可选的赠品列表 */
|
|
67
69
|
giftProducts?: ProductIdentifier[];
|
|
68
70
|
}
|
|
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
|
+
}
|
|
69
124
|
/**
|
|
70
125
|
* 商品标识
|
|
71
126
|
*
|
|
@@ -102,10 +157,19 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
|
|
|
102
157
|
valueType: 'object';
|
|
103
158
|
config?: BuyXGetYFreeConfig;
|
|
104
159
|
}
|
|
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
|
+
}
|
|
105
169
|
/**
|
|
106
170
|
* 促销活动 Action 联合类型
|
|
107
171
|
*/
|
|
108
|
-
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
|
|
172
|
+
export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction | ItemRewardAction;
|
|
109
173
|
/**
|
|
110
174
|
* 促销相关运算符
|
|
111
175
|
*/
|
|
@@ -170,6 +234,8 @@ export interface PromotionProduct {
|
|
|
170
234
|
quantity: number;
|
|
171
235
|
/** 原价 */
|
|
172
236
|
original_price?: number;
|
|
237
|
+
/** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
|
|
238
|
+
_promotionOnlyForItemReward?: boolean;
|
|
173
239
|
}
|
|
174
240
|
/**
|
|
175
241
|
* 促销活动适配器转换结果
|
|
@@ -195,7 +261,7 @@ export interface PromotionTransformResult {
|
|
|
195
261
|
/**
|
|
196
262
|
* Action 详情联合类型
|
|
197
263
|
*/
|
|
198
|
-
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
|
|
264
|
+
export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail | ItemRewardActionDetail;
|
|
199
265
|
/**
|
|
200
266
|
* X件Y元 Action 详情
|
|
201
267
|
*/
|
|
@@ -226,6 +292,28 @@ export interface BuyXGetYFreeActionDetail {
|
|
|
226
292
|
/** 可选的赠品列表 */
|
|
227
293
|
giftProducts: ProductIdentifier[];
|
|
228
294
|
}
|
|
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
|
+
}
|
|
229
317
|
/**
|
|
230
318
|
* X件Y元 - 业务层计算结果
|
|
231
319
|
*
|
|
@@ -28,6 +28,8 @@ 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",
|
|
31
33
|
/** 固定折扣 */
|
|
32
34
|
DISCOUNT_RATE: "DISCOUNT_RATE",
|
|
33
35
|
/** 固定减价 */
|
|
@@ -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, _g;
|
|
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,6 +259,7 @@ 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)) } : {},
|
|
262
263
|
...productOptionString ? { product_option_string: productOptionString } : {},
|
|
263
264
|
_extend: extend,
|
|
264
265
|
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, _f;
|
|
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,6 +144,7 @@ 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)) } : {},
|
|
147
148
|
new: 0,
|
|
148
149
|
autoClose: true,
|
|
149
150
|
_extend: extend
|
|
@@ -32,7 +32,6 @@ 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>;
|
|
36
35
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
37
36
|
private checkUsageCreditsLimit;
|
|
38
37
|
filterEnabledDiscountListWithReason(discountList: Discount[]): DiscountWithReason;
|
|
@@ -147,15 +147,6 @@ 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
|
-
}
|
|
159
150
|
filterEnabledDiscountList(discountList) {
|
|
160
151
|
return discountList.filter(
|
|
161
152
|
(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)
|
|
@@ -27,6 +27,8 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
27
27
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
28
28
|
getOpenData(): OpenDataConfig | null;
|
|
29
29
|
getLastFetchedAt(): number | null;
|
|
30
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
31
|
+
clearCache(): void;
|
|
30
32
|
checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
|
|
31
33
|
storeChange(): void;
|
|
32
34
|
}
|
|
@@ -73,7 +73,7 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
73
73
|
}
|
|
74
74
|
async fetchOpenData(params) {
|
|
75
75
|
var _a, _b;
|
|
76
|
-
const getData = (_b = (_a = this.appPlugin)
|
|
76
|
+
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
77
77
|
const shopId = getData == null ? void 0 : getData("shop_id");
|
|
78
78
|
if (!shopId)
|
|
79
79
|
throw new Error("[OpenDataModule] 无法获取 shop_id");
|
|
@@ -104,6 +104,11 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
|
|
|
104
104
|
getLastFetchedAt() {
|
|
105
105
|
return this.store.lastFetchedAt ?? null;
|
|
106
106
|
}
|
|
107
|
+
/** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
|
|
108
|
+
clearCache() {
|
|
109
|
+
this.store.data = null;
|
|
110
|
+
this.store.lastFetchedAt = null;
|
|
111
|
+
}
|
|
107
112
|
checkAvailability(scheduleModule) {
|
|
108
113
|
var _a;
|
|
109
114
|
const scheduleList = scheduleModule ? scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -14,6 +14,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
14
14
|
private request;
|
|
15
15
|
private logger;
|
|
16
16
|
private window;
|
|
17
|
+
private appPlugin;
|
|
17
18
|
private cacheId;
|
|
18
19
|
private salesSummaryModuleName;
|
|
19
20
|
private rulesHooksOverride?;
|
|
@@ -145,7 +146,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
145
146
|
isTempOrderPersistEnabled(): boolean;
|
|
146
147
|
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化;草稿保存请使用 IndexedDB saveDraft。 */
|
|
147
148
|
persistTempOrder(): void;
|
|
148
|
-
notifyTempOrderChanged(): void;
|
|
149
149
|
private createDefaultTempOrderInstance;
|
|
150
150
|
private createExternalSaleNumber;
|
|
151
151
|
private ensureExternalSaleNumber;
|
|
@@ -177,6 +177,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
177
177
|
};
|
|
178
178
|
private calculateDepositPaidAmount;
|
|
179
179
|
private resolveNextOrderPaymentType;
|
|
180
|
+
private getPaymentNumberAppData;
|
|
181
|
+
private getPaymentNumberDevicePrefixSync;
|
|
182
|
+
private getPaymentNumberDevicePrefixAsync;
|
|
180
183
|
private normalizePaymentSource;
|
|
181
184
|
private updateTempOrderPaymentStatus;
|
|
182
185
|
private shouldKeepPaymentStatusAfterAmountRecalc;
|
|
@@ -308,19 +311,20 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
308
311
|
* 用一组支付来源覆盖当前订单支付项。
|
|
309
312
|
*
|
|
310
313
|
* 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
|
|
311
|
-
* uuid
|
|
314
|
+
* 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
|
|
312
315
|
* isSynced 等运行态字段不会进入 tempOrder.payments。
|
|
313
316
|
*/
|
|
314
317
|
setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
|
|
315
|
-
/**
|
|
318
|
+
/** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
|
|
316
319
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
320
|
+
/** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
|
|
321
|
+
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
322
|
+
private addOrderPaymentWithDevicePrefix;
|
|
317
323
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
|
|
321
|
-
* 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
|
|
324
|
+
* 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
|
|
325
|
+
* metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
|
|
322
326
|
*/
|
|
323
|
-
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any
|
|
327
|
+
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions): Promise<OrderPaymentUpdateResult>;
|
|
324
328
|
/** 从当前订单支付项中移除指定支付项。 */
|
|
325
329
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
326
330
|
private confirmPendingVoucherPaymentsInList;
|
|
@@ -343,7 +347,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
343
347
|
*/
|
|
344
348
|
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
345
349
|
status?: 'paid' | 'payment_pending';
|
|
350
|
+
devicePrefix?: string;
|
|
346
351
|
}): OrderPaymentData[];
|
|
352
|
+
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
353
|
+
status?: 'paid' | 'payment_pending';
|
|
354
|
+
}): Promise<OrderPaymentData[]>;
|
|
347
355
|
private shouldMergeProductToOrder;
|
|
348
356
|
private hasOrderProductLineNote;
|
|
349
357
|
/**
|
|
@@ -428,6 +436,14 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
428
436
|
type?: string;
|
|
429
437
|
}): import("./types").OrderSubmitPayload;
|
|
430
438
|
applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
|
|
439
|
+
saveTempOrderAsDraft<T = any>(params?: {
|
|
440
|
+
cacheId?: string;
|
|
441
|
+
platform?: string;
|
|
442
|
+
businessCode?: string;
|
|
443
|
+
channel?: string;
|
|
444
|
+
type?: string;
|
|
445
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
446
|
+
}): Promise<T>;
|
|
431
447
|
/**
|
|
432
448
|
* 提交当前 Sales tempOrder。
|
|
433
449
|
*
|
|
@@ -469,7 +485,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
469
485
|
generateIdempotencyToken(): string;
|
|
470
486
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
471
487
|
createOrder(params: CommitOrderParams['query']): {
|
|
472
|
-
type: "
|
|
488
|
+
type: "appointment_booking" | "virtual";
|
|
473
489
|
platform: string;
|
|
474
490
|
sales_channel: string;
|
|
475
491
|
order_sales_channel: string;
|
|
@@ -479,7 +495,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
479
495
|
is_deposit: number;
|
|
480
496
|
relation_products: any[];
|
|
481
497
|
relation_forms: any[];
|
|
482
|
-
business_code: string | undefined;
|
|
483
498
|
};
|
|
484
499
|
checkBeforeSubmitOrder(params: {
|
|
485
500
|
cartItems: CartItem[];
|
|
@@ -533,6 +548,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
533
548
|
*/
|
|
534
549
|
private seedAnonymousBookingUidsFromProducts;
|
|
535
550
|
private normalizeTempOrderForRuntime;
|
|
551
|
+
private isSyntheticDraftOrderIdForRuntime;
|
|
552
|
+
private withoutSyntheticDraftOrderIdForRuntime;
|
|
536
553
|
private hydrateLinkedBookingIdentity;
|
|
537
554
|
private pickHydratedDisplayText;
|
|
538
555
|
private formatHydratedNamePair;
|