@pisell/pisellos 2.1.151 → 2.1.152
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/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +26 -99
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +8 -61
- package/dist/model/strategy/adapter/walletPass/locales.js +3 -12
- package/dist/model/strategy/engine.d.ts +5 -18
- package/dist/model/strategy/engine.js +45 -145
- package/dist/model/strategy/type.d.ts +0 -17
- package/dist/model/strategy/type.js +0 -4
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/index.d.ts +9 -3
- package/dist/modules/Discount/index.js +103 -11
- package/dist/modules/Discount/types.d.ts +8 -19
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +66 -1
- package/dist/modules/Order/index.js +906 -30
- package/dist/modules/Order/types.d.ts +174 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +118 -0
- package/dist/modules/Order/utils.js +586 -2
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -3
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +168 -677
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +41 -52
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +46 -43
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +152 -0
- package/dist/solution/ScanOrder/index.js +3132 -0
- package/dist/solution/ScanOrder/types.d.ts +287 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +764 -0
- package/dist/solution/ShopDiscount/index.d.ts +3 -2
- package/dist/solution/ShopDiscount/index.js +60 -59
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +200 -0
- package/dist/solution/VenueBooking/index.js +3459 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +154 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/promotion/evaluator.js +8 -57
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +3 -34
- package/lib/model/strategy/adapter/walletPass/locales.js +3 -12
- package/lib/model/strategy/engine.d.ts +5 -18
- package/lib/model/strategy/engine.js +21 -85
- package/lib/model/strategy/type.d.ts +0 -17
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/index.d.ts +9 -3
- package/lib/modules/Discount/index.js +65 -4
- package/lib/modules/Discount/types.d.ts +8 -19
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +66 -1
- package/lib/modules/Order/index.js +515 -1
- package/lib/modules/Order/types.d.ts +174 -12
- package/lib/modules/Order/utils.d.ts +118 -0
- package/lib/modules/Order/utils.js +483 -2
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +288 -780
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +22 -31
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +6 -4
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +152 -0
- package/lib/solution/ScanOrder/index.js +1901 -0
- package/lib/solution/ScanOrder/types.d.ts +287 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +635 -0
- package/lib/solution/ShopDiscount/index.d.ts +3 -2
- package/lib/solution/ShopDiscount/index.js +19 -25
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +200 -0
- package/lib/solution/VenueBooking/index.js +1926 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +154 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/ScanOrderLogger/providers/feishu.ts
|
|
20
|
+
var feishu_exports = {};
|
|
21
|
+
__export(feishu_exports, {
|
|
22
|
+
feishuLoggerProvider: () => feishuLoggerProvider
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(feishu_exports);
|
|
25
|
+
var DEFAULT_THROTTLE_MS = 3e3;
|
|
26
|
+
var pendingQueue = [];
|
|
27
|
+
var flushTimer = null;
|
|
28
|
+
var cachedProviderConfig;
|
|
29
|
+
function safeStringify(value) {
|
|
30
|
+
if (value === void 0 || value === null)
|
|
31
|
+
return "";
|
|
32
|
+
if (typeof value === "string")
|
|
33
|
+
return value;
|
|
34
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
35
|
+
return String(value);
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
return JSON.stringify(value);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return `[unserializable: ${String(error)}]`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function isWebhookUsable(webhook) {
|
|
44
|
+
if (!webhook)
|
|
45
|
+
return false;
|
|
46
|
+
if (webhook.includes("REPLACE_ME"))
|
|
47
|
+
return false;
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
function buildRecordSegments(record) {
|
|
51
|
+
const context = record.context || {};
|
|
52
|
+
return [
|
|
53
|
+
[{ tag: "text", text: `[${record.level}] ${record.timestamp} ${record.title}
|
|
54
|
+
` }],
|
|
55
|
+
[{ tag: "text", text: `缓存标识: ${safeStringify(context.cacheId)}
|
|
56
|
+
` }],
|
|
57
|
+
[{ tag: "text", text: `日志来源: ${safeStringify(context)}
|
|
58
|
+
` }],
|
|
59
|
+
[{ tag: "text", text: `日志内容: ${safeStringify(record.payload)}
|
|
60
|
+
` }],
|
|
61
|
+
[{ tag: "text", text: `扩展信息: ${safeStringify(record.extra)}
|
|
62
|
+
` }],
|
|
63
|
+
[{ tag: "text", text: "------\n" }]
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
function buildFeishuBody(records) {
|
|
67
|
+
const title = records.length === 1 ? records[0].title : `ScanOrder 日志批量 (${records.length} 条)`;
|
|
68
|
+
const content = [];
|
|
69
|
+
records.forEach((record) => {
|
|
70
|
+
buildRecordSegments(record).forEach((segment) => content.push(segment));
|
|
71
|
+
});
|
|
72
|
+
return JSON.stringify({
|
|
73
|
+
msg_type: "post",
|
|
74
|
+
content: JSON.stringify({
|
|
75
|
+
post: {
|
|
76
|
+
zh_cn: {
|
|
77
|
+
title,
|
|
78
|
+
content
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async function postToFeishu(webhook, body) {
|
|
85
|
+
await fetch(webhook, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: {
|
|
88
|
+
"Content-Type": "application/json"
|
|
89
|
+
},
|
|
90
|
+
body
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async function flushQueue() {
|
|
94
|
+
var _a;
|
|
95
|
+
flushTimer = null;
|
|
96
|
+
if (!pendingQueue.length)
|
|
97
|
+
return;
|
|
98
|
+
const records = pendingQueue.splice(0, pendingQueue.length);
|
|
99
|
+
const webhook = (_a = cachedProviderConfig == null ? void 0 : cachedProviderConfig.feishu) == null ? void 0 : _a.webhook;
|
|
100
|
+
if (!isWebhookUsable(webhook)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (typeof fetch !== "function") {
|
|
104
|
+
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Feishu 日志批量上报");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
await postToFeishu(webhook, buildFeishuBody(records));
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.warn("[ScanOrderLogger] Feishu 批量上报失败", error);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
var feishuLoggerProvider = {
|
|
114
|
+
async send(payload) {
|
|
115
|
+
var _a, _b, _c, _d, _e, _f;
|
|
116
|
+
cachedProviderConfig = payload.providerConfig;
|
|
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
|
+
if (!webhook) {
|
|
132
|
+
console.warn("[ScanOrderLogger] Feishu webhook 未配置,跳过日志上报");
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!isWebhookUsable(webhook))
|
|
136
|
+
return;
|
|
137
|
+
const throttleMs = ((_f = (_e = payload.providerConfig) == null ? void 0 : _e.feishu) == null ? void 0 : _f.throttleMs) ?? DEFAULT_THROTTLE_MS;
|
|
138
|
+
if (throttleMs <= 0) {
|
|
139
|
+
try {
|
|
140
|
+
await postToFeishu(webhook, buildFeishuBody([payload.record]));
|
|
141
|
+
} catch (error) {
|
|
142
|
+
console.warn("[ScanOrderLogger] Feishu 日志上报失败", error);
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
pendingQueue.push(payload.record);
|
|
147
|
+
if (!flushTimer) {
|
|
148
|
+
flushTimer = setTimeout(() => {
|
|
149
|
+
void flushQueue();
|
|
150
|
+
}, throttleMs);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
feishuLoggerProvider
|
|
157
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/ScanOrderLogger/providers/grafana.ts
|
|
20
|
+
var grafana_exports = {};
|
|
21
|
+
__export(grafana_exports, {
|
|
22
|
+
grafanaLoggerProvider: () => grafanaLoggerProvider
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(grafana_exports);
|
|
25
|
+
var grafanaLoggerProvider = {
|
|
26
|
+
async send(payload) {
|
|
27
|
+
var _a, _b, _c, _d;
|
|
28
|
+
const endpoint = (_b = (_a = payload.providerConfig) == null ? void 0 : _a.grafana) == null ? void 0 : _b.endpoint;
|
|
29
|
+
if (!endpoint) {
|
|
30
|
+
console.warn("[ScanOrderLogger] Grafana endpoint 未配置,跳过日志上报");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (typeof fetch !== "function") {
|
|
34
|
+
console.warn("[ScanOrderLogger] 当前环境不支持 fetch,跳过 Grafana 日志上报");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
await fetch(endpoint, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: {
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
...((_d = (_c = payload.providerConfig) == null ? void 0 : _c.grafana) == null ? void 0 : _d.headers) || {}
|
|
42
|
+
},
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
record: payload.record
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
grafanaLoggerProvider
|
|
52
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type ScanOrderLogLevel = 'info' | 'warning' | 'error' | 'debug';
|
|
2
|
+
export type ScanOrderLoggerProviderType = 'feishu' | 'grafana';
|
|
3
|
+
export interface ScanOrderLoggerProviderFeishuConfig {
|
|
4
|
+
webhook?: string;
|
|
5
|
+
errorHook?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 节流窗口毫秒数,默认 3000ms
|
|
8
|
+
* - >0:首条日志进入队列并启动定时器,窗口结束后合并成一条 Feishu post 统一发送
|
|
9
|
+
* - <=0:关闭节流,保持每条日志立即单独发送
|
|
10
|
+
*/
|
|
11
|
+
throttleMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ScanOrderLoggerProviderGrafanaConfig {
|
|
14
|
+
endpoint?: string;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export interface ScanOrderLoggerProviderConfig {
|
|
18
|
+
feishu?: ScanOrderLoggerProviderFeishuConfig;
|
|
19
|
+
grafana?: ScanOrderLoggerProviderGrafanaConfig;
|
|
20
|
+
}
|
|
21
|
+
export interface ScanOrderLoggerContext {
|
|
22
|
+
cacheId?: string;
|
|
23
|
+
solutionName?: string;
|
|
24
|
+
moduleName?: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface ScanOrderLogInput {
|
|
28
|
+
level?: ScanOrderLogLevel;
|
|
29
|
+
title: string;
|
|
30
|
+
payload?: Record<string, any>;
|
|
31
|
+
extra?: Record<string, any>;
|
|
32
|
+
timestamp?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ScanOrderLogRecord {
|
|
35
|
+
level: ScanOrderLogLevel;
|
|
36
|
+
title: string;
|
|
37
|
+
timestamp: string;
|
|
38
|
+
payload: Record<string, any>;
|
|
39
|
+
extra: Record<string, any>;
|
|
40
|
+
context: ScanOrderLoggerContext;
|
|
41
|
+
}
|
|
42
|
+
export interface ScanOrderLoggerDispatchPayload {
|
|
43
|
+
record: ScanOrderLogRecord;
|
|
44
|
+
providerConfig?: ScanOrderLoggerProviderConfig;
|
|
45
|
+
}
|
|
46
|
+
export interface ScanOrderLoggerProvider {
|
|
47
|
+
send: (payload: ScanOrderLoggerDispatchPayload) => Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
export interface ScanOrderLoggerState {
|
|
50
|
+
provider: ScanOrderLoggerProviderType;
|
|
51
|
+
providerConfig: ScanOrderLoggerProviderConfig;
|
|
52
|
+
context: ScanOrderLoggerContext;
|
|
53
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/modules/ScanOrderLogger/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -70,7 +70,7 @@ var isInStandardSchedule = (targetDate, targetDateString, targetTimeString, sche
|
|
|
70
70
|
}
|
|
71
71
|
const startDate = (0, import_dayjs.default)(schedule.start_time);
|
|
72
72
|
const endDate = (0, import_dayjs.default)(schedule.end_time);
|
|
73
|
-
const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.
|
|
73
|
+
const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate);
|
|
74
74
|
if (schedule.repeat_type === "none") {
|
|
75
75
|
return isInBasicRange;
|
|
76
76
|
}
|
|
@@ -80,16 +80,14 @@ var isInTimeSlotsSchedule = (targetDate, targetDateString, targetTimeString, sch
|
|
|
80
80
|
if (!schedule.start_time) {
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
83
|
+
const scheduleStartDate = (0, import_dayjs.default)(schedule.start_time.split(" ")[0]);
|
|
84
|
+
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
for (const timeSlot of schedule.time_slot) {
|
|
88
|
-
const slotStart = `${
|
|
89
|
-
const slotEnd = `${
|
|
90
|
-
|
|
91
|
-
const slotEndDate = (0, import_dayjs.default)(slotEnd);
|
|
92
|
-
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
88
|
+
const slotStart = (0, import_dayjs.default)(`${targetDateString} ${timeSlot.start_time}:00`);
|
|
89
|
+
const slotEnd = (0, import_dayjs.default)(`${targetDateString} ${timeSlot.end_time}:00`);
|
|
90
|
+
if (targetDate.isSameOrAfter(slotStart) && targetDate.isBefore(slotEnd)) {
|
|
93
91
|
return true;
|
|
94
92
|
}
|
|
95
93
|
}
|
|
@@ -104,7 +102,7 @@ var isInDesignationSchedule = (targetDate, targetDateString, targetTimeString, s
|
|
|
104
102
|
const endDateTime = `${designation.end_date} ${designation.end_time}:00`;
|
|
105
103
|
const startDate = (0, import_dayjs.default)(startDateTime);
|
|
106
104
|
const endDate = (0, import_dayjs.default)(endDateTime);
|
|
107
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
105
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate)) {
|
|
108
106
|
return true;
|
|
109
107
|
}
|
|
110
108
|
}
|
|
@@ -158,7 +156,7 @@ var isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
|
158
156
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
159
157
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
160
158
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
161
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
159
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
|
|
162
160
|
};
|
|
163
161
|
var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
164
162
|
const targetDayOfWeek = targetDate.day();
|
|
@@ -175,7 +173,7 @@ var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
|
175
173
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
176
174
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
177
175
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
178
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
176
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
|
|
179
177
|
};
|
|
180
178
|
var getScheduleStartEndTimePoints = (date, scheduleList) => {
|
|
181
179
|
if (!date || !scheduleList || scheduleList.length === 0) {
|
|
@@ -46,7 +46,7 @@ export declare const formatScheduleResult: (schedule: ScheduleItem) => {
|
|
|
46
46
|
};
|
|
47
47
|
export declare const calcScheduleDateRange: (schedule: ScheduleItem) => any[];
|
|
48
48
|
export declare const calcCalendarDataBySchedules: (schedules: ScheduleItem[]) => unknown[];
|
|
49
|
-
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) =>
|
|
49
|
+
export declare const calcMinTimeMaxTimeBySchedules: (schedules: ScheduleItem[], scheduleAllMap?: ScheduleAllMap, selectDate?: string) => ScheduleAllMap;
|
|
50
50
|
/**
|
|
51
51
|
* @title: 格式化日程数据
|
|
52
52
|
* @description:
|
|
@@ -7,8 +7,8 @@ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[], i
|
|
|
7
7
|
* @param item
|
|
8
8
|
*/
|
|
9
9
|
export declare const getBundleDiscountList: (bundle: any[]) => any[];
|
|
10
|
-
export declare const calcDiscountListDifference: (discountList: any[]) =>
|
|
11
|
-
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) =>
|
|
10
|
+
export declare const calcDiscountListDifference: (discountList: any[]) => number;
|
|
11
|
+
export declare const getProductDiscountProductDiscountDifference: (item: CartItem) => number;
|
|
12
12
|
/**
|
|
13
13
|
* 计算订单税费(折扣前/折扣后),并把单品税费信息回写到商品数据上(用于明细展示/后续计算)。
|
|
14
14
|
*
|
|
@@ -58,12 +58,6 @@ export declare const getTax: ({ service, addons, bookingDetail, bookingId }: {
|
|
|
58
58
|
* @returns 商品总价字符串,保留2位小数
|
|
59
59
|
*/
|
|
60
60
|
export declare const calculateSubtotal: (items: CartItem[]) => string;
|
|
61
|
-
/**
|
|
62
|
-
* 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
|
|
63
|
-
* @param items - 购物车商品数组
|
|
64
|
-
* @returns 商品总价字符串,保留2位小数
|
|
65
|
-
*/
|
|
66
|
-
export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
|
|
67
61
|
/**
|
|
68
62
|
* @title: 单个商品的税费
|
|
69
63
|
* @description:
|
|
@@ -100,7 +94,7 @@ export declare const calculateDeposit: (items: CartItem[]) => {
|
|
|
100
94
|
export declare const getSurchargeAmount: ({ bookingDetail, bookingId }: {
|
|
101
95
|
bookingDetail?: any;
|
|
102
96
|
bookingId?: number | undefined;
|
|
103
|
-
}, surcharge: any[], options: any) =>
|
|
97
|
+
}, surcharge: any[], options: any) => number;
|
|
104
98
|
/**
|
|
105
99
|
* 订单附加费各项信息
|
|
106
100
|
*
|
|
@@ -31,7 +31,6 @@ var utils_exports = {};
|
|
|
31
31
|
__export(utils_exports, {
|
|
32
32
|
calcDiscountListDifference: () => calcDiscountListDifference,
|
|
33
33
|
calculateDeposit: () => calculateDeposit,
|
|
34
|
-
calculateOriginSubtotal: () => calculateOriginSubtotal,
|
|
35
34
|
calculatePriceDetails: () => calculatePriceDetails,
|
|
36
35
|
calculateSubtotal: () => calculateSubtotal,
|
|
37
36
|
calculateTaxFee: () => calculateTaxFee,
|
|
@@ -47,7 +46,6 @@ var import_utils = require("../Product/utils");
|
|
|
47
46
|
var import_dayjs = __toESM(require("dayjs"));
|
|
48
47
|
var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList, scheduleById) => {
|
|
49
48
|
const subtotal = new import_decimal.default(calculateSubtotal(items));
|
|
50
|
-
const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
|
|
51
49
|
const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
|
|
52
50
|
const surcharge = getSurcharge({ service: items, addons: [], bookingDetail: null, bookingId: void 0 }, { isEdit: false, isInScheduleByDate, surcharge_list: surchargeList, scheduleById });
|
|
53
51
|
const surchargeAmount = new import_decimal.default(getSurchargeAmount({ bookingDetail: null, bookingId: void 0 }, surcharge, { isEdit: false }));
|
|
@@ -61,12 +59,10 @@ var calculatePriceDetails = (shopInfo, items, isInScheduleByDate, surchargeList,
|
|
|
61
59
|
is_price_include_tax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax
|
|
62
60
|
});
|
|
63
61
|
const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal.plus(surchargeAmount) : subtotal.plus(tax).plus(surchargeAmount);
|
|
64
|
-
const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
|
|
65
62
|
const deposit = calculateDeposit(items);
|
|
66
63
|
return {
|
|
67
64
|
subtotal: subtotal.toFixed(2),
|
|
68
65
|
total: total.toFixed(2),
|
|
69
|
-
originTotal: originTotal.toFixed(2),
|
|
70
66
|
taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
|
|
71
67
|
taxRate: shopInfo == null ? void 0 : shopInfo.tax_rate,
|
|
72
68
|
totalTaxFee: tax,
|
|
@@ -91,8 +87,8 @@ var getBundleDiscountList = (bundle) => {
|
|
|
91
87
|
var calcDiscountListDifference = (discountList) => {
|
|
92
88
|
return discountList.reduce((pre, cur) => {
|
|
93
89
|
var _a;
|
|
94
|
-
return pre
|
|
95
|
-
}, 0);
|
|
90
|
+
return pre.plus(((_a = cur == null ? void 0 : cur.metadata) == null ? void 0 : _a.product_discount_difference) || 0);
|
|
91
|
+
}, new import_decimal.default(0)).toNumber();
|
|
96
92
|
};
|
|
97
93
|
var getProductDiscountProductDiscountDifference = (item) => {
|
|
98
94
|
var _a, _b, _c, _d;
|
|
@@ -364,16 +360,6 @@ var calculateSubtotal = (items) => {
|
|
|
364
360
|
}, new import_decimal.default(0));
|
|
365
361
|
return subtotal.toFixed(2);
|
|
366
362
|
};
|
|
367
|
-
var calculateOriginSubtotal = (items) => {
|
|
368
|
-
if (!(items == null ? void 0 : items.length)) {
|
|
369
|
-
return "0.00";
|
|
370
|
-
}
|
|
371
|
-
const subtotal = items.reduce((sum, item) => {
|
|
372
|
-
const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
|
|
373
|
-
return sum.plus(cartItemTotalPrice);
|
|
374
|
-
}, new import_decimal.default(0));
|
|
375
|
-
return subtotal.toFixed(2);
|
|
376
|
-
};
|
|
377
363
|
var calculateTaxFee = (shopInfo, items) => {
|
|
378
364
|
if (!(items == null ? void 0 : items.length)) {
|
|
379
365
|
return "0.00";
|
|
@@ -422,8 +408,8 @@ var getSurchargeAmount = ({ bookingDetail, bookingId }, surcharge, options) => {
|
|
|
422
408
|
if (!Array.isArray(surcharge))
|
|
423
409
|
return 0;
|
|
424
410
|
return surcharge.reduce((total, item) => {
|
|
425
|
-
return total
|
|
426
|
-
}, 0);
|
|
411
|
+
return total.plus(item.value || 0);
|
|
412
|
+
}, new import_decimal.default(0)).toNumber();
|
|
427
413
|
};
|
|
428
414
|
var getBundleItemIsOriginalPrice = (item) => {
|
|
429
415
|
return (item == null ? void 0 : item.price_type) === "markup" && (item == null ? void 0 : item.price_type_ext) === "product_price";
|
|
@@ -443,18 +429,24 @@ var getDiscountAmount = (discounts) => {
|
|
|
443
429
|
}, new import_decimal.default(0)).toNumber();
|
|
444
430
|
};
|
|
445
431
|
var getMainProductTotal = (item) => {
|
|
446
|
-
var _a, _b, _c, _d, _e, _f;
|
|
447
|
-
let total = new import_decimal.default(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
432
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
433
|
+
let total = new import_decimal.default(
|
|
434
|
+
(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
|
|
435
|
+
);
|
|
436
|
+
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;
|
|
437
|
+
if (!hasMainProductPrice) {
|
|
438
|
+
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);
|
|
439
|
+
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) => {
|
|
440
|
+
var _a2;
|
|
441
|
+
return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
|
|
442
|
+
})) || [];
|
|
443
|
+
const mainProductDiscountAmount = getDiscountAmount(discount);
|
|
444
|
+
total = total.minus(mainProductDiscountAmount);
|
|
445
|
+
if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
|
|
446
|
+
total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
|
|
447
|
+
return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
|
|
448
|
+
}, new import_decimal.default(0)));
|
|
449
|
+
}
|
|
458
450
|
}
|
|
459
451
|
for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
|
|
460
452
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
@@ -799,7 +791,6 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
|
|
|
799
791
|
0 && (module.exports = {
|
|
800
792
|
calcDiscountListDifference,
|
|
801
793
|
calculateDeposit,
|
|
802
|
-
calculateOriginSubtotal,
|
|
803
794
|
calculatePriceDetails,
|
|
804
795
|
calculateSubtotal,
|
|
805
796
|
calculateTaxFee,
|
package/lib/modules/index.d.ts
CHANGED
|
@@ -11,4 +11,8 @@ export * from './Payment';
|
|
|
11
11
|
export * from './Resource';
|
|
12
12
|
export * from './Step';
|
|
13
13
|
export * from './Summary';
|
|
14
|
+
export * from './SalesSummary';
|
|
14
15
|
export * from './Schedule';
|
|
16
|
+
export * from './Quotation';
|
|
17
|
+
export * from './ScanOrderLogger';
|
|
18
|
+
export * from './OpenData';
|
package/lib/modules/index.js
CHANGED
|
@@ -29,7 +29,11 @@ __reExport(modules_exports, require("./Payment"), module.exports);
|
|
|
29
29
|
__reExport(modules_exports, require("./Resource"), module.exports);
|
|
30
30
|
__reExport(modules_exports, require("./Step"), module.exports);
|
|
31
31
|
__reExport(modules_exports, require("./Summary"), module.exports);
|
|
32
|
+
__reExport(modules_exports, require("./SalesSummary"), module.exports);
|
|
32
33
|
__reExport(modules_exports, require("./Schedule"), module.exports);
|
|
34
|
+
__reExport(modules_exports, require("./Quotation"), module.exports);
|
|
35
|
+
__reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
|
|
36
|
+
__reExport(modules_exports, require("./OpenData"), module.exports);
|
|
33
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
38
|
0 && (module.exports = {
|
|
35
39
|
...require("./Product"),
|
|
@@ -45,5 +49,9 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
45
49
|
...require("./Resource"),
|
|
46
50
|
...require("./Step"),
|
|
47
51
|
...require("./Summary"),
|
|
48
|
-
...require("./
|
|
52
|
+
...require("./SalesSummary"),
|
|
53
|
+
...require("./Schedule"),
|
|
54
|
+
...require("./Quotation"),
|
|
55
|
+
...require("./ScanOrderLogger"),
|
|
56
|
+
...require("./OpenData")
|
|
49
57
|
});
|
package/lib/plugins/window.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* WindowPlugin 接口定义
|
|
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
14
|
document: Partial<Document>;
|
|
16
15
|
history: History;
|
|
17
16
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* 简单的 Storage 接口实现
|
|
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
144
|
getSummary(): Promise<{
|
|
145
145
|
subtotal: string | number;
|
|
146
146
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
147
|
taxTitle?: string | undefined;
|
|
149
148
|
totalTaxFee?: string | number | undefined;
|
|
150
149
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -302,7 +301,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
301
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
302
|
errorList: any[];
|
|
304
303
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
304
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
305
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
306
|
resources_code: string;
|
|
308
307
|
startDate: string;
|
|
@@ -1235,7 +1235,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
);
|
|
1237
1237
|
cartItems2.forEach((item, index) => {
|
|
1238
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1238
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1239
1239
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1240
1240
|
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1241
1241
|
if (hasOriginTimeSlot) {
|
|
@@ -1368,7 +1368,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1368
1368
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1369
1369
|
resources: targetRenderList,
|
|
1370
1370
|
currentCapacity,
|
|
1371
|
-
countMap: selectResourcesMap
|
|
1371
|
+
countMap: selectResourcesMap,
|
|
1372
|
+
targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
|
|
1373
|
+
durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
|
|
1372
1374
|
});
|
|
1373
1375
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1374
1376
|
targetResource.capacity = currentCapacity;
|
|
@@ -1405,7 +1407,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1405
1407
|
return { errorList };
|
|
1406
1408
|
}
|
|
1407
1409
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1408
|
-
getTimeSlotByAllResources(resources_code) {
|
|
1410
|
+
getTimeSlotByAllResources(resources_code, split = 10) {
|
|
1409
1411
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1410
1412
|
let dateRange = this.store.date.getDateRange();
|
|
1411
1413
|
const resources = [];
|
|
@@ -1563,7 +1565,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1563
1565
|
resourcesMap,
|
|
1564
1566
|
duration,
|
|
1565
1567
|
currentDate: dateRange[0].date,
|
|
1566
|
-
split
|
|
1568
|
+
split,
|
|
1567
1569
|
resourcesUseableMap,
|
|
1568
1570
|
capacity: maxCapacity,
|
|
1569
1571
|
cut_off_time: maxCutOffTime,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -14,6 +14,8 @@ export interface BookingByStepState {
|
|
|
14
14
|
currentProduct?: ProductData;
|
|
15
15
|
currentProductMeta?: Record<string, any>;
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
|
+
salesSummary?: SalesSummaryModule;
|
|
18
|
+
scanOrderLogger?: ScanOrderLoggerModule;
|
|
17
19
|
}
|
|
18
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
19
21
|
export declare enum BookingByStepHooks {
|
|
@@ -36,6 +36,11 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
36
36
|
`${solutionName}_${name || moduleName}`,
|
|
37
37
|
version
|
|
38
38
|
);
|
|
39
|
+
case "salesSummary":
|
|
40
|
+
return new import_modules.SalesSummaryModule(
|
|
41
|
+
`${solutionName}_${name || moduleName}`,
|
|
42
|
+
version
|
|
43
|
+
);
|
|
39
44
|
case "step":
|
|
40
45
|
return new import_modules.StepModule(
|
|
41
46
|
`${solutionName}_${name || moduleName}`,
|
|
@@ -71,6 +76,11 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
71
76
|
`${solutionName}_${name || moduleName}`,
|
|
72
77
|
version
|
|
73
78
|
);
|
|
79
|
+
case "scanOrderLogger":
|
|
80
|
+
return new import_modules.ScanOrderLoggerModule(
|
|
81
|
+
`${solutionName}_${name || moduleName}`,
|
|
82
|
+
version
|
|
83
|
+
);
|
|
74
84
|
default:
|
|
75
85
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
76
86
|
}
|