@pisell/pisellos 2.2.178 → 2.2.180
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/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +17 -87
- package/dist/modules/Order/index.js +501 -1357
- package/dist/modules/Order/types.d.ts +19 -198
- package/dist/modules/Order/types.js +0 -31
- package/dist/modules/Order/utils.d.ts +1 -50
- package/dist/modules/Order/utils.js +32 -261
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +21 -23
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/SalesSummary/utils.js +7 -21
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +29 -87
- package/dist/server/modules/order/index.d.ts +0 -23
- package/dist/server/modules/order/index.js +46 -123
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +113 -130
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -89
- package/dist/solution/BaseSales/index.js +375 -1494
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -780
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/BookingTicket/utils/cartView.js +2 -4
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +17 -87
- package/lib/modules/Order/index.js +150 -677
- package/lib/modules/Order/types.d.ts +19 -198
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +1 -50
- package/lib/modules/Order/utils.js +22 -229
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +15 -18
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/SalesSummary/utils.js +7 -21
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +4 -41
- package/lib/server/modules/order/index.d.ts +0 -23
- package/lib/server/modules/order/index.js +14 -46
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +20 -30
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -89
- package/lib/solution/BaseSales/index.js +22 -736
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -352
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/BookingTicket/utils/cartView.js +2 -4
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -13,8 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import Decimal from 'decimal.js';
|
|
16
|
-
import { composeLinePrice, createUuidV4,
|
|
17
|
-
import { ensureManualProductDiscountList } from "../../modules/Order/utils/manualProductDiscount";
|
|
16
|
+
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* 构建金额全为 0 的空 summary。
|
|
@@ -481,42 +480,17 @@ export function getProductIdentityIndex(products, identity) {
|
|
|
481
480
|
* - 因此多次 normalize 不会重复叠加 option/bundle。
|
|
482
481
|
*/
|
|
483
482
|
export function normalizeOrderProduct(product) {
|
|
484
|
-
var _product$metadata, _metadata$origin,
|
|
483
|
+
var _product$metadata, _metadata$origin, _variantList$find, _product$is_charge_ta;
|
|
485
484
|
var metadata = _objectSpread({}, product.metadata || {});
|
|
486
485
|
// 不透明 identity 契约:每条订单行必须带 identity_key。
|
|
487
486
|
// 调用方未传时由 SDK 自动生成 UUID,后续 update/remove 只做严格比对,避免猜测合成 key。
|
|
488
487
|
var resolvedIdentityKey = (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 && _product$metadata.unique_identification_number ? String(product.metadata.unique_identification_number) : product.unique_identification_number && String(product.unique_identification_number).length > 0 ? String(product.unique_identification_number) : product.identity_key && String(product.identity_key).length > 0 ? String(product.identity_key) : createUuidV4();
|
|
489
488
|
metadata.unique_identification_number = resolvedIdentityKey;
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
var bundleInput = product.product_bundle || [];
|
|
493
|
-
if (priceOverride !== undefined && priceOverride !== null && priceOverride !== '' && Array.isArray(originOtherBundle) && originOtherBundle.length > 0) {
|
|
494
|
-
var priceById = new Map();
|
|
495
|
-
originOtherBundle.forEach(function (item) {
|
|
496
|
-
var _item$price2;
|
|
497
|
-
if ((item === null || item === void 0 ? void 0 : item.id) == null) return;
|
|
498
|
-
var unit = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.bundle_selling_price;
|
|
499
|
-
if (unit === undefined || unit === null) return;
|
|
500
|
-
priceById.set(String(item.id), String(unit));
|
|
501
|
-
});
|
|
502
|
-
var base = Array.isArray(bundleInput) && bundleInput.length > 0 ? bundleInput : originOtherBundle;
|
|
503
|
-
bundleInput = base.map(function (item) {
|
|
504
|
-
var unit = priceById.get(String(item === null || item === void 0 ? void 0 : item.id));
|
|
505
|
-
if (unit === undefined) return item;
|
|
506
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
507
|
-
price: unit,
|
|
508
|
-
bundle_selling_price: unit
|
|
509
|
-
});
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
var normalizedBundle = bundleInput.map(function (item) {
|
|
513
|
-
var _item$bundle_id2, _item$bundle_product_, _item$bundle_group_id, _ref4, _item$bundle_selling_, _ref5, _ref6, _item$price3, _ref7, _item$price_type, _ref8, _item$price_type_ext;
|
|
489
|
+
var normalizedBundle = (product.product_bundle || []).map(function (item) {
|
|
490
|
+
var _ref4, _item$bundle_selling_, _ref5, _ref6, _item$price2, _ref7, _item$price_type, _ref8, _item$price_type_ext;
|
|
514
491
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
515
|
-
bundle_id: (_item$bundle_id2 = item.bundle_id) !== null && _item$bundle_id2 !== void 0 ? _item$bundle_id2 : item.id,
|
|
516
|
-
bundle_product_id: (_item$bundle_product_ = item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item._bundle_product_id,
|
|
517
|
-
bundle_group_id: (_item$bundle_group_id = item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item.group_id,
|
|
518
492
|
bundle_selling_price: (_ref4 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref4 !== void 0 ? _ref4 : '0.00',
|
|
519
|
-
price: (_ref5 = (_ref6 = (_item$
|
|
493
|
+
price: (_ref5 = (_ref6 = (_item$price2 = item.price) !== null && _item$price2 !== void 0 ? _item$price2 : item.custom_price) !== null && _ref6 !== void 0 ? _ref6 : item.bundle_selling_price) !== null && _ref5 !== void 0 ? _ref5 : '0.00',
|
|
520
494
|
price_type: (_ref7 = (_item$price_type = item.price_type) !== null && _item$price_type !== void 0 ? _item$price_type : item.custom_price_type) !== null && _ref7 !== void 0 ? _ref7 : '',
|
|
521
495
|
price_type_ext: (_ref8 = (_item$price_type_ext = item.price_type_ext) !== null && _item$price_type_ext !== void 0 ? _item$price_type_ext : item.custom_price_type_ext) !== null && _ref8 !== void 0 ? _ref8 : ''
|
|
522
496
|
});
|
|
@@ -534,7 +508,7 @@ export function normalizeOrderProduct(product) {
|
|
|
534
508
|
// 6) 入参 selling_price(最末兜底,新添加路径 caller 只给 selling_price)
|
|
535
509
|
var isV2 = metadata.price_schema_version === 2 || metadata.price_schema_version === '2';
|
|
536
510
|
var variantId = Number(product.product_variant_id || 0);
|
|
537
|
-
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$
|
|
511
|
+
var variantList = variantId ? metadata === null || metadata === void 0 || (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant : null;
|
|
538
512
|
var variantPrice = Array.isArray(variantList) ? (_variantList$find = variantList.find(function (v) {
|
|
539
513
|
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
540
514
|
})) === null || _variantList$find === void 0 ? void 0 : _variantList$find.price : undefined;
|
|
@@ -604,18 +578,6 @@ export function normalizeOrderProduct(product) {
|
|
|
604
578
|
bundle: normalizedBundle,
|
|
605
579
|
useOriginalBundle: true
|
|
606
580
|
});
|
|
607
|
-
var finalOriginalPrice = resolveManualOverrideLineOriginalPrice({
|
|
608
|
-
num: product.num,
|
|
609
|
-
metadata: metadata,
|
|
610
|
-
lineOriginalPrice: product.original_price
|
|
611
|
-
}, composedOriginalPrice);
|
|
612
|
-
var discountList = ensureManualProductDiscountList({
|
|
613
|
-
discountList: product.discount_list,
|
|
614
|
-
metadata: metadata,
|
|
615
|
-
originalPrice: finalOriginalPrice,
|
|
616
|
-
sellingPrice: composedSellingPrice,
|
|
617
|
-
quantity: getSafeProductNum(product.num)
|
|
618
|
-
});
|
|
619
581
|
return {
|
|
620
582
|
order_detail_id: product.order_detail_id || null,
|
|
621
583
|
product_id: product.product_id,
|
|
@@ -623,10 +585,10 @@ export function normalizeOrderProduct(product) {
|
|
|
623
585
|
product_variant_id: product.product_variant_id,
|
|
624
586
|
product_option_item: normalizedOptions,
|
|
625
587
|
selling_price: composedSellingPrice,
|
|
626
|
-
original_price:
|
|
588
|
+
original_price: composedOriginalPrice,
|
|
627
589
|
tax_fee: product.tax_fee || '0.00',
|
|
628
590
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
629
|
-
discount_list:
|
|
591
|
+
discount_list: product.discount_list || [],
|
|
630
592
|
product_bundle: normalizedBundle,
|
|
631
593
|
metadata: metadata,
|
|
632
594
|
note: product.note != null ? String(product.note) : ''
|
|
@@ -46,6 +46,7 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
|
|
|
46
46
|
discountList: Discount[];
|
|
47
47
|
type: "server" | "clientCalc";
|
|
48
48
|
unavailableReason?: UnavailableReason;
|
|
49
|
+
unavailableReasonKey?: string | null;
|
|
49
50
|
}>;
|
|
50
51
|
calcDiscountApplicableProductTotalPrice(discount: Discount): number | undefined;
|
|
51
52
|
private getCustomer;
|
|
@@ -406,7 +406,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
406
406
|
key: "scanCode",
|
|
407
407
|
value: function () {
|
|
408
408
|
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
|
|
409
|
-
var _this$store$discount3, _this$store$bookingSu2, resultDiscountList, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, unavailableReason, _this$options$otherPa6;
|
|
409
|
+
var _this$store$discount3, _this$store$bookingSu2, resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, unavailableReason, _this$options$otherPa6;
|
|
410
410
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
411
411
|
while (1) switch (_context5.prev = _context5.next) {
|
|
412
412
|
case 0:
|
|
@@ -422,12 +422,16 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
422
422
|
_context5.next = 6;
|
|
423
423
|
break;
|
|
424
424
|
}
|
|
425
|
-
_context5.t0 =
|
|
425
|
+
_context5.t0 = {
|
|
426
|
+
discountList: [],
|
|
427
|
+
unavailableReasonKey: null
|
|
428
|
+
};
|
|
426
429
|
case 6:
|
|
427
|
-
|
|
430
|
+
resultDiscountWithReason = _context5.t0;
|
|
431
|
+
resultDiscountList = resultDiscountWithReason.discountList, unavailableReasonKey = resultDiscountWithReason.unavailableReasonKey;
|
|
428
432
|
rulesModule = this.store.rules;
|
|
429
433
|
if (rulesModule) {
|
|
430
|
-
_context5.next =
|
|
434
|
+
_context5.next = 11;
|
|
431
435
|
break;
|
|
432
436
|
}
|
|
433
437
|
return _context5.abrupt("return", {
|
|
@@ -437,18 +441,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
437
441
|
discountList: this.getDiscountList(),
|
|
438
442
|
unavailableReason: UnavailableReason.Unknown
|
|
439
443
|
});
|
|
440
|
-
case
|
|
444
|
+
case 11:
|
|
441
445
|
if (resultDiscountList.length) {
|
|
442
|
-
_context5.next =
|
|
446
|
+
_context5.next = 13;
|
|
443
447
|
break;
|
|
444
448
|
}
|
|
445
449
|
return _context5.abrupt("return", {
|
|
446
450
|
type: "server",
|
|
447
451
|
isAvailable: false,
|
|
448
452
|
productList: this.store.productList || [],
|
|
449
|
-
discountList: this.getDiscountList()
|
|
453
|
+
discountList: this.getDiscountList(),
|
|
454
|
+
unavailableReasonKey: unavailableReasonKey
|
|
450
455
|
});
|
|
451
|
-
case
|
|
456
|
+
case 13:
|
|
452
457
|
withScanList = resultDiscountList.map(function (item) {
|
|
453
458
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
454
459
|
isScan: true
|
|
@@ -462,7 +467,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
462
467
|
return m.id === n.id;
|
|
463
468
|
});
|
|
464
469
|
}))) {
|
|
465
|
-
_context5.next =
|
|
470
|
+
_context5.next = 17;
|
|
466
471
|
break;
|
|
467
472
|
}
|
|
468
473
|
return _context5.abrupt("return", {
|
|
@@ -471,7 +476,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
471
476
|
productList: this.store.productList || [],
|
|
472
477
|
discountList: this.getDiscountList()
|
|
473
478
|
});
|
|
474
|
-
case
|
|
479
|
+
case 17:
|
|
475
480
|
_ref2 = rulesModule.isDiscountListAvailable({
|
|
476
481
|
productList: this.store.productList || [],
|
|
477
482
|
oldDiscountList: this.getDiscountList(),
|
|
@@ -485,19 +490,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
485
490
|
discountList: this.getDiscountList()
|
|
486
491
|
}, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable, unavailableReason = _ref2.unavailableReason;
|
|
487
492
|
if (!isAvailable) {
|
|
488
|
-
_context5.next =
|
|
493
|
+
_context5.next = 25;
|
|
489
494
|
break;
|
|
490
495
|
}
|
|
491
496
|
this.setDiscountList(newDiscountList || []);
|
|
492
497
|
this.store.originalDiscountList = newDiscountList || [];
|
|
493
498
|
this.setProductList(newProductList || []);
|
|
494
499
|
if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop' && !((resultDiscountList[0].customer_id || 1) === 1))) {
|
|
495
|
-
_context5.next =
|
|
500
|
+
_context5.next = 25;
|
|
496
501
|
break;
|
|
497
502
|
}
|
|
498
|
-
_context5.next =
|
|
503
|
+
_context5.next = 25;
|
|
499
504
|
return this.getCustomerWallet(resultDiscountList[0].customer_id);
|
|
500
|
-
case
|
|
505
|
+
case 25:
|
|
501
506
|
return _context5.abrupt("return", {
|
|
502
507
|
type: "clientCalc",
|
|
503
508
|
isAvailable: isAvailable || false,
|
|
@@ -505,8 +510,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
505
510
|
discountList: newDiscountList || this.getDiscountList(),
|
|
506
511
|
unavailableReason: unavailableReason
|
|
507
512
|
});
|
|
508
|
-
case
|
|
509
|
-
_context5.prev =
|
|
513
|
+
case 28:
|
|
514
|
+
_context5.prev = 28;
|
|
510
515
|
_context5.t1 = _context5["catch"](0);
|
|
511
516
|
console.error('[ShopDiscount] 扫码出错:', _context5.t1);
|
|
512
517
|
return _context5.abrupt("return", {
|
|
@@ -516,11 +521,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
516
521
|
discountList: this.getDiscountList(),
|
|
517
522
|
unavailableReason: UnavailableReason.Unknown
|
|
518
523
|
});
|
|
519
|
-
case
|
|
524
|
+
case 32:
|
|
520
525
|
case "end":
|
|
521
526
|
return _context5.stop();
|
|
522
527
|
}
|
|
523
|
-
}, _callee5, this, [[0,
|
|
528
|
+
}, _callee5, this, [[0, 28]]);
|
|
524
529
|
}));
|
|
525
530
|
function scanCode(_x4, _x5) {
|
|
526
531
|
return _scanCode.apply(this, arguments);
|
|
@@ -2,7 +2,7 @@ import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
|
2
2
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
3
|
import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
|
|
4
4
|
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
|
|
5
|
-
import type {
|
|
5
|
+
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
6
6
|
import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
7
7
|
import type { ProductData } from '../../modules/Product/types';
|
|
8
8
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
@@ -41,8 +41,6 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
41
41
|
private loadOpenDataConfigInFlight;
|
|
42
42
|
private static readonly OPEN_DATA_CACHE_TTL;
|
|
43
43
|
private getLoggerContext;
|
|
44
|
-
private safeStringify;
|
|
45
|
-
private pickErrorMessage;
|
|
46
44
|
private serializeError;
|
|
47
45
|
private addVenueBookingLog;
|
|
48
46
|
private logMethodStart;
|
|
@@ -150,7 +148,13 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
150
148
|
customerId: number;
|
|
151
149
|
}): Promise<void>;
|
|
152
150
|
private recalculateOrderPricesFromQuotation;
|
|
153
|
-
scanCode(code: string, customerId?: number): Promise<
|
|
151
|
+
scanCode(code: string, customerId?: number): Promise<{
|
|
152
|
+
isAvailable: boolean;
|
|
153
|
+
discountList: import("../../modules/Discount").Discount[];
|
|
154
|
+
type: "server" | "clientCalc";
|
|
155
|
+
unavailableReason?: import("../../modules/Rules/types").UnavailableReason | undefined;
|
|
156
|
+
unavailableReasonKey?: string | null | undefined;
|
|
157
|
+
}>;
|
|
154
158
|
/** 获取当前折扣列表(包装 order.getDiscountList) */
|
|
155
159
|
getDiscountList(): import("../../modules/Discount").Discount[];
|
|
156
160
|
/** 勾选/取消勾选某张折扣券,重新计算折扣并持久化 */
|
|
@@ -163,7 +167,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
163
167
|
getSummary(): Promise<import("../../modules/Order/types").OrderSummary>;
|
|
164
168
|
submitOrder<T = any>(): Promise<T>;
|
|
165
169
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
166
|
-
|
|
170
|
+
updateProductInOrder(params: UpdateProductInOrderParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
167
171
|
removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
168
172
|
getProductList(): Promise<ProductData[]>;
|
|
169
173
|
private loadOpenDataConfig;
|
|
@@ -44,7 +44,7 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
|
44
44
|
import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
45
45
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
46
46
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
|
-
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry,
|
|
47
|
+
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
48
|
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
49
49
|
import { OrderModule } from "../../modules/Order";
|
|
50
50
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
@@ -112,26 +112,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
112
112
|
moduleName: 'venueBooking'
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
}, {
|
|
116
|
-
key: "safeStringify",
|
|
117
|
-
value: function safeStringify(value) {
|
|
118
|
-
try {
|
|
119
|
-
return JSON.stringify(value);
|
|
120
|
-
} catch (_unused) {
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}, {
|
|
125
|
-
key: "pickErrorMessage",
|
|
126
|
-
value: function pickErrorMessage(error) {
|
|
127
|
-
var _error$data, _error$response, _error$error;
|
|
128
|
-
var candidates = [error.message, (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.message, (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message];
|
|
129
|
-
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
130
|
-
var candidate = _candidates[_i];
|
|
131
|
-
if (typeof candidate === 'string' && candidate.trim()) return candidate;
|
|
132
|
-
}
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
115
|
}, {
|
|
136
116
|
key: "serializeError",
|
|
137
117
|
value: function serializeError(error) {
|
|
@@ -142,21 +122,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
142
122
|
stack: error.stack
|
|
143
123
|
};
|
|
144
124
|
}
|
|
145
|
-
if (error && _typeof(error) === 'object') {
|
|
146
|
-
var raw = error;
|
|
147
|
-
var message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
|
|
148
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof raw.name === 'string' ? {
|
|
149
|
-
name: raw.name
|
|
150
|
-
} : {}), {}, {
|
|
151
|
-
message: message
|
|
152
|
-
}, 'code' in raw ? {
|
|
153
|
-
code: raw.code
|
|
154
|
-
} : {}), 'status' in raw ? {
|
|
155
|
-
status: raw.status
|
|
156
|
-
} : {}), this.safeStringify(raw) ? {
|
|
157
|
-
raw: this.safeStringify(raw)
|
|
158
|
-
} : {});
|
|
159
|
-
}
|
|
160
125
|
return {
|
|
161
126
|
message: String(error)
|
|
162
127
|
};
|
|
@@ -281,8 +246,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
281
246
|
value: function resolveCustomerIdFromLoginPayload(payload) {
|
|
282
247
|
var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
|
|
283
248
|
var candidates = [payload === null || payload === void 0 ? void 0 : payload.customerId, payload === null || payload === void 0 ? void 0 : payload.customer_id, payload === null || payload === void 0 ? void 0 : payload.id, payload === null || payload === void 0 || (_payload$user = payload.user) === null || _payload$user === void 0 ? void 0 : _payload$user.customerId, payload === null || payload === void 0 || (_payload$user2 = payload.user) === null || _payload$user2 === void 0 ? void 0 : _payload$user2.customer_id, payload === null || payload === void 0 || (_payload$user3 = payload.user) === null || _payload$user3 === void 0 ? void 0 : _payload$user3.id, payload === null || payload === void 0 || (_payload$user4 = payload.user) === null || _payload$user4 === void 0 || (_payload$user4 = _payload$user4._origin) === null || _payload$user4 === void 0 ? void 0 : _payload$user4.customer_id, payload === null || payload === void 0 || (_payload$account = payload.account) === null || _payload$account === void 0 ? void 0 : _payload$account.customerId, payload === null || payload === void 0 || (_payload$account2 = payload.account) === null || _payload$account2 === void 0 ? void 0 : _payload$account2.customer_id, payload === null || payload === void 0 || (_payload$account3 = payload.account) === null || _payload$account3 === void 0 ? void 0 : _payload$account3.id, payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.customer_id];
|
|
284
|
-
for (var
|
|
285
|
-
var candidate =
|
|
249
|
+
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
250
|
+
var candidate = _candidates[_i];
|
|
286
251
|
var customerId = this.normalizeCustomerId(candidate);
|
|
287
252
|
if (customerId) return customerId;
|
|
288
253
|
}
|
|
@@ -534,14 +499,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
534
499
|
var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
|
|
535
500
|
_this4.store[step] = targetModule;
|
|
536
501
|
var initialState = step === 'salesSummary' ? {
|
|
502
|
+
// TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
|
|
537
503
|
summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
|
|
538
504
|
} : {};
|
|
539
505
|
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
|
|
540
506
|
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
|
|
541
|
-
feishu: {
|
|
542
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
543
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
|
|
544
|
-
}
|
|
507
|
+
feishu: {}
|
|
545
508
|
};
|
|
546
509
|
_this4.core.registerModule(targetModule, {
|
|
547
510
|
initialState: initialState,
|
|
@@ -866,28 +829,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
866
829
|
}
|
|
867
830
|
throw new Error('addonProducts 模块未初始化');
|
|
868
831
|
case 6:
|
|
869
|
-
_context11.next = 8;
|
|
870
|
-
return this.loadOpenDataConfig();
|
|
871
|
-
case 8:
|
|
872
832
|
associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
|
|
873
833
|
if (associatedMenus.length) {
|
|
874
|
-
_context11.next =
|
|
834
|
+
_context11.next = 9;
|
|
875
835
|
break;
|
|
876
836
|
}
|
|
877
|
-
this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
|
|
878
837
|
throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
|
|
879
|
-
case
|
|
838
|
+
case 9:
|
|
880
839
|
menuListIds = associatedMenus.map(function (n) {
|
|
881
840
|
return Number(n.value);
|
|
882
841
|
});
|
|
883
|
-
_context11.next =
|
|
842
|
+
_context11.next = 12;
|
|
884
843
|
return this.store.venueProducts.loadProducts({
|
|
885
844
|
menu_list_ids: menuListIds,
|
|
886
845
|
cacheId: this.cacheId,
|
|
887
846
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
888
847
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
889
848
|
});
|
|
890
|
-
case
|
|
849
|
+
case 12:
|
|
891
850
|
allProducts = _context11.sent;
|
|
892
851
|
list = Array.isArray(allProducts) ? allProducts : [];
|
|
893
852
|
venueList = list.filter(function (p) {
|
|
@@ -915,16 +874,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
915
874
|
venueProducts: venueList,
|
|
916
875
|
addonProducts: addonList
|
|
917
876
|
});
|
|
918
|
-
case
|
|
919
|
-
_context11.prev =
|
|
877
|
+
case 25:
|
|
878
|
+
_context11.prev = 25;
|
|
920
879
|
_context11.t0 = _context11["catch"](1);
|
|
921
880
|
this.logMethodError('loadAllProducts', _context11.t0);
|
|
922
881
|
throw _context11.t0;
|
|
923
|
-
case
|
|
882
|
+
case 29:
|
|
924
883
|
case "end":
|
|
925
884
|
return _context11.stop();
|
|
926
885
|
}
|
|
927
|
-
}, _callee11, this, [[1,
|
|
886
|
+
}, _callee11, this, [[1, 25]]);
|
|
928
887
|
}));
|
|
929
888
|
function _doLoadAllProducts() {
|
|
930
889
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -1036,7 +995,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1036
995
|
key: "fetchResourceAvailability",
|
|
1037
996
|
value: function () {
|
|
1038
997
|
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1039
|
-
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item,
|
|
998
|
+
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mappings, _iterator3, _step3, mapping;
|
|
1040
999
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1041
1000
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1042
1001
|
case 0:
|
|
@@ -1104,13 +1063,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1104
1063
|
}
|
|
1105
1064
|
}
|
|
1106
1065
|
this.store.rawResourceData = rawData;
|
|
1107
|
-
|
|
1066
|
+
_i2 = 0, _rawData = rawData;
|
|
1108
1067
|
case 24:
|
|
1109
|
-
if (!(
|
|
1068
|
+
if (!(_i2 < _rawData.length)) {
|
|
1110
1069
|
_context15.next = 34;
|
|
1111
1070
|
break;
|
|
1112
1071
|
}
|
|
1113
|
-
_item = _rawData[
|
|
1072
|
+
_item = _rawData[_i2];
|
|
1114
1073
|
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1115
1074
|
if (mappings) {
|
|
1116
1075
|
_context15.next = 29;
|
|
@@ -1131,7 +1090,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1131
1090
|
_iterator3.f();
|
|
1132
1091
|
}
|
|
1133
1092
|
case 31:
|
|
1134
|
-
|
|
1093
|
+
_i2++;
|
|
1135
1094
|
_context15.next = 24;
|
|
1136
1095
|
break;
|
|
1137
1096
|
case 34:
|
|
@@ -1669,10 +1628,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1669
1628
|
form_id: (_rawResource$form_id = rawResource === null || rawResource === void 0 ? void 0 : rawResource.form_id) !== null && _rawResource$form_id !== void 0 ? _rawResource$form_id : mapping.formId,
|
|
1670
1629
|
relation_id: resourceId,
|
|
1671
1630
|
capacity: 1,
|
|
1672
|
-
metadata:
|
|
1673
|
-
mapping: mapping,
|
|
1674
|
-
rawResource: rawResource
|
|
1675
|
-
})
|
|
1631
|
+
metadata: {}
|
|
1676
1632
|
};
|
|
1677
1633
|
if (childRawResources && childRawResources.length) {
|
|
1678
1634
|
resourceEntry.children = childRawResources.map(function (child) {
|
|
@@ -2226,6 +2182,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2226
2182
|
});
|
|
2227
2183
|
case 50:
|
|
2228
2184
|
this.store.order.persistTempOrder();
|
|
2185
|
+
// TODO(Order types): VenueBooking should read OrderState.summary instead of tempOrder.summary.
|
|
2229
2186
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
2230
2187
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
2231
2188
|
this.logMethodSuccess('setDiscountSelected', params);
|
|
@@ -2448,14 +2405,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2448
2405
|
return addProductToOrder;
|
|
2449
2406
|
}()
|
|
2450
2407
|
}, {
|
|
2451
|
-
key: "
|
|
2408
|
+
key: "updateProductInOrder",
|
|
2452
2409
|
value: function () {
|
|
2453
|
-
var
|
|
2410
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2454
2411
|
var products;
|
|
2455
2412
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2456
2413
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2457
2414
|
case 0:
|
|
2458
|
-
this.logMethodStart('
|
|
2415
|
+
this.logMethodStart('updateProductInOrder', {
|
|
2459
2416
|
product_id: params.product_id,
|
|
2460
2417
|
product_variant_id: params.product_variant_id
|
|
2461
2418
|
});
|
|
@@ -2467,7 +2424,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2467
2424
|
throw new Error('order 模块未初始化');
|
|
2468
2425
|
case 4:
|
|
2469
2426
|
_context26.next = 6;
|
|
2470
|
-
return this.store.order.
|
|
2427
|
+
return this.store.order.updateProductInOrder(params);
|
|
2471
2428
|
case 6:
|
|
2472
2429
|
products = _context26.sent;
|
|
2473
2430
|
_context26.next = 9;
|
|
@@ -2476,14 +2433,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2476
2433
|
_context26.next = 11;
|
|
2477
2434
|
return this.refreshCartValidationPassed();
|
|
2478
2435
|
case 11:
|
|
2479
|
-
this.logMethodSuccess('
|
|
2436
|
+
this.logMethodSuccess('updateProductInOrder', {
|
|
2480
2437
|
productCount: products.length
|
|
2481
2438
|
});
|
|
2482
2439
|
return _context26.abrupt("return", products);
|
|
2483
2440
|
case 15:
|
|
2484
2441
|
_context26.prev = 15;
|
|
2485
2442
|
_context26.t0 = _context26["catch"](1);
|
|
2486
|
-
this.logMethodError('
|
|
2443
|
+
this.logMethodError('updateProductInOrder', _context26.t0);
|
|
2487
2444
|
throw _context26.t0;
|
|
2488
2445
|
case 19:
|
|
2489
2446
|
case "end":
|
|
@@ -2491,10 +2448,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2491
2448
|
}
|
|
2492
2449
|
}, _callee26, this, [[1, 15]]);
|
|
2493
2450
|
}));
|
|
2494
|
-
function
|
|
2495
|
-
return
|
|
2451
|
+
function updateProductInOrder(_x17) {
|
|
2452
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
2496
2453
|
}
|
|
2497
|
-
return
|
|
2454
|
+
return updateProductInOrder;
|
|
2498
2455
|
}()
|
|
2499
2456
|
}, {
|
|
2500
2457
|
key: "removeProductFromOrder",
|
|
@@ -2541,6 +2498,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2541
2498
|
}
|
|
2542
2499
|
return _context27.abrupt("continue", 20);
|
|
2543
2500
|
case 18:
|
|
2501
|
+
// TODO(Order types): VenueBooking should use metadata.unique_identification_number only.
|
|
2544
2502
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2545
2503
|
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
2546
2504
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
@@ -2635,7 +2593,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2635
2593
|
key: "loadOpenDataConfig",
|
|
2636
2594
|
value: function () {
|
|
2637
2595
|
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2638
|
-
var
|
|
2596
|
+
var _this11 = this;
|
|
2597
|
+
var lastFetchedAt, cachedData;
|
|
2639
2598
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2640
2599
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2641
2600
|
case 0:
|
|
@@ -2655,35 +2614,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2655
2614
|
return _context29.abrupt("return", cachedData);
|
|
2656
2615
|
case 7:
|
|
2657
2616
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2658
|
-
_context29.next =
|
|
2617
|
+
_context29.next = 9;
|
|
2659
2618
|
break;
|
|
2660
2619
|
}
|
|
2661
|
-
_context29.
|
|
2662
|
-
|
|
2663
|
-
case 10:
|
|
2664
|
-
return _context29.abrupt("return", _context29.sent);
|
|
2665
|
-
case 11:
|
|
2620
|
+
return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
|
|
2621
|
+
case 9:
|
|
2666
2622
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2667
2623
|
scope: 'board',
|
|
2668
2624
|
target: 'venue_booking+online_store',
|
|
2669
2625
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2626
|
+
}).then(function (openDataConfig) {
|
|
2627
|
+
_this11.otherParams.openData = openDataConfig;
|
|
2628
|
+
return openDataConfig;
|
|
2629
|
+
}).finally(function () {
|
|
2630
|
+
_this11.loadOpenDataConfigInFlight = null;
|
|
2670
2631
|
});
|
|
2671
|
-
_context29.
|
|
2672
|
-
|
|
2673
|
-
return this.loadOpenDataConfigInFlight;
|
|
2674
|
-
case 15:
|
|
2675
|
-
openDataConfig = _context29.sent;
|
|
2676
|
-
this.otherParams.openData = openDataConfig;
|
|
2677
|
-
return _context29.abrupt("return", openDataConfig);
|
|
2678
|
-
case 18:
|
|
2679
|
-
_context29.prev = 18;
|
|
2680
|
-
this.loadOpenDataConfigInFlight = null;
|
|
2681
|
-
return _context29.finish(18);
|
|
2682
|
-
case 21:
|
|
2632
|
+
return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
|
|
2633
|
+
case 11:
|
|
2683
2634
|
case "end":
|
|
2684
2635
|
return _context29.stop();
|
|
2685
2636
|
}
|
|
2686
|
-
}, _callee29, this
|
|
2637
|
+
}, _callee29, this);
|
|
2687
2638
|
}));
|
|
2688
2639
|
function loadOpenDataConfig() {
|
|
2689
2640
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2829,8 +2780,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2829
2780
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
2830
2781
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
2831
2782
|
}
|
|
2832
|
-
for (var
|
|
2833
|
-
var childValue = _Object$values[
|
|
2783
|
+
for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
|
|
2784
|
+
var childValue = _Object$values[_i3];
|
|
2834
2785
|
if (childValue && _typeof(childValue) === 'object') collectFromValue(childValue);
|
|
2835
2786
|
}
|
|
2836
2787
|
};
|
|
@@ -2863,7 +2814,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2863
2814
|
key: "ensureItemRuleConfigsLoaded",
|
|
2864
2815
|
value: function () {
|
|
2865
2816
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2866
|
-
var
|
|
2817
|
+
var _this12 = this;
|
|
2867
2818
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2868
2819
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2869
2820
|
case 0:
|
|
@@ -2884,19 +2835,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2884
2835
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2885
2836
|
while (1) switch (_context33.prev = _context33.next) {
|
|
2886
2837
|
case 0:
|
|
2887
|
-
runtimeConfig =
|
|
2838
|
+
runtimeConfig = _this12.getItemRuleRuntimeConfig();
|
|
2888
2839
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2889
2840
|
if (!(staticConfigs.length > 0)) {
|
|
2890
2841
|
_context33.next = 6;
|
|
2891
2842
|
break;
|
|
2892
2843
|
}
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
return _context33.abrupt("return",
|
|
2844
|
+
_this12.itemRuleConfigs = staticConfigs;
|
|
2845
|
+
_this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2846
|
+
return _context33.abrupt("return", _this12.itemRuleConfigs);
|
|
2896
2847
|
case 6:
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
return _context33.abrupt("return",
|
|
2848
|
+
_this12.itemRuleConfigs = [];
|
|
2849
|
+
_this12.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2850
|
+
return _context33.abrupt("return", _this12.itemRuleConfigs);
|
|
2900
2851
|
case 9:
|
|
2901
2852
|
case "end":
|
|
2902
2853
|
return _context33.stop();
|
|
@@ -3077,6 +3028,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3077
3028
|
item_rule_prefill: true,
|
|
3078
3029
|
item_rule_id: prefillItem.ruleId
|
|
3079
3030
|
}),
|
|
3031
|
+
// TODO(Order types): migrate VenueBooking prefill origin runtime into tempOrder._extend.
|
|
3080
3032
|
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
3081
3033
|
});
|
|
3082
3034
|
if (delta > 0 || Boolean(sourceItem && (!targetProduct._origin || ((_origin2 = targetProduct._origin) === null || _origin2 === void 0 ? void 0 : _origin2.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
|
|
@@ -3357,7 +3309,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3357
3309
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3358
3310
|
var parsed = JSON.parse(raw);
|
|
3359
3311
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3360
|
-
} catch (
|
|
3312
|
+
} catch (_unused2) {
|
|
3361
3313
|
return {};
|
|
3362
3314
|
}
|
|
3363
3315
|
}
|