@pisell/pisellos 2.3.43 → 2.3.45
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/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +2 -3
- package/dist/modules/Order/index.js +98 -82
- package/dist/modules/Order/types.d.ts +2 -9
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Payment/walletpass.d.ts +10 -3
- package/dist/modules/Payment/walletpass.js +425 -282
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +72 -102
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +657 -772
- package/dist/solution/BaseSales/index.d.ts +0 -7
- package/dist/solution/BaseSales/index.js +48 -67
- package/dist/solution/BaseSales/types.d.ts +3 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +1 -13
- package/dist/solution/BookingTicket/index.js +8 -5
- package/dist/solution/BookingTicket/types.d.ts +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +3 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +12 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +2 -3
- package/lib/modules/Order/index.js +56 -33
- package/lib/modules/Order/types.d.ts +2 -9
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Payment/walletpass.d.ts +10 -3
- package/lib/modules/Payment/walletpass.js +218 -56
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +24 -36
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +5 -65
- package/lib/solution/BaseSales/index.d.ts +0 -7
- package/lib/solution/BaseSales/index.js +9 -24
- package/lib/solution/BaseSales/types.d.ts +3 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +1 -13
- package/lib/solution/BookingTicket/index.js +3 -10
- package/lib/solution/BookingTicket/types.d.ts +1 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -2
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +12 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -53,6 +53,9 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
53
53
|
this.store.surchargeList = ((_a = options.initialState) == null ? void 0 : _a.surchargeList) || [];
|
|
54
54
|
this.store.summary = ((_b = options.initialState) == null ? void 0 : _b.summary) || (0, import_utils.createEmptySalesSummary)();
|
|
55
55
|
this.surchargeListModuleName = ((_c = this.otherParams) == null ? void 0 : _c.surchargeListModuleName) || "surchargeList";
|
|
56
|
+
if (!this.appPlugin) {
|
|
57
|
+
throw new Error("SalesSummaryModule 需要 app 插件支持");
|
|
58
|
+
}
|
|
56
59
|
if (!this.request) {
|
|
57
60
|
throw new Error("SalesSummaryModule 需要 request 插件支持");
|
|
58
61
|
}
|
|
@@ -106,14 +109,12 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
getAppData(key) {
|
|
109
|
-
var _a, _b, _c, _d, _e, _f
|
|
110
|
-
const getData = (_b = (_a = this.appPlugin)
|
|
112
|
+
var _a, _b, _c, _d, _e, _f;
|
|
113
|
+
const getData = (_b = (_a = this.appPlugin).getData) == null ? void 0 : _b.call(_a);
|
|
111
114
|
if (typeof getData === "function")
|
|
112
115
|
return getData(key);
|
|
113
|
-
const app =
|
|
114
|
-
|
|
115
|
-
return void 0;
|
|
116
|
-
const coreData = (_h = (_f = (_e = app == null ? void 0 : app.models) == null ? void 0 : _e.getStore) == null ? void 0 : (_g = _f.call(_e)).getDataByModel) == null ? void 0 : _h.call(_g, "core", "core");
|
|
116
|
+
const app = this.appPlugin.getApp();
|
|
117
|
+
const coreData = (_f = (_d = (_c = app == null ? void 0 : app.models) == null ? void 0 : _c.getStore) == null ? void 0 : (_e = _d.call(_c)).getDataByModel) == null ? void 0 : _f.call(_e, "core", "core");
|
|
117
118
|
return coreData == null ? void 0 : coreData[key];
|
|
118
119
|
}
|
|
119
120
|
getTaxConfig() {
|
|
@@ -11,12 +11,10 @@ export declare class ScanOrderLoggerModule extends BaseModule implements Module,
|
|
|
11
11
|
protected defaultName: string;
|
|
12
12
|
protected defaultVersion: string;
|
|
13
13
|
private store;
|
|
14
|
-
private window?;
|
|
15
14
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
16
15
|
setContext(context: ScanOrderLoggerContext): void;
|
|
17
16
|
setProvider(provider: ScanOrderLoggerProviderType): void;
|
|
18
17
|
setProviderConfig(providerConfig: ScanOrderLoggerProviderConfig): void;
|
|
19
|
-
private getCurrentHost;
|
|
20
18
|
private buildRecord;
|
|
21
19
|
addLog(params: ScanOrderLogInput): Promise<void>;
|
|
22
20
|
}
|
|
@@ -60,7 +60,6 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
|
|
|
60
60
|
var _a, _b, _c;
|
|
61
61
|
this.core = core;
|
|
62
62
|
this.store = options.store;
|
|
63
|
-
this.window = core.getPlugin("window") || void 0;
|
|
64
63
|
const provider = ((_a = options.otherParams) == null ? void 0 : _a.provider) || "feishu";
|
|
65
64
|
const providerConfig = ((_b = options.otherParams) == null ? void 0 : _b.providerConfig) || {};
|
|
66
65
|
const context = ((_c = options.otherParams) == null ? void 0 : _c.context) || {};
|
|
@@ -102,25 +101,14 @@ var ScanOrderLoggerModule = class extends import_BaseModule.BaseModule {
|
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
|
-
getCurrentHost() {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
const host = (_b = (_a = this.window) == null ? void 0 : _a.location) == null ? void 0 : _b.host;
|
|
108
|
-
if (typeof host === "string" && host.length > 0)
|
|
109
|
-
return host;
|
|
110
|
-
return void 0;
|
|
111
|
-
}
|
|
112
104
|
buildRecord(params) {
|
|
113
|
-
const host = this.getCurrentHost();
|
|
114
105
|
return {
|
|
115
106
|
level: params.level || "info",
|
|
116
107
|
title: params.title,
|
|
117
108
|
timestamp: params.timestamp || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss"),
|
|
118
109
|
payload: params.payload || {},
|
|
119
110
|
extra: params.extra || {},
|
|
120
|
-
context: {
|
|
121
|
-
...this.store.context || {},
|
|
122
|
-
...host ? { host } : {}
|
|
123
|
-
}
|
|
111
|
+
context: this.store.context || {}
|
|
124
112
|
};
|
|
125
113
|
}
|
|
126
114
|
async addLog(params) {
|
|
@@ -112,29 +112,20 @@ async function flushQueue() {
|
|
|
112
112
|
}
|
|
113
113
|
var feishuLoggerProvider = {
|
|
114
114
|
async send(payload) {
|
|
115
|
-
var _a, _b, _c, _d
|
|
115
|
+
var _a, _b, _c, _d;
|
|
116
116
|
cachedProviderConfig = payload.providerConfig;
|
|
117
117
|
const webhook = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.feishu) == null ? void 0 : _b.webhook;
|
|
118
|
-
const errorHook = (_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.errorHook;
|
|
119
|
-
if (typeof fetch !== "function") {
|
|
120
|
-
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (payload.record.level === "error" && isWebhookUsable(errorHook)) {
|
|
124
|
-
try {
|
|
125
|
-
await postToFeishu(errorHook, buildFeishuBody([payload.record]));
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.warn("[ScanOrderLogger] Feishu errorHook 上报失败", error);
|
|
128
|
-
}
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
118
|
if (!webhook) {
|
|
132
119
|
console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
|
|
133
120
|
return;
|
|
134
121
|
}
|
|
135
122
|
if (!isWebhookUsable(webhook))
|
|
136
123
|
return;
|
|
137
|
-
|
|
124
|
+
if (typeof fetch !== "function") {
|
|
125
|
+
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志上报");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const throttleMs = ((_d = (_c = payload.providerConfig) == null ? void 0 : _c.feishu) == null ? void 0 : _d.throttleMs) ?? DEFAULT_THROTTLE_MS;
|
|
138
129
|
if (throttleMs <= 0) {
|
|
139
130
|
try {
|
|
140
131
|
await postToFeishu(webhook, buildFeishuBody([payload.record]));
|
|
@@ -2,7 +2,6 @@ export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
|
2
2
|
export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
|
|
3
3
|
export interface ScanOrderLoggerProviderFeishuConfig {
|
|
4
4
|
webhook?: string;
|
|
5
|
-
errorHook?: string;
|
|
6
5
|
/**
|
|
7
6
|
* 节流窗口毫秒数,默认 3000ms
|
|
8
7
|
* - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
|
|
@@ -24,9 +24,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
24
24
|
*
|
|
25
25
|
* @memberof ScheduleModule
|
|
26
26
|
*/
|
|
27
|
-
loadAllSchedule(
|
|
28
|
-
useCache?: boolean;
|
|
29
|
-
}): Promise<void>;
|
|
27
|
+
loadAllSchedule(): Promise<void>;
|
|
30
28
|
setScheduleList(list: ScheduleItem[]): void;
|
|
31
29
|
private syncScheduleMap;
|
|
32
30
|
getScheduleList(): ScheduleItem[];
|
|
@@ -95,12 +95,12 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
*
|
|
96
96
|
* @memberof ScheduleModule
|
|
97
97
|
*/
|
|
98
|
-
async loadAllSchedule(
|
|
98
|
+
async loadAllSchedule() {
|
|
99
99
|
var _a;
|
|
100
100
|
const scheduleList = await this.request.get(
|
|
101
101
|
`/schedule`,
|
|
102
102
|
{ num: 999 },
|
|
103
|
-
{ useCache:
|
|
103
|
+
{ useCache: true }
|
|
104
104
|
);
|
|
105
105
|
this.setScheduleList(((_a = scheduleList.data) == null ? void 0 : _a.list) || []);
|
|
106
106
|
}
|
|
@@ -126,6 +126,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
126
126
|
custom_page_id,
|
|
127
127
|
channel
|
|
128
128
|
}) {
|
|
129
|
+
var _a, _b, _c;
|
|
129
130
|
if ((0, import_dayjs.default)(startDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
130
131
|
startDate = (0, import_dayjs.default)().format("YYYY-MM-DD");
|
|
131
132
|
}
|
|
@@ -143,20 +144,17 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
143
144
|
channel
|
|
144
145
|
}
|
|
145
146
|
);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
this.setAvailabilityScheduleDateList(dateList);
|
|
150
|
-
this.setOtherProductsIds(otherProductIds);
|
|
151
|
-
if (!dateList.length && !otherProductIds.length || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
147
|
+
this.setAvailabilityScheduleDateList(res.data.date_list);
|
|
148
|
+
this.setOtherProductsIds(res.data.other_product_ids || []);
|
|
149
|
+
if (!((_a = res.data.date_list) == null ? void 0 : _a.length) && !((_b = res.data.other_product_ids) == null ? void 0 : _b.length) || (0, import_dayjs.default)(endDate).isBefore((0, import_dayjs.default)(), "day")) {
|
|
152
150
|
return dates;
|
|
153
151
|
}
|
|
154
|
-
if (
|
|
152
|
+
if ((_c = res.data.other_product_ids) == null ? void 0 : _c.length) {
|
|
155
153
|
dates.forEach((n) => {
|
|
156
154
|
n.status = "available";
|
|
157
155
|
});
|
|
158
156
|
} else {
|
|
159
|
-
|
|
157
|
+
res.data.date_list.forEach((n) => {
|
|
160
158
|
const index = dates.findIndex((m) => m.date === n.date);
|
|
161
159
|
if (index !== -1) {
|
|
162
160
|
dates[index].status = "available";
|
|
@@ -437,31 +437,11 @@ var getBundleItemIsDiscountPrice = (item) => {
|
|
|
437
437
|
var getBundleItemIsMarkupOrDiscountPrice = (item) => {
|
|
438
438
|
return getBundleItemIsMarkupPrice(item) || getBundleItemIsDiscountPrice(item);
|
|
439
439
|
};
|
|
440
|
-
var getDiscountAmount = (discounts) => {
|
|
441
|
-
return (discounts || []).reduce((total, discount) => {
|
|
442
|
-
return total.add(new import_decimal.default(discount.amount || 0));
|
|
443
|
-
}, new import_decimal.default(0)).toNumber();
|
|
444
|
-
};
|
|
445
440
|
var getMainProductTotal = (item) => {
|
|
446
|
-
var _a, _b
|
|
441
|
+
var _a, _b;
|
|
447
442
|
let total = new import_decimal.default(
|
|
448
443
|
(item == null ? void 0 : item.main_product_selling_price) ?? ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.main_product_selling_price) ?? ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.main_product_original_price) ?? 0
|
|
449
444
|
);
|
|
450
|
-
const hasMainProductPrice = (item == null ? void 0 : item.main_product_selling_price) != null || ((_c = item == null ? void 0 : item.metadata) == null ? void 0 : _c.main_product_selling_price) != null || ((_d = item == null ? void 0 : item.metadata) == null ? void 0 : _d.main_product_original_price) != null;
|
|
451
|
-
if (!hasMainProductPrice) {
|
|
452
|
-
total = new import_decimal.default((item == null ? void 0 : item.main_product_selling_price) ?? ((_e = item == null ? void 0 : item.metadata) == null ? void 0 : _e.main_product_selling_price) ?? item.price ?? 0);
|
|
453
|
-
const discount = ((_g = (_f = item == null ? void 0 : item._origin) == null ? void 0 : _f.product) == null ? void 0 : _g.discount_list) || ((_j = (_i = (_h = item == null ? void 0 : item._originData) == null ? void 0 : _h.product) == null ? void 0 : _i.discount_list) == null ? void 0 : _j.filter((item2) => {
|
|
454
|
-
var _a2;
|
|
455
|
-
return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
|
|
456
|
-
})) || [];
|
|
457
|
-
const mainProductDiscountAmount = getDiscountAmount(discount);
|
|
458
|
-
total = total.minus(mainProductDiscountAmount);
|
|
459
|
-
if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
|
|
460
|
-
total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
|
|
461
|
-
return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
|
|
462
|
-
}, new import_decimal.default(0)));
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
445
|
for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
|
|
466
446
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
467
447
|
const bundleItemTotal = new import_decimal.default(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -36,8 +36,6 @@ __reExport(modules_exports, require("./Quotation"), module.exports);
|
|
|
36
36
|
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
37
37
|
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
38
38
|
__reExport(modules_exports, require("./BookingContext"), module.exports);
|
|
39
|
-
__reExport(modules_exports, require("./Holder"), module.exports);
|
|
40
|
-
__reExport(modules_exports, require("./ResourcePlanner"), module.exports);
|
|
41
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
40
|
0 && (module.exports = {
|
|
43
41
|
...require("./Product"),
|
|
@@ -59,7 +57,5 @@ __reExport(modules_exports, require("./ResourcePlanner"), module.exports);
|
|
|
59
57
|
...require("./Quotation"),
|
|
60
58
|
...require("./ScanOrderLogger"),
|
|
61
59
|
...require("./OpenData"),
|
|
62
|
-
...require("./BookingContext")
|
|
63
|
-
...require("./Holder"),
|
|
64
|
-
...require("./ResourcePlanner")
|
|
60
|
+
...require("./BookingContext")
|
|
65
61
|
});
|
package/lib/plugins/window.d.ts
CHANGED
package/lib/server/index.d.ts
CHANGED
|
@@ -49,10 +49,6 @@ declare class Server {
|
|
|
49
49
|
private productQuerySubscribers;
|
|
50
50
|
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
51
51
|
private productQueryScheduleTimers;
|
|
52
|
-
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
53
|
-
private menuScheduleRefreshInFlight;
|
|
54
|
-
private lastMenuScheduleRefreshAt;
|
|
55
|
-
private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
|
|
56
52
|
private orderQuerySubscribers;
|
|
57
53
|
private bookingQuerySubscribers;
|
|
58
54
|
private bookingRemoteQuerySubscribers;
|
|
@@ -266,16 +262,6 @@ declare class Server {
|
|
|
266
262
|
* 存储订阅者信息,便于数据变更时推送最新结果
|
|
267
263
|
*/
|
|
268
264
|
private handleProductQuery;
|
|
269
|
-
/**
|
|
270
|
-
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
271
|
-
* In that case query against the current local time so menu availability can still be evaluated.
|
|
272
|
-
*/
|
|
273
|
-
private resolveProductQueryScheduleContext;
|
|
274
|
-
/**
|
|
275
|
-
* OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
|
|
276
|
-
* 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
|
|
277
|
-
*/
|
|
278
|
-
private refreshMenuScheduleCacheAfterEmptyResult;
|
|
279
265
|
/**
|
|
280
266
|
* 按商品 id 查询单条(GET /shop/product/query/:productId)
|
|
281
267
|
* schedule_date 必填:query 或 data;schedule_datetime 可选。不走订阅。
|
package/lib/server/index.js
CHANGED
|
@@ -82,10 +82,6 @@ var Server = class {
|
|
|
82
82
|
this.productQuerySubscribers = /* @__PURE__ */ new Map();
|
|
83
83
|
/** subscriberId → 智能定价变价时间点定时器句柄(与 subscriber 分离存储,便于 clear) */
|
|
84
84
|
this.productQueryScheduleTimers = /* @__PURE__ */ new Map();
|
|
85
|
-
/** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
|
|
86
|
-
this.menuScheduleRefreshInFlight = null;
|
|
87
|
-
this.lastMenuScheduleRefreshAt = 0;
|
|
88
|
-
this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS = 30 * 1e3;
|
|
89
85
|
// ---- 订单 / 预约列表查询订阅者 ----
|
|
90
86
|
this.orderQuerySubscribers = /* @__PURE__ */ new Map();
|
|
91
87
|
this.bookingQuerySubscribers = /* @__PURE__ */ new Map();
|
|
@@ -219,11 +215,7 @@ var Server = class {
|
|
|
219
215
|
*/
|
|
220
216
|
this.handleProductQuery = async ({ url, method, data, config }) => {
|
|
221
217
|
console.log("[Server] handleProductQuery:", url, method, data, config);
|
|
222
|
-
const { menu_list_ids, customer_id, ids, extension_type, strategy_context } = data;
|
|
223
|
-
const { schedule_date, schedule_datetime } = this.resolveProductQueryScheduleContext({
|
|
224
|
-
schedule_date: data.schedule_date,
|
|
225
|
-
schedule_datetime: data.schedule_datetime
|
|
226
|
-
});
|
|
218
|
+
const { menu_list_ids, schedule_datetime, schedule_date, customer_id, ids, extension_type, strategy_context } = data;
|
|
227
219
|
const { callback, subscriberId } = config || {};
|
|
228
220
|
this.logInfo("handleProductQuery: 开始处理商品查询请求", {
|
|
229
221
|
menu_list_ids,
|
|
@@ -2285,43 +2277,6 @@ var Server = class {
|
|
|
2285
2277
|
this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
|
|
2286
2278
|
}
|
|
2287
2279
|
}
|
|
2288
|
-
/**
|
|
2289
|
-
* ProductList callers such as standalone retail pages do not always have a selected schedule.
|
|
2290
|
-
* In that case query against the current local time so menu availability can still be evaluated.
|
|
2291
|
-
*/
|
|
2292
|
-
resolveProductQueryScheduleContext(params) {
|
|
2293
|
-
const now = (0, import_dayjs.default)();
|
|
2294
|
-
const schedule_datetime = typeof params.schedule_datetime === "string" && params.schedule_datetime.trim() ? params.schedule_datetime : now.format("YYYY-MM-DD HH:mm:ss");
|
|
2295
|
-
const schedule_date = typeof params.schedule_date === "string" && params.schedule_date.trim() ? params.schedule_date : (0, import_dayjs.default)(schedule_datetime).isValid() ? (0, import_dayjs.default)(schedule_datetime).format("YYYY-MM-DD") : now.format("YYYY-MM-DD");
|
|
2296
|
-
return { schedule_date, schedule_datetime };
|
|
2297
|
-
}
|
|
2298
|
-
/**
|
|
2299
|
-
* OpenData 的关联餐牌可能已更新,而 server_menu/server_schedule 仍命中本地持久化缓存。
|
|
2300
|
-
* 仅在当前筛选没有任何生效餐牌时刷新一次,并由调用方重新计算筛选结果。
|
|
2301
|
-
*/
|
|
2302
|
-
async refreshMenuScheduleCacheAfterEmptyResult() {
|
|
2303
|
-
if (!this.menu || !this.schedule)
|
|
2304
|
-
return false;
|
|
2305
|
-
const now = Date.now();
|
|
2306
|
-
if (now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS) {
|
|
2307
|
-
return false;
|
|
2308
|
-
}
|
|
2309
|
-
if (!this.menuScheduleRefreshInFlight) {
|
|
2310
|
-
this.lastMenuScheduleRefreshAt = now;
|
|
2311
|
-
this.menuScheduleRefreshInFlight = Promise.all([
|
|
2312
|
-
this.menu.loadMenuList(),
|
|
2313
|
-
this.schedule.loadAllSchedule()
|
|
2314
|
-
]).then(() => void 0).catch((error) => {
|
|
2315
|
-
this.logWarning("刷新菜单/日程缓存失败,继续使用现有缓存", {
|
|
2316
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2317
|
-
});
|
|
2318
|
-
}).finally(() => {
|
|
2319
|
-
this.menuScheduleRefreshInFlight = null;
|
|
2320
|
-
});
|
|
2321
|
-
}
|
|
2322
|
-
await this.menuScheduleRefreshInFlight;
|
|
2323
|
-
return true;
|
|
2324
|
-
}
|
|
2325
2280
|
/**
|
|
2326
2281
|
* 执行 sales 搜索并登记可见订单号。
|
|
2327
2282
|
* 搜索参数完全透传后端,OS 不做过滤、筛选、排序。
|
|
@@ -3824,22 +3779,10 @@ var Server = class {
|
|
|
3824
3779
|
data: (normalized == null ? void 0 : normalized.data) ?? null
|
|
3825
3780
|
};
|
|
3826
3781
|
}
|
|
3827
|
-
|
|
3782
|
+
return this.withSyncedOrderIdInCheckoutResponse(
|
|
3828
3783
|
syncResult.normalizedResponse,
|
|
3829
3784
|
syncResult.syncedOrder
|
|
3830
3785
|
);
|
|
3831
|
-
const syncedOrder = syncResult.syncedOrder;
|
|
3832
|
-
if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData) && this.isSalesOrderFullyPaid(syncedOrder)) {
|
|
3833
|
-
await this.dispatchLocalReceiptPrint({
|
|
3834
|
-
checkoutData: syncResult.checkoutData,
|
|
3835
|
-
order: syncedOrder,
|
|
3836
|
-
response: syncResult.normalizedResponse,
|
|
3837
|
-
requireFullyPaid: true,
|
|
3838
|
-
// print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
|
|
3839
|
-
isManualPrint: true
|
|
3840
|
-
});
|
|
3841
|
-
}
|
|
3842
|
-
return response;
|
|
3843
3786
|
} catch (error) {
|
|
3844
3787
|
const backendError = this.extractBackendErrorResponse(error);
|
|
3845
3788
|
if (backendError) {
|
|
@@ -5129,16 +5072,13 @@ var Server = class {
|
|
|
5129
5072
|
let activeMenuList = [];
|
|
5130
5073
|
if (menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0) {
|
|
5131
5074
|
const tMenu = performance.now();
|
|
5132
|
-
const
|
|
5075
|
+
const menuList = this.menu.getMenuByIds(menu_list_ids);
|
|
5076
|
+
activeMenuList = menuList.filter((menu) => {
|
|
5133
5077
|
var _a;
|
|
5134
5078
|
return ((_a = this.schedule) == null ? void 0 : _a.getDateIsInSchedule(schedule_datetime, menu.schedule)) || false;
|
|
5135
5079
|
});
|
|
5136
|
-
activeMenuList = getActiveMenus();
|
|
5137
|
-
if (!activeMenuList.length && await this.refreshMenuScheduleCacheAfterEmptyResult()) {
|
|
5138
|
-
activeMenuList = getActiveMenus();
|
|
5139
|
-
}
|
|
5140
5080
|
(0, import_product.perfMark)("computeQuery.filterActiveMenu", performance.now() - tMenu, {
|
|
5141
|
-
totalMenu:
|
|
5081
|
+
totalMenu: menuList.length,
|
|
5142
5082
|
activeMenu: activeMenuList.length
|
|
5143
5083
|
});
|
|
5144
5084
|
}
|
|
@@ -280,13 +280,6 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
280
280
|
confirmPendingVoucherPayments?: boolean;
|
|
281
281
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
282
282
|
}): Promise<T>;
|
|
283
|
-
/**
|
|
284
|
-
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
285
|
-
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
286
|
-
*/
|
|
287
|
-
protected shouldUseCheckoutSyncTask(): boolean;
|
|
288
|
-
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
289
|
-
protected getDefaultCheckoutSmallTicketDataFlag(): number | undefined;
|
|
290
283
|
printLocalOrderReceipt<T = any>(lookup?: BaseSalesPrintLocalOrderReceiptParams): Promise<T>;
|
|
291
284
|
private getSubmitPaymentStatus;
|
|
292
285
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
@@ -1008,7 +1008,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1008
1008
|
return isChanged;
|
|
1009
1009
|
}
|
|
1010
1010
|
async initialize(core, options = {}) {
|
|
1011
|
-
var _a, _b
|
|
1011
|
+
var _a, _b;
|
|
1012
1012
|
this.core = core;
|
|
1013
1013
|
this.initializeOptions = options || {};
|
|
1014
1014
|
this.paymentNumberDevicePrefix = null;
|
|
@@ -1019,9 +1019,10 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1019
1019
|
this.request = core.getPlugin("request");
|
|
1020
1020
|
this.appPlugin = core.getPlugin("app");
|
|
1021
1021
|
if (!this.appPlugin) {
|
|
1022
|
+
throw new Error("Checkout 解决方案需要 app 插件支持");
|
|
1022
1023
|
}
|
|
1023
|
-
const app =
|
|
1024
|
-
this.logger = app
|
|
1024
|
+
const app = this.appPlugin.getApp();
|
|
1025
|
+
this.logger = app.logger;
|
|
1025
1026
|
const targetCacheData = this.readSessionCacheData();
|
|
1026
1027
|
const moduleNames = this.getRegisteredModuleNames();
|
|
1027
1028
|
moduleNames.forEach((step) => {
|
|
@@ -1046,7 +1047,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1046
1047
|
if (this.store.schedule && !this.isScheduleListLoaded(this.store.schedule)) {
|
|
1047
1048
|
await this.store.schedule.loadAllSchedule();
|
|
1048
1049
|
}
|
|
1049
|
-
if (this.store.order && typeof ((
|
|
1050
|
+
if (this.store.order && typeof ((_b = this.otherParams) == null ? void 0 : _b.enableTempOrderPersist) === "boolean") {
|
|
1050
1051
|
this.store.order.setEnableTempOrderPersist(
|
|
1051
1052
|
this.otherParams.enableTempOrderPersist
|
|
1052
1053
|
);
|
|
@@ -1719,6 +1720,7 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1719
1720
|
}
|
|
1720
1721
|
return {
|
|
1721
1722
|
isAvailable: raw.isAvailable,
|
|
1723
|
+
...raw.isAccepted !== void 0 ? { isAccepted: raw.isAccepted } : {},
|
|
1722
1724
|
type: raw.type,
|
|
1723
1725
|
unavailableReason: raw.unavailableReason,
|
|
1724
1726
|
scannedDiscountList: raw.scannedDiscountList
|
|
@@ -1899,7 +1901,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1899
1901
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1900
1902
|
}
|
|
1901
1903
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1902
|
-
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1903
1904
|
const submitParams = {
|
|
1904
1905
|
cacheId: this.cacheId,
|
|
1905
1906
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
@@ -1909,11 +1910,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1909
1910
|
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1910
1911
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1911
1912
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1912
|
-
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1913
|
+
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
1913
1914
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1914
1915
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1915
1916
|
};
|
|
1916
|
-
return this.
|
|
1917
|
+
return this.store.order.submitTempOrder(submitParams);
|
|
1917
1918
|
}
|
|
1918
1919
|
async saveSalesOrderDraft(params) {
|
|
1919
1920
|
var _a, _b, _c, _d;
|
|
@@ -1935,35 +1936,20 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
1935
1936
|
throw new Error("BaseSales 解决方案需要 order 模块支持");
|
|
1936
1937
|
}
|
|
1937
1938
|
const inferredPaymentStatus = this.getSubmitPaymentStatus(params == null ? void 0 : params.paymentStatus);
|
|
1938
|
-
const smallTicketDataFlag = (params == null ? void 0 : params.smallTicketDataFlag) ?? this.getDefaultCheckoutSmallTicketDataFlag();
|
|
1939
1939
|
const submitParams = {
|
|
1940
1940
|
cacheId: this.cacheId,
|
|
1941
1941
|
platform: (_a = this.otherParams) == null ? void 0 : _a.platform,
|
|
1942
1942
|
businessCode: ((_b = this.otherParams) == null ? void 0 : _b.businessCode) || ((_c = this.otherParams) == null ? void 0 : _c.business_code),
|
|
1943
1943
|
channel: this.getSubmitOrderSalesChannel(),
|
|
1944
1944
|
type: (_d = this.otherParams) == null ? void 0 : _d.type,
|
|
1945
|
-
request_unique_idempotency_token: this.store.order.generateIdempotencyToken(),
|
|
1946
1945
|
...(params == null ? void 0 : params.payments) !== void 0 ? { payments: params.payments } : {},
|
|
1947
1946
|
...inferredPaymentStatus !== void 0 ? { paymentStatus: inferredPaymentStatus } : {},
|
|
1948
|
-
...smallTicketDataFlag !== void 0 ? { smallTicketDataFlag } : {},
|
|
1947
|
+
...(params == null ? void 0 : params.smallTicketDataFlag) !== void 0 ? { smallTicketDataFlag: params.smallTicketDataFlag } : {},
|
|
1949
1948
|
...(params == null ? void 0 : params.confirmPendingVoucherPayments) !== void 0 ? { confirmPendingVoucherPayments: params.confirmPendingVoucherPayments } : {},
|
|
1950
1949
|
...(params == null ? void 0 : params.enhancePayload) !== void 0 ? { enhancePayload: params.enhancePayload } : {}
|
|
1951
1950
|
};
|
|
1952
1951
|
return this.store.order.submitTempOrderAsync(submitParams);
|
|
1953
1952
|
}
|
|
1954
|
-
/**
|
|
1955
|
-
* 默认保持 WebPOS 的本地待同步订单模式;需要云端确认后才算成功的渠道可覆盖此策略。
|
|
1956
|
-
* otherParams.checkoutSyncTaskEnabled 优先,便于同一 solution 按入口恢复旧行为。
|
|
1957
|
-
*/
|
|
1958
|
-
shouldUseCheckoutSyncTask() {
|
|
1959
|
-
var _a;
|
|
1960
|
-
const configured = (_a = this.otherParams) == null ? void 0 : _a.checkoutSyncTaskEnabled;
|
|
1961
|
-
return typeof configured === "boolean" ? configured : true;
|
|
1962
|
-
}
|
|
1963
|
-
/** 可由特定 solution 为真实 checkout 补充默认收据数据请求。 */
|
|
1964
|
-
getDefaultCheckoutSmallTicketDataFlag() {
|
|
1965
|
-
return void 0;
|
|
1966
|
-
}
|
|
1967
1953
|
async printLocalOrderReceipt(lookup) {
|
|
1968
1954
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1969
1955
|
if (!this.store.order) {
|
|
@@ -2023,7 +2009,6 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
2023
2009
|
const channel = params.channel ?? this.getSubmitOrderSalesChannel();
|
|
2024
2010
|
const syncParams = {
|
|
2025
2011
|
...params,
|
|
2026
|
-
checkoutSyncTaskEnabled: this.shouldUseCheckoutSyncTask(),
|
|
2027
2012
|
...businessCode !== void 0 ? { businessCode } : {},
|
|
2028
2013
|
...channel !== void 0 ? { channel } : {}
|
|
2029
2014
|
};
|
|
@@ -439,8 +439,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
|
|
|
439
439
|
/** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
|
|
440
440
|
export interface BaseSalesScanCodeResult {
|
|
441
441
|
isAvailable: boolean;
|
|
442
|
+
/** 卡券已加入 Promotion;false 时可能是无效、过期或已使用。 */
|
|
443
|
+
isAccepted?: boolean;
|
|
442
444
|
type?: 'server' | string;
|
|
443
445
|
unavailableReason?: 'time_limit' | string;
|
|
444
|
-
/** batchSearch 原始结果;
|
|
446
|
+
/** batchSearch 原始结果;Holder 补全等流程可从这里读取原始卡券。 */
|
|
445
447
|
scannedDiscountList?: Discount[];
|
|
446
448
|
}
|
|
@@ -132,14 +132,15 @@ function transformBaseProductToOrderProduct(params) {
|
|
|
132
132
|
...callbackOrigin || {}
|
|
133
133
|
};
|
|
134
134
|
const matchedVariant = findVariantById(callbackOrigin, productVariantId) ?? findVariantById(sourceProduct, productVariantId) ?? findVariantById(origin, productVariantId);
|
|
135
|
+
const hasPriceOverride = payload.price_override !== void 0 && payload.price_override !== null && payload.price_override !== "";
|
|
136
|
+
const catalogSourcePrice = (matchedVariant == null ? void 0 : matchedVariant.price) ?? (matchedVariant == null ? void 0 : matchedVariant.base_price) ?? (origin == null ? void 0 : origin.price) ?? (origin == null ? void 0 : origin.base_price) ?? (sourceProduct == null ? void 0 : sourceProduct.price) ?? (sourceProduct == null ? void 0 : sourceProduct.selling_price) ?? (sourceProduct == null ? void 0 : sourceProduct.base_price);
|
|
135
137
|
const sourceProductPrice = toPriceString(
|
|
136
|
-
|
|
138
|
+
hasPriceOverride ? catalogSourcePrice ?? payload.price ?? payload.selling_price : payload.price ?? payload.selling_price ?? catalogSourcePrice,
|
|
137
139
|
"0.00"
|
|
138
140
|
);
|
|
139
141
|
const explicitLineTotal = payload.line_total ?? payload.total ?? ((_c = payload._extend) == null ? void 0 : _c.total);
|
|
140
142
|
const hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
|
|
141
143
|
const lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
|
|
142
|
-
const hasPriceOverride = payload.price_override !== void 0 && payload.price_override !== null && payload.price_override !== "";
|
|
143
144
|
const productOptionItem = (0, import_utils.normalizeProductSkuOptions)(
|
|
144
145
|
normalizeOptionItems(
|
|
145
146
|
((_d = payload.product_sku) == null ? void 0 : _d.option) ?? payload.option ?? payload.options ?? payload.product_option_item
|
|
@@ -10,7 +10,6 @@ import { ITime } from '../../modules/Date/types';
|
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import { LoadScheduleAvailableDateParams } from '../../modules/Schedule/types';
|
|
12
12
|
import { IHolder, IFetchHolderAccountsParams } from '../../modules/AccountList/types';
|
|
13
|
-
import { IAppendFormRecordParams } from '../../modules/Holder/types';
|
|
14
13
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
15
14
|
protected defaultName: string;
|
|
16
15
|
protected defaultVersion: string;
|
|
@@ -127,20 +126,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
127
126
|
* @param params
|
|
128
127
|
*/
|
|
129
128
|
fetchHolderAccountsAsync(params: IFetchHolderAccountsParams): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* 获取 holder 表单 map
|
|
132
|
-
*/
|
|
133
|
-
getHolderFormMap(): import("../../modules").HolderFormMap;
|
|
134
|
-
/**
|
|
135
|
-
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
136
|
-
*/
|
|
137
|
-
refreshAllHolderFormRecords(params?: {
|
|
138
|
-
customer_id?: number;
|
|
139
|
-
}): Promise<import("../../modules").HolderFormMap>;
|
|
140
|
-
/**
|
|
141
|
-
* 添加表单记录
|
|
142
|
-
*/
|
|
143
|
-
appendFormRecord(params: IAppendFormRecordParams): import("../../modules").IFormRecord;
|
|
144
129
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
145
130
|
clearDateRange(): void;
|
|
146
131
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -317,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
317
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
318
303
|
errorList: any[];
|
|
319
304
|
};
|
|
320
|
-
getTimeSlotByAllResources(resources_code: string
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string): any[];
|
|
321
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
322
307
|
resources_code: string;
|
|
323
308
|
startDate: string;
|