@pisell/pisellos 2.3.101 → 2.3.103
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/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +29 -3
- package/dist/modules/Order/index.js +1105 -703
- package/dist/modules/Order/types.d.ts +14 -6
- package/dist/modules/Order/types.js +1 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/dist/modules/Order/utils/virtualSettlement.js +284 -0
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +63 -24
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +1074 -746
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +31 -2
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +29 -3
- package/lib/modules/Order/index.js +326 -51
- package/lib/modules/Order/types.d.ts +14 -6
- package/lib/modules/Order/types.js +1 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/lib/modules/Order/utils/virtualSettlement.js +262 -0
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +57 -20
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +17 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +228 -20
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
- package/package.json +1 -1
|
@@ -35,6 +35,10 @@ export interface DataVariantItem {
|
|
|
35
35
|
module_data_id?: number;
|
|
36
36
|
/** 关联策略模型 metadata.id / data_variant_rule.id */
|
|
37
37
|
data_variant_rule_id: number | string;
|
|
38
|
+
/** 业务类型;多货币结算候选不会走普通字段覆盖 */
|
|
39
|
+
business_type?: 'multi_currency_settlement' | string;
|
|
40
|
+
/** 数据状态;多货币结算仅处理 enable 记录 */
|
|
41
|
+
status?: 'enable' | 'disable' | string;
|
|
38
42
|
/** 命中策略后需要覆盖到商品上的字段 */
|
|
39
43
|
data: Record<string, any>;
|
|
40
44
|
created_at?: string | null;
|
|
@@ -53,11 +57,30 @@ export interface DataVariantProduct {
|
|
|
53
57
|
id?: number | string;
|
|
54
58
|
[key: string]: any;
|
|
55
59
|
}>;
|
|
60
|
+
/**
|
|
61
|
+
* 商品接口已经完成规则计算时返回的命中结果。
|
|
62
|
+
* 数组按 Data Variant 优先级从高到低排列;空数组表示已计算但无命中。
|
|
63
|
+
*/
|
|
64
|
+
metadata?: {
|
|
65
|
+
data_variant_ids?: Array<number | string>;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
56
68
|
/** 后端 /product/query with dataVariants 返回的智能定价变体列表 */
|
|
57
69
|
data_variants?: DataVariantItem[];
|
|
70
|
+
/** 当前上下文解析后的可选结算货币,不覆盖商品原始多货币配置 */
|
|
71
|
+
available_settlement_options?: AvailableSettlementOption[];
|
|
58
72
|
_dataVariant?: DataVariantAppliedInfo;
|
|
59
73
|
[key: string]: any;
|
|
60
74
|
}
|
|
75
|
+
export interface AvailableSettlementOption extends Record<string, any> {
|
|
76
|
+
settlement_type: 'legal_currency' | 'virtual_currency' | string;
|
|
77
|
+
currency_product_id?: number;
|
|
78
|
+
price: string;
|
|
79
|
+
data_variant_id?: number;
|
|
80
|
+
data_variant_rule_id: number | string;
|
|
81
|
+
available: boolean;
|
|
82
|
+
disabled_reason?: string;
|
|
83
|
+
}
|
|
61
84
|
/**
|
|
62
85
|
* 餐牌商品配置项。
|
|
63
86
|
*/
|
|
@@ -131,6 +154,8 @@ export interface MatchedDataVariant {
|
|
|
131
154
|
*/
|
|
132
155
|
export interface DataVariantAppliedInfo {
|
|
133
156
|
appliedRuleIds: string[];
|
|
157
|
+
/** 本地策略实际应用的 Data Variant ID,按优先级从高到低排列。 */
|
|
158
|
+
appliedVariantIds?: Array<number | string>;
|
|
134
159
|
appliedFields: string[];
|
|
135
160
|
original: DataVariantProduct;
|
|
136
161
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -192,10 +192,11 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
192
192
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
193
193
|
*/
|
|
194
194
|
export function buildCacheItemFromOrderLine(input) {
|
|
195
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num,
|
|
195
|
+
var _ref11, _sourceProduct$holder, _sourceProduct$origin, _product$metadata, _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num, _ref12, _product$note, _booking$detail2, _product$metadata2, _product$metadata3, _ref13, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref14, _booking$id;
|
|
196
196
|
var product = input.product,
|
|
197
197
|
booking = input.booking,
|
|
198
198
|
sourceProduct = input.sourceProduct;
|
|
199
|
+
var holderConfig = (_ref11 = (_sourceProduct$holder = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config) !== null && _sourceProduct$holder !== void 0 ? _sourceProduct$holder : sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$origin = sourceProduct.origin) === null || _sourceProduct$origin === void 0 ? void 0 : _sourceProduct$origin.holder_config) !== null && _ref11 !== void 0 ? _ref11 : (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.holder_config;
|
|
199
200
|
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;
|
|
200
201
|
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
201
202
|
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
@@ -229,7 +230,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
229
230
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
230
231
|
product_name: productTitle,
|
|
231
232
|
product_cover: productCover,
|
|
232
|
-
note: (
|
|
233
|
+
note: (_ref12 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref12 !== void 0 ? _ref12 : '',
|
|
233
234
|
price: mainProductPrice,
|
|
234
235
|
total: selling,
|
|
235
236
|
origin_total: original,
|
|
@@ -238,7 +239,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
238
239
|
holder_id: holderId,
|
|
239
240
|
other: other,
|
|
240
241
|
like_status: booking.like_status || 'common',
|
|
241
|
-
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$
|
|
242
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.product_discount_reason) || undefined
|
|
242
243
|
}, bundleEdit !== undefined ? {
|
|
243
244
|
bundle_edit: bundleEdit
|
|
244
245
|
} : {}), productOptionString ? {
|
|
@@ -254,7 +255,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
254
255
|
extend.origin_total = selling + manualAmount;
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
|
-
if (((_product$
|
|
258
|
+
if (((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.price_override) != null || manualDiscount) {
|
|
258
259
|
extend.priceOverride = selling;
|
|
259
260
|
}
|
|
260
261
|
if (booking.holder !== undefined) {
|
|
@@ -263,10 +264,12 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
263
264
|
if (Array.isArray(booking.relation_forms)) {
|
|
264
265
|
extend.relation_forms = booking.relation_forms;
|
|
265
266
|
}
|
|
266
|
-
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}),
|
|
267
|
+
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), holderConfig !== undefined && holderConfig !== null ? {
|
|
268
|
+
holder_config: holderConfig
|
|
269
|
+
} : {}), {}, {
|
|
267
270
|
id: resolvedId,
|
|
268
271
|
product_id: resolvedId,
|
|
269
|
-
extension_type: (
|
|
272
|
+
extension_type: (_ref13 = (_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 && _ref13 !== void 0 ? _ref13 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
270
273
|
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
271
274
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
272
275
|
selling_price: product.selling_price,
|
|
@@ -280,7 +283,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
280
283
|
new: 0,
|
|
281
284
|
autoClose: false,
|
|
282
285
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
283
|
-
booking_id: (
|
|
286
|
+
booking_id: (_ref14 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref14 !== void 0 ? _ref14 : 0
|
|
284
287
|
});
|
|
285
288
|
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
286
289
|
base.capacity = sourceProduct.capacity;
|
|
@@ -25,9 +25,11 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
25
25
|
with_wallet_pass_holder: 0 | 1;
|
|
26
26
|
with_available_wallet_flag?: 0 | 1;
|
|
27
27
|
with_available_wallet_pass_flag?: 0 | 1;
|
|
28
|
+
with_virtual_currency?: 0 | 1;
|
|
28
29
|
request_timezone: string;
|
|
29
30
|
order_id?: number | string;
|
|
30
31
|
}): Promise<DiscountPrepareConfigResult>;
|
|
32
|
+
private normalizeVirtualCurrencyList;
|
|
31
33
|
batchSearch(code: string, options?: {
|
|
32
34
|
customerId?: number;
|
|
33
35
|
orderId?: number;
|
|
@@ -165,8 +165,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
165
|
key: "loadPrepareConfig",
|
|
166
166
|
value: function () {
|
|
167
167
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
168
|
-
var _params$with_availabl, _params$with_availabl2, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5;
|
|
169
|
-
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, goodPassList;
|
|
168
|
+
var _params$with_availabl, _params$with_availabl2, _params$with_virtual_, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5, _prepareConfig$data6;
|
|
169
|
+
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, virtualCurrencyList, goodPassList;
|
|
170
170
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
171
171
|
while (1) switch (_context4.prev = _context4.next) {
|
|
172
172
|
case 0:
|
|
@@ -176,7 +176,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
176
|
_context4.next = 3;
|
|
177
177
|
return this.request.post("/order/prepare/config", _objectSpread(_objectSpread({}, params), {}, {
|
|
178
178
|
with_available_wallet_flag: (_params$with_availabl = params.with_available_wallet_flag) !== null && _params$with_availabl !== void 0 ? _params$with_availabl : 1,
|
|
179
|
-
with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1
|
|
179
|
+
with_available_wallet_pass_flag: (_params$with_availabl2 = params.with_available_wallet_pass_flag) !== null && _params$with_availabl2 !== void 0 ? _params$with_availabl2 : 1,
|
|
180
|
+
with_virtual_currency: (_params$with_virtual_ = params.with_virtual_currency) !== null && _params$with_virtual_ !== void 0 ? _params$with_virtual_ : 1
|
|
180
181
|
}));
|
|
181
182
|
case 3:
|
|
182
183
|
prepareConfig = _context4.sent;
|
|
@@ -188,12 +189,14 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
188
189
|
})), _toConsumableArray(availableWalletPassList.map(function (item) {
|
|
189
190
|
return item === null || item === void 0 ? void 0 : item.product_id;
|
|
190
191
|
}))));
|
|
192
|
+
virtualCurrencyList = this.normalizeVirtualCurrencyList(prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data6 = prepareConfig.data) === null || _prepareConfig$data6 === void 0 ? void 0 : _prepareConfig$data6.virtual_currency_list);
|
|
191
193
|
goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
|
|
192
194
|
return _context4.abrupt("return", {
|
|
193
195
|
discountList: goodPassList,
|
|
194
|
-
availableWalletIds: availableWalletIds
|
|
196
|
+
availableWalletIds: availableWalletIds,
|
|
197
|
+
virtualCurrencyList: virtualCurrencyList
|
|
195
198
|
});
|
|
196
|
-
case
|
|
199
|
+
case 11:
|
|
197
200
|
case "end":
|
|
198
201
|
return _context4.stop();
|
|
199
202
|
}
|
|
@@ -204,6 +207,36 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
204
207
|
}
|
|
205
208
|
return loadPrepareConfig;
|
|
206
209
|
}()
|
|
210
|
+
}, {
|
|
211
|
+
key: "normalizeVirtualCurrencyList",
|
|
212
|
+
value: function normalizeVirtualCurrencyList(value) {
|
|
213
|
+
if (!Array.isArray(value)) return [];
|
|
214
|
+
return value.flatMap(function (item) {
|
|
215
|
+
var _item$balance;
|
|
216
|
+
var id = Number(item === null || item === void 0 ? void 0 : item.id);
|
|
217
|
+
var productId = Number(item === null || item === void 0 ? void 0 : item.product_id);
|
|
218
|
+
if (!Number.isFinite(id) || id <= 0 || !Number.isFinite(productId) || productId <= 0) {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
var displayExtension = Array.isArray(item === null || item === void 0 ? void 0 : item.extension_data) ? item.extension_data.find(function (extension) {
|
|
222
|
+
return (extension === null || extension === void 0 ? void 0 : extension.field_key) === 'virtual_currency_display';
|
|
223
|
+
}) : undefined;
|
|
224
|
+
var display = displayExtension === null || displayExtension === void 0 ? void 0 : displayExtension.value;
|
|
225
|
+
if (typeof display === 'string') {
|
|
226
|
+
try {
|
|
227
|
+
display = JSON.parse(display);
|
|
228
|
+
} catch (_unused) {
|
|
229
|
+
display = {};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return [_objectSpread(_objectSpread({}, item), {}, {
|
|
233
|
+
id: id,
|
|
234
|
+
product_id: productId,
|
|
235
|
+
balance: String((_item$balance = item === null || item === void 0 ? void 0 : item.balance) !== null && _item$balance !== void 0 ? _item$balance : '0'),
|
|
236
|
+
virtual_currency_display: display && _typeof(display) === 'object' && !Array.isArray(display) ? display : {}
|
|
237
|
+
})];
|
|
238
|
+
});
|
|
239
|
+
}
|
|
207
240
|
}, {
|
|
208
241
|
key: "batchSearch",
|
|
209
242
|
value: function () {
|
|
@@ -71,6 +71,17 @@ export interface DiscountWithReason {
|
|
|
71
71
|
export interface DiscountPrepareConfigResult {
|
|
72
72
|
discountList: Discount[];
|
|
73
73
|
availableWalletIds: number[];
|
|
74
|
+
virtualCurrencyList?: VirtualCurrencyAsset[];
|
|
75
|
+
}
|
|
76
|
+
export interface VirtualCurrencyAsset extends Record<string, any> {
|
|
77
|
+
id: number;
|
|
78
|
+
product_id: number;
|
|
79
|
+
balance: string;
|
|
80
|
+
product_name?: string;
|
|
81
|
+
format_title?: Record<string, any>;
|
|
82
|
+
code?: string;
|
|
83
|
+
encoded?: string;
|
|
84
|
+
virtual_currency_display?: Record<string, any>;
|
|
74
85
|
}
|
|
75
86
|
interface ExtensionData {
|
|
76
87
|
id: number;
|
|
@@ -29,8 +29,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
29
29
|
private promotionEvaluator;
|
|
30
30
|
/** 赠品选择 resolver;由 SDK host bridge 注入 */
|
|
31
31
|
private giftSelectResolver;
|
|
32
|
-
/**
|
|
32
|
+
/** 促销评估递归保护 flag(写路径同步评估促销,禁止重入) */
|
|
33
33
|
private isApplyingPromotion;
|
|
34
|
+
/** 保持旧事件语义:同步事件监听器内触发的订单写入不得递归评估促销。 */
|
|
35
|
+
private isEmittingPromotionApplied;
|
|
34
36
|
/** 商品曾应用过客户券卡,客户变更剥离后需强制跑一次 calcDiscount 复位价格 */
|
|
35
37
|
private hasActiveCustomerBoundDiscount;
|
|
36
38
|
/** 最近一次 applyPromotion 的未满足促销提示 */
|
|
@@ -60,6 +62,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
60
62
|
* orderModule.updateOtherParams({ cacheId: 'cache-2', channel: 'pos' });
|
|
61
63
|
*/
|
|
62
64
|
updateOtherParams(params: Record<string, any>): void;
|
|
65
|
+
/** PC/H5 属于在线店铺;其它或缺失平台统一沿用 POS 行为。 */
|
|
66
|
+
isOnlineStorePlatform(): boolean;
|
|
63
67
|
/**
|
|
64
68
|
* 记录信息日志
|
|
65
69
|
*/
|
|
@@ -82,6 +86,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
82
86
|
}): Promise<Discount[]>;
|
|
83
87
|
getDiscountList(): Discount[];
|
|
84
88
|
getAvailableWalletIds(): number[];
|
|
89
|
+
getVirtualCurrencyList(): import("../Discount/types").VirtualCurrencyAsset[];
|
|
85
90
|
private syncScannedDiscountsToOriginalDiscountList;
|
|
86
91
|
private ensureEditDiscountConfigForProductChange;
|
|
87
92
|
scanCode(code: string, customerId?: number): Promise<{
|
|
@@ -121,7 +126,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
121
126
|
*/
|
|
122
127
|
appendPromotionTags<T extends Record<string, any>>(products: T[]): T[];
|
|
123
128
|
/**
|
|
124
|
-
*
|
|
129
|
+
* 只执行购物车促销评估与赠品写回,不发布稳定态事件。
|
|
125
130
|
*
|
|
126
131
|
* 调用时机:写路径(add/update/remove/clear/setCustomer)末尾自动触发;外部一般无需手动调。
|
|
127
132
|
*
|
|
@@ -129,8 +134,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
129
134
|
* - 不调用任何公开 CRUD API(如 removeProductFromOrder),全部内部 mutate tempOrder.products,避免事件风暴;
|
|
130
135
|
* - 用 `isApplyingPromotion` 防递归;
|
|
131
136
|
* - 多选项赠品依赖 giftSelectResolver,未注入则跳过且 console.warn;
|
|
132
|
-
* - 不主动调用 applyDiscount / recalculateSummary
|
|
137
|
+
* - 不主动调用 applyDiscount / recalculateSummary,调用方负责跟进;
|
|
138
|
+
* - 返回的 payload 只能在 applyDiscount(商品写路径还需 summary/persist)完成后发布。
|
|
133
139
|
*/
|
|
140
|
+
private evaluatePromotion;
|
|
141
|
+
/** 发布促销稳定态;products 必须读取折扣计算后的当前数组。 */
|
|
142
|
+
private emitPromotionApplied;
|
|
143
|
+
/** 公开入口:促销、折扣、summary 与持久化完成后发布稳定态事件。 */
|
|
134
144
|
applyPromotion(): Promise<void>;
|
|
135
145
|
/** 最近一次 applyPromotion 输出的未满足促销列表 */
|
|
136
146
|
getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
|
|
@@ -400,6 +410,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
400
410
|
* this.hasLinkedBookingUid({ metadata: { booking_uid: 'booking-1' } });
|
|
401
411
|
*/
|
|
402
412
|
private hasLinkedBookingUid;
|
|
413
|
+
private isMultiCurrencySettlementEnabled;
|
|
414
|
+
private isActiveVirtualSettlementOrder;
|
|
415
|
+
private shouldUseVirtualSettlementSummary;
|
|
416
|
+
private normalizeVirtualSettlementProductIfEnabled;
|
|
417
|
+
private assertAndLockProductSettlement;
|
|
418
|
+
private syncTempOrderSettlementState;
|
|
419
|
+
private prepareVirtualSettlementTempOrder;
|
|
403
420
|
/**
|
|
404
421
|
* 预约商品加车后的统一收尾:促销、折扣、summary 重算与持久化(批量拆行时只调用一次)。
|
|
405
422
|
*
|
|
@@ -420,6 +437,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
420
437
|
* if (pending) await pending;
|
|
421
438
|
*/
|
|
422
439
|
private appendProductLineToTempOrder;
|
|
440
|
+
/**
|
|
441
|
+
* booking 数量拆行时,若 Holder 数量与拆行数严格一致,则按下标分配。
|
|
442
|
+
* 数量不一致时保持旧数据,避免猜测 Holder 与商品份数的对应关系。
|
|
443
|
+
*/
|
|
444
|
+
private createSplitBookingLine;
|
|
423
445
|
/**
|
|
424
446
|
* 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
|
|
425
447
|
*
|
|
@@ -472,6 +494,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
472
494
|
* 普通整单 note 保持不变;以商品行为主体的 Sales Notes 同步删除。
|
|
473
495
|
*/
|
|
474
496
|
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
497
|
+
/**
|
|
498
|
+
* 切换购物车结算单位时清理所有会影响新币种的订单状态,但保留当前客户。
|
|
499
|
+
*/
|
|
500
|
+
clearOrderForSettlementSwitch(): Promise<OrderTempOrder>;
|
|
475
501
|
buildCurrentSubmitPayloadForLocalPrint(params?: {
|
|
476
502
|
cacheId?: string;
|
|
477
503
|
platform?: string;
|