@pisell/pisellos 2.1.119 → 2.1.121
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/index.d.ts +1 -0
- package/dist/model/index.js +1 -0
- package/dist/model/strategy/adapter/index.d.ts +7 -0
- package/dist/model/strategy/adapter/index.js +7 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/dist/model/strategy/adapter/itemRule/adapter.js +439 -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 +64 -0
- package/dist/model/strategy/adapter/itemRule/examples.js +315 -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 +206 -0
- package/dist/model/strategy/adapter/itemRule/type.js +101 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +271 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +1206 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/dist/model/strategy/adapter/promotion/examples.js +166 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/dist/model/strategy/adapter/promotion/type.js +209 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +502 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/dist/model/strategy/adapter/walletPass/example.js +258 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/index.js +182 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.js +26 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/dist/model/strategy/adapter/walletPass/type.js +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +1104 -0
- package/dist/model/strategy/engine.d.ts +106 -0
- package/dist/model/strategy/engine.js +611 -0
- package/dist/model/strategy/index.d.ts +3 -0
- package/dist/model/strategy/index.js +8 -0
- package/dist/model/strategy/strategy-example.d.ts +5 -0
- package/dist/model/strategy/strategy-example.js +331 -0
- package/dist/model/strategy/type.d.ts +228 -0
- package/dist/model/strategy/type.js +94 -0
- package/dist/modules/Cart/utils/cartProduct.js +1 -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 +58 -1
- package/dist/modules/Order/index.js +796 -29
- package/dist/modules/Order/types.d.ts +144 -12
- package/dist/modules/Order/utils.d.ts +28 -0
- package/dist/modules/Order/utils.js +250 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -1
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +245 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.js +4 -1
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +59 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +513 -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 +95 -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 +46 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Summary/utils.d.ts +3 -3
- package/dist/modules/Summary/utils.js +4 -4
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/ScanOrder/index.d.ts +90 -0
- package/dist/solution/ScanOrder/index.js +1853 -0
- package/dist/solution/ScanOrder/types.d.ts +210 -0
- package/dist/solution/ScanOrder/types.js +16 -0
- package/dist/solution/ScanOrder/utils.d.ts +93 -0
- package/dist/solution/ScanOrder/utils.js +397 -0
- package/dist/solution/VenueBooking/index.d.ts +163 -0
- package/dist/solution/VenueBooking/index.js +2931 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +130 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +102 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/resource.js +94 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +203 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +256 -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/model/index.d.ts +1 -0
- package/lib/model/index.js +23 -0
- package/lib/model/strategy/adapter/index.d.ts +7 -0
- package/lib/model/strategy/adapter/index.js +57 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +59 -0
- package/lib/model/strategy/adapter/itemRule/adapter.js +338 -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 +64 -0
- package/lib/model/strategy/adapter/itemRule/examples.js +269 -0
- package/lib/model/strategy/adapter/itemRule/index.d.ts +5 -0
- package/lib/model/strategy/adapter/itemRule/index.js +58 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +206 -0
- package/lib/model/strategy/adapter/itemRule/type.js +46 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +66 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +217 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +213 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +844 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +138 -0
- package/lib/model/strategy/adapter/promotion/examples.js +192 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +447 -0
- package/lib/model/strategy/adapter/promotion/type.js +51 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +84 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +424 -0
- package/lib/model/strategy/adapter/walletPass/example.d.ts +4 -0
- package/lib/model/strategy/adapter/walletPass/example.js +207 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/index.js +142 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/locales.js +54 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +187 -0
- package/lib/model/strategy/adapter/walletPass/type.js +17 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +791 -0
- package/lib/model/strategy/engine.d.ts +106 -0
- package/lib/model/strategy/engine.js +450 -0
- package/lib/model/strategy/index.d.ts +3 -0
- package/lib/model/strategy/index.js +38 -0
- package/lib/model/strategy/strategy-example.d.ts +5 -0
- package/lib/model/strategy/strategy-example.js +318 -0
- package/lib/model/strategy/type.d.ts +228 -0
- package/lib/model/strategy/type.js +44 -0
- package/lib/modules/Cart/utils/cartProduct.js +1 -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 +58 -1
- package/lib/modules/Order/index.js +437 -1
- package/lib/modules/Order/types.d.ts +144 -12
- package/lib/modules/Order/utils.d.ts +28 -0
- package/lib/modules/Order/utils.js +250 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -1
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +149 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.js +4 -1
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +59 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +452 -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 +82 -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 +46 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Summary/utils.d.ts +3 -3
- package/lib/modules/Summary/utils.js +4 -4
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/ScanOrder/index.d.ts +90 -0
- package/lib/solution/ScanOrder/index.js +1071 -0
- package/lib/solution/ScanOrder/types.d.ts +210 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +93 -0
- package/lib/solution/ScanOrder/utils.js +359 -0
- package/lib/solution/VenueBooking/index.d.ts +163 -0
- package/lib/solution/VenueBooking/index.js +1578 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +130 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +10 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +101 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/resource.js +80 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +29 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +208 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +200 -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
|
@@ -29,12 +29,22 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/modules/Order/utils.ts
|
|
30
30
|
var utils_exports = {};
|
|
31
31
|
__export(utils_exports, {
|
|
32
|
+
buildSubmitPayload: () => buildSubmitPayload,
|
|
33
|
+
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
34
|
+
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
35
|
+
createUuidV4: () => createUuidV4,
|
|
36
|
+
formatDateTime: () => formatDateTime,
|
|
37
|
+
formatV1Product: () => formatV1Product,
|
|
32
38
|
generateDuration: () => generateDuration,
|
|
33
39
|
getAllDiscountList: () => getAllDiscountList,
|
|
34
|
-
|
|
40
|
+
isTempOrder: () => isTempOrder,
|
|
41
|
+
mergeRelationForms: () => mergeRelationForms,
|
|
42
|
+
normalizeSubmitBooking: () => normalizeSubmitBooking
|
|
35
43
|
});
|
|
36
44
|
module.exports = __toCommonJS(utils_exports);
|
|
37
45
|
var import_dayjs = __toESM(require("dayjs"));
|
|
46
|
+
var import_utils = require("../../solution/ScanOrder/utils");
|
|
47
|
+
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
38
48
|
var generateDuration = (cartItem) => {
|
|
39
49
|
const startDate = (0, import_dayjs.default)(`${cartItem.start_date} ${cartItem.start_time}`);
|
|
40
50
|
const endDate = (0, import_dayjs.default)(`${cartItem.end_date} ${cartItem.end_time}`);
|
|
@@ -65,9 +75,247 @@ var getAllDiscountList = (cartItem) => {
|
|
|
65
75
|
});
|
|
66
76
|
return discountList;
|
|
67
77
|
};
|
|
78
|
+
function createUuidV4() {
|
|
79
|
+
const template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
80
|
+
return template.replace(/[xy]/g, (char) => {
|
|
81
|
+
const randomValue = Math.floor(Math.random() * 16);
|
|
82
|
+
const value = char === "x" ? randomValue : randomValue & 3 | 8;
|
|
83
|
+
return value.toString(16);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function isTempOrder(data) {
|
|
87
|
+
if (!data || typeof data !== "object")
|
|
88
|
+
return false;
|
|
89
|
+
if (!Array.isArray(data.products))
|
|
90
|
+
return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function formatDateTime(date) {
|
|
94
|
+
const pad = (value) => value.toString().padStart(2, "0");
|
|
95
|
+
const year = date.getFullYear();
|
|
96
|
+
const month = pad(date.getMonth() + 1);
|
|
97
|
+
const day = pad(date.getDate());
|
|
98
|
+
const hours = pad(date.getHours());
|
|
99
|
+
const minutes = pad(date.getMinutes());
|
|
100
|
+
const seconds = pad(date.getSeconds());
|
|
101
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
102
|
+
}
|
|
103
|
+
function normalizeSubmitPlatform(platform) {
|
|
104
|
+
return (platform == null ? void 0 : platform.toLowerCase()) === "pc" ? "PC" : "H5";
|
|
105
|
+
}
|
|
106
|
+
function normalizeSubmitProduct(product) {
|
|
107
|
+
const { _origin, identity_key, ...submitProduct } = product;
|
|
108
|
+
const rawMetadata = submitProduct.metadata || {};
|
|
109
|
+
const bookingUid = rawMetadata.booking_uid;
|
|
110
|
+
const cleanMetadata = {};
|
|
111
|
+
if (rawMetadata.unique_identification_number) {
|
|
112
|
+
cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
|
|
113
|
+
}
|
|
114
|
+
const priceMetaKeys = [
|
|
115
|
+
"main_product_original_price",
|
|
116
|
+
"main_product_selling_price",
|
|
117
|
+
"source_product_price"
|
|
118
|
+
];
|
|
119
|
+
for (const key of priceMetaKeys) {
|
|
120
|
+
if (rawMetadata[key] !== void 0) {
|
|
121
|
+
cleanMetadata[key] = rawMetadata[key];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (rawMetadata.price_breakdown) {
|
|
125
|
+
cleanMetadata.price_breakdown = rawMetadata.price_breakdown;
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
...submitProduct,
|
|
129
|
+
...bookingUid ? { booking_uid: bookingUid } : {},
|
|
130
|
+
product_option_item: submitProduct.product_option_item || [],
|
|
131
|
+
discount_list: submitProduct.discount_list || [],
|
|
132
|
+
product_bundle: submitProduct.product_bundle || [],
|
|
133
|
+
metadata: cleanMetadata
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
var SUBMIT_BOOKING_METADATA_WHITELIST = [
|
|
137
|
+
"unique_identification_number",
|
|
138
|
+
"collect_pax"
|
|
139
|
+
];
|
|
140
|
+
function normalizeSubmitBooking(booking) {
|
|
141
|
+
const rawMetadata = booking.metadata || {};
|
|
142
|
+
const cleanMetadata = {};
|
|
143
|
+
for (const key of SUBMIT_BOOKING_METADATA_WHITELIST) {
|
|
144
|
+
if (rawMetadata[key] !== void 0) {
|
|
145
|
+
cleanMetadata[key] = rawMetadata[key];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...booking,
|
|
150
|
+
metadata: cleanMetadata
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
154
|
+
function resolveTableOccupancyDuration(tempOrder) {
|
|
155
|
+
var _a, _b, _c, _d;
|
|
156
|
+
const metadata = tempOrder.metadata || {};
|
|
157
|
+
const candidates = [
|
|
158
|
+
metadata.table_occupancy_duration,
|
|
159
|
+
metadata.booking_duration,
|
|
160
|
+
metadata.table_duration,
|
|
161
|
+
metadata.duration,
|
|
162
|
+
(_a = metadata.table_config) == null ? void 0 : _a.occupancy_duration,
|
|
163
|
+
(_b = metadata.tableConfig) == null ? void 0 : _b.occupancy_duration,
|
|
164
|
+
(_c = metadata.resource_config) == null ? void 0 : _c.occupancy_duration,
|
|
165
|
+
(_d = metadata.resourceConfig) == null ? void 0 : _d.occupancy_duration
|
|
166
|
+
];
|
|
167
|
+
for (const value of candidates) {
|
|
168
|
+
const duration = Number(value);
|
|
169
|
+
if (Number.isFinite(duration) && duration > 0) {
|
|
170
|
+
return Math.floor(duration);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return DEFAULT_TABLE_OCCUPANCY_DURATION;
|
|
174
|
+
}
|
|
175
|
+
function createDefaultTempOrder(params) {
|
|
176
|
+
const summary = params.summary || (0, import_utils.createEmptySummary)();
|
|
177
|
+
return {
|
|
178
|
+
order_id: null,
|
|
179
|
+
relation_id: void 0,
|
|
180
|
+
table_form_id: void 0,
|
|
181
|
+
resource_id: void 0,
|
|
182
|
+
order_number: "",
|
|
183
|
+
shop_order_number: "",
|
|
184
|
+
type: "appointment_booking",
|
|
185
|
+
business_code: "appointment_booking",
|
|
186
|
+
platform: "h5",
|
|
187
|
+
sales_channel: "my_pisel",
|
|
188
|
+
order_sales_channel: "online_store",
|
|
189
|
+
status: "normal",
|
|
190
|
+
payment_status: "payment_processing",
|
|
191
|
+
shipping_status: "unfulfilled",
|
|
192
|
+
customer_id: null,
|
|
193
|
+
customer_name: "",
|
|
194
|
+
country_calling_code: "",
|
|
195
|
+
phone: "",
|
|
196
|
+
email: "",
|
|
197
|
+
is_price_include_tax: 1,
|
|
198
|
+
tax_title: "",
|
|
199
|
+
tax_country_code: "",
|
|
200
|
+
currency_code: "",
|
|
201
|
+
currency_symbol: "",
|
|
202
|
+
currency_format: "symbol_first",
|
|
203
|
+
is_deposit: 0,
|
|
204
|
+
deposit_amount: "0.00",
|
|
205
|
+
shop_discount: "0.00",
|
|
206
|
+
surcharge_fee: "0.00",
|
|
207
|
+
note: "",
|
|
208
|
+
schedule_date: params.now,
|
|
209
|
+
created_at: params.now,
|
|
210
|
+
products: [],
|
|
211
|
+
bookings: [],
|
|
212
|
+
payments: [],
|
|
213
|
+
surcharges: [],
|
|
214
|
+
discount_list: [],
|
|
215
|
+
relation_forms: [],
|
|
216
|
+
contacts: [],
|
|
217
|
+
contacts_info: [],
|
|
218
|
+
holder: null,
|
|
219
|
+
summary,
|
|
220
|
+
metadata: {}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
function buildSubmitPayload(params) {
|
|
224
|
+
const { tempOrder, cacheId, now = /* @__PURE__ */ new Date() } = params;
|
|
225
|
+
const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
226
|
+
const summary = tempOrder.summary || (0, import_utils.createEmptySummary)();
|
|
227
|
+
const relationId = tempOrder.relation_id;
|
|
228
|
+
const tableFormId = tempOrder.table_form_id;
|
|
229
|
+
const bookingUuid = createUuidV4();
|
|
230
|
+
const bookingStart = (0, import_dayjs.default)(now);
|
|
231
|
+
const bookingDuration = resolveTableOccupancyDuration(tempOrder);
|
|
232
|
+
const bookingEnd = bookingStart.add(bookingDuration, "minute");
|
|
233
|
+
const bookings = relationId && tableFormId ? [{
|
|
234
|
+
relation_id: relationId,
|
|
235
|
+
form_id: tableFormId,
|
|
236
|
+
start_time: bookingStart.format("HH:mm"),
|
|
237
|
+
start_date: bookingStart.format("YYYY-MM-DD"),
|
|
238
|
+
end_time: bookingEnd.format("HH:mm"),
|
|
239
|
+
end_date: bookingEnd.format("YYYY-MM-DD"),
|
|
240
|
+
duration: bookingDuration,
|
|
241
|
+
metadata: {
|
|
242
|
+
unique_identification_number: bookingUuid,
|
|
243
|
+
collect_pax: 1
|
|
244
|
+
},
|
|
245
|
+
select_date: bookingStart.format("YYYY-MM-DD"),
|
|
246
|
+
is_all: false,
|
|
247
|
+
"like_status": "common",
|
|
248
|
+
"schedule_id": 0,
|
|
249
|
+
"relation_type": "form",
|
|
250
|
+
"number": 1
|
|
251
|
+
}] : tempOrder.bookings || [];
|
|
252
|
+
const formRecordIds = relationId && tableFormId ? [{
|
|
253
|
+
form_id: tableFormId,
|
|
254
|
+
form_record_ids: [relationId]
|
|
255
|
+
}] : void 0;
|
|
256
|
+
const { created_at: _createdAt, summary: _summary, surcharges: _surcharges, ...tempOrderRest } = tempOrder;
|
|
257
|
+
return {
|
|
258
|
+
...tempOrderRest,
|
|
259
|
+
platform: normalizeSubmitPlatform(tempOrder.platform),
|
|
260
|
+
request_unique_idempotency_token: cacheId,
|
|
261
|
+
type: tempOrder.type || "table-order",
|
|
262
|
+
business_code: tempOrder.business_code || "table-order",
|
|
263
|
+
sales_channel: tempOrder.sales_channel || "my_pisel",
|
|
264
|
+
order_sales_channel: tempOrder.order_sales_channel || "online_store",
|
|
265
|
+
status: tempOrder.status || "normal",
|
|
266
|
+
payment_status: tempOrder.payment_status || "payment_processing",
|
|
267
|
+
// shipping_status: tempOrder.shipping_status || 'unfulfilled',
|
|
268
|
+
is_price_include_tax: tempOrder.is_price_include_tax ?? 1,
|
|
269
|
+
currency_format: tempOrder.currency_format || "symbol_first",
|
|
270
|
+
is_deposit: tempOrder.is_deposit ?? 0,
|
|
271
|
+
deposit_amount: tempOrder.deposit_amount || "0.00",
|
|
272
|
+
shop_discount: tempOrder.shop_discount || "0.00",
|
|
273
|
+
surcharge_fee: summary.surcharge_fee || tempOrder.surcharge_fee || "0.00",
|
|
274
|
+
note: tempOrder.note || "",
|
|
275
|
+
schedule_date: scheduleDate,
|
|
276
|
+
bookings: bookings.map((booking) => normalizeSubmitBooking(booking)),
|
|
277
|
+
payments: tempOrder.payments || [],
|
|
278
|
+
// discount_list: tempOrder.discount_list || [],
|
|
279
|
+
relation_forms: tempOrder.relation_forms || [],
|
|
280
|
+
form_record_ids: formRecordIds,
|
|
281
|
+
// contacts: tempOrder.contacts || [],
|
|
282
|
+
contacts_info: tempOrder.contacts_info || [],
|
|
283
|
+
// holder: tempOrder.holder || null,
|
|
284
|
+
// summary,
|
|
285
|
+
metadata: {
|
|
286
|
+
...tempOrder.metadata
|
|
287
|
+
},
|
|
288
|
+
products: (tempOrder.products || []).map(
|
|
289
|
+
(product) => normalizeSubmitProduct(product)
|
|
290
|
+
)
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function formatV1Product(products) {
|
|
294
|
+
return products.map((product) => {
|
|
295
|
+
return {
|
|
296
|
+
bundle: product.product_bundle,
|
|
297
|
+
key: product.product_id,
|
|
298
|
+
option: product.product_option_item,
|
|
299
|
+
product_id: product.product_id,
|
|
300
|
+
product_variant_id: product.product_variant_id,
|
|
301
|
+
quantity: product.num,
|
|
302
|
+
rowKey: product.product_id,
|
|
303
|
+
session: null,
|
|
304
|
+
unique: createUuidV4()
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
}
|
|
68
308
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
309
|
0 && (module.exports = {
|
|
310
|
+
buildSubmitPayload,
|
|
311
|
+
createDefaultTempOrder,
|
|
312
|
+
createEmptySummary,
|
|
313
|
+
createUuidV4,
|
|
314
|
+
formatDateTime,
|
|
315
|
+
formatV1Product,
|
|
70
316
|
generateDuration,
|
|
71
317
|
getAllDiscountList,
|
|
72
|
-
|
|
318
|
+
isTempOrder,
|
|
319
|
+
mergeRelationForms,
|
|
320
|
+
normalizeSubmitBooking
|
|
73
321
|
});
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -25,10 +25,10 @@ __export(utils_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(utils_exports);
|
|
26
26
|
function isNormalProduct(product) {
|
|
27
27
|
var _a;
|
|
28
|
-
if (product.duration) {
|
|
28
|
+
if (product == null ? void 0 : product.duration) {
|
|
29
29
|
return false;
|
|
30
30
|
}
|
|
31
|
-
if ((_a = product["schedule.ids"]) == null ? void 0 : _a.length) {
|
|
31
|
+
if ((_a = product == null ? void 0 : product["schedule.ids"]) == null ? void 0 : _a.length) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
return true;
|
|
@@ -16,10 +16,10 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
18
18
|
schedule_date?: string;
|
|
19
|
+
schedule_datetime?: string;
|
|
19
20
|
cacheId?: string;
|
|
20
21
|
customer_id?: number;
|
|
21
22
|
menu_list_ids?: number[];
|
|
22
|
-
schedule_datetime?: string;
|
|
23
23
|
with_count?: string[];
|
|
24
24
|
with_schedule?: number;
|
|
25
25
|
}): Promise<any>;
|
|
@@ -100,7 +100,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
100
100
|
schedule_datetime,
|
|
101
101
|
is_eject: 1
|
|
102
102
|
},
|
|
103
|
-
{ useCache: true
|
|
103
|
+
{ useCache: true, customToast: () => {
|
|
104
|
+
} }
|
|
104
105
|
);
|
|
105
106
|
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
106
107
|
this.addProduct(sortedList);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import type { ScheduleItem } from '../Schedule/types';
|
|
4
|
+
import type { QuotationItem } from './types';
|
|
5
|
+
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
|
|
6
|
+
export declare class QuotationModule extends BaseModule implements Module {
|
|
7
|
+
protected defaultName: string;
|
|
8
|
+
protected defaultVersion: string;
|
|
9
|
+
private request;
|
|
10
|
+
private store;
|
|
11
|
+
private scheduleResolver?;
|
|
12
|
+
constructor(name?: string, version?: string);
|
|
13
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
|
+
loadQuotations(params?: {
|
|
15
|
+
channel?: string;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
getQuotationList(): QuotationItem[];
|
|
18
|
+
/**
|
|
19
|
+
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
20
|
+
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
21
|
+
*
|
|
22
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
23
|
+
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
24
|
+
* the requested productId wins.
|
|
25
|
+
*/
|
|
26
|
+
getPriceForProduct(params: {
|
|
27
|
+
productId: number;
|
|
28
|
+
variantId?: number;
|
|
29
|
+
datetime: string;
|
|
30
|
+
}): string | null;
|
|
31
|
+
getQuotationShelfId(params: {
|
|
32
|
+
productId: number;
|
|
33
|
+
variantId?: number;
|
|
34
|
+
datetime: string;
|
|
35
|
+
}): number;
|
|
36
|
+
/**
|
|
37
|
+
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
38
|
+
* Key format: `${productId}:${timePoint}`
|
|
39
|
+
* This avoids repeated schedule matching when the same product appears in multiple resource rows.
|
|
40
|
+
*/
|
|
41
|
+
buildProductPriceMap(params: {
|
|
42
|
+
productIds: number[];
|
|
43
|
+
timePoints: string[];
|
|
44
|
+
}): Map<string, string | null>;
|
|
45
|
+
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
46
|
+
private isQuotationActiveAt;
|
|
47
|
+
private findProductData;
|
|
48
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
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/Quotation/index.ts
|
|
20
|
+
var Quotation_exports = {};
|
|
21
|
+
__export(Quotation_exports, {
|
|
22
|
+
QuotationModule: () => QuotationModule
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Quotation_exports);
|
|
25
|
+
var import_BaseModule = require("../BaseModule");
|
|
26
|
+
var import_getDateIsInSchedule = require("../Schedule/getDateIsInSchedule");
|
|
27
|
+
var QuotationModule = class extends import_BaseModule.BaseModule {
|
|
28
|
+
constructor(name, version) {
|
|
29
|
+
super(name, version);
|
|
30
|
+
this.defaultName = "quotation";
|
|
31
|
+
this.defaultVersion = "1.0.0";
|
|
32
|
+
this.store = { list: [] };
|
|
33
|
+
}
|
|
34
|
+
async initialize(core, options) {
|
|
35
|
+
this.core = core;
|
|
36
|
+
this.request = core.getPlugin("request");
|
|
37
|
+
if (!this.request)
|
|
38
|
+
throw new Error("QuotationModule 需要 request 插件支持");
|
|
39
|
+
this.store = { list: [] };
|
|
40
|
+
}
|
|
41
|
+
async loadQuotations(params) {
|
|
42
|
+
var _a;
|
|
43
|
+
const query = {};
|
|
44
|
+
if (params == null ? void 0 : params.channel)
|
|
45
|
+
query.channel = params.channel;
|
|
46
|
+
const res = await this.request.get(
|
|
47
|
+
"/quotation/available",
|
|
48
|
+
query,
|
|
49
|
+
{ useCache: false }
|
|
50
|
+
);
|
|
51
|
+
const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
|
|
52
|
+
list.sort((a, b) => a.sort - b.sort);
|
|
53
|
+
this.store.list = list;
|
|
54
|
+
}
|
|
55
|
+
getQuotationList() {
|
|
56
|
+
return this.store.list;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
60
|
+
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
61
|
+
*
|
|
62
|
+
* Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
|
|
63
|
+
* First matching quotation whose schedule covers `datetime` and whose product_data contains
|
|
64
|
+
* the requested productId wins.
|
|
65
|
+
*/
|
|
66
|
+
getPriceForProduct(params) {
|
|
67
|
+
const { productId, variantId, datetime } = params;
|
|
68
|
+
for (const quotation of this.store.list) {
|
|
69
|
+
if (!this.isQuotationActiveAt(quotation, datetime))
|
|
70
|
+
continue;
|
|
71
|
+
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
72
|
+
if (!match)
|
|
73
|
+
continue;
|
|
74
|
+
if (match.value === 0)
|
|
75
|
+
continue;
|
|
76
|
+
return String(match.value);
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
getQuotationShelfId(params) {
|
|
81
|
+
const { productId, variantId, datetime } = params;
|
|
82
|
+
for (const quotation of this.store.list) {
|
|
83
|
+
if (!this.isQuotationActiveAt(quotation, datetime))
|
|
84
|
+
continue;
|
|
85
|
+
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
86
|
+
if (!match || match.value === 0)
|
|
87
|
+
continue;
|
|
88
|
+
return quotation.id;
|
|
89
|
+
}
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
94
|
+
* Key format: `${productId}:${timePoint}`
|
|
95
|
+
* This avoids repeated schedule matching when the same product appears in multiple resource rows.
|
|
96
|
+
*/
|
|
97
|
+
buildProductPriceMap(params) {
|
|
98
|
+
const map = /* @__PURE__ */ new Map();
|
|
99
|
+
if (!this.store.list.length)
|
|
100
|
+
return map;
|
|
101
|
+
for (const productId of params.productIds) {
|
|
102
|
+
for (const timePoint of params.timePoints) {
|
|
103
|
+
const key = `${productId}:${timePoint}`;
|
|
104
|
+
const price = this.getPriceForProduct({ productId, datetime: timePoint });
|
|
105
|
+
if (price !== null) {
|
|
106
|
+
map.set(key, price);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return map;
|
|
111
|
+
}
|
|
112
|
+
setScheduleResolver(resolver) {
|
|
113
|
+
this.scheduleResolver = resolver;
|
|
114
|
+
}
|
|
115
|
+
isQuotationActiveAt(quotation, datetime) {
|
|
116
|
+
var _a;
|
|
117
|
+
if (!((_a = quotation.schedule) == null ? void 0 : _a.length))
|
|
118
|
+
return false;
|
|
119
|
+
const scheduleItems = quotation.schedule.map((s) => {
|
|
120
|
+
var _a2;
|
|
121
|
+
const full = (_a2 = this.scheduleResolver) == null ? void 0 : _a2.call(this, s.id);
|
|
122
|
+
if (full)
|
|
123
|
+
return full;
|
|
124
|
+
return {
|
|
125
|
+
...s,
|
|
126
|
+
repeat_type: s.repeat_type || "none",
|
|
127
|
+
repeat_rule: s.repeat_rule || null,
|
|
128
|
+
time_slot: s.time_slot || []
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
return (0, import_getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
|
|
132
|
+
}
|
|
133
|
+
findProductData(productData, productId, variantId) {
|
|
134
|
+
if (variantId && variantId !== 0) {
|
|
135
|
+
const variantMatch = productData.find(
|
|
136
|
+
(p) => p.product_id === productId && p.variant_id === variantId
|
|
137
|
+
);
|
|
138
|
+
if (variantMatch)
|
|
139
|
+
return variantMatch;
|
|
140
|
+
}
|
|
141
|
+
return productData.find(
|
|
142
|
+
(p) => p.product_id === productId && p.variant_id === 0
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
QuotationModule
|
|
149
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface QuotationProductData {
|
|
2
|
+
id: number;
|
|
3
|
+
shelf_id: number;
|
|
4
|
+
product_id: number;
|
|
5
|
+
variant_id: number;
|
|
6
|
+
type: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}
|
|
9
|
+
export interface QuotationSchedule {
|
|
10
|
+
id: number;
|
|
11
|
+
name: string;
|
|
12
|
+
type: 'standard' | 'time-slots' | 'designation';
|
|
13
|
+
start_time: string;
|
|
14
|
+
end_time: string;
|
|
15
|
+
is_all: number;
|
|
16
|
+
repeat_type?: string;
|
|
17
|
+
repeat_rule?: any;
|
|
18
|
+
designation?: any;
|
|
19
|
+
time_slot?: Array<{
|
|
20
|
+
start_time: string;
|
|
21
|
+
end_time: string;
|
|
22
|
+
}>;
|
|
23
|
+
pivot?: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
export interface QuotationItem {
|
|
26
|
+
id: number;
|
|
27
|
+
shop_id: number;
|
|
28
|
+
shelf_type_id?: number;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
status: string;
|
|
32
|
+
sort: number;
|
|
33
|
+
channel: string[];
|
|
34
|
+
created_at?: string;
|
|
35
|
+
updated_at?: string;
|
|
36
|
+
deleted_at?: string | null;
|
|
37
|
+
schedule: QuotationSchedule[];
|
|
38
|
+
product_data: QuotationProductData[];
|
|
39
|
+
}
|
|
40
|
+
export interface QuotationState {
|
|
41
|
+
list: QuotationItem[];
|
|
42
|
+
}
|
|
@@ -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/Quotation/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -731,7 +731,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
731
731
|
bundle: product.bundle,
|
|
732
732
|
options: product.options
|
|
733
733
|
}),
|
|
734
|
-
price: product.price
|
|
734
|
+
price: product.price,
|
|
735
|
+
options: product.options
|
|
735
736
|
},
|
|
736
737
|
discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
|
|
737
738
|
})]
|
|
@@ -750,7 +751,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
750
751
|
price: product.price
|
|
751
752
|
} : {
|
|
752
753
|
_id: product._id.split("___")[0] + "___" + index,
|
|
754
|
+
origin_total: product.origin_total,
|
|
753
755
|
total,
|
|
756
|
+
original_price: product.original_price,
|
|
754
757
|
price: product.price,
|
|
755
758
|
main_product_selling_price
|
|
756
759
|
},
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { SalesSummaryModuleAPI } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare class SalesSummaryModule extends BaseModule implements Module, SalesSummaryModuleAPI {
|
|
6
|
+
protected defaultName: string;
|
|
7
|
+
protected defaultVersion: string;
|
|
8
|
+
private shopStore;
|
|
9
|
+
private store;
|
|
10
|
+
private request;
|
|
11
|
+
constructor(name?: string, version?: string);
|
|
12
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
13
|
+
getSurchargeList(): Promise<void>;
|
|
14
|
+
getSummary(params: {
|
|
15
|
+
products: any[];
|
|
16
|
+
isPriceIncludeTax?: number;
|
|
17
|
+
taxRate?: number;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
tax_title: any;
|
|
20
|
+
tax_rate: any;
|
|
21
|
+
product_quantity: number;
|
|
22
|
+
product_original_amount: string;
|
|
23
|
+
product_amount: string;
|
|
24
|
+
product_expect_amount: string;
|
|
25
|
+
product_tax_fee: string;
|
|
26
|
+
shipping_fee: string;
|
|
27
|
+
shipping_tax_fee: string;
|
|
28
|
+
tax_fee: string;
|
|
29
|
+
surcharge_fee: string;
|
|
30
|
+
surcharges: any[];
|
|
31
|
+
discount_amount: string;
|
|
32
|
+
deposit_amount: string;
|
|
33
|
+
deposit?: import("./types").DepositInfo | undefined;
|
|
34
|
+
expect_amount: string;
|
|
35
|
+
total_amount: string;
|
|
36
|
+
amount_gap: string;
|
|
37
|
+
rounding_amount: string;
|
|
38
|
+
pay_service_charge_amount: string;
|
|
39
|
+
is_price_include_tax?: number | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
tax_title: any;
|
|
42
|
+
tax_rate: any;
|
|
43
|
+
product_quantity: number;
|
|
44
|
+
product_original_amount: string;
|
|
45
|
+
product_amount: string;
|
|
46
|
+
product_expect_amount: string;
|
|
47
|
+
product_tax_fee: string;
|
|
48
|
+
shipping_fee: string;
|
|
49
|
+
shipping_tax_fee: string;
|
|
50
|
+
tax_fee: string;
|
|
51
|
+
surcharge_fee: string;
|
|
52
|
+
surcharges: any;
|
|
53
|
+
discount_amount: string;
|
|
54
|
+
deposit_amount: string;
|
|
55
|
+
deposit: import("./types").DepositInfo | undefined;
|
|
56
|
+
expect_amount: string;
|
|
57
|
+
total_amount: string;
|
|
58
|
+
amount_gap: string;
|
|
59
|
+
rounding_amount: string;
|
|
60
|
+
pay_service_charge_amount: string;
|
|
61
|
+
is_price_include_tax: number;
|
|
62
|
+
}>;
|
|
63
|
+
}
|