@pisell/pisellos 2.1.172 → 2.1.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apis/picoding.d.ts +0 -0
- package/dist/apis/picoding.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/model/strategy/adapter/promotion/evaluator.js +26 -99
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +12 -63
- package/dist/model/strategy/adapter/walletPass/locales.js +3 -12
- package/dist/model/strategy/engine.d.ts +5 -18
- package/dist/model/strategy/engine.js +45 -145
- package/dist/model/strategy/type.d.ts +0 -17
- package/dist/model/strategy/type.js +0 -4
- package/dist/modules/Cart/types.d.ts +0 -2
- package/dist/modules/Cart/utils/cartProduct.js +25 -56
- package/dist/modules/Cart/utils/changePrice.js +16 -9
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +52 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/entitlementState.d.ts +8 -0
- package/dist/modules/Discount/entitlementState.js +205 -0
- package/dist/modules/Discount/index.d.ts +12 -3
- package/dist/modules/Discount/index.js +211 -17
- package/dist/modules/Discount/types.d.ts +42 -22
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +24 -0
- package/dist/modules/OpenData/index.js +173 -0
- package/dist/modules/OpenData/types.d.ts +73 -0
- package/dist/modules/OpenData/types.js +1 -0
- package/dist/modules/OpenData/utils.d.ts +2 -0
- package/dist/modules/OpenData/utils.js +75 -0
- package/dist/modules/Order/index.d.ts +67 -1
- package/dist/modules/Order/index.js +923 -30
- package/dist/modules/Order/types.d.ts +176 -12
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +128 -0
- package/dist/modules/Order/utils.js +621 -5
- package/dist/modules/Payment/index.d.ts +1 -2
- package/dist/modules/Payment/index.js +7 -10
- package/dist/modules/Payment/utils.js +0 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -23
- package/dist/modules/Payment/walletpass.js +95 -191
- package/dist/modules/Product/types.d.ts +7 -0
- package/dist/modules/Product/utils.js +2 -2
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -3
- package/dist/modules/Quotation/index.d.ts +48 -0
- package/dist/modules/Quotation/index.js +248 -0
- package/dist/modules/Quotation/types.d.ts +42 -0
- package/dist/modules/Quotation/types.js +1 -0
- package/dist/modules/Rules/entitlementLines.d.ts +8 -0
- package/dist/modules/Rules/entitlementLines.js +157 -0
- package/dist/modules/Rules/index.d.ts +17 -11
- package/dist/modules/Rules/index.js +495 -726
- package/dist/modules/Rules/types.d.ts +2 -4
- package/dist/modules/SalesSummary/index.d.ts +63 -0
- package/dist/modules/SalesSummary/index.js +174 -0
- package/dist/modules/SalesSummary/types.d.ts +60 -0
- package/dist/modules/SalesSummary/types.js +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +30 -0
- package/dist/modules/SalesSummary/utils.js +480 -0
- package/dist/modules/ScanOrderLogger/index.d.ts +23 -0
- package/dist/modules/ScanOrderLogger/index.js +174 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.js +221 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.js +50 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/ScanOrderLogger/types.js +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.js +11 -18
- package/dist/modules/Schedule/utils.d.ts +1 -1
- package/dist/modules/Summary/types.d.ts +0 -2
- package/dist/modules/Summary/utils.d.ts +3 -9
- package/dist/modules/Summary/utils.js +67 -57
- package/dist/modules/index.d.ts +5 -0
- package/dist/modules/index.js +6 -1
- package/dist/plugins/window.d.ts +3 -2
- package/dist/solution/BookingByStep/index.d.ts +17 -3
- package/dist/solution/BookingByStep/index.js +322 -247
- package/dist/solution/BookingByStep/types.d.ts +4 -1
- package/dist/solution/BookingByStep/types.js +7 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/Checkout/index.js +0 -2
- package/dist/solution/ScanOrder/index.d.ts +158 -0
- package/dist/solution/ScanOrder/index.js +3474 -0
- package/dist/solution/ScanOrder/types.d.ts +307 -0
- package/dist/solution/ScanOrder/types.js +35 -0
- package/dist/solution/ScanOrder/utils.d.ts +172 -0
- package/dist/solution/ScanOrder/utils.js +796 -0
- package/dist/solution/ShopDiscount/index.d.ts +6 -2
- package/dist/solution/ShopDiscount/index.js +194 -110
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.js +1 -2
- package/dist/solution/ShopDiscount/utils.d.ts +1 -0
- package/dist/solution/ShopDiscount/utils.js +52 -27
- package/dist/solution/VenueBooking/index.d.ts +225 -0
- package/dist/solution/VenueBooking/index.js +3749 -0
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/dist/solution/VenueBooking/types.d.ts +156 -0
- package/dist/solution/VenueBooking/types.js +21 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +104 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/dist/solution/VenueBooking/utils/resource.js +131 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +239 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +453 -0
- package/dist/solution/VenueBooking/utils.d.ts +1 -0
- package/dist/solution/VenueBooking/utils.js +1 -0
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/apis/picoding.js +0 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/model/strategy/adapter/promotion/evaluator.js +8 -57
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +7 -36
- package/lib/model/strategy/adapter/walletPass/locales.js +3 -12
- package/lib/model/strategy/engine.d.ts +5 -18
- package/lib/model/strategy/engine.js +21 -85
- package/lib/model/strategy/type.d.ts +0 -17
- package/lib/modules/Cart/types.d.ts +0 -2
- package/lib/modules/Cart/utils/cartProduct.js +12 -39
- package/lib/modules/Cart/utils/changePrice.js +13 -9
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +91 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +184 -0
- package/lib/modules/Discount/entitlementState.d.ts +8 -0
- package/lib/modules/Discount/entitlementState.js +206 -0
- package/lib/modules/Discount/index.d.ts +12 -3
- package/lib/modules/Discount/index.js +123 -12
- package/lib/modules/Discount/types.d.ts +42 -22
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +24 -0
- package/lib/modules/OpenData/index.js +119 -0
- package/lib/modules/OpenData/types.d.ts +73 -0
- package/lib/modules/OpenData/types.js +17 -0
- package/lib/modules/OpenData/utils.d.ts +2 -0
- package/lib/modules/OpenData/utils.js +111 -0
- package/lib/modules/Order/index.d.ts +67 -1
- package/lib/modules/Order/index.js +529 -1
- package/lib/modules/Order/types.d.ts +176 -12
- package/lib/modules/Order/utils.d.ts +128 -0
- package/lib/modules/Order/utils.js +514 -2
- package/lib/modules/Payment/index.d.ts +1 -2
- package/lib/modules/Payment/index.js +0 -1
- package/lib/modules/Payment/utils.js +0 -3
- package/lib/modules/Payment/walletpass.d.ts +0 -23
- package/lib/modules/Payment/walletpass.js +17 -94
- package/lib/modules/Product/types.d.ts +7 -0
- package/lib/modules/Product/utils.js +2 -2
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +5 -4
- package/lib/modules/Quotation/index.d.ts +48 -0
- package/lib/modules/Quotation/index.js +152 -0
- package/lib/modules/Quotation/types.d.ts +42 -0
- package/lib/modules/Quotation/types.js +17 -0
- package/lib/modules/Rules/entitlementLines.d.ts +8 -0
- package/lib/modules/Rules/entitlementLines.js +158 -0
- package/lib/modules/Rules/index.d.ts +17 -11
- package/lib/modules/Rules/index.js +548 -798
- package/lib/modules/Rules/types.d.ts +2 -4
- package/lib/modules/SalesSummary/index.d.ts +63 -0
- package/lib/modules/SalesSummary/index.js +105 -0
- package/lib/modules/SalesSummary/types.d.ts +60 -0
- package/lib/modules/SalesSummary/types.js +17 -0
- package/lib/modules/SalesSummary/utils.d.ts +30 -0
- package/lib/modules/SalesSummary/utils.js +420 -0
- package/lib/modules/ScanOrderLogger/index.d.ts +23 -0
- package/lib/modules/ScanOrderLogger/index.js +147 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.js +157 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.js +52 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/ScanOrderLogger/types.js +17 -0
- package/lib/modules/Schedule/getDateIsInSchedule.js +9 -11
- package/lib/modules/Schedule/utils.d.ts +1 -1
- package/lib/modules/Summary/types.d.ts +0 -2
- package/lib/modules/Summary/utils.d.ts +3 -9
- package/lib/modules/Summary/utils.js +45 -34
- package/lib/modules/index.d.ts +5 -0
- package/lib/modules/index.js +11 -1
- package/lib/plugins/window.d.ts +3 -2
- package/lib/solution/BookingByStep/index.d.ts +17 -3
- package/lib/solution/BookingByStep/index.js +45 -4
- package/lib/solution/BookingByStep/types.d.ts +4 -1
- package/lib/solution/BookingByStep/types.js +15 -0
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/Checkout/index.js +0 -2
- package/lib/solution/ScanOrder/index.d.ts +158 -0
- package/lib/solution/ScanOrder/index.js +2135 -0
- package/lib/solution/ScanOrder/types.d.ts +307 -0
- package/lib/solution/ScanOrder/types.js +36 -0
- package/lib/solution/ScanOrder/utils.d.ts +172 -0
- package/lib/solution/ScanOrder/utils.js +658 -0
- package/lib/solution/ShopDiscount/index.d.ts +6 -2
- package/lib/solution/ShopDiscount/index.js +94 -50
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +1 -0
- package/lib/solution/ShopDiscount/utils.js +48 -11
- package/lib/solution/VenueBooking/index.d.ts +225 -0
- package/lib/solution/VenueBooking/index.js +2073 -0
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +343 -0
- package/lib/solution/VenueBooking/types.d.ts +156 -0
- package/lib/solution/VenueBooking/types.js +44 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +11 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +110 -0
- package/lib/solution/VenueBooking/utils/resource.d.ts +14 -0
- package/lib/solution/VenueBooking/utils/resource.js +92 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +38 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +237 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +32 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +339 -0
- package/lib/solution/VenueBooking/utils.d.ts +1 -0
- package/lib/solution/VenueBooking/utils.js +69 -0
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -89,6 +89,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
89
89
|
}
|
|
90
90
|
const moduleArr = [
|
|
91
91
|
"accountList",
|
|
92
|
+
"holder",
|
|
92
93
|
"cart",
|
|
93
94
|
"schedule",
|
|
94
95
|
"summary",
|
|
@@ -379,6 +380,27 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
379
380
|
}
|
|
380
381
|
return this.store.accountList.fetchHolderAccounts(params);
|
|
381
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* 获取 holder 表单 map
|
|
385
|
+
*/
|
|
386
|
+
getHolderFormMap() {
|
|
387
|
+
return this.store.holder.getHolderFormMap();
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* 登录后或外部触发时,按当前 holderMap 批量刷新所有表单的 records
|
|
391
|
+
*/
|
|
392
|
+
async refreshAllHolderFormRecords(params) {
|
|
393
|
+
return this.store.holder.refreshAllFormRecords({
|
|
394
|
+
customer_id: params == null ? void 0 : params.customer_id,
|
|
395
|
+
useCache: false
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* 添加表单记录
|
|
400
|
+
*/
|
|
401
|
+
appendFormRecord(params) {
|
|
402
|
+
return this.store.holder.appendFormRecord(params);
|
|
403
|
+
}
|
|
382
404
|
// 设置日期范围,注入到日期模块中
|
|
383
405
|
async setDateRange(dateRange) {
|
|
384
406
|
this.store.date.setDateRange(dateRange);
|
|
@@ -486,6 +508,14 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
486
508
|
date = (normalProductCartItem == null ? void 0 : normalProductCartItem.start_date) || "";
|
|
487
509
|
}
|
|
488
510
|
this.updateQuotationPriceAndCart(date);
|
|
511
|
+
try {
|
|
512
|
+
const customerId = Number(accountInfo.id);
|
|
513
|
+
await this.refreshAllHolderFormRecords({
|
|
514
|
+
customer_id: customerId
|
|
515
|
+
});
|
|
516
|
+
} catch (error) {
|
|
517
|
+
console.error("[BookingByStep] 登录后刷新 holder 表单失败", error);
|
|
518
|
+
}
|
|
489
519
|
}
|
|
490
520
|
} else {
|
|
491
521
|
throw new Error(`没有找到${accountId}账户`);
|
|
@@ -631,6 +661,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
631
661
|
account = activeAccount;
|
|
632
662
|
}
|
|
633
663
|
}
|
|
664
|
+
try {
|
|
665
|
+
this.store.holder.ensureFormByProduct({
|
|
666
|
+
product: productData,
|
|
667
|
+
shop_id: (productData == null ? void 0 : productData.shop_id) || "",
|
|
668
|
+
useCache: true
|
|
669
|
+
});
|
|
670
|
+
} catch (error) {
|
|
671
|
+
console.error("[BookingByStep] 加载 holder 表单失败", error);
|
|
672
|
+
}
|
|
634
673
|
const flag = this.store.cart.mergeCartItemByRowKey({
|
|
635
674
|
rowKey,
|
|
636
675
|
quantity,
|
|
@@ -1235,7 +1274,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1235
1274
|
}
|
|
1236
1275
|
);
|
|
1237
1276
|
cartItems2.forEach((item, index) => {
|
|
1238
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1277
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1239
1278
|
const { currentCapacity } = (0, import_capacity.getCapacityInfoByCartItem)(item);
|
|
1240
1279
|
const hasOriginTimeSlot = Boolean(item._origin.start_time) && Boolean(item._origin.end_time) && !(timeSlots == null ? void 0 : timeSlots.start_time);
|
|
1241
1280
|
if (hasOriginTimeSlot) {
|
|
@@ -1368,7 +1407,9 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1368
1407
|
const fastestResource = (0, import_timeslots.findFastestAvailableResource)({
|
|
1369
1408
|
resources: targetRenderList,
|
|
1370
1409
|
currentCapacity,
|
|
1371
|
-
countMap: selectResourcesMap
|
|
1410
|
+
countMap: selectResourcesMap,
|
|
1411
|
+
targetDate: (_k = dateRange == null ? void 0 : dateRange[0]) == null ? void 0 : _k.date,
|
|
1412
|
+
durationMinutes: ((_l = item == null ? void 0 : item.duration) == null ? void 0 : _l.value) || ((_n = (_m = item == null ? void 0 : item._productOrigin) == null ? void 0 : _m.duration) == null ? void 0 : _n.value) || 10
|
|
1372
1413
|
});
|
|
1373
1414
|
const targetResource = fastestResource || targetRenderList[0];
|
|
1374
1415
|
targetResource.capacity = currentCapacity;
|
|
@@ -1405,7 +1446,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1405
1446
|
return { errorList };
|
|
1406
1447
|
}
|
|
1407
1448
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1408
|
-
getTimeSlotByAllResources(resources_code) {
|
|
1449
|
+
getTimeSlotByAllResources(resources_code, split = 10) {
|
|
1409
1450
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1410
1451
|
let dateRange = this.store.date.getDateRange();
|
|
1411
1452
|
const resources = [];
|
|
@@ -1563,7 +1604,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1563
1604
|
resourcesMap,
|
|
1564
1605
|
duration,
|
|
1565
1606
|
currentDate: dateRange[0].date,
|
|
1566
|
-
split
|
|
1607
|
+
split,
|
|
1567
1608
|
resourcesUseableMap,
|
|
1568
1609
|
capacity: maxCapacity,
|
|
1569
1610
|
cut_off_time: maxCutOffTime,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, ScheduleModule } from '../../modules';
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -14,6 +14,9 @@ export interface BookingByStepState {
|
|
|
14
14
|
currentProduct?: ProductData;
|
|
15
15
|
currentProductMeta?: Record<string, any>;
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
|
+
salesSummary?: SalesSummaryModule;
|
|
18
|
+
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
+
holder: HolderModule;
|
|
17
20
|
}
|
|
18
21
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
19
22
|
export declare enum BookingByStepHooks {
|
|
@@ -36,6 +36,11 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
36
36
|
`${solutionName}_${name || moduleName}`,
|
|
37
37
|
version
|
|
38
38
|
);
|
|
39
|
+
case "salesSummary":
|
|
40
|
+
return new import_modules.SalesSummaryModule(
|
|
41
|
+
`${solutionName}_${name || moduleName}`,
|
|
42
|
+
version
|
|
43
|
+
);
|
|
39
44
|
case "step":
|
|
40
45
|
return new import_modules.StepModule(
|
|
41
46
|
`${solutionName}_${name || moduleName}`,
|
|
@@ -71,6 +76,16 @@ function createModule(moduleName, solutionName, name, version) {
|
|
|
71
76
|
`${solutionName}_${name || moduleName}`,
|
|
72
77
|
version
|
|
73
78
|
);
|
|
79
|
+
case "scanOrderLogger":
|
|
80
|
+
return new import_modules.ScanOrderLoggerModule(
|
|
81
|
+
`${solutionName}_${name || moduleName}`,
|
|
82
|
+
version
|
|
83
|
+
);
|
|
84
|
+
case "holder":
|
|
85
|
+
return new import_modules.HolderModule(
|
|
86
|
+
`${solutionName}_${name || moduleName}`,
|
|
87
|
+
version
|
|
88
|
+
);
|
|
74
89
|
default:
|
|
75
90
|
throw new Error(`Unknown module type: ${moduleName}`);
|
|
76
91
|
}
|
|
@@ -19,10 +19,12 @@ export declare function calculateResourceAvailableTime({ resource, timeSlots, cu
|
|
|
19
19
|
* @param countMap 已预约数量映射
|
|
20
20
|
* @returns 最快可用的资源
|
|
21
21
|
*/
|
|
22
|
-
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, }: {
|
|
22
|
+
export declare function findFastestAvailableResource({ resources, currentCapacity, countMap, targetDate, durationMinutes, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
+
targetDate?: string | Dayjs;
|
|
27
|
+
durationMinutes?: number;
|
|
26
28
|
}): ResourceItem | null;
|
|
27
29
|
/**
|
|
28
30
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -77,10 +77,15 @@ function calculateResourceAvailableTime({
|
|
|
77
77
|
function findFastestAvailableResource({
|
|
78
78
|
resources,
|
|
79
79
|
currentCapacity = 1,
|
|
80
|
-
countMap = {}
|
|
80
|
+
countMap = {},
|
|
81
|
+
targetDate,
|
|
82
|
+
durationMinutes = 30
|
|
81
83
|
}) {
|
|
82
84
|
var _a, _b, _c;
|
|
83
85
|
const currentTime = (0, import_dayjs.default)();
|
|
86
|
+
const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
87
|
+
const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
|
|
88
|
+
const isTargetDayToday = targetDay.isSame(currentTime, "day");
|
|
84
89
|
let fastestTime = null;
|
|
85
90
|
let fastestResources = [];
|
|
86
91
|
console.log("[TimeslotUtils] 查找最快可用资源:", {
|
|
@@ -90,19 +95,22 @@ function findFastestAvailableResource({
|
|
|
90
95
|
countMap
|
|
91
96
|
});
|
|
92
97
|
for (const resource of resources) {
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
const targetDayTimes = resource.times.filter((time) => {
|
|
99
|
+
const isSameTargetDay = (0, import_dayjs.default)(time.start_at).isSame(targetDay, "day");
|
|
100
|
+
if (!isSameTargetDay)
|
|
101
|
+
return false;
|
|
102
|
+
if (!isTargetDayToday)
|
|
103
|
+
return true;
|
|
104
|
+
return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
|
|
97
105
|
});
|
|
98
|
-
if (
|
|
106
|
+
if (targetDayTimes.length === 0) {
|
|
99
107
|
console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
|
|
100
108
|
continue;
|
|
101
109
|
}
|
|
102
|
-
for (const time of
|
|
110
|
+
for (const time of targetDayTimes) {
|
|
103
111
|
const workStartTime = (0, import_dayjs.default)(time.start_at);
|
|
104
112
|
const workEndTime = (0, import_dayjs.default)(time.end_at);
|
|
105
|
-
let nextAvailableTime = currentTime.
|
|
113
|
+
let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
106
114
|
console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
|
|
107
115
|
workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
|
|
108
116
|
checkStartTime: nextAvailableTime.format("HH:mm:ss"),
|
|
@@ -126,7 +134,7 @@ function findFastestAvailableResource({
|
|
|
126
134
|
pax: event.pax || 1
|
|
127
135
|
});
|
|
128
136
|
if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
|
|
129
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
137
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
130
138
|
finalAvailableTime = eventEnd;
|
|
131
139
|
console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
|
|
132
140
|
}
|
|
@@ -134,7 +142,7 @@ function findFastestAvailableResource({
|
|
|
134
142
|
const totalCapacity = resource.capacity || 0;
|
|
135
143
|
const currentUsedCapacity = countMap[resource.id] || 0;
|
|
136
144
|
const eventUsedCapacity = event.pax || 1;
|
|
137
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
145
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
138
146
|
const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
139
147
|
if (totalRequiredCapacity > totalCapacity) {
|
|
140
148
|
finalAvailableTime = eventEnd;
|
|
@@ -143,7 +151,7 @@ function findFastestAvailableResource({
|
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
|
-
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
154
|
+
if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
|
|
147
155
|
console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
|
|
148
156
|
continue;
|
|
149
157
|
}
|
|
@@ -222,7 +222,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
222
222
|
product_id: item.product_id,
|
|
223
223
|
product_variant_id: item.product_variant_id,
|
|
224
224
|
quantity: item.num,
|
|
225
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
226
225
|
// 商品是否含税:1;0
|
|
227
226
|
is_charge_tax: item.is_charge_tax ?? 0,
|
|
228
227
|
// 若商品不含税,计算得到的税费,单位(元)
|
|
@@ -247,7 +246,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
247
246
|
},
|
|
248
247
|
product_bundle: (item.product_bundle || []).map((bundle) => {
|
|
249
248
|
return {
|
|
250
|
-
is_price_include_tax: item.is_price_include_tax,
|
|
251
249
|
bundle_id: bundle.bundle_id,
|
|
252
250
|
bundle_product_id: bundle.bundle_product_id,
|
|
253
251
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult, ScanOrderTempOrder } from './types';
|
|
4
|
+
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
5
|
+
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
+
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
|
+
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
|
+
import type { ProductData } from '../../modules/Product/types';
|
|
9
|
+
export * from './types';
|
|
10
|
+
interface ScanOrderItemRuleRuntimeConfig {
|
|
11
|
+
strategyConfigs?: StrategyConfig[];
|
|
12
|
+
pax?: Partial<PaxInfo>;
|
|
13
|
+
historicalItems?: CartItemSummary[];
|
|
14
|
+
serviceType?: string;
|
|
15
|
+
submissionIndex?: number;
|
|
16
|
+
custom?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
19
|
+
protected defaultName: string;
|
|
20
|
+
protected defaultVersion: string;
|
|
21
|
+
isSolution: boolean;
|
|
22
|
+
private initializeOptions;
|
|
23
|
+
private store;
|
|
24
|
+
private otherParams;
|
|
25
|
+
private cacheId;
|
|
26
|
+
private window;
|
|
27
|
+
private request;
|
|
28
|
+
private itemRuleEvaluator;
|
|
29
|
+
private itemRuleConfigs;
|
|
30
|
+
private itemRuleConfigsPromise;
|
|
31
|
+
private itemRulePrefillApplied;
|
|
32
|
+
private itemRuleRuntimeConfig;
|
|
33
|
+
/** 最近一次 checkResourceAvailable 从预约规则 link 拉取的商品快照 */
|
|
34
|
+
private enabledReservationRuleProducts;
|
|
35
|
+
private loginEffectDisposers;
|
|
36
|
+
private customerLoginRefreshInFlight;
|
|
37
|
+
private customerLoginRefreshIdInFlight;
|
|
38
|
+
private static readonly PISELL1_LOGIN_SUCCESS;
|
|
39
|
+
private getScanOrderLoggerContext;
|
|
40
|
+
private safeStringify;
|
|
41
|
+
private pickErrorMessage;
|
|
42
|
+
private serializeError;
|
|
43
|
+
private addScanOrderLog;
|
|
44
|
+
private logMethodStart;
|
|
45
|
+
private logMethodSuccess;
|
|
46
|
+
private logMethodError;
|
|
47
|
+
private assertProductListLoaded;
|
|
48
|
+
addLog(params: ScanOrderAddLogParams): Promise<void>;
|
|
49
|
+
private normalizeCustomerId;
|
|
50
|
+
private resolveCustomerIdFromLoginPayload;
|
|
51
|
+
private clearLoginEffectListeners;
|
|
52
|
+
private registerLoginEffect;
|
|
53
|
+
private registerCustomerLoginListeners;
|
|
54
|
+
private refreshOrderMarketingAfterLogin;
|
|
55
|
+
constructor(name?: string, version?: string);
|
|
56
|
+
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
|
+
getCacheId(): string | undefined;
|
|
58
|
+
private destroyRegisteredChildModules;
|
|
59
|
+
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
|
+
destroy(): Promise<void>;
|
|
61
|
+
retryInit(): Promise<void>;
|
|
62
|
+
refresh(): Promise<void>;
|
|
63
|
+
getStatus(): import("./types").ScanOrderStatus;
|
|
64
|
+
getEntryContext(): import("./types").ScanOrderEntryContext | null;
|
|
65
|
+
getConfig(): Record<string, any>;
|
|
66
|
+
getItemRuleQuantityLimits(): QuantityLimitResult[];
|
|
67
|
+
getCartValidationPassed(): boolean | null;
|
|
68
|
+
getCartValidation(): {
|
|
69
|
+
passed: boolean | null;
|
|
70
|
+
failures: QuantityCheckResult[];
|
|
71
|
+
};
|
|
72
|
+
getTempOrder(): ScanOrderTempOrder | null;
|
|
73
|
+
updateTempOrderNote(note: string): string;
|
|
74
|
+
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
|
+
service_type: 'dine_in' | '';
|
|
76
|
+
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
|
+
};
|
|
78
|
+
setPickupRef(buzzer: string): string;
|
|
79
|
+
private ensureTempOrder;
|
|
80
|
+
addNewOrder(): Promise<ScanOrderTempOrder>;
|
|
81
|
+
restoreOrder(): Promise<ScanOrderTempOrder>;
|
|
82
|
+
getOrderProducts(): ScanOrderOrderProduct[];
|
|
83
|
+
getSummary(): Promise<import("./types").ScanOrderSummary>;
|
|
84
|
+
getDiscountList(): Discount[];
|
|
85
|
+
scanCode(code: string, customerId?: number): Promise<ScanOrderScanCodeResult>;
|
|
86
|
+
setDiscountSelected(params: {
|
|
87
|
+
discountId: number;
|
|
88
|
+
isSelected: boolean;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
onCustomerLogin(params: {
|
|
91
|
+
customerId: number;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
private findReservationRuleResource;
|
|
94
|
+
private buildScanOrderResourceMetadata;
|
|
95
|
+
private prepareRetailAvailability;
|
|
96
|
+
private buildSubmitPayloadEnhancer;
|
|
97
|
+
submitScanOrder<T = any>(): Promise<T>;
|
|
98
|
+
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
99
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
|
|
100
|
+
/**
|
|
101
|
+
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
102
|
+
* 多行同 SKU 时必须传入与删除/更新一致的 identity(如 `identity_key`)。
|
|
103
|
+
*/
|
|
104
|
+
setOrderProductLineNote(identity: ScanOrderOrderProductIdentity, note: string): Promise<ScanOrderOrderProduct[]>;
|
|
105
|
+
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
|
|
106
|
+
private loadRuntimeConfigs;
|
|
107
|
+
private syncItemRuleConfigsFromDineInConfig;
|
|
108
|
+
private fetchItemRuleConfigsByModelIds;
|
|
109
|
+
private buildPrefillProductSourceMap;
|
|
110
|
+
private getItemRuleRuntimeConfig;
|
|
111
|
+
private ensureItemRuleConfigsLoaded;
|
|
112
|
+
private refreshItemRuleQuantityLimits;
|
|
113
|
+
private applyPrefillByItemRule;
|
|
114
|
+
applyItemRulePrefill(): Promise<void>;
|
|
115
|
+
private evaluateCartValidationByItemRule;
|
|
116
|
+
private validateBeforeSubmitByItemRule;
|
|
117
|
+
private refreshCartValidationPassed;
|
|
118
|
+
setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
|
|
119
|
+
private normalizeResourceState;
|
|
120
|
+
private resolveResourceSelectType;
|
|
121
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
122
|
+
private resolveAdditionalOrderFromOccupyDetail;
|
|
123
|
+
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
124
|
+
restorePreviousOrderData(): Promise<void>;
|
|
125
|
+
getAdditionalOrderInfo(): Promise<{
|
|
126
|
+
orderId: string;
|
|
127
|
+
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|
|
128
|
+
orderTime: string;
|
|
129
|
+
orderAmount: number;
|
|
130
|
+
orderItems: any[];
|
|
131
|
+
}>;
|
|
132
|
+
getProductList(): Promise<ProductData[]>;
|
|
133
|
+
getOtherParams(): Record<string, any>;
|
|
134
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
135
|
+
cover?: boolean;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
private static readonly UI_STATE_KEY_PREFIX;
|
|
138
|
+
private getUIStateBucketKey;
|
|
139
|
+
private readUIStateBucket;
|
|
140
|
+
private writeUIStateBucket;
|
|
141
|
+
setUIState(key: string, value: any): void;
|
|
142
|
+
getUIState<T = any>(key: string): T | undefined;
|
|
143
|
+
deleteUIState(key: string): void;
|
|
144
|
+
clearUIState(): void;
|
|
145
|
+
setEntryPaxNumber(number: number): Promise<void>;
|
|
146
|
+
getEntryPaxNumber(): number | null;
|
|
147
|
+
syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
|
|
148
|
+
getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
|
|
149
|
+
checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
|
|
150
|
+
getFulfillmentModes(): {
|
|
151
|
+
enablePickup: boolean;
|
|
152
|
+
enableTableService: boolean;
|
|
153
|
+
};
|
|
154
|
+
checkManualPickupRef(): {
|
|
155
|
+
enabled: boolean;
|
|
156
|
+
manualInputType?: string;
|
|
157
|
+
};
|
|
158
|
+
}
|