@pisell/pisellos 0.10.7 → 0.10.9
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.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
- 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 +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +32 -6
- package/dist/modules/Order/index.js +1165 -819
- package/dist/modules/Order/types.d.ts +32 -4
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +28 -2
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.js +894 -781
- 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/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +41 -7
- package/dist/solution/BaseSales/index.js +1405 -974
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -162
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.js +25 -64
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/dist/solution/UnifiedBookingSales/index.js +51 -39
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
- 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 +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +32 -6
- package/lib/modules/Order/index.js +518 -148
- package/lib/modules/Order/types.d.ts +32 -4
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +30 -2
- package/lib/server/index.d.ts +15 -0
- package/lib/server/index.js +105 -14
- 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/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +41 -7
- package/lib/solution/BaseSales/index.js +325 -39
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +31 -6
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.js +17 -54
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
- package/lib/solution/UnifiedBookingSales/index.js +35 -26
- package/package.json +1 -1
|
@@ -118,12 +118,15 @@ export interface BookingTicketCartBookingView extends ISalesBooking {
|
|
|
118
118
|
canAddTime: boolean;
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
+
export type BookingTicketCartLineView = BookingTicketCartBookingView | BookingTicketCartItemView;
|
|
121
122
|
/**
|
|
122
123
|
* BookingTicket 面向 UI 的购物车视图。
|
|
123
124
|
*/
|
|
124
125
|
export interface BookingTicketCartView {
|
|
125
126
|
bookings: BookingTicketCartBookingView[];
|
|
126
127
|
items: BookingTicketCartItemView[];
|
|
128
|
+
/** 以 tempOrder.products 为唯一顺序真源的统一购物车行(旧到新)。 */
|
|
129
|
+
lines: BookingTicketCartLineView[];
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
129
132
|
* BookingTicket 面向 UI 的客户展示视图。
|
|
@@ -318,7 +318,7 @@ export function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
318
318
|
* 把 cacheItem._extend.other 中的字段 + 顶层运行态拼成 `BaseProductDetailPayload`。
|
|
319
319
|
*/
|
|
320
320
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
321
|
-
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2;
|
|
321
|
+
var _cacheItem$_extend, _cacheItem$_extend$qu, _cacheItem$_extend2, _cacheItem$product_id, _cacheItem$id, _ref5, _other$product_varian, _extend$skuValue, _extend$_skuValue, _extend$price, _extend$price2, _cacheItem$metadata$s, _cacheItem$metadata, _extend$metadata;
|
|
322
322
|
var other = (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.other) || {};
|
|
323
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;
|
|
324
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;
|
|
@@ -347,6 +347,7 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
347
347
|
bundle_edit: extend === null || extend === void 0 ? void 0 : extend.bundle_edit,
|
|
348
348
|
discount_reason: extend === null || extend === void 0 ? void 0 : extend.discount_reason,
|
|
349
349
|
discount_list: cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.discount_list,
|
|
350
|
+
selected_settlement_snapshot: (_cacheItem$metadata$s = cacheItem === null || cacheItem === void 0 || (_cacheItem$metadata = cacheItem.metadata) === null || _cacheItem$metadata === void 0 ? void 0 : _cacheItem$metadata.selected_settlement_snapshot) !== null && _cacheItem$metadata$s !== void 0 ? _cacheItem$metadata$s : extend === null || extend === void 0 || (_extend$metadata = extend.metadata) === null || _extend$metadata === void 0 ? void 0 : _extend$metadata.selected_settlement_snapshot,
|
|
350
351
|
_extend: extend
|
|
351
352
|
};
|
|
352
353
|
}
|
|
@@ -108,33 +108,28 @@ export function buildCartView(lines, bookings) {
|
|
|
108
108
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
109
109
|
var productLines = Array.isArray(lines) ? lines : [];
|
|
110
110
|
var bookingList = Array.isArray(bookings) ? bookings : [];
|
|
111
|
+
var childBookings = bookingList.filter(function (booking) {
|
|
112
|
+
return booking.parent_id !== 0;
|
|
113
|
+
});
|
|
114
|
+
var bookingsByProductUid = indexBookingsByProductUid(childBookings);
|
|
111
115
|
var linesByUid = indexProductsByUid(productLines);
|
|
112
116
|
var addTimeLinesByBookingUid = indexAddTimeProductsByBookingUid(productLines);
|
|
113
|
-
var claimedUids = new Set();
|
|
114
117
|
var claimedAddTimeLines = new Set();
|
|
115
|
-
|
|
116
|
-
return booking.parent_id !== 0;
|
|
117
|
-
}).reduce(function (acc, booking) {
|
|
118
|
-
var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
|
|
118
|
+
childBookings.forEach(function (booking) {
|
|
119
119
|
var bookingUid = getBookingUid(booking);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (!claimedUids.has(key)) {
|
|
124
|
-
var line = linesByUid[key];
|
|
125
|
-
// 赠品预约只作为提交数据保留,不在购物车顶部预约卡片区展示。
|
|
126
|
-
if (isGiftProductLine(line)) return acc;
|
|
127
|
-
if (line) {
|
|
128
|
-
claimedUids.add(key);
|
|
129
|
-
product = line;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
|
|
134
|
-
addTimeProduct.forEach(function (line) {
|
|
135
|
-
return claimedAddTimeLines.add(line);
|
|
120
|
+
if (!bookingUid) return;
|
|
121
|
+
(addTimeLinesByBookingUid[bookingUid] || []).forEach(function (line) {
|
|
122
|
+
claimedAddTimeLines.add(line);
|
|
136
123
|
});
|
|
137
|
-
|
|
124
|
+
});
|
|
125
|
+
var claimedBookings = new Set();
|
|
126
|
+
var cartBookings = [];
|
|
127
|
+
var items = [];
|
|
128
|
+
var orderedLines = [];
|
|
129
|
+
var buildBookingView = function buildBookingView(booking, product) {
|
|
130
|
+
var bookingUid = getBookingUid(booking);
|
|
131
|
+
var addTimeProduct = bookingUid ? addTimeLinesByBookingUid[bookingUid] || [] : [];
|
|
132
|
+
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
138
133
|
_extend: {
|
|
139
134
|
product: product,
|
|
140
135
|
addTimeProduct: addTimeProduct,
|
|
@@ -147,21 +142,38 @@ export function buildCartView(lines, bookings) {
|
|
|
147
142
|
shopOpeningHours: options.shopOpeningHours
|
|
148
143
|
})
|
|
149
144
|
}
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var items = productLines.filter(function (line) {
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
productLines.forEach(function (line) {
|
|
154
148
|
var _line$metadata6;
|
|
155
|
-
//
|
|
156
|
-
if (isGiftProductLine(line)) return
|
|
157
|
-
if (claimedAddTimeLines.has(line)) return false;
|
|
149
|
+
// 赠品由主商品 Gift 行展示;加时商品挂在 booking._extend.addTimeProduct。
|
|
150
|
+
if (isGiftProductLine(line) || claimedAddTimeLines.has(line)) return;
|
|
158
151
|
var uid = (_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6.unique_identification_number;
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
var matchedBooking = uid === undefined || uid === null || uid === '' ? undefined : (bookingsByProductUid[String(uid)] || []).find(function (booking) {
|
|
153
|
+
return !claimedBookings.has(booking);
|
|
154
|
+
});
|
|
155
|
+
if (matchedBooking) {
|
|
156
|
+
claimedBookings.add(matchedBooking);
|
|
157
|
+
var bookingView = buildBookingView(matchedBooking, line);
|
|
158
|
+
cartBookings.push(bookingView);
|
|
159
|
+
orderedLines.push(bookingView);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
items.push(line);
|
|
163
|
+
orderedLines.push(line);
|
|
164
|
+
});
|
|
165
|
+
childBookings.forEach(function (booking) {
|
|
166
|
+
if (claimedBookings.has(booking)) return;
|
|
167
|
+
var uid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
|
|
168
|
+
var linkedProduct = uid === undefined || uid === null || uid === '' ? null : linesByUid[String(uid)] || null;
|
|
169
|
+
// 赠品预约只作为提交数据保留,不在购物车预约卡片区展示。
|
|
170
|
+
if (isGiftProductLine(linkedProduct)) return;
|
|
171
|
+
cartBookings.push(buildBookingView(booking, null));
|
|
161
172
|
});
|
|
162
173
|
return {
|
|
163
174
|
bookings: cartBookings,
|
|
164
|
-
items: items
|
|
175
|
+
items: items,
|
|
176
|
+
lines: orderedLines
|
|
165
177
|
};
|
|
166
178
|
}
|
|
167
179
|
export function isWalkInCustomer(customer) {
|
|
@@ -95,6 +95,7 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
95
95
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
96
96
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
97
97
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
98
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
98
99
|
*/
|
|
99
100
|
private pickBookingsForCurrentPoint;
|
|
100
101
|
/**
|
|
@@ -485,11 +485,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
485
485
|
* 2) 若无 active,返回已超时且仍占用中的预约(允许并发多条)
|
|
486
486
|
* 3) 若仍无,返回最近一组未来预约(同 start_time 的并发预约全部返回)
|
|
487
487
|
* 4) 最后兜底返回一条(避免资源有历史预约时完全无反馈)
|
|
488
|
+
* - includeAllFuture 时,保留选中预约并返回当天全部后续预约;仅详情接口启用。
|
|
488
489
|
*/
|
|
489
490
|
}, {
|
|
490
491
|
key: "pickBookingsForCurrentPoint",
|
|
491
492
|
value: function pickBookingsForCurrentPoint(current, bookings) {
|
|
492
493
|
var _this4 = this;
|
|
494
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
493
495
|
if (bookings.length === 0) return [];
|
|
494
496
|
var currentDayStart = current.startOf('day');
|
|
495
497
|
var currentDayEnd = current.endOf('day');
|
|
@@ -504,6 +506,13 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
504
506
|
if (dayScopedBookings.length === 0) return [];
|
|
505
507
|
var appendNextStartGroupIfNeeded = function appendNextStartGroupIfNeeded(selectedBookings) {
|
|
506
508
|
if (selectedBookings.length === 0) return selectedBookings;
|
|
509
|
+
if (options.includeAllFuture) {
|
|
510
|
+
var allFutureBookings = dayScopedBookings.filter(function (booking) {
|
|
511
|
+
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
512
|
+
return startAt.isValid() && startAt.isAfter(current);
|
|
513
|
+
});
|
|
514
|
+
return [].concat(_toConsumableArray(selectedBookings), _toConsumableArray(allFutureBookings));
|
|
515
|
+
}
|
|
507
516
|
var shouldAppendNextGroup = selectedBookings.some(function (booking) {
|
|
508
517
|
return booking.status === 'reserved' || booking.status === 'occupied';
|
|
509
518
|
});
|
|
@@ -554,6 +563,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
554
563
|
return startAt.isValid() && startAt.isAfter(current) && startAt.isSame(current, 'day');
|
|
555
564
|
});
|
|
556
565
|
if (upcoming.length > 0) {
|
|
566
|
+
if (options.includeAllFuture) return upcoming;
|
|
557
567
|
var firstStartAt = this.toBookingDateTime(upcoming[0].start_date, upcoming[0].start_time).valueOf();
|
|
558
568
|
var upcomingStartGroup = upcoming.filter(function (booking) {
|
|
559
569
|
var startAt = _this4.toBookingDateTime(booking.start_date, booking.start_time);
|
|
@@ -907,7 +917,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
907
917
|
unpaidBookingList = matchedBookingList.filter(function (booking) {
|
|
908
918
|
return _this7.isUnpaidBooking(booking);
|
|
909
919
|
});
|
|
910
|
-
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
|
|
920
|
+
bookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList), {
|
|
921
|
+
includeAllFuture: true
|
|
922
|
+
});
|
|
911
923
|
completedBookings = completedBookingList.map(function (booking) {
|
|
912
924
|
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
913
925
|
status: 'compelete',
|
|
@@ -919,7 +931,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
919
931
|
remainingReserveTime: undefined
|
|
920
932
|
});
|
|
921
933
|
});
|
|
922
|
-
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList)
|
|
934
|
+
unpaidBookings = this.pickBookingsForCurrentPoint(current, this.normalizeResourceBookings(current, deviceCurrent, unpaidBookingList), {
|
|
935
|
+
includeAllFuture: true
|
|
936
|
+
});
|
|
923
937
|
orderCount = this.countBookingOrders(statsBookingList);
|
|
924
938
|
bookingCount = statsBookingList.length;
|
|
925
939
|
compeleteBookingCount = this.countCompletedBookings(statsBookingList);
|
|
@@ -2757,10 +2757,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2757
2757
|
ruleProductsForResource,
|
|
2758
2758
|
occupancyMinutes,
|
|
2759
2759
|
paxBounds,
|
|
2760
|
-
error,
|
|
2761
|
-
_occupancyMinutes,
|
|
2762
|
-
_paxBounds,
|
|
2763
|
-
_error,
|
|
2764
2760
|
occupyDetails,
|
|
2765
2761
|
occupyDetail,
|
|
2766
2762
|
resourceSelectType,
|
|
@@ -2903,59 +2899,24 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2903
2899
|
});
|
|
2904
2900
|
case 46:
|
|
2905
2901
|
loaded = _context37.sent;
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) pendingRequestPaxMax = paxBounds.max;
|
|
2919
|
-
}
|
|
2920
|
-
} else {
|
|
2921
|
-
this.enabledReservationRuleProducts = [];
|
|
2922
|
-
error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2923
|
-
this.logMethodError('loadReservationRuleProducts', error, {
|
|
2924
|
-
resourceId: normalizedResourceId,
|
|
2925
|
-
reservationLinkIds: reservationLinkIds,
|
|
2926
|
-
scheduleDate: scheduleDate,
|
|
2927
|
-
scheduleDatetime: scheduleDatetime,
|
|
2928
|
-
cacheId: this.cacheId
|
|
2929
|
-
});
|
|
2930
|
-
if (Array.isArray(loaded)) {
|
|
2931
|
-
this.enabledReservationRuleProducts = loaded;
|
|
2932
|
-
_occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
|
|
2933
|
-
if (_occupancyMinutes !== undefined) {
|
|
2934
|
-
tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
|
|
2935
|
-
}
|
|
2936
|
-
if (hasCustomCapacityProduct(loaded)) {
|
|
2937
|
-
pendingRequestEntryPax = 1;
|
|
2938
|
-
_paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
|
|
2939
|
-
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
|
|
2940
|
-
if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
|
|
2941
|
-
}
|
|
2942
|
-
} else {
|
|
2943
|
-
this.enabledReservationRuleProducts = [];
|
|
2944
|
-
_error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
|
|
2945
|
-
this.logMethodError('loadReservationRuleProducts', _error, {
|
|
2946
|
-
resourceId: resourceId,
|
|
2947
|
-
reservationLinkIds: reservationLinkIds,
|
|
2948
|
-
scheduleDate: scheduleDate,
|
|
2949
|
-
scheduleDatetime: scheduleDatetime,
|
|
2950
|
-
cacheId: this.cacheId
|
|
2951
|
-
});
|
|
2952
|
-
}
|
|
2902
|
+
matchedRuleProduct = findReservationRuleProductByResourceId(loaded, normalizedResourceId);
|
|
2903
|
+
ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
|
|
2904
|
+
this.enabledReservationRuleProducts = ruleProductsForResource;
|
|
2905
|
+
occupancyMinutes = pickFirstDurationMinutesFromProducts(ruleProductsForResource);
|
|
2906
|
+
if (occupancyMinutes !== undefined) {
|
|
2907
|
+
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
2908
|
+
}
|
|
2909
|
+
if (hasCustomCapacityProduct(ruleProductsForResource)) {
|
|
2910
|
+
pendingRequestEntryPax = 1;
|
|
2911
|
+
paxBounds = pickFirstCustomCapacityPaxBounds(ruleProductsForResource);
|
|
2912
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.min) !== undefined) pendingRequestPaxMin = paxBounds.min;
|
|
2913
|
+
if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) pendingRequestPaxMax = paxBounds.max;
|
|
2953
2914
|
}
|
|
2954
2915
|
|
|
2955
2916
|
// Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
|
|
2956
|
-
_context37.next =
|
|
2917
|
+
_context37.next = 55;
|
|
2957
2918
|
return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
2958
|
-
case
|
|
2919
|
+
case 55:
|
|
2959
2920
|
occupyDetails = _context37.sent;
|
|
2960
2921
|
occupyDetail = (_occupyDetails$ = occupyDetails[0]) !== null && _occupyDetails$ !== void 0 ? _occupyDetails$ : null; // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2961
2922
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2963,7 +2924,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2963
2924
|
allowAddItems = toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.allow_add_items']);
|
|
2964
2925
|
additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
|
|
2965
2926
|
if (!(additionalOrderResult.reason === 'multiple_orders')) {
|
|
2966
|
-
_context37.next =
|
|
2927
|
+
_context37.next = 66;
|
|
2967
2928
|
break;
|
|
2968
2929
|
}
|
|
2969
2930
|
multipleOrdersState = _objectSpread(_objectSpread({}, this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId)), {}, {
|
|
@@ -2984,7 +2945,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2984
2945
|
resourceSelectType: resourceSelectType
|
|
2985
2946
|
});
|
|
2986
2947
|
return _context37.abrupt("return", _availabilityInfo);
|
|
2987
|
-
case
|
|
2948
|
+
case 66:
|
|
2988
2949
|
// Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
|
|
2989
2950
|
resourceState = this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId);
|
|
2990
2951
|
additionalOrderId = additionalOrderResult.order_id;
|
|
@@ -3030,12 +2991,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3030
2991
|
|
|
3031
2992
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
3032
2993
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
3033
|
-
_context37.next =
|
|
2994
|
+
_context37.next = 78;
|
|
3034
2995
|
break;
|
|
3035
2996
|
}
|
|
3036
|
-
_context37.next =
|
|
2997
|
+
_context37.next = 78;
|
|
3037
2998
|
return this.addNewOrder();
|
|
3038
|
-
case
|
|
2999
|
+
case 78:
|
|
3039
3000
|
isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
|
|
3040
3001
|
if (isAdditionalOrderMode) {
|
|
3041
3002
|
tempOrder.order_id = additionalOrderId;
|
|
@@ -3051,13 +3012,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3051
3012
|
} : {}));
|
|
3052
3013
|
return acc;
|
|
3053
3014
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
3054
|
-
_context37.next =
|
|
3015
|
+
_context37.next = 84;
|
|
3055
3016
|
return this.setItemRuleRuntimeConfig({
|
|
3056
3017
|
serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
3057
3018
|
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
3058
3019
|
historicalItems: historicalItems
|
|
3059
3020
|
});
|
|
3060
|
-
case
|
|
3021
|
+
case 84:
|
|
3061
3022
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
3062
3023
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
3063
3024
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -3079,18 +3040,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3079
3040
|
isFull: resourceState.isFull
|
|
3080
3041
|
});
|
|
3081
3042
|
return _context37.abrupt("return", availabilityInfo);
|
|
3082
|
-
case
|
|
3083
|
-
_context37.prev =
|
|
3043
|
+
case 89:
|
|
3044
|
+
_context37.prev = 89;
|
|
3084
3045
|
_context37.t0 = _context37["catch"](3);
|
|
3085
3046
|
this.logMethodError('checkResourceAvailable', _context37.t0.message, {
|
|
3086
3047
|
resourceId: normalizedResourceId
|
|
3087
3048
|
});
|
|
3088
3049
|
throw _context37.t0;
|
|
3089
|
-
case
|
|
3050
|
+
case 93:
|
|
3090
3051
|
case "end":
|
|
3091
3052
|
return _context37.stop();
|
|
3092
3053
|
}
|
|
3093
|
-
}, _callee37, this, [[3,
|
|
3054
|
+
}, _callee37, this, [[3, 89]]);
|
|
3094
3055
|
}));
|
|
3095
3056
|
function checkResourceAvailable(_x20) {
|
|
3096
3057
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -388,35 +388,46 @@ export function attachItemRuleLimitsToTopLevelProducts(productList, limits) {
|
|
|
388
388
|
* 数组元素先按主键排序再序列化,避免顺序差异导致误判为不同行。
|
|
389
389
|
*/
|
|
390
390
|
export function buildProductLineFingerprint(productOptionItem, productBundle) {
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
391
|
+
var normalizeOptions = function normalizeOptions(options) {
|
|
392
|
+
var optionArr = Array.isArray(options) ? options : [];
|
|
393
|
+
return optionArr.map(function (item) {
|
|
394
|
+
var _ref, _item$add_price;
|
|
395
|
+
return {
|
|
396
|
+
option_group_item_id: Number(item === null || item === void 0 ? void 0 : item.option_group_item_id) || 0,
|
|
397
|
+
option_group_id: Number(item === null || item === void 0 ? void 0 : item.option_group_id) || 0,
|
|
398
|
+
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
399
|
+
price: String((_ref = (_item$add_price = item === null || item === void 0 ? void 0 : item.add_price) !== null && _item$add_price !== void 0 ? _item$add_price : item === null || item === void 0 ? void 0 : item.price) !== null && _ref !== void 0 ? _ref : '')
|
|
400
|
+
};
|
|
401
|
+
}).sort(function (p, q) {
|
|
402
|
+
if (p.option_group_item_id !== q.option_group_item_id) {
|
|
403
|
+
return p.option_group_item_id - q.option_group_item_id;
|
|
404
|
+
}
|
|
405
|
+
if (p.option_group_id !== q.option_group_id) {
|
|
406
|
+
return p.option_group_id - q.option_group_id;
|
|
407
|
+
}
|
|
408
|
+
if (p.num !== q.num) return p.num - q.num;
|
|
409
|
+
return p.price.localeCompare(q.price);
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
var normalizedOpts = normalizeOptions(productOptionItem);
|
|
408
413
|
var bundleArr = Array.isArray(productBundle) ? productBundle : [];
|
|
409
414
|
var normalizedBundles = bundleArr.map(function (item) {
|
|
410
|
-
var _ref2, _item$bundle_id;
|
|
415
|
+
var _ref2, _item$bundle_id, _item$bundle_variant_;
|
|
411
416
|
return {
|
|
412
417
|
bundle_id: Number((_ref2 = (_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref2 !== void 0 ? _ref2 : 0) || 0,
|
|
413
418
|
product_id: Number(item === null || item === void 0 ? void 0 : item.product_id) || 0,
|
|
414
|
-
|
|
419
|
+
product_variant_id: Number((_item$bundle_variant_ = item === null || item === void 0 ? void 0 : item.bundle_variant_id) !== null && _item$bundle_variant_ !== void 0 ? _item$bundle_variant_ : item === null || item === void 0 ? void 0 : item.product_variant_id) || 0,
|
|
420
|
+
num: typeof (item === null || item === void 0 ? void 0 : item.num) === 'number' && !Number.isNaN(item.num) ? Math.max(1, Math.floor(item.num)) : 1,
|
|
421
|
+
option: normalizeOptions(item === null || item === void 0 ? void 0 : item.option)
|
|
415
422
|
};
|
|
416
423
|
}).sort(function (p, q) {
|
|
417
424
|
if (p.bundle_id !== q.bundle_id) return p.bundle_id - q.bundle_id;
|
|
418
425
|
if (p.product_id !== q.product_id) return p.product_id - q.product_id;
|
|
419
|
-
|
|
426
|
+
if (p.product_variant_id !== q.product_variant_id) {
|
|
427
|
+
return p.product_variant_id - q.product_variant_id;
|
|
428
|
+
}
|
|
429
|
+
if (p.num !== q.num) return p.num - q.num;
|
|
430
|
+
return JSON.stringify(p.option).localeCompare(JSON.stringify(q.option));
|
|
420
431
|
});
|
|
421
432
|
return JSON.stringify([normalizedOpts, normalizedBundles]);
|
|
422
433
|
}
|
|
@@ -76,6 +76,11 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
76
76
|
* value 为 undefined 时删除该 key;存储失败不阻断业务流程。
|
|
77
77
|
*/
|
|
78
78
|
setSessionStateValue(key: string, value: unknown): void;
|
|
79
|
+
/**
|
|
80
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
81
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
82
|
+
*/
|
|
83
|
+
clearSessionStorageOrderSnapshot(): void;
|
|
79
84
|
/**
|
|
80
85
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
81
86
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -122,10 +127,6 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
122
127
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
123
128
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
124
129
|
*/
|
|
125
|
-
getCart(): {
|
|
126
|
-
items: any[];
|
|
127
|
-
bookings: any[];
|
|
128
|
-
};
|
|
129
130
|
/**
|
|
130
131
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
131
132
|
* then optionally lets the existing Rules engine select the best valid combination. This is a
|
|
@@ -584,6 +584,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
/**
|
|
588
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
589
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
590
|
+
*/
|
|
591
|
+
}, {
|
|
592
|
+
key: "clearSessionStorageOrderSnapshot",
|
|
593
|
+
value: function clearSessionStorageOrderSnapshot() {
|
|
594
|
+
var _this$store$order, _this$store$order$cle;
|
|
595
|
+
(_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$cle = _this$store$order.clearSessionStoragePersistedTempOrder) === null || _this$store$order$cle === void 0 || _this$store$order$cle.call(_this$store$order);
|
|
596
|
+
}
|
|
597
|
+
|
|
587
598
|
/**
|
|
588
599
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
589
600
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -622,12 +633,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
622
633
|
key: "addNewOrder",
|
|
623
634
|
value: function () {
|
|
624
635
|
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
625
|
-
var _this$store$
|
|
626
|
-
var sessionRecord, tempOrder, _this$store$
|
|
636
|
+
var _this$store$order2, _this$store$order2$co, _this$store$order4;
|
|
637
|
+
var sessionRecord, tempOrder, _this$store$order3, didSyncAuthenticatedCustomer;
|
|
627
638
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
628
639
|
while (1) switch (_context.prev = _context.next) {
|
|
629
640
|
case 0:
|
|
630
|
-
sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$
|
|
641
|
+
sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$co = _this$store$order2.consumeSessionStorageRestore) === null || _this$store$order2$co === void 0 ? void 0 : _this$store$order2$co.call(_this$store$order2) : null;
|
|
631
642
|
if (!sessionRecord) {
|
|
632
643
|
_context.next = 4;
|
|
633
644
|
break;
|
|
@@ -643,7 +654,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
643
654
|
case 6:
|
|
644
655
|
tempOrder = _context.sent;
|
|
645
656
|
if (sessionRecord) {
|
|
646
|
-
(_this$store$
|
|
657
|
+
(_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || _this$store$order3.persistTempOrder();
|
|
647
658
|
}
|
|
648
659
|
if (!this.isAuthenticatedCustomerUserPlatform()) {
|
|
649
660
|
_context.next = 23;
|
|
@@ -686,7 +697,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
686
697
|
_context.t1 = _context["catch"](24);
|
|
687
698
|
console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder', _context.t1);
|
|
688
699
|
case 32:
|
|
689
|
-
return _context.abrupt("return", ((_this$store$
|
|
700
|
+
return _context.abrupt("return", ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) || tempOrder);
|
|
690
701
|
case 33:
|
|
691
702
|
case "end":
|
|
692
703
|
return _context.stop();
|
|
@@ -757,8 +768,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
757
768
|
}, {
|
|
758
769
|
key: "resolveDiscountOrderIdentity",
|
|
759
770
|
value: function resolveDiscountOrderIdentity(tempOrder) {
|
|
760
|
-
var _this$store$
|
|
761
|
-
return (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this$store$
|
|
771
|
+
var _this$store$order5, _this$store$order5$ge;
|
|
772
|
+
return (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getOrderIdentity) === null || _this$store$order5$ge === void 0 || (_this$store$order5$ge = _this$store$order5$ge.call(_this$store$order5)) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.orderId) || null;
|
|
762
773
|
}
|
|
763
774
|
}, {
|
|
764
775
|
key: "resolveDiscountAction",
|
|
@@ -770,16 +781,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
770
781
|
key: "resetCachedCustomerDiscountState",
|
|
771
782
|
value: function () {
|
|
772
783
|
var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
773
|
-
var _this$store$
|
|
784
|
+
var _this$store$order6, _this$store$order6$cl, _this$store$customer2, _this$store$customer3, _this$store$order7, _discountModule$getOr, _discountModule$getDi, _discountModule$setOr, _discountModule$setDi, _this$store$order8, _this$store$order8$ap, _this$store$order9, _this$store$order9$re, _this$store$order10, _this$store$order10$p;
|
|
774
785
|
var orderStore, discountModule, filteredOriginalDiscounts, filteredCurrentDiscounts;
|
|
775
786
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
776
787
|
while (1) switch (_context3.prev = _context3.next) {
|
|
777
788
|
case 0:
|
|
778
|
-
(_this$store$
|
|
789
|
+
(_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$cl = _this$store$order6.clearOrderCustomer) === null || _this$store$order6$cl === void 0 || _this$store$order6$cl.call(_this$store$order6);
|
|
779
790
|
(_this$store$customer2 = this.store.customer) === null || _this$store$customer2 === void 0 || (_this$store$customer3 = _this$store$customer2.setSelectedCustomer) === null || _this$store$customer3 === void 0 || _this$store$customer3.call(_this$store$customer2, null);
|
|
780
791
|
this.discountConfigCacheKey = null;
|
|
781
792
|
this.hasManualDiscountSelection = false;
|
|
782
|
-
orderStore = ((_this$store$
|
|
793
|
+
orderStore = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.store) || {};
|
|
783
794
|
discountModule = orderStore.discount;
|
|
784
795
|
filteredOriginalDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || []);
|
|
785
796
|
filteredCurrentDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || []);
|
|
@@ -789,13 +800,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
789
800
|
_context3.next = 12;
|
|
790
801
|
return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, filteredCurrentDiscounts);
|
|
791
802
|
case 12:
|
|
792
|
-
(_this$store$
|
|
803
|
+
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ap = _this$store$order8.applyDiscount) === null || _this$store$order8$ap === void 0 || _this$store$order8$ap.call(_this$store$order8);
|
|
793
804
|
_context3.next = 15;
|
|
794
|
-
return (_this$store$
|
|
805
|
+
return (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$re = _this$store$order9.recalculateSummary) === null || _this$store$order9$re === void 0 ? void 0 : _this$store$order9$re.call(_this$store$order9, {
|
|
795
806
|
createIfMissing: true
|
|
796
807
|
});
|
|
797
808
|
case 15:
|
|
798
|
-
(_this$store$
|
|
809
|
+
(_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$p = _this$store$order10.persistTempOrder) === null || _this$store$order10$p === void 0 || _this$store$order10$p.call(_this$store$order10);
|
|
799
810
|
case 16:
|
|
800
811
|
case "end":
|
|
801
812
|
return _context3.stop();
|
|
@@ -1188,32 +1199,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1188
1199
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
1189
1200
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
1190
1201
|
*/
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
}
|
|
1202
|
+
// getCart(): BookingTicketCartView {
|
|
1203
|
+
// const tempOrder = this.getTempOrder();
|
|
1204
|
+
// const salesDetail = this.getSalesOrder();
|
|
1205
|
+
// const items = tempOrder?.products || [];
|
|
1206
|
+
// const bookings = salesDetail?.bookings || tempOrder?.bookings || [];
|
|
1207
|
+
// return {
|
|
1208
|
+
// items,
|
|
1209
|
+
// bookings: bookings.map((booking: any) => {
|
|
1210
|
+
// const productUid = booking?.product_uid;
|
|
1211
|
+
// const product = productUid
|
|
1212
|
+
// ? items.find((item: any) => {
|
|
1213
|
+
// const uid = item?.metadata?.unique_identification_number || item?.unique_identification_number;
|
|
1214
|
+
// return String(uid || '') === String(productUid);
|
|
1215
|
+
// }) || null
|
|
1216
|
+
// : null;
|
|
1217
|
+
// return {
|
|
1218
|
+
// ...booking,
|
|
1219
|
+
// _extend: {
|
|
1220
|
+
// ...(booking?._extend || {}),
|
|
1221
|
+
// product,
|
|
1222
|
+
// addTimeProduct: [],
|
|
1223
|
+
// canAddTime: false,
|
|
1224
|
+
// },
|
|
1225
|
+
// };
|
|
1226
|
+
// }),
|
|
1227
|
+
// };
|
|
1228
|
+
// }
|
|
1217
1229
|
|
|
1218
1230
|
/**
|
|
1219
1231
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|