@pisell/pisellos 2.2.148 → 2.2.149
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/model/strategy/adapter/index.d.ts +2 -0
- package/dist/model/strategy/adapter/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +483 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.js +169 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +382 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/dist/model/strategy/adapter/itemRule/index.js +5 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.js +22 -1
- package/dist/modules/Cart/utils/changePrice.js +6 -0
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +16 -8
- package/dist/modules/Date/types.d.ts +3 -1
- 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 +171 -1
- package/dist/modules/Order/index.js +2052 -112
- package/dist/modules/Order/types.d.ts +441 -20
- package/dist/modules/Order/types.js +23 -0
- package/dist/modules/Order/utils.d.ts +120 -0
- package/dist/modules/Order/utils.js +653 -2
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +8 -1
- package/dist/modules/Quotation/index.js +40 -10
- package/dist/modules/Quotation/types.d.ts +5 -0
- package/dist/modules/Rules/index.d.ts +3 -1
- package/dist/modules/Rules/index.js +136 -50
- package/dist/modules/Rules/types.d.ts +6 -0
- package/dist/modules/Rules/types.js +8 -0
- package/dist/modules/SalesSummary/index.d.ts +70 -0
- package/dist/modules/SalesSummary/index.js +175 -0
- package/dist/modules/SalesSummary/types.d.ts +64 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +34 -0
- package/dist/modules/SalesSummary/utils.js +488 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +21 -0
- package/dist/modules/ScanOrderLogger/index.js +161 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +203 -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 +52 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +7 -7
- package/dist/modules/Schedule/index.d.ts +4 -13
- package/dist/modules/Schedule/index.js +6 -23
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/index.d.ts +3 -0
- package/dist/modules/Summary/index.js +134 -15
- package/dist/modules/Summary/types.d.ts +7 -0
- package/dist/modules/Summary/utils.d.ts +104 -1
- package/dist/modules/Summary/utils.js +1116 -13
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/server/index.d.ts +41 -4
- package/dist/server/index.js +900 -405
- package/dist/server/modules/order/index.d.ts +10 -2
- package/dist/server/modules/order/index.js +246 -193
- package/dist/server/modules/products/index.d.ts +26 -0
- package/dist/server/modules/products/index.js +618 -338
- package/dist/server/modules/products/types.d.ts +5 -1
- package/dist/solution/BaseSales/index.d.ts +175 -0
- package/dist/solution/BaseSales/index.js +1293 -0
- package/dist/solution/BaseSales/types.d.ts +305 -0
- package/dist/solution/BaseSales/types.js +38 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +159 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +222 -0
- package/dist/solution/BookingByStep/index.d.ts +14 -0
- package/dist/solution/BookingByStep/index.js +699 -212
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/capacity.js +1 -1
- package/dist/solution/BookingByStep/utils/resources.js +6 -1
- package/dist/solution/BookingTicket/index.d.ts +113 -15
- package/dist/solution/BookingTicket/index.js +534 -196
- package/dist/solution/BookingTicket/types.d.ts +69 -6
- package/dist/solution/BookingTicket/types.js +40 -9
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +66 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/dist/solution/BookingTicket/utils/cartView.js +84 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +1 -0
- package/dist/solution/ScanOrder/index.d.ts +146 -0
- package/dist/solution/ScanOrder/index.js +3029 -0
- package/dist/solution/ScanOrder/types.d.ts +305 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +768 -0
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +9 -5
- package/dist/solution/ShopDiscount/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +197 -0
- package/dist/solution/VenueBooking/index.js +3411 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +153 -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 +130 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +224 -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 +3 -0
- package/dist/solution/index.js +4 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/model/strategy/adapter/index.d.ts +2 -0
- package/lib/model/strategy/adapter/index.js +6 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +67 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +377 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +43 -0
- package/lib/model/strategy/adapter/itemRule/evaluator.js +124 -0
- package/lib/model/strategy/adapter/itemRule/examples.d.ts +79 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +316 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +60 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +225 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.js +17 -1
- package/lib/modules/Cart/utils/changePrice.js +5 -0
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +7 -1
- package/lib/modules/Date/types.d.ts +3 -1
- 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 +171 -1
- package/lib/modules/Order/index.js +1396 -5
- package/lib/modules/Order/types.d.ts +441 -20
- package/lib/modules/Order/types.js +1 -0
- package/lib/modules/Order/utils.d.ts +120 -0
- package/lib/modules/Order/utils.js +562 -2
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +8 -1
- package/lib/modules/Quotation/index.js +33 -4
- package/lib/modules/Quotation/types.d.ts +5 -0
- package/lib/modules/Rules/index.d.ts +3 -1
- package/lib/modules/Rules/index.js +46 -6
- package/lib/modules/Rules/types.d.ts +6 -0
- package/lib/modules/Rules/types.js +11 -2
- package/lib/modules/SalesSummary/index.d.ts +70 -0
- package/lib/modules/SalesSummary/index.js +106 -0
- package/lib/modules/SalesSummary/types.d.ts +64 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +34 -0
- package/lib/modules/SalesSummary/utils.js +430 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +21 -0
- package/lib/modules/ScanOrderLogger/index.js +135 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +148 -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 +52 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +5 -5
- package/lib/modules/Schedule/index.d.ts +4 -13
- package/lib/modules/Schedule/index.js +4 -15
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/index.d.ts +3 -0
- package/lib/modules/Summary/index.js +61 -2
- package/lib/modules/Summary/types.d.ts +7 -0
- package/lib/modules/Summary/utils.d.ts +104 -1
- package/lib/modules/Summary/utils.js +659 -8
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/server/index.d.ts +41 -4
- package/lib/server/index.js +272 -10
- package/lib/server/modules/order/index.d.ts +10 -2
- package/lib/server/modules/order/index.js +26 -1
- package/lib/server/modules/products/index.d.ts +26 -0
- package/lib/server/modules/products/index.js +174 -22
- package/lib/server/modules/products/types.d.ts +5 -1
- package/lib/solution/BaseSales/index.d.ts +175 -0
- package/lib/solution/BaseSales/index.js +655 -0
- package/lib/solution/BaseSales/types.d.ts +305 -0
- package/lib/solution/BaseSales/types.js +40 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +143 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +200 -0
- package/lib/solution/BookingByStep/index.d.ts +14 -0
- package/lib/solution/BookingByStep/index.js +469 -91
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/capacity.js +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +5 -2
- package/lib/solution/BookingTicket/index.d.ts +113 -15
- package/lib/solution/BookingTicket/index.js +253 -61
- package/lib/solution/BookingTicket/types.d.ts +69 -6
- package/lib/solution/BookingTicket/types.js +16 -14
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +37 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +65 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +26 -0
- package/lib/solution/BookingTicket/utils/cartView.js +103 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.d.ts +146 -0
- package/lib/solution/ScanOrder/index.js +1820 -0
- package/lib/solution/ScanOrder/types.d.ts +305 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +639 -0
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +9 -4
- package/lib/solution/ShopDiscount/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +197 -0
- package/lib/solution/VenueBooking/index.js +1892 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +153 -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 +91 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +34 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +225 -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 +3 -0
- package/lib/solution/index.js +7 -1
- package/package.json +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/solution/BaseSales/utils.ts
|
|
30
|
+
var utils_exports = {};
|
|
31
|
+
__export(utils_exports, {
|
|
32
|
+
buildProductLineFingerprint: () => buildProductLineFingerprint,
|
|
33
|
+
createEmptySummary: () => createEmptySummary,
|
|
34
|
+
getSafeProductNum: () => getSafeProductNum,
|
|
35
|
+
isSkuOnlyDeleteIdentity: () => isSkuOnlyDeleteIdentity,
|
|
36
|
+
normalizeOrderProduct: () => normalizeOrderProduct
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(utils_exports);
|
|
39
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
40
|
+
var import_utils = require("../../modules/Order/utils");
|
|
41
|
+
function createEmptySummary() {
|
|
42
|
+
return {
|
|
43
|
+
product_quantity: 0,
|
|
44
|
+
product_original_amount: "0.00",
|
|
45
|
+
product_amount: "0.00",
|
|
46
|
+
product_expect_amount: "0.00",
|
|
47
|
+
product_tax_fee: "0.00",
|
|
48
|
+
shipping_fee: "0.00",
|
|
49
|
+
shipping_tax_fee: "0.00",
|
|
50
|
+
tax_fee: "0.00",
|
|
51
|
+
surcharge_fee: "0.00",
|
|
52
|
+
discount_amount: "0.00",
|
|
53
|
+
deposit_amount: "0.00",
|
|
54
|
+
expect_amount: "0.00",
|
|
55
|
+
total_amount: "0.00",
|
|
56
|
+
amount_gap: "0.00",
|
|
57
|
+
rounding_amount: "0.00",
|
|
58
|
+
pay_service_charge_amount: "0.00"
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
62
|
+
const optArr = Array.isArray(productOptionItem) ? productOptionItem : [];
|
|
63
|
+
const normalizedOpts = optArr.map((item) => ({
|
|
64
|
+
product_option_item_id: Number(item == null ? void 0 : item.product_option_item_id) || 0,
|
|
65
|
+
option_group_id: Number(item == null ? void 0 : item.option_group_id) || 0,
|
|
66
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
67
|
+
price: String((item == null ? void 0 : item.price) ?? "")
|
|
68
|
+
})).sort((p, q) => {
|
|
69
|
+
if (p.product_option_item_id !== q.product_option_item_id) {
|
|
70
|
+
return p.product_option_item_id - q.product_option_item_id;
|
|
71
|
+
}
|
|
72
|
+
if (p.option_group_id !== q.option_group_id)
|
|
73
|
+
return p.option_group_id - q.option_group_id;
|
|
74
|
+
if (p.num !== q.num)
|
|
75
|
+
return p.num - q.num;
|
|
76
|
+
return p.price.localeCompare(q.price);
|
|
77
|
+
});
|
|
78
|
+
const bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
79
|
+
const normalizedBundles = bundleArr.map((item) => ({
|
|
80
|
+
bundle_id: Number((item == null ? void 0 : item.bundle_id) ?? (item == null ? void 0 : item.id) ?? 0) || 0,
|
|
81
|
+
product_id: Number(item == null ? void 0 : item.product_id) || 0,
|
|
82
|
+
num: typeof (item == null ? void 0 : item.num) === "number" && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1
|
|
83
|
+
})).sort((p, q) => {
|
|
84
|
+
if (p.bundle_id !== q.bundle_id)
|
|
85
|
+
return p.bundle_id - q.bundle_id;
|
|
86
|
+
if (p.product_id !== q.product_id)
|
|
87
|
+
return p.product_id - q.product_id;
|
|
88
|
+
return p.num - q.num;
|
|
89
|
+
});
|
|
90
|
+
return JSON.stringify([normalizedOpts, normalizedBundles]);
|
|
91
|
+
}
|
|
92
|
+
function getSafeProductNum(num) {
|
|
93
|
+
if (!num || Number.isNaN(num))
|
|
94
|
+
return 1;
|
|
95
|
+
if (num < 1)
|
|
96
|
+
return 1;
|
|
97
|
+
return Math.floor(num);
|
|
98
|
+
}
|
|
99
|
+
function isSkuOnlyDeleteIdentity(x) {
|
|
100
|
+
if (x.identity_key)
|
|
101
|
+
return false;
|
|
102
|
+
return !("product_option_item" in x) && !("product_bundle" in x);
|
|
103
|
+
}
|
|
104
|
+
function normalizeOrderProduct(product) {
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
const metadata = { ...product.metadata || {} };
|
|
107
|
+
const resolvedIdentityKey = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : (0, import_utils.createUuidV4)();
|
|
108
|
+
metadata.unique_identification_number = resolvedIdentityKey;
|
|
109
|
+
const normalizedBundle = (product.product_bundle || []).map((item) => ({
|
|
110
|
+
...item,
|
|
111
|
+
bundle_selling_price: item.bundle_selling_price ?? item.price ?? "0.00",
|
|
112
|
+
price: item.price ?? item.custom_price ?? item.bundle_selling_price ?? "0.00",
|
|
113
|
+
price_type: item.price_type ?? item.custom_price_type ?? "",
|
|
114
|
+
price_type_ext: item.price_type_ext ?? item.custom_price_type_ext ?? ""
|
|
115
|
+
}));
|
|
116
|
+
const normalizedOptions = product.product_option_item || [];
|
|
117
|
+
const optionSum = (0, import_utils.sumOptionUnitPrice)(normalizedOptions);
|
|
118
|
+
const isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === "2";
|
|
119
|
+
const variantId = Number(product.product_variant_id || 0);
|
|
120
|
+
const variantList = variantId ? (_b = metadata == null ? void 0 : metadata.origin) == null ? void 0 : _b.variant : null;
|
|
121
|
+
const variantPrice = Array.isArray(variantList) ? (_c = variantList.find((v) => Number(v == null ? void 0 : v.id) === variantId)) == null ? void 0 : _c.price : void 0;
|
|
122
|
+
const resolvedSource = (() => {
|
|
123
|
+
var _a2, _b2;
|
|
124
|
+
if (metadata.source_product_price !== void 0) {
|
|
125
|
+
return String(metadata.source_product_price);
|
|
126
|
+
}
|
|
127
|
+
if (variantPrice !== void 0 && variantPrice !== null) {
|
|
128
|
+
return String(variantPrice);
|
|
129
|
+
}
|
|
130
|
+
const originPrice = (_a2 = product._origin) == null ? void 0 : _a2.price;
|
|
131
|
+
if (originPrice !== void 0 && originPrice !== null) {
|
|
132
|
+
return String(originPrice);
|
|
133
|
+
}
|
|
134
|
+
const originBasePrice = (_b2 = product._origin) == null ? void 0 : _b2.base_price;
|
|
135
|
+
if (originBasePrice !== void 0 && originBasePrice !== null) {
|
|
136
|
+
return String(originBasePrice);
|
|
137
|
+
}
|
|
138
|
+
if (!isV2 && metadata.main_product_original_price !== void 0) {
|
|
139
|
+
return String(metadata.main_product_original_price);
|
|
140
|
+
}
|
|
141
|
+
return product.original_price ?? product.selling_price ?? "0.00";
|
|
142
|
+
})();
|
|
143
|
+
const mainOriginalDec = new import_decimal.default(Number(resolvedSource) || 0).plus(optionSum);
|
|
144
|
+
const mainOriginalStr = mainOriginalDec.toDecimalPlaces(2).toFixed(2);
|
|
145
|
+
let mainSellingDec;
|
|
146
|
+
if (isV2 && metadata.main_product_selling_price != null) {
|
|
147
|
+
mainSellingDec = new import_decimal.default(Number(metadata.main_product_selling_price) || 0);
|
|
148
|
+
} else if (metadata.main_product_selling_price != null && metadata.main_product_original_price != null) {
|
|
149
|
+
const legacyOriginal = new import_decimal.default(Number(metadata.main_product_original_price) || 0);
|
|
150
|
+
const legacySelling = new import_decimal.default(Number(metadata.main_product_selling_price) || 0);
|
|
151
|
+
const legacyDiscount = legacyOriginal.minus(legacySelling);
|
|
152
|
+
mainSellingDec = mainOriginalDec.minus(legacyDiscount);
|
|
153
|
+
} else if (product.original_price != null && product.selling_price != null && new import_decimal.default(Number(product.original_price) || 0).greaterThan(
|
|
154
|
+
new import_decimal.default(Number(product.selling_price) || 0)
|
|
155
|
+
)) {
|
|
156
|
+
const topOriginal = new import_decimal.default(Number(product.original_price) || 0);
|
|
157
|
+
const topSelling = new import_decimal.default(Number(product.selling_price) || 0);
|
|
158
|
+
const legacyDiscount = topOriginal.minus(topSelling);
|
|
159
|
+
mainSellingDec = mainOriginalDec.minus(legacyDiscount);
|
|
160
|
+
} else {
|
|
161
|
+
mainSellingDec = mainOriginalDec;
|
|
162
|
+
}
|
|
163
|
+
const mainSellingStr = mainSellingDec.toDecimalPlaces(2).toFixed(2);
|
|
164
|
+
metadata.source_product_price = resolvedSource;
|
|
165
|
+
metadata.main_product_original_price = mainOriginalStr;
|
|
166
|
+
metadata.main_product_selling_price = mainSellingStr;
|
|
167
|
+
metadata.price_schema_version = 2;
|
|
168
|
+
const composedSellingPrice = (0, import_utils.composeLinePrice)({
|
|
169
|
+
mainPrice: mainSellingStr,
|
|
170
|
+
bundle: normalizedBundle
|
|
171
|
+
});
|
|
172
|
+
const composedOriginalPrice = (0, import_utils.composeLinePrice)({
|
|
173
|
+
mainPrice: mainOriginalStr,
|
|
174
|
+
bundle: normalizedBundle,
|
|
175
|
+
useOriginalBundle: true
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
order_detail_id: product.order_detail_id || null,
|
|
179
|
+
product_id: product.product_id,
|
|
180
|
+
num: getSafeProductNum(product.num),
|
|
181
|
+
product_variant_id: product.product_variant_id,
|
|
182
|
+
product_option_item: normalizedOptions,
|
|
183
|
+
selling_price: composedSellingPrice,
|
|
184
|
+
original_price: composedOriginalPrice,
|
|
185
|
+
tax_fee: product.tax_fee || "0.00",
|
|
186
|
+
is_charge_tax: product.is_charge_tax ?? 0,
|
|
187
|
+
discount_list: product.discount_list || [],
|
|
188
|
+
product_bundle: normalizedBundle,
|
|
189
|
+
metadata,
|
|
190
|
+
note: product.note != null ? String(product.note) : ""
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
194
|
+
0 && (module.exports = {
|
|
195
|
+
buildProductLineFingerprint,
|
|
196
|
+
createEmptySummary,
|
|
197
|
+
getSafeProductNum,
|
|
198
|
+
isSkuOnlyDeleteIdentity,
|
|
199
|
+
normalizeOrderProduct
|
|
200
|
+
});
|
|
@@ -148,6 +148,9 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
148
148
|
taxTitle?: string | undefined;
|
|
149
149
|
totalTaxFee?: string | number | undefined;
|
|
150
150
|
isPriceIncludeTax?: 0 | 1 | undefined;
|
|
151
|
+
surchargeAmount?: string | number | undefined;
|
|
152
|
+
surcharge?: any[] | undefined;
|
|
153
|
+
taxRate?: string | number | undefined;
|
|
151
154
|
deposit?: {
|
|
152
155
|
total?: string | number | undefined;
|
|
153
156
|
policies?: import("../../modules/Summary/types").IProtocol[] | undefined;
|
|
@@ -300,6 +303,16 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
300
303
|
errorList: any[];
|
|
301
304
|
};
|
|
302
305
|
getTimeSlotByAllResources(resources_code: string): any[];
|
|
306
|
+
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
|
+
resources_code: string;
|
|
308
|
+
startDate: string;
|
|
309
|
+
endDate: string;
|
|
310
|
+
}): Promise<{
|
|
311
|
+
date: string;
|
|
312
|
+
status: string;
|
|
313
|
+
week: string;
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
|
+
}[]>;
|
|
303
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
304
317
|
private getScheduleDataByIds;
|
|
305
318
|
openProductDetail(productId: number): Promise<void>;
|
|
@@ -317,6 +330,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
317
330
|
count: number;
|
|
318
331
|
left: number;
|
|
319
332
|
summaryCount: number;
|
|
333
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
320
334
|
}[];
|
|
321
335
|
/**
|
|
322
336
|
* 找到多个资源的公共可用时间段
|