@pisell/pisellos 2.2.260 → 2.2.262
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 +1 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +15 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +25 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +1 -6
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +23 -13
- 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 +45 -2
- package/dist/modules/Order/index.js +1552 -926
- package/dist/modules/Order/types.d.ts +36 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +8 -3
- package/dist/modules/Order/utils.js +136 -56
- package/dist/modules/Rules/index.d.ts +4 -10
- package/dist/modules/Rules/index.js +63 -12
- package/dist/modules/Rules/types.d.ts +12 -2
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +1365 -911
- package/dist/server/modules/order/index.d.ts +32 -7
- package/dist/server/modules/order/index.js +551 -464
- package/dist/server/modules/order/types.d.ts +4 -0
- package/dist/server/modules/products/index.d.ts +5 -1
- package/dist/server/modules/products/index.js +384 -315
- package/dist/server/modules/products/types.d.ts +4 -0
- package/dist/solution/BaseSales/index.d.ts +42 -2
- package/dist/solution/BaseSales/index.js +1416 -775
- package/dist/solution/BaseSales/types.d.ts +7 -1
- package/dist/solution/BaseSales/types.js +3 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -7
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +20 -4
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -0
- package/dist/solution/BookingTicket/index.js +212 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +10 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +20 -1
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -2
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -1
- 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 +45 -2
- package/lib/modules/Order/index.js +720 -116
- package/lib/modules/Order/types.d.ts +36 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +8 -3
- package/lib/modules/Order/utils.js +104 -18
- package/lib/modules/Rules/index.d.ts +4 -10
- package/lib/modules/Rules/index.js +61 -9
- package/lib/modules/Rules/types.d.ts +12 -2
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/server/index.d.ts +8 -0
- package/lib/server/index.js +336 -11
- package/lib/server/modules/order/index.d.ts +32 -7
- package/lib/server/modules/order/index.js +298 -189
- package/lib/server/modules/order/types.d.ts +4 -0
- package/lib/server/modules/products/index.d.ts +5 -1
- package/lib/server/modules/products/index.js +21 -0
- package/lib/server/modules/products/types.d.ts +4 -0
- package/lib/solution/BaseSales/index.d.ts +42 -2
- package/lib/solution/BaseSales/index.js +535 -108
- package/lib/solution/BaseSales/types.d.ts +7 -1
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +13 -1
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -0
- package/lib/solution/BookingTicket/index.js +134 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- 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
|
/**
|
|
@@ -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 会获取所有详细信息并缓存
|
|
@@ -204,6 +204,10 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
204
204
|
* 获取商品列表(深拷贝,供外部安全使用)
|
|
205
205
|
*/
|
|
206
206
|
getProducts(): Promise<ProductData[]>;
|
|
207
|
+
/**
|
|
208
|
+
* 批量获取商品轻量快照,供订单详情等响应补齐展示协议字段。
|
|
209
|
+
*/
|
|
210
|
+
getProductSnapshotsByIds(ids: number[]): Promise<Record<string, ProductSnapshot>>;
|
|
207
211
|
/**
|
|
208
212
|
* 内部获取商品列表的直接引用(无拷贝)
|
|
209
213
|
* 仅供内部 formatter 流程使用,因为 formatter 会创建新对象
|
|
@@ -693,6 +693,7 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
693
693
|
channel: strategyContext.channel,
|
|
694
694
|
orderType: strategyContext.orderType || strategyContext.order_type,
|
|
695
695
|
businessCode: strategyContext.business_code ?? strategyContext.businessCode,
|
|
696
|
+
availableWalletIds: strategyContext.available_wallet_ids,
|
|
696
697
|
custom: strategyContext
|
|
697
698
|
};
|
|
698
699
|
const result = evaluator.resolveProducts(businessData);
|
|
@@ -934,6 +935,26 @@ var ProductsModule = class extends import_BaseModule.BaseModule {
|
|
|
934
935
|
(0, import_product.perfMark)("ProductsModule.getProducts(structuredClone)", performance.now() - t0, { count: result.length });
|
|
935
936
|
return result;
|
|
936
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
|
+
}
|
|
937
958
|
/**
|
|
938
959
|
* 内部获取商品列表的直接引用(无拷贝)
|
|
939
960
|
* 仅供内部 formatter 流程使用,因为 formatter 会创建新对象
|
|
@@ -30,7 +30,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
30
30
|
protected defaultVersion: string;
|
|
31
31
|
isSolution: boolean;
|
|
32
32
|
protected initializeOptions: ModuleOptions;
|
|
33
|
-
|
|
33
|
+
protected logger: any;
|
|
34
34
|
protected appPlugin: AppPlugin;
|
|
35
35
|
protected store: BaseSalesState;
|
|
36
36
|
protected otherParams: Record<string, any>;
|
|
@@ -46,6 +46,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
46
46
|
protected hasManualDiscountSelection: boolean;
|
|
47
47
|
private readonly reusedSharedSubModuleNames;
|
|
48
48
|
private paymentMethodsCache;
|
|
49
|
+
private queuedAutoPaymentSync;
|
|
50
|
+
private autoPaymentSyncFlushing;
|
|
51
|
+
private autoPaymentSyncTimer;
|
|
52
|
+
private salesDetailLoadInFlightCount;
|
|
53
|
+
private salesDetailLoadSequence;
|
|
54
|
+
private salesDetailHydrateQueue;
|
|
55
|
+
private serverOrderChangeUnsubscribe;
|
|
56
|
+
private serverOrderChangeHydrateInFlight;
|
|
57
|
+
private queuedServerOrderChanges;
|
|
58
|
+
private serverOrderChangeSyncEnabled;
|
|
49
59
|
constructor(name?: string, version?: string);
|
|
50
60
|
/**
|
|
51
61
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
@@ -66,6 +76,13 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
66
76
|
* 记录错误日志
|
|
67
77
|
*/
|
|
68
78
|
private logError;
|
|
79
|
+
private isCurrentSalesOrderRecord;
|
|
80
|
+
setServerOrderChangeSyncEnabled(enabled: boolean): void;
|
|
81
|
+
private queueLatestServerOrderChange;
|
|
82
|
+
private drainQueuedServerOrderChanges;
|
|
83
|
+
private syncCurrentSalesDetailFromServerOrderChange;
|
|
84
|
+
private registerServerOrderChangeSync;
|
|
85
|
+
private hydrateLatestLoadedSalesDetail;
|
|
69
86
|
private hydrateOrderPaymentNames;
|
|
70
87
|
get payment(): PaymentModule | undefined;
|
|
71
88
|
private getCurrentOrderCustomerId;
|
|
@@ -176,12 +193,24 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
176
193
|
}): Promise<{
|
|
177
194
|
productList: Record<string, any>[];
|
|
178
195
|
discountList: Discount[];
|
|
196
|
+
availableWalletIds: number[];
|
|
179
197
|
}>;
|
|
198
|
+
getAvailableWalletIds(): number[];
|
|
180
199
|
bestDiscount(cb?: (result: any) => void): Promise<{
|
|
181
200
|
productList: Record<string, any>[];
|
|
182
201
|
discountList: Discount[];
|
|
183
202
|
}>;
|
|
184
203
|
getDiscountList(): Discount[];
|
|
204
|
+
/** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
|
|
205
|
+
getOriginalDiscountList(): Discount[];
|
|
206
|
+
/**
|
|
207
|
+
* 同步写入 Discount 模块的 discountList / originalDiscountList。
|
|
208
|
+
* 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
|
|
209
|
+
*/
|
|
210
|
+
replaceDiscountStoreLists(params: {
|
|
211
|
+
discountList: Discount[];
|
|
212
|
+
originalDiscountList?: Discount[];
|
|
213
|
+
}): Promise<void>;
|
|
185
214
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
186
215
|
setDiscountSelected(params: {
|
|
187
216
|
discountId: number;
|
|
@@ -195,6 +224,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
195
224
|
payments?: OrderPaymentSource[];
|
|
196
225
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
197
226
|
smallTicketDataFlag?: number;
|
|
227
|
+
confirmPendingVoucherPayments?: boolean;
|
|
198
228
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
199
229
|
}): Promise<T>;
|
|
200
230
|
/**
|
|
@@ -207,12 +237,14 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
207
237
|
payments?: OrderPaymentSource[];
|
|
208
238
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
209
239
|
smallTicketDataFlag?: number;
|
|
240
|
+
confirmPendingVoucherPayments?: boolean;
|
|
210
241
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
211
242
|
}): Promise<T>;
|
|
212
243
|
submitTempOrderAsync<T = any>(params?: {
|
|
213
244
|
payments?: OrderPaymentSource[];
|
|
214
245
|
paymentStatus?: BaseSalesPaymentStatus;
|
|
215
246
|
smallTicketDataFlag?: number;
|
|
247
|
+
confirmPendingVoucherPayments?: boolean;
|
|
216
248
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
217
249
|
}): Promise<T>;
|
|
218
250
|
printLocalOrderReceipt<T = any>(lookup?: BaseSalesPrintLocalOrderReceiptParams): Promise<T>;
|
|
@@ -222,6 +254,10 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
222
254
|
getOrderPayments(): OrderPaymentData[];
|
|
223
255
|
/** 覆盖当前订单支付项,内部由 OrderModule 清洗为 Sales 协议字段。 */
|
|
224
256
|
setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
|
|
257
|
+
private getPaymentStatusForSync;
|
|
258
|
+
private queueLatestAutoPaymentSync;
|
|
259
|
+
private scheduleQueuedAutoPaymentSyncFlush;
|
|
260
|
+
private flushQueuedAutoPaymentSync;
|
|
225
261
|
/** 追加单个支付项到当前订单。 */
|
|
226
262
|
addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
|
|
227
263
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -229,7 +265,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
229
265
|
/** 删除当前订单中的指定支付项。 */
|
|
230
266
|
deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
|
|
231
267
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
232
|
-
updateVoucherOrderPayments(payments: OrderPaymentSource[]
|
|
268
|
+
updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
|
|
269
|
+
status?: 'paid' | 'payment_pending';
|
|
270
|
+
}): OrderPaymentData[];
|
|
271
|
+
confirmPendingVoucherPayments(): OrderPaymentData[];
|
|
272
|
+
discardPendingVoucherPayments(): OrderPaymentData[];
|
|
233
273
|
private getWalletProductList;
|
|
234
274
|
initWalletData(params?: {
|
|
235
275
|
order_wait_pay_amount?: number;
|