@pisell/pisellos 2.1.172 → 2.1.174
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/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +12 -63
- 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/Cart/utils/changePrice.js +16 -9
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +52 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/entitlementState.d.ts +8 -0
- package/dist/modules/Discount/entitlementState.js +205 -0
- package/dist/modules/Discount/index.d.ts +12 -3
- package/dist/modules/Discount/index.js +211 -17
- package/dist/modules/Discount/types.d.ts +42 -22
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- 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 +67 -1
- package/dist/modules/Order/index.js +923 -30
- package/dist/modules/Order/types.d.ts +176 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +128 -0
- package/dist/modules/Order/utils.js +621 -5
- 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/types.d.ts +7 -0
- 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/entitlementLines.d.ts +8 -0
- package/dist/modules/Rules/entitlementLines.js +157 -0
- package/dist/modules/Rules/index.d.ts +17 -11
- package/dist/modules/Rules/index.js +495 -726
- package/dist/modules/Rules/types.d.ts +2 -4
- 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 +67 -57
- package/dist/modules/index.d.ts +5 -0
- package/dist/modules/index.js +6 -1
- package/dist/plugins/window.d.ts +3 -2
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +322 -247
- package/dist/solution/BookingByStep/types.d.ts +4 -1
- package/dist/solution/BookingByStep/types.js +7 -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 +158 -0
- package/dist/solution/ScanOrder/index.js +3474 -0
- package/dist/solution/ScanOrder/types.d.ts +307 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +172 -0
- package/dist/solution/ScanOrder/utils.js +796 -0
- package/dist/solution/ShopDiscount/index.d.ts +6 -2
- package/dist/solution/ShopDiscount/index.js +194 -110
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.d.ts +1 -0
- package/dist/solution/ShopDiscount/utils.js +52 -27
- package/dist/solution/VenueBooking/index.d.ts +225 -0
- package/dist/solution/VenueBooking/index.js +3749 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +156 -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/dist/types/index.d.ts +1 -0
- 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 +49 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +7 -36
- 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/Cart/utils/changePrice.js +13 -9
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +91 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +184 -0
- package/lib/modules/Discount/entitlementState.d.ts +8 -0
- package/lib/modules/Discount/entitlementState.js +206 -0
- package/lib/modules/Discount/index.d.ts +12 -3
- package/lib/modules/Discount/index.js +123 -12
- package/lib/modules/Discount/types.d.ts +42 -22
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- 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 +67 -1
- package/lib/modules/Order/index.js +529 -1
- package/lib/modules/Order/types.d.ts +176 -12
- package/lib/modules/Order/utils.d.ts +128 -0
- package/lib/modules/Order/utils.js +514 -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/types.d.ts +7 -0
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -4
- 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/entitlementLines.d.ts +8 -0
- package/lib/modules/Rules/entitlementLines.js +158 -0
- package/lib/modules/Rules/index.d.ts +17 -11
- package/lib/modules/Rules/index.js +548 -798
- package/lib/modules/Rules/types.d.ts +2 -4
- 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 +45 -34
- package/lib/modules/index.d.ts +5 -0
- package/lib/modules/index.js +11 -1
- package/lib/plugins/window.d.ts +3 -2
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +45 -4
- package/lib/solution/BookingByStep/types.d.ts +4 -1
- package/lib/solution/BookingByStep/types.js +15 -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 +158 -0
- package/lib/solution/ScanOrder/index.js +2135 -0
- package/lib/solution/ScanOrder/types.d.ts +307 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +172 -0
- package/lib/solution/ScanOrder/utils.js +658 -0
- package/lib/solution/ShopDiscount/index.d.ts +6 -2
- package/lib/solution/ShopDiscount/index.js +94 -50
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +48 -11
- package/lib/solution/VenueBooking/index.d.ts +225 -0
- package/lib/solution/VenueBooking/index.js +2073 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +156 -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/lib/types/index.d.ts +1 -0
- 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";
|
|
@@ -387,6 +373,26 @@ var calculateTaxFee = (shopInfo, items) => {
|
|
|
387
373
|
}, new import_decimal.default(0));
|
|
388
374
|
return totalTaxFee;
|
|
389
375
|
};
|
|
376
|
+
var getCartItemDepositData = (item) => {
|
|
377
|
+
var _a, _b, _c, _d;
|
|
378
|
+
const target = item;
|
|
379
|
+
return ((_a = target == null ? void 0 : target._productOrigin) == null ? void 0 : _a.custom_deposit_data) || ((_b = target == null ? void 0 : target._origin) == null ? void 0 : _b.custom_deposit_data) || ((_d = (_c = target == null ? void 0 : target._origin) == null ? void 0 : _c.product) == null ? void 0 : _d.custom_deposit_data);
|
|
380
|
+
};
|
|
381
|
+
var getCartItemQuantity = (item) => {
|
|
382
|
+
return new import_decimal.default((item == null ? void 0 : item.num) || 1);
|
|
383
|
+
};
|
|
384
|
+
var calculateCartItemDepositTotal = (item) => {
|
|
385
|
+
var _a;
|
|
386
|
+
const depositData = getCartItemDepositData(item);
|
|
387
|
+
if ((depositData == null ? void 0 : depositData.has_deposit) == 1 && typeof (depositData == null ? void 0 : depositData.deposit_fixed) === "string" && typeof (depositData == null ? void 0 : depositData.deposit_percentage) === "string") {
|
|
388
|
+
const lineTotal = new import_decimal.default(item.summaryTotal ?? item.total ?? 0);
|
|
389
|
+
const quantity = getCartItemQuantity(item);
|
|
390
|
+
const fixedTotal = new import_decimal.default(depositData.deposit_fixed || 0).times(quantity);
|
|
391
|
+
const percentageTotal = new import_decimal.default(depositData.deposit_percentage || 0).times(lineTotal);
|
|
392
|
+
return fixedTotal.plus(percentageTotal);
|
|
393
|
+
}
|
|
394
|
+
return new import_decimal.default(((_a = item == null ? void 0 : item.deposit) == null ? void 0 : _a.total) || 0);
|
|
395
|
+
};
|
|
390
396
|
var calculateDeposit = (items) => {
|
|
391
397
|
if (!(items == null ? void 0 : items.length)) {
|
|
392
398
|
return void 0;
|
|
@@ -394,11 +400,11 @@ var calculateDeposit = (items) => {
|
|
|
394
400
|
const protocols = [];
|
|
395
401
|
let hasDeposit = false;
|
|
396
402
|
const total = items.reduce((sum, item) => {
|
|
397
|
-
var _a, _b
|
|
403
|
+
var _a, _b;
|
|
398
404
|
if (item == null ? void 0 : item.deposit) {
|
|
399
405
|
hasDeposit = true;
|
|
400
|
-
const cartItemTotalPrice =
|
|
401
|
-
(
|
|
406
|
+
const cartItemTotalPrice = calculateCartItemDepositTotal(item);
|
|
407
|
+
(_b = (_a = item == null ? void 0 : item.deposit) == null ? void 0 : _a.protocols) == null ? void 0 : _b.forEach((protocol) => {
|
|
402
408
|
if (protocols.findIndex((p) => p.id === protocol.id) === -1) {
|
|
403
409
|
protocols.push(protocol);
|
|
404
410
|
}
|
|
@@ -422,8 +428,8 @@ var getSurchargeAmount = ({ bookingDetail, bookingId }, surcharge, options) => {
|
|
|
422
428
|
if (!Array.isArray(surcharge))
|
|
423
429
|
return 0;
|
|
424
430
|
return surcharge.reduce((total, item) => {
|
|
425
|
-
return total
|
|
426
|
-
}, 0);
|
|
431
|
+
return total.plus(item.value || 0);
|
|
432
|
+
}, new import_decimal.default(0)).toNumber();
|
|
427
433
|
};
|
|
428
434
|
var getBundleItemIsOriginalPrice = (item) => {
|
|
429
435
|
return (item == null ? void 0 : item.price_type) === "markup" && (item == null ? void 0 : item.price_type_ext) === "product_price";
|
|
@@ -443,18 +449,24 @@ var getDiscountAmount = (discounts) => {
|
|
|
443
449
|
}, new import_decimal.default(0)).toNumber();
|
|
444
450
|
};
|
|
445
451
|
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
|
-
|
|
452
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
453
|
+
let total = new import_decimal.default(
|
|
454
|
+
(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
|
|
455
|
+
);
|
|
456
|
+
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;
|
|
457
|
+
if (!hasMainProductPrice) {
|
|
458
|
+
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);
|
|
459
|
+
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) => {
|
|
460
|
+
var _a2;
|
|
461
|
+
return !((_a2 = item2 == null ? void 0 : item2.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
|
|
462
|
+
})) || [];
|
|
463
|
+
const mainProductDiscountAmount = getDiscountAmount(discount);
|
|
464
|
+
total = total.minus(mainProductDiscountAmount);
|
|
465
|
+
if ((item == null ? void 0 : item.option) && Array.isArray(item == null ? void 0 : item.option)) {
|
|
466
|
+
total = total.add(item == null ? void 0 : item.option.reduce((t, option) => {
|
|
467
|
+
return t.add(new import_decimal.default(option.price || 0).mul(option.num || 1));
|
|
468
|
+
}, new import_decimal.default(0)));
|
|
469
|
+
}
|
|
458
470
|
}
|
|
459
471
|
for (let bundleItem of (item == null ? void 0 : item.bundle) || []) {
|
|
460
472
|
if (getBundleItemIsMarkupOrDiscountPrice(bundleItem)) {
|
|
@@ -799,7 +811,6 @@ function resetItemsSurchargeSideEffects({ service, addons }) {
|
|
|
799
811
|
0 && (module.exports = {
|
|
800
812
|
calcDiscountListDifference,
|
|
801
813
|
calculateDeposit,
|
|
802
|
-
calculateOriginSubtotal,
|
|
803
814
|
calculatePriceDetails,
|
|
804
815
|
calculateSubtotal,
|
|
805
816
|
calculateTaxFee,
|
package/lib/modules/index.d.ts
CHANGED
|
@@ -11,4 +11,9 @@ 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';
|
|
19
|
+
export * from './Holder';
|
package/lib/modules/index.js
CHANGED
|
@@ -29,7 +29,12 @@ __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);
|
|
37
|
+
__reExport(modules_exports, require("./Holder"), module.exports);
|
|
33
38
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
39
|
0 && (module.exports = {
|
|
35
40
|
...require("./Product"),
|
|
@@ -45,5 +50,10 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
45
50
|
...require("./Resource"),
|
|
46
51
|
...require("./Step"),
|
|
47
52
|
...require("./Summary"),
|
|
48
|
-
...require("./
|
|
53
|
+
...require("./SalesSummary"),
|
|
54
|
+
...require("./Schedule"),
|
|
55
|
+
...require("./Quotation"),
|
|
56
|
+
...require("./ScanOrderLogger"),
|
|
57
|
+
...require("./OpenData"),
|
|
58
|
+
...require("./Holder")
|
|
49
59
|
});
|
package/lib/plugins/window.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WalletPassEvaluator } from '../model';
|
|
2
1
|
import { Plugin } from '../types';
|
|
2
|
+
import type { WalletPassEvaluator } from '../model/strategy/adapter/walletPass/evaluator';
|
|
3
3
|
/**
|
|
4
4
|
* WindowPlugin 接口定义
|
|
5
5
|
*/
|
|
@@ -15,7 +15,8 @@ export interface WindowPlugin extends Plugin {
|
|
|
15
15
|
document: Partial<Document>;
|
|
16
16
|
history: History;
|
|
17
17
|
interaction?: any;
|
|
18
|
-
getWalletPassEvaluator?: () => WalletPassEvaluator;
|
|
18
|
+
getWalletPassEvaluator?: () => WalletPassEvaluator | undefined;
|
|
19
|
+
getLocalStorage?: (key: string) => string | null;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* 简单的 Storage 接口实现
|
|
@@ -10,6 +10,7 @@ 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';
|
|
13
14
|
export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
14
15
|
protected defaultName: string;
|
|
15
16
|
protected defaultVersion: string;
|
|
@@ -126,6 +127,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
126
127
|
* @param params
|
|
127
128
|
*/
|
|
128
129
|
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;
|
|
129
144
|
setDateRange(dateRange: ITime[]): Promise<void>;
|
|
130
145
|
clearDateRange(): void;
|
|
131
146
|
getDateRange(): Promise<ITime[]>;
|
|
@@ -144,7 +159,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
144
159
|
getSummary(): Promise<{
|
|
145
160
|
subtotal: string | number;
|
|
146
161
|
total: string | number;
|
|
147
|
-
originTotal: string | number;
|
|
148
162
|
taxTitle?: string | undefined;
|
|
149
163
|
totalTaxFee?: string | number | undefined;
|
|
150
164
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
@@ -302,7 +316,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
316
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
317
|
errorList: any[];
|
|
304
318
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
319
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
320
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
321
|
resources_code: string;
|
|
308
322
|
startDate: string;
|
|
@@ -311,7 +325,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
325
|
date: string;
|
|
312
326
|
status: string;
|
|
313
327
|
week: string;
|
|
314
|
-
weekNum: 0 |
|
|
328
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
329
|
}[]>;
|
|
316
330
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
331
|
private getScheduleDataByIds;
|