@pisell/pisellos 2.2.313 → 2.2.315
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/dist/model/strategy/adapter/itemRule/type.js +10 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/dist/modules/BookingContext/utils/productExtend.js +62 -18
- package/dist/modules/BookingContext/utils/resources.js +1 -1
- package/dist/modules/BusinessAvailability/index.d.ts +30 -0
- package/dist/modules/BusinessAvailability/index.js +204 -0
- package/dist/modules/Cart/index.js +4 -3
- package/dist/modules/Cart/types.d.ts +2 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/dist/modules/Cart/utils/cartProduct.js +59 -32
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +14 -0
- package/dist/modules/Order/index.d.ts +14 -2
- package/dist/modules/Order/index.js +856 -486
- package/dist/modules/Order/localEftposState.d.ts +13 -0
- package/dist/modules/Order/localEftposState.js +39 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +30 -2
- package/dist/modules/Order/utils.js +25 -7
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Product/types.d.ts +11 -0
- package/dist/modules/ProductList/index.js +1 -1
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
- package/dist/modules/ResourcePlanner/planner.js +332 -23
- package/dist/modules/ResourcePlanner/types.d.ts +29 -0
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1536 -1309
- package/dist/server/modules/form/index.d.ts +19 -0
- package/dist/server/modules/form/index.js +205 -0
- package/dist/server/modules/form/types.d.ts +13 -0
- package/dist/server/modules/form/types.js +3 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/index.d.ts +15 -0
- package/dist/server/modules/order/index.js +920 -688
- package/dist/server/modules/order/types.d.ts +1 -0
- package/dist/server/test.json +1 -1
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/dist/shared/receipt/customerInvoiceLanguages.js +60 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +184 -0
- package/dist/shared/receipt/small-ticket.d.ts +96 -0
- package/dist/shared/receipt/small-ticket.js +2751 -0
- package/dist/shared/receipt/templateVisibility.d.ts +23 -0
- package/dist/shared/receipt/templateVisibility.js +64 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
- package/dist/solution/BaseSales/index.d.ts +39 -16
- package/dist/solution/BaseSales/index.js +1754 -1154
- package/dist/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/dist/solution/BaseSales/pickupTiming.js +616 -0
- package/dist/solution/BaseSales/types.d.ts +11 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +4 -2
- package/dist/solution/BookingByStep/index.js +8 -3
- package/dist/solution/BookingTicket/index.d.ts +8 -2
- package/dist/solution/BookingTicket/index.js +513 -436
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/dist/solution/OrderInvoicePreview/index.js +340 -0
- package/dist/solution/RegisterAndLogin/config.js +54 -11
- package/dist/solution/RegisterAndLogin/index.d.ts +2 -0
- package/dist/solution/RegisterAndLogin/index.js +1 -1
- package/dist/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/dist/solution/RegisterAndLogin/utils.js +36 -16
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.js +292 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/dist/solution/UnifiedBookingSales/index.js +1714 -905
- package/dist/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1062 -785
- package/dist/solution/VenueBooking/types.d.ts +2 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +273 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +6 -3
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
- package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
- package/lib/model/strategy/adapter/itemRule/type.js +10 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +7 -0
- package/lib/modules/BookingContext/utils/productExtend.js +45 -2
- package/lib/modules/BookingContext/utils/resources.js +1 -1
- package/lib/modules/BusinessAvailability/index.d.ts +30 -0
- package/lib/modules/BusinessAvailability/index.js +146 -0
- package/lib/modules/Cart/index.js +4 -2
- package/lib/modules/Cart/types.d.ts +2 -0
- package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
- package/lib/modules/Cart/utils/cartProduct.js +39 -20
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +14 -0
- package/lib/modules/Order/index.d.ts +14 -2
- package/lib/modules/Order/index.js +240 -38
- package/lib/modules/Order/localEftposState.d.ts +13 -0
- package/lib/modules/Order/localEftposState.js +44 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +30 -2
- package/lib/modules/Order/utils.js +21 -5
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Product/types.d.ts +11 -0
- package/lib/modules/ProductList/index.js +1 -1
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
- package/lib/modules/ResourcePlanner/planner.js +252 -8
- package/lib/modules/ResourcePlanner/types.d.ts +29 -0
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/index.d.ts +1 -0
- package/lib/server/index.js +158 -37
- package/lib/server/modules/form/index.d.ts +19 -0
- package/lib/server/modules/form/index.js +73 -0
- package/lib/server/modules/form/types.d.ts +13 -0
- package/lib/server/modules/form/types.js +9 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +15 -1
- package/lib/server/modules/order/index.d.ts +15 -0
- package/lib/server/modules/order/index.js +114 -3
- package/lib/server/modules/order/types.d.ts +1 -0
- package/lib/server/test.json +1 -1
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +8 -0
- package/lib/shared/receipt/customerInvoiceLanguages.js +58 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +27 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +124 -0
- package/lib/shared/receipt/small-ticket.d.ts +96 -0
- package/lib/shared/receipt/small-ticket.js +2546 -0
- package/lib/shared/receipt/templateVisibility.d.ts +23 -0
- package/lib/shared/receipt/templateVisibility.js +63 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
- package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
- package/lib/solution/BaseSales/index.d.ts +39 -16
- package/lib/solution/BaseSales/index.js +333 -31
- package/lib/solution/BaseSales/pickupTiming.d.ts +47 -0
- package/lib/solution/BaseSales/pickupTiming.js +290 -0
- package/lib/solution/BaseSales/types.d.ts +11 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +4 -2
- package/lib/solution/BookingByStep/index.js +7 -3
- package/lib/solution/BookingTicket/index.d.ts +8 -2
- package/lib/solution/BookingTicket/index.js +65 -6
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -1
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +66 -0
- package/lib/solution/OrderInvoicePreview/index.js +246 -0
- package/lib/solution/RegisterAndLogin/config.js +57 -11
- package/lib/solution/RegisterAndLogin/index.d.ts +2 -0
- package/lib/solution/RegisterAndLogin/index.js +9 -1
- package/lib/solution/RegisterAndLogin/utils.d.ts +12 -4
- package/lib/solution/RegisterAndLogin/utils.js +24 -17
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/UnifiedBookingSales/businessAvailability.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/businessAvailability.js +138 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +36 -4
- package/lib/solution/UnifiedBookingSales/index.js +561 -74
- package/lib/solution/UnifiedBookingSales/types.d.ts +16 -2
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +243 -96
- package/lib/solution/VenueBooking/types.d.ts +2 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +7 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +71 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +224 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +5 -2
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -46,8 +46,9 @@ import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
|
46
46
|
import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
|
|
47
47
|
import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
|
|
48
48
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
49
|
+
import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
|
|
49
50
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
50
|
-
import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
51
|
+
import { composeLinePrice, createUuidV4, getOrderProductLineUid, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
51
52
|
import { OrderModule } from "../../modules/Order";
|
|
52
53
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
53
54
|
import Decimal from 'decimal.js';
|
|
@@ -108,6 +109,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
108
109
|
_defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
|
|
109
110
|
_defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
|
|
110
111
|
_defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
|
|
112
|
+
// undefined 尚未同步宿主身份;null 表示已明确退出,禁止回退到旧用户插件。
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "smartPricingCustomerId", void 0);
|
|
114
|
+
_defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
|
|
115
|
+
_defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
|
|
116
|
+
_defineProperty(_assertThisInitialized(_this), "slotPriceStrategyConfigs", void 0);
|
|
117
|
+
_defineProperty(_assertThisInitialized(_this), "slotPriceScheduleList", undefined);
|
|
111
118
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
|
|
112
119
|
return _this;
|
|
113
120
|
}
|
|
@@ -309,8 +316,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
309
316
|
}, {
|
|
310
317
|
key: "readProductOriginFromTempOrder",
|
|
311
318
|
value: function readProductOriginFromTempOrder(tempOrder, product) {
|
|
312
|
-
var
|
|
313
|
-
var uid = (
|
|
319
|
+
var _tempOrder$_extend3;
|
|
320
|
+
var uid = getOrderProductLineUid(product);
|
|
314
321
|
if (uid && (_tempOrder$_extend3 = tempOrder._extend) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3[uid]) !== null && _tempOrder$_extend3 !== void 0 && _tempOrder$_extend3.origin) {
|
|
315
322
|
return tempOrder._extend.productsByUid[uid].origin;
|
|
316
323
|
}
|
|
@@ -365,6 +372,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
365
372
|
key: "resolveHolderCustomerId",
|
|
366
373
|
value: function resolveHolderCustomerId() {
|
|
367
374
|
var _this$window, _this$window$getLocal;
|
|
375
|
+
if (this.smartPricingCustomerId !== undefined) {
|
|
376
|
+
var _this$smartPricingCus;
|
|
377
|
+
return (_this$smartPricingCus = this.smartPricingCustomerId) !== null && _this$smartPricingCus !== void 0 ? _this$smartPricingCus : undefined;
|
|
378
|
+
}
|
|
368
379
|
var customer = JSON.parse(((_this$window = this.window) === null || _this$window === void 0 || (_this$window$getLocal = _this$window.getLocalStorage) === null || _this$window$getLocal === void 0 ? void 0 : _this$window$getLocal.call(_this$window, 'customer')) || '{}');
|
|
369
380
|
if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
|
|
370
381
|
return undefined;
|
|
@@ -489,53 +500,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
489
500
|
}, {
|
|
490
501
|
key: "registerCustomerLoginListeners",
|
|
491
502
|
value: function registerCustomerLoginListeners() {
|
|
492
|
-
var
|
|
493
|
-
_this$core3,
|
|
494
|
-
_accountModule$getCur,
|
|
495
|
-
_accountModule$getAcc,
|
|
496
|
-
_this2 = this;
|
|
503
|
+
var _this2 = this;
|
|
497
504
|
this.clearLoginEffectListeners();
|
|
498
|
-
var
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
};
|
|
530
|
-
this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin(AccountHooks.OnLogin));
|
|
531
|
-
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin(RegisterAndLoginHooks.onLoginSuccess));
|
|
505
|
+
var handleLogin = /*#__PURE__*/function () {
|
|
506
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
507
|
+
var customerId;
|
|
508
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
509
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
510
|
+
case 0:
|
|
511
|
+
customerId = _this2.resolveCustomerIdFromLoginPayload(payload);
|
|
512
|
+
if (customerId) {
|
|
513
|
+
_context4.next = 3;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
return _context4.abrupt("return");
|
|
517
|
+
case 3:
|
|
518
|
+
_context4.next = 5;
|
|
519
|
+
return _this2.refreshOrderMarketingForCustomer({
|
|
520
|
+
customerId: customerId
|
|
521
|
+
});
|
|
522
|
+
case 5:
|
|
523
|
+
case "end":
|
|
524
|
+
return _context4.stop();
|
|
525
|
+
}
|
|
526
|
+
}, _callee4);
|
|
527
|
+
}));
|
|
528
|
+
return function handleLogin(_x4) {
|
|
529
|
+
return _ref3.apply(this, arguments);
|
|
530
|
+
};
|
|
531
|
+
}();
|
|
532
|
+
this.registerLoginEffect(AccountHooks.OnLogin, handleLogin);
|
|
533
|
+
this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, handleLogin);
|
|
534
|
+
this.registerLoginEffect(AccountHooks.OnLogout, function () {
|
|
535
|
+
return _this2.onCustomerLogout();
|
|
536
|
+
});
|
|
532
537
|
}
|
|
533
538
|
}, {
|
|
534
|
-
key: "
|
|
539
|
+
key: "refreshOrderMarketingForCustomer",
|
|
535
540
|
value: function () {
|
|
536
|
-
var
|
|
541
|
+
var _refreshOrderMarketingForCustomer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
|
|
537
542
|
var _this3 = this;
|
|
538
|
-
var refreshTask;
|
|
543
|
+
var previousRefresh, refreshTask;
|
|
539
544
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
540
545
|
while (1) switch (_context6.prev = _context6.next) {
|
|
541
546
|
case 0:
|
|
@@ -545,98 +550,123 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
545
550
|
}
|
|
546
551
|
throw new Error('order 模块未初始化');
|
|
547
552
|
case 2:
|
|
548
|
-
if (!this.customerLoginRefreshInFlight) {
|
|
549
|
-
_context6.next =
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
553
|
-
_context6.next = 7;
|
|
553
|
+
if (!(this.customerLoginRefreshInFlight && this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
554
|
+
_context6.next = 6;
|
|
554
555
|
break;
|
|
555
556
|
}
|
|
556
|
-
_context6.next =
|
|
557
|
+
_context6.next = 5;
|
|
557
558
|
return this.customerLoginRefreshInFlight;
|
|
558
|
-
case
|
|
559
|
+
case 5:
|
|
559
560
|
return _context6.abrupt("return");
|
|
560
|
-
case
|
|
561
|
-
|
|
562
|
-
return this.customerLoginRefreshInFlight;
|
|
563
|
-
case 9:
|
|
561
|
+
case 6:
|
|
562
|
+
previousRefresh = this.customerLoginRefreshInFlight;
|
|
564
563
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
565
564
|
refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
566
|
-
var _this3$
|
|
565
|
+
var order, holder, _i3, _Object$keys, formId, tempOrder, _this3$core$getPlugin, _this3$core$getPlugin2, user;
|
|
567
566
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
568
567
|
while (1) switch (_context5.prev = _context5.next) {
|
|
569
568
|
case 0:
|
|
570
|
-
if (!
|
|
569
|
+
if (!previousRefresh) {
|
|
571
570
|
_context5.next = 3;
|
|
572
571
|
break;
|
|
573
572
|
}
|
|
574
573
|
_context5.next = 3;
|
|
575
|
-
return
|
|
576
|
-
|
|
577
|
-
useCache: false
|
|
574
|
+
return previousRefresh.catch(function () {
|
|
575
|
+
return undefined;
|
|
578
576
|
});
|
|
579
577
|
case 3:
|
|
580
|
-
|
|
581
|
-
|
|
578
|
+
_this3.smartPricingCustomerId = params.customerId;
|
|
579
|
+
order = _this3.store.order;
|
|
580
|
+
if (!(params.customerId === null)) {
|
|
581
|
+
_context5.next = 11;
|
|
582
582
|
break;
|
|
583
583
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
584
|
+
order.clearOrderCustomer();
|
|
585
|
+
// 清除客户记录,保留表单定义供下次登录刷新。
|
|
586
|
+
holder = _this3.store.holder;
|
|
587
|
+
for (_i3 = 0, _Object$keys = Object.keys((holder === null || holder === void 0 ? void 0 : holder.getHolderFormMap()) || {}); _i3 < _Object$keys.length; _i3++) {
|
|
588
|
+
formId = _Object$keys[_i3];
|
|
589
|
+
holder === null || holder === void 0 || holder.setFormData(formId, {
|
|
590
|
+
records: []
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
_context5.next = 18;
|
|
594
|
+
break;
|
|
595
|
+
case 11:
|
|
596
|
+
tempOrder = order.ensureTempOrder();
|
|
597
|
+
if (Number(tempOrder.customer_id) !== params.customerId) {
|
|
598
|
+
user = (_this3$core$getPlugin = _this3.core.getPlugin('user')) === null || _this3$core$getPlugin === void 0 || (_this3$core$getPlugin2 = _this3$core$getPlugin.get) === null || _this3$core$getPlugin2 === void 0 ? void 0 : _this3$core$getPlugin2.call(_this3$core$getPlugin);
|
|
599
|
+
order.updateTempOrderCustomer(_objectSpread(_objectSpread({}, Number(user === null || user === void 0 ? void 0 : user.id) === params.customerId ? user : {}), {}, {
|
|
600
|
+
customer_id: params.customerId
|
|
601
|
+
}));
|
|
602
|
+
}
|
|
603
|
+
// 先获取新客户的钱包/优惠资产,再按该上下文计算智能价。
|
|
604
|
+
_context5.next = 15;
|
|
605
|
+
return order.loadDiscountConfig({
|
|
606
|
+
customerId: params.customerId,
|
|
607
|
+
apply: false
|
|
593
608
|
});
|
|
594
|
-
case
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
609
|
+
case 15:
|
|
610
|
+
if (!_this3.store.holder) {
|
|
611
|
+
_context5.next = 18;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
_context5.next = 18;
|
|
615
|
+
return _this3.store.holder.refreshAllFormRecords({
|
|
616
|
+
customer_id: params.customerId,
|
|
617
|
+
useCache: false
|
|
598
618
|
});
|
|
599
|
-
case
|
|
600
|
-
_this3.
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
_context5.next =
|
|
605
|
-
return _this3.
|
|
606
|
-
case
|
|
619
|
+
case 18:
|
|
620
|
+
if (!_this3.loadAllProductsInFlight) {
|
|
621
|
+
_context5.next = 21;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
_context5.next = 21;
|
|
625
|
+
return _this3.loadAllProductsInFlight;
|
|
626
|
+
case 21:
|
|
627
|
+
if (!_this3.productsLoaded) {
|
|
628
|
+
_context5.next = 24;
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
_context5.next = 24;
|
|
632
|
+
return _this3.loadAllProducts();
|
|
633
|
+
case 24:
|
|
634
|
+
_context5.next = 26;
|
|
635
|
+
return _this3.refreshSmartPricing();
|
|
636
|
+
case 26:
|
|
607
637
|
case "end":
|
|
608
638
|
return _context5.stop();
|
|
609
639
|
}
|
|
610
640
|
}, _callee5);
|
|
611
641
|
}))();
|
|
612
642
|
this.customerLoginRefreshInFlight = refreshTask;
|
|
613
|
-
_context6.prev =
|
|
614
|
-
_context6.next =
|
|
643
|
+
_context6.prev = 10;
|
|
644
|
+
_context6.next = 13;
|
|
615
645
|
return refreshTask;
|
|
616
|
-
case
|
|
617
|
-
_context6.next =
|
|
646
|
+
case 13:
|
|
647
|
+
_context6.next = 18;
|
|
618
648
|
break;
|
|
619
|
-
case
|
|
620
|
-
_context6.prev =
|
|
621
|
-
_context6.t0 = _context6["catch"](
|
|
649
|
+
case 15:
|
|
650
|
+
_context6.prev = 15;
|
|
651
|
+
_context6.t0 = _context6["catch"](10);
|
|
622
652
|
throw _context6.t0;
|
|
623
|
-
case
|
|
624
|
-
_context6.prev =
|
|
653
|
+
case 18:
|
|
654
|
+
_context6.prev = 18;
|
|
625
655
|
if (this.customerLoginRefreshInFlight === refreshTask) {
|
|
626
656
|
this.customerLoginRefreshInFlight = null;
|
|
627
657
|
this.customerLoginRefreshIdInFlight = null;
|
|
628
658
|
}
|
|
629
|
-
return _context6.finish(
|
|
630
|
-
case
|
|
659
|
+
return _context6.finish(18);
|
|
660
|
+
case 21:
|
|
631
661
|
case "end":
|
|
632
662
|
return _context6.stop();
|
|
633
663
|
}
|
|
634
|
-
}, _callee6, this, [[
|
|
664
|
+
}, _callee6, this, [[10, 15, 18, 21]]);
|
|
635
665
|
}));
|
|
636
|
-
function
|
|
637
|
-
return
|
|
666
|
+
function refreshOrderMarketingForCustomer(_x5) {
|
|
667
|
+
return _refreshOrderMarketingForCustomer.apply(this, arguments);
|
|
638
668
|
}
|
|
639
|
-
return
|
|
669
|
+
return refreshOrderMarketingForCustomer;
|
|
640
670
|
}()
|
|
641
671
|
}, {
|
|
642
672
|
key: "initialize",
|
|
@@ -682,6 +712,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
682
712
|
this.store.status = 'initializing';
|
|
683
713
|
this.store.error = null;
|
|
684
714
|
this.store.rawResourceData = [];
|
|
715
|
+
this.smartPricingCustomerId = undefined;
|
|
716
|
+
this.smartPricingProductCatalog = [];
|
|
717
|
+
this.productsLoaded = false;
|
|
718
|
+
this.slotPriceStrategyConfigs = undefined;
|
|
719
|
+
this.slotPriceScheduleList = undefined;
|
|
720
|
+
this.slotPriceMapCache.clear();
|
|
685
721
|
this.baseSlotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
|
|
686
722
|
this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
|
|
687
723
|
this.otherParams = options.otherParams || {};
|
|
@@ -695,9 +731,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
695
731
|
passed: null,
|
|
696
732
|
failures: []
|
|
697
733
|
};
|
|
698
|
-
_context7.next =
|
|
734
|
+
_context7.next = 25;
|
|
699
735
|
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
|
|
700
|
-
case
|
|
736
|
+
case 25:
|
|
701
737
|
if (this.store.scanOrderLogger) {
|
|
702
738
|
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
|
|
703
739
|
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
|
|
@@ -821,45 +857,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
821
857
|
})
|
|
822
858
|
});
|
|
823
859
|
this.registerCustomerLoginListeners();
|
|
824
|
-
_context7.prev =
|
|
825
|
-
_context7.next =
|
|
860
|
+
_context7.prev = 51;
|
|
861
|
+
_context7.next = 54;
|
|
826
862
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
827
863
|
createIfMissing: false
|
|
828
864
|
});
|
|
829
|
-
case
|
|
865
|
+
case 54:
|
|
830
866
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
831
|
-
_context7.next =
|
|
867
|
+
_context7.next = 57;
|
|
832
868
|
return this.loadRuntimeConfigs();
|
|
833
|
-
case
|
|
869
|
+
case 57:
|
|
834
870
|
if (!this.store.schedule) {
|
|
835
|
-
_context7.next =
|
|
871
|
+
_context7.next = 62;
|
|
836
872
|
break;
|
|
837
873
|
}
|
|
838
|
-
_context7.next =
|
|
874
|
+
_context7.next = 60;
|
|
839
875
|
return this.store.schedule.loadAllSchedule();
|
|
840
|
-
case
|
|
876
|
+
case 60:
|
|
841
877
|
this.injectScheduleResolverToQuotation();
|
|
842
878
|
this.preloadQuotations({
|
|
843
879
|
channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
|
|
844
880
|
});
|
|
845
|
-
case
|
|
846
|
-
_context7.next =
|
|
881
|
+
case 62:
|
|
882
|
+
_context7.next = 64;
|
|
847
883
|
return this.refreshItemRuleQuantityLimits();
|
|
848
|
-
case
|
|
884
|
+
case 64:
|
|
849
885
|
this.store.status = 'ready';
|
|
850
|
-
_context7.next =
|
|
886
|
+
_context7.next = 67;
|
|
851
887
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
852
888
|
status: this.store.status
|
|
853
889
|
});
|
|
854
|
-
case
|
|
890
|
+
case 67:
|
|
855
891
|
this.logMethodSuccess('initialize', {
|
|
856
892
|
status: this.store.status
|
|
857
893
|
});
|
|
858
|
-
_context7.next =
|
|
894
|
+
_context7.next = 77;
|
|
859
895
|
break;
|
|
860
|
-
case
|
|
861
|
-
_context7.prev =
|
|
862
|
-
_context7.t0 = _context7["catch"](
|
|
896
|
+
case 70:
|
|
897
|
+
_context7.prev = 70;
|
|
898
|
+
_context7.t0 = _context7["catch"](51);
|
|
863
899
|
this.store.status = 'error';
|
|
864
900
|
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
865
901
|
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
@@ -867,11 +903,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
867
903
|
status: this.store.status
|
|
868
904
|
});
|
|
869
905
|
throw _context7.t0;
|
|
870
|
-
case
|
|
906
|
+
case 77:
|
|
871
907
|
case "end":
|
|
872
908
|
return _context7.stop();
|
|
873
909
|
}
|
|
874
|
-
}, _callee7, this, [[
|
|
910
|
+
}, _callee7, this, [[51, 70]]);
|
|
875
911
|
}));
|
|
876
912
|
function initialize(_x6) {
|
|
877
913
|
return _initialize.apply(this, arguments);
|
|
@@ -1008,31 +1044,156 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1008
1044
|
failures: []
|
|
1009
1045
|
};
|
|
1010
1046
|
}
|
|
1047
|
+
}, {
|
|
1048
|
+
key: "resolveCustomerIdForSmartPricing",
|
|
1049
|
+
value: function resolveCustomerIdForSmartPricing() {
|
|
1050
|
+
var _this$smartPricingCus2;
|
|
1051
|
+
if (this.smartPricingCustomerId !== undefined) return (_this$smartPricingCus2 = this.smartPricingCustomerId) !== null && _this$smartPricingCus2 !== void 0 ? _this$smartPricingCus2 : undefined;
|
|
1052
|
+
try {
|
|
1053
|
+
var _this$core2, _user$get;
|
|
1054
|
+
var user = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getPlugin('user');
|
|
1055
|
+
var customerId = Number(user === null || user === void 0 || (_user$get = user.get) === null || _user$get === void 0 || (_user$get = _user$get.call(user)) === null || _user$get === void 0 ? void 0 : _user$get.id);
|
|
1056
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
|
|
1057
|
+
} catch (_unused3) {
|
|
1058
|
+
return undefined;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}, {
|
|
1062
|
+
key: "buildSmartPricingContext",
|
|
1063
|
+
value: function buildSmartPricingContext() {
|
|
1064
|
+
var _this$otherParams12, _this$store$order3, _this$store$order3$ge, _ref5, _ref6, _this$otherParams$ava, _this$otherParams13, _this$otherParams14, _this$core3, _this$store$schedule, _this$store$schedule$, _this$otherParams15, _this$otherParams16, _this$core4, _this$otherParams$cha, _this$otherParams17, _ref7, _this$otherParams$bus, _this$otherParams18, _this$otherParams19, _this$otherParams20;
|
|
1065
|
+
var strategyContext = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.strategy_context) || {};
|
|
1066
|
+
var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1067
|
+
var fallbackWalletIds = (_ref5 = (_ref6 = (_this$otherParams$ava = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) !== null && _this$otherParams$ava !== void 0 ? _this$otherParams$ava : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds) !== null && _ref6 !== void 0 ? _ref6 : strategyContext.available_wallet_ids) !== null && _ref5 !== void 0 ? _ref5 : strategyContext.availableWalletIds;
|
|
1068
|
+
var walletIds = this.smartPricingCustomerId === null ? [] : orderWalletIds !== null && orderWalletIds !== void 0 && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
1069
|
+
return {
|
|
1070
|
+
evaluator: (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator,
|
|
1071
|
+
scheduleList: ((_this$store$schedule = this.store.schedule) === null || _this$store$schedule === void 0 || (_this$store$schedule$ = _this$store$schedule.getScheduleList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule)) || [],
|
|
1072
|
+
menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || ((_this$core4 = this.core) === null || _this$core4 === void 0 || (_this$core4 = _this$core4.context) === null || _this$core4 === void 0 ? void 0 : _this$core4.menuList) || [],
|
|
1073
|
+
customerId: this.resolveCustomerIdForSmartPricing(),
|
|
1074
|
+
availableWalletIds: Array.isArray(walletIds) ? walletIds : [],
|
|
1075
|
+
channel: (_this$otherParams$cha = (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : strategyContext.channel,
|
|
1076
|
+
businessCode: (_ref7 = (_this$otherParams$bus = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : strategyContext.business_code) !== null && _ref7 !== void 0 ? _ref7 : strategyContext.businessCode,
|
|
1077
|
+
orderType: ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.orderType) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type) || strategyContext.orderType || strategyContext.order_type,
|
|
1078
|
+
strategy_context: strategyContext
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
}, {
|
|
1082
|
+
key: "buildSlotPriceMapForDate",
|
|
1083
|
+
value: function buildSlotPriceMapForDate(date, config, productIds) {
|
|
1084
|
+
var _context$evaluator, _context$evaluator$ge;
|
|
1085
|
+
var context = this.buildSmartPricingContext();
|
|
1086
|
+
var strategyConfigs = (_context$evaluator = context.evaluator) === null || _context$evaluator === void 0 || (_context$evaluator$ge = _context$evaluator.getStrategyConfigs) === null || _context$evaluator$ge === void 0 ? void 0 : _context$evaluator$ge.call(_context$evaluator);
|
|
1087
|
+
if (strategyConfigs !== this.slotPriceStrategyConfigs) {
|
|
1088
|
+
this.slotPriceMapCache.clear();
|
|
1089
|
+
this.slotPriceStrategyConfigs = strategyConfigs;
|
|
1090
|
+
}
|
|
1091
|
+
if (context.scheduleList !== this.slotPriceScheduleList) {
|
|
1092
|
+
this.slotPriceMapCache.clear();
|
|
1093
|
+
this.slotPriceScheduleList = context.scheduleList;
|
|
1094
|
+
}
|
|
1095
|
+
var cacheKey = JSON.stringify([date, config, productIds, context.customerId, context.availableWalletIds, context.channel, context.businessCode, context.orderType]);
|
|
1096
|
+
var cached = this.slotPriceMapCache.get(cacheKey);
|
|
1097
|
+
if (cached) return cached;
|
|
1098
|
+
var priceMap = buildSlotPriceMapByScheduleSegments({
|
|
1099
|
+
products: this.smartPricingProductCatalog,
|
|
1100
|
+
productIds: productIds,
|
|
1101
|
+
date: date,
|
|
1102
|
+
timeLabels: generateTimeLabels(config),
|
|
1103
|
+
config: config,
|
|
1104
|
+
context: context
|
|
1105
|
+
});
|
|
1106
|
+
this.slotPriceMapCache.set(cacheKey, priceMap);
|
|
1107
|
+
return priceMap;
|
|
1108
|
+
}
|
|
1011
1109
|
|
|
1012
|
-
|
|
1110
|
+
/** 规则或客户上下文更新后,同步商品展示、已选时段和订单汇总。 */
|
|
1111
|
+
}, {
|
|
1112
|
+
key: "refreshSmartPricing",
|
|
1113
|
+
value: (function () {
|
|
1114
|
+
var _refreshSmartPricing = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1115
|
+
var _this$store$schedule2, _this$store$venueProd, _this$store$addonProd;
|
|
1116
|
+
var products;
|
|
1117
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1118
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1119
|
+
case 0:
|
|
1120
|
+
if (!this.loadAllProductsInFlight) {
|
|
1121
|
+
_context11.next = 3;
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
_context11.next = 3;
|
|
1125
|
+
return this.loadAllProductsInFlight;
|
|
1126
|
+
case 3:
|
|
1127
|
+
this.slotPriceMapCache.clear();
|
|
1128
|
+
if (!(!this.productsLoaded || !this.store.order)) {
|
|
1129
|
+
_context11.next = 6;
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
return _context11.abrupt("return");
|
|
1133
|
+
case 6:
|
|
1134
|
+
_context11.next = 8;
|
|
1135
|
+
return (_this$store$schedule2 = this.store.schedule) === null || _this$store$schedule2 === void 0 ? void 0 : _this$store$schedule2.loadAllSchedule();
|
|
1136
|
+
case 8:
|
|
1137
|
+
products = formatProductsWithDataVariant(this.smartPricingProductCatalog, this.buildSmartPricingContext());
|
|
1138
|
+
(_this$store$venueProd = this.store.venueProducts) === null || _this$store$venueProd === void 0 || _this$store$venueProd.addProduct(products.filter(function (product) {
|
|
1139
|
+
return product.duration != null;
|
|
1140
|
+
}));
|
|
1141
|
+
(_this$store$addonProd = this.store.addonProducts) === null || _this$store$addonProd === void 0 || _this$store$addonProd.addProduct(products.filter(function (product) {
|
|
1142
|
+
return product.duration == null;
|
|
1143
|
+
}));
|
|
1144
|
+
this.recalculateOrderPricesFromSmartPricing();
|
|
1145
|
+
this.store.order.applyDiscount();
|
|
1146
|
+
_context11.next = 15;
|
|
1147
|
+
return this.store.order.recalculateSummary({
|
|
1148
|
+
createIfMissing: false
|
|
1149
|
+
});
|
|
1150
|
+
case 15:
|
|
1151
|
+
this.store.order.persistTempOrder();
|
|
1152
|
+
_context11.next = 18;
|
|
1153
|
+
return this.refreshItemRuleQuantityLimits();
|
|
1154
|
+
case 18:
|
|
1155
|
+
_context11.next = 20;
|
|
1156
|
+
return this.refreshCartValidationPassed();
|
|
1157
|
+
case 20:
|
|
1158
|
+
_context11.next = 22;
|
|
1159
|
+
return this.core.effects.emit(VenueBookingHooks.onSmartPricingUpdated, {
|
|
1160
|
+
customerId: this.resolveCustomerIdForSmartPricing()
|
|
1161
|
+
});
|
|
1162
|
+
case 22:
|
|
1163
|
+
case "end":
|
|
1164
|
+
return _context11.stop();
|
|
1165
|
+
}
|
|
1166
|
+
}, _callee11, this);
|
|
1167
|
+
}));
|
|
1168
|
+
function refreshSmartPricing() {
|
|
1169
|
+
return _refreshSmartPricing.apply(this, arguments);
|
|
1170
|
+
}
|
|
1171
|
+
return refreshSmartPricing;
|
|
1172
|
+
}() // ─── 场地商品 & 附加商品 ───
|
|
1173
|
+
)
|
|
1013
1174
|
}, {
|
|
1014
1175
|
key: "loadAllProducts",
|
|
1015
1176
|
value: function () {
|
|
1016
|
-
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1177
|
+
var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1017
1178
|
var _this5 = this;
|
|
1018
|
-
return _regeneratorRuntime().wrap(function
|
|
1019
|
-
while (1) switch (
|
|
1179
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1180
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1020
1181
|
case 0:
|
|
1021
1182
|
if (!this.loadAllProductsInFlight) {
|
|
1022
|
-
|
|
1183
|
+
_context12.next = 2;
|
|
1023
1184
|
break;
|
|
1024
1185
|
}
|
|
1025
|
-
return
|
|
1186
|
+
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
1026
1187
|
case 2:
|
|
1027
1188
|
this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
|
|
1028
1189
|
_this5.loadAllProductsInFlight = null;
|
|
1029
1190
|
});
|
|
1030
|
-
return
|
|
1191
|
+
return _context12.abrupt("return", this.loadAllProductsInFlight);
|
|
1031
1192
|
case 4:
|
|
1032
1193
|
case "end":
|
|
1033
|
-
return
|
|
1194
|
+
return _context12.stop();
|
|
1034
1195
|
}
|
|
1035
|
-
},
|
|
1196
|
+
}, _callee12, this);
|
|
1036
1197
|
}));
|
|
1037
1198
|
function loadAllProducts() {
|
|
1038
1199
|
return _loadAllProducts.apply(this, arguments);
|
|
@@ -1042,73 +1203,151 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1042
1203
|
}, {
|
|
1043
1204
|
key: "_doLoadAllProducts",
|
|
1044
1205
|
value: function () {
|
|
1045
|
-
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1046
|
-
var
|
|
1047
|
-
|
|
1048
|
-
|
|
1206
|
+
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1207
|
+
var _this6 = this;
|
|
1208
|
+
var _this$otherParams21, _this$store$venueProd2, associatedMenus, menuListIds, pricingContext, allProducts, loadedList, rawProducts, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
|
|
1209
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1210
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1049
1211
|
case 0:
|
|
1050
1212
|
this.logMethodStart('loadAllProducts');
|
|
1051
|
-
|
|
1213
|
+
_context14.prev = 1;
|
|
1052
1214
|
if (this.store.venueProducts) {
|
|
1053
|
-
|
|
1215
|
+
_context14.next = 4;
|
|
1054
1216
|
break;
|
|
1055
1217
|
}
|
|
1056
1218
|
throw new Error('venueProducts 模块未初始化');
|
|
1057
1219
|
case 4:
|
|
1058
1220
|
if (this.store.addonProducts) {
|
|
1059
|
-
|
|
1221
|
+
_context14.next = 6;
|
|
1060
1222
|
break;
|
|
1061
1223
|
}
|
|
1062
1224
|
throw new Error('addonProducts 模块未初始化');
|
|
1063
1225
|
case 6:
|
|
1064
|
-
|
|
1226
|
+
_context14.next = 8;
|
|
1065
1227
|
return this.loadOpenDataConfig();
|
|
1066
1228
|
case 8:
|
|
1067
|
-
|
|
1229
|
+
if (this.store.schedule) {
|
|
1230
|
+
_context14.next = 10;
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
throw new Error('schedule 模块未初始化');
|
|
1234
|
+
case 10:
|
|
1235
|
+
_context14.next = 12;
|
|
1236
|
+
return this.store.schedule.loadAllSchedule();
|
|
1237
|
+
case 12:
|
|
1238
|
+
associatedMenus = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.openData) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus']) || [];
|
|
1068
1239
|
if (associatedMenus.length) {
|
|
1069
|
-
|
|
1240
|
+
_context14.next = 16;
|
|
1070
1241
|
break;
|
|
1071
1242
|
}
|
|
1072
1243
|
this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
|
|
1073
1244
|
throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
|
|
1074
|
-
case
|
|
1245
|
+
case 16:
|
|
1075
1246
|
menuListIds = associatedMenus.map(function (n) {
|
|
1076
1247
|
return Number(n.value);
|
|
1077
1248
|
});
|
|
1078
|
-
|
|
1249
|
+
pricingContext = this.buildSmartPricingContext();
|
|
1250
|
+
_context14.next = 20;
|
|
1079
1251
|
return this.store.venueProducts.loadProducts({
|
|
1080
1252
|
menu_list_ids: menuListIds,
|
|
1081
1253
|
cacheId: this.cacheId,
|
|
1082
1254
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
1083
|
-
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1255
|
+
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
1256
|
+
customer_id: this.resolveCustomerIdForSmartPricing(),
|
|
1257
|
+
strategy_context: _objectSpread(_objectSpread({}, pricingContext.strategy_context), {}, {
|
|
1258
|
+
channel: pricingContext.channel,
|
|
1259
|
+
business_code: pricingContext.businessCode,
|
|
1260
|
+
order_type: pricingContext.orderType,
|
|
1261
|
+
available_wallet_ids: pricingContext.availableWalletIds
|
|
1262
|
+
})
|
|
1084
1263
|
});
|
|
1085
|
-
case
|
|
1086
|
-
allProducts =
|
|
1087
|
-
|
|
1264
|
+
case 20:
|
|
1265
|
+
allProducts = _context14.sent;
|
|
1266
|
+
loadedList = Array.isArray(allProducts) ? allProducts : [];
|
|
1267
|
+
rawProducts = this.store.venueProducts.getRawProductPriceSources(loadedList.map(function (product) {
|
|
1268
|
+
return product.id;
|
|
1269
|
+
}));
|
|
1270
|
+
_context14.next = 25;
|
|
1271
|
+
return Promise.all(loadedList.map( /*#__PURE__*/function () {
|
|
1272
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(product) {
|
|
1273
|
+
var _ref9, _rawProducts$get, _this6$core$server, _this6$core$server$ge;
|
|
1274
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1275
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1276
|
+
case 0:
|
|
1277
|
+
if (!((_rawProducts$get = rawProducts.get(product.id)) !== null && _rawProducts$get !== void 0)) {
|
|
1278
|
+
_context13.next = 4;
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
_context13.t1 = _rawProducts$get;
|
|
1282
|
+
_context13.next = 7;
|
|
1283
|
+
break;
|
|
1284
|
+
case 4:
|
|
1285
|
+
_context13.next = 6;
|
|
1286
|
+
return (_this6$core$server = _this6.core.server) === null || _this6$core$server === void 0 || (_this6$core$server$ge = _this6$core$server.getProducts) === null || _this6$core$server$ge === void 0 || (_this6$core$server$ge = _this6$core$server$ge.call(_this6$core$server)) === null || _this6$core$server$ge === void 0 ? void 0 : _this6$core$server$ge.getProductById(product.id);
|
|
1287
|
+
case 6:
|
|
1288
|
+
_context13.t1 = _context13.sent;
|
|
1289
|
+
case 7:
|
|
1290
|
+
_context13.t2 = _ref9 = _context13.t1;
|
|
1291
|
+
_context13.t0 = _context13.t2 !== null;
|
|
1292
|
+
if (!_context13.t0) {
|
|
1293
|
+
_context13.next = 11;
|
|
1294
|
+
break;
|
|
1295
|
+
}
|
|
1296
|
+
_context13.t0 = _ref9 !== void 0;
|
|
1297
|
+
case 11:
|
|
1298
|
+
if (!_context13.t0) {
|
|
1299
|
+
_context13.next = 15;
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
_context13.t3 = _ref9;
|
|
1303
|
+
_context13.next = 16;
|
|
1304
|
+
break;
|
|
1305
|
+
case 15:
|
|
1306
|
+
_context13.t3 = product;
|
|
1307
|
+
case 16:
|
|
1308
|
+
return _context13.abrupt("return", _context13.t3);
|
|
1309
|
+
case 17:
|
|
1310
|
+
case "end":
|
|
1311
|
+
return _context13.stop();
|
|
1312
|
+
}
|
|
1313
|
+
}, _callee13);
|
|
1314
|
+
}));
|
|
1315
|
+
return function (_x7) {
|
|
1316
|
+
return _ref8.apply(this, arguments);
|
|
1317
|
+
};
|
|
1318
|
+
}()));
|
|
1319
|
+
case 25:
|
|
1320
|
+
this.smartPricingProductCatalog = _context14.sent;
|
|
1321
|
+
list = formatProductsWithDataVariant(this.smartPricingProductCatalog, this.buildSmartPricingContext());
|
|
1322
|
+
this.slotPriceMapCache.clear();
|
|
1088
1323
|
venueList = list.filter(function (p) {
|
|
1089
1324
|
return p.duration != null;
|
|
1090
1325
|
});
|
|
1091
1326
|
addonList = list.filter(function (p) {
|
|
1092
1327
|
return p.duration == null;
|
|
1093
1328
|
});
|
|
1094
|
-
venueStore = (_this$store$
|
|
1329
|
+
venueStore = (_this$store$venueProd2 = this.store.venueProducts) === null || _this$store$venueProd2 === void 0 ? void 0 : _this$store$venueProd2.store;
|
|
1095
1330
|
if (venueStore) {
|
|
1096
1331
|
venueStore.list = venueList.slice().sort(function (a, b) {
|
|
1097
1332
|
return Number(b.sort) - Number(a.sort);
|
|
1098
1333
|
});
|
|
1099
1334
|
}
|
|
1100
1335
|
this.store.addonProducts.addProduct(addonList);
|
|
1101
|
-
|
|
1336
|
+
|
|
1337
|
+
// 无规则命中时仍应回到原始商品价,不能回退到加载时刻的智能价。
|
|
1338
|
+
this.resourceProductMap = buildResourceProductMap(this.smartPricingProductCatalog.filter(function (product) {
|
|
1339
|
+
return product.duration != null;
|
|
1340
|
+
}));
|
|
1102
1341
|
|
|
1103
1342
|
// 加载 holder 表单
|
|
1104
1343
|
if (!this.store.order) {
|
|
1105
|
-
|
|
1344
|
+
_context14.next = 38;
|
|
1106
1345
|
break;
|
|
1107
1346
|
}
|
|
1108
|
-
products = ((_this$store$
|
|
1109
|
-
|
|
1347
|
+
products = ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getOrderProducts) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4)) || [];
|
|
1348
|
+
_context14.next = 38;
|
|
1110
1349
|
return this.preloadHolderForms(products);
|
|
1111
|
-
case
|
|
1350
|
+
case 38:
|
|
1112
1351
|
this.productsLoaded = true;
|
|
1113
1352
|
this.logMethodSuccess('loadAllProducts', {
|
|
1114
1353
|
total: list.length,
|
|
@@ -1116,20 +1355,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1116
1355
|
addonCount: addonList.length,
|
|
1117
1356
|
resourceCount: this.resourceProductMap.size
|
|
1118
1357
|
});
|
|
1119
|
-
return
|
|
1358
|
+
return _context14.abrupt("return", {
|
|
1120
1359
|
venueProducts: venueList,
|
|
1121
1360
|
addonProducts: addonList
|
|
1122
1361
|
});
|
|
1123
|
-
case
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
this.logMethodError('loadAllProducts',
|
|
1127
|
-
throw
|
|
1128
|
-
case
|
|
1362
|
+
case 43:
|
|
1363
|
+
_context14.prev = 43;
|
|
1364
|
+
_context14.t0 = _context14["catch"](1);
|
|
1365
|
+
this.logMethodError('loadAllProducts', _context14.t0);
|
|
1366
|
+
throw _context14.t0;
|
|
1367
|
+
case 47:
|
|
1129
1368
|
case "end":
|
|
1130
|
-
return
|
|
1369
|
+
return _context14.stop();
|
|
1131
1370
|
}
|
|
1132
|
-
},
|
|
1371
|
+
}, _callee14, this, [[1, 43]]);
|
|
1133
1372
|
}));
|
|
1134
1373
|
function _doLoadAllProducts() {
|
|
1135
1374
|
return _doLoadAllProducts2.apply(this, arguments);
|
|
@@ -1139,21 +1378,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1139
1378
|
}, {
|
|
1140
1379
|
key: "loadVenueProducts",
|
|
1141
1380
|
value: function () {
|
|
1142
|
-
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
1381
|
+
var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1382
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1383
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1146
1384
|
case 0:
|
|
1147
|
-
|
|
1385
|
+
_context15.next = 2;
|
|
1148
1386
|
return this.loadAllProducts();
|
|
1149
1387
|
case 2:
|
|
1150
|
-
|
|
1151
|
-
return
|
|
1388
|
+
_context15.next = 4;
|
|
1389
|
+
return this.refreshSmartPricing();
|
|
1152
1390
|
case 4:
|
|
1391
|
+
return _context15.abrupt("return", this.getVenueProducts());
|
|
1392
|
+
case 5:
|
|
1153
1393
|
case "end":
|
|
1154
|
-
return
|
|
1394
|
+
return _context15.stop();
|
|
1155
1395
|
}
|
|
1156
|
-
},
|
|
1396
|
+
}, _callee15, this);
|
|
1157
1397
|
}));
|
|
1158
1398
|
function loadVenueProducts() {
|
|
1159
1399
|
return _loadVenueProducts.apply(this, arguments);
|
|
@@ -1163,21 +1403,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1163
1403
|
}, {
|
|
1164
1404
|
key: "loadAddonProducts",
|
|
1165
1405
|
value: function () {
|
|
1166
|
-
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1406
|
+
var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1167
1407
|
var result;
|
|
1168
|
-
return _regeneratorRuntime().wrap(function
|
|
1169
|
-
while (1) switch (
|
|
1408
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1409
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1170
1410
|
case 0:
|
|
1171
|
-
|
|
1411
|
+
_context16.next = 2;
|
|
1172
1412
|
return this.loadAllProducts();
|
|
1173
1413
|
case 2:
|
|
1174
|
-
result =
|
|
1175
|
-
return
|
|
1414
|
+
result = _context16.sent;
|
|
1415
|
+
return _context16.abrupt("return", result.addonProducts);
|
|
1176
1416
|
case 4:
|
|
1177
1417
|
case "end":
|
|
1178
|
-
return
|
|
1418
|
+
return _context16.stop();
|
|
1179
1419
|
}
|
|
1180
|
-
},
|
|
1420
|
+
}, _callee16, this);
|
|
1181
1421
|
}));
|
|
1182
1422
|
function loadAddonProducts() {
|
|
1183
1423
|
return _loadAddonProducts.apply(this, arguments);
|
|
@@ -1187,42 +1427,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1187
1427
|
}, {
|
|
1188
1428
|
key: "getVenueProducts",
|
|
1189
1429
|
value: function getVenueProducts() {
|
|
1190
|
-
var _this$store$
|
|
1191
|
-
return ((_this$store$
|
|
1430
|
+
var _this$store$venueProd3;
|
|
1431
|
+
return ((_this$store$venueProd3 = this.store.venueProducts) === null || _this$store$venueProd3 === void 0 || (_this$store$venueProd3 = _this$store$venueProd3.store) === null || _this$store$venueProd3 === void 0 ? void 0 : _this$store$venueProd3.list) || [];
|
|
1192
1432
|
}
|
|
1193
1433
|
}, {
|
|
1194
1434
|
key: "getAddonProductsList",
|
|
1195
1435
|
value: function getAddonProductsList() {
|
|
1196
|
-
var _this$store$
|
|
1197
|
-
return ((_this$store$
|
|
1436
|
+
var _this$store$addonProd2;
|
|
1437
|
+
return ((_this$store$addonProd2 = this.store.addonProducts) === null || _this$store$addonProd2 === void 0 || (_this$store$addonProd2 = _this$store$addonProd2.store) === null || _this$store$addonProd2 === void 0 ? void 0 : _this$store$addonProd2.list) || [];
|
|
1198
1438
|
}
|
|
1199
1439
|
|
|
1200
1440
|
// ─── 报价单 ───
|
|
1201
1441
|
}, {
|
|
1202
1442
|
key: "ensureQuotationsLoaded",
|
|
1203
1443
|
value: function () {
|
|
1204
|
-
var _ensureQuotationsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1444
|
+
var _ensureQuotationsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1205
1445
|
var quotation, load;
|
|
1206
|
-
return _regeneratorRuntime().wrap(function
|
|
1207
|
-
while (1) switch (
|
|
1446
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1447
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1208
1448
|
case 0:
|
|
1209
1449
|
quotation = this.store.quotation;
|
|
1210
1450
|
if (quotation) {
|
|
1211
|
-
|
|
1451
|
+
_context17.next = 3;
|
|
1212
1452
|
break;
|
|
1213
1453
|
}
|
|
1214
|
-
return
|
|
1454
|
+
return _context17.abrupt("return");
|
|
1215
1455
|
case 3:
|
|
1216
1456
|
load = typeof quotation.ensureQuotations === 'function' ? quotation.ensureQuotations.bind(quotation) : quotation.loadQuotations.bind(quotation);
|
|
1217
|
-
|
|
1457
|
+
_context17.next = 6;
|
|
1218
1458
|
return load(params);
|
|
1219
1459
|
case 6:
|
|
1220
1460
|
case "end":
|
|
1221
|
-
return
|
|
1461
|
+
return _context17.stop();
|
|
1222
1462
|
}
|
|
1223
|
-
},
|
|
1463
|
+
}, _callee17, this);
|
|
1224
1464
|
}));
|
|
1225
|
-
function ensureQuotationsLoaded(
|
|
1465
|
+
function ensureQuotationsLoaded(_x8) {
|
|
1226
1466
|
return _ensureQuotationsLoaded.apply(this, arguments);
|
|
1227
1467
|
}
|
|
1228
1468
|
return ensureQuotationsLoaded;
|
|
@@ -1230,9 +1470,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1230
1470
|
}, {
|
|
1231
1471
|
key: "preloadQuotations",
|
|
1232
1472
|
value: function preloadQuotations(params) {
|
|
1233
|
-
var
|
|
1473
|
+
var _this7 = this;
|
|
1234
1474
|
void this.ensureQuotationsLoaded(params).catch(function (error) {
|
|
1235
|
-
|
|
1475
|
+
_this7.logMethodError('preloadQuotations', error, {
|
|
1236
1476
|
channel: params === null || params === void 0 ? void 0 : params.channel
|
|
1237
1477
|
});
|
|
1238
1478
|
});
|
|
@@ -1240,38 +1480,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1240
1480
|
}, {
|
|
1241
1481
|
key: "loadQuotations",
|
|
1242
1482
|
value: function () {
|
|
1243
|
-
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1244
|
-
return _regeneratorRuntime().wrap(function
|
|
1245
|
-
while (1) switch (
|
|
1483
|
+
var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1484
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1485
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1246
1486
|
case 0:
|
|
1247
1487
|
this.logMethodStart('loadQuotations');
|
|
1248
|
-
|
|
1488
|
+
_context18.prev = 1;
|
|
1249
1489
|
if (this.store.quotation) {
|
|
1250
|
-
|
|
1490
|
+
_context18.next = 4;
|
|
1251
1491
|
break;
|
|
1252
1492
|
}
|
|
1253
1493
|
throw new Error('quotation 模块未初始化');
|
|
1254
1494
|
case 4:
|
|
1255
|
-
|
|
1495
|
+
_context18.next = 6;
|
|
1256
1496
|
return this.store.quotation.loadQuotations(params);
|
|
1257
1497
|
case 6:
|
|
1258
1498
|
this.logMethodSuccess('loadQuotations', {
|
|
1259
1499
|
count: this.store.quotation.getQuotationList().length
|
|
1260
1500
|
});
|
|
1261
|
-
|
|
1501
|
+
_context18.next = 13;
|
|
1262
1502
|
break;
|
|
1263
1503
|
case 9:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
this.logMethodError('loadQuotations',
|
|
1267
|
-
throw
|
|
1504
|
+
_context18.prev = 9;
|
|
1505
|
+
_context18.t0 = _context18["catch"](1);
|
|
1506
|
+
this.logMethodError('loadQuotations', _context18.t0);
|
|
1507
|
+
throw _context18.t0;
|
|
1268
1508
|
case 13:
|
|
1269
1509
|
case "end":
|
|
1270
|
-
return
|
|
1510
|
+
return _context18.stop();
|
|
1271
1511
|
}
|
|
1272
|
-
},
|
|
1512
|
+
}, _callee18, this, [[1, 9]]);
|
|
1273
1513
|
}));
|
|
1274
|
-
function loadQuotations(
|
|
1514
|
+
function loadQuotations(_x9) {
|
|
1275
1515
|
return _loadQuotations.apply(this, arguments);
|
|
1276
1516
|
}
|
|
1277
1517
|
return loadQuotations;
|
|
@@ -1279,46 +1519,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1279
1519
|
}, {
|
|
1280
1520
|
key: "fetchResourceAvailability",
|
|
1281
1521
|
value: function () {
|
|
1282
|
-
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1283
|
-
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item,
|
|
1284
|
-
return _regeneratorRuntime().wrap(function
|
|
1285
|
-
while (1) switch (
|
|
1522
|
+
var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1523
|
+
var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i4, _rawData, _item, mappings, _iterator4, _step4, mapping;
|
|
1524
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1525
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1286
1526
|
case 0:
|
|
1287
1527
|
this.logMethodStart('fetchResourceAvailability', params);
|
|
1288
|
-
|
|
1528
|
+
_context19.prev = 1;
|
|
1289
1529
|
venueProducts = this.getVenueProducts();
|
|
1290
1530
|
if (venueProducts.length) {
|
|
1291
|
-
|
|
1531
|
+
_context19.next = 7;
|
|
1292
1532
|
break;
|
|
1293
1533
|
}
|
|
1294
1534
|
this.store.rawResourceData = [];
|
|
1295
1535
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1296
1536
|
resourceCount: 0
|
|
1297
1537
|
});
|
|
1298
|
-
return
|
|
1538
|
+
return _context19.abrupt("return");
|
|
1299
1539
|
case 7:
|
|
1300
1540
|
resourceIds = extractResourceIds(venueProducts);
|
|
1301
1541
|
if (resourceIds.length) {
|
|
1302
|
-
|
|
1542
|
+
_context19.next = 12;
|
|
1303
1543
|
break;
|
|
1304
1544
|
}
|
|
1305
1545
|
this.store.rawResourceData = [];
|
|
1306
1546
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
1307
1547
|
resourceIds: []
|
|
1308
1548
|
});
|
|
1309
|
-
return
|
|
1549
|
+
return _context19.abrupt("return");
|
|
1310
1550
|
case 12:
|
|
1311
1551
|
// 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
|
|
1312
1552
|
config = this.store.slotConfig;
|
|
1313
1553
|
crossDay = isBusinessHoursCrossDay(config);
|
|
1314
1554
|
effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
|
|
1315
1555
|
if (this.store.date) {
|
|
1316
|
-
|
|
1556
|
+
_context19.next = 17;
|
|
1317
1557
|
break;
|
|
1318
1558
|
}
|
|
1319
1559
|
throw new Error('date 模块未初始化');
|
|
1320
1560
|
case 17:
|
|
1321
|
-
|
|
1561
|
+
_context19.next = 19;
|
|
1322
1562
|
return this.store.date.fetchResourceDates({
|
|
1323
1563
|
query: {
|
|
1324
1564
|
start_date: params.startDate,
|
|
@@ -1328,7 +1568,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1328
1568
|
useCache: false
|
|
1329
1569
|
});
|
|
1330
1570
|
case 19:
|
|
1331
|
-
res =
|
|
1571
|
+
res = _context19.sent;
|
|
1332
1572
|
rawData = [];
|
|
1333
1573
|
if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
|
|
1334
1574
|
_iterator3 = _createForOfIteratorHelper(res.data);
|
|
@@ -1348,19 +1588,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1348
1588
|
}
|
|
1349
1589
|
}
|
|
1350
1590
|
this.store.rawResourceData = rawData;
|
|
1351
|
-
|
|
1591
|
+
_i4 = 0, _rawData = rawData;
|
|
1352
1592
|
case 24:
|
|
1353
|
-
if (!(
|
|
1354
|
-
|
|
1593
|
+
if (!(_i4 < _rawData.length)) {
|
|
1594
|
+
_context19.next = 34;
|
|
1355
1595
|
break;
|
|
1356
1596
|
}
|
|
1357
|
-
_item = _rawData[
|
|
1597
|
+
_item = _rawData[_i4];
|
|
1358
1598
|
mappings = this.resourceProductMap.get(_item.resourceId);
|
|
1359
1599
|
if (mappings) {
|
|
1360
|
-
|
|
1600
|
+
_context19.next = 29;
|
|
1361
1601
|
break;
|
|
1362
1602
|
}
|
|
1363
|
-
return
|
|
1603
|
+
return _context19.abrupt("continue", 31);
|
|
1364
1604
|
case 29:
|
|
1365
1605
|
_iterator4 = _createForOfIteratorHelper(mappings);
|
|
1366
1606
|
try {
|
|
@@ -1375,8 +1615,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1375
1615
|
_iterator4.f();
|
|
1376
1616
|
}
|
|
1377
1617
|
case 31:
|
|
1378
|
-
|
|
1379
|
-
|
|
1618
|
+
_i4++;
|
|
1619
|
+
_context19.next = 24;
|
|
1380
1620
|
break;
|
|
1381
1621
|
case 34:
|
|
1382
1622
|
this.logMethodSuccess('fetchResourceAvailability', {
|
|
@@ -1385,21 +1625,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1385
1625
|
return sum + r.times.length;
|
|
1386
1626
|
}, 0)
|
|
1387
1627
|
});
|
|
1388
|
-
|
|
1628
|
+
_context19.next = 42;
|
|
1389
1629
|
break;
|
|
1390
1630
|
case 37:
|
|
1391
|
-
|
|
1392
|
-
|
|
1631
|
+
_context19.prev = 37;
|
|
1632
|
+
_context19.t0 = _context19["catch"](1);
|
|
1393
1633
|
this.store.rawResourceData = [];
|
|
1394
|
-
this.logMethodError('fetchResourceAvailability',
|
|
1395
|
-
throw
|
|
1634
|
+
this.logMethodError('fetchResourceAvailability', _context19.t0);
|
|
1635
|
+
throw _context19.t0;
|
|
1396
1636
|
case 42:
|
|
1397
1637
|
case "end":
|
|
1398
|
-
return
|
|
1638
|
+
return _context19.stop();
|
|
1399
1639
|
}
|
|
1400
|
-
},
|
|
1640
|
+
}, _callee19, this, [[1, 37]]);
|
|
1401
1641
|
}));
|
|
1402
|
-
function fetchResourceAvailability(
|
|
1642
|
+
function fetchResourceAvailability(_x10) {
|
|
1403
1643
|
return _fetchResourceAvailability.apply(this, arguments);
|
|
1404
1644
|
}
|
|
1405
1645
|
return fetchResourceAvailability;
|
|
@@ -1480,18 +1720,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1480
1720
|
}, {
|
|
1481
1721
|
key: "getDateRangeSummary",
|
|
1482
1722
|
value: function getDateRangeSummary(params) {
|
|
1483
|
-
var
|
|
1484
|
-
_this7 = this;
|
|
1723
|
+
var _this8 = this;
|
|
1485
1724
|
return buildDateRangeSummary({
|
|
1486
1725
|
startDate: params.startDate,
|
|
1487
1726
|
endDate: params.endDate,
|
|
1488
1727
|
config: this.baseSlotConfig,
|
|
1489
1728
|
rawResources: this.store.rawResourceData,
|
|
1490
1729
|
resourceProductMap: this.resourceProductMap,
|
|
1491
|
-
quotationModule: this.store.quotation,
|
|
1492
|
-
channel: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel,
|
|
1493
1730
|
resolveConfig: function resolveConfig(date) {
|
|
1494
|
-
return
|
|
1731
|
+
return _this8.resolveSlotConfigForDate(date);
|
|
1732
|
+
},
|
|
1733
|
+
buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
|
|
1734
|
+
return _this8.buildSlotPriceMapForDate(date, config, productIds);
|
|
1495
1735
|
}
|
|
1496
1736
|
});
|
|
1497
1737
|
}
|
|
@@ -1499,29 +1739,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1499
1739
|
key: "getTimeSlotGrid",
|
|
1500
1740
|
value: function getTimeSlotGrid(date) {
|
|
1501
1741
|
var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
|
|
1502
|
-
var
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
})));
|
|
1508
|
-
var timeLabels = generateTimeLabels(resolvedSlotConfig);
|
|
1509
|
-
var timePoints = timeLabels.map(function (label) {
|
|
1510
|
-
return "".concat(date, " ").concat(label);
|
|
1511
|
-
});
|
|
1512
|
-
quotationPriceMap = this.store.quotation.buildProductPriceMap({
|
|
1513
|
-
productIds: productIds,
|
|
1514
|
-
timePoints: timePoints,
|
|
1515
|
-
channel: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.channel
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
return buildTimeSlotGrid({
|
|
1742
|
+
var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (mapping) {
|
|
1743
|
+
return mapping.productId;
|
|
1744
|
+
})));
|
|
1745
|
+
var slotPriceMap = this.buildSlotPriceMapForDate(date, resolvedSlotConfig, productIds);
|
|
1746
|
+
var grid = buildTimeSlotGrid({
|
|
1519
1747
|
date: date,
|
|
1520
1748
|
config: resolvedSlotConfig,
|
|
1521
1749
|
rawResources: this.store.rawResourceData,
|
|
1522
1750
|
resourceProductMap: this.resourceProductMap,
|
|
1523
|
-
|
|
1751
|
+
slotPriceMap: slotPriceMap
|
|
1524
1752
|
});
|
|
1753
|
+
return grid;
|
|
1525
1754
|
}
|
|
1526
1755
|
|
|
1527
1756
|
// ─── 时间槽订单操作 ───
|
|
@@ -1536,20 +1765,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1536
1765
|
}, {
|
|
1537
1766
|
key: "toggleSlot",
|
|
1538
1767
|
value: function () {
|
|
1539
|
-
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1768
|
+
var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(slot) {
|
|
1540
1769
|
var mappings, mapping, currentSlots, existIndex, nextSlots, products;
|
|
1541
|
-
return _regeneratorRuntime().wrap(function
|
|
1542
|
-
while (1) switch (
|
|
1770
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1771
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1543
1772
|
case 0:
|
|
1544
1773
|
this.logMethodStart('toggleSlot', {
|
|
1545
1774
|
resourceId: slot.resourceId,
|
|
1546
1775
|
productId: slot.productId,
|
|
1547
1776
|
startTime: slot.startTime
|
|
1548
1777
|
});
|
|
1549
|
-
|
|
1778
|
+
_context20.prev = 1;
|
|
1550
1779
|
mappings = this.resourceProductMap.get(slot.resourceId);
|
|
1551
1780
|
if (!(!mappings || !mappings.length)) {
|
|
1552
|
-
|
|
1781
|
+
_context20.next = 5;
|
|
1553
1782
|
break;
|
|
1554
1783
|
}
|
|
1555
1784
|
throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
|
|
@@ -1558,13 +1787,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1558
1787
|
return m.productId === slot.productId;
|
|
1559
1788
|
});
|
|
1560
1789
|
if (mapping) {
|
|
1561
|
-
|
|
1790
|
+
_context20.next = 8;
|
|
1562
1791
|
break;
|
|
1563
1792
|
}
|
|
1564
1793
|
throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
|
|
1565
1794
|
case 8:
|
|
1566
1795
|
if (this.store.order) {
|
|
1567
|
-
|
|
1796
|
+
_context20.next = 10;
|
|
1568
1797
|
break;
|
|
1569
1798
|
}
|
|
1570
1799
|
throw new Error('order 模块未初始化');
|
|
@@ -1580,14 +1809,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1580
1809
|
} else {
|
|
1581
1810
|
nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
|
|
1582
1811
|
}
|
|
1583
|
-
|
|
1812
|
+
_context20.next = 15;
|
|
1584
1813
|
return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
|
|
1585
1814
|
case 15:
|
|
1586
1815
|
products = this.store.order.getOrderProducts();
|
|
1587
|
-
|
|
1816
|
+
_context20.next = 18;
|
|
1588
1817
|
return this.refreshItemRuleQuantityLimits();
|
|
1589
1818
|
case 18:
|
|
1590
|
-
|
|
1819
|
+
_context20.next = 20;
|
|
1591
1820
|
return this.refreshCartValidationPassed();
|
|
1592
1821
|
case 20:
|
|
1593
1822
|
this.logMethodSuccess('toggleSlot', {
|
|
@@ -1596,19 +1825,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1596
1825
|
productId: slot.productId,
|
|
1597
1826
|
slotCount: nextSlots.length
|
|
1598
1827
|
});
|
|
1599
|
-
return
|
|
1828
|
+
return _context20.abrupt("return", products);
|
|
1600
1829
|
case 24:
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
this.logMethodError('toggleSlot',
|
|
1604
|
-
throw
|
|
1830
|
+
_context20.prev = 24;
|
|
1831
|
+
_context20.t0 = _context20["catch"](1);
|
|
1832
|
+
this.logMethodError('toggleSlot', _context20.t0);
|
|
1833
|
+
throw _context20.t0;
|
|
1605
1834
|
case 28:
|
|
1606
1835
|
case "end":
|
|
1607
|
-
return
|
|
1836
|
+
return _context20.stop();
|
|
1608
1837
|
}
|
|
1609
|
-
},
|
|
1838
|
+
}, _callee20, this, [[1, 24]]);
|
|
1610
1839
|
}));
|
|
1611
|
-
function toggleSlot(
|
|
1840
|
+
function toggleSlot(_x11) {
|
|
1612
1841
|
return _toggleSlot.apply(this, arguments);
|
|
1613
1842
|
}
|
|
1614
1843
|
return toggleSlot;
|
|
@@ -1620,8 +1849,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1620
1849
|
}, {
|
|
1621
1850
|
key: "getSelectedSlotsForResource",
|
|
1622
1851
|
value: function getSelectedSlotsForResource(resourceId, productId) {
|
|
1623
|
-
var _this$store$
|
|
1624
|
-
var tempOrder = (_this$store$
|
|
1852
|
+
var _this$store$order5;
|
|
1853
|
+
var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
|
|
1625
1854
|
if (!tempOrder) return [];
|
|
1626
1855
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1627
1856
|
var _p$metadata, _p$metadata2;
|
|
@@ -1686,7 +1915,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1686
1915
|
}, {
|
|
1687
1916
|
key: "isSlotDisabledBySelection",
|
|
1688
1917
|
value: function isSlotDisabledBySelection(params) {
|
|
1689
|
-
var
|
|
1918
|
+
var _this9 = this;
|
|
1690
1919
|
var resourceId = params.resourceId,
|
|
1691
1920
|
productId = params.productId,
|
|
1692
1921
|
startTime = params.startTime;
|
|
@@ -1708,7 +1937,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1708
1937
|
|
|
1709
1938
|
// 组合资源字段缓存
|
|
1710
1939
|
var getCombinedChildIds = function getCombinedChildIds(resId) {
|
|
1711
|
-
var raw =
|
|
1940
|
+
var raw = _this9.store.rawResourceData.find(function (r) {
|
|
1712
1941
|
return String(r.resourceId) === String(resId);
|
|
1713
1942
|
});
|
|
1714
1943
|
var combined = raw === null || raw === void 0 ? void 0 : raw.combined_resource;
|
|
@@ -1782,9 +2011,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1782
2011
|
}, {
|
|
1783
2012
|
key: "getAllSelectedSlots",
|
|
1784
2013
|
value: function getAllSelectedSlots() {
|
|
1785
|
-
var _this$store$
|
|
2014
|
+
var _this$store$order6;
|
|
1786
2015
|
var result = new Map();
|
|
1787
|
-
var tempOrder = (_this$store$
|
|
2016
|
+
var tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder();
|
|
1788
2017
|
if (!tempOrder) return result;
|
|
1789
2018
|
var venueProducts = tempOrder.products.filter(function (p) {
|
|
1790
2019
|
var _p$metadata3;
|
|
@@ -1795,9 +2024,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1795
2024
|
_step10;
|
|
1796
2025
|
try {
|
|
1797
2026
|
var _loop2 = function _loop2() {
|
|
1798
|
-
var _product$
|
|
2027
|
+
var _product$metadata;
|
|
1799
2028
|
var product = _step10.value;
|
|
1800
|
-
var resourceId = (_product$
|
|
2029
|
+
var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
|
|
1801
2030
|
if (resourceId == null) return 1; // continue
|
|
1802
2031
|
var productId = Number(product.product_id);
|
|
1803
2032
|
var existing = result.get(resourceId) || [];
|
|
@@ -1843,27 +2072,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1843
2072
|
}, {
|
|
1844
2073
|
key: "reconcileOrderForResourceProduct",
|
|
1845
2074
|
value: (function () {
|
|
1846
|
-
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1847
|
-
var _this$store$
|
|
1848
|
-
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char,
|
|
1849
|
-
return _regeneratorRuntime().wrap(function
|
|
1850
|
-
while (1) switch (
|
|
2075
|
+
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(resourceId, productId, slots) {
|
|
2076
|
+
var _this$store$order7, _this$store$order7$ge;
|
|
2077
|
+
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, productUid, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
|
|
2078
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2079
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1851
2080
|
case 0:
|
|
1852
2081
|
mappings = this.resourceProductMap.get(resourceId);
|
|
1853
2082
|
if (!(!mappings || !mappings.length || !this.store.order)) {
|
|
1854
|
-
|
|
2083
|
+
_context21.next = 3;
|
|
1855
2084
|
break;
|
|
1856
2085
|
}
|
|
1857
|
-
return
|
|
2086
|
+
return _context21.abrupt("return");
|
|
1858
2087
|
case 3:
|
|
1859
2088
|
mapping = mappings.find(function (m) {
|
|
1860
2089
|
return m.productId === productId;
|
|
1861
2090
|
});
|
|
1862
2091
|
if (mapping) {
|
|
1863
|
-
|
|
2092
|
+
_context21.next = 6;
|
|
1864
2093
|
break;
|
|
1865
2094
|
}
|
|
1866
|
-
return
|
|
2095
|
+
return _context21.abrupt("return");
|
|
1867
2096
|
case 6:
|
|
1868
2097
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1869
2098
|
matchesCurrent = function matchesCurrent(meta, pid) {
|
|
@@ -1881,17 +2110,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1881
2110
|
return Number(bookingProductId) !== Number(productId);
|
|
1882
2111
|
});
|
|
1883
2112
|
if (slots.length) {
|
|
1884
|
-
|
|
2113
|
+
_context21.next = 16;
|
|
1885
2114
|
break;
|
|
1886
2115
|
}
|
|
1887
2116
|
this.store.order.applyDiscount();
|
|
1888
|
-
|
|
2117
|
+
_context21.next = 14;
|
|
1889
2118
|
return this.store.order.recalculateSummary({
|
|
1890
2119
|
createIfMissing: true
|
|
1891
2120
|
});
|
|
1892
2121
|
case 14:
|
|
1893
2122
|
this.store.order.persistTempOrder();
|
|
1894
|
-
return
|
|
2123
|
+
return _context21.abrupt("return");
|
|
1895
2124
|
case 16:
|
|
1896
2125
|
merged = mergeConsecutiveSlots(slots);
|
|
1897
2126
|
rawResource = this.store.rawResourceData.find(function (r) {
|
|
@@ -1904,7 +2133,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1904
2133
|
tempOrder.bookings = tempOrder.bookings || [];
|
|
1905
2134
|
for (i = 0; i < merged.length; i++) {
|
|
1906
2135
|
group = merged[i];
|
|
1907
|
-
|
|
2136
|
+
productUid = buildVenueIdentityKey(resourceId, i);
|
|
1908
2137
|
bookingUuid = createUuidV4();
|
|
1909
2138
|
startMoment = dayjs(group.startTime, 'YYYY-MM-DD HH:mm');
|
|
1910
2139
|
endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
|
|
@@ -1980,12 +2209,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1980
2209
|
normalizedVenueOrderProduct = normalizeOrderProduct({
|
|
1981
2210
|
product_id: mapping.productId,
|
|
1982
2211
|
product_variant_id: 0,
|
|
1983
|
-
identity_key: identityKey,
|
|
1984
2212
|
num: 1,
|
|
1985
2213
|
selling_price: group.totalPrice,
|
|
1986
2214
|
original_price: group.totalPrice,
|
|
1987
2215
|
is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
|
|
1988
2216
|
metadata: _objectSpread(_objectSpread({
|
|
2217
|
+
unique_identification_number: productUid,
|
|
1989
2218
|
venue_booking: true
|
|
1990
2219
|
}, productTitle ? {
|
|
1991
2220
|
product_title: productTitle
|
|
@@ -1999,9 +2228,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1999
2228
|
booking_uid: bookingUuid,
|
|
2000
2229
|
price_breakdown: buildPriceBreakdown({
|
|
2001
2230
|
group: group,
|
|
2002
|
-
productId: mapping.productId
|
|
2003
|
-
quotation: this.store.quotation,
|
|
2004
|
-
channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel
|
|
2231
|
+
productId: mapping.productId
|
|
2005
2232
|
})
|
|
2006
2233
|
}),
|
|
2007
2234
|
_origin: venueProductOrigin
|
|
@@ -2009,7 +2236,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2009
2236
|
venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
|
|
2010
2237
|
product_title: productTitle
|
|
2011
2238
|
}) : normalizedVenueOrderProduct;
|
|
2012
|
-
this.attachProductOriginToTempOrder(tempOrder,
|
|
2239
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, venueProductOrigin);
|
|
2013
2240
|
tempOrder.products.push(venueOrderProduct);
|
|
2014
2241
|
booking = buildVenueBookingEntry({
|
|
2015
2242
|
group: group,
|
|
@@ -2017,19 +2244,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2017
2244
|
mapping: mapping,
|
|
2018
2245
|
rawResource: rawResource,
|
|
2019
2246
|
bookingUuid: bookingUuid,
|
|
2020
|
-
productUid:
|
|
2247
|
+
productUid: productUid,
|
|
2021
2248
|
childResources: childRawResources
|
|
2022
2249
|
});
|
|
2023
2250
|
tempOrder.bookings.push(booking);
|
|
2024
2251
|
}
|
|
2025
2252
|
|
|
2026
2253
|
// 获取表单信息
|
|
2027
|
-
products = ((_this$store$
|
|
2028
|
-
|
|
2254
|
+
products = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getOrderProducts) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7)) || [];
|
|
2255
|
+
_context21.next = 25;
|
|
2029
2256
|
return this.preloadHolderForms(products);
|
|
2030
2257
|
case 25:
|
|
2031
2258
|
this.store.order.applyDiscount();
|
|
2032
|
-
|
|
2259
|
+
_context21.next = 28;
|
|
2033
2260
|
return this.store.order.recalculateSummary({
|
|
2034
2261
|
createIfMissing: true
|
|
2035
2262
|
});
|
|
@@ -2037,11 +2264,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2037
2264
|
this.store.order.persistTempOrder();
|
|
2038
2265
|
case 29:
|
|
2039
2266
|
case "end":
|
|
2040
|
-
return
|
|
2267
|
+
return _context21.stop();
|
|
2041
2268
|
}
|
|
2042
|
-
},
|
|
2269
|
+
}, _callee21, this);
|
|
2043
2270
|
}));
|
|
2044
|
-
function reconcileOrderForResourceProduct(
|
|
2271
|
+
function reconcileOrderForResourceProduct(_x12, _x13, _x14) {
|
|
2045
2272
|
return _reconcileOrderForResourceProduct.apply(this, arguments);
|
|
2046
2273
|
}
|
|
2047
2274
|
return reconcileOrderForResourceProduct;
|
|
@@ -2049,7 +2276,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2049
2276
|
}, {
|
|
2050
2277
|
key: "getCombinedChildRawResources",
|
|
2051
2278
|
value: function getCombinedChildRawResources(rawResource) {
|
|
2052
|
-
var
|
|
2279
|
+
var _this10 = this;
|
|
2053
2280
|
if (!rawResource) return undefined;
|
|
2054
2281
|
var combined = rawResource.combined_resource;
|
|
2055
2282
|
if (!combined || combined.status !== 1 || !Array.isArray(combined.resource_ids) || !combined.resource_ids.length) {
|
|
@@ -2061,7 +2288,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2061
2288
|
try {
|
|
2062
2289
|
var _loop3 = function _loop3() {
|
|
2063
2290
|
var id = _step12.value;
|
|
2064
|
-
var child =
|
|
2291
|
+
var child = _this10.store.rawResourceData.find(function (r) {
|
|
2065
2292
|
return String(r.resourceId) === String(id);
|
|
2066
2293
|
});
|
|
2067
2294
|
if (child) children.push(child);
|
|
@@ -2081,6 +2308,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2081
2308
|
}, {
|
|
2082
2309
|
key: "setSlotConfig",
|
|
2083
2310
|
value: function setSlotConfig(config) {
|
|
2311
|
+
this.slotPriceMapCache.clear();
|
|
2084
2312
|
this.baseSlotConfig = _objectSpread(_objectSpread({}, this.baseSlotConfig), config);
|
|
2085
2313
|
this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
|
|
2086
2314
|
}
|
|
@@ -2094,35 +2322,39 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2094
2322
|
}, {
|
|
2095
2323
|
key: "loadSchedules",
|
|
2096
2324
|
value: function () {
|
|
2097
|
-
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2098
|
-
return _regeneratorRuntime().wrap(function
|
|
2099
|
-
while (1) switch (
|
|
2325
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2326
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2327
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2100
2328
|
case 0:
|
|
2101
2329
|
this.logMethodStart('loadSchedules');
|
|
2102
|
-
|
|
2330
|
+
_context22.prev = 1;
|
|
2103
2331
|
if (this.store.schedule) {
|
|
2104
|
-
|
|
2332
|
+
_context22.next = 4;
|
|
2105
2333
|
break;
|
|
2106
2334
|
}
|
|
2107
2335
|
throw new Error('schedule 模块未初始化');
|
|
2108
2336
|
case 4:
|
|
2109
|
-
|
|
2337
|
+
_context22.next = 6;
|
|
2110
2338
|
return this.store.schedule.loadAllSchedule();
|
|
2111
2339
|
case 6:
|
|
2112
2340
|
this.injectScheduleResolverToQuotation();
|
|
2341
|
+
this.slotPriceMapCache.clear();
|
|
2342
|
+
_context22.next = 10;
|
|
2343
|
+
return this.refreshSmartPricing();
|
|
2344
|
+
case 10:
|
|
2113
2345
|
this.logMethodSuccess('loadSchedules');
|
|
2114
|
-
|
|
2346
|
+
_context22.next = 17;
|
|
2115
2347
|
break;
|
|
2116
|
-
case
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
this.logMethodError('loadSchedules',
|
|
2120
|
-
throw
|
|
2121
|
-
case
|
|
2348
|
+
case 13:
|
|
2349
|
+
_context22.prev = 13;
|
|
2350
|
+
_context22.t0 = _context22["catch"](1);
|
|
2351
|
+
this.logMethodError('loadSchedules', _context22.t0);
|
|
2352
|
+
throw _context22.t0;
|
|
2353
|
+
case 17:
|
|
2122
2354
|
case "end":
|
|
2123
|
-
return
|
|
2355
|
+
return _context22.stop();
|
|
2124
2356
|
}
|
|
2125
|
-
},
|
|
2357
|
+
}, _callee22, this, [[1, 13]]);
|
|
2126
2358
|
}));
|
|
2127
2359
|
function loadSchedules() {
|
|
2128
2360
|
return _loadSchedules.apply(this, arguments);
|
|
@@ -2132,10 +2364,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2132
2364
|
}, {
|
|
2133
2365
|
key: "injectScheduleResolverToQuotation",
|
|
2134
2366
|
value: function injectScheduleResolverToQuotation() {
|
|
2135
|
-
var
|
|
2367
|
+
var _this11 = this;
|
|
2136
2368
|
if (this.store.quotation && this.store.schedule) {
|
|
2137
2369
|
this.store.quotation.setScheduleResolver(function (id) {
|
|
2138
|
-
return
|
|
2370
|
+
return _this11.store.schedule.getScheduleListByIds([id])[0];
|
|
2139
2371
|
});
|
|
2140
2372
|
}
|
|
2141
2373
|
}
|
|
@@ -2150,8 +2382,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2150
2382
|
}, {
|
|
2151
2383
|
key: "getTempOrder",
|
|
2152
2384
|
value: function getTempOrder() {
|
|
2153
|
-
var _this$store$
|
|
2154
|
-
var result = ((_this$store$
|
|
2385
|
+
var _this$store$order8;
|
|
2386
|
+
var result = ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getTempOrder()) || null;
|
|
2155
2387
|
return result;
|
|
2156
2388
|
}
|
|
2157
2389
|
}, {
|
|
@@ -2176,46 +2408,68 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2176
2408
|
}, {
|
|
2177
2409
|
key: "onCustomerLogin",
|
|
2178
2410
|
value: function () {
|
|
2179
|
-
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2180
|
-
return _regeneratorRuntime().wrap(function
|
|
2181
|
-
while (1) switch (
|
|
2411
|
+
var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2412
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2413
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2182
2414
|
case 0:
|
|
2183
2415
|
this.logMethodStart('onCustomerLogin', {
|
|
2184
2416
|
customerId: params.customerId
|
|
2185
2417
|
});
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
return this.
|
|
2418
|
+
_context23.prev = 1;
|
|
2419
|
+
_context23.next = 4;
|
|
2420
|
+
return this.refreshOrderMarketingForCustomer({
|
|
2189
2421
|
customerId: params.customerId
|
|
2190
2422
|
});
|
|
2191
2423
|
case 4:
|
|
2192
2424
|
this.logMethodSuccess('onCustomerLogin', {
|
|
2193
2425
|
customerId: params.customerId
|
|
2194
2426
|
});
|
|
2195
|
-
|
|
2427
|
+
_context23.next = 11;
|
|
2196
2428
|
break;
|
|
2197
2429
|
case 7:
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
this.logMethodError('onCustomerLogin',
|
|
2201
|
-
throw
|
|
2430
|
+
_context23.prev = 7;
|
|
2431
|
+
_context23.t0 = _context23["catch"](1);
|
|
2432
|
+
this.logMethodError('onCustomerLogin', _context23.t0);
|
|
2433
|
+
throw _context23.t0;
|
|
2202
2434
|
case 11:
|
|
2203
2435
|
case "end":
|
|
2204
|
-
return
|
|
2436
|
+
return _context23.stop();
|
|
2205
2437
|
}
|
|
2206
|
-
},
|
|
2438
|
+
}, _callee23, this, [[1, 7]]);
|
|
2207
2439
|
}));
|
|
2208
|
-
function onCustomerLogin(
|
|
2440
|
+
function onCustomerLogin(_x15) {
|
|
2209
2441
|
return _onCustomerLogin.apply(this, arguments);
|
|
2210
2442
|
}
|
|
2211
2443
|
return onCustomerLogin;
|
|
2212
|
-
}()
|
|
2444
|
+
}() /** 宿主退出登录或以匿名身份重新进入时,清理客户资产并恢复匿名价格。 */
|
|
2213
2445
|
}, {
|
|
2214
|
-
key: "
|
|
2215
|
-
value: function
|
|
2446
|
+
key: "onCustomerLogout",
|
|
2447
|
+
value: (function () {
|
|
2448
|
+
var _onCustomerLogout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2449
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2450
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2451
|
+
case 0:
|
|
2452
|
+
_context24.next = 2;
|
|
2453
|
+
return this.refreshOrderMarketingForCustomer({
|
|
2454
|
+
customerId: null
|
|
2455
|
+
});
|
|
2456
|
+
case 2:
|
|
2457
|
+
case "end":
|
|
2458
|
+
return _context24.stop();
|
|
2459
|
+
}
|
|
2460
|
+
}, _callee24, this);
|
|
2461
|
+
}));
|
|
2462
|
+
function onCustomerLogout() {
|
|
2463
|
+
return _onCustomerLogout.apply(this, arguments);
|
|
2464
|
+
}
|
|
2465
|
+
return onCustomerLogout;
|
|
2466
|
+
}())
|
|
2467
|
+
}, {
|
|
2468
|
+
key: "recalculateOrderPricesFromSmartPricing",
|
|
2469
|
+
value: function recalculateOrderPricesFromSmartPricing() {
|
|
2216
2470
|
var _tempOrder$products,
|
|
2217
|
-
|
|
2218
|
-
if (!this.store.order
|
|
2471
|
+
_this12 = this;
|
|
2472
|
+
if (!this.store.order) return;
|
|
2219
2473
|
var tempOrder = this.store.order.getTempOrder();
|
|
2220
2474
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
|
|
2221
2475
|
var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
@@ -2223,51 +2477,54 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2223
2477
|
_step13;
|
|
2224
2478
|
try {
|
|
2225
2479
|
var _loop4 = function _loop4() {
|
|
2226
|
-
var _product$
|
|
2480
|
+
var _product$metadata2;
|
|
2227
2481
|
var product = _step13.value;
|
|
2228
|
-
if ((_product$
|
|
2229
|
-
var mappings =
|
|
2482
|
+
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
2483
|
+
var mappings = _this12.resourceProductMap.get(product.metadata.resource_id);
|
|
2230
2484
|
if (!mappings || !mappings.length) return 0; // continue
|
|
2231
2485
|
var mapping = mappings.find(function (m) {
|
|
2232
2486
|
return Number(m.productId) === Number(product.product_id);
|
|
2233
2487
|
}) || mappings[0];
|
|
2234
2488
|
if (!mapping) return 0; // continue
|
|
2235
|
-
var slots = expandMergedSlotToIndividual(product,
|
|
2489
|
+
var slots = expandMergedSlotToIndividual(product, _this12.store.slotConfig.slotDurationMinutes);
|
|
2236
2490
|
var updatedSlots = slots.map(function (slot) {
|
|
2237
|
-
var
|
|
2491
|
+
var slotStart = dayjs(slot.startTime);
|
|
2492
|
+
var date = slotStart.format('YYYY-MM-DD');
|
|
2493
|
+
var previousDate = slotStart.subtract(1, 'day').format('YYYY-MM-DD');
|
|
2494
|
+
var previousConfig = _this12.resolveSlotConfigForDate(previousDate);
|
|
2495
|
+
if (isBusinessHoursCrossDay(previousConfig) && slotStart.format('HH:mm') < previousConfig.businessStartTime) {
|
|
2496
|
+
date = previousDate;
|
|
2497
|
+
}
|
|
2498
|
+
var slotPriceMap = _this12.buildSlotPriceMapForDate(date, _this12.resolveSlotConfigForDate(date), [mapping.productId]);
|
|
2238
2499
|
return _objectSpread(_objectSpread({}, slot), {}, {
|
|
2239
2500
|
productId: mapping.productId,
|
|
2240
|
-
price: (
|
|
2501
|
+
price: getSlotPriceFromMap({
|
|
2502
|
+
slotPriceMap: slotPriceMap,
|
|
2241
2503
|
productId: mapping.productId,
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
})
|
|
2504
|
+
slotStartTime: slot.startTime,
|
|
2505
|
+
fallbackPrice: mapping.price
|
|
2506
|
+
})
|
|
2245
2507
|
});
|
|
2246
2508
|
});
|
|
2247
2509
|
var merged = mergeConsecutiveSlots(updatedSlots);
|
|
2248
2510
|
if (merged.length === 1) {
|
|
2249
|
-
|
|
2250
|
-
product.selling_price = merged[0].totalPrice;
|
|
2251
|
-
product.original_price = merged[0].totalPrice;
|
|
2511
|
+
_this12.resetProductPriceForSmartPricing(product, merged[0].totalPrice);
|
|
2252
2512
|
product.metadata.price_breakdown = buildPriceBreakdown({
|
|
2253
2513
|
group: merged[0],
|
|
2254
|
-
productId: mapping.productId
|
|
2255
|
-
quotation: _this11.store.quotation,
|
|
2256
|
-
channel: (_this11$otherParams2 = _this11.otherParams) === null || _this11$otherParams2 === void 0 ? void 0 : _this11$otherParams2.channel
|
|
2514
|
+
productId: mapping.productId
|
|
2257
2515
|
});
|
|
2258
2516
|
}
|
|
2259
2517
|
} else if (product.product_id != null) {
|
|
2260
|
-
var _product$product_vari,
|
|
2261
|
-
var
|
|
2518
|
+
var _product$product_vari, _product$metadata$sou, _product$metadata3;
|
|
2519
|
+
var price = getPriceForProductAtDatetime({
|
|
2520
|
+
products: _this12.smartPricingProductCatalog,
|
|
2521
|
+
context: _this12.buildSmartPricingContext(),
|
|
2262
2522
|
productId: product.product_id,
|
|
2263
2523
|
variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
|
|
2264
2524
|
datetime: now,
|
|
2265
|
-
|
|
2525
|
+
fallbackPrice: (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : product.original_price
|
|
2266
2526
|
});
|
|
2267
|
-
|
|
2268
|
-
product.selling_price = quotationPrice;
|
|
2269
|
-
product.original_price = quotationPrice;
|
|
2270
|
-
}
|
|
2527
|
+
_this12.resetProductPriceForSmartPricing(product, price);
|
|
2271
2528
|
}
|
|
2272
2529
|
},
|
|
2273
2530
|
_ret;
|
|
@@ -2281,33 +2538,54 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2281
2538
|
_iterator13.f();
|
|
2282
2539
|
}
|
|
2283
2540
|
}
|
|
2541
|
+
}, {
|
|
2542
|
+
key: "resetProductPriceForSmartPricing",
|
|
2543
|
+
value: function resetProductPriceForSmartPricing(product, price) {
|
|
2544
|
+
var mainPrice = new Decimal(price).plus(sumOptionUnitPrice(getProductSkuOptions(product))).toFixed(2);
|
|
2545
|
+
product.metadata = _objectSpread(_objectSpread({}, product.metadata), {}, {
|
|
2546
|
+
source_product_price: price,
|
|
2547
|
+
main_product_original_price: mainPrice,
|
|
2548
|
+
main_product_selling_price: mainPrice,
|
|
2549
|
+
price_schema_version: 2
|
|
2550
|
+
});
|
|
2551
|
+
product.discount_list = [];
|
|
2552
|
+
product.selling_price = composeLinePrice({
|
|
2553
|
+
mainPrice: mainPrice,
|
|
2554
|
+
bundle: product.product_bundle
|
|
2555
|
+
});
|
|
2556
|
+
product.original_price = composeLinePrice({
|
|
2557
|
+
mainPrice: mainPrice,
|
|
2558
|
+
bundle: product.product_bundle,
|
|
2559
|
+
useOriginalBundle: true
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2284
2562
|
}, {
|
|
2285
2563
|
key: "scanCode",
|
|
2286
2564
|
value: function () {
|
|
2287
|
-
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2565
|
+
var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(code, customerId) {
|
|
2288
2566
|
var result;
|
|
2289
|
-
return _regeneratorRuntime().wrap(function
|
|
2290
|
-
while (1) switch (
|
|
2567
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2568
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2291
2569
|
case 0:
|
|
2292
2570
|
this.logMethodStart('scanCode', {
|
|
2293
2571
|
code: code
|
|
2294
2572
|
});
|
|
2295
|
-
|
|
2573
|
+
_context25.prev = 1;
|
|
2296
2574
|
if (this.store.order) {
|
|
2297
|
-
|
|
2575
|
+
_context25.next = 4;
|
|
2298
2576
|
break;
|
|
2299
2577
|
}
|
|
2300
2578
|
throw new Error('order 模块未初始化');
|
|
2301
2579
|
case 4:
|
|
2302
|
-
|
|
2580
|
+
_context25.next = 6;
|
|
2303
2581
|
return this.store.order.scanCode(code, customerId);
|
|
2304
2582
|
case 6:
|
|
2305
|
-
result =
|
|
2583
|
+
result = _context25.sent;
|
|
2306
2584
|
if (!result.isAvailable) {
|
|
2307
|
-
|
|
2585
|
+
_context25.next = 11;
|
|
2308
2586
|
break;
|
|
2309
2587
|
}
|
|
2310
|
-
|
|
2588
|
+
_context25.next = 10;
|
|
2311
2589
|
return this.store.order.recalculateSummary({
|
|
2312
2590
|
createIfMissing: true
|
|
2313
2591
|
});
|
|
@@ -2317,19 +2595,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2317
2595
|
this.logMethodSuccess('scanCode', {
|
|
2318
2596
|
isAvailable: result.isAvailable
|
|
2319
2597
|
});
|
|
2320
|
-
return
|
|
2598
|
+
return _context25.abrupt("return", result);
|
|
2321
2599
|
case 15:
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
this.logMethodError('scanCode',
|
|
2325
|
-
throw
|
|
2600
|
+
_context25.prev = 15;
|
|
2601
|
+
_context25.t0 = _context25["catch"](1);
|
|
2602
|
+
this.logMethodError('scanCode', _context25.t0);
|
|
2603
|
+
throw _context25.t0;
|
|
2326
2604
|
case 19:
|
|
2327
2605
|
case "end":
|
|
2328
|
-
return
|
|
2606
|
+
return _context25.stop();
|
|
2329
2607
|
}
|
|
2330
|
-
},
|
|
2608
|
+
}, _callee25, this, [[1, 15]]);
|
|
2331
2609
|
}));
|
|
2332
|
-
function scanCode(
|
|
2610
|
+
function scanCode(_x16, _x17) {
|
|
2333
2611
|
return _scanCode.apply(this, arguments);
|
|
2334
2612
|
}
|
|
2335
2613
|
return scanCode;
|
|
@@ -2345,15 +2623,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2345
2623
|
}, {
|
|
2346
2624
|
key: "setDiscountSelected",
|
|
2347
2625
|
value: (function () {
|
|
2348
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2349
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _origin, _product$metadata$
|
|
2350
|
-
return _regeneratorRuntime().wrap(function
|
|
2351
|
-
while (1) switch (
|
|
2626
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2627
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _origin, _product$metadata$sou2, _product$metadata4, _product$metadata5, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2628
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2629
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2352
2630
|
case 0:
|
|
2353
2631
|
this.logMethodStart('setDiscountSelected', params);
|
|
2354
|
-
|
|
2632
|
+
_context26.prev = 1;
|
|
2355
2633
|
if (this.store.order) {
|
|
2356
|
-
|
|
2634
|
+
_context26.next = 4;
|
|
2357
2635
|
break;
|
|
2358
2636
|
}
|
|
2359
2637
|
throw new Error('order 模块未初始化');
|
|
@@ -2379,7 +2657,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2379
2657
|
form_record_id: tempOrder.holder.form_record_id
|
|
2380
2658
|
}] : [];
|
|
2381
2659
|
nextDiscountList = updated;
|
|
2382
|
-
|
|
2660
|
+
_context26.next = 16;
|
|
2383
2661
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2384
2662
|
case 16:
|
|
2385
2663
|
if (rulesModule) {
|
|
@@ -2431,26 +2709,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2431
2709
|
// 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
|
|
2432
2710
|
// 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
|
|
2433
2711
|
_iterator15 = _createForOfIteratorHelper(tempOrder.products);
|
|
2434
|
-
|
|
2712
|
+
_context26.prev = 19;
|
|
2435
2713
|
_iterator15.s();
|
|
2436
2714
|
case 21:
|
|
2437
2715
|
if ((_step15 = _iterator15.n()).done) {
|
|
2438
|
-
|
|
2716
|
+
_context26.next = 38;
|
|
2439
2717
|
break;
|
|
2440
2718
|
}
|
|
2441
2719
|
product = _step15.value;
|
|
2442
2720
|
if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
|
|
2443
|
-
|
|
2721
|
+
_context26.next = 25;
|
|
2444
2722
|
break;
|
|
2445
2723
|
}
|
|
2446
|
-
return
|
|
2724
|
+
return _context26.abrupt("continue", 36);
|
|
2447
2725
|
case 25:
|
|
2448
2726
|
if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
|
|
2449
|
-
|
|
2727
|
+
_context26.next = 28;
|
|
2450
2728
|
break;
|
|
2451
2729
|
}
|
|
2452
2730
|
product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
|
|
2453
|
-
return
|
|
2731
|
+
return _context26.abrupt("continue", 36);
|
|
2454
2732
|
case 28:
|
|
2455
2733
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2456
2734
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
@@ -2465,7 +2743,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2465
2743
|
return sum + (pd.amount || 0);
|
|
2466
2744
|
}, 0);
|
|
2467
2745
|
optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
2468
|
-
sourcePrice = (_product$metadata$
|
|
2746
|
+
sourcePrice = (_product$metadata$sou2 = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou2 !== void 0 ? _product$metadata$sou2 : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
2469
2747
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2470
2748
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2471
2749
|
if (product.metadata) {
|
|
@@ -2477,22 +2755,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2477
2755
|
bundle: product.product_bundle
|
|
2478
2756
|
});
|
|
2479
2757
|
case 36:
|
|
2480
|
-
|
|
2758
|
+
_context26.next = 21;
|
|
2481
2759
|
break;
|
|
2482
2760
|
case 38:
|
|
2483
|
-
|
|
2761
|
+
_context26.next = 43;
|
|
2484
2762
|
break;
|
|
2485
2763
|
case 40:
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
_iterator15.e(
|
|
2764
|
+
_context26.prev = 40;
|
|
2765
|
+
_context26.t0 = _context26["catch"](19);
|
|
2766
|
+
_iterator15.e(_context26.t0);
|
|
2489
2767
|
case 43:
|
|
2490
|
-
|
|
2768
|
+
_context26.prev = 43;
|
|
2491
2769
|
_iterator15.f();
|
|
2492
|
-
return
|
|
2770
|
+
return _context26.finish(43);
|
|
2493
2771
|
case 46:
|
|
2494
2772
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2495
|
-
|
|
2773
|
+
_context26.next = 49;
|
|
2496
2774
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2497
2775
|
case 49:
|
|
2498
2776
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
@@ -2501,7 +2779,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2501
2779
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2502
2780
|
return d.id === params.discountId;
|
|
2503
2781
|
}) || null;
|
|
2504
|
-
|
|
2782
|
+
_context26.next = 53;
|
|
2505
2783
|
return this.store.order.recalculateSummary({
|
|
2506
2784
|
createIfMissing: true
|
|
2507
2785
|
});
|
|
@@ -2513,19 +2791,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2513
2791
|
finalTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2514
2792
|
return d.id === params.discountId;
|
|
2515
2793
|
}) || null;
|
|
2516
|
-
return
|
|
2794
|
+
return _context26.abrupt("return", this.store.order.getDiscountList());
|
|
2517
2795
|
case 61:
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
this.logMethodError('setDiscountSelected',
|
|
2521
|
-
throw
|
|
2796
|
+
_context26.prev = 61;
|
|
2797
|
+
_context26.t1 = _context26["catch"](1);
|
|
2798
|
+
this.logMethodError('setDiscountSelected', _context26.t1);
|
|
2799
|
+
throw _context26.t1;
|
|
2522
2800
|
case 65:
|
|
2523
2801
|
case "end":
|
|
2524
|
-
return
|
|
2802
|
+
return _context26.stop();
|
|
2525
2803
|
}
|
|
2526
|
-
},
|
|
2804
|
+
}, _callee26, this, [[1, 61], [19, 40, 43, 46]]);
|
|
2527
2805
|
}));
|
|
2528
|
-
function setDiscountSelected(
|
|
2806
|
+
function setDiscountSelected(_x18) {
|
|
2529
2807
|
return _setDiscountSelected.apply(this, arguments);
|
|
2530
2808
|
}
|
|
2531
2809
|
return setDiscountSelected;
|
|
@@ -2533,37 +2811,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2533
2811
|
}, {
|
|
2534
2812
|
key: "addNewOrder",
|
|
2535
2813
|
value: function () {
|
|
2536
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2814
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2537
2815
|
var tempOrder;
|
|
2538
|
-
return _regeneratorRuntime().wrap(function
|
|
2539
|
-
while (1) switch (
|
|
2816
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2817
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2540
2818
|
case 0:
|
|
2541
2819
|
this.logMethodStart('addNewOrder');
|
|
2542
|
-
|
|
2820
|
+
_context27.prev = 1;
|
|
2543
2821
|
if (this.store.order) {
|
|
2544
|
-
|
|
2822
|
+
_context27.next = 4;
|
|
2545
2823
|
break;
|
|
2546
2824
|
}
|
|
2547
2825
|
throw new Error('order 模块未初始化');
|
|
2548
2826
|
case 4:
|
|
2549
|
-
|
|
2827
|
+
_context27.next = 6;
|
|
2550
2828
|
return this.store.order.addNewOrder();
|
|
2551
2829
|
case 6:
|
|
2552
|
-
tempOrder =
|
|
2830
|
+
tempOrder = _context27.sent;
|
|
2553
2831
|
this.logMethodSuccess('addNewOrder', {
|
|
2554
2832
|
productCount: tempOrder.products.length
|
|
2555
2833
|
});
|
|
2556
|
-
return
|
|
2834
|
+
return _context27.abrupt("return", tempOrder);
|
|
2557
2835
|
case 11:
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
this.logMethodError('addNewOrder',
|
|
2561
|
-
throw
|
|
2836
|
+
_context27.prev = 11;
|
|
2837
|
+
_context27.t0 = _context27["catch"](1);
|
|
2838
|
+
this.logMethodError('addNewOrder', _context27.t0);
|
|
2839
|
+
throw _context27.t0;
|
|
2562
2840
|
case 15:
|
|
2563
2841
|
case "end":
|
|
2564
|
-
return
|
|
2842
|
+
return _context27.stop();
|
|
2565
2843
|
}
|
|
2566
|
-
},
|
|
2844
|
+
}, _callee27, this, [[1, 11]]);
|
|
2567
2845
|
}));
|
|
2568
2846
|
function addNewOrder() {
|
|
2569
2847
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -2580,37 +2858,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2580
2858
|
}, {
|
|
2581
2859
|
key: "getSummary",
|
|
2582
2860
|
value: function () {
|
|
2583
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2861
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2584
2862
|
var summary;
|
|
2585
|
-
return _regeneratorRuntime().wrap(function
|
|
2586
|
-
while (1) switch (
|
|
2863
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2864
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2587
2865
|
case 0:
|
|
2588
2866
|
this.logMethodStart('getSummary');
|
|
2589
|
-
|
|
2867
|
+
_context28.prev = 1;
|
|
2590
2868
|
if (this.store.order) {
|
|
2591
|
-
|
|
2869
|
+
_context28.next = 4;
|
|
2592
2870
|
break;
|
|
2593
2871
|
}
|
|
2594
2872
|
throw new Error('order 模块未初始化');
|
|
2595
2873
|
case 4:
|
|
2596
|
-
|
|
2874
|
+
_context28.next = 6;
|
|
2597
2875
|
return this.store.order.getOrderSummary();
|
|
2598
2876
|
case 6:
|
|
2599
|
-
summary =
|
|
2877
|
+
summary = _context28.sent;
|
|
2600
2878
|
this.logMethodSuccess('getSummary', {
|
|
2601
2879
|
totalAmount: summary.total_amount
|
|
2602
2880
|
});
|
|
2603
|
-
return
|
|
2881
|
+
return _context28.abrupt("return", summary);
|
|
2604
2882
|
case 11:
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
this.logMethodError('getSummary',
|
|
2608
|
-
throw
|
|
2883
|
+
_context28.prev = 11;
|
|
2884
|
+
_context28.t0 = _context28["catch"](1);
|
|
2885
|
+
this.logMethodError('getSummary', _context28.t0);
|
|
2886
|
+
throw _context28.t0;
|
|
2609
2887
|
case 15:
|
|
2610
2888
|
case "end":
|
|
2611
|
-
return
|
|
2889
|
+
return _context28.stop();
|
|
2612
2890
|
}
|
|
2613
|
-
},
|
|
2891
|
+
}, _callee28, this, [[1, 11]]);
|
|
2614
2892
|
}));
|
|
2615
2893
|
function getSummary() {
|
|
2616
2894
|
return _getSummary.apply(this, arguments);
|
|
@@ -2620,47 +2898,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2620
2898
|
}, {
|
|
2621
2899
|
key: "submitOrder",
|
|
2622
2900
|
value: function () {
|
|
2623
|
-
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2624
|
-
var _this$
|
|
2625
|
-
return _regeneratorRuntime().wrap(function
|
|
2626
|
-
while (1) switch (
|
|
2901
|
+
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2902
|
+
var _this$otherParams22, _this$otherParams23, _this$otherParams24, _this$otherParams25, _tempOrder$products2, result, tempOrder;
|
|
2903
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2904
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2627
2905
|
case 0:
|
|
2628
2906
|
this.logMethodStart('submitOrder');
|
|
2629
|
-
|
|
2630
|
-
|
|
2907
|
+
_context29.prev = 1;
|
|
2908
|
+
_context29.next = 4;
|
|
2631
2909
|
return this.validateBeforeSubmitByItemRule();
|
|
2632
2910
|
case 4:
|
|
2633
2911
|
if (this.store.order) {
|
|
2634
|
-
|
|
2912
|
+
_context29.next = 6;
|
|
2635
2913
|
break;
|
|
2636
2914
|
}
|
|
2637
2915
|
throw new Error('venueBooking解决方案需要 order 模块支持');
|
|
2638
2916
|
case 6:
|
|
2639
|
-
|
|
2917
|
+
_context29.next = 8;
|
|
2640
2918
|
return this.store.order.submitTempOrder({
|
|
2641
2919
|
cacheId: this.cacheId,
|
|
2642
|
-
platform: (_this$
|
|
2643
|
-
businessCode: (_this$
|
|
2644
|
-
channel: (_this$
|
|
2645
|
-
type: (_this$
|
|
2920
|
+
platform: (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.platform,
|
|
2921
|
+
businessCode: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.businessCode,
|
|
2922
|
+
channel: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.channel,
|
|
2923
|
+
type: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.type
|
|
2646
2924
|
});
|
|
2647
2925
|
case 8:
|
|
2648
|
-
result =
|
|
2926
|
+
result = _context29.sent;
|
|
2649
2927
|
tempOrder = this.store.order.getTempOrder();
|
|
2650
2928
|
this.logMethodSuccess('submitOrder', {
|
|
2651
2929
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
|
|
2652
2930
|
});
|
|
2653
|
-
return
|
|
2931
|
+
return _context29.abrupt("return", result);
|
|
2654
2932
|
case 14:
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
this.logMethodError('submitOrder',
|
|
2658
|
-
throw
|
|
2933
|
+
_context29.prev = 14;
|
|
2934
|
+
_context29.t0 = _context29["catch"](1);
|
|
2935
|
+
this.logMethodError('submitOrder', _context29.t0);
|
|
2936
|
+
throw _context29.t0;
|
|
2659
2937
|
case 18:
|
|
2660
2938
|
case "end":
|
|
2661
|
-
return
|
|
2939
|
+
return _context29.stop();
|
|
2662
2940
|
}
|
|
2663
|
-
},
|
|
2941
|
+
}, _callee29, this, [[1, 14]]);
|
|
2664
2942
|
}));
|
|
2665
2943
|
function submitOrder() {
|
|
2666
2944
|
return _submitOrder.apply(this, arguments);
|
|
@@ -2670,62 +2948,59 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2670
2948
|
}, {
|
|
2671
2949
|
key: "addProductToOrder",
|
|
2672
2950
|
value: function () {
|
|
2673
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2674
|
-
var _product$metadata6, _product$product_vari2,
|
|
2675
|
-
return _regeneratorRuntime().wrap(function
|
|
2676
|
-
while (1) switch (
|
|
2951
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(product) {
|
|
2952
|
+
var _product$metadata6, _product$product_vari2, _product$metadata$sou3, _product$metadata7, price, products;
|
|
2953
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2954
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2677
2955
|
case 0:
|
|
2678
2956
|
this.logMethodStart('addProductToOrder', {
|
|
2679
2957
|
product_id: product.product_id,
|
|
2680
2958
|
product_variant_id: product.product_variant_id
|
|
2681
2959
|
});
|
|
2682
|
-
|
|
2960
|
+
_context30.prev = 1;
|
|
2683
2961
|
if (this.store.order) {
|
|
2684
|
-
|
|
2962
|
+
_context30.next = 4;
|
|
2685
2963
|
break;
|
|
2686
2964
|
}
|
|
2687
2965
|
throw new Error('order 模块未初始化');
|
|
2688
2966
|
case 4:
|
|
2689
|
-
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) &&
|
|
2690
|
-
|
|
2967
|
+
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && product.product_id != null) {
|
|
2968
|
+
price = getPriceForProductAtDatetime({
|
|
2969
|
+
products: this.smartPricingProductCatalog,
|
|
2970
|
+
context: this.buildSmartPricingContext(),
|
|
2691
2971
|
productId: product.product_id,
|
|
2692
2972
|
variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
|
|
2693
2973
|
datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
2694
|
-
|
|
2974
|
+
fallbackPrice: (_product$metadata$sou3 = (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.source_product_price) !== null && _product$metadata$sou3 !== void 0 ? _product$metadata$sou3 : product.selling_price
|
|
2695
2975
|
});
|
|
2696
|
-
|
|
2697
|
-
product.selling_price = quotationPrice;
|
|
2698
|
-
product.original_price = quotationPrice;
|
|
2699
|
-
} else if (product.selling_price != null) {
|
|
2700
|
-
product.original_price = product.selling_price;
|
|
2701
|
-
}
|
|
2976
|
+
this.resetProductPriceForSmartPricing(product, price);
|
|
2702
2977
|
}
|
|
2703
|
-
|
|
2978
|
+
_context30.next = 7;
|
|
2704
2979
|
return this.store.order.addProductToOrder(product);
|
|
2705
2980
|
case 7:
|
|
2706
|
-
products =
|
|
2707
|
-
|
|
2981
|
+
products = _context30.sent;
|
|
2982
|
+
_context30.next = 10;
|
|
2708
2983
|
return this.refreshItemRuleQuantityLimits();
|
|
2709
2984
|
case 10:
|
|
2710
|
-
|
|
2985
|
+
_context30.next = 12;
|
|
2711
2986
|
return this.refreshCartValidationPassed();
|
|
2712
2987
|
case 12:
|
|
2713
2988
|
this.logMethodSuccess('addProductToOrder', {
|
|
2714
2989
|
productCount: products.length
|
|
2715
2990
|
});
|
|
2716
|
-
return
|
|
2991
|
+
return _context30.abrupt("return", products);
|
|
2717
2992
|
case 16:
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
this.logMethodError('addProductToOrder',
|
|
2721
|
-
throw
|
|
2993
|
+
_context30.prev = 16;
|
|
2994
|
+
_context30.t0 = _context30["catch"](1);
|
|
2995
|
+
this.logMethodError('addProductToOrder', _context30.t0);
|
|
2996
|
+
throw _context30.t0;
|
|
2722
2997
|
case 20:
|
|
2723
2998
|
case "end":
|
|
2724
|
-
return
|
|
2999
|
+
return _context30.stop();
|
|
2725
3000
|
}
|
|
2726
|
-
},
|
|
3001
|
+
}, _callee30, this, [[1, 16]]);
|
|
2727
3002
|
}));
|
|
2728
|
-
function addProductToOrder(
|
|
3003
|
+
function addProductToOrder(_x19) {
|
|
2729
3004
|
return _addProductToOrder.apply(this, arguments);
|
|
2730
3005
|
}
|
|
2731
3006
|
return addProductToOrder;
|
|
@@ -2733,48 +3008,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2733
3008
|
}, {
|
|
2734
3009
|
key: "updateOrderProduct",
|
|
2735
3010
|
value: function () {
|
|
2736
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3011
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2737
3012
|
var products;
|
|
2738
|
-
return _regeneratorRuntime().wrap(function
|
|
2739
|
-
while (1) switch (
|
|
3013
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3014
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2740
3015
|
case 0:
|
|
2741
3016
|
this.logMethodStart('updateOrderProduct', {
|
|
2742
3017
|
product_id: params.product_id,
|
|
2743
3018
|
product_variant_id: params.product_variant_id
|
|
2744
3019
|
});
|
|
2745
|
-
|
|
3020
|
+
_context31.prev = 1;
|
|
2746
3021
|
if (this.store.order) {
|
|
2747
|
-
|
|
3022
|
+
_context31.next = 4;
|
|
2748
3023
|
break;
|
|
2749
3024
|
}
|
|
2750
3025
|
throw new Error('order 模块未初始化');
|
|
2751
3026
|
case 4:
|
|
2752
|
-
|
|
3027
|
+
_context31.next = 6;
|
|
2753
3028
|
return this.store.order.updateOrderProduct(params);
|
|
2754
3029
|
case 6:
|
|
2755
|
-
products =
|
|
2756
|
-
|
|
3030
|
+
products = _context31.sent;
|
|
3031
|
+
_context31.next = 9;
|
|
2757
3032
|
return this.refreshItemRuleQuantityLimits();
|
|
2758
3033
|
case 9:
|
|
2759
|
-
|
|
3034
|
+
_context31.next = 11;
|
|
2760
3035
|
return this.refreshCartValidationPassed();
|
|
2761
3036
|
case 11:
|
|
2762
3037
|
this.logMethodSuccess('updateOrderProduct', {
|
|
2763
3038
|
productCount: products.length
|
|
2764
3039
|
});
|
|
2765
|
-
return
|
|
3040
|
+
return _context31.abrupt("return", products);
|
|
2766
3041
|
case 15:
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
this.logMethodError('updateOrderProduct',
|
|
2770
|
-
throw
|
|
3042
|
+
_context31.prev = 15;
|
|
3043
|
+
_context31.t0 = _context31["catch"](1);
|
|
3044
|
+
this.logMethodError('updateOrderProduct', _context31.t0);
|
|
3045
|
+
throw _context31.t0;
|
|
2771
3046
|
case 19:
|
|
2772
3047
|
case "end":
|
|
2773
|
-
return
|
|
3048
|
+
return _context31.stop();
|
|
2774
3049
|
}
|
|
2775
|
-
},
|
|
3050
|
+
}, _callee31, this, [[1, 15]]);
|
|
2776
3051
|
}));
|
|
2777
|
-
function updateOrderProduct(
|
|
3052
|
+
function updateOrderProduct(_x20) {
|
|
2778
3053
|
return _updateOrderProduct.apply(this, arguments);
|
|
2779
3054
|
}
|
|
2780
3055
|
return updateOrderProduct;
|
|
@@ -2782,67 +3057,68 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2782
3057
|
}, {
|
|
2783
3058
|
key: "removeProductFromOrder",
|
|
2784
3059
|
value: function () {
|
|
2785
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2786
|
-
var _this$store$order$get3, _this$store$
|
|
2787
|
-
return _regeneratorRuntime().wrap(function
|
|
2788
|
-
while (1) switch (
|
|
3060
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(identity) {
|
|
3061
|
+
var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata8, _product$metadata9, product, productUid, beforeBookingCount, _this$store$order$per, _this$store$order11;
|
|
3062
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3063
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2789
3064
|
case 0:
|
|
2790
3065
|
this.logMethodStart('removeProductFromOrder', {
|
|
2791
3066
|
product_id: identity.product_id,
|
|
2792
3067
|
product_variant_id: identity.product_variant_id
|
|
2793
3068
|
});
|
|
2794
|
-
|
|
3069
|
+
_context32.prev = 1;
|
|
2795
3070
|
if (this.store.order) {
|
|
2796
|
-
|
|
3071
|
+
_context32.next = 4;
|
|
2797
3072
|
break;
|
|
2798
3073
|
}
|
|
2799
3074
|
throw new Error('order 模块未初始化');
|
|
2800
3075
|
case 4:
|
|
2801
|
-
tempOrder = ((_this$store$order$get3 = (_this$store$
|
|
2802
|
-
|
|
3076
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order9 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9)) || ((_this$store$order$ens = (_this$store$order10 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order10));
|
|
3077
|
+
_context32.next = 7;
|
|
2803
3078
|
return this.store.order.removeProductFromOrder(identity);
|
|
2804
3079
|
case 7:
|
|
2805
|
-
products =
|
|
3080
|
+
products = _context32.sent;
|
|
2806
3081
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2807
|
-
|
|
3082
|
+
_context32.next = 34;
|
|
2808
3083
|
break;
|
|
2809
3084
|
}
|
|
2810
3085
|
venueProductUids = new Set();
|
|
2811
3086
|
venueBookingUids = new Set();
|
|
2812
3087
|
_iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2813
|
-
|
|
3088
|
+
_context32.prev = 12;
|
|
2814
3089
|
_iterator16.s();
|
|
2815
3090
|
case 14:
|
|
2816
3091
|
if ((_step16 = _iterator16.n()).done) {
|
|
2817
|
-
|
|
3092
|
+
_context32.next = 23;
|
|
2818
3093
|
break;
|
|
2819
3094
|
}
|
|
2820
3095
|
product = _step16.value;
|
|
2821
|
-
if (product !== null && product !== void 0 && (_product$
|
|
2822
|
-
|
|
3096
|
+
if (product !== null && product !== void 0 && (_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.venue_booking) {
|
|
3097
|
+
_context32.next = 18;
|
|
2823
3098
|
break;
|
|
2824
3099
|
}
|
|
2825
|
-
return
|
|
3100
|
+
return _context32.abrupt("continue", 21);
|
|
2826
3101
|
case 18:
|
|
2827
|
-
|
|
2828
|
-
if (
|
|
3102
|
+
productUid = getOrderProductLineUid(product);
|
|
3103
|
+
if (productUid) venueProductUids.add(productUid);
|
|
3104
|
+
if ((_product$metadata9 = product.metadata) !== null && _product$metadata9 !== void 0 && _product$metadata9.booking_uid) {
|
|
2829
3105
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2830
3106
|
}
|
|
2831
|
-
case
|
|
2832
|
-
|
|
3107
|
+
case 21:
|
|
3108
|
+
_context32.next = 14;
|
|
2833
3109
|
break;
|
|
2834
|
-
case
|
|
2835
|
-
|
|
3110
|
+
case 23:
|
|
3111
|
+
_context32.next = 28;
|
|
2836
3112
|
break;
|
|
2837
|
-
case
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
_iterator16.e(
|
|
2841
|
-
case
|
|
2842
|
-
|
|
3113
|
+
case 25:
|
|
3114
|
+
_context32.prev = 25;
|
|
3115
|
+
_context32.t0 = _context32["catch"](12);
|
|
3116
|
+
_iterator16.e(_context32.t0);
|
|
3117
|
+
case 28:
|
|
3118
|
+
_context32.prev = 28;
|
|
2843
3119
|
_iterator16.f();
|
|
2844
|
-
return
|
|
2845
|
-
case
|
|
3120
|
+
return _context32.finish(28);
|
|
3121
|
+
case 31:
|
|
2846
3122
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2847
3123
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2848
3124
|
var _booking$metadata, _booking$metadata2;
|
|
@@ -2855,31 +3131,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2855
3131
|
return true;
|
|
2856
3132
|
});
|
|
2857
3133
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2858
|
-
(_this$store$order$per = (_this$store$
|
|
3134
|
+
(_this$store$order$per = (_this$store$order11 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order11);
|
|
2859
3135
|
}
|
|
2860
|
-
case
|
|
2861
|
-
|
|
3136
|
+
case 34:
|
|
3137
|
+
_context32.next = 36;
|
|
2862
3138
|
return this.refreshItemRuleQuantityLimits();
|
|
2863
|
-
case
|
|
2864
|
-
|
|
3139
|
+
case 36:
|
|
3140
|
+
_context32.next = 38;
|
|
2865
3141
|
return this.refreshCartValidationPassed();
|
|
2866
|
-
case
|
|
3142
|
+
case 38:
|
|
2867
3143
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2868
3144
|
productCount: products.length
|
|
2869
3145
|
});
|
|
2870
|
-
return
|
|
2871
|
-
case
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
this.logMethodError('removeProductFromOrder',
|
|
2875
|
-
throw
|
|
2876
|
-
case
|
|
3146
|
+
return _context32.abrupt("return", products);
|
|
3147
|
+
case 42:
|
|
3148
|
+
_context32.prev = 42;
|
|
3149
|
+
_context32.t1 = _context32["catch"](1);
|
|
3150
|
+
this.logMethodError('removeProductFromOrder', _context32.t1);
|
|
3151
|
+
throw _context32.t1;
|
|
3152
|
+
case 46:
|
|
2877
3153
|
case "end":
|
|
2878
|
-
return
|
|
3154
|
+
return _context32.stop();
|
|
2879
3155
|
}
|
|
2880
|
-
},
|
|
3156
|
+
}, _callee32, this, [[1, 42], [12, 25, 28, 31]]);
|
|
2881
3157
|
}));
|
|
2882
|
-
function removeProductFromOrder(
|
|
3158
|
+
function removeProductFromOrder(_x21) {
|
|
2883
3159
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2884
3160
|
}
|
|
2885
3161
|
return removeProductFromOrder;
|
|
@@ -2887,27 +3163,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2887
3163
|
}, {
|
|
2888
3164
|
key: "getProductList",
|
|
2889
3165
|
value: function () {
|
|
2890
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3166
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2891
3167
|
var result;
|
|
2892
|
-
return _regeneratorRuntime().wrap(function
|
|
2893
|
-
while (1) switch (
|
|
3168
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3169
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2894
3170
|
case 0:
|
|
2895
3171
|
if (!this.productsLoaded) {
|
|
2896
|
-
|
|
3172
|
+
_context33.next = 2;
|
|
2897
3173
|
break;
|
|
2898
3174
|
}
|
|
2899
|
-
return
|
|
3175
|
+
return _context33.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2900
3176
|
case 2:
|
|
2901
|
-
|
|
3177
|
+
_context33.next = 4;
|
|
2902
3178
|
return this.loadAllProducts();
|
|
2903
3179
|
case 4:
|
|
2904
|
-
result =
|
|
2905
|
-
return
|
|
3180
|
+
result = _context33.sent;
|
|
3181
|
+
return _context33.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2906
3182
|
case 6:
|
|
2907
3183
|
case "end":
|
|
2908
|
-
return
|
|
3184
|
+
return _context33.stop();
|
|
2909
3185
|
}
|
|
2910
|
-
},
|
|
3186
|
+
}, _callee33, this);
|
|
2911
3187
|
}));
|
|
2912
3188
|
function getProductList() {
|
|
2913
3189
|
return _getProductList.apply(this, arguments);
|
|
@@ -2917,13 +3193,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2917
3193
|
}, {
|
|
2918
3194
|
key: "loadOpenDataConfig",
|
|
2919
3195
|
value: function () {
|
|
2920
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3196
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2921
3197
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2922
|
-
return _regeneratorRuntime().wrap(function
|
|
2923
|
-
while (1) switch (
|
|
3198
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3199
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2924
3200
|
case 0:
|
|
2925
3201
|
if (this.store.openData) {
|
|
2926
|
-
|
|
3202
|
+
_context34.next = 2;
|
|
2927
3203
|
break;
|
|
2928
3204
|
}
|
|
2929
3205
|
throw new Error('openData 模块未初始化');
|
|
@@ -2931,42 +3207,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2931
3207
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2932
3208
|
cachedData = this.store.openData.getOpenData();
|
|
2933
3209
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2934
|
-
|
|
3210
|
+
_context34.next = 7;
|
|
2935
3211
|
break;
|
|
2936
3212
|
}
|
|
2937
3213
|
this.otherParams.openData = cachedData;
|
|
2938
|
-
return
|
|
3214
|
+
return _context34.abrupt("return", cachedData);
|
|
2939
3215
|
case 7:
|
|
2940
3216
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2941
|
-
|
|
3217
|
+
_context34.next = 11;
|
|
2942
3218
|
break;
|
|
2943
3219
|
}
|
|
2944
|
-
|
|
3220
|
+
_context34.next = 10;
|
|
2945
3221
|
return this.loadOpenDataConfigInFlight;
|
|
2946
3222
|
case 10:
|
|
2947
|
-
return
|
|
3223
|
+
return _context34.abrupt("return", _context34.sent);
|
|
2948
3224
|
case 11:
|
|
2949
3225
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2950
3226
|
scope: 'board',
|
|
2951
3227
|
target: 'venue_booking+online_store',
|
|
2952
3228
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2953
3229
|
});
|
|
2954
|
-
|
|
2955
|
-
|
|
3230
|
+
_context34.prev = 12;
|
|
3231
|
+
_context34.next = 15;
|
|
2956
3232
|
return this.loadOpenDataConfigInFlight;
|
|
2957
3233
|
case 15:
|
|
2958
|
-
openDataConfig =
|
|
3234
|
+
openDataConfig = _context34.sent;
|
|
2959
3235
|
this.otherParams.openData = openDataConfig;
|
|
2960
|
-
return
|
|
3236
|
+
return _context34.abrupt("return", openDataConfig);
|
|
2961
3237
|
case 18:
|
|
2962
|
-
|
|
3238
|
+
_context34.prev = 18;
|
|
2963
3239
|
this.loadOpenDataConfigInFlight = null;
|
|
2964
|
-
return
|
|
3240
|
+
return _context34.finish(18);
|
|
2965
3241
|
case 21:
|
|
2966
3242
|
case "end":
|
|
2967
|
-
return
|
|
3243
|
+
return _context34.stop();
|
|
2968
3244
|
}
|
|
2969
|
-
},
|
|
3245
|
+
}, _callee34, this, [[12,, 18, 21]]);
|
|
2970
3246
|
}));
|
|
2971
3247
|
function loadOpenDataConfig() {
|
|
2972
3248
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2976,29 +3252,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2976
3252
|
}, {
|
|
2977
3253
|
key: "loadRuntimeConfigs",
|
|
2978
3254
|
value: function () {
|
|
2979
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3255
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2980
3256
|
var itemRuleConfigs;
|
|
2981
|
-
return _regeneratorRuntime().wrap(function
|
|
2982
|
-
while (1) switch (
|
|
3257
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3258
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2983
3259
|
case 0:
|
|
2984
|
-
|
|
3260
|
+
_context35.next = 2;
|
|
2985
3261
|
return this.loadOpenDataConfig();
|
|
2986
3262
|
case 2:
|
|
2987
|
-
|
|
3263
|
+
_context35.next = 4;
|
|
2988
3264
|
return this.ensureItemRuleConfigsLoaded();
|
|
2989
3265
|
case 4:
|
|
2990
|
-
itemRuleConfigs =
|
|
3266
|
+
itemRuleConfigs = _context35.sent;
|
|
2991
3267
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2992
3268
|
itemRuleCount: itemRuleConfigs.length
|
|
2993
3269
|
});
|
|
2994
|
-
return
|
|
3270
|
+
return _context35.abrupt("return", {
|
|
2995
3271
|
itemRuleConfigs: itemRuleConfigs
|
|
2996
3272
|
});
|
|
2997
3273
|
case 7:
|
|
2998
3274
|
case "end":
|
|
2999
|
-
return
|
|
3275
|
+
return _context35.stop();
|
|
3000
3276
|
}
|
|
3001
|
-
},
|
|
3277
|
+
}, _callee35, this);
|
|
3002
3278
|
}));
|
|
3003
3279
|
function loadRuntimeConfigs() {
|
|
3004
3280
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -3008,22 +3284,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3008
3284
|
}, {
|
|
3009
3285
|
key: "fetchItemRuleConfigsByModelIds",
|
|
3010
3286
|
value: function () {
|
|
3011
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3287
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(strategyModelIds) {
|
|
3012
3288
|
var result, configs;
|
|
3013
|
-
return _regeneratorRuntime().wrap(function
|
|
3014
|
-
while (1) switch (
|
|
3289
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3290
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3015
3291
|
case 0:
|
|
3016
3292
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3017
3293
|
strategyModelIds: strategyModelIds
|
|
3018
3294
|
});
|
|
3019
3295
|
if (strategyModelIds.length) {
|
|
3020
|
-
|
|
3296
|
+
_context36.next = 3;
|
|
3021
3297
|
break;
|
|
3022
3298
|
}
|
|
3023
|
-
return
|
|
3299
|
+
return _context36.abrupt("return", []);
|
|
3024
3300
|
case 3:
|
|
3025
|
-
|
|
3026
|
-
|
|
3301
|
+
_context36.prev = 3;
|
|
3302
|
+
_context36.next = 6;
|
|
3027
3303
|
return this.request.get('/promotion', {
|
|
3028
3304
|
skip: 1,
|
|
3029
3305
|
num: 99,
|
|
@@ -3031,7 +3307,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3031
3307
|
ids: strategyModelIds
|
|
3032
3308
|
});
|
|
3033
3309
|
case 6:
|
|
3034
|
-
result =
|
|
3310
|
+
result = _context36.sent;
|
|
3035
3311
|
configs = [];
|
|
3036
3312
|
if (result.code === 200) {
|
|
3037
3313
|
configs = result.data.list.map(function (item) {
|
|
@@ -3042,21 +3318,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3042
3318
|
strategyModelIds: strategyModelIds,
|
|
3043
3319
|
strategyCount: configs.length
|
|
3044
3320
|
});
|
|
3045
|
-
return
|
|
3321
|
+
return _context36.abrupt("return", configs);
|
|
3046
3322
|
case 13:
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
3323
|
+
_context36.prev = 13;
|
|
3324
|
+
_context36.t0 = _context36["catch"](3);
|
|
3325
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context36.t0, {
|
|
3050
3326
|
strategyModelIds: strategyModelIds
|
|
3051
3327
|
});
|
|
3052
|
-
return
|
|
3328
|
+
return _context36.abrupt("return", []);
|
|
3053
3329
|
case 17:
|
|
3054
3330
|
case "end":
|
|
3055
|
-
return
|
|
3331
|
+
return _context36.stop();
|
|
3056
3332
|
}
|
|
3057
|
-
},
|
|
3333
|
+
}, _callee36, this, [[3, 13]]);
|
|
3058
3334
|
}));
|
|
3059
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3335
|
+
function fetchItemRuleConfigsByModelIds(_x22) {
|
|
3060
3336
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
3061
3337
|
}
|
|
3062
3338
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -3064,22 +3340,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3064
3340
|
}, {
|
|
3065
3341
|
key: "buildPrefillProductSourceMap",
|
|
3066
3342
|
value: function () {
|
|
3067
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3343
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3068
3344
|
var sourceMap, productList, visited, collectFromValue;
|
|
3069
|
-
return _regeneratorRuntime().wrap(function
|
|
3070
|
-
while (1) switch (
|
|
3345
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3346
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3071
3347
|
case 0:
|
|
3072
3348
|
sourceMap = new Map();
|
|
3073
|
-
|
|
3074
|
-
|
|
3349
|
+
_context37.prev = 1;
|
|
3350
|
+
_context37.next = 4;
|
|
3075
3351
|
return this.getProductList();
|
|
3076
3352
|
case 4:
|
|
3077
|
-
productList =
|
|
3353
|
+
productList = _context37.sent;
|
|
3078
3354
|
if (Array.isArray(productList)) {
|
|
3079
|
-
|
|
3355
|
+
_context37.next = 7;
|
|
3080
3356
|
break;
|
|
3081
3357
|
}
|
|
3082
|
-
return
|
|
3358
|
+
return _context37.abrupt("return", sourceMap);
|
|
3083
3359
|
case 7:
|
|
3084
3360
|
visited = new Set();
|
|
3085
3361
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3106,31 +3382,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3106
3382
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
3107
3383
|
var productId = Number(rawProductId);
|
|
3108
3384
|
if (Number.isFinite(productId) && productId > 0) {
|
|
3109
|
-
var
|
|
3110
|
-
var productVariantId = Number((
|
|
3385
|
+
var _ref10, _node$product_variant;
|
|
3386
|
+
var productVariantId = Number((_ref10 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref10 !== void 0 ? _ref10 : 0);
|
|
3111
3387
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
3112
3388
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
3113
3389
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
3114
3390
|
}
|
|
3115
|
-
for (var
|
|
3116
|
-
var childValue = _Object$values[
|
|
3391
|
+
for (var _i5 = 0, _Object$values = Object.values(node); _i5 < _Object$values.length; _i5++) {
|
|
3392
|
+
var childValue = _Object$values[_i5];
|
|
3117
3393
|
if (childValue && _typeof(childValue) === 'object') collectFromValue(childValue);
|
|
3118
3394
|
}
|
|
3119
3395
|
};
|
|
3120
3396
|
collectFromValue(productList);
|
|
3121
|
-
|
|
3397
|
+
_context37.next = 15;
|
|
3122
3398
|
break;
|
|
3123
3399
|
case 12:
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3400
|
+
_context37.prev = 12;
|
|
3401
|
+
_context37.t0 = _context37["catch"](1);
|
|
3402
|
+
this.logMethodError('buildPrefillProductSourceMap', _context37.t0);
|
|
3127
3403
|
case 15:
|
|
3128
|
-
return
|
|
3404
|
+
return _context37.abrupt("return", sourceMap);
|
|
3129
3405
|
case 16:
|
|
3130
3406
|
case "end":
|
|
3131
|
-
return
|
|
3407
|
+
return _context37.stop();
|
|
3132
3408
|
}
|
|
3133
|
-
},
|
|
3409
|
+
}, _callee37, this, [[1, 12]]);
|
|
3134
3410
|
}));
|
|
3135
3411
|
function buildPrefillProductSourceMap() {
|
|
3136
3412
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3140,65 +3416,65 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3140
3416
|
}, {
|
|
3141
3417
|
key: "getItemRuleRuntimeConfig",
|
|
3142
3418
|
value: function getItemRuleRuntimeConfig() {
|
|
3143
|
-
var
|
|
3419
|
+
var _ref11, _runtimeConfig$channe, _runtimeConfig$custom, _this$otherParams26;
|
|
3144
3420
|
var runtimeConfig = this.itemRuleRuntimeConfig || {};
|
|
3145
3421
|
return _objectSpread(_objectSpread({}, runtimeConfig), {}, {
|
|
3146
|
-
channel: (
|
|
3422
|
+
channel: (_ref11 = (_runtimeConfig$channe = runtimeConfig.channel) !== null && _runtimeConfig$channe !== void 0 ? _runtimeConfig$channe : (_runtimeConfig$custom = runtimeConfig.custom) === null || _runtimeConfig$custom === void 0 ? void 0 : _runtimeConfig$custom.channel) !== null && _ref11 !== void 0 ? _ref11 : (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.channel
|
|
3147
3423
|
});
|
|
3148
3424
|
}
|
|
3149
3425
|
}, {
|
|
3150
3426
|
key: "ensureItemRuleConfigsLoaded",
|
|
3151
3427
|
value: function () {
|
|
3152
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3153
|
-
var
|
|
3154
|
-
return _regeneratorRuntime().wrap(function
|
|
3155
|
-
while (1) switch (
|
|
3428
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3429
|
+
var _this13 = this;
|
|
3430
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3431
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3156
3432
|
case 0:
|
|
3157
3433
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3158
|
-
|
|
3434
|
+
_context39.next = 2;
|
|
3159
3435
|
break;
|
|
3160
3436
|
}
|
|
3161
|
-
return
|
|
3437
|
+
return _context39.abrupt("return", this.itemRuleConfigs);
|
|
3162
3438
|
case 2:
|
|
3163
3439
|
if (!this.itemRuleConfigsPromise) {
|
|
3164
|
-
|
|
3440
|
+
_context39.next = 4;
|
|
3165
3441
|
break;
|
|
3166
3442
|
}
|
|
3167
|
-
return
|
|
3443
|
+
return _context39.abrupt("return", this.itemRuleConfigsPromise);
|
|
3168
3444
|
case 4:
|
|
3169
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3445
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3170
3446
|
var runtimeConfig, staticConfigs;
|
|
3171
|
-
return _regeneratorRuntime().wrap(function
|
|
3172
|
-
while (1) switch (
|
|
3447
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3448
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3173
3449
|
case 0:
|
|
3174
|
-
runtimeConfig =
|
|
3450
|
+
runtimeConfig = _this13.getItemRuleRuntimeConfig();
|
|
3175
3451
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3176
3452
|
if (!(staticConfigs.length > 0)) {
|
|
3177
|
-
|
|
3453
|
+
_context38.next = 6;
|
|
3178
3454
|
break;
|
|
3179
3455
|
}
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
return
|
|
3456
|
+
_this13.itemRuleConfigs = staticConfigs;
|
|
3457
|
+
_this13.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3458
|
+
return _context38.abrupt("return", _this13.itemRuleConfigs);
|
|
3183
3459
|
case 6:
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
return
|
|
3460
|
+
_this13.itemRuleConfigs = [];
|
|
3461
|
+
_this13.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3462
|
+
return _context38.abrupt("return", _this13.itemRuleConfigs);
|
|
3187
3463
|
case 9:
|
|
3188
3464
|
case "end":
|
|
3189
|
-
return
|
|
3465
|
+
return _context38.stop();
|
|
3190
3466
|
}
|
|
3191
|
-
},
|
|
3467
|
+
}, _callee38);
|
|
3192
3468
|
}))();
|
|
3193
|
-
|
|
3469
|
+
_context39.next = 7;
|
|
3194
3470
|
return this.itemRuleConfigsPromise;
|
|
3195
3471
|
case 7:
|
|
3196
|
-
return
|
|
3472
|
+
return _context39.abrupt("return", _context39.sent);
|
|
3197
3473
|
case 8:
|
|
3198
3474
|
case "end":
|
|
3199
|
-
return
|
|
3475
|
+
return _context39.stop();
|
|
3200
3476
|
}
|
|
3201
|
-
},
|
|
3477
|
+
}, _callee39, this);
|
|
3202
3478
|
}));
|
|
3203
3479
|
function ensureItemRuleConfigsLoaded() {
|
|
3204
3480
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3208,22 +3484,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3208
3484
|
}, {
|
|
3209
3485
|
key: "refreshItemRuleQuantityLimits",
|
|
3210
3486
|
value: function () {
|
|
3211
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3487
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3212
3488
|
var strategyConfigs, businessData, limits;
|
|
3213
|
-
return _regeneratorRuntime().wrap(function
|
|
3214
|
-
while (1) switch (
|
|
3489
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3490
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3215
3491
|
case 0:
|
|
3216
|
-
|
|
3217
|
-
|
|
3492
|
+
_context40.prev = 0;
|
|
3493
|
+
_context40.next = 3;
|
|
3218
3494
|
return this.ensureItemRuleConfigsLoaded();
|
|
3219
3495
|
case 3:
|
|
3220
|
-
strategyConfigs =
|
|
3496
|
+
strategyConfigs = _context40.sent;
|
|
3221
3497
|
if (strategyConfigs.length) {
|
|
3222
|
-
|
|
3498
|
+
_context40.next = 7;
|
|
3223
3499
|
break;
|
|
3224
3500
|
}
|
|
3225
3501
|
this.store.itemRuleQuantityLimits = [];
|
|
3226
|
-
return
|
|
3502
|
+
return _context40.abrupt("return", []);
|
|
3227
3503
|
case 7:
|
|
3228
3504
|
businessData = buildItemRuleBusinessData({
|
|
3229
3505
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3235,18 +3511,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3235
3511
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3236
3512
|
limitCount: limits.length
|
|
3237
3513
|
});
|
|
3238
|
-
return
|
|
3514
|
+
return _context40.abrupt("return", limits);
|
|
3239
3515
|
case 14:
|
|
3240
|
-
|
|
3241
|
-
|
|
3516
|
+
_context40.prev = 14;
|
|
3517
|
+
_context40.t0 = _context40["catch"](0);
|
|
3242
3518
|
this.store.itemRuleQuantityLimits = [];
|
|
3243
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3244
|
-
return
|
|
3519
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context40.t0);
|
|
3520
|
+
return _context40.abrupt("return", []);
|
|
3245
3521
|
case 19:
|
|
3246
3522
|
case "end":
|
|
3247
|
-
return
|
|
3523
|
+
return _context40.stop();
|
|
3248
3524
|
}
|
|
3249
|
-
},
|
|
3525
|
+
}, _callee40, this, [[0, 14]]);
|
|
3250
3526
|
}));
|
|
3251
3527
|
function refreshItemRuleQuantityLimits() {
|
|
3252
3528
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3256,32 +3532,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3256
3532
|
}, {
|
|
3257
3533
|
key: "applyPrefillByItemRule",
|
|
3258
3534
|
value: function () {
|
|
3259
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3260
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price,
|
|
3261
|
-
return _regeneratorRuntime().wrap(function
|
|
3262
|
-
while (1) switch (
|
|
3535
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3536
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _productUid;
|
|
3537
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3538
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3263
3539
|
case 0:
|
|
3264
3540
|
if (!this.itemRulePrefillApplied) {
|
|
3265
|
-
|
|
3541
|
+
_context41.next = 2;
|
|
3266
3542
|
break;
|
|
3267
3543
|
}
|
|
3268
|
-
return
|
|
3544
|
+
return _context41.abrupt("return");
|
|
3269
3545
|
case 2:
|
|
3270
3546
|
if (this.store.order) {
|
|
3271
|
-
|
|
3547
|
+
_context41.next = 4;
|
|
3272
3548
|
break;
|
|
3273
3549
|
}
|
|
3274
|
-
return
|
|
3550
|
+
return _context41.abrupt("return");
|
|
3275
3551
|
case 4:
|
|
3276
|
-
|
|
3552
|
+
_context41.next = 6;
|
|
3277
3553
|
return this.ensureItemRuleConfigsLoaded();
|
|
3278
3554
|
case 6:
|
|
3279
|
-
strategyConfigs =
|
|
3555
|
+
strategyConfigs = _context41.sent;
|
|
3280
3556
|
if (strategyConfigs.length) {
|
|
3281
|
-
|
|
3557
|
+
_context41.next = 9;
|
|
3282
3558
|
break;
|
|
3283
3559
|
}
|
|
3284
|
-
return
|
|
3560
|
+
return _context41.abrupt("return");
|
|
3285
3561
|
case 9:
|
|
3286
3562
|
businessData = buildItemRuleBusinessData({
|
|
3287
3563
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3290,24 +3566,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3290
3566
|
});
|
|
3291
3567
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3292
3568
|
if (prefillItems.length) {
|
|
3293
|
-
|
|
3569
|
+
_context41.next = 14;
|
|
3294
3570
|
break;
|
|
3295
3571
|
}
|
|
3296
3572
|
this.itemRulePrefillApplied = true;
|
|
3297
|
-
return
|
|
3573
|
+
return _context41.abrupt("return");
|
|
3298
3574
|
case 14:
|
|
3299
|
-
|
|
3575
|
+
_context41.next = 16;
|
|
3300
3576
|
return this.buildPrefillProductSourceMap();
|
|
3301
3577
|
case 16:
|
|
3302
|
-
productSourceMap =
|
|
3578
|
+
productSourceMap = _context41.sent;
|
|
3303
3579
|
tempOrder = this.ensureVenueTempOrder();
|
|
3304
3580
|
hasChanges = false;
|
|
3305
3581
|
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3306
|
-
|
|
3582
|
+
_context41.prev = 20;
|
|
3307
3583
|
_iterator18.s();
|
|
3308
3584
|
case 22:
|
|
3309
3585
|
if ((_step18 = _iterator18.n()).done) {
|
|
3310
|
-
|
|
3586
|
+
_context41.next = 51;
|
|
3311
3587
|
break;
|
|
3312
3588
|
}
|
|
3313
3589
|
prefillItem = _step18.value;
|
|
@@ -3315,16 +3591,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3315
3591
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3316
3592
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3317
3593
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3318
|
-
|
|
3594
|
+
_context41.next = 29;
|
|
3319
3595
|
break;
|
|
3320
3596
|
}
|
|
3321
|
-
return
|
|
3597
|
+
return _context41.abrupt("continue", 49);
|
|
3322
3598
|
case 29:
|
|
3323
3599
|
if (!Number.isNaN(productVariantId)) {
|
|
3324
|
-
|
|
3600
|
+
_context41.next = 31;
|
|
3325
3601
|
break;
|
|
3326
3602
|
}
|
|
3327
|
-
return
|
|
3603
|
+
return _context41.abrupt("continue", 49);
|
|
3328
3604
|
case 31:
|
|
3329
3605
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3330
3606
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3332,7 +3608,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3332
3608
|
product_variant_id: productVariantId
|
|
3333
3609
|
});
|
|
3334
3610
|
if (!(productIndex === -1)) {
|
|
3335
|
-
|
|
3611
|
+
_context41.next = 42;
|
|
3336
3612
|
break;
|
|
3337
3613
|
}
|
|
3338
3614
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
@@ -3352,11 +3628,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3352
3628
|
},
|
|
3353
3629
|
_origin: origin
|
|
3354
3630
|
});
|
|
3355
|
-
productUid =
|
|
3631
|
+
productUid = getOrderProductLineUid(product) || '';
|
|
3356
3632
|
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3357
3633
|
tempOrder.products.push(product);
|
|
3358
3634
|
hasChanges = true;
|
|
3359
|
-
return
|
|
3635
|
+
return _context41.abrupt("continue", 49);
|
|
3360
3636
|
case 42:
|
|
3361
3637
|
targetProduct = tempOrder.products[productIndex];
|
|
3362
3638
|
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
@@ -3372,40 +3648,40 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3372
3648
|
})
|
|
3373
3649
|
});
|
|
3374
3650
|
if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
|
|
3375
|
-
_productUid =
|
|
3651
|
+
_productUid = getOrderProductLineUid(nextProduct) || '';
|
|
3376
3652
|
this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
|
|
3377
3653
|
tempOrder.products[productIndex] = nextProduct;
|
|
3378
3654
|
hasChanges = true;
|
|
3379
3655
|
}
|
|
3380
3656
|
case 49:
|
|
3381
|
-
|
|
3657
|
+
_context41.next = 22;
|
|
3382
3658
|
break;
|
|
3383
3659
|
case 51:
|
|
3384
|
-
|
|
3660
|
+
_context41.next = 56;
|
|
3385
3661
|
break;
|
|
3386
3662
|
case 53:
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
_iterator18.e(
|
|
3663
|
+
_context41.prev = 53;
|
|
3664
|
+
_context41.t0 = _context41["catch"](20);
|
|
3665
|
+
_iterator18.e(_context41.t0);
|
|
3390
3666
|
case 56:
|
|
3391
|
-
|
|
3667
|
+
_context41.prev = 56;
|
|
3392
3668
|
_iterator18.f();
|
|
3393
|
-
return
|
|
3669
|
+
return _context41.finish(56);
|
|
3394
3670
|
case 59:
|
|
3395
3671
|
if (!hasChanges) {
|
|
3396
|
-
|
|
3672
|
+
_context41.next = 64;
|
|
3397
3673
|
break;
|
|
3398
3674
|
}
|
|
3399
3675
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3400
3676
|
this.store.order.applyDiscount();
|
|
3401
|
-
|
|
3677
|
+
_context41.next = 63;
|
|
3402
3678
|
return this.store.order.recalculateSummary({
|
|
3403
3679
|
createIfMissing: true
|
|
3404
3680
|
});
|
|
3405
3681
|
case 63:
|
|
3406
3682
|
this.store.order.persistTempOrder();
|
|
3407
3683
|
case 64:
|
|
3408
|
-
|
|
3684
|
+
_context41.next = 66;
|
|
3409
3685
|
return this.refreshItemRuleQuantityLimits();
|
|
3410
3686
|
case 66:
|
|
3411
3687
|
this.itemRulePrefillApplied = true;
|
|
@@ -3415,9 +3691,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3415
3691
|
});
|
|
3416
3692
|
case 68:
|
|
3417
3693
|
case "end":
|
|
3418
|
-
return
|
|
3694
|
+
return _context41.stop();
|
|
3419
3695
|
}
|
|
3420
|
-
},
|
|
3696
|
+
}, _callee41, this, [[20, 53, 56, 59]]);
|
|
3421
3697
|
}));
|
|
3422
3698
|
function applyPrefillByItemRule() {
|
|
3423
3699
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3427,24 +3703,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3427
3703
|
}, {
|
|
3428
3704
|
key: "applyItemRulePrefill",
|
|
3429
3705
|
value: function () {
|
|
3430
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3431
|
-
return _regeneratorRuntime().wrap(function
|
|
3432
|
-
while (1) switch (
|
|
3706
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3707
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3708
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3433
3709
|
case 0:
|
|
3434
3710
|
this.logMethodStart('applyItemRulePrefill');
|
|
3435
|
-
|
|
3711
|
+
_context42.next = 3;
|
|
3436
3712
|
return this.applyPrefillByItemRule();
|
|
3437
3713
|
case 3:
|
|
3438
|
-
|
|
3714
|
+
_context42.next = 5;
|
|
3439
3715
|
return this.refreshItemRuleQuantityLimits();
|
|
3440
3716
|
case 5:
|
|
3441
|
-
|
|
3717
|
+
_context42.next = 7;
|
|
3442
3718
|
return this.refreshCartValidationPassed();
|
|
3443
3719
|
case 7:
|
|
3444
3720
|
case "end":
|
|
3445
|
-
return
|
|
3721
|
+
return _context42.stop();
|
|
3446
3722
|
}
|
|
3447
|
-
},
|
|
3723
|
+
}, _callee42, this);
|
|
3448
3724
|
}));
|
|
3449
3725
|
function applyItemRulePrefill() {
|
|
3450
3726
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3454,20 +3730,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3454
3730
|
}, {
|
|
3455
3731
|
key: "evaluateCartValidationByItemRule",
|
|
3456
3732
|
value: function () {
|
|
3457
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3733
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3458
3734
|
var strategyConfigs, businessData;
|
|
3459
|
-
return _regeneratorRuntime().wrap(function
|
|
3460
|
-
while (1) switch (
|
|
3735
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3736
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3461
3737
|
case 0:
|
|
3462
|
-
|
|
3738
|
+
_context43.next = 2;
|
|
3463
3739
|
return this.ensureItemRuleConfigsLoaded();
|
|
3464
3740
|
case 2:
|
|
3465
|
-
strategyConfigs =
|
|
3741
|
+
strategyConfigs = _context43.sent;
|
|
3466
3742
|
if (strategyConfigs.length) {
|
|
3467
|
-
|
|
3743
|
+
_context43.next = 5;
|
|
3468
3744
|
break;
|
|
3469
3745
|
}
|
|
3470
|
-
return
|
|
3746
|
+
return _context43.abrupt("return", {
|
|
3471
3747
|
passed: true,
|
|
3472
3748
|
failures: []
|
|
3473
3749
|
});
|
|
@@ -3477,12 +3753,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3477
3753
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3478
3754
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3479
3755
|
});
|
|
3480
|
-
return
|
|
3756
|
+
return _context43.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3481
3757
|
case 7:
|
|
3482
3758
|
case "end":
|
|
3483
|
-
return
|
|
3759
|
+
return _context43.stop();
|
|
3484
3760
|
}
|
|
3485
|
-
},
|
|
3761
|
+
}, _callee43, this);
|
|
3486
3762
|
}));
|
|
3487
3763
|
function evaluateCartValidationByItemRule() {
|
|
3488
3764
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3492,20 +3768,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3492
3768
|
}, {
|
|
3493
3769
|
key: "validateBeforeSubmitByItemRule",
|
|
3494
3770
|
value: function () {
|
|
3495
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3771
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3496
3772
|
var validationResult, firstFailure, errorMessage, error;
|
|
3497
|
-
return _regeneratorRuntime().wrap(function
|
|
3498
|
-
while (1) switch (
|
|
3773
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3774
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3499
3775
|
case 0:
|
|
3500
|
-
|
|
3776
|
+
_context44.next = 2;
|
|
3501
3777
|
return this.evaluateCartValidationByItemRule();
|
|
3502
3778
|
case 2:
|
|
3503
|
-
validationResult =
|
|
3779
|
+
validationResult = _context44.sent;
|
|
3504
3780
|
if (!validationResult.passed) {
|
|
3505
|
-
|
|
3781
|
+
_context44.next = 5;
|
|
3506
3782
|
break;
|
|
3507
3783
|
}
|
|
3508
|
-
return
|
|
3784
|
+
return _context44.abrupt("return");
|
|
3509
3785
|
case 5:
|
|
3510
3786
|
firstFailure = validationResult.failures[0];
|
|
3511
3787
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3514,9 +3790,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3514
3790
|
throw error;
|
|
3515
3791
|
case 10:
|
|
3516
3792
|
case "end":
|
|
3517
|
-
return
|
|
3793
|
+
return _context44.stop();
|
|
3518
3794
|
}
|
|
3519
|
-
},
|
|
3795
|
+
}, _callee44, this);
|
|
3520
3796
|
}));
|
|
3521
3797
|
function validateBeforeSubmitByItemRule() {
|
|
3522
3798
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3526,10 +3802,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3526
3802
|
}, {
|
|
3527
3803
|
key: "refreshCartValidationPassed",
|
|
3528
3804
|
value: function () {
|
|
3529
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3805
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3530
3806
|
var previous, nextState, validationResult, changed;
|
|
3531
|
-
return _regeneratorRuntime().wrap(function
|
|
3532
|
-
while (1) switch (
|
|
3807
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3808
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3533
3809
|
case 0:
|
|
3534
3810
|
previous = this.store.cartValidation || {
|
|
3535
3811
|
passed: null,
|
|
@@ -3539,20 +3815,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3539
3815
|
passed: null,
|
|
3540
3816
|
failures: []
|
|
3541
3817
|
};
|
|
3542
|
-
|
|
3543
|
-
|
|
3818
|
+
_context45.prev = 2;
|
|
3819
|
+
_context45.next = 5;
|
|
3544
3820
|
return this.evaluateCartValidationByItemRule();
|
|
3545
3821
|
case 5:
|
|
3546
|
-
validationResult =
|
|
3822
|
+
validationResult = _context45.sent;
|
|
3547
3823
|
nextState = {
|
|
3548
3824
|
passed: validationResult.passed,
|
|
3549
3825
|
failures: validationResult.failures || []
|
|
3550
3826
|
};
|
|
3551
|
-
|
|
3827
|
+
_context45.next = 12;
|
|
3552
3828
|
break;
|
|
3553
3829
|
case 9:
|
|
3554
|
-
|
|
3555
|
-
|
|
3830
|
+
_context45.prev = 9;
|
|
3831
|
+
_context45.t0 = _context45["catch"](2);
|
|
3556
3832
|
nextState = {
|
|
3557
3833
|
passed: false,
|
|
3558
3834
|
failures: []
|
|
@@ -3561,21 +3837,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3561
3837
|
this.store.cartValidation = nextState;
|
|
3562
3838
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3563
3839
|
if (!changed) {
|
|
3564
|
-
|
|
3840
|
+
_context45.next = 17;
|
|
3565
3841
|
break;
|
|
3566
3842
|
}
|
|
3567
|
-
|
|
3843
|
+
_context45.next = 17;
|
|
3568
3844
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3569
3845
|
cartValidation: nextState,
|
|
3570
3846
|
cartValidationPassed: nextState.passed
|
|
3571
3847
|
});
|
|
3572
3848
|
case 17:
|
|
3573
|
-
return
|
|
3849
|
+
return _context45.abrupt("return", nextState.passed);
|
|
3574
3850
|
case 18:
|
|
3575
3851
|
case "end":
|
|
3576
|
-
return
|
|
3852
|
+
return _context45.stop();
|
|
3577
3853
|
}
|
|
3578
|
-
},
|
|
3854
|
+
}, _callee45, this, [[2, 9]]);
|
|
3579
3855
|
}));
|
|
3580
3856
|
function refreshCartValidationPassed() {
|
|
3581
3857
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3585,14 +3861,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3585
3861
|
}, {
|
|
3586
3862
|
key: "setItemRuleRuntimeConfig",
|
|
3587
3863
|
value: function () {
|
|
3588
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3864
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3589
3865
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3590
3866
|
var config,
|
|
3591
|
-
|
|
3592
|
-
return _regeneratorRuntime().wrap(function
|
|
3593
|
-
while (1) switch (
|
|
3867
|
+
_args46 = arguments;
|
|
3868
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3869
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3594
3870
|
case 0:
|
|
3595
|
-
config =
|
|
3871
|
+
config = _args46.length > 0 && _args46[0] !== undefined ? _args46[0] : {};
|
|
3596
3872
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3597
3873
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3598
3874
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3604,10 +3880,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3604
3880
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3605
3881
|
}
|
|
3606
3882
|
this.itemRulePrefillApplied = false;
|
|
3607
|
-
|
|
3883
|
+
_context46.next = 7;
|
|
3608
3884
|
return this.refreshItemRuleQuantityLimits();
|
|
3609
3885
|
case 7:
|
|
3610
|
-
|
|
3886
|
+
_context46.next = 9;
|
|
3611
3887
|
return this.refreshCartValidationPassed();
|
|
3612
3888
|
case 9:
|
|
3613
3889
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3615,9 +3891,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3615
3891
|
});
|
|
3616
3892
|
case 10:
|
|
3617
3893
|
case "end":
|
|
3618
|
-
return
|
|
3894
|
+
return _context46.stop();
|
|
3619
3895
|
}
|
|
3620
|
-
},
|
|
3896
|
+
}, _callee46, this);
|
|
3621
3897
|
}));
|
|
3622
3898
|
function setItemRuleRuntimeConfig() {
|
|
3623
3899
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3651,7 +3927,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3651
3927
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3652
3928
|
var parsed = JSON.parse(raw);
|
|
3653
3929
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3654
|
-
} catch (
|
|
3930
|
+
} catch (_unused5) {
|
|
3655
3931
|
return {};
|
|
3656
3932
|
}
|
|
3657
3933
|
}
|
|
@@ -3738,30 +4014,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3738
4014
|
}, {
|
|
3739
4015
|
key: "refreshAllHolderFormRecords",
|
|
3740
4016
|
value: (function () {
|
|
3741
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4017
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
3742
4018
|
var _params$customer_id, _params$useCache;
|
|
3743
4019
|
var customer_id;
|
|
3744
|
-
return _regeneratorRuntime().wrap(function
|
|
3745
|
-
while (1) switch (
|
|
4020
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4021
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3746
4022
|
case 0:
|
|
3747
4023
|
if (this.store.holder) {
|
|
3748
|
-
|
|
4024
|
+
_context47.next = 2;
|
|
3749
4025
|
break;
|
|
3750
4026
|
}
|
|
3751
4027
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3752
4028
|
case 2:
|
|
3753
4029
|
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
3754
|
-
return
|
|
4030
|
+
return _context47.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3755
4031
|
customer_id: customer_id,
|
|
3756
4032
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3757
4033
|
})));
|
|
3758
4034
|
case 4:
|
|
3759
4035
|
case "end":
|
|
3760
|
-
return
|
|
4036
|
+
return _context47.stop();
|
|
3761
4037
|
}
|
|
3762
|
-
},
|
|
4038
|
+
}, _callee47, this);
|
|
3763
4039
|
}));
|
|
3764
|
-
function refreshAllHolderFormRecords(
|
|
4040
|
+
function refreshAllHolderFormRecords(_x23) {
|
|
3765
4041
|
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3766
4042
|
}
|
|
3767
4043
|
return refreshAllHolderFormRecords;
|
|
@@ -3781,25 +4057,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3781
4057
|
}, {
|
|
3782
4058
|
key: "checkOpenDataAvailability",
|
|
3783
4059
|
value: function () {
|
|
3784
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3785
|
-
return _regeneratorRuntime().wrap(function
|
|
3786
|
-
while (1) switch (
|
|
4060
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
4061
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4062
|
+
while (1) switch (_context48.prev = _context48.next) {
|
|
3787
4063
|
case 0:
|
|
3788
4064
|
if (this.store.openData) {
|
|
3789
|
-
|
|
4065
|
+
_context48.next = 2;
|
|
3790
4066
|
break;
|
|
3791
4067
|
}
|
|
3792
4068
|
throw new Error('openData 模块未初始化');
|
|
3793
4069
|
case 2:
|
|
3794
|
-
|
|
4070
|
+
_context48.next = 4;
|
|
3795
4071
|
return this.loadOpenDataConfig();
|
|
3796
4072
|
case 4:
|
|
3797
|
-
return
|
|
4073
|
+
return _context48.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3798
4074
|
case 5:
|
|
3799
4075
|
case "end":
|
|
3800
|
-
return
|
|
4076
|
+
return _context48.stop();
|
|
3801
4077
|
}
|
|
3802
|
-
},
|
|
4078
|
+
}, _callee48, this);
|
|
3803
4079
|
}));
|
|
3804
4080
|
function checkOpenDataAvailability() {
|
|
3805
4081
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3809,27 +4085,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3809
4085
|
}, {
|
|
3810
4086
|
key: "setOtherParams",
|
|
3811
4087
|
value: function () {
|
|
3812
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3813
|
-
var
|
|
3814
|
-
|
|
4088
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4089
|
+
var _ref13,
|
|
4090
|
+
_ref13$cover,
|
|
3815
4091
|
cover,
|
|
3816
|
-
|
|
3817
|
-
return _regeneratorRuntime().wrap(function
|
|
3818
|
-
while (1) switch (
|
|
4092
|
+
_args49 = arguments;
|
|
4093
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4094
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
3819
4095
|
case 0:
|
|
3820
|
-
|
|
4096
|
+
_ref13 = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {}, _ref13$cover = _ref13.cover, cover = _ref13$cover === void 0 ? false : _ref13$cover;
|
|
4097
|
+
this.slotPriceMapCache.clear();
|
|
3821
4098
|
if (cover) {
|
|
3822
4099
|
this.otherParams = params;
|
|
3823
4100
|
} else {
|
|
3824
4101
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3825
4102
|
}
|
|
3826
|
-
case
|
|
4103
|
+
case 3:
|
|
3827
4104
|
case "end":
|
|
3828
|
-
return
|
|
4105
|
+
return _context49.stop();
|
|
3829
4106
|
}
|
|
3830
|
-
},
|
|
4107
|
+
}, _callee49, this);
|
|
3831
4108
|
}));
|
|
3832
|
-
function setOtherParams(
|
|
4109
|
+
function setOtherParams(_x24) {
|
|
3833
4110
|
return _setOtherParams.apply(this, arguments);
|
|
3834
4111
|
}
|
|
3835
4112
|
return setOtherParams;
|