@pisell/pisellos 2.1.151 → 2.1.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +26 -99
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +8 -61
- package/dist/model/strategy/adapter/walletPass/locales.js +3 -12
- package/dist/model/strategy/engine.d.ts +5 -18
- package/dist/model/strategy/engine.js +45 -145
- package/dist/model/strategy/type.d.ts +0 -17
- package/dist/model/strategy/type.js +0 -4
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Discount/index.d.ts +9 -3
- package/dist/modules/Discount/index.js +103 -11
- package/dist/modules/Discount/types.d.ts +8 -19
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +66 -1
- package/dist/modules/Order/index.js +906 -30
- package/dist/modules/Order/types.d.ts +174 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +118 -0
- package/dist/modules/Order/utils.js +586 -2
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -3
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +5 -9
- package/dist/modules/Rules/index.js +168 -677
- package/dist/modules/Rules/types.d.ts +0 -2
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +41 -52
- package/dist/modules/index.d.ts +4 -0
- package/dist/modules/index.js +5 -1
- package/dist/plugins/window.d.ts +0 -2
- package/dist/solution/BookingByStep/index.d.ts +1 -2
- package/dist/solution/BookingByStep/index.js +46 -43
- package/dist/solution/BookingByStep/types.d.ts +3 -1
- package/dist/solution/BookingByStep/types.js +5 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +152 -0
- package/dist/solution/ScanOrder/index.js +3132 -0
- package/dist/solution/ScanOrder/types.d.ts +287 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +167 -0
- package/dist/solution/ScanOrder/utils.js +764 -0
- package/dist/solution/ShopDiscount/index.d.ts +3 -2
- package/dist/solution/ShopDiscount/index.js +60 -59
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.js +12 -26
- package/dist/solution/VenueBooking/index.d.ts +200 -0
- package/dist/solution/VenueBooking/index.js +3459 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +154 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/promotion/evaluator.js +8 -57
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +3 -34
- package/lib/model/strategy/adapter/walletPass/locales.js +3 -12
- package/lib/model/strategy/engine.d.ts +5 -18
- package/lib/model/strategy/engine.js +21 -85
- package/lib/model/strategy/type.d.ts +0 -17
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Discount/index.d.ts +9 -3
- package/lib/modules/Discount/index.js +65 -4
- package/lib/modules/Discount/types.d.ts +8 -19
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +66 -1
- package/lib/modules/Order/index.js +515 -1
- package/lib/modules/Order/types.d.ts +174 -12
- package/lib/modules/Order/utils.d.ts +118 -0
- package/lib/modules/Order/utils.js +483 -2
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -3
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +5 -9
- package/lib/modules/Rules/index.js +288 -780
- package/lib/modules/Rules/types.d.ts +0 -2
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +22 -31
- package/lib/modules/index.d.ts +4 -0
- package/lib/modules/index.js +9 -1
- package/lib/plugins/window.d.ts +0 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -2
- package/lib/solution/BookingByStep/index.js +6 -4
- package/lib/solution/BookingByStep/types.d.ts +3 -1
- package/lib/solution/BookingByStep/types.js +10 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +152 -0
- package/lib/solution/ScanOrder/index.js +1901 -0
- package/lib/solution/ScanOrder/types.d.ts +287 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +167 -0
- package/lib/solution/ScanOrder/utils.js +635 -0
- package/lib/solution/ShopDiscount/index.d.ts +3 -2
- package/lib/solution/ShopDiscount/index.js +19 -25
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/VenueBooking/index.d.ts +200 -0
- package/lib/solution/VenueBooking/index.js +1926 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +154 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
57
57
|
currentBookingTime: "",
|
|
58
58
|
filteredDiscountList: [],
|
|
59
59
|
bookingSubject: void 0,
|
|
60
|
-
|
|
60
|
+
orderId: void 0
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
// =========== 生命周期方法 ===========
|
|
@@ -195,9 +195,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
setOriginTotalAmount(amount) {
|
|
199
|
-
this.store.orderTotalAmount = amount;
|
|
200
|
-
}
|
|
201
198
|
// 设置holders
|
|
202
199
|
setHolders(holders) {
|
|
203
200
|
this.store.holders = holders;
|
|
@@ -205,6 +202,9 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
205
202
|
setBookingSubject(bookingSubject) {
|
|
206
203
|
this.store.bookingSubject = bookingSubject;
|
|
207
204
|
}
|
|
205
|
+
setOrderId(id) {
|
|
206
|
+
this.store.orderId = id;
|
|
207
|
+
}
|
|
208
208
|
// 计算优惠券
|
|
209
209
|
calcDiscount(productList, options) {
|
|
210
210
|
var _a;
|
|
@@ -217,7 +217,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
217
217
|
{
|
|
218
218
|
productList,
|
|
219
219
|
discountList: this.getDiscountList(),
|
|
220
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
221
220
|
holders: this.store.holders || [],
|
|
222
221
|
isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
|
|
223
222
|
},
|
|
@@ -282,7 +281,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
282
281
|
async scanCode(code, customerId) {
|
|
283
282
|
var _a, _b, _c;
|
|
284
283
|
try {
|
|
285
|
-
const
|
|
284
|
+
const resultDiscountWithReason = await ((_a = this.store.discount) == null ? void 0 : _a.batchSearch(code, { customerId, orderId: this.store.orderId })) || { discountList: [], unavailableReasonKey: null };
|
|
285
|
+
const { discountList: resultDiscountList, unavailableReasonKey } = resultDiscountWithReason;
|
|
286
286
|
const rulesModule = this.store.rules;
|
|
287
287
|
if (!rulesModule) {
|
|
288
288
|
return {
|
|
@@ -298,7 +298,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
298
298
|
type: "server",
|
|
299
299
|
isAvailable: false,
|
|
300
300
|
productList: this.store.productList || [],
|
|
301
|
-
discountList: this.getDiscountList()
|
|
301
|
+
discountList: this.getDiscountList(),
|
|
302
|
+
unavailableReasonKey
|
|
302
303
|
};
|
|
303
304
|
}
|
|
304
305
|
const withScanList = resultDiscountList.map((item) => {
|
|
@@ -325,7 +326,6 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
325
326
|
productList: this.store.productList || [],
|
|
326
327
|
oldDiscountList: this.getDiscountList(),
|
|
327
328
|
newDiscountList: withScanList,
|
|
328
|
-
orderTotalAmount: this.store.orderTotalAmount || 0,
|
|
329
329
|
holders: this.store.holders || [],
|
|
330
330
|
isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
|
|
331
331
|
}) || {
|
|
@@ -394,7 +394,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
394
394
|
if (item.booking_id) {
|
|
395
395
|
const product = (_a2 = this.hooks) == null ? void 0 : _a2.getProduct(item);
|
|
396
396
|
(item.discount_list || []).forEach((discount) => {
|
|
397
|
-
var _a3, _b, _c, _d, _e
|
|
397
|
+
var _a3, _b, _c, _d, _e;
|
|
398
398
|
if (discount.id && ["good_pass", "discount_card"].includes(discount.type)) {
|
|
399
399
|
const index = editModeDiscountList.findIndex((n) => {
|
|
400
400
|
var _a4;
|
|
@@ -403,12 +403,8 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
403
403
|
if (index !== -1) {
|
|
404
404
|
editModeDiscountList[index] = {
|
|
405
405
|
...editModeDiscountList[index],
|
|
406
|
-
metadata: {
|
|
407
|
-
...discount.metadata || {},
|
|
408
|
-
num: (((_b = (_a3 = editModeDiscountList == null ? void 0 : editModeDiscountList[index]) == null ? void 0 : _a3.metadata) == null ? void 0 : _b.num) || 1) + (((_c = discount.metadata) == null ? void 0 : _c.num) || 1)
|
|
409
|
-
},
|
|
410
406
|
amount: new import_decimal.default(discount.amount || 0).plus(new import_decimal.default(editModeDiscountList[index].amount || 0)).toNumber(),
|
|
411
|
-
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((
|
|
407
|
+
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_a3 = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a3.product_discount_difference) || 0).plus(new import_decimal.default(editModeDiscountList[index].savedAmount || 0)).toNumber()
|
|
412
408
|
};
|
|
413
409
|
} else {
|
|
414
410
|
if (discount.type && !discount.tag) {
|
|
@@ -416,20 +412,16 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
416
412
|
}
|
|
417
413
|
editModeDiscountList.push({
|
|
418
414
|
...discount,
|
|
419
|
-
metadata: {
|
|
420
|
-
...discount.metadata || {},
|
|
421
|
-
num: ((_e = discount.metadata) == null ? void 0 : _e.num) || 1
|
|
422
|
-
},
|
|
423
415
|
name: discount.name || discount.discount.title.auto,
|
|
424
416
|
isEditMode: true,
|
|
425
417
|
limited_relation_product_data: {},
|
|
426
|
-
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((
|
|
418
|
+
savedAmount: new import_decimal.default(discount.amount || 0).times((product == null ? void 0 : product.quantity) || (product == null ? void 0 : product.num) || 1).plus(((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.product_discount_difference) || 0).toNumber(),
|
|
427
419
|
isAvailable: true,
|
|
428
|
-
id: ((
|
|
429
|
-
format_title: ((
|
|
420
|
+
id: ((_c = discount.discount) == null ? void 0 : _c.resource_id) || discount.id,
|
|
421
|
+
format_title: ((_d = discount.discount) == null ? void 0 : _d.title) || discount.format_title,
|
|
430
422
|
isDisabled: true,
|
|
431
423
|
isSelected: true,
|
|
432
|
-
product_id: ((
|
|
424
|
+
product_id: ((_e = discount.discount) == null ? void 0 : _e.product_id) || discount.product_id
|
|
433
425
|
});
|
|
434
426
|
}
|
|
435
427
|
}
|
|
@@ -517,14 +509,16 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
517
509
|
async loadPrepareConfig(params) {
|
|
518
510
|
var _a, _b, _c, _d, _e;
|
|
519
511
|
try {
|
|
512
|
+
const orderId = this.store.orderId;
|
|
520
513
|
const customerId = params.customerId || ((_a = this.getCustomer()) == null ? void 0 : _a.id);
|
|
521
514
|
const goodPassList = await ((_b = this.store.discount) == null ? void 0 : _b.loadPrepareConfig({
|
|
522
515
|
customer_id: customerId,
|
|
523
|
-
action: "create",
|
|
516
|
+
action: orderId ? "edit" : "create",
|
|
524
517
|
with_good_pass: 1,
|
|
525
518
|
with_discount_card: 1,
|
|
526
519
|
with_wallet_pass_holder: 1,
|
|
527
|
-
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
520
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
521
|
+
...orderId ? { order_id: orderId } : {}
|
|
528
522
|
}));
|
|
529
523
|
const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
|
|
530
524
|
(item) => item.isScan
|
|
@@ -546,7 +540,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
546
540
|
}
|
|
547
541
|
await this.core.effects.emit(
|
|
548
542
|
`${this.name}:onLoadDiscountList`,
|
|
549
|
-
|
|
543
|
+
filteredDiscountList
|
|
550
544
|
);
|
|
551
545
|
} catch (error) {
|
|
552
546
|
console.error("[ShopDiscount] 加载准备配置出错:", error);
|
|
@@ -23,7 +23,6 @@ export interface ShopDiscountState {
|
|
|
23
23
|
discount: DiscountModule | null;
|
|
24
24
|
rules: RulesModule | null;
|
|
25
25
|
productList: Record<string, any>[];
|
|
26
|
-
orderTotalAmount?: number;
|
|
27
26
|
holders?: {
|
|
28
27
|
form_record_id: number;
|
|
29
28
|
form_id?: number;
|
|
@@ -36,6 +35,7 @@ export interface ShopDiscountState {
|
|
|
36
35
|
type?: 'form' | 'customer';
|
|
37
36
|
[key: string]: any;
|
|
38
37
|
};
|
|
38
|
+
orderId?: number;
|
|
39
39
|
}
|
|
40
40
|
export interface SetDiscountSelectedParams {
|
|
41
41
|
discountId: number;
|
|
@@ -56,18 +56,14 @@ var isAllNormalProduct = (items) => {
|
|
|
56
56
|
};
|
|
57
57
|
var getDiscountAmount = (discount, total, price) => {
|
|
58
58
|
var _a;
|
|
59
|
-
let discountedPrice = 0;
|
|
60
59
|
if (discount.tag === "good_pass") {
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} else {
|
|
67
|
-
discountedPrice = new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
|
|
68
|
-
}
|
|
60
|
+
return new import_decimal.default(price).minus(new import_decimal.default(price || 0)).toNumber();
|
|
61
|
+
}
|
|
62
|
+
const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
|
|
63
|
+
if (isFixedAmount) {
|
|
64
|
+
return Math.max(new import_decimal.default(price).minus(new import_decimal.default((discount.amount ?? discount.par_value) || 0)).toNumber(), 0);
|
|
69
65
|
}
|
|
70
|
-
return
|
|
66
|
+
return new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
|
|
71
67
|
};
|
|
72
68
|
var getDiscountListAmountTotal = (discount) => {
|
|
73
69
|
return discount.reduce((acc, cur) => {
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
|
|
4
|
+
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
|
|
5
|
+
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
6
|
+
import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
7
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
8
|
+
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
9
|
+
import type { StrategyConfig } from '../../model/strategy/type';
|
|
10
|
+
export * from './types';
|
|
11
|
+
interface VenueBookingItemRuleRuntimeConfig {
|
|
12
|
+
strategyConfigs?: StrategyConfig[];
|
|
13
|
+
pax?: Partial<PaxInfo>;
|
|
14
|
+
historicalItems?: CartItemSummary[];
|
|
15
|
+
serviceType?: string;
|
|
16
|
+
submissionIndex?: number;
|
|
17
|
+
custom?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
20
|
+
protected defaultName: string;
|
|
21
|
+
protected defaultVersion: string;
|
|
22
|
+
isSolution: boolean;
|
|
23
|
+
private initializeOptions;
|
|
24
|
+
private store;
|
|
25
|
+
private otherParams;
|
|
26
|
+
private cacheId;
|
|
27
|
+
private window;
|
|
28
|
+
private request;
|
|
29
|
+
private baseSlotConfig;
|
|
30
|
+
private itemRuleEvaluator;
|
|
31
|
+
private itemRuleConfigs;
|
|
32
|
+
private itemRuleConfigsPromise;
|
|
33
|
+
private itemRulePrefillApplied;
|
|
34
|
+
private itemRuleRuntimeConfig;
|
|
35
|
+
private resourceProductMap;
|
|
36
|
+
private loginEffectDisposers;
|
|
37
|
+
private customerLoginRefreshInFlight;
|
|
38
|
+
private customerLoginRefreshIdInFlight;
|
|
39
|
+
private loadAllProductsInFlight;
|
|
40
|
+
private productsLoaded;
|
|
41
|
+
private loadOpenDataConfigInFlight;
|
|
42
|
+
private static readonly OPEN_DATA_CACHE_TTL;
|
|
43
|
+
private getLoggerContext;
|
|
44
|
+
private safeStringify;
|
|
45
|
+
private pickErrorMessage;
|
|
46
|
+
private serializeError;
|
|
47
|
+
private addVenueBookingLog;
|
|
48
|
+
private logMethodStart;
|
|
49
|
+
private logMethodSuccess;
|
|
50
|
+
private logMethodError;
|
|
51
|
+
addLog(params: VenueBookingAddLogParams): Promise<void>;
|
|
52
|
+
constructor(name?: string, version?: string);
|
|
53
|
+
private normalizeCustomerId;
|
|
54
|
+
private resolveCustomerIdFromLoginPayload;
|
|
55
|
+
private clearLoginEffectListeners;
|
|
56
|
+
private registerLoginEffect;
|
|
57
|
+
private registerCustomerLoginListeners;
|
|
58
|
+
private refreshOrderMarketingAfterLogin;
|
|
59
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
|
+
destroy(): Promise<void>;
|
|
61
|
+
retryInit(): Promise<void>;
|
|
62
|
+
refresh(): Promise<void>;
|
|
63
|
+
getStatus(): import("./types").VenueBookingStatus;
|
|
64
|
+
getEntryContext(): import("./types").VenueBookingEntryContext | null;
|
|
65
|
+
getItemRuleQuantityLimits(): QuantityLimitResult[];
|
|
66
|
+
getCartValidationPassed(): boolean | null;
|
|
67
|
+
getCartValidation(): {
|
|
68
|
+
passed: boolean | null;
|
|
69
|
+
failures: QuantityCheckResult[];
|
|
70
|
+
};
|
|
71
|
+
loadAllProducts(): Promise<{
|
|
72
|
+
venueProducts: ProductData[];
|
|
73
|
+
addonProducts: ProductData[];
|
|
74
|
+
}>;
|
|
75
|
+
private _doLoadAllProducts;
|
|
76
|
+
loadVenueProducts(): Promise<ProductData[]>;
|
|
77
|
+
loadAddonProducts(): Promise<ProductData[]>;
|
|
78
|
+
getVenueProducts(): ProductData[];
|
|
79
|
+
getAddonProductsList(): ProductData[];
|
|
80
|
+
loadQuotations(params?: {
|
|
81
|
+
channel?: string;
|
|
82
|
+
}): Promise<void>;
|
|
83
|
+
fetchResourceAvailability(params: {
|
|
84
|
+
startDate: string;
|
|
85
|
+
endDate: string;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
private getOperatingHoursScheduleIds;
|
|
88
|
+
private resolveSlotConfigForDate;
|
|
89
|
+
private syncOperatingHoursToSlotConfig;
|
|
90
|
+
getDateRangeSummary(params: {
|
|
91
|
+
startDate: string;
|
|
92
|
+
endDate: string;
|
|
93
|
+
}): VenueDateSummaryItem[];
|
|
94
|
+
getTimeSlotGrid(date: string): VenueTimeSlotGrid;
|
|
95
|
+
/**
|
|
96
|
+
* 切换单个时段的选中状态(选中/取消)。
|
|
97
|
+
* 内部自动处理连续时段的合并与拆分,订单是唯一真相源。
|
|
98
|
+
*
|
|
99
|
+
* slot.productId 指定当前操作针对的是该 resourceId 下的哪一个商品。
|
|
100
|
+
* 同一资源下不同 productId 之间互相隔离,不会相互合并。
|
|
101
|
+
*/
|
|
102
|
+
toggleSlot(slot: VenueSlotSelection): Promise<ScanOrderOrderProduct[]>;
|
|
103
|
+
/**
|
|
104
|
+
* 获取某资源当前选中的所有独立时段(从订单中解析)。
|
|
105
|
+
* 不传 productId 时返回该资源下所有商品的选中时段;传了则精确匹配。
|
|
106
|
+
*/
|
|
107
|
+
getSelectedSlotsForResource(resourceId: number | string, productId?: number): VenueSlotSelection[];
|
|
108
|
+
/** getSelectedSlotsForResource 的 (resourceId, productId) 精确版,内部使用。 */
|
|
109
|
+
private getSelectedSlotsForResourceProduct;
|
|
110
|
+
/**
|
|
111
|
+
* 判断某个时段是否已选中。
|
|
112
|
+
* 不传 productId 时:只要该资源下任一商品在 startTime 被选中即返回 true;传了则精确匹配。
|
|
113
|
+
*/
|
|
114
|
+
isSlotSelected(resourceId: number | string, startTime: string, productId?: number): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* 判断指定 (resourceId, productId, startTime) 格子是否应因其它已选项而被禁用。
|
|
117
|
+
* 规则:
|
|
118
|
+
* 1) 同一 resourceId 下若已选了另一个 productId 的同 startTime → 禁用
|
|
119
|
+
* 2) 当前 resource 是组合资源:若其任一 child resource 在 startTime 被选中 → 禁用
|
|
120
|
+
* 3) 当前 resource 是某些组合资源的 child:若该组合资源在 startTime 被选中 → 禁用
|
|
121
|
+
* 4) 两个组合资源的 child 集合有交集,且对方在该 startTime 被选中 → 禁用
|
|
122
|
+
*/
|
|
123
|
+
isSlotDisabledBySelection(params: {
|
|
124
|
+
resourceId: number | string;
|
|
125
|
+
productId: number;
|
|
126
|
+
startTime: string;
|
|
127
|
+
}): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* 获取所有已选时段(按资源分组)。每个 slot 上带 productId,便于 UI 做 per-product 判定。
|
|
130
|
+
*/
|
|
131
|
+
getAllSelectedSlots(): Map<number | string, VenueSlotSelection[]>;
|
|
132
|
+
/**
|
|
133
|
+
* 对指定 (resourceId, productId) 的订单商品进行 reconcile:
|
|
134
|
+
* 清除旧商品 → 合并连续时段 → 重新写入。
|
|
135
|
+
* 同一场地下不同商品互不干扰,各自单独 reconcile。
|
|
136
|
+
*/
|
|
137
|
+
private reconcileOrderForResourceProduct;
|
|
138
|
+
/** 给定一个父 rawResource,返回其 combined_resource.resource_ids 对应的子 rawResource 列表。 */
|
|
139
|
+
private getCombinedChildRawResources;
|
|
140
|
+
setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
|
|
141
|
+
getSlotConfig(): VenueBookingSlotConfig;
|
|
142
|
+
loadSchedules(): Promise<void>;
|
|
143
|
+
private injectScheduleResolverToQuotation;
|
|
144
|
+
getScheduleListByIds(ids: number[]): import("../../modules/Schedule/types").ScheduleItem[];
|
|
145
|
+
getTempOrder(): import("./types").ScanOrderTempOrder | null;
|
|
146
|
+
updateTempOrderNote(note: string): string;
|
|
147
|
+
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
148
|
+
private ensureTempOrder;
|
|
149
|
+
onCustomerLogin(params: {
|
|
150
|
+
customerId: number;
|
|
151
|
+
}): Promise<void>;
|
|
152
|
+
private recalculateOrderPricesFromQuotation;
|
|
153
|
+
scanCode(code: string, customerId?: number): Promise<{
|
|
154
|
+
isAvailable: boolean;
|
|
155
|
+
discountList: import("../../modules/Discount").Discount[];
|
|
156
|
+
type: "server" | "clientCalc";
|
|
157
|
+
unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
|
|
158
|
+
unavailableReasonKey?: string | null | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
/** 获取当前折扣列表(包装 order.getDiscountList) */
|
|
161
|
+
getDiscountList(): import("../../modules/Discount").Discount[];
|
|
162
|
+
/** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
|
|
163
|
+
setDiscountSelected(params: {
|
|
164
|
+
discountId: number;
|
|
165
|
+
isSelected: boolean;
|
|
166
|
+
}): Promise<import("../../modules/Discount").Discount[]>;
|
|
167
|
+
addNewOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
168
|
+
getOrderProducts(): ScanOrderOrderProduct[];
|
|
169
|
+
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
170
|
+
submitOrder<T = any>(): Promise<T>;
|
|
171
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
172
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
173
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
174
|
+
getProductList(): Promise<ProductData[]>;
|
|
175
|
+
private loadOpenDataConfig;
|
|
176
|
+
private loadRuntimeConfigs;
|
|
177
|
+
private fetchItemRuleConfigsByModelIds;
|
|
178
|
+
private buildPrefillProductSourceMap;
|
|
179
|
+
private getItemRuleRuntimeConfig;
|
|
180
|
+
private ensureItemRuleConfigsLoaded;
|
|
181
|
+
private refreshItemRuleQuantityLimits;
|
|
182
|
+
private applyPrefillByItemRule;
|
|
183
|
+
applyItemRulePrefill(): Promise<void>;
|
|
184
|
+
private evaluateCartValidationByItemRule;
|
|
185
|
+
private validateBeforeSubmitByItemRule;
|
|
186
|
+
private refreshCartValidationPassed;
|
|
187
|
+
setItemRuleRuntimeConfig(config?: VenueBookingItemRuleRuntimeConfig): Promise<void>;
|
|
188
|
+
getOtherParams(): Record<string, any>;
|
|
189
|
+
private static readonly UI_STATE_KEY_PREFIX;
|
|
190
|
+
private getUIStateBucketKey;
|
|
191
|
+
private readUIStateBucket;
|
|
192
|
+
private writeUIStateBucket;
|
|
193
|
+
setUIState(key: string, value: any): void;
|
|
194
|
+
getUIState<T = any>(key: string): T | undefined;
|
|
195
|
+
deleteUIState(key: string): void;
|
|
196
|
+
checkOpenDataAvailability(): Promise<OpenDataAvailabilityResult>;
|
|
197
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
198
|
+
cover?: boolean;
|
|
199
|
+
}): Promise<void>;
|
|
200
|
+
}
|