@pisell/pisellos 2.2.278 → 2.2.279
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BaseModule.d.ts +1 -0
- package/dist/modules/BaseModule.js +24 -28
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- 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.js +2 -2
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +868 -675
- package/dist/modules/Order/types.d.ts +22 -1
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +71 -34
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +14 -4
- package/dist/modules/Payment/walletpass.js +21 -7
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -13
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.js +153 -56
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +20 -0
- package/dist/server/index.js +1101 -909
- package/dist/server/modules/order/index.d.ts +2 -0
- package/dist/server/modules/order/index.js +261 -96
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +10 -1
- package/dist/solution/BaseSales/index.js +201 -148
- package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +18 -2
- package/dist/solution/BookingTicket/index.js +125 -77
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1142 -739
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +97 -45
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/dist/solution/UnifiedBookingSales/index.js +2211 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1167 -841
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -0
- package/lib/modules/BaseModule.d.ts +1 -0
- package/lib/modules/BaseModule.js +24 -37
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- 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.js +1 -1
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +372 -156
- package/lib/modules/Order/types.d.ts +22 -1
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +39 -6
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +7 -0
- package/lib/modules/Payment/walletpass.js +12 -0
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +49 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.js +117 -25
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +20 -0
- package/lib/server/index.js +124 -19
- package/lib/server/modules/order/index.d.ts +2 -0
- package/lib/server/modules/order/index.js +75 -5
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +10 -1
- package/lib/solution/BaseSales/index.js +73 -29
- package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +18 -2
- package/lib/solution/BookingTicket/index.js +63 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -182
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +60 -18
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
- package/lib/solution/UnifiedBookingSales/index.js +1273 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +322 -110
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, ProductData, AccountModule, AccountListModule, DateModule, GuestListModule, OrderModule, PaymentModule, ResourceListModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } 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;
|
|
@@ -16,6 +16,7 @@ export interface BookingByStepState {
|
|
|
16
16
|
schedule: ScheduleModule;
|
|
17
17
|
salesSummary?: SalesSummaryModule;
|
|
18
18
|
scanOrderLogger?: ScanOrderLoggerModule;
|
|
19
|
+
holder: HolderModule;
|
|
19
20
|
}
|
|
20
21
|
export declare function createModule<T extends keyof BookingByStepState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingByStepState[T];
|
|
21
22
|
export declare enum BookingByStepHooks {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule } from "../../modules";
|
|
1
|
+
import { ProductList, CartModule, AccountListModule, DateModule, OrderModule, PaymentModule, StepModule, SummaryModule, SalesSummaryModule, ScheduleModule, ScanOrderLoggerModule, HolderModule } from "../../modules";
|
|
2
2
|
export function createModule(moduleName, solutionName, name, version) {
|
|
3
3
|
switch (moduleName) {
|
|
4
4
|
case 'cart':
|
|
@@ -23,6 +23,8 @@ 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);
|
|
26
28
|
default:
|
|
27
29
|
throw new Error("Unknown module type: ".concat(moduleName));
|
|
28
30
|
}
|
|
@@ -23,11 +23,27 @@ 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;
|
|
26
27
|
var id = d.bundle_product_id;
|
|
27
28
|
var variantId = d.bundle_variant_id;
|
|
28
29
|
var item = ((capacity === null || capacity === void 0 ? void 0 : capacity.package) || []).find(function (item) {
|
|
29
|
-
return item.product_id
|
|
30
|
+
return item.product_id == id || item.product_id == variantId;
|
|
30
31
|
});
|
|
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
|
+
}
|
|
31
47
|
return {
|
|
32
48
|
id: id,
|
|
33
49
|
value: item ? d.num || 0 : 0,
|
|
@@ -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
|
* 给定一个时间列表,通过开始和结束时间过滤出符合条件的时间段
|
|
@@ -91,8 +91,14 @@ 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
|
|
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;
|
|
95
98
|
var currentTime = dayjs();
|
|
99
|
+
var resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
100
|
+
var targetDay = targetDate ? dayjs(targetDate) : currentTime;
|
|
101
|
+
var isTargetDayToday = targetDay.isSame(currentTime, 'day');
|
|
96
102
|
var fastestTime = null;
|
|
97
103
|
var fastestResources = [];
|
|
98
104
|
console.log('[TimeslotUtils] 查找最快可用资源:', {
|
|
@@ -108,17 +114,18 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
108
114
|
try {
|
|
109
115
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
110
116
|
var _resource = _step2.value;
|
|
111
|
-
//
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
// 获取资源在目标日期且还在工作时间内的时间段
|
|
118
|
+
var targetDayTimes = _resource.times.filter(function (time) {
|
|
119
|
+
var isSameTargetDay = dayjs(time.start_at).isSame(targetDay, 'day');
|
|
120
|
+
if (!isSameTargetDay) return false;
|
|
121
|
+
if (!isTargetDayToday) return true;
|
|
122
|
+
return dayjs(time.end_at).isAfter(currentTime);
|
|
116
123
|
});
|
|
117
|
-
if (
|
|
124
|
+
if (targetDayTimes.length === 0) {
|
|
118
125
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, ") \u4ECA\u65E5\u65E0\u53EF\u7528\u65F6\u95F4\u6BB5"));
|
|
119
126
|
continue;
|
|
120
127
|
}
|
|
121
|
-
var _iterator4 = _createForOfIteratorHelper(
|
|
128
|
+
var _iterator4 = _createForOfIteratorHelper(targetDayTimes),
|
|
122
129
|
_step4;
|
|
123
130
|
try {
|
|
124
131
|
var _loop = function _loop() {
|
|
@@ -128,7 +135,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
128
135
|
var workEndTime = dayjs(time.end_at);
|
|
129
136
|
|
|
130
137
|
// 确定检查的起始时间(当前时间 vs 工作开始时间)
|
|
131
|
-
var nextAvailableTime = currentTime.
|
|
138
|
+
var nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
132
139
|
console.log("[TimeslotUtils] \u68C0\u67E5\u8D44\u6E90 ".concat(_resource.id, "(").concat(_resource.main_field, "):"), {
|
|
133
140
|
workTime: "".concat(workStartTime.format('HH:mm'), "-").concat(workEndTime.format('HH:mm')),
|
|
134
141
|
checkStartTime: nextAvailableTime.format('HH:mm:ss'),
|
|
@@ -165,7 +172,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
165
172
|
// 检查资源类型和容量
|
|
166
173
|
if (_resource.resourceType === 'single' || (_resource.capacity || 1) === 1) {
|
|
167
174
|
// 单人预约资源:检查时间冲突
|
|
168
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
175
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
169
176
|
// 有冲突,使用事件结束时间
|
|
170
177
|
finalAvailableTime = _eventEnd;
|
|
171
178
|
console.log("[TimeslotUtils] \u53D1\u73B0\u65F6\u95F4\u51B2\u7A81\uFF0C\u8C03\u6574\u5230: ".concat(finalAvailableTime.format('HH:mm:ss')));
|
|
@@ -177,7 +184,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
177
184
|
var eventUsedCapacity = _event.pax || 1;
|
|
178
185
|
|
|
179
186
|
// 如果在事件时间范围内,检查容量是否足够
|
|
180
|
-
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(
|
|
187
|
+
if (finalAvailableTime.isBefore(_eventEnd) && _eventStart.isBefore(finalAvailableTime.add(resolvedDuration, 'minute'))) {
|
|
181
188
|
var totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
182
189
|
if (totalRequiredCapacity > totalCapacity) {
|
|
183
190
|
// 容量不足,使用事件结束时间
|
|
@@ -194,7 +201,7 @@ export function findFastestAvailableResource(_ref2) {
|
|
|
194
201
|
} finally {
|
|
195
202
|
_iterator5.f();
|
|
196
203
|
}
|
|
197
|
-
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
204
|
+
if (finalAvailableTime.add(resolvedDuration, 'minute').isAfter(workEndTime)) {
|
|
198
205
|
console.log("[TimeslotUtils] \u8D44\u6E90 ".concat(_resource.id, " \u53EF\u7528\u65F6\u95F4\u8D85\u51FA\u5DE5\u4F5C\u65F6\u95F4\uFF0C\u8DF3\u8FC7"));
|
|
199
206
|
return 0; // continue
|
|
200
207
|
}
|
|
@@ -29,6 +29,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
29
29
|
private addTimeProductsCatalog;
|
|
30
30
|
private orderCustomerDiscountRefreshInFlight;
|
|
31
31
|
private orderCustomerDiscountRefreshCustomerId;
|
|
32
|
+
private orderCustomerPromotionRefreshInFlight;
|
|
32
33
|
private loadOpenDataConfigInFlight;
|
|
33
34
|
/**
|
|
34
35
|
* 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext。
|
|
@@ -63,6 +64,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
63
64
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
64
65
|
private hydrateOrderCustomerFromScanDiscounts;
|
|
65
66
|
private getDiscountCustomerId;
|
|
67
|
+
resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
|
|
68
|
+
/** 兼容既有优惠码扫码逻辑。 */
|
|
66
69
|
private resolveCustomerByDiscountCustomerId;
|
|
67
70
|
private findCustomerById;
|
|
68
71
|
private normalizeCustomer;
|
|
@@ -282,7 +285,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
282
285
|
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
283
286
|
/** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
|
|
284
287
|
private buildOrderCustomerPayload;
|
|
285
|
-
|
|
288
|
+
protected refreshDiscountConfigAfterOrderCustomerChange(customerId: number | null): Promise<void>;
|
|
289
|
+
protected waitForOrderCustomerPromotionRefresh(): Promise<void>;
|
|
286
290
|
/**
|
|
287
291
|
* 获取客户分页信息
|
|
288
292
|
* @returns 分页信息
|
|
@@ -445,7 +449,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
445
449
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
446
450
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
447
451
|
*/
|
|
448
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
452
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
453
|
+
action: "reloadCatalog";
|
|
454
|
+
} | {
|
|
455
|
+
action: "add";
|
|
456
|
+
cacheItem: any;
|
|
457
|
+
} | {
|
|
458
|
+
action: "requiresDetail";
|
|
459
|
+
payload: AddProductRequiresDetailPayload;
|
|
460
|
+
} | {
|
|
461
|
+
action: "requiresBookingEdit";
|
|
462
|
+
cacheItem: any;
|
|
463
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
464
|
+
};
|
|
449
465
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
450
466
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
451
467
|
/**
|
|
@@ -52,6 +52,7 @@ import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resol
|
|
|
52
52
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
53
53
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
54
54
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
55
|
+
var USER_PLATFORM = ['pc', 'h5'];
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
* 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
|
|
@@ -178,6 +179,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
178
179
|
_defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
|
|
179
180
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
180
181
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
182
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
181
183
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
182
184
|
return _this;
|
|
183
185
|
}
|
|
@@ -400,35 +402,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
400
402
|
value: function () {
|
|
401
403
|
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
402
404
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
403
|
-
var
|
|
405
|
+
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
404
406
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
405
407
|
while (1) switch (_context5.prev = _context5.next) {
|
|
406
408
|
case 0:
|
|
407
409
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
410
|
this.setPaymentNumberDevicePrefix(null);
|
|
409
|
-
openDataConfig = null;
|
|
410
|
-
_context5.prev = 2;
|
|
411
|
-
_context5.next = 5;
|
|
412
|
-
return this.loadOpenDataConfig();
|
|
413
|
-
case 5:
|
|
414
|
-
openDataConfig = _context5.sent;
|
|
415
|
-
_context5.next = 12;
|
|
416
|
-
break;
|
|
417
|
-
case 8:
|
|
418
|
-
_context5.prev = 8;
|
|
419
|
-
_context5.t0 = _context5["catch"](2);
|
|
420
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
421
|
-
return _context5.abrupt("return");
|
|
422
|
-
case 12:
|
|
423
|
-
// if (!openDataConfig) return;
|
|
424
411
|
idGenerator = this.getIdGeneratorPlugin();
|
|
425
412
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
426
|
-
_context5.next =
|
|
413
|
+
_context5.next = 5;
|
|
427
414
|
break;
|
|
428
415
|
}
|
|
429
416
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
430
417
|
return _context5.abrupt("return");
|
|
418
|
+
case 5:
|
|
419
|
+
openDataConfig = null;
|
|
420
|
+
_context5.prev = 6;
|
|
421
|
+
_context5.next = 9;
|
|
422
|
+
return this.loadOpenDataConfig();
|
|
423
|
+
case 9:
|
|
424
|
+
openDataConfig = _context5.sent;
|
|
425
|
+
_context5.next = 16;
|
|
426
|
+
break;
|
|
427
|
+
case 12:
|
|
428
|
+
_context5.prev = 12;
|
|
429
|
+
_context5.t0 = _context5["catch"](6);
|
|
430
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
|
|
431
|
+
return _context5.abrupt("return");
|
|
431
432
|
case 16:
|
|
433
|
+
// if (!openDataConfig) return;
|
|
432
434
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
433
435
|
receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
|
|
434
436
|
prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
|
|
@@ -475,7 +477,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
475
477
|
case "end":
|
|
476
478
|
return _context5.stop();
|
|
477
479
|
}
|
|
478
|
-
}, _callee5, this, [[
|
|
480
|
+
}, _callee5, this, [[6, 12], [30, 35]]);
|
|
479
481
|
}));
|
|
480
482
|
function configureIdGeneratorFromOpenData() {
|
|
481
483
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -559,7 +561,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
559
561
|
key: "scanPromotionCode",
|
|
560
562
|
value: function () {
|
|
561
563
|
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
|
|
562
|
-
var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
|
|
564
|
+
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
563
565
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
564
566
|
while (1) switch (_context7.prev = _context7.next) {
|
|
565
567
|
case 0:
|
|
@@ -575,33 +577,34 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
575
577
|
raw = _context7.sent;
|
|
576
578
|
scannedList = raw.scannedDiscountList || [];
|
|
577
579
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
578
|
-
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
579
|
-
|
|
580
|
-
|
|
580
|
+
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
581
|
+
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
582
|
+
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
583
|
+
_context7.next = 12;
|
|
581
584
|
break;
|
|
582
585
|
}
|
|
583
|
-
_context7.next =
|
|
586
|
+
_context7.next = 12;
|
|
584
587
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
585
|
-
case
|
|
588
|
+
case 12:
|
|
586
589
|
if (!raw.isAvailable) {
|
|
587
|
-
_context7.next =
|
|
590
|
+
_context7.next = 19;
|
|
588
591
|
break;
|
|
589
592
|
}
|
|
590
|
-
_context7.next =
|
|
593
|
+
_context7.next = 15;
|
|
591
594
|
return this.store.order.recalculateSummary({
|
|
592
595
|
createIfMissing: true
|
|
593
596
|
});
|
|
594
|
-
case
|
|
597
|
+
case 15:
|
|
595
598
|
this.store.order.persistTempOrder();
|
|
596
599
|
tempOrder = this.store.order.ensureTempOrder();
|
|
597
|
-
_context7.next =
|
|
600
|
+
_context7.next = 19;
|
|
598
601
|
return this.effectsEmit('onDiscountApplied', {
|
|
599
602
|
productList: tempOrder.products || [],
|
|
600
603
|
discountList: this.store.order.getDiscountList(),
|
|
601
604
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
602
605
|
tempOrder: tempOrder
|
|
603
606
|
});
|
|
604
|
-
case
|
|
607
|
+
case 19:
|
|
605
608
|
return _context7.abrupt("return", _objectSpread(_objectSpread({
|
|
606
609
|
isAvailable: raw.isAvailable
|
|
607
610
|
}, raw.isAccepted !== undefined ? {
|
|
@@ -611,7 +614,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
611
614
|
unavailableReason: raw.unavailableReason,
|
|
612
615
|
scannedDiscountList: raw.scannedDiscountList
|
|
613
616
|
}));
|
|
614
|
-
case
|
|
617
|
+
case 20:
|
|
615
618
|
case "end":
|
|
616
619
|
return _context7.stop();
|
|
617
620
|
}
|
|
@@ -688,11 +691,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
688
691
|
return null;
|
|
689
692
|
}
|
|
690
693
|
}, {
|
|
691
|
-
key: "
|
|
694
|
+
key: "resolveCustomerById",
|
|
692
695
|
value: function () {
|
|
693
|
-
var
|
|
696
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
|
|
694
697
|
var _result$list;
|
|
695
|
-
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
|
|
698
|
+
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
|
|
696
699
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
697
700
|
while (1) switch (_context9.prev = _context9.next) {
|
|
698
701
|
case 0:
|
|
@@ -714,18 +717,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
714
717
|
case 7:
|
|
715
718
|
result = _context9.sent;
|
|
716
719
|
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
717
|
-
|
|
718
|
-
|
|
720
|
+
if (!remoteCustomer) {
|
|
721
|
+
_context9.next = 11;
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
return _context9.abrupt("return", this.normalizeCustomer(remoteCustomer));
|
|
725
|
+
case 11:
|
|
726
|
+
_context9.prev = 11;
|
|
727
|
+
_context9.next = 14;
|
|
728
|
+
return this.store.customer.queryCustomerDetail(customerId);
|
|
729
|
+
case 14:
|
|
730
|
+
detailCustomer = _context9.sent;
|
|
731
|
+
return _context9.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
|
|
732
|
+
case 18:
|
|
733
|
+
_context9.prev = 18;
|
|
734
|
+
_context9.t0 = _context9["catch"](11);
|
|
735
|
+
console.warn('[BookingTicket] resolveCustomerById detail request failed', {
|
|
736
|
+
customerId: customerId,
|
|
737
|
+
error: _context9.t0
|
|
738
|
+
});
|
|
739
|
+
return _context9.abrupt("return", null);
|
|
740
|
+
case 22:
|
|
719
741
|
case "end":
|
|
720
742
|
return _context9.stop();
|
|
721
743
|
}
|
|
722
|
-
}, _callee9, this);
|
|
744
|
+
}, _callee9, this, [[11, 18]]);
|
|
723
745
|
}));
|
|
724
|
-
function
|
|
725
|
-
return
|
|
746
|
+
function resolveCustomerById(_x6) {
|
|
747
|
+
return _resolveCustomerById.apply(this, arguments);
|
|
726
748
|
}
|
|
727
|
-
return
|
|
728
|
-
}()
|
|
749
|
+
return resolveCustomerById;
|
|
750
|
+
}() /** 兼容既有优惠码扫码逻辑。 */
|
|
751
|
+
}, {
|
|
752
|
+
key: "resolveCustomerByDiscountCustomerId",
|
|
753
|
+
value: function resolveCustomerByDiscountCustomerId(customerId) {
|
|
754
|
+
return this.resolveCustomerById(customerId);
|
|
755
|
+
}
|
|
729
756
|
}, {
|
|
730
757
|
key: "findCustomerById",
|
|
731
758
|
value: function findCustomerById() {
|
|
@@ -1532,7 +1559,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1532
1559
|
}, {
|
|
1533
1560
|
key: "setOrderCustomer",
|
|
1534
1561
|
value: function setOrderCustomer(customer) {
|
|
1535
|
-
var _this$store$order$get3
|
|
1562
|
+
var _this$store$order$get3,
|
|
1563
|
+
_this3 = this;
|
|
1536
1564
|
if (!customer) {
|
|
1537
1565
|
this.clearOrderCustomer();
|
|
1538
1566
|
return;
|
|
@@ -1561,8 +1589,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1561
1589
|
this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
|
|
1562
1590
|
this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
|
|
1563
1591
|
// 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
|
|
1564
|
-
|
|
1592
|
+
var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
|
|
1593
|
+
return undefined;
|
|
1594
|
+
});
|
|
1595
|
+
this.orderCustomerPromotionRefreshInFlight = promotionRefreshTask;
|
|
1596
|
+
void promotionRefreshTask.then(function () {
|
|
1597
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1598
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1599
|
+
}, function (error) {
|
|
1565
1600
|
console.error('[BookingTicket] applyPromotion after customer change failed', error);
|
|
1601
|
+
if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
|
|
1602
|
+
_this3.orderCustomerPromotionRefreshInFlight = null;
|
|
1566
1603
|
});
|
|
1567
1604
|
}
|
|
1568
1605
|
|
|
@@ -1592,7 +1629,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1592
1629
|
value: function clearOrderCustomer() {
|
|
1593
1630
|
var _discountModule$setOr,
|
|
1594
1631
|
_discountModule$setDi,
|
|
1595
|
-
|
|
1632
|
+
_this4 = this;
|
|
1596
1633
|
this.store.order.clearOrderCustomer();
|
|
1597
1634
|
this.discountConfigCacheKey = null;
|
|
1598
1635
|
this.hasManualDiscountSelection = false;
|
|
@@ -1605,9 +1642,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1605
1642
|
createIfMissing: true
|
|
1606
1643
|
}).then(function () {
|
|
1607
1644
|
var _discountModule$getDi;
|
|
1608
|
-
var tempOrder =
|
|
1609
|
-
|
|
1610
|
-
return
|
|
1645
|
+
var tempOrder = _this4.store.order.ensureTempOrder();
|
|
1646
|
+
_this4.store.order.persistTempOrder();
|
|
1647
|
+
return _this4.effectsEmit('onDiscountApplied', {
|
|
1611
1648
|
productList: tempOrder.products || [],
|
|
1612
1649
|
discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
|
|
1613
1650
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
@@ -1668,14 +1705,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1668
1705
|
}, {
|
|
1669
1706
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
1670
1707
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
1671
|
-
var
|
|
1672
|
-
if (!customerId || customerId === 1) return;
|
|
1708
|
+
var _this5 = this;
|
|
1709
|
+
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1673
1710
|
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
|
|
1674
|
-
return;
|
|
1711
|
+
return this.orderCustomerDiscountRefreshInFlight;
|
|
1675
1712
|
}
|
|
1676
1713
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1677
1714
|
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1678
|
-
var
|
|
1715
|
+
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1716
|
+
var currentCustomer, tempOrder, orderId, action;
|
|
1679
1717
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1680
1718
|
while (1) switch (_context22.prev = _context22.next) {
|
|
1681
1719
|
case 0:
|
|
@@ -1688,18 +1726,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1688
1726
|
return undefined;
|
|
1689
1727
|
});
|
|
1690
1728
|
case 3:
|
|
1691
|
-
currentCustomer =
|
|
1729
|
+
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1692
1730
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1693
1731
|
_context22.next = 6;
|
|
1694
1732
|
break;
|
|
1695
1733
|
}
|
|
1696
1734
|
return _context22.abrupt("return");
|
|
1697
1735
|
case 6:
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1736
|
+
tempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
|
|
1737
|
+
orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
|
|
1738
|
+
action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1739
|
+
_context22.next = 11;
|
|
1740
|
+
return _this5.loadDiscountConfig({
|
|
1741
|
+
customerId: customerId,
|
|
1742
|
+
action: action
|
|
1701
1743
|
});
|
|
1702
|
-
case
|
|
1744
|
+
case 11:
|
|
1703
1745
|
case "end":
|
|
1704
1746
|
return _context22.stop();
|
|
1705
1747
|
}
|
|
@@ -1710,10 +1752,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1710
1752
|
refreshTask.catch(function (error) {
|
|
1711
1753
|
console.error('Failed to load discount config after customer change:', error);
|
|
1712
1754
|
}).finally(function () {
|
|
1713
|
-
if (
|
|
1714
|
-
|
|
1715
|
-
|
|
1755
|
+
if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
1756
|
+
_this5.orderCustomerDiscountRefreshInFlight = null;
|
|
1757
|
+
_this5.orderCustomerDiscountRefreshCustomerId = null;
|
|
1716
1758
|
});
|
|
1759
|
+
return refreshTask;
|
|
1760
|
+
}
|
|
1761
|
+
}, {
|
|
1762
|
+
key: "waitForOrderCustomerPromotionRefresh",
|
|
1763
|
+
value: function waitForOrderCustomerPromotionRefresh() {
|
|
1764
|
+
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
1717
1765
|
}
|
|
1718
1766
|
|
|
1719
1767
|
/**
|
|
@@ -1897,11 +1945,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1897
1945
|
}, {
|
|
1898
1946
|
key: "scanGlobalListener",
|
|
1899
1947
|
value: function scanGlobalListener(callback) {
|
|
1900
|
-
var
|
|
1948
|
+
var _this6 = this;
|
|
1901
1949
|
var localSearch = function localSearch(v) {
|
|
1902
|
-
return
|
|
1950
|
+
return _this6.store.products.findProductsByCodeOrBarcode(v);
|
|
1903
1951
|
};
|
|
1904
|
-
var scanCallback = handleGlobalScan(this.request, localSearch);
|
|
1952
|
+
var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
1905
1953
|
var safeCallback = function safeCallback(d) {
|
|
1906
1954
|
try {
|
|
1907
1955
|
callback(d);
|
|
@@ -2375,7 +2423,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2375
2423
|
key: "handleGlobalScanCode",
|
|
2376
2424
|
value: (function () {
|
|
2377
2425
|
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
|
|
2378
|
-
var
|
|
2426
|
+
var _this7 = this;
|
|
2379
2427
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2380
2428
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2381
2429
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2393,9 +2441,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2393
2441
|
case 4:
|
|
2394
2442
|
_context28.prev = 4;
|
|
2395
2443
|
localSearch = function localSearch(v) {
|
|
2396
|
-
return
|
|
2444
|
+
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2397
2445
|
};
|
|
2398
|
-
scanCallback = handleGlobalScan(this.request, localSearch);
|
|
2446
|
+
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2399
2447
|
_context28.next = 9;
|
|
2400
2448
|
return scanCallback({
|
|
2401
2449
|
type: 'nativeScanner',
|
|
@@ -2417,35 +2465,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2417
2465
|
_context28.next = 16;
|
|
2418
2466
|
return applyGlobalScan({
|
|
2419
2467
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2420
|
-
return
|
|
2468
|
+
return _this7.setOrderCustomer(customer);
|
|
2421
2469
|
},
|
|
2422
2470
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2423
|
-
return
|
|
2471
|
+
return _this7.getOrderCustomerSnapshot();
|
|
2424
2472
|
},
|
|
2425
2473
|
getBusinessCode: function getBusinessCode() {
|
|
2426
|
-
var
|
|
2427
|
-
return (
|
|
2474
|
+
var _this7$otherParams;
|
|
2475
|
+
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
2428
2476
|
},
|
|
2429
2477
|
buildAddProductCtx: function buildAddProductCtx(extra) {
|
|
2430
|
-
return
|
|
2478
|
+
return _this7.buildAddProductCtx(extra);
|
|
2431
2479
|
},
|
|
2432
2480
|
decideAddProduct: function decideAddProduct(item, options) {
|
|
2433
|
-
return
|
|
2481
|
+
return _this7.decideAddProduct(item, options);
|
|
2434
2482
|
},
|
|
2435
2483
|
decideAfterDetail: function decideAfterDetail(cacheItem, options) {
|
|
2436
|
-
return
|
|
2484
|
+
return _this7.decideAfterDetail(cacheItem, options);
|
|
2437
2485
|
},
|
|
2438
2486
|
transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
|
|
2439
|
-
return
|
|
2487
|
+
return _this7.transformDetailToProductAndBooking(input);
|
|
2440
2488
|
},
|
|
2441
2489
|
addProductToOrder: function addProductToOrder(product, booking) {
|
|
2442
|
-
return
|
|
2490
|
+
return _this7.addProductToOrder(product, booking);
|
|
2443
2491
|
},
|
|
2444
2492
|
refreshWalletAssets: function refreshWalletAssets(params) {
|
|
2445
|
-
return
|
|
2493
|
+
return _this7.refreshWalletAssets(params);
|
|
2446
2494
|
},
|
|
2447
2495
|
scanWalletAsset: function scanWalletAsset(scanCode) {
|
|
2448
|
-
return
|
|
2496
|
+
return _this7.scanWalletAsset(scanCode);
|
|
2449
2497
|
}
|
|
2450
2498
|
}, formatted, bridge);
|
|
2451
2499
|
case 16:
|
|
@@ -2584,7 +2632,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2584
2632
|
key: "addAddTimeProductsToBooking",
|
|
2585
2633
|
value: (function () {
|
|
2586
2634
|
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
|
|
2587
|
-
var
|
|
2635
|
+
var _this8 = this,
|
|
2588
2636
|
_input$bookingPatch;
|
|
2589
2637
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2590
2638
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
@@ -2599,7 +2647,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2599
2647
|
case 3:
|
|
2600
2648
|
orderLines = (input.products || []).map(function (line) {
|
|
2601
2649
|
return {
|
|
2602
|
-
product:
|
|
2650
|
+
product: _this8.buildAddTimeOrderLine(line, bookingUid)
|
|
2603
2651
|
};
|
|
2604
2652
|
});
|
|
2605
2653
|
if (this.store.order) {
|
|
@@ -2,9 +2,11 @@ import { RequestPlugin } from '../../../../plugins';
|
|
|
2
2
|
/**
|
|
3
3
|
* 处理全局扫码
|
|
4
4
|
* @param request 请求插件
|
|
5
|
+
* @param localSearch 本地商品搜索
|
|
6
|
+
* @param channel 当前销售渠道
|
|
5
7
|
* @returns 处理结果
|
|
6
8
|
*/
|
|
7
|
-
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
|
|
9
|
+
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[], channel?: string) => (scanResult: {
|
|
8
10
|
type: string;
|
|
9
11
|
value: string;
|
|
10
12
|
}) => Promise<any>;
|