@pisell/pisellos 2.2.264 → 2.2.266
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/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -10
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +41 -10
- package/dist/modules/Order/index.js +1379 -810
- 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 +49 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +410 -0
- package/dist/modules/Order/utils.d.ts +4 -3
- package/dist/modules/Order/utils.js +61 -64
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +26 -24
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/modules/Rules/index.d.ts +2 -8
- package/dist/modules/Rules/index.js +55 -9
- package/dist/modules/Rules/types.d.ts +10 -1
- package/dist/server/index.d.ts +71 -0
- package/dist/server/index.js +2504 -1187
- package/dist/server/modules/order/index.d.ts +56 -5
- package/dist/server/modules/order/index.js +1718 -834
- package/dist/server/modules/order/types.d.ts +15 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/server/modules/products/index.d.ts +31 -8
- package/dist/server/modules/products/index.js +549 -390
- package/dist/server/modules/products/types.d.ts +18 -0
- package/dist/solution/BaseSales/index.d.ts +67 -4
- package/dist/solution/BaseSales/index.js +1476 -792
- package/dist/solution/BaseSales/types.d.ts +6 -1
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +94 -54
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +41 -10
- package/lib/modules/Order/index.js +514 -122
- 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 +49 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +418 -0
- package/lib/modules/Order/utils.d.ts +4 -3
- package/lib/modules/Order/utils.js +26 -20
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +26 -24
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/modules/Rules/index.d.ts +2 -8
- package/lib/modules/Rules/index.js +57 -6
- package/lib/modules/Rules/types.d.ts +10 -1
- package/lib/server/index.d.ts +71 -0
- package/lib/server/index.js +1002 -52
- package/lib/server/modules/order/index.d.ts +56 -5
- package/lib/server/modules/order/index.js +798 -148
- package/lib/server/modules/order/types.d.ts +15 -3
- package/lib/server/modules/products/index.d.ts +31 -8
- package/lib/server/modules/products/index.js +134 -35
- package/lib/server/modules/products/types.d.ts +18 -0
- package/lib/solution/BaseSales/index.d.ts +67 -4
- package/lib/solution/BaseSales/index.js +496 -50
- package/lib/solution/BaseSales/types.d.ts +6 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +39 -11
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
|
@@ -63,6 +63,8 @@ export interface OrderProductBundleItem {
|
|
|
63
63
|
bundle_group_id?: number;
|
|
64
64
|
/** 套餐商品 ID */
|
|
65
65
|
bundle_id?: number;
|
|
66
|
+
/** 套餐子商品封面图 */
|
|
67
|
+
cover?: string | null;
|
|
66
68
|
/** 套餐商品规格 ID */
|
|
67
69
|
bundle_variant_id?: number;
|
|
68
70
|
/** 数量 */
|
|
@@ -104,6 +106,8 @@ export interface OrderProductLineItem {
|
|
|
104
106
|
num: number;
|
|
105
107
|
/** 商品标题快照;本地待同步订单会补齐为多语言对象。 */
|
|
106
108
|
product_title?: OrderProductTitleSnapshot | string | null;
|
|
109
|
+
/** 商品封面图 */
|
|
110
|
+
product_cover?: string | null;
|
|
107
111
|
/** 多规格 ID。来源:Detail.product_variant_id */
|
|
108
112
|
product_variant_id?: number;
|
|
109
113
|
/**
|
|
@@ -209,10 +213,12 @@ export interface OrderBookingItem {
|
|
|
209
213
|
[key: string]: unknown;
|
|
210
214
|
}[];
|
|
211
215
|
}
|
|
212
|
-
/** 支付记录 metadata
|
|
216
|
+
/** 支付记录 metadata */
|
|
213
217
|
export interface OrderPaymentMetadata {
|
|
214
|
-
/**
|
|
218
|
+
/** 三方支付交易流水号 */
|
|
215
219
|
unique_payment_number?: string;
|
|
220
|
+
/** 刷卡机设备快照;server 不解析内部字段,仅透传并持久化 */
|
|
221
|
+
card_reader_snapshot?: Record<string, unknown>;
|
|
216
222
|
[key: string]: unknown;
|
|
217
223
|
}
|
|
218
224
|
/**
|
|
@@ -221,6 +227,8 @@ export interface OrderPaymentMetadata {
|
|
|
221
227
|
export interface OrderPaymentItem {
|
|
222
228
|
/** 支付记录 ID;存量/更新时传。来源:OrderPayment.id */
|
|
223
229
|
order_payment_id?: number | null;
|
|
230
|
+
/** 支付项稳定唯一号;历史支付项允许缺失 */
|
|
231
|
+
payment_number?: string;
|
|
224
232
|
/** 支付方式 ID(设备端从本地支付方式配置取详情)。来源:OrderPayment.custom_payment_id */
|
|
225
233
|
custom_payment_id?: number;
|
|
226
234
|
/** 支付方式编码。来源:OrderPayment.payment_method */
|
|
@@ -245,11 +253,13 @@ export interface OrderPaymentItem {
|
|
|
245
253
|
created_at?: string | null;
|
|
246
254
|
/** 手续费配置。来源:OrderPayment.service_charge */
|
|
247
255
|
service_charge?: Record<string, unknown> | null;
|
|
256
|
+
/** 已计算的支付手续费。来源:OrderPayment.service_fee */
|
|
257
|
+
service_fee?: OrderMoneyString;
|
|
248
258
|
/** Wallet Pass 使用单位 */
|
|
249
259
|
wallet_pass_usage_unit?: unknown[] | null;
|
|
250
260
|
/** Wallet Pass 使用值 */
|
|
251
261
|
wallet_pass_use_value?: number | null;
|
|
252
|
-
/**
|
|
262
|
+
/** 元数据;三方支付成功后可含 unique_payment_number */
|
|
253
263
|
metadata?: OrderPaymentMetadata | null;
|
|
254
264
|
}
|
|
255
265
|
/**
|
|
@@ -409,6 +419,8 @@ export interface OrderData {
|
|
|
409
419
|
create_date?: string;
|
|
410
420
|
/** 本地待同步标记:1 表示需要后续同步到云端 */
|
|
411
421
|
need_sync?: 0 | 1 | number;
|
|
422
|
+
/** 本地草稿标记:1 表示仅为 POS 可恢复草稿,不代表已提交云端 */
|
|
423
|
+
is_draft_order?: 0 | 1 | number;
|
|
412
424
|
/** 兼容:部分场景仍使用顶层 total_amount */
|
|
413
425
|
total_amount?: OrderMoneyString | number;
|
|
414
426
|
/** 扩展字段(物流、标签等);使用 any 以便筛选与数据源扩展 */
|
|
@@ -2,7 +2,7 @@ import { Module, PisellCore } from '../../../types';
|
|
|
2
2
|
import { BaseModule } from '../../../modules/BaseModule';
|
|
3
3
|
import { ProductData } from '../../../modules/Product/types';
|
|
4
4
|
import type { RouteDefinition } from '../../types';
|
|
5
|
-
import { ProductIdScope, ProductFormatter, ProductFormatterContext } from './types';
|
|
5
|
+
import { ProductIdScope, type ProductSnapshot, ProductFormatter, ProductFormatterContext } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Products 模块 - 用于获取和管理完整的商品详细数据
|
|
8
8
|
* 相比 ProductList 模块,Products 会获取所有详细信息并缓存
|
|
@@ -18,7 +18,8 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
18
18
|
private productsPriceCache;
|
|
19
19
|
private readonly CACHE_MAX_DAYS;
|
|
20
20
|
private formatters;
|
|
21
|
-
private
|
|
21
|
+
private isBuiltinFormatterRegistered;
|
|
22
|
+
private isLegacyPriceFormatterEnabled;
|
|
22
23
|
private quotationPriceBridge?;
|
|
23
24
|
private quotationBridgeChannel?;
|
|
24
25
|
private quotationBridgeLoadedKey?;
|
|
@@ -36,6 +37,8 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
36
37
|
private lastPreloadCompletedAtMs;
|
|
37
38
|
/** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
|
|
38
39
|
private productIndexDBSaveQueue;
|
|
40
|
+
/** 最近一次智能定价评估提取的 schedule 变价时间点(HH:mm),供 Server 订阅定时刷新使用 */
|
|
41
|
+
private lastScheduleTimePoints;
|
|
39
42
|
constructor(name?: string, version?: string);
|
|
40
43
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
41
44
|
/**
|
|
@@ -108,6 +111,10 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
108
111
|
*/
|
|
109
112
|
private prepareProductsWithPrice;
|
|
110
113
|
private getProductsPriceCacheKey;
|
|
114
|
+
/**
|
|
115
|
+
* 稳定序列化策略上下文,避免对象 key 顺序不同导致缓存 key 抖动。
|
|
116
|
+
*/
|
|
117
|
+
private stringifyStable;
|
|
111
118
|
private normalizeProductIds;
|
|
112
119
|
/**
|
|
113
120
|
* 按轻量范围返回商品 ID,不做 structuredClone。
|
|
@@ -122,14 +129,26 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
122
129
|
*/
|
|
123
130
|
private applyFormatters;
|
|
124
131
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
132
|
+
* 注册内置商品格式化器。
|
|
133
|
+
*
|
|
134
|
+
* 智能定价默认替代报价单逻辑;报价单 formatter 仅在 enableLegacyPriceFormatter=true 时启用。
|
|
127
135
|
* @private
|
|
128
136
|
*/
|
|
129
|
-
private
|
|
137
|
+
private registerBuiltinProductFormatters;
|
|
138
|
+
/**
|
|
139
|
+
* 是否启用旧报价单价格 formatter。
|
|
140
|
+
*
|
|
141
|
+
* 默认关闭,避免报价单逻辑覆盖智能定价结果。
|
|
142
|
+
*/
|
|
143
|
+
private shouldEnableLegacyPriceFormatter;
|
|
144
|
+
/**
|
|
145
|
+
* 返回最近一次 prepareProductsWithPrice / DataVariant 评估提取的变价时间点(HH:mm)。
|
|
146
|
+
* 供 OS Server 商品 query 订阅定时刷新使用。
|
|
147
|
+
*/
|
|
148
|
+
getLastScheduleTimePoints(): string[];
|
|
130
149
|
/**
|
|
131
150
|
* 注册商品格式化器
|
|
132
|
-
*
|
|
151
|
+
* 格式化器会按注册顺序依次执行;legacy 启用时先兜底报价,再由智能定价覆盖。
|
|
133
152
|
* @param formatter 格式化函数
|
|
134
153
|
* @param prepend 是否插入到队列开头(默认 false,追加到末尾)
|
|
135
154
|
* @example
|
|
@@ -144,8 +163,8 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
144
163
|
*/
|
|
145
164
|
registerFormatter(formatter: ProductFormatter, prepend?: boolean): void;
|
|
146
165
|
/**
|
|
147
|
-
*
|
|
148
|
-
* @param keepBuiltin
|
|
166
|
+
* 清空所有格式化器(包括内置智能定价格式化器)
|
|
167
|
+
* @param keepBuiltin 是否保留内置智能定价格式化器(默认 true)
|
|
149
168
|
*/
|
|
150
169
|
clearFormatters(keepBuiltin?: boolean): void;
|
|
151
170
|
/**
|
|
@@ -185,6 +204,10 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
185
204
|
* 获取商品列表(深拷贝,供外部安全使用)
|
|
186
205
|
*/
|
|
187
206
|
getProducts(): Promise<ProductData[]>;
|
|
207
|
+
/**
|
|
208
|
+
* 批量获取商品轻量快照,供订单详情等响应补齐展示协议字段。
|
|
209
|
+
*/
|
|
210
|
+
getProductSnapshotsByIds(ids: number[]): Promise<Record<string, ProductSnapshot>>;
|
|
188
211
|
/**
|
|
189
212
|
* 内部获取商品列表的直接引用(无拷贝)
|
|
190
213
|
* 仅供内部 formatter 流程使用,因为 formatter 会创建新对象
|
|
@@ -43,8 +43,10 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
43
43
|
// 最多缓存7天
|
|
44
44
|
// 商品格式化器列表
|
|
45
45
|
this.formatters = [];
|
|
46
|
-
//
|
|
47
|
-
this.
|
|
46
|
+
// 是否已注册内置商品格式化器
|
|
47
|
+
this.isBuiltinFormatterRegistered = false;
|
|
48
|
+
// 旧报价单格式化器默认关闭,仅显式开启时作为兼容兜底注册
|
|
49
|
+
this.isLegacyPriceFormatterEnabled = false;
|
|
48
50
|
this.quotationBridgeLoadedKey = "";
|
|
49
51
|
this.quotationScheduleCache = /* @__PURE__ */ new Map();
|
|
50
52
|
this.quotationScheduleCacheSource = null;
|
|
@@ -56,6 +58,8 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
56
58
|
this.lastPreloadCompletedAtMs = 0;
|
|
57
59
|
/** IndexDB 写入串行队列,避免快照与 patch 并发交错 */
|
|
58
60
|
this.productIndexDBSaveQueue = Promise.resolve();
|
|
61
|
+
/** 最近一次智能定价评估提取的 schedule 变价时间点(HH:mm),供 Server 订阅定时刷新使用 */
|
|
62
|
+
this.lastScheduleTimePoints = [];
|
|
59
63
|
}
|
|
60
64
|
async initialize(core, options) {
|
|
61
65
|
var _a;
|
|
@@ -82,7 +86,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
82
86
|
console.warn("[Products] IndexDB Manager 未找到");
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
|
-
this.
|
|
89
|
+
this.registerBuiltinProductFormatters();
|
|
86
90
|
this.initProductDataSource();
|
|
87
91
|
this.setupProductSync();
|
|
88
92
|
this.logInfo("模块初始化完成", {
|
|
@@ -474,7 +478,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
474
478
|
* @private
|
|
475
479
|
*/
|
|
476
480
|
async prepareProductsWithPrice(schedule_date, extraContext, options) {
|
|
477
|
-
var _a, _b;
|
|
481
|
+
var _a, _b, _c, _d;
|
|
478
482
|
const tTotal = performance.now();
|
|
479
483
|
const targetIds = options == null ? void 0 : options.productIds;
|
|
480
484
|
const isIncremental = Array.isArray(targetIds);
|
|
@@ -499,21 +503,28 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
499
503
|
(0, import_product.perfMark)("prepareProducts.extractIds", performance.now() - tIds, { count: ids.length });
|
|
500
504
|
}
|
|
501
505
|
this.logInfo("获取到商品列表", { productCount: products.length });
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
let priceData = [];
|
|
507
|
+
if (this.isLegacyPriceFormatterEnabled) {
|
|
508
|
+
const tPrice = performance.now();
|
|
509
|
+
priceData = await this.loadProductsPrice({
|
|
510
|
+
ids,
|
|
511
|
+
schedule_date,
|
|
512
|
+
schedule_datetime: extraContext == null ? void 0 : extraContext.schedule_datetime,
|
|
513
|
+
customer_id: extraContext == null ? void 0 : extraContext.customer_id
|
|
514
|
+
});
|
|
515
|
+
(0, import_product.perfMark)("prepareProducts.loadPrice", performance.now() - tPrice, { count: ids.length });
|
|
516
|
+
this.logInfo("获取商品报价单价格成功", { priceDataCount: (priceData == null ? void 0 : priceData.length) ?? 0 });
|
|
517
|
+
}
|
|
511
518
|
const context = {
|
|
512
519
|
schedule_date,
|
|
513
520
|
schedule_datetime: extraContext == null ? void 0 : extraContext.schedule_datetime,
|
|
514
521
|
customer_id: extraContext == null ? void 0 : extraContext.customer_id,
|
|
515
522
|
priceData,
|
|
516
523
|
locale: (_b = (_a = this.core) == null ? void 0 : _a.context) == null ? void 0 : _b.locale,
|
|
524
|
+
dataVariantEvaluator: (extraContext == null ? void 0 : extraContext.dataVariantEvaluator) || ((_d = (_c = this.core) == null ? void 0 : _c.context) == null ? void 0 : _d.dataVariantEvaluator),
|
|
525
|
+
menuList: (extraContext == null ? void 0 : extraContext.menuList) || [],
|
|
526
|
+
scheduleList: (extraContext == null ? void 0 : extraContext.scheduleList) || [],
|
|
527
|
+
strategy_context: extraContext == null ? void 0 : extraContext.strategy_context,
|
|
517
528
|
...extraContext
|
|
518
529
|
};
|
|
519
530
|
const tFormat = performance.now();
|
|
@@ -553,7 +564,21 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
553
564
|
getProductsPriceCacheKey(schedule_date, extraContext, productIds) {
|
|
554
565
|
const datetime = (extraContext == null ? void 0 : extraContext.schedule_datetime) || schedule_date;
|
|
555
566
|
const productScope = productIds ? `:products:${productIds.join(",")}` : "";
|
|
556
|
-
|
|
567
|
+
const strategyScope = this.stringifyStable((extraContext == null ? void 0 : extraContext.strategy_context) || {});
|
|
568
|
+
return `${datetime}:customer:${(extraContext == null ? void 0 : extraContext.customer_id) ?? ""}:strategy:${strategyScope}${productScope}`;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* 稳定序列化策略上下文,避免对象 key 顺序不同导致缓存 key 抖动。
|
|
572
|
+
*/
|
|
573
|
+
stringifyStable(value) {
|
|
574
|
+
if (value == null)
|
|
575
|
+
return "";
|
|
576
|
+
if (Array.isArray(value))
|
|
577
|
+
return `[${value.map((item) => this.stringifyStable(item)).join(",")}]`;
|
|
578
|
+
if (typeof value === "object") {
|
|
579
|
+
return `{${Object.keys(value).sort().map((key) => `${key}:${this.stringifyStable(value[key])}`).join(",")}}`;
|
|
580
|
+
}
|
|
581
|
+
return String(value);
|
|
557
582
|
}
|
|
558
583
|
normalizeProductIds(productIds) {
|
|
559
584
|
if (!Array.isArray(productIds))
|
|
@@ -637,21 +662,50 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
637
662
|
return result;
|
|
638
663
|
}
|
|
639
664
|
/**
|
|
640
|
-
*
|
|
641
|
-
*
|
|
665
|
+
* 注册内置商品格式化器。
|
|
666
|
+
*
|
|
667
|
+
* 智能定价默认替代报价单逻辑;报价单 formatter 仅在 enableLegacyPriceFormatter=true 时启用。
|
|
642
668
|
* @private
|
|
643
669
|
*/
|
|
644
|
-
|
|
645
|
-
if (this.
|
|
646
|
-
console.warn("[ProductsModule]
|
|
670
|
+
registerBuiltinProductFormatters() {
|
|
671
|
+
if (this.isBuiltinFormatterRegistered) {
|
|
672
|
+
console.warn("[ProductsModule] 内置商品格式化器已注册,跳过");
|
|
647
673
|
return;
|
|
648
674
|
}
|
|
649
|
-
|
|
675
|
+
this.isLegacyPriceFormatterEnabled = this.shouldEnableLegacyPriceFormatter();
|
|
676
|
+
const dataVariantFormatter = (products, context) => {
|
|
677
|
+
var _a, _b;
|
|
678
|
+
const evaluator = context.dataVariantEvaluator || ((_b = (_a = this.core) == null ? void 0 : _a.context) == null ? void 0 : _b.dataVariantEvaluator);
|
|
679
|
+
if (!evaluator || typeof evaluator.resolveProducts !== "function") {
|
|
680
|
+
this.lastScheduleTimePoints = [];
|
|
681
|
+
this.logWarning("智能定价评估器未注入,跳过 DataVariant 格式化", {
|
|
682
|
+
productCount: products.length
|
|
683
|
+
});
|
|
684
|
+
return products;
|
|
685
|
+
}
|
|
686
|
+
const strategyContext = context.strategy_context || {};
|
|
687
|
+
const businessData = {
|
|
688
|
+
products,
|
|
689
|
+
scheduleDateTime: context.schedule_datetime || context.schedule_date,
|
|
690
|
+
scheduleList: context.scheduleList || [],
|
|
691
|
+
menuList: context.menuList || [],
|
|
692
|
+
customerId: context.customer_id,
|
|
693
|
+
channel: strategyContext.channel,
|
|
694
|
+
orderType: strategyContext.orderType || strategyContext.order_type,
|
|
695
|
+
businessCode: strategyContext.business_code ?? strategyContext.businessCode,
|
|
696
|
+
availableWalletIds: strategyContext.available_wallet_ids,
|
|
697
|
+
custom: strategyContext
|
|
698
|
+
};
|
|
699
|
+
const result = evaluator.resolveProducts(businessData);
|
|
700
|
+
this.lastScheduleTimePoints = Array.isArray(result == null ? void 0 : result.scheduleTimePoints) ? [...result.scheduleTimePoints] : [];
|
|
701
|
+
return Array.isArray(result == null ? void 0 : result.products) ? result.products : products;
|
|
702
|
+
};
|
|
703
|
+
const legacyPriceFormatter = (products, context) => {
|
|
650
704
|
if (!context.priceData || context.priceData.length === 0) {
|
|
651
|
-
console.log("[ProductsModule] 💰
|
|
705
|
+
console.log("[ProductsModule] 💰 没有价格数据,跳过 legacy 报价单价格应用");
|
|
652
706
|
return products;
|
|
653
707
|
}
|
|
654
|
-
console.log(`[ProductsModule] 💰
|
|
708
|
+
console.log(`[ProductsModule] 💰 应用 legacy 报价单价格到 ${products.length} 个商品`);
|
|
655
709
|
return (0, import_product.applyPriceDataToProducts)(products, context.priceData);
|
|
656
710
|
};
|
|
657
711
|
const i18nFormatter = (products, context) => {
|
|
@@ -660,15 +714,34 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
660
714
|
const detailValueFormatter = (products, context) => {
|
|
661
715
|
return (0, import_product.applyDetailValueToProducts)(products, context);
|
|
662
716
|
};
|
|
663
|
-
this.
|
|
717
|
+
if (this.isLegacyPriceFormatterEnabled) {
|
|
718
|
+
this.formatters.push(legacyPriceFormatter);
|
|
719
|
+
}
|
|
720
|
+
this.formatters.push(dataVariantFormatter);
|
|
664
721
|
this.formatters.push(i18nFormatter);
|
|
665
722
|
this.formatters.push(detailValueFormatter);
|
|
666
|
-
this.
|
|
667
|
-
console.log("[ProductsModule] ✅
|
|
723
|
+
this.isBuiltinFormatterRegistered = true;
|
|
724
|
+
console.log("[ProductsModule] ✅ 内置商品格式化器已注册(智能定价优先)");
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* 是否启用旧报价单价格 formatter。
|
|
728
|
+
*
|
|
729
|
+
* 默认关闭,避免报价单逻辑覆盖智能定价结果。
|
|
730
|
+
*/
|
|
731
|
+
shouldEnableLegacyPriceFormatter() {
|
|
732
|
+
var _a, _b, _c;
|
|
733
|
+
return ((_a = this.otherParams) == null ? void 0 : _a.enableLegacyPriceFormatter) === true || ((_c = (_b = this.core) == null ? void 0 : _b.context) == null ? void 0 : _c.enableLegacyPriceFormatter) === true;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* 返回最近一次 prepareProductsWithPrice / DataVariant 评估提取的变价时间点(HH:mm)。
|
|
737
|
+
* 供 OS Server 商品 query 订阅定时刷新使用。
|
|
738
|
+
*/
|
|
739
|
+
getLastScheduleTimePoints() {
|
|
740
|
+
return [...this.lastScheduleTimePoints];
|
|
668
741
|
}
|
|
669
742
|
/**
|
|
670
743
|
* 注册商品格式化器
|
|
671
|
-
*
|
|
744
|
+
* 格式化器会按注册顺序依次执行;legacy 启用时先兜底报价,再由智能定价覆盖。
|
|
672
745
|
* @param formatter 格式化函数
|
|
673
746
|
* @param prepend 是否插入到队列开头(默认 false,追加到末尾)
|
|
674
747
|
* @example
|
|
@@ -683,7 +756,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
683
756
|
*/
|
|
684
757
|
registerFormatter(formatter, prepend = false) {
|
|
685
758
|
if (prepend) {
|
|
686
|
-
const insertIndex = this.
|
|
759
|
+
const insertIndex = this.isBuiltinFormatterRegistered ? this.isLegacyPriceFormatterEnabled ? 2 : 1 : 0;
|
|
687
760
|
this.formatters.splice(insertIndex, 0, formatter);
|
|
688
761
|
console.log(`[ProductsModule] 📌 已在位置 ${insertIndex + 1} 插入格式化器,当前共 ${this.formatters.length} 个`);
|
|
689
762
|
} else {
|
|
@@ -692,16 +765,17 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
692
765
|
}
|
|
693
766
|
}
|
|
694
767
|
/**
|
|
695
|
-
*
|
|
696
|
-
* @param keepBuiltin
|
|
768
|
+
* 清空所有格式化器(包括内置智能定价格式化器)
|
|
769
|
+
* @param keepBuiltin 是否保留内置智能定价格式化器(默认 true)
|
|
697
770
|
*/
|
|
698
771
|
clearFormatters(keepBuiltin = true) {
|
|
699
|
-
if (keepBuiltin && this.
|
|
700
|
-
|
|
701
|
-
|
|
772
|
+
if (keepBuiltin && this.isBuiltinFormatterRegistered) {
|
|
773
|
+
const builtinCount = this.isLegacyPriceFormatterEnabled ? 2 : 1;
|
|
774
|
+
this.formatters = this.formatters.slice(0, builtinCount);
|
|
775
|
+
console.log("[ProductsModule] 🧹 已清空自定义格式化器,保留内置智能定价格式化器");
|
|
702
776
|
} else {
|
|
703
777
|
this.formatters = [];
|
|
704
|
-
this.
|
|
778
|
+
this.isBuiltinFormatterRegistered = false;
|
|
705
779
|
console.log("[ProductsModule] 🧹 已清空所有格式化器");
|
|
706
780
|
}
|
|
707
781
|
}
|
|
@@ -802,7 +876,8 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
802
876
|
"resourceRelation",
|
|
803
877
|
"bundleGroup.bundleItem",
|
|
804
878
|
"optionGroup.optionItem",
|
|
805
|
-
"variantGroup.variantItem"
|
|
879
|
+
"variantGroup.variantItem",
|
|
880
|
+
"dataVariants"
|
|
806
881
|
],
|
|
807
882
|
open_deposit: 1,
|
|
808
883
|
is_append_product_description: 1,
|
|
@@ -860,6 +935,26 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
860
935
|
(0, import_product.perfMark)("ProductsModule.getProducts(structuredClone)", performance.now() - t0, { count: result.length });
|
|
861
936
|
return result;
|
|
862
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* 批量获取商品轻量快照,供订单详情等响应补齐展示协议字段。
|
|
940
|
+
*/
|
|
941
|
+
async getProductSnapshotsByIds(ids) {
|
|
942
|
+
const snapshots = {};
|
|
943
|
+
const seen = /* @__PURE__ */ new Set();
|
|
944
|
+
for (const id of ids) {
|
|
945
|
+
if (!Number.isFinite(id) || seen.has(id))
|
|
946
|
+
continue;
|
|
947
|
+
seen.add(id);
|
|
948
|
+
const product = this.store.map.get(id);
|
|
949
|
+
if (!product)
|
|
950
|
+
continue;
|
|
951
|
+
snapshots[String(id)] = {
|
|
952
|
+
cover: product.cover,
|
|
953
|
+
holder_config: product.holder_config
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
return snapshots;
|
|
957
|
+
}
|
|
863
958
|
/**
|
|
864
959
|
* 内部获取商品列表的直接引用(无拷贝)
|
|
865
960
|
* 仅供内部 formatter 流程使用,因为 formatter 会创建新对象
|
|
@@ -1227,7 +1322,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
1227
1322
|
* Server 层监听该事件后对变更商品增量执行 prepareProductsWithPrice 并更新缓存
|
|
1228
1323
|
*/
|
|
1229
1324
|
async processProductSyncMessages() {
|
|
1230
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1325
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1231
1326
|
const messages = [...this.pendingSyncMessages];
|
|
1232
1327
|
this.pendingSyncMessages = [];
|
|
1233
1328
|
if (messages.length === 0)
|
|
@@ -1281,6 +1376,10 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
1281
1376
|
if ((_f = msg.relation_product_ids) == null ? void 0 : _f.length) {
|
|
1282
1377
|
sseRefreshIds.push(...msg.relation_product_ids);
|
|
1283
1378
|
}
|
|
1379
|
+
} else if (["product_data_variant"].includes(channelKey)) {
|
|
1380
|
+
if ((_g = msg.product_ids) == null ? void 0 : _g.length) {
|
|
1381
|
+
sseRefreshIds.push(...msg.product_ids);
|
|
1382
|
+
}
|
|
1284
1383
|
}
|
|
1285
1384
|
}
|
|
1286
1385
|
const uniqueDeleteIds = [...new Set(deleteIds)];
|
|
@@ -28,6 +28,10 @@ export interface ProductIdScope {
|
|
|
28
28
|
/** 指定商品集合 ID */
|
|
29
29
|
collectionIds?: number[];
|
|
30
30
|
}
|
|
31
|
+
export interface ProductSnapshot {
|
|
32
|
+
cover?: ProductData['cover'];
|
|
33
|
+
holder_config?: ProductData['holder_config'];
|
|
34
|
+
}
|
|
31
35
|
/**
|
|
32
36
|
* 加载报价单商品价格参数
|
|
33
37
|
*/
|
|
@@ -110,6 +114,8 @@ export interface ProductSyncMessage {
|
|
|
110
114
|
change_types?: string[];
|
|
111
115
|
/** 关联商品 ID(product_collection / product_category / product_quotation 变更时携带) */
|
|
112
116
|
relation_product_ids?: number[];
|
|
117
|
+
/** 关联商品 ID(product_data_variant 变更时携带) */
|
|
118
|
+
product_ids?: number[];
|
|
113
119
|
message_uuid?: string;
|
|
114
120
|
timestamp?: string;
|
|
115
121
|
/** 内部标记:来源频道 key */
|
|
@@ -124,6 +130,18 @@ export interface ProductFormatterContext {
|
|
|
124
130
|
customer_id?: number | string;
|
|
125
131
|
priceData?: LoadProductsPriceData[];
|
|
126
132
|
scheduleModule?: any;
|
|
133
|
+
/** 全量餐牌列表,供智能定价 menu_match 等条件判断使用 */
|
|
134
|
+
menuList?: any[];
|
|
135
|
+
/** 全量日程列表,供智能定价 schedule_match 等条件判断使用 */
|
|
136
|
+
scheduleList?: any[];
|
|
137
|
+
/** 外部传入的策略上下文,仅承载定价条件,不参与商品集合筛选 */
|
|
138
|
+
strategy_context?: Record<string, any>;
|
|
139
|
+
/** 智能定价评估器,由宿主统一注入到 PisellOS context */
|
|
140
|
+
dataVariantEvaluator?: {
|
|
141
|
+
resolveProducts: (businessData: any) => {
|
|
142
|
+
products: ProductData[];
|
|
143
|
+
};
|
|
144
|
+
};
|
|
127
145
|
locale?: string;
|
|
128
146
|
}
|
|
129
147
|
/**
|
|
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { BaseSalesOrderProduct, BaseSalesOrderProductIdentity, BaseSalesPaymentStatus, BaseSalesUpdateOrderProductQuantityParams, BaseSalesCalculateProductBookingPriceParams, BaseSalesPriceRecalculationContextChange, BaseSalesProductBookingPriceResult, BaseSalesQuotationCustomerScopeInfo, BaseSalesScanCodeResult } from './types';
|
|
4
4
|
import { OrderModule } from '../../modules/Order';
|
|
5
|
-
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
|
|
5
|
+
import type { AddProductBookingInput, LoadSalesDetailParams, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, OrderPaymentSource, SendCustomerPayLinkParams, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, UpdateTempOrderCustomerInput, UpdateOrderBookingParams, UpdateOrderProductParams, OrderTempOrder, OrderSummary, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from '../../modules/Order/types';
|
|
6
6
|
import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
|
|
7
7
|
import type { Discount } from '../../modules/Discount/types';
|
|
8
8
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
@@ -24,6 +24,19 @@ export interface BaseSalesState {
|
|
|
24
24
|
schedule?: ScheduleModule;
|
|
25
25
|
quotation?: QuotationModule;
|
|
26
26
|
}
|
|
27
|
+
export interface BaseSalesUpdateOrderPaymentOptions extends OrderPaymentUpdateOptions {
|
|
28
|
+
persistDraft?: boolean;
|
|
29
|
+
submitWhenPaid?: boolean;
|
|
30
|
+
forceSubmitIfPaid?: boolean;
|
|
31
|
+
/** 草稿恢复时,允许将新回调字段合并进已 paid 的支付项。 */
|
|
32
|
+
applyUpdatesWhenPaid?: boolean;
|
|
33
|
+
smallTicketDataFlag?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface BaseSalesUpdateOrderPaymentResult extends OrderPaymentUpdateResult {
|
|
36
|
+
draftResult?: unknown;
|
|
37
|
+
draftError?: unknown;
|
|
38
|
+
syncResult?: SyncPaymentsToOrderResult<any>;
|
|
39
|
+
}
|
|
27
40
|
export type BaseSalesPrintLocalOrderReceiptParams = string | number;
|
|
28
41
|
export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
29
42
|
protected defaultName: string;
|
|
@@ -35,6 +48,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
35
48
|
protected store: BaseSalesState;
|
|
36
49
|
protected otherParams: Record<string, any>;
|
|
37
50
|
protected cacheId: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
53
|
+
* 未设置时,支付编号仍按原逻辑实时读取设备信息。
|
|
54
|
+
*/
|
|
55
|
+
protected paymentNumberDevicePrefix: string | null;
|
|
38
56
|
/**
|
|
39
57
|
* window / request 暴露为 public:现存外部工具(如 BookingTicket Scan)通过
|
|
40
58
|
* `solution.window` / `solution.request` 直接访问插件,保持原有契约不破坏。
|
|
@@ -49,9 +67,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
49
67
|
private queuedAutoPaymentSync;
|
|
50
68
|
private autoPaymentSyncFlushing;
|
|
51
69
|
private autoPaymentSyncTimer;
|
|
52
|
-
private
|
|
70
|
+
private salesDetailLoadInFlightCount;
|
|
71
|
+
private salesDetailLoadSequence;
|
|
72
|
+
private salesDetailHydrateQueue;
|
|
53
73
|
private serverOrderChangeUnsubscribe;
|
|
54
74
|
private serverOrderChangeHydrateInFlight;
|
|
75
|
+
private queuedServerOrderChanges;
|
|
76
|
+
private serverOrderChangeSyncEnabled;
|
|
55
77
|
constructor(name?: string, version?: string);
|
|
56
78
|
/**
|
|
57
79
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
@@ -73,8 +95,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
73
95
|
*/
|
|
74
96
|
private logError;
|
|
75
97
|
private isCurrentSalesOrderRecord;
|
|
98
|
+
setServerOrderChangeSyncEnabled(enabled: boolean): void;
|
|
99
|
+
private queueLatestServerOrderChange;
|
|
100
|
+
private drainQueuedServerOrderChanges;
|
|
76
101
|
private syncCurrentSalesDetailFromServerOrderChange;
|
|
77
102
|
private registerServerOrderChangeSync;
|
|
103
|
+
private hydrateLatestLoadedSalesDetail;
|
|
78
104
|
private hydrateOrderPaymentNames;
|
|
79
105
|
get payment(): PaymentModule | undefined;
|
|
80
106
|
private getCurrentOrderCustomerId;
|
|
@@ -120,6 +146,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
120
146
|
*/
|
|
121
147
|
protected readSessionCacheData(): Record<string, any>;
|
|
122
148
|
protected getAppData<T>(key: string): T | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* 复用业务解决方案初始化时已解析的支付设备短号。
|
|
151
|
+
* 空值会清除缓存,使后续支付恢复实时读取设备信息的兼容路径。
|
|
152
|
+
*/
|
|
153
|
+
protected setPaymentNumberDevicePrefix(prefix: unknown): void;
|
|
154
|
+
private getPaymentNumberDevicePrefixSync;
|
|
155
|
+
private getPaymentNumberDevicePrefixAsync;
|
|
123
156
|
private syncAppDataToTempOrder;
|
|
124
157
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
125
158
|
destroy(): Promise<void>;
|
|
@@ -185,12 +218,24 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
185
218
|
}): Promise<{
|
|
186
219
|
productList: Record<string, any>[];
|
|
187
220
|
discountList: Discount[];
|
|
221
|
+
availableWalletIds: number[];
|
|
188
222
|
}>;
|
|
223
|
+
getAvailableWalletIds(): number[];
|
|
189
224
|
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
190
225
|
productList: Record<string, any>[];
|
|
191
226
|
discountList: Discount[];
|
|
192
227
|
}>;
|
|
193
228
|
getDiscountList(): Discount[];
|
|
229
|
+
/** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
|
|
230
|
+
getOriginalDiscountList(): Discount[];
|
|
231
|
+
/**
|
|
232
|
+
* 同步写入 Discount 模块的 discountList / originalDiscountList。
|
|
233
|
+
* 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
|
|
234
|
+
*/
|
|
235
|
+
replaceDiscountStoreLists(params: {
|
|
236
|
+
discountList: Discount[];
|
|
237
|
+
originalDiscountList?: Discount[];
|
|
238
|
+
}): Promise<void>;
|
|
194
239
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
195
240
|
setDiscountSelected(params: {
|
|
196
241
|
discountId: number;
|
|
@@ -220,6 +265,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
220
265
|
confirmPendingVoucherPayments?: boolean;
|
|
221
266
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
222
267
|
}): Promise<T>;
|
|
268
|
+
saveSalesOrderDraft<T = any>(params?: {
|
|
269
|
+
platform?: string;
|
|
270
|
+
businessCode?: string;
|
|
271
|
+
channel?: string;
|
|
272
|
+
type?: string;
|
|
273
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
274
|
+
}): Promise<T>;
|
|
223
275
|
submitTempOrderAsync<T = any>(params?: {
|
|
224
276
|
payments?: OrderPaymentSource[];
|
|
225
277
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -238,16 +290,27 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
238
290
|
private queueLatestAutoPaymentSync;
|
|
239
291
|
private scheduleQueuedAutoPaymentSyncFlush;
|
|
240
292
|
private flushQueuedAutoPaymentSync;
|
|
241
|
-
/**
|
|
293
|
+
/**
|
|
294
|
+
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
295
|
+
*/
|
|
242
296
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
297
|
+
/**
|
|
298
|
+
* 创建新支付项时优先使用业务解决方案初始化阶段缓存的设备短号;
|
|
299
|
+
* 未缓存的通用 BaseSales 保持实时读取设备信息的兼容语义。
|
|
300
|
+
*/
|
|
301
|
+
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
302
|
+
private addOrderPaymentWithDevicePrefix;
|
|
243
303
|
/** 更新当前订单中的指定支付项。 */
|
|
244
|
-
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any
|
|
304
|
+
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: BaseSalesUpdateOrderPaymentOptions): Promise<BaseSalesUpdateOrderPaymentResult>;
|
|
245
305
|
/** 删除当前订单中的指定支付项。 */
|
|
246
306
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
247
307
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
248
308
|
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
249
309
|
status?: 'paid' | 'payment_pending';
|
|
250
310
|
}): OrderPaymentData[];
|
|
311
|
+
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
312
|
+
status?: 'paid' | 'payment_pending';
|
|
313
|
+
}): Promise<OrderPaymentData[]>;
|
|
251
314
|
confirmPendingVoucherPayments(): OrderPaymentData[];
|
|
252
315
|
discardPendingVoucherPayments(): OrderPaymentData[];
|
|
253
316
|
private getWalletProductList;
|