@pisell/pisellos 2.2.264 → 2.2.265
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/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +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 +1370 -808
- 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 +62 -66
- 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 -9
- package/dist/modules/Rules/index.js +69 -43
- 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 +54 -4
- package/dist/solution/BaseSales/index.js +1448 -788
- package/dist/solution/BaseSales/types.d.ts +6 -1
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +50 -97
- 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 +61 -26
- 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/ScanOrder/index.js +20 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/dist/solution/VenueBooking/index.js +19 -30
- 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/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +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 +505 -119
- 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 +27 -26
- 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 -9
- package/lib/modules/Rules/index.js +61 -29
- 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 +54 -4
- package/lib/solution/BaseSales/index.js +475 -50
- package/lib/solution/BaseSales/types.d.ts +6 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +25 -64
- 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 +35 -9
- 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/ScanOrder/index.js +0 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -49,9 +62,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
49
62
|
private queuedAutoPaymentSync;
|
|
50
63
|
private autoPaymentSyncFlushing;
|
|
51
64
|
private autoPaymentSyncTimer;
|
|
52
|
-
private
|
|
65
|
+
private salesDetailLoadInFlightCount;
|
|
66
|
+
private salesDetailLoadSequence;
|
|
67
|
+
private salesDetailHydrateQueue;
|
|
53
68
|
private serverOrderChangeUnsubscribe;
|
|
54
69
|
private serverOrderChangeHydrateInFlight;
|
|
70
|
+
private queuedServerOrderChanges;
|
|
71
|
+
private serverOrderChangeSyncEnabled;
|
|
55
72
|
constructor(name?: string, version?: string);
|
|
56
73
|
/**
|
|
57
74
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
@@ -73,8 +90,12 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
73
90
|
*/
|
|
74
91
|
private logError;
|
|
75
92
|
private isCurrentSalesOrderRecord;
|
|
93
|
+
setServerOrderChangeSyncEnabled(enabled: boolean): void;
|
|
94
|
+
private queueLatestServerOrderChange;
|
|
95
|
+
private drainQueuedServerOrderChanges;
|
|
76
96
|
private syncCurrentSalesDetailFromServerOrderChange;
|
|
77
97
|
private registerServerOrderChangeSync;
|
|
98
|
+
private hydrateLatestLoadedSalesDetail;
|
|
78
99
|
private hydrateOrderPaymentNames;
|
|
79
100
|
get payment(): PaymentModule | undefined;
|
|
80
101
|
private getCurrentOrderCustomerId;
|
|
@@ -120,6 +141,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
120
141
|
*/
|
|
121
142
|
protected readSessionCacheData(): Record<string, any>;
|
|
122
143
|
protected getAppData<T>(key: string): T | undefined;
|
|
144
|
+
private getPaymentNumberDevicePrefixSync;
|
|
145
|
+
private getPaymentNumberDevicePrefixAsync;
|
|
123
146
|
private syncAppDataToTempOrder;
|
|
124
147
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
125
148
|
destroy(): Promise<void>;
|
|
@@ -185,12 +208,24 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
185
208
|
}): Promise<{
|
|
186
209
|
productList: Record<string, any>[];
|
|
187
210
|
discountList: Discount[];
|
|
211
|
+
availableWalletIds: number[];
|
|
188
212
|
}>;
|
|
213
|
+
getAvailableWalletIds(): number[];
|
|
189
214
|
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
190
215
|
productList: Record<string, any>[];
|
|
191
216
|
discountList: Discount[];
|
|
192
217
|
}>;
|
|
193
218
|
getDiscountList(): Discount[];
|
|
219
|
+
/** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
|
|
220
|
+
getOriginalDiscountList(): Discount[];
|
|
221
|
+
/**
|
|
222
|
+
* 同步写入 Discount 模块的 discountList / originalDiscountList。
|
|
223
|
+
* 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
|
|
224
|
+
*/
|
|
225
|
+
replaceDiscountStoreLists(params: {
|
|
226
|
+
discountList: Discount[];
|
|
227
|
+
originalDiscountList?: Discount[];
|
|
228
|
+
}): Promise<void>;
|
|
194
229
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
195
230
|
setDiscountSelected(params: {
|
|
196
231
|
discountId: number;
|
|
@@ -220,6 +255,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
220
255
|
confirmPendingVoucherPayments?: boolean;
|
|
221
256
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
222
257
|
}): Promise<T>;
|
|
258
|
+
saveSalesOrderDraft<T = any>(params?: {
|
|
259
|
+
platform?: string;
|
|
260
|
+
businessCode?: string;
|
|
261
|
+
channel?: string;
|
|
262
|
+
type?: string;
|
|
263
|
+
enhancePayload?: SubmitPayloadEnhancer;
|
|
264
|
+
}): Promise<T>;
|
|
223
265
|
submitTempOrderAsync<T = any>(params?: {
|
|
224
266
|
payments?: OrderPaymentSource[];
|
|
225
267
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
@@ -238,16 +280,24 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
238
280
|
private queueLatestAutoPaymentSync;
|
|
239
281
|
private scheduleQueuedAutoPaymentSyncFlush;
|
|
240
282
|
private flushQueuedAutoPaymentSync;
|
|
241
|
-
/**
|
|
283
|
+
/**
|
|
284
|
+
* 同步兼容入口。无法等待 IoT 短号时,按调用当下的 device_id 或 LOCAL 生成。
|
|
285
|
+
*/
|
|
242
286
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
287
|
+
/** 创建新支付项时读取最新设备短号,不缓存运行时设备信息。 */
|
|
288
|
+
addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
|
|
289
|
+
private addOrderPaymentWithDevicePrefix;
|
|
243
290
|
/** 更新当前订单中的指定支付项。 */
|
|
244
|
-
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any
|
|
291
|
+
updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: BaseSalesUpdateOrderPaymentOptions): Promise<BaseSalesUpdateOrderPaymentResult>;
|
|
245
292
|
/** 删除当前订单中的指定支付项。 */
|
|
246
293
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
247
294
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
248
295
|
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
249
296
|
status?: 'paid' | 'payment_pending';
|
|
250
297
|
}): OrderPaymentData[];
|
|
298
|
+
updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
|
|
299
|
+
status?: 'paid' | 'payment_pending';
|
|
300
|
+
}): Promise<OrderPaymentData[]>;
|
|
251
301
|
confirmPendingVoucherPayments(): OrderPaymentData[];
|
|
252
302
|
discardPendingVoucherPayments(): OrderPaymentData[];
|
|
253
303
|
private getWalletProductList;
|