@pisell/pisellos 2.3.40 → 2.3.41
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/core/index.d.ts +2 -0
- package/dist/core/index.js +7 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +2 -0
- package/dist/modules/OpenData/index.js +10 -2
- package/dist/modules/Order/index.d.ts +29 -12
- package/dist/modules/Order/index.js +750 -509
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +33 -10
- package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +13 -41
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +79 -50
- package/dist/modules/Payment/types.d.ts +99 -28
- package/dist/modules/Payment/types.js +20 -3
- package/dist/modules/Payment/walletpass.d.ts +25 -1
- package/dist/modules/Payment/walletpass.js +707 -157
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.d.ts +1 -0
- package/dist/modules/Rules/index.js +89 -96
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +16 -14
- package/dist/server/index.js +1925 -1143
- package/dist/server/modules/order/index.d.ts +54 -4
- package/dist/server/modules/order/index.js +1600 -700
- package/dist/server/modules/order/types.d.ts +11 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +109 -20
- package/dist/solution/BaseSales/index.js +1800 -480
- package/dist/solution/BaseSales/types.d.ts +52 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -17
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +8 -4
- package/dist/solution/BookingTicket/index.js +134 -51
- package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +756 -1148
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +860 -1176
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/core/index.d.ts +2 -0
- package/lib/core/index.js +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +2 -0
- package/lib/modules/OpenData/index.js +6 -1
- package/lib/modules/Order/index.d.ts +29 -12
- package/lib/modules/Order/index.js +196 -86
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +33 -10
- package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +16 -40
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +34 -13
- package/lib/modules/Payment/types.d.ts +99 -28
- package/lib/modules/Payment/types.js +4 -3
- package/lib/modules/Payment/walletpass.d.ts +25 -1
- package/lib/modules/Payment/walletpass.js +470 -21
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +1 -0
- package/lib/modules/Rules/index.js +47 -40
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +16 -14
- package/lib/server/index.js +675 -83
- package/lib/server/modules/order/index.d.ts +54 -4
- package/lib/server/modules/order/index.js +679 -66
- package/lib/server/modules/order/types.d.ts +11 -3
- package/lib/solution/BaseSales/index.d.ts +109 -20
- package/lib/solution/BaseSales/index.js +883 -70
- package/lib/solution/BaseSales/types.d.ts +52 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -17
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +8 -4
- package/lib/solution/BookingTicket/index.js +64 -19
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +190 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +123 -328
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1871
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1076
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule
|
|
1
|
+
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from '../../modules';
|
|
2
2
|
export interface BookingByStepState {
|
|
3
3
|
cart: CartModule;
|
|
4
4
|
summary: SummaryModule;
|
|
@@ -16,7 +16,6 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
-
holder: HolderModule;
|
|
20
19
|
}
|
|
21
20
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
22
21
|
export declare enum BookingByStepHooks {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule
|
|
1
|
+
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
|
|
2
2
|
export function createModule(moduleName, solutionName, name, version) {
|
|
3
3
|
switch (moduleName) {
|
|
4
4
|
case 'cart':
|
|
@@ -23,8 +23,6 @@ export function createModule(moduleName, solutionName, name, version) {
|
|
|
23
23
|
return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
24
24
|
case 'scanOrderLogger':
|
|
25
25
|
return new ScanOrderLoggerModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
26
|
-
case 'holder':
|
|
27
|
-
return new HolderModule("".concat(solutionName, "_").concat(name || moduleName), version);
|
|
28
26
|
default:
|
|
29
27
|
throw new Error("Unknown module type: ".concat(moduleName));
|
|
30
28
|
}
|
|
@@ -23,27 +23,11 @@ export var formatDefaultCapacitys = function formatDefaultCapacitys(_ref) {
|
|
|
23
23
|
product_bundle = _ref.product_bundle;
|
|
24
24
|
if ((capacity === null || capacity === void 0 ? void 0 : capacity.type) === 'package') {
|
|
25
25
|
return (product_bundle || []).map(function (d) {
|
|
26
|
-
var _window;
|
|
27
26
|
var id = d.bundle_product_id;
|
|
28
27
|
var variantId = d.bundle_variant_id;
|
|
29
28
|
var item = ((capacity === null || capacity === void 0 ? void 0 : capacity.package) || []).find(function (item) {
|
|
30
|
-
return item.product_id
|
|
29
|
+
return item.product_id === id || item.product_id === variantId;
|
|
31
30
|
});
|
|
32
|
-
if (!item && (_window = window) !== null && _window !== void 0 && _window.sendWarningLog) {
|
|
33
|
-
window.sendWarningLog({
|
|
34
|
-
title: '未找到套餐 capacity 配置',
|
|
35
|
-
content: [{
|
|
36
|
-
key: 'product_id',
|
|
37
|
-
value: id
|
|
38
|
-
}, {
|
|
39
|
-
key: 'variant_id',
|
|
40
|
-
value: variantId
|
|
41
|
-
}, {
|
|
42
|
-
key: 'package',
|
|
43
|
-
value: JSON.stringify((capacity === null || capacity === void 0 ? void 0 : capacity.package) || [])
|
|
44
|
-
}]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
31
|
return {
|
|
48
32
|
id: id,
|
|
49
33
|
value: item ? d.num || 0 : 0,
|
|
@@ -19,12 +19,10 @@ 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, }: {
|
|
23
23
|
resources: ResourceItem[];
|
|
24
24
|
currentCapacity?: number;
|
|
25
25
|
countMap?: Record<number, number>;
|
|
26
|
-
targetDate?: string | Dayjs;
|
|
27
|
-
durationMinutes?: number;
|
|
28
26
|
}): ResourceItem | null;
|
|
29
27
|
/**
|
|
30
28
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -91,14 +91,8 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
91
91
|
_ref2$currentCapacity = _ref2.currentCapacity,
|
|
92
92
|
currentCapacity = _ref2$currentCapacity === void 0 ? 1 : _ref2$currentCapacity,
|
|
93
93
|
_ref2$countMap = _ref2.countMap,
|
|
94
|
-
countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap
|
|
95
|
-
targetDate = _ref2.targetDate,
|
|
96
|
-
_ref2$durationMinutes = _ref2.durationMinutes,
|
|
97
|
-
durationMinutes = _ref2$durationMinutes === void 0 ? 30 : _ref2$durationMinutes;
|
|
94
|
+
countMap = _ref2$countMap === void 0 ? {} : _ref2$countMap;
|
|
98
95
|
var currentTime = dayjs();
|
|
99
|
-
var resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
100
|
-
var targetDay = targetDate ? dayjs(targetDate) : currentTime;
|
|
101
|
-
var isTargetDayToday = targetDay.isSame(currentTime, 'day');
|
|
102
96
|
var fastestTime = null;
|
|
103
97
|
var fastestResources = [];
|
|
104
98
|
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
@@ -114,18 +108,17 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
114
108
|
try {
|
|
115
109
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
116
110
|
var _resource = _step2.value;
|
|
117
|
-
//
|
|
118
|
-
var
|
|
119
|
-
var
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return dayjs(time.end_at).isAfter(currentTime);
|
|
111
|
+
// 获取资源当天且还在工作时间内的时间段
|
|
112
|
+
var todayTimes = _resource.times.filter(function (time) {
|
|
113
|
+
var isToday = dayjs(time.start_at).isSame(currentTime, 'day');
|
|
114
|
+
var isStillWorking = dayjs(time.end_at).isAfter(currentTime);
|
|
115
|
+
return isToday && isStillWorking;
|
|
123
116
|
});
|
|
124
|
-
if (
|
|
117
|
+
if (todayTimes.length === 0) {
|
|
125
118
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
126
119
|
continue;
|
|
127
120
|
}
|
|
128
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
121
|
+
var _iterator4 = _createForOfIteratorHelper(todayTimes),
|
|
129
122
|
_step4;
|
|
130
123
|
try {
|
|
131
124
|
var _loop = function _loop() {
|
|
@@ -135,7 +128,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
135
128
|
var workEndTime = dayjs(time.end_at);
|
|
136
129
|
|
|
137
130
|
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
138
|
-
var nextAvailableTime =
|
|
131
|
+
var nextAvailableTime = currentTime.isBefore(workStartTime) ? workStartTime : currentTime;
|
|
139
132
|
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
|
|
140
133
|
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
141
134
|
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
@@ -172,7 +165,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
172
165
|
// 检查资源类型和容量
|
|
173
166
|
if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
|
|
174
167
|
// 单人预约资源:检查时间冲突
|
|
175
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
168
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
|
|
176
169
|
// 有冲突,使用事件结束时间
|
|
177
170
|
finalAvailableTime = _eventEnd;
|
|
178
171
|
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
@@ -184,7 +177,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
184
177
|
var eventUsedCapacity = _event.pax || 1;
|
|
185
178
|
|
|
186
179
|
// 如果在事件时间范围内,检查容量是否足够
|
|
187
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
180
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(30, 'minute'))) {
|
|
188
181
|
var totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
189
182
|
if (totalRequiredCapacity > totalCapacity) {
|
|
190
183
|
// 容量不足,使用事件结束时间
|
|
@@ -201,7 +194,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
201
194
|
} finally {
|
|
202
195
|
_iterator5.f();
|
|
203
196
|
}
|
|
204
|
-
if (finalAvailableTime.
|
|
197
|
+
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
205
198
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
206
199
|
return 0; // continue
|
|
207
200
|
}
|
|
@@ -46,6 +46,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
46
46
|
private getIdGeneratorPlugin;
|
|
47
47
|
private loadOpenDataConfig;
|
|
48
48
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
49
|
+
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
50
|
+
clearOpenDataCache(): void;
|
|
49
51
|
private getShortNumberOrDeviceId;
|
|
50
52
|
private configureIdGeneratorFromOpenData;
|
|
51
53
|
private normalizePositiveInteger;
|
|
@@ -189,10 +191,12 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
189
191
|
*/
|
|
190
192
|
getCustomer(): ICustomer | null;
|
|
191
193
|
/**
|
|
192
|
-
* 通过 ids
|
|
193
|
-
*
|
|
194
|
+
* 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
|
|
195
|
+
* 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
|
|
194
196
|
*/
|
|
195
|
-
getProductByIds(ids: number[]
|
|
197
|
+
getProductByIds(ids: number[], options?: {
|
|
198
|
+
loadMissing?: boolean;
|
|
199
|
+
}): Promise<ProductData[]>;
|
|
196
200
|
/**
|
|
197
201
|
* 获取日程时间段点
|
|
198
202
|
* @param params 参数
|
|
@@ -322,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
322
326
|
* 获取当前的客户搜索条件
|
|
323
327
|
* @returns 当前搜索条件
|
|
324
328
|
*/
|
|
325
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
329
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
326
330
|
/**
|
|
327
331
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
328
332
|
* @returns 客户状态
|
|
@@ -337,11 +337,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
337
337
|
key: "getOpenData",
|
|
338
338
|
value: function () {
|
|
339
339
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
340
|
-
var _this$store$openData;
|
|
341
340
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
342
341
|
while (1) switch (_context3.prev = _context3.next) {
|
|
343
342
|
case 0:
|
|
344
|
-
return _context3.abrupt("return",
|
|
343
|
+
return _context3.abrupt("return", this.loadOpenDataConfig());
|
|
345
344
|
case 1:
|
|
346
345
|
case "end":
|
|
347
346
|
return _context3.stop();
|
|
@@ -352,7 +351,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
352
351
|
return _getOpenData.apply(this, arguments);
|
|
353
352
|
}
|
|
354
353
|
return getOpenData;
|
|
355
|
-
}()
|
|
354
|
+
}() /** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
355
|
+
}, {
|
|
356
|
+
key: "clearOpenDataCache",
|
|
357
|
+
value: function clearOpenDataCache() {
|
|
358
|
+
var _this$store$openData;
|
|
359
|
+
this.loadOpenDataConfigInFlight = null;
|
|
360
|
+
this.otherParams.openData = null;
|
|
361
|
+
(_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
|
|
362
|
+
}
|
|
356
363
|
}, {
|
|
357
364
|
key: "getShortNumberOrDeviceId",
|
|
358
365
|
value: function () {
|
|
@@ -397,49 +404,52 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
397
404
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
398
405
|
while (1) switch (_context5.prev = _context5.next) {
|
|
399
406
|
case 0:
|
|
407
|
+
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
|
+
this.setPaymentNumberDevicePrefix(null);
|
|
400
409
|
openDataConfig = null;
|
|
401
|
-
_context5.prev =
|
|
402
|
-
_context5.next =
|
|
410
|
+
_context5.prev = 2;
|
|
411
|
+
_context5.next = 5;
|
|
403
412
|
return this.loadOpenDataConfig();
|
|
404
|
-
case
|
|
413
|
+
case 5:
|
|
405
414
|
openDataConfig = _context5.sent;
|
|
406
|
-
_context5.next =
|
|
415
|
+
_context5.next = 12;
|
|
407
416
|
break;
|
|
408
|
-
case
|
|
409
|
-
_context5.prev =
|
|
410
|
-
_context5.t0 = _context5["catch"](
|
|
417
|
+
case 8:
|
|
418
|
+
_context5.prev = 8;
|
|
419
|
+
_context5.t0 = _context5["catch"](2);
|
|
411
420
|
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
412
421
|
return _context5.abrupt("return");
|
|
413
|
-
case
|
|
422
|
+
case 12:
|
|
414
423
|
// if (!openDataConfig) return;
|
|
415
424
|
idGenerator = this.getIdGeneratorPlugin();
|
|
416
425
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
417
|
-
_context5.next =
|
|
426
|
+
_context5.next = 16;
|
|
418
427
|
break;
|
|
419
428
|
}
|
|
420
429
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
421
430
|
return _context5.abrupt("return");
|
|
422
|
-
case
|
|
431
|
+
case 16:
|
|
423
432
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
424
433
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
425
434
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
426
435
|
shopOrderPrefix = this.normalizeIdPrefix((_openDataConfig4 = openDataConfig) === null || _openDataConfig4 === void 0 ? void 0 : _openDataConfig4['sale.sale_number_prefix'], '');
|
|
427
436
|
resetReceiptSequenceDaily = typeof ((_openDataConfig5 = openDataConfig) === null || _openDataConfig5 === void 0 ? void 0 : _openDataConfig5['sale.short_number_daily_reset']) === 'boolean' ? (_openDataConfig6 = openDataConfig) === null || _openDataConfig6 === void 0 ? void 0 : _openDataConfig6['sale.short_number_daily_reset'] : false;
|
|
428
437
|
operatingDayBoundary = this.getAppData('operating_day_boundary');
|
|
429
|
-
_context5.next =
|
|
438
|
+
_context5.next = 24;
|
|
430
439
|
return this.getShortNumberOrDeviceId();
|
|
431
|
-
case
|
|
440
|
+
case 24:
|
|
432
441
|
deviceId = _context5.sent;
|
|
442
|
+
this.setPaymentNumberDevicePrefix(deviceId);
|
|
433
443
|
businessCode = this.getBookingTicketBusinessCode();
|
|
434
444
|
if (businessCode) {
|
|
435
|
-
_context5.next =
|
|
445
|
+
_context5.next = 30;
|
|
436
446
|
break;
|
|
437
447
|
}
|
|
438
448
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
439
449
|
return _context5.abrupt("return");
|
|
440
|
-
case
|
|
441
|
-
_context5.prev =
|
|
442
|
-
_context5.next =
|
|
450
|
+
case 30:
|
|
451
|
+
_context5.prev = 30;
|
|
452
|
+
_context5.next = 33;
|
|
443
453
|
return idGenerator.configure({
|
|
444
454
|
biz: businessCode,
|
|
445
455
|
config: {
|
|
@@ -454,18 +464,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
454
464
|
shopOrderPrefix: shopOrderPrefix
|
|
455
465
|
}
|
|
456
466
|
});
|
|
457
|
-
case 31:
|
|
458
|
-
_context5.next = 36;
|
|
459
|
-
break;
|
|
460
467
|
case 33:
|
|
461
|
-
_context5.
|
|
462
|
-
|
|
468
|
+
_context5.next = 38;
|
|
469
|
+
break;
|
|
470
|
+
case 35:
|
|
471
|
+
_context5.prev = 35;
|
|
472
|
+
_context5.t1 = _context5["catch"](30);
|
|
463
473
|
console.warn('[BookingTicket] idGenerator 配置失败', _context5.t1);
|
|
464
|
-
case
|
|
474
|
+
case 38:
|
|
465
475
|
case "end":
|
|
466
476
|
return _context5.stop();
|
|
467
477
|
}
|
|
468
|
-
}, _callee5, this, [[
|
|
478
|
+
}, _callee5, this, [[2, 8], [30, 35]]);
|
|
469
479
|
}));
|
|
470
480
|
function configureIdGeneratorFromOpenData() {
|
|
471
481
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -1260,24 +1270,88 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1260
1270
|
}
|
|
1261
1271
|
|
|
1262
1272
|
/**
|
|
1263
|
-
* 通过 ids
|
|
1264
|
-
*
|
|
1273
|
+
* 通过 ids 获取商品列表;默认只读取内存,显式开启 loadMissing 时按当前订单上下文补查缺失商品。
|
|
1274
|
+
* 补查直接写入 ProductList,不更新 BookingTicket.productCatalog,避免当前商品列表被查询子集覆盖。
|
|
1265
1275
|
*/
|
|
1266
1276
|
}, {
|
|
1267
1277
|
key: "getProductByIds",
|
|
1268
1278
|
value: (function () {
|
|
1269
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids) {
|
|
1279
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(ids, options) {
|
|
1280
|
+
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1281
|
+
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1270
1282
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1271
1283
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1272
1284
|
case 0:
|
|
1273
|
-
|
|
1274
|
-
|
|
1285
|
+
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1286
|
+
return Number(id);
|
|
1287
|
+
}).filter(function (id) {
|
|
1288
|
+
return Number.isFinite(id);
|
|
1289
|
+
})));
|
|
1290
|
+
_context18.next = 3;
|
|
1291
|
+
return this.store.products.getProductByIds(normalizedIds);
|
|
1292
|
+
case 3:
|
|
1293
|
+
_context18.t0 = _context18.sent;
|
|
1294
|
+
if (_context18.t0) {
|
|
1295
|
+
_context18.next = 6;
|
|
1296
|
+
break;
|
|
1297
|
+
}
|
|
1298
|
+
_context18.t0 = [];
|
|
1299
|
+
case 6:
|
|
1300
|
+
localProducts = _context18.t0;
|
|
1301
|
+
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1302
|
+
_context18.next = 9;
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
return _context18.abrupt("return", localProducts);
|
|
1306
|
+
case 9:
|
|
1307
|
+
localProductIds = new Set(localProducts.map(function (product) {
|
|
1308
|
+
return Number(product.id);
|
|
1309
|
+
}));
|
|
1310
|
+
missingIds = normalizedIds.filter(function (id) {
|
|
1311
|
+
return !localProductIds.has(id);
|
|
1312
|
+
});
|
|
1313
|
+
if (missingIds.length) {
|
|
1314
|
+
_context18.next = 13;
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
return _context18.abrupt("return", localProducts);
|
|
1318
|
+
case 13:
|
|
1319
|
+
rawBookingDate = this.getBookingDate();
|
|
1320
|
+
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1321
|
+
customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
|
|
1322
|
+
_context18.next = 18;
|
|
1323
|
+
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1324
|
+
product_ids: missingIds,
|
|
1325
|
+
with_count: ['bundleGroup', 'optionGroup'],
|
|
1326
|
+
with_schedule: 1,
|
|
1327
|
+
cacheId: this.cacheId
|
|
1328
|
+
}, bookingDate ? {
|
|
1329
|
+
schedule_date: bookingDate.format('YYYY-MM-DD'),
|
|
1330
|
+
schedule_datetime: bookingDate.format('YYYY-MM-DD HH:mm:ss')
|
|
1331
|
+
} : {}), Number.isFinite(customerId) && customerId > 0 ? {
|
|
1332
|
+
customer_id: customerId
|
|
1333
|
+
} : {}));
|
|
1334
|
+
case 18:
|
|
1335
|
+
loadedProducts = _context18.sent;
|
|
1336
|
+
productById = new Map();
|
|
1337
|
+
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1338
|
+
var productId = Number(product.id);
|
|
1339
|
+
if (Number.isFinite(productId)) {
|
|
1340
|
+
productById.set(productId, product);
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
return _context18.abrupt("return", normalizedIds.map(function (id) {
|
|
1344
|
+
return productById.get(id);
|
|
1345
|
+
}).filter(function (product) {
|
|
1346
|
+
return Boolean(product);
|
|
1347
|
+
}));
|
|
1348
|
+
case 22:
|
|
1275
1349
|
case "end":
|
|
1276
1350
|
return _context18.stop();
|
|
1277
1351
|
}
|
|
1278
1352
|
}, _callee18, this);
|
|
1279
1353
|
}));
|
|
1280
|
-
function getProductByIds(_x13) {
|
|
1354
|
+
function getProductByIds(_x13, _x14) {
|
|
1281
1355
|
return _getProductByIds.apply(this, arguments);
|
|
1282
1356
|
}
|
|
1283
1357
|
return getProductByIds;
|
|
@@ -1311,7 +1385,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1311
1385
|
}
|
|
1312
1386
|
}, _callee19, this);
|
|
1313
1387
|
}));
|
|
1314
|
-
function getScheduleTimePoints(
|
|
1388
|
+
function getScheduleTimePoints(_x15) {
|
|
1315
1389
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
1316
1390
|
}
|
|
1317
1391
|
return getScheduleTimePoints;
|
|
@@ -1701,7 +1775,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1701
1775
|
}
|
|
1702
1776
|
}, _callee23, this, [[0, 7]]);
|
|
1703
1777
|
}));
|
|
1704
|
-
function changeCustomerPage(
|
|
1778
|
+
function changeCustomerPage(_x16, _x17) {
|
|
1705
1779
|
return _changeCustomerPage.apply(this, arguments);
|
|
1706
1780
|
}
|
|
1707
1781
|
return changeCustomerPage;
|
|
@@ -1824,7 +1898,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1824
1898
|
var localSearch = function localSearch(v) {
|
|
1825
1899
|
return _this5.store.products.findProductsByCodeOrBarcode(v);
|
|
1826
1900
|
};
|
|
1827
|
-
var scanCallback = handleGlobalScan(this.request, localSearch
|
|
1901
|
+
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
1828
1902
|
var safeCallback = function safeCallback(d) {
|
|
1829
1903
|
try {
|
|
1830
1904
|
callback(d);
|
|
@@ -1993,7 +2067,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1993
2067
|
}, {
|
|
1994
2068
|
key: "getBookingConfig",
|
|
1995
2069
|
value: function getBookingConfig() {
|
|
1996
|
-
|
|
2070
|
+
var _this$store$bookingCo;
|
|
2071
|
+
return (_this$store$bookingCo = this.store.bookingContext) === null || _this$store$bookingCo === void 0 ? void 0 : _this$store$bookingCo.getBookingConfig();
|
|
1997
2072
|
}
|
|
1998
2073
|
|
|
1999
2074
|
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
@@ -2154,10 +2229,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2154
2229
|
}, {
|
|
2155
2230
|
key: "buildAddProductCtx",
|
|
2156
2231
|
value: function buildAddProductCtx(extra) {
|
|
2157
|
-
var _extra$date2, _ref12, _this$
|
|
2232
|
+
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
|
|
2158
2233
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2159
2234
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2160
|
-
var orderCustomerId = (_ref12 = (_this$
|
|
2235
|
+
var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2161
2236
|
return _objectSpread({
|
|
2162
2237
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2163
2238
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2274,7 +2349,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2274
2349
|
}
|
|
2275
2350
|
}, _callee27, this);
|
|
2276
2351
|
}));
|
|
2277
|
-
function updateProductInOrder(
|
|
2352
|
+
function updateProductInOrder(_x18) {
|
|
2278
2353
|
return _updateProductInOrder.apply(this, arguments);
|
|
2279
2354
|
}
|
|
2280
2355
|
return updateProductInOrder;
|
|
@@ -2317,7 +2392,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2317
2392
|
localSearch = function localSearch(v) {
|
|
2318
2393
|
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
2319
2394
|
};
|
|
2320
|
-
scanCallback = handleGlobalScan(this.request, localSearch
|
|
2395
|
+
scanCallback = handleGlobalScan(this.request, localSearch);
|
|
2321
2396
|
_context28.next = 9;
|
|
2322
2397
|
return scanCallback({
|
|
2323
2398
|
type: 'nativeScanner',
|
|
@@ -2362,6 +2437,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2362
2437
|
},
|
|
2363
2438
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2364
2439
|
return _this6.addProductToOrder(product, booking);
|
|
2440
|
+
},
|
|
2441
|
+
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2442
|
+
return _this6.refreshWalletAssets(params);
|
|
2443
|
+
},
|
|
2444
|
+
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2445
|
+
return _this6.scanWalletAsset(scanCode);
|
|
2365
2446
|
}
|
|
2366
2447
|
}, formatted, bridge);
|
|
2367
2448
|
case 16:
|
|
@@ -2383,7 +2464,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2383
2464
|
}
|
|
2384
2465
|
}, _callee28, this, [[4, 21]]);
|
|
2385
2466
|
}));
|
|
2386
|
-
function handleGlobalScanCode(
|
|
2467
|
+
function handleGlobalScanCode(_x19, _x20) {
|
|
2387
2468
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2388
2469
|
}
|
|
2389
2470
|
return handleGlobalScanCode;
|
|
@@ -2481,7 +2562,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2481
2562
|
}
|
|
2482
2563
|
}, _callee29, this);
|
|
2483
2564
|
}));
|
|
2484
|
-
function addAddTimeProductToBooking(
|
|
2565
|
+
function addAddTimeProductToBooking(_x21) {
|
|
2485
2566
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2486
2567
|
}
|
|
2487
2568
|
return addAddTimeProductToBooking;
|
|
@@ -2584,7 +2665,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2584
2665
|
}
|
|
2585
2666
|
}, _callee30, this, [[13, 31, 34, 37]]);
|
|
2586
2667
|
}));
|
|
2587
|
-
function addAddTimeProductsToBooking(
|
|
2668
|
+
function addAddTimeProductsToBooking(_x22) {
|
|
2588
2669
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
2589
2670
|
}
|
|
2590
2671
|
return addAddTimeProductsToBooking;
|
|
@@ -2601,22 +2682,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2601
2682
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2602
2683
|
case 0:
|
|
2603
2684
|
_ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
2604
|
-
|
|
2685
|
+
_context31.next = 3;
|
|
2686
|
+
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2605
2687
|
cover: cover
|
|
2606
2688
|
});
|
|
2607
|
-
|
|
2608
|
-
|
|
2689
|
+
case 3:
|
|
2690
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
2691
|
+
_context31.next = 6;
|
|
2609
2692
|
break;
|
|
2610
2693
|
}
|
|
2611
|
-
_context31.next =
|
|
2694
|
+
_context31.next = 6;
|
|
2612
2695
|
return this.configureIdGeneratorFromOpenData();
|
|
2613
|
-
case
|
|
2696
|
+
case 6:
|
|
2614
2697
|
case "end":
|
|
2615
2698
|
return _context31.stop();
|
|
2616
2699
|
}
|
|
2617
2700
|
}, _callee31, this);
|
|
2618
2701
|
}));
|
|
2619
|
-
function setOtherParams(
|
|
2702
|
+
function setOtherParams(_x23) {
|
|
2620
2703
|
return _setOtherParams.apply(this, arguments);
|
|
2621
2704
|
}
|
|
2622
2705
|
return setOtherParams;
|
|
@@ -2687,7 +2770,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2687
2770
|
}
|
|
2688
2771
|
}, _callee32, this);
|
|
2689
2772
|
}));
|
|
2690
|
-
function handlePrintWristband(
|
|
2773
|
+
function handlePrintWristband(_x24) {
|
|
2691
2774
|
return _handlePrintWristband.apply(this, arguments);
|
|
2692
2775
|
}
|
|
2693
2776
|
return handlePrintWristband;
|
|
@@ -2762,7 +2845,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2762
2845
|
}
|
|
2763
2846
|
}, _callee33, this);
|
|
2764
2847
|
}));
|
|
2765
|
-
function handleRedeem(
|
|
2848
|
+
function handleRedeem(_x25) {
|
|
2766
2849
|
return _handleRedeem.apply(this, arguments);
|
|
2767
2850
|
}
|
|
2768
2851
|
return handleRedeem;
|
|
@@ -7,6 +7,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
|
|
9
9
|
import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
|
|
10
|
+
import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
@@ -322,11 +323,16 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
322
323
|
var quantity = (ctx === null || ctx === void 0 ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : (_cacheItem$_extend$qu = cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend2 = cacheItem._extend) === null || _cacheItem$_extend2 === void 0 ? void 0 : _cacheItem$_extend2.quantity) !== null && _cacheItem$_extend$qu !== void 0 ? _cacheItem$_extend$qu : 1;
|
|
323
324
|
var resolvedPid = (_cacheItem$product_id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id) !== null && _cacheItem$product_id !== void 0 ? _cacheItem$product_id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id;
|
|
324
325
|
var extend = (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {};
|
|
326
|
+
var productSku = buildProductSkuFromCacheItem(cacheItem);
|
|
325
327
|
return {
|
|
326
328
|
id: (_cacheItem$id = cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.id) !== null && _cacheItem$id !== void 0 ? _cacheItem$id : cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_id,
|
|
327
329
|
product_id: resolvedPid,
|
|
328
330
|
variant_id: (_ref5 = (_other$product_varian = other === null || other === void 0 ? void 0 : other.product_variant_id) !== null && _other$product_varian !== void 0 ? _other$product_varian : other === null || other === void 0 ? void 0 : other.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0,
|
|
329
331
|
quantity: quantity,
|
|
332
|
+
// 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
|
|
333
|
+
product_sku: productSku ? _objectSpread(_objectSpread({}, productSku), {}, {
|
|
334
|
+
option: (other === null || other === void 0 ? void 0 : other.option) || []
|
|
335
|
+
}) : undefined,
|
|
330
336
|
option: (other === null || other === void 0 ? void 0 : other.option) || [],
|
|
331
337
|
bundle: (other === null || other === void 0 ? void 0 : other.bundle) || (extend === null || extend === void 0 || (_extend$skuValue = extend.skuValue) === null || _extend$skuValue === void 0 ? void 0 : _extend$skuValue.bundle) || (extend === null || extend === void 0 || (_extend$_skuValue = extend._skuValue) === null || _extend$_skuValue === void 0 ? void 0 : _extend$_skuValue.bundle) || [],
|
|
332
338
|
unique: other === null || other === void 0 ? void 0 : other.unique,
|
|
@@ -24,6 +24,14 @@ export interface GlobalScanApplyHost {
|
|
|
24
24
|
cacheItem: any;
|
|
25
25
|
};
|
|
26
26
|
addProductToOrder(product: any, booking?: any): Promise<any>;
|
|
27
|
+
refreshWalletAssets?(params?: {
|
|
28
|
+
preserveSelection?: boolean;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
scanWalletAsset?(code: string): Promise<{
|
|
31
|
+
type: 'walletCode' | 'normalCode';
|
|
32
|
+
asset?: any;
|
|
33
|
+
selected: boolean;
|
|
34
|
+
}>;
|
|
27
35
|
}
|
|
28
36
|
/**
|
|
29
37
|
* 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
|