@pisell/pisellos 2.2.259 → 2.2.260
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 +49 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +282 -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 +146 -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 +13 -17
- package/dist/modules/Order/index.d.ts +1 -32
- package/dist/modules/Order/index.js +288 -615
- package/dist/modules/Order/types.d.ts +2 -20
- package/dist/modules/Order/utils.d.ts +0 -4
- package/dist/modules/Order/utils.js +28 -114
- package/dist/modules/Product/index.d.ts +1 -1
- 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 +3 -3
- package/dist/modules/Rules/index.js +3 -8
- package/dist/modules/Rules/types.d.ts +1 -2
- package/dist/modules/SalesSummary/index.d.ts +3 -7
- package/dist/modules/SalesSummary/index.js +39 -67
- package/dist/modules/SalesSummary/types.d.ts +0 -1
- package/dist/modules/SalesSummary/utils.js +1 -2
- package/dist/modules/SurchargeList/index.d.ts +4 -6
- package/dist/modules/SurchargeList/index.js +39 -62
- package/dist/modules/SurchargeList/types.d.ts +2 -6
- package/dist/server/index.d.ts +50 -3
- package/dist/server/index.js +1040 -1075
- package/dist/server/modules/order/index.d.ts +3 -22
- package/dist/server/modules/order/index.js +316 -398
- package/dist/server/modules/products/index.d.ts +26 -7
- package/dist/server/modules/products/index.js +166 -76
- package/dist/server/modules/products/types.d.ts +14 -0
- package/dist/solution/BaseSales/index.d.ts +2 -22
- package/dist/solution/BaseSales/index.js +701 -995
- package/dist/solution/BaseSales/types.d.ts +0 -1
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -6
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +0 -8
- package/dist/solution/BookingTicket/index.js +6 -153
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +295 -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 +146 -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 +1 -11
- package/lib/modules/Order/index.d.ts +1 -32
- package/lib/modules/Order/index.js +64 -402
- package/lib/modules/Order/types.d.ts +2 -20
- package/lib/modules/Order/utils.d.ts +0 -4
- package/lib/modules/Order/utils.js +2 -84
- package/lib/modules/Product/index.d.ts +1 -1
- 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 +3 -3
- package/lib/modules/Rules/index.js +3 -4
- package/lib/modules/Rules/types.d.ts +1 -2
- package/lib/modules/SalesSummary/index.d.ts +3 -7
- package/lib/modules/SalesSummary/index.js +11 -28
- package/lib/modules/SalesSummary/types.d.ts +0 -1
- package/lib/modules/SalesSummary/utils.js +0 -2
- package/lib/modules/SurchargeList/index.d.ts +4 -6
- package/lib/modules/SurchargeList/index.js +21 -41
- package/lib/modules/SurchargeList/types.d.ts +2 -6
- package/lib/server/index.d.ts +50 -3
- package/lib/server/index.js +215 -244
- package/lib/server/modules/order/index.d.ts +3 -22
- package/lib/server/modules/order/index.js +53 -103
- package/lib/server/modules/products/index.d.ts +26 -7
- package/lib/server/modules/products/index.js +113 -35
- package/lib/server/modules/products/types.d.ts +14 -0
- package/lib/solution/BaseSales/index.d.ts +2 -22
- package/lib/solution/BaseSales/index.js +60 -246
- package/lib/solution/BaseSales/types.d.ts +0 -1
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +0 -8
- package/lib/solution/BookingTicket/index.js +0 -101
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
- package/dist/modules/Order/utils/bundleDiscountHydration.js +0 -144
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +0 -5
- package/lib/modules/Order/utils/bundleDiscountHydration.js +0 -139
|
@@ -25,17 +25,15 @@ __export(SurchargeList_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(SurchargeList_exports);
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
27
|
__reExport(SurchargeList_exports, require("./types"), module.exports);
|
|
28
|
-
var DEFAULT_SURCHARGE_CHANNEL = "online-store";
|
|
29
28
|
var SurchargeListModule = class extends import_BaseModule.BaseModule {
|
|
30
29
|
constructor(name, version) {
|
|
31
30
|
super(name, version);
|
|
32
31
|
this.defaultName = "surchargeList";
|
|
33
32
|
this.defaultVersion = "1.0.0";
|
|
34
|
-
this.
|
|
35
|
-
this.requestVersion = 0;
|
|
33
|
+
this.loadingPromise = null;
|
|
36
34
|
}
|
|
37
35
|
async initialize(core, options) {
|
|
38
|
-
var _a, _b, _c
|
|
36
|
+
var _a, _b, _c;
|
|
39
37
|
this.core = core;
|
|
40
38
|
this.store = options.store;
|
|
41
39
|
this.request = this.core.getPlugin("request");
|
|
@@ -43,62 +41,44 @@ var SurchargeListModule = class extends import_BaseModule.BaseModule {
|
|
|
43
41
|
(_a = options.initialState) == null ? void 0 : _a.surchargeList
|
|
44
42
|
);
|
|
45
43
|
this.store.surchargeList = hasInitialSurchargeList ? (_b = options.initialState) == null ? void 0 : _b.surchargeList : [];
|
|
46
|
-
this.store.
|
|
47
|
-
this.store.isLoaded = Boolean((_e = options.initialState) == null ? void 0 : _e.isLoaded) || hasInitialSurchargeList;
|
|
44
|
+
this.store.isLoaded = Boolean((_c = options.initialState) == null ? void 0 : _c.isLoaded) || hasInitialSurchargeList;
|
|
48
45
|
if (!this.request) {
|
|
49
46
|
throw new Error("SurchargeListModule 需要 request 插件支持");
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
async getSurchargeList(query) {
|
|
56
|
-
const channel = this.resolveChannel(query);
|
|
57
|
-
if (this.store.isLoaded && this.store.channel === channel) {
|
|
49
|
+
async getSurchargeList() {
|
|
50
|
+
if (this.store.isLoaded)
|
|
58
51
|
return this.store.surchargeList;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const nextPromise = this.loadSurchargeList(channel);
|
|
64
|
-
this.loadingPromises.set(channel, nextPromise);
|
|
65
|
-
return nextPromise;
|
|
52
|
+
if (this.loadingPromise)
|
|
53
|
+
return this.loadingPromise;
|
|
54
|
+
this.loadingPromise = this.loadSurchargeList();
|
|
55
|
+
return this.loadingPromise;
|
|
66
56
|
}
|
|
67
|
-
async refreshSurchargeList(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.loadingPromises.set(channel, nextPromise);
|
|
71
|
-
return nextPromise;
|
|
57
|
+
async refreshSurchargeList() {
|
|
58
|
+
this.loadingPromise = this.loadSurchargeList();
|
|
59
|
+
return this.loadingPromise;
|
|
72
60
|
}
|
|
73
|
-
async loadSurchargeList(
|
|
74
|
-
const currentRequestVersion = ++this.requestVersion;
|
|
61
|
+
async loadSurchargeList() {
|
|
75
62
|
try {
|
|
76
63
|
const surchargeList = await this.request.get(
|
|
77
64
|
"/order/custom-surcharge/available/v2",
|
|
78
65
|
{
|
|
79
|
-
channel,
|
|
66
|
+
channel: "online-store",
|
|
80
67
|
is_assemble_product_data: 1,
|
|
81
68
|
is_assemble_schedule_data: 1,
|
|
82
69
|
with: ["relationSchedule"]
|
|
83
70
|
}
|
|
84
71
|
);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.store.channel = channel;
|
|
89
|
-
this.store.isLoaded = true;
|
|
90
|
-
}
|
|
91
|
-
return nextSurchargeList;
|
|
72
|
+
this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
|
|
73
|
+
this.store.isLoaded = true;
|
|
74
|
+
return this.store.surchargeList;
|
|
92
75
|
} catch (error) {
|
|
93
76
|
console.warn("[SurchargeListModule] 加载附加费配置失败", error);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.store.isLoaded = true;
|
|
98
|
-
}
|
|
99
|
-
return [];
|
|
77
|
+
this.store.surchargeList = [];
|
|
78
|
+
this.store.isLoaded = true;
|
|
79
|
+
return this.store.surchargeList;
|
|
100
80
|
} finally {
|
|
101
|
-
this.
|
|
81
|
+
this.loadingPromise = null;
|
|
102
82
|
}
|
|
103
83
|
}
|
|
104
84
|
};
|
|
@@ -4,12 +4,8 @@ export interface SurchargeListItem {
|
|
|
4
4
|
export interface SurchargeListState {
|
|
5
5
|
surchargeList: SurchargeListItem[];
|
|
6
6
|
isLoaded: boolean;
|
|
7
|
-
channel?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SurchargeListQuery {
|
|
10
|
-
channel?: string;
|
|
11
7
|
}
|
|
12
8
|
export interface SurchargeListModuleAPI {
|
|
13
|
-
getSurchargeList(
|
|
14
|
-
refreshSurchargeList(
|
|
9
|
+
getSurchargeList(): Promise<SurchargeListItem[]>;
|
|
10
|
+
refreshSurchargeList(): Promise<SurchargeListItem[]>;
|
|
15
11
|
}
|
package/lib/server/index.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
+
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
+
private productQueryScheduleTimers;
|
|
50
52
|
private orderQuerySubscribers;
|
|
51
53
|
private bookingQuerySubscribers;
|
|
52
54
|
private bookingRemoteQuerySubscribers;
|
|
@@ -210,6 +212,48 @@ declare class Server {
|
|
|
210
212
|
* 根据 subscriberId 移除商品查询订阅者
|
|
211
213
|
*/
|
|
212
214
|
removeProductQuerySubscriber(subscriberId?: string): void;
|
|
215
|
+
/**
|
|
216
|
+
* 构建商品 query 响应 data 段,附带智能定价 schedule_time_points 元数据。
|
|
217
|
+
*/
|
|
218
|
+
private buildProductQueryResultPayload;
|
|
219
|
+
/**
|
|
220
|
+
* 是否启用商品 query 订阅的 schedule 时间点定时重算。
|
|
221
|
+
* strategy_context.enable_schedule_reload === false 时关闭。
|
|
222
|
+
*/
|
|
223
|
+
private shouldScheduleProductQueryReload;
|
|
224
|
+
/**
|
|
225
|
+
* 清除指定 subscriber 的全部 schedule 定时器,防止重复 query 或 unsubscribe 后泄漏。
|
|
226
|
+
*/
|
|
227
|
+
private clearSubscriberScheduleTimers;
|
|
228
|
+
/**
|
|
229
|
+
* 从 productQueryScheduleTimers 移除已触发的 timer 引用。
|
|
230
|
+
*/
|
|
231
|
+
private removeScheduleTimerRef;
|
|
232
|
+
/**
|
|
233
|
+
* 计算 schedule 变价时间点到当前时刻的延迟(ms)。已过期返回 -1。
|
|
234
|
+
*/
|
|
235
|
+
private computeScheduleTimePointDelayMs;
|
|
236
|
+
/**
|
|
237
|
+
* 定时重算前刷新 subscriber schedule 上下文:使用执行瞬间时间,禁止沿用首次 query 的 schedule_datetime。
|
|
238
|
+
*/
|
|
239
|
+
private refreshSubscriberScheduleAtExecution;
|
|
240
|
+
/**
|
|
241
|
+
* 为 subscriber 注册智能定价 scheduleTimePoints 定时重算。
|
|
242
|
+
* 必须先 clearSubscriberScheduleTimers,再调用本方法。
|
|
243
|
+
*/
|
|
244
|
+
private scheduleSubscriberTimePointReloads;
|
|
245
|
+
/**
|
|
246
|
+
* schedule 变价时间点定时器触发:刷新 schedule_datetime 后重算并 callback。
|
|
247
|
+
*/
|
|
248
|
+
private onScheduleTimePointTimerFire;
|
|
249
|
+
/**
|
|
250
|
+
* 对单个商品 query 订阅者重算并推送(定时路径;不新建 schedule timer)。
|
|
251
|
+
*/
|
|
252
|
+
private recomputeAndNotifySubscriber;
|
|
253
|
+
/**
|
|
254
|
+
* query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
|
|
255
|
+
*/
|
|
256
|
+
private syncProductQueryScheduleTimers;
|
|
213
257
|
/**
|
|
214
258
|
* 处理商品查询请求
|
|
215
259
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -431,9 +475,6 @@ declare class Server {
|
|
|
431
475
|
private shouldLookupLocalPrintOrder;
|
|
432
476
|
private getLocalPrintOrderLookup;
|
|
433
477
|
private handleLocalPrintOrder;
|
|
434
|
-
private handleMachinecodeBatchMeta;
|
|
435
|
-
private resolveMachinecodeBatchMetadataLookup;
|
|
436
|
-
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
437
478
|
private handleOrderCheckoutSubmit;
|
|
438
479
|
private handleSyncCheckoutSubmit;
|
|
439
480
|
private handlePendingSyncCheckoutOrder;
|
|
@@ -565,6 +606,12 @@ declare class Server {
|
|
|
565
606
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
566
607
|
*/
|
|
567
608
|
private computeProductQueryResult;
|
|
609
|
+
/**
|
|
610
|
+
* 构建商品格式化上下文。
|
|
611
|
+
*
|
|
612
|
+
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
613
|
+
*/
|
|
614
|
+
private buildProductFormatterContext;
|
|
568
615
|
/**
|
|
569
616
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
570
617
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|