@pisell/pisellos 2.2.260 → 2.2.261
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/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
- package/dist/modules/Order/index.d.ts +33 -2
- package/dist/modules/Order/index.js +615 -288
- package/dist/modules/Order/types.d.ts +20 -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.d.ts +4 -0
- package/dist/modules/Order/utils.js +116 -29
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/modules/Rules/index.d.ts +4 -3
- package/dist/modules/Rules/index.js +42 -17
- package/dist/modules/Rules/types.d.ts +2 -1
- 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 +3 -50
- package/dist/server/index.js +1075 -1040
- package/dist/server/modules/order/index.d.ts +22 -3
- package/dist/server/modules/order/index.js +398 -316
- package/dist/server/modules/products/index.d.ts +7 -26
- package/dist/server/modules/products/index.js +76 -166
- package/dist/server/modules/products/types.d.ts +0 -14
- package/dist/solution/BaseSales/index.d.ts +22 -2
- package/dist/solution/BaseSales/index.js +995 -701
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +74 -29
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -1
- package/dist/solution/BookingTicket/index.js +153 -6
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/VenueBooking/index.js +30 -19
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
- package/lib/modules/Order/index.d.ts +33 -2
- package/lib/modules/Order/index.js +402 -64
- package/lib/modules/Order/types.d.ts +20 -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.d.ts +4 -0
- package/lib/modules/Order/utils.js +90 -3
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/modules/Rules/index.d.ts +4 -3
- package/lib/modules/Rules/index.js +27 -7
- package/lib/modules/Rules/types.d.ts +2 -1
- 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 +3 -50
- package/lib/server/index.js +244 -215
- package/lib/server/modules/order/index.d.ts +22 -3
- package/lib/server/modules/order/index.js +103 -53
- package/lib/server/modules/products/index.d.ts +7 -26
- package/lib/server/modules/products/index.js +35 -113
- package/lib/server/modules/products/types.d.ts +0 -14
- package/lib/solution/BaseSales/index.d.ts +22 -2
- package/lib/solution/BaseSales/index.js +246 -60
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +59 -16
- 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 +9 -1
- package/lib/solution/BookingTicket/index.js +101 -0
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/VenueBooking/index.js +8 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -152
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -755
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -282
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -146
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -139
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -564
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -295
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -146
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
|
@@ -9,16 +9,19 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
9
9
|
private store;
|
|
10
10
|
private request;
|
|
11
11
|
private surchargeListModuleName;
|
|
12
|
+
private otherParams;
|
|
13
|
+
private surchargeListChannel;
|
|
12
14
|
constructor(name?: string, version?: string);
|
|
13
15
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
16
|
/**
|
|
15
|
-
* 更新父级解决方案透传的运行态参数,并在 surcharge
|
|
17
|
+
* 更新父级解决方案透传的运行态参数,并在 surcharge 模块名或渠道变化时刷新附加费列表。
|
|
16
18
|
*
|
|
17
19
|
* @example
|
|
18
|
-
* await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
|
|
20
|
+
* await salesSummaryModule.updateOtherParams({ channel: 'pos', surchargeListModuleName: 'custom_surchargeList' });
|
|
19
21
|
*/
|
|
20
22
|
updateOtherParams(params: Record<string, any>): Promise<void>;
|
|
21
|
-
|
|
23
|
+
private resolveChannel;
|
|
24
|
+
getSurchargeList(channel?: string): Promise<void>;
|
|
22
25
|
private getAppData;
|
|
23
26
|
private getTaxConfig;
|
|
24
27
|
getSummary(params: {
|
|
@@ -26,6 +29,7 @@ export declare class SalesSummaryModule extends BaseModule implements Module, Sa
|
|
|
26
29
|
isPriceIncludeTax?: number;
|
|
27
30
|
taxRate?: number;
|
|
28
31
|
shopDiscount?: string | number;
|
|
32
|
+
channel?: string;
|
|
29
33
|
}): Promise<{
|
|
30
34
|
tax_title: string;
|
|
31
35
|
tax_rate: number | undefined;
|
|
@@ -33,12 +33,15 @@ var salesSummaryDataKeys = {
|
|
|
33
33
|
taxTitle: "tax_title",
|
|
34
34
|
taxCountryCode: "tax_country_code"
|
|
35
35
|
};
|
|
36
|
+
var DEFAULT_SURCHARGE_CHANNEL = "online-store";
|
|
36
37
|
var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
37
38
|
constructor(name, version) {
|
|
38
39
|
super(name, version);
|
|
39
40
|
this.defaultName = "salesSummary";
|
|
40
41
|
this.defaultVersion = "1.0.0";
|
|
41
42
|
this.surchargeListModuleName = "surchargeList";
|
|
43
|
+
this.otherParams = {};
|
|
44
|
+
this.surchargeListChannel = DEFAULT_SURCHARGE_CHANNEL;
|
|
42
45
|
}
|
|
43
46
|
async initialize(core, options) {
|
|
44
47
|
var _a, _b, _c;
|
|
@@ -46,9 +49,10 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
46
49
|
this.store = options.store;
|
|
47
50
|
this.appPlugin = this.core.getPlugin("app");
|
|
48
51
|
this.request = this.core.getPlugin("request");
|
|
52
|
+
this.otherParams = options.otherParams || {};
|
|
49
53
|
this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
|
|
50
54
|
this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
|
|
51
|
-
this.surchargeListModuleName = ((_c =
|
|
55
|
+
this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
|
|
52
56
|
if (!this.appPlugin) {
|
|
53
57
|
throw new Error("SalesSummaryModule 需要 app 插件支持");
|
|
54
58
|
}
|
|
@@ -58,41 +62,50 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
58
62
|
await this.getSurchargeList();
|
|
59
63
|
}
|
|
60
64
|
/**
|
|
61
|
-
* 更新父级解决方案透传的运行态参数,并在 surcharge
|
|
65
|
+
* 更新父级解决方案透传的运行态参数,并在 surcharge 模块名或渠道变化时刷新附加费列表。
|
|
62
66
|
*
|
|
63
67
|
* @example
|
|
64
|
-
* await salesSummaryModule.updateOtherParams({ surchargeListModuleName: 'custom_surchargeList' });
|
|
68
|
+
* await salesSummaryModule.updateOtherParams({ channel: 'pos', surchargeListModuleName: 'custom_surchargeList' });
|
|
65
69
|
*/
|
|
66
70
|
async updateOtherParams(params) {
|
|
71
|
+
const previousChannel = this.resolveChannel();
|
|
67
72
|
const nextSurchargeListModuleName = (params == null ? void 0 : params.surchargeListModuleName) || "surchargeList";
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
const nextChannel = this.resolveChannel(params);
|
|
74
|
+
const shouldReload = nextSurchargeListModuleName !== this.surchargeListModuleName || nextChannel !== previousChannel;
|
|
75
|
+
this.otherParams = params || {};
|
|
70
76
|
this.surchargeListModuleName = nextSurchargeListModuleName;
|
|
71
|
-
|
|
77
|
+
if (shouldReload) {
|
|
78
|
+
await this.getSurchargeList(nextChannel);
|
|
79
|
+
}
|
|
72
80
|
}
|
|
73
|
-
|
|
81
|
+
resolveChannel(params = this.otherParams) {
|
|
82
|
+
return (params == null ? void 0 : params.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
83
|
+
}
|
|
84
|
+
async getSurchargeList(channel = this.resolveChannel()) {
|
|
74
85
|
try {
|
|
75
86
|
const surchargeListModule = this.core.getModule(
|
|
76
87
|
this.surchargeListModuleName
|
|
77
88
|
);
|
|
78
89
|
if (surchargeListModule == null ? void 0 : surchargeListModule.getSurchargeList) {
|
|
79
|
-
this.store.surchargeList = await surchargeListModule.getSurchargeList();
|
|
90
|
+
this.store.surchargeList = await surchargeListModule.getSurchargeList({ channel });
|
|
91
|
+
this.surchargeListChannel = channel;
|
|
80
92
|
return;
|
|
81
93
|
}
|
|
82
94
|
const surchargeList = await this.request.get(
|
|
83
95
|
"/order/custom-surcharge/available/v2",
|
|
84
96
|
{
|
|
85
|
-
|
|
86
|
-
channel: "online-store",
|
|
97
|
+
channel,
|
|
87
98
|
is_assemble_product_data: 1,
|
|
88
99
|
is_assemble_schedule_data: 1,
|
|
89
100
|
with: ["relationSchedule"]
|
|
90
101
|
}
|
|
91
102
|
);
|
|
92
103
|
this.store.surchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
|
|
104
|
+
this.surchargeListChannel = channel;
|
|
93
105
|
} catch (error) {
|
|
94
106
|
console.warn("[SalesSummaryModule] 加载附加费配置失败", error);
|
|
95
107
|
this.store.surchargeList = [];
|
|
108
|
+
this.surchargeListChannel = channel;
|
|
96
109
|
}
|
|
97
110
|
}
|
|
98
111
|
getAppData(key) {
|
|
@@ -114,7 +127,11 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
114
127
|
}
|
|
115
128
|
async getSummary(params) {
|
|
116
129
|
var _a, _b;
|
|
117
|
-
const { products = [], isPriceIncludeTax, taxRate, shopDiscount } = params;
|
|
130
|
+
const { products = [], isPriceIncludeTax, taxRate, shopDiscount, channel } = params;
|
|
131
|
+
const summaryChannel = channel || this.resolveChannel();
|
|
132
|
+
if (summaryChannel !== this.surchargeListChannel) {
|
|
133
|
+
await this.getSurchargeList(summaryChannel);
|
|
134
|
+
}
|
|
118
135
|
const taxConfig = this.getTaxConfig();
|
|
119
136
|
const summarySchedule = this.core.getModule(
|
|
120
137
|
`${this.name.split("_")[0]}_schedule`
|
|
@@ -308,6 +308,8 @@ function getFallbackAllProductSurchargeIds(surchargeList) {
|
|
|
308
308
|
return ids;
|
|
309
309
|
if (Number(config.is_all ?? 0) !== 1)
|
|
310
310
|
return ids;
|
|
311
|
+
if (Number(config.open_schedule ?? 0) === 1 && config.schedule_type !== "all")
|
|
312
|
+
return ids;
|
|
311
313
|
ids.push(id);
|
|
312
314
|
return ids;
|
|
313
315
|
}, []);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { SurchargeListItem, SurchargeListModuleAPI } from './types';
|
|
3
|
+
import { SurchargeListItem, SurchargeListModuleAPI, SurchargeListQuery } from './types';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export declare class SurchargeListModule extends BaseModule implements Module, SurchargeListModuleAPI {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
8
8
|
private request;
|
|
9
9
|
private store;
|
|
10
|
-
private
|
|
10
|
+
private loadingPromises;
|
|
11
|
+
private requestVersion;
|
|
11
12
|
constructor(name?: string, version?: string);
|
|
12
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
private resolveChannel;
|
|
15
|
+
getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
16
|
+
refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
15
17
|
private loadSurchargeList;
|
|
16
18
|
}
|
|
@@ -25,15 +25,17 @@ __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";
|
|
28
29
|
var SurchargeListModule = class extends import_BaseModule.BaseModule {
|
|
29
30
|
constructor(name, version) {
|
|
30
31
|
super(name, version);
|
|
31
32
|
this.defaultName = "surchargeList";
|
|
32
33
|
this.defaultVersion = "1.0.0";
|
|
33
|
-
this.
|
|
34
|
+
this.loadingPromises = /* @__PURE__ */ new Map();
|
|
35
|
+
this.requestVersion = 0;
|
|
34
36
|
}
|
|
35
37
|
async initialize(core, options) {
|
|
36
|
-
var _a, _b, _c;
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
37
39
|
this.core = core;
|
|
38
40
|
this.store = options.store;
|
|
39
41
|
this.request = this.core.getPlugin("request");
|
|
@@ -41,44 +43,62 @@ var SurchargeListModule = class extends import_BaseModule.BaseModule {
|
|
|
41
43
|
(_a = options.initialState) == null ? void 0 : _a.surchargeList
|
|
42
44
|
);
|
|
43
45
|
this.store.surchargeList = hasInitialSurchargeList ? (_b = options.initialState) == null ? void 0 : _b.surchargeList : [];
|
|
44
|
-
this.store.
|
|
46
|
+
this.store.channel = ((_c = options.initialState) == null ? void 0 : _c.channel) || ((_d = options.otherParams) == null ? void 0 : _d.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
47
|
+
this.store.isLoaded = Boolean((_e = options.initialState) == null ? void 0 : _e.isLoaded) || hasInitialSurchargeList;
|
|
45
48
|
if (!this.request) {
|
|
46
49
|
throw new Error("SurchargeListModule 需要 request 插件支持");
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
resolveChannel(query) {
|
|
53
|
+
return (query == null ? void 0 : query.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
54
|
+
}
|
|
55
|
+
async getSurchargeList(query) {
|
|
56
|
+
const channel = this.resolveChannel(query);
|
|
57
|
+
if (this.store.isLoaded && this.store.channel === channel) {
|
|
51
58
|
return this.store.surchargeList;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
}
|
|
60
|
+
const loadingPromise = this.loadingPromises.get(channel);
|
|
61
|
+
if (loadingPromise)
|
|
62
|
+
return loadingPromise;
|
|
63
|
+
const nextPromise = this.loadSurchargeList(channel);
|
|
64
|
+
this.loadingPromises.set(channel, nextPromise);
|
|
65
|
+
return nextPromise;
|
|
56
66
|
}
|
|
57
|
-
async refreshSurchargeList() {
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
async refreshSurchargeList(query) {
|
|
68
|
+
const channel = this.resolveChannel(query);
|
|
69
|
+
const nextPromise = this.loadSurchargeList(channel);
|
|
70
|
+
this.loadingPromises.set(channel, nextPromise);
|
|
71
|
+
return nextPromise;
|
|
60
72
|
}
|
|
61
|
-
async loadSurchargeList() {
|
|
73
|
+
async loadSurchargeList(channel) {
|
|
74
|
+
const currentRequestVersion = ++this.requestVersion;
|
|
62
75
|
try {
|
|
63
76
|
const surchargeList = await this.request.get(
|
|
64
77
|
"/order/custom-surcharge/available/v2",
|
|
65
78
|
{
|
|
66
|
-
channel
|
|
79
|
+
channel,
|
|
67
80
|
is_assemble_product_data: 1,
|
|
68
81
|
is_assemble_schedule_data: 1,
|
|
69
82
|
with: ["relationSchedule"]
|
|
70
83
|
}
|
|
71
84
|
);
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
|
|
85
|
+
const nextSurchargeList = (surchargeList == null ? void 0 : surchargeList.data) || [];
|
|
86
|
+
if (currentRequestVersion === this.requestVersion) {
|
|
87
|
+
this.store.surchargeList = nextSurchargeList;
|
|
88
|
+
this.store.channel = channel;
|
|
89
|
+
this.store.isLoaded = true;
|
|
90
|
+
}
|
|
91
|
+
return nextSurchargeList;
|
|
75
92
|
} catch (error) {
|
|
76
93
|
console.warn("[SurchargeListModule] 加载附加费配置失败", error);
|
|
77
|
-
this.
|
|
78
|
-
|
|
79
|
-
|
|
94
|
+
if (currentRequestVersion === this.requestVersion) {
|
|
95
|
+
this.store.surchargeList = [];
|
|
96
|
+
this.store.channel = channel;
|
|
97
|
+
this.store.isLoaded = true;
|
|
98
|
+
}
|
|
99
|
+
return [];
|
|
80
100
|
} finally {
|
|
81
|
-
this.
|
|
101
|
+
this.loadingPromises.delete(channel);
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
};
|
|
@@ -4,8 +4,12 @@ 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;
|
|
7
11
|
}
|
|
8
12
|
export interface SurchargeListModuleAPI {
|
|
9
|
-
getSurchargeList(): Promise<SurchargeListItem[]>;
|
|
10
|
-
refreshSurchargeList(): Promise<SurchargeListItem[]>;
|
|
13
|
+
getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
14
|
+
refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
11
15
|
}
|
package/lib/server/index.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ declare class Server {
|
|
|
47
47
|
private prefixRouterGet;
|
|
48
48
|
router: Router;
|
|
49
49
|
private productQuerySubscribers;
|
|
50
|
-
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
|
-
private productQueryScheduleTimers;
|
|
52
50
|
private orderQuerySubscribers;
|
|
53
51
|
private bookingQuerySubscribers;
|
|
54
52
|
private bookingRemoteQuerySubscribers;
|
|
@@ -212,48 +210,6 @@ declare class Server {
|
|
|
212
210
|
* 根据 subscriberId 移除商品查询订阅者
|
|
213
211
|
*/
|
|
214
212
|
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;
|
|
257
213
|
/**
|
|
258
214
|
* 处理商品查询请求
|
|
259
215
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
@@ -475,6 +431,9 @@ declare class Server {
|
|
|
475
431
|
private shouldLookupLocalPrintOrder;
|
|
476
432
|
private getLocalPrintOrderLookup;
|
|
477
433
|
private handleLocalPrintOrder;
|
|
434
|
+
private handleMachinecodeBatchMeta;
|
|
435
|
+
private resolveMachinecodeBatchMetadataLookup;
|
|
436
|
+
private syncMachinecodeRedeemStatusToLocalOrder;
|
|
478
437
|
private handleOrderCheckoutSubmit;
|
|
479
438
|
private handleSyncCheckoutSubmit;
|
|
480
439
|
private handlePendingSyncCheckoutOrder;
|
|
@@ -606,12 +565,6 @@ declare class Server {
|
|
|
606
565
|
* @param options.changedIds 变更的商品 IDs,用于增量更新价格缓存
|
|
607
566
|
*/
|
|
608
567
|
private computeProductQueryResult;
|
|
609
|
-
/**
|
|
610
|
-
* 构建商品格式化上下文。
|
|
611
|
-
*
|
|
612
|
-
* 智能定价条件使用全量 menuList/scheduleList;Product Query 顶层参数只保留筛选商品集合所需字段。
|
|
613
|
-
*/
|
|
614
|
-
private buildProductFormatterContext;
|
|
615
568
|
/**
|
|
616
569
|
* 数据变更后,遍历所有订阅者重新计算查询结果并通过 callback 推送
|
|
617
570
|
* 由 ProductsModule 的 onProductsSyncCompleted 事件触发
|