@pisell/pisellos 2.3.132 → 2.3.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/VenueBooking/index.d.ts +15 -2
- package/dist/solution/VenueBooking/index.js +1036 -760
- 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/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/VenueBooking/index.d.ts +15 -2
- package/lib/solution/VenueBooking/index.js +234 -88
- 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/package.json +1 -1
|
@@ -46,6 +46,7 @@ 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
51
|
import { composeLinePrice, createUuidV4, getOrderProductLineUid, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
51
52
|
import { OrderModule } from "../../modules/Order";
|
|
@@ -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
|
}
|
|
@@ -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 =
|
|
553
|
+
if (!(this.customerLoginRefreshInFlight && this.customerLoginRefreshIdInFlight === params.customerId)) {
|
|
554
|
+
_context6.next = 6;
|
|
550
555
|
break;
|
|
551
556
|
}
|
|
552
|
-
|
|
553
|
-
_context6.next = 7;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
_context6.next = 6;
|
|
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;
|
|
@@ -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) {
|
|
@@ -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
|
|
@@ -2024,12 +2251,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
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
|
+
}() /** 宿主退出登录或以匿名身份重新进入时,清理客户资产并恢复匿名价格。 */
|
|
2445
|
+
}, {
|
|
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
|
+
}())
|
|
2213
2467
|
}, {
|
|
2214
|
-
key: "
|
|
2215
|
-
value: function
|
|
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');
|
|
@@ -2226,48 +2480,51 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2226
2480
|
var _product$metadata2;
|
|
2227
2481
|
var product = _step13.value;
|
|
2228
2482
|
if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
|
|
2229
|
-
var mappings =
|
|
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$
|
|
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$
|
|
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,67 @@ 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
3102
|
productUid = getOrderProductLineUid(product);
|
|
2828
3103
|
if (productUid) venueProductUids.add(productUid);
|
|
2829
|
-
if ((_product$
|
|
3104
|
+
if ((_product$metadata9 = product.metadata) !== null && _product$metadata9 !== void 0 && _product$metadata9.booking_uid) {
|
|
2830
3105
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2831
3106
|
}
|
|
2832
3107
|
case 21:
|
|
2833
|
-
|
|
3108
|
+
_context32.next = 14;
|
|
2834
3109
|
break;
|
|
2835
3110
|
case 23:
|
|
2836
|
-
|
|
3111
|
+
_context32.next = 28;
|
|
2837
3112
|
break;
|
|
2838
3113
|
case 25:
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
_iterator16.e(
|
|
3114
|
+
_context32.prev = 25;
|
|
3115
|
+
_context32.t0 = _context32["catch"](12);
|
|
3116
|
+
_iterator16.e(_context32.t0);
|
|
2842
3117
|
case 28:
|
|
2843
|
-
|
|
3118
|
+
_context32.prev = 28;
|
|
2844
3119
|
_iterator16.f();
|
|
2845
|
-
return
|
|
3120
|
+
return _context32.finish(28);
|
|
2846
3121
|
case 31:
|
|
2847
3122
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2848
3123
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2856,31 +3131,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2856
3131
|
return true;
|
|
2857
3132
|
});
|
|
2858
3133
|
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2859
|
-
(_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);
|
|
2860
3135
|
}
|
|
2861
3136
|
case 34:
|
|
2862
|
-
|
|
3137
|
+
_context32.next = 36;
|
|
2863
3138
|
return this.refreshItemRuleQuantityLimits();
|
|
2864
3139
|
case 36:
|
|
2865
|
-
|
|
3140
|
+
_context32.next = 38;
|
|
2866
3141
|
return this.refreshCartValidationPassed();
|
|
2867
3142
|
case 38:
|
|
2868
3143
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2869
3144
|
productCount: products.length
|
|
2870
3145
|
});
|
|
2871
|
-
return
|
|
3146
|
+
return _context32.abrupt("return", products);
|
|
2872
3147
|
case 42:
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
this.logMethodError('removeProductFromOrder',
|
|
2876
|
-
throw
|
|
3148
|
+
_context32.prev = 42;
|
|
3149
|
+
_context32.t1 = _context32["catch"](1);
|
|
3150
|
+
this.logMethodError('removeProductFromOrder', _context32.t1);
|
|
3151
|
+
throw _context32.t1;
|
|
2877
3152
|
case 46:
|
|
2878
3153
|
case "end":
|
|
2879
|
-
return
|
|
3154
|
+
return _context32.stop();
|
|
2880
3155
|
}
|
|
2881
|
-
},
|
|
3156
|
+
}, _callee32, this, [[1, 42], [12, 25, 28, 31]]);
|
|
2882
3157
|
}));
|
|
2883
|
-
function removeProductFromOrder(
|
|
3158
|
+
function removeProductFromOrder(_x21) {
|
|
2884
3159
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2885
3160
|
}
|
|
2886
3161
|
return removeProductFromOrder;
|
|
@@ -2888,27 +3163,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2888
3163
|
}, {
|
|
2889
3164
|
key: "getProductList",
|
|
2890
3165
|
value: function () {
|
|
2891
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3166
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2892
3167
|
var result;
|
|
2893
|
-
return _regeneratorRuntime().wrap(function
|
|
2894
|
-
while (1) switch (
|
|
3168
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3169
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2895
3170
|
case 0:
|
|
2896
3171
|
if (!this.productsLoaded) {
|
|
2897
|
-
|
|
3172
|
+
_context33.next = 2;
|
|
2898
3173
|
break;
|
|
2899
3174
|
}
|
|
2900
|
-
return
|
|
3175
|
+
return _context33.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2901
3176
|
case 2:
|
|
2902
|
-
|
|
3177
|
+
_context33.next = 4;
|
|
2903
3178
|
return this.loadAllProducts();
|
|
2904
3179
|
case 4:
|
|
2905
|
-
result =
|
|
2906
|
-
return
|
|
3180
|
+
result = _context33.sent;
|
|
3181
|
+
return _context33.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2907
3182
|
case 6:
|
|
2908
3183
|
case "end":
|
|
2909
|
-
return
|
|
3184
|
+
return _context33.stop();
|
|
2910
3185
|
}
|
|
2911
|
-
},
|
|
3186
|
+
}, _callee33, this);
|
|
2912
3187
|
}));
|
|
2913
3188
|
function getProductList() {
|
|
2914
3189
|
return _getProductList.apply(this, arguments);
|
|
@@ -2918,13 +3193,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2918
3193
|
}, {
|
|
2919
3194
|
key: "loadOpenDataConfig",
|
|
2920
3195
|
value: function () {
|
|
2921
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3196
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
2922
3197
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2923
|
-
return _regeneratorRuntime().wrap(function
|
|
2924
|
-
while (1) switch (
|
|
3198
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3199
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2925
3200
|
case 0:
|
|
2926
3201
|
if (this.store.openData) {
|
|
2927
|
-
|
|
3202
|
+
_context34.next = 2;
|
|
2928
3203
|
break;
|
|
2929
3204
|
}
|
|
2930
3205
|
throw new Error('openData 模块未初始化');
|
|
@@ -2932,42 +3207,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2932
3207
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2933
3208
|
cachedData = this.store.openData.getOpenData();
|
|
2934
3209
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2935
|
-
|
|
3210
|
+
_context34.next = 7;
|
|
2936
3211
|
break;
|
|
2937
3212
|
}
|
|
2938
3213
|
this.otherParams.openData = cachedData;
|
|
2939
|
-
return
|
|
3214
|
+
return _context34.abrupt("return", cachedData);
|
|
2940
3215
|
case 7:
|
|
2941
3216
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2942
|
-
|
|
3217
|
+
_context34.next = 11;
|
|
2943
3218
|
break;
|
|
2944
3219
|
}
|
|
2945
|
-
|
|
3220
|
+
_context34.next = 10;
|
|
2946
3221
|
return this.loadOpenDataConfigInFlight;
|
|
2947
3222
|
case 10:
|
|
2948
|
-
return
|
|
3223
|
+
return _context34.abrupt("return", _context34.sent);
|
|
2949
3224
|
case 11:
|
|
2950
3225
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2951
3226
|
scope: 'board',
|
|
2952
3227
|
target: 'venue_booking+online_store',
|
|
2953
3228
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2954
3229
|
});
|
|
2955
|
-
|
|
2956
|
-
|
|
3230
|
+
_context34.prev = 12;
|
|
3231
|
+
_context34.next = 15;
|
|
2957
3232
|
return this.loadOpenDataConfigInFlight;
|
|
2958
3233
|
case 15:
|
|
2959
|
-
openDataConfig =
|
|
3234
|
+
openDataConfig = _context34.sent;
|
|
2960
3235
|
this.otherParams.openData = openDataConfig;
|
|
2961
|
-
return
|
|
3236
|
+
return _context34.abrupt("return", openDataConfig);
|
|
2962
3237
|
case 18:
|
|
2963
|
-
|
|
3238
|
+
_context34.prev = 18;
|
|
2964
3239
|
this.loadOpenDataConfigInFlight = null;
|
|
2965
|
-
return
|
|
3240
|
+
return _context34.finish(18);
|
|
2966
3241
|
case 21:
|
|
2967
3242
|
case "end":
|
|
2968
|
-
return
|
|
3243
|
+
return _context34.stop();
|
|
2969
3244
|
}
|
|
2970
|
-
},
|
|
3245
|
+
}, _callee34, this, [[12,, 18, 21]]);
|
|
2971
3246
|
}));
|
|
2972
3247
|
function loadOpenDataConfig() {
|
|
2973
3248
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2977,29 +3252,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2977
3252
|
}, {
|
|
2978
3253
|
key: "loadRuntimeConfigs",
|
|
2979
3254
|
value: function () {
|
|
2980
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3255
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
2981
3256
|
var itemRuleConfigs;
|
|
2982
|
-
return _regeneratorRuntime().wrap(function
|
|
2983
|
-
while (1) switch (
|
|
3257
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3258
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2984
3259
|
case 0:
|
|
2985
|
-
|
|
3260
|
+
_context35.next = 2;
|
|
2986
3261
|
return this.loadOpenDataConfig();
|
|
2987
3262
|
case 2:
|
|
2988
|
-
|
|
3263
|
+
_context35.next = 4;
|
|
2989
3264
|
return this.ensureItemRuleConfigsLoaded();
|
|
2990
3265
|
case 4:
|
|
2991
|
-
itemRuleConfigs =
|
|
3266
|
+
itemRuleConfigs = _context35.sent;
|
|
2992
3267
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2993
3268
|
itemRuleCount: itemRuleConfigs.length
|
|
2994
3269
|
});
|
|
2995
|
-
return
|
|
3270
|
+
return _context35.abrupt("return", {
|
|
2996
3271
|
itemRuleConfigs: itemRuleConfigs
|
|
2997
3272
|
});
|
|
2998
3273
|
case 7:
|
|
2999
3274
|
case "end":
|
|
3000
|
-
return
|
|
3275
|
+
return _context35.stop();
|
|
3001
3276
|
}
|
|
3002
|
-
},
|
|
3277
|
+
}, _callee35, this);
|
|
3003
3278
|
}));
|
|
3004
3279
|
function loadRuntimeConfigs() {
|
|
3005
3280
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -3009,22 +3284,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3009
3284
|
}, {
|
|
3010
3285
|
key: "fetchItemRuleConfigsByModelIds",
|
|
3011
3286
|
value: function () {
|
|
3012
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3287
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(strategyModelIds) {
|
|
3013
3288
|
var result, configs;
|
|
3014
|
-
return _regeneratorRuntime().wrap(function
|
|
3015
|
-
while (1) switch (
|
|
3289
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3290
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3016
3291
|
case 0:
|
|
3017
3292
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3018
3293
|
strategyModelIds: strategyModelIds
|
|
3019
3294
|
});
|
|
3020
3295
|
if (strategyModelIds.length) {
|
|
3021
|
-
|
|
3296
|
+
_context36.next = 3;
|
|
3022
3297
|
break;
|
|
3023
3298
|
}
|
|
3024
|
-
return
|
|
3299
|
+
return _context36.abrupt("return", []);
|
|
3025
3300
|
case 3:
|
|
3026
|
-
|
|
3027
|
-
|
|
3301
|
+
_context36.prev = 3;
|
|
3302
|
+
_context36.next = 6;
|
|
3028
3303
|
return this.request.get('/promotion', {
|
|
3029
3304
|
skip: 1,
|
|
3030
3305
|
num: 99,
|
|
@@ -3032,7 +3307,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3032
3307
|
ids: strategyModelIds
|
|
3033
3308
|
});
|
|
3034
3309
|
case 6:
|
|
3035
|
-
result =
|
|
3310
|
+
result = _context36.sent;
|
|
3036
3311
|
configs = [];
|
|
3037
3312
|
if (result.code === 200) {
|
|
3038
3313
|
configs = result.data.list.map(function (item) {
|
|
@@ -3043,21 +3318,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3043
3318
|
strategyModelIds: strategyModelIds,
|
|
3044
3319
|
strategyCount: configs.length
|
|
3045
3320
|
});
|
|
3046
|
-
return
|
|
3321
|
+
return _context36.abrupt("return", configs);
|
|
3047
3322
|
case 13:
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
3323
|
+
_context36.prev = 13;
|
|
3324
|
+
_context36.t0 = _context36["catch"](3);
|
|
3325
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context36.t0, {
|
|
3051
3326
|
strategyModelIds: strategyModelIds
|
|
3052
3327
|
});
|
|
3053
|
-
return
|
|
3328
|
+
return _context36.abrupt("return", []);
|
|
3054
3329
|
case 17:
|
|
3055
3330
|
case "end":
|
|
3056
|
-
return
|
|
3331
|
+
return _context36.stop();
|
|
3057
3332
|
}
|
|
3058
|
-
},
|
|
3333
|
+
}, _callee36, this, [[3, 13]]);
|
|
3059
3334
|
}));
|
|
3060
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3335
|
+
function fetchItemRuleConfigsByModelIds(_x22) {
|
|
3061
3336
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
3062
3337
|
}
|
|
3063
3338
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -3065,22 +3340,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3065
3340
|
}, {
|
|
3066
3341
|
key: "buildPrefillProductSourceMap",
|
|
3067
3342
|
value: function () {
|
|
3068
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3343
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3069
3344
|
var sourceMap, productList, visited, collectFromValue;
|
|
3070
|
-
return _regeneratorRuntime().wrap(function
|
|
3071
|
-
while (1) switch (
|
|
3345
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3346
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3072
3347
|
case 0:
|
|
3073
3348
|
sourceMap = new Map();
|
|
3074
|
-
|
|
3075
|
-
|
|
3349
|
+
_context37.prev = 1;
|
|
3350
|
+
_context37.next = 4;
|
|
3076
3351
|
return this.getProductList();
|
|
3077
3352
|
case 4:
|
|
3078
|
-
productList =
|
|
3353
|
+
productList = _context37.sent;
|
|
3079
3354
|
if (Array.isArray(productList)) {
|
|
3080
|
-
|
|
3355
|
+
_context37.next = 7;
|
|
3081
3356
|
break;
|
|
3082
3357
|
}
|
|
3083
|
-
return
|
|
3358
|
+
return _context37.abrupt("return", sourceMap);
|
|
3084
3359
|
case 7:
|
|
3085
3360
|
visited = new Set();
|
|
3086
3361
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3107,31 +3382,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3107
3382
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
3108
3383
|
var productId = Number(rawProductId);
|
|
3109
3384
|
if (Number.isFinite(productId) && productId > 0) {
|
|
3110
|
-
var
|
|
3111
|
-
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);
|
|
3112
3387
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
3113
3388
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
3114
3389
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
3115
3390
|
}
|
|
3116
|
-
for (var
|
|
3117
|
-
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];
|
|
3118
3393
|
if (childValue && _typeof(childValue) === 'object') collectFromValue(childValue);
|
|
3119
3394
|
}
|
|
3120
3395
|
};
|
|
3121
3396
|
collectFromValue(productList);
|
|
3122
|
-
|
|
3397
|
+
_context37.next = 15;
|
|
3123
3398
|
break;
|
|
3124
3399
|
case 12:
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3400
|
+
_context37.prev = 12;
|
|
3401
|
+
_context37.t0 = _context37["catch"](1);
|
|
3402
|
+
this.logMethodError('buildPrefillProductSourceMap', _context37.t0);
|
|
3128
3403
|
case 15:
|
|
3129
|
-
return
|
|
3404
|
+
return _context37.abrupt("return", sourceMap);
|
|
3130
3405
|
case 16:
|
|
3131
3406
|
case "end":
|
|
3132
|
-
return
|
|
3407
|
+
return _context37.stop();
|
|
3133
3408
|
}
|
|
3134
|
-
},
|
|
3409
|
+
}, _callee37, this, [[1, 12]]);
|
|
3135
3410
|
}));
|
|
3136
3411
|
function buildPrefillProductSourceMap() {
|
|
3137
3412
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3141,65 +3416,65 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3141
3416
|
}, {
|
|
3142
3417
|
key: "getItemRuleRuntimeConfig",
|
|
3143
3418
|
value: function getItemRuleRuntimeConfig() {
|
|
3144
|
-
var
|
|
3419
|
+
var _ref11, _runtimeConfig$channe, _runtimeConfig$custom, _this$otherParams26;
|
|
3145
3420
|
var runtimeConfig = this.itemRuleRuntimeConfig || {};
|
|
3146
3421
|
return _objectSpread(_objectSpread({}, runtimeConfig), {}, {
|
|
3147
|
-
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
|
|
3148
3423
|
});
|
|
3149
3424
|
}
|
|
3150
3425
|
}, {
|
|
3151
3426
|
key: "ensureItemRuleConfigsLoaded",
|
|
3152
3427
|
value: function () {
|
|
3153
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3154
|
-
var
|
|
3155
|
-
return _regeneratorRuntime().wrap(function
|
|
3156
|
-
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) {
|
|
3157
3432
|
case 0:
|
|
3158
3433
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3159
|
-
|
|
3434
|
+
_context39.next = 2;
|
|
3160
3435
|
break;
|
|
3161
3436
|
}
|
|
3162
|
-
return
|
|
3437
|
+
return _context39.abrupt("return", this.itemRuleConfigs);
|
|
3163
3438
|
case 2:
|
|
3164
3439
|
if (!this.itemRuleConfigsPromise) {
|
|
3165
|
-
|
|
3440
|
+
_context39.next = 4;
|
|
3166
3441
|
break;
|
|
3167
3442
|
}
|
|
3168
|
-
return
|
|
3443
|
+
return _context39.abrupt("return", this.itemRuleConfigsPromise);
|
|
3169
3444
|
case 4:
|
|
3170
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3445
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3171
3446
|
var runtimeConfig, staticConfigs;
|
|
3172
|
-
return _regeneratorRuntime().wrap(function
|
|
3173
|
-
while (1) switch (
|
|
3447
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3448
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3174
3449
|
case 0:
|
|
3175
|
-
runtimeConfig =
|
|
3450
|
+
runtimeConfig = _this13.getItemRuleRuntimeConfig();
|
|
3176
3451
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3177
3452
|
if (!(staticConfigs.length > 0)) {
|
|
3178
|
-
|
|
3453
|
+
_context38.next = 6;
|
|
3179
3454
|
break;
|
|
3180
3455
|
}
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
return
|
|
3456
|
+
_this13.itemRuleConfigs = staticConfigs;
|
|
3457
|
+
_this13.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3458
|
+
return _context38.abrupt("return", _this13.itemRuleConfigs);
|
|
3184
3459
|
case 6:
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
return
|
|
3460
|
+
_this13.itemRuleConfigs = [];
|
|
3461
|
+
_this13.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3462
|
+
return _context38.abrupt("return", _this13.itemRuleConfigs);
|
|
3188
3463
|
case 9:
|
|
3189
3464
|
case "end":
|
|
3190
|
-
return
|
|
3465
|
+
return _context38.stop();
|
|
3191
3466
|
}
|
|
3192
|
-
},
|
|
3467
|
+
}, _callee38);
|
|
3193
3468
|
}))();
|
|
3194
|
-
|
|
3469
|
+
_context39.next = 7;
|
|
3195
3470
|
return this.itemRuleConfigsPromise;
|
|
3196
3471
|
case 7:
|
|
3197
|
-
return
|
|
3472
|
+
return _context39.abrupt("return", _context39.sent);
|
|
3198
3473
|
case 8:
|
|
3199
3474
|
case "end":
|
|
3200
|
-
return
|
|
3475
|
+
return _context39.stop();
|
|
3201
3476
|
}
|
|
3202
|
-
},
|
|
3477
|
+
}, _callee39, this);
|
|
3203
3478
|
}));
|
|
3204
3479
|
function ensureItemRuleConfigsLoaded() {
|
|
3205
3480
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3209,22 +3484,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3209
3484
|
}, {
|
|
3210
3485
|
key: "refreshItemRuleQuantityLimits",
|
|
3211
3486
|
value: function () {
|
|
3212
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3487
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3213
3488
|
var strategyConfigs, businessData, limits;
|
|
3214
|
-
return _regeneratorRuntime().wrap(function
|
|
3215
|
-
while (1) switch (
|
|
3489
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3490
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3216
3491
|
case 0:
|
|
3217
|
-
|
|
3218
|
-
|
|
3492
|
+
_context40.prev = 0;
|
|
3493
|
+
_context40.next = 3;
|
|
3219
3494
|
return this.ensureItemRuleConfigsLoaded();
|
|
3220
3495
|
case 3:
|
|
3221
|
-
strategyConfigs =
|
|
3496
|
+
strategyConfigs = _context40.sent;
|
|
3222
3497
|
if (strategyConfigs.length) {
|
|
3223
|
-
|
|
3498
|
+
_context40.next = 7;
|
|
3224
3499
|
break;
|
|
3225
3500
|
}
|
|
3226
3501
|
this.store.itemRuleQuantityLimits = [];
|
|
3227
|
-
return
|
|
3502
|
+
return _context40.abrupt("return", []);
|
|
3228
3503
|
case 7:
|
|
3229
3504
|
businessData = buildItemRuleBusinessData({
|
|
3230
3505
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3236,18 +3511,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3236
3511
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3237
3512
|
limitCount: limits.length
|
|
3238
3513
|
});
|
|
3239
|
-
return
|
|
3514
|
+
return _context40.abrupt("return", limits);
|
|
3240
3515
|
case 14:
|
|
3241
|
-
|
|
3242
|
-
|
|
3516
|
+
_context40.prev = 14;
|
|
3517
|
+
_context40.t0 = _context40["catch"](0);
|
|
3243
3518
|
this.store.itemRuleQuantityLimits = [];
|
|
3244
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3245
|
-
return
|
|
3519
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context40.t0);
|
|
3520
|
+
return _context40.abrupt("return", []);
|
|
3246
3521
|
case 19:
|
|
3247
3522
|
case "end":
|
|
3248
|
-
return
|
|
3523
|
+
return _context40.stop();
|
|
3249
3524
|
}
|
|
3250
|
-
},
|
|
3525
|
+
}, _callee40, this, [[0, 14]]);
|
|
3251
3526
|
}));
|
|
3252
3527
|
function refreshItemRuleQuantityLimits() {
|
|
3253
3528
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3257,32 +3532,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3257
3532
|
}, {
|
|
3258
3533
|
key: "applyPrefillByItemRule",
|
|
3259
3534
|
value: function () {
|
|
3260
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3535
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3261
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;
|
|
3262
|
-
return _regeneratorRuntime().wrap(function
|
|
3263
|
-
while (1) switch (
|
|
3537
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3538
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3264
3539
|
case 0:
|
|
3265
3540
|
if (!this.itemRulePrefillApplied) {
|
|
3266
|
-
|
|
3541
|
+
_context41.next = 2;
|
|
3267
3542
|
break;
|
|
3268
3543
|
}
|
|
3269
|
-
return
|
|
3544
|
+
return _context41.abrupt("return");
|
|
3270
3545
|
case 2:
|
|
3271
3546
|
if (this.store.order) {
|
|
3272
|
-
|
|
3547
|
+
_context41.next = 4;
|
|
3273
3548
|
break;
|
|
3274
3549
|
}
|
|
3275
|
-
return
|
|
3550
|
+
return _context41.abrupt("return");
|
|
3276
3551
|
case 4:
|
|
3277
|
-
|
|
3552
|
+
_context41.next = 6;
|
|
3278
3553
|
return this.ensureItemRuleConfigsLoaded();
|
|
3279
3554
|
case 6:
|
|
3280
|
-
strategyConfigs =
|
|
3555
|
+
strategyConfigs = _context41.sent;
|
|
3281
3556
|
if (strategyConfigs.length) {
|
|
3282
|
-
|
|
3557
|
+
_context41.next = 9;
|
|
3283
3558
|
break;
|
|
3284
3559
|
}
|
|
3285
|
-
return
|
|
3560
|
+
return _context41.abrupt("return");
|
|
3286
3561
|
case 9:
|
|
3287
3562
|
businessData = buildItemRuleBusinessData({
|
|
3288
3563
|
tempOrder: this.ensureVenueTempOrder(),
|
|
@@ -3291,24 +3566,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3291
3566
|
});
|
|
3292
3567
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3293
3568
|
if (prefillItems.length) {
|
|
3294
|
-
|
|
3569
|
+
_context41.next = 14;
|
|
3295
3570
|
break;
|
|
3296
3571
|
}
|
|
3297
3572
|
this.itemRulePrefillApplied = true;
|
|
3298
|
-
return
|
|
3573
|
+
return _context41.abrupt("return");
|
|
3299
3574
|
case 14:
|
|
3300
|
-
|
|
3575
|
+
_context41.next = 16;
|
|
3301
3576
|
return this.buildPrefillProductSourceMap();
|
|
3302
3577
|
case 16:
|
|
3303
|
-
productSourceMap =
|
|
3578
|
+
productSourceMap = _context41.sent;
|
|
3304
3579
|
tempOrder = this.ensureVenueTempOrder();
|
|
3305
3580
|
hasChanges = false;
|
|
3306
3581
|
_iterator18 = _createForOfIteratorHelper(prefillItems);
|
|
3307
|
-
|
|
3582
|
+
_context41.prev = 20;
|
|
3308
3583
|
_iterator18.s();
|
|
3309
3584
|
case 22:
|
|
3310
3585
|
if ((_step18 = _iterator18.n()).done) {
|
|
3311
|
-
|
|
3586
|
+
_context41.next = 51;
|
|
3312
3587
|
break;
|
|
3313
3588
|
}
|
|
3314
3589
|
prefillItem = _step18.value;
|
|
@@ -3316,16 +3591,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3316
3591
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3317
3592
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3318
3593
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3319
|
-
|
|
3594
|
+
_context41.next = 29;
|
|
3320
3595
|
break;
|
|
3321
3596
|
}
|
|
3322
|
-
return
|
|
3597
|
+
return _context41.abrupt("continue", 49);
|
|
3323
3598
|
case 29:
|
|
3324
3599
|
if (!Number.isNaN(productVariantId)) {
|
|
3325
|
-
|
|
3600
|
+
_context41.next = 31;
|
|
3326
3601
|
break;
|
|
3327
3602
|
}
|
|
3328
|
-
return
|
|
3603
|
+
return _context41.abrupt("continue", 49);
|
|
3329
3604
|
case 31:
|
|
3330
3605
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3331
3606
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3333,7 +3608,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3333
3608
|
product_variant_id: productVariantId
|
|
3334
3609
|
});
|
|
3335
3610
|
if (!(productIndex === -1)) {
|
|
3336
|
-
|
|
3611
|
+
_context41.next = 42;
|
|
3337
3612
|
break;
|
|
3338
3613
|
}
|
|
3339
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');
|
|
@@ -3357,7 +3632,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3357
3632
|
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3358
3633
|
tempOrder.products.push(product);
|
|
3359
3634
|
hasChanges = true;
|
|
3360
|
-
return
|
|
3635
|
+
return _context41.abrupt("continue", 49);
|
|
3361
3636
|
case 42:
|
|
3362
3637
|
targetProduct = tempOrder.products[productIndex];
|
|
3363
3638
|
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
@@ -3379,34 +3654,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3379
3654
|
hasChanges = true;
|
|
3380
3655
|
}
|
|
3381
3656
|
case 49:
|
|
3382
|
-
|
|
3657
|
+
_context41.next = 22;
|
|
3383
3658
|
break;
|
|
3384
3659
|
case 51:
|
|
3385
|
-
|
|
3660
|
+
_context41.next = 56;
|
|
3386
3661
|
break;
|
|
3387
3662
|
case 53:
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
_iterator18.e(
|
|
3663
|
+
_context41.prev = 53;
|
|
3664
|
+
_context41.t0 = _context41["catch"](20);
|
|
3665
|
+
_iterator18.e(_context41.t0);
|
|
3391
3666
|
case 56:
|
|
3392
|
-
|
|
3667
|
+
_context41.prev = 56;
|
|
3393
3668
|
_iterator18.f();
|
|
3394
|
-
return
|
|
3669
|
+
return _context41.finish(56);
|
|
3395
3670
|
case 59:
|
|
3396
3671
|
if (!hasChanges) {
|
|
3397
|
-
|
|
3672
|
+
_context41.next = 64;
|
|
3398
3673
|
break;
|
|
3399
3674
|
}
|
|
3400
3675
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3401
3676
|
this.store.order.applyDiscount();
|
|
3402
|
-
|
|
3677
|
+
_context41.next = 63;
|
|
3403
3678
|
return this.store.order.recalculateSummary({
|
|
3404
3679
|
createIfMissing: true
|
|
3405
3680
|
});
|
|
3406
3681
|
case 63:
|
|
3407
3682
|
this.store.order.persistTempOrder();
|
|
3408
3683
|
case 64:
|
|
3409
|
-
|
|
3684
|
+
_context41.next = 66;
|
|
3410
3685
|
return this.refreshItemRuleQuantityLimits();
|
|
3411
3686
|
case 66:
|
|
3412
3687
|
this.itemRulePrefillApplied = true;
|
|
@@ -3416,9 +3691,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3416
3691
|
});
|
|
3417
3692
|
case 68:
|
|
3418
3693
|
case "end":
|
|
3419
|
-
return
|
|
3694
|
+
return _context41.stop();
|
|
3420
3695
|
}
|
|
3421
|
-
},
|
|
3696
|
+
}, _callee41, this, [[20, 53, 56, 59]]);
|
|
3422
3697
|
}));
|
|
3423
3698
|
function applyPrefillByItemRule() {
|
|
3424
3699
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3428,24 +3703,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3428
3703
|
}, {
|
|
3429
3704
|
key: "applyItemRulePrefill",
|
|
3430
3705
|
value: function () {
|
|
3431
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3432
|
-
return _regeneratorRuntime().wrap(function
|
|
3433
|
-
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) {
|
|
3434
3709
|
case 0:
|
|
3435
3710
|
this.logMethodStart('applyItemRulePrefill');
|
|
3436
|
-
|
|
3711
|
+
_context42.next = 3;
|
|
3437
3712
|
return this.applyPrefillByItemRule();
|
|
3438
3713
|
case 3:
|
|
3439
|
-
|
|
3714
|
+
_context42.next = 5;
|
|
3440
3715
|
return this.refreshItemRuleQuantityLimits();
|
|
3441
3716
|
case 5:
|
|
3442
|
-
|
|
3717
|
+
_context42.next = 7;
|
|
3443
3718
|
return this.refreshCartValidationPassed();
|
|
3444
3719
|
case 7:
|
|
3445
3720
|
case "end":
|
|
3446
|
-
return
|
|
3721
|
+
return _context42.stop();
|
|
3447
3722
|
}
|
|
3448
|
-
},
|
|
3723
|
+
}, _callee42, this);
|
|
3449
3724
|
}));
|
|
3450
3725
|
function applyItemRulePrefill() {
|
|
3451
3726
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3455,20 +3730,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3455
3730
|
}, {
|
|
3456
3731
|
key: "evaluateCartValidationByItemRule",
|
|
3457
3732
|
value: function () {
|
|
3458
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3733
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3459
3734
|
var strategyConfigs, businessData;
|
|
3460
|
-
return _regeneratorRuntime().wrap(function
|
|
3461
|
-
while (1) switch (
|
|
3735
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3736
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3462
3737
|
case 0:
|
|
3463
|
-
|
|
3738
|
+
_context43.next = 2;
|
|
3464
3739
|
return this.ensureItemRuleConfigsLoaded();
|
|
3465
3740
|
case 2:
|
|
3466
|
-
strategyConfigs =
|
|
3741
|
+
strategyConfigs = _context43.sent;
|
|
3467
3742
|
if (strategyConfigs.length) {
|
|
3468
|
-
|
|
3743
|
+
_context43.next = 5;
|
|
3469
3744
|
break;
|
|
3470
3745
|
}
|
|
3471
|
-
return
|
|
3746
|
+
return _context43.abrupt("return", {
|
|
3472
3747
|
passed: true,
|
|
3473
3748
|
failures: []
|
|
3474
3749
|
});
|
|
@@ -3478,12 +3753,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3478
3753
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3479
3754
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3480
3755
|
});
|
|
3481
|
-
return
|
|
3756
|
+
return _context43.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3482
3757
|
case 7:
|
|
3483
3758
|
case "end":
|
|
3484
|
-
return
|
|
3759
|
+
return _context43.stop();
|
|
3485
3760
|
}
|
|
3486
|
-
},
|
|
3761
|
+
}, _callee43, this);
|
|
3487
3762
|
}));
|
|
3488
3763
|
function evaluateCartValidationByItemRule() {
|
|
3489
3764
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3493,20 +3768,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3493
3768
|
}, {
|
|
3494
3769
|
key: "validateBeforeSubmitByItemRule",
|
|
3495
3770
|
value: function () {
|
|
3496
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3771
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
|
|
3497
3772
|
var validationResult, firstFailure, errorMessage, error;
|
|
3498
|
-
return _regeneratorRuntime().wrap(function
|
|
3499
|
-
while (1) switch (
|
|
3773
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3774
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3500
3775
|
case 0:
|
|
3501
|
-
|
|
3776
|
+
_context44.next = 2;
|
|
3502
3777
|
return this.evaluateCartValidationByItemRule();
|
|
3503
3778
|
case 2:
|
|
3504
|
-
validationResult =
|
|
3779
|
+
validationResult = _context44.sent;
|
|
3505
3780
|
if (!validationResult.passed) {
|
|
3506
|
-
|
|
3781
|
+
_context44.next = 5;
|
|
3507
3782
|
break;
|
|
3508
3783
|
}
|
|
3509
|
-
return
|
|
3784
|
+
return _context44.abrupt("return");
|
|
3510
3785
|
case 5:
|
|
3511
3786
|
firstFailure = validationResult.failures[0];
|
|
3512
3787
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3515,9 +3790,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3515
3790
|
throw error;
|
|
3516
3791
|
case 10:
|
|
3517
3792
|
case "end":
|
|
3518
|
-
return
|
|
3793
|
+
return _context44.stop();
|
|
3519
3794
|
}
|
|
3520
|
-
},
|
|
3795
|
+
}, _callee44, this);
|
|
3521
3796
|
}));
|
|
3522
3797
|
function validateBeforeSubmitByItemRule() {
|
|
3523
3798
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3527,10 +3802,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3527
3802
|
}, {
|
|
3528
3803
|
key: "refreshCartValidationPassed",
|
|
3529
3804
|
value: function () {
|
|
3530
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3805
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3531
3806
|
var previous, nextState, validationResult, changed;
|
|
3532
|
-
return _regeneratorRuntime().wrap(function
|
|
3533
|
-
while (1) switch (
|
|
3807
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3808
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3534
3809
|
case 0:
|
|
3535
3810
|
previous = this.store.cartValidation || {
|
|
3536
3811
|
passed: null,
|
|
@@ -3540,20 +3815,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3540
3815
|
passed: null,
|
|
3541
3816
|
failures: []
|
|
3542
3817
|
};
|
|
3543
|
-
|
|
3544
|
-
|
|
3818
|
+
_context45.prev = 2;
|
|
3819
|
+
_context45.next = 5;
|
|
3545
3820
|
return this.evaluateCartValidationByItemRule();
|
|
3546
3821
|
case 5:
|
|
3547
|
-
validationResult =
|
|
3822
|
+
validationResult = _context45.sent;
|
|
3548
3823
|
nextState = {
|
|
3549
3824
|
passed: validationResult.passed,
|
|
3550
3825
|
failures: validationResult.failures || []
|
|
3551
3826
|
};
|
|
3552
|
-
|
|
3827
|
+
_context45.next = 12;
|
|
3553
3828
|
break;
|
|
3554
3829
|
case 9:
|
|
3555
|
-
|
|
3556
|
-
|
|
3830
|
+
_context45.prev = 9;
|
|
3831
|
+
_context45.t0 = _context45["catch"](2);
|
|
3557
3832
|
nextState = {
|
|
3558
3833
|
passed: false,
|
|
3559
3834
|
failures: []
|
|
@@ -3562,21 +3837,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3562
3837
|
this.store.cartValidation = nextState;
|
|
3563
3838
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3564
3839
|
if (!changed) {
|
|
3565
|
-
|
|
3840
|
+
_context45.next = 17;
|
|
3566
3841
|
break;
|
|
3567
3842
|
}
|
|
3568
|
-
|
|
3843
|
+
_context45.next = 17;
|
|
3569
3844
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3570
3845
|
cartValidation: nextState,
|
|
3571
3846
|
cartValidationPassed: nextState.passed
|
|
3572
3847
|
});
|
|
3573
3848
|
case 17:
|
|
3574
|
-
return
|
|
3849
|
+
return _context45.abrupt("return", nextState.passed);
|
|
3575
3850
|
case 18:
|
|
3576
3851
|
case "end":
|
|
3577
|
-
return
|
|
3852
|
+
return _context45.stop();
|
|
3578
3853
|
}
|
|
3579
|
-
},
|
|
3854
|
+
}, _callee45, this, [[2, 9]]);
|
|
3580
3855
|
}));
|
|
3581
3856
|
function refreshCartValidationPassed() {
|
|
3582
3857
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3586,14 +3861,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3586
3861
|
}, {
|
|
3587
3862
|
key: "setItemRuleRuntimeConfig",
|
|
3588
3863
|
value: function () {
|
|
3589
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3864
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3590
3865
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3591
3866
|
var config,
|
|
3592
|
-
|
|
3593
|
-
return _regeneratorRuntime().wrap(function
|
|
3594
|
-
while (1) switch (
|
|
3867
|
+
_args46 = arguments;
|
|
3868
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3869
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3595
3870
|
case 0:
|
|
3596
|
-
config =
|
|
3871
|
+
config = _args46.length > 0 && _args46[0] !== undefined ? _args46[0] : {};
|
|
3597
3872
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3598
3873
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3599
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) || {}),
|
|
@@ -3605,10 +3880,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3605
3880
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3606
3881
|
}
|
|
3607
3882
|
this.itemRulePrefillApplied = false;
|
|
3608
|
-
|
|
3883
|
+
_context46.next = 7;
|
|
3609
3884
|
return this.refreshItemRuleQuantityLimits();
|
|
3610
3885
|
case 7:
|
|
3611
|
-
|
|
3886
|
+
_context46.next = 9;
|
|
3612
3887
|
return this.refreshCartValidationPassed();
|
|
3613
3888
|
case 9:
|
|
3614
3889
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3616,9 +3891,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3616
3891
|
});
|
|
3617
3892
|
case 10:
|
|
3618
3893
|
case "end":
|
|
3619
|
-
return
|
|
3894
|
+
return _context46.stop();
|
|
3620
3895
|
}
|
|
3621
|
-
},
|
|
3896
|
+
}, _callee46, this);
|
|
3622
3897
|
}));
|
|
3623
3898
|
function setItemRuleRuntimeConfig() {
|
|
3624
3899
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3652,7 +3927,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3652
3927
|
var raw = this.window.sessionStorage.getItem(key) || '{}';
|
|
3653
3928
|
var parsed = JSON.parse(raw);
|
|
3654
3929
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
3655
|
-
} catch (
|
|
3930
|
+
} catch (_unused5) {
|
|
3656
3931
|
return {};
|
|
3657
3932
|
}
|
|
3658
3933
|
}
|
|
@@ -3739,30 +4014,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3739
4014
|
}, {
|
|
3740
4015
|
key: "refreshAllHolderFormRecords",
|
|
3741
4016
|
value: (function () {
|
|
3742
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4017
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(params) {
|
|
3743
4018
|
var _params$customer_id, _params$useCache;
|
|
3744
4019
|
var customer_id;
|
|
3745
|
-
return _regeneratorRuntime().wrap(function
|
|
3746
|
-
while (1) switch (
|
|
4020
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
4021
|
+
while (1) switch (_context47.prev = _context47.next) {
|
|
3747
4022
|
case 0:
|
|
3748
4023
|
if (this.store.holder) {
|
|
3749
|
-
|
|
4024
|
+
_context47.next = 2;
|
|
3750
4025
|
break;
|
|
3751
4026
|
}
|
|
3752
4027
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3753
4028
|
case 2:
|
|
3754
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();
|
|
3755
|
-
return
|
|
4030
|
+
return _context47.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3756
4031
|
customer_id: customer_id,
|
|
3757
4032
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3758
4033
|
})));
|
|
3759
4034
|
case 4:
|
|
3760
4035
|
case "end":
|
|
3761
|
-
return
|
|
4036
|
+
return _context47.stop();
|
|
3762
4037
|
}
|
|
3763
|
-
},
|
|
4038
|
+
}, _callee47, this);
|
|
3764
4039
|
}));
|
|
3765
|
-
function refreshAllHolderFormRecords(
|
|
4040
|
+
function refreshAllHolderFormRecords(_x23) {
|
|
3766
4041
|
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3767
4042
|
}
|
|
3768
4043
|
return refreshAllHolderFormRecords;
|
|
@@ -3782,25 +4057,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3782
4057
|
}, {
|
|
3783
4058
|
key: "checkOpenDataAvailability",
|
|
3784
4059
|
value: function () {
|
|
3785
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3786
|
-
return _regeneratorRuntime().wrap(function
|
|
3787
|
-
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) {
|
|
3788
4063
|
case 0:
|
|
3789
4064
|
if (this.store.openData) {
|
|
3790
|
-
|
|
4065
|
+
_context48.next = 2;
|
|
3791
4066
|
break;
|
|
3792
4067
|
}
|
|
3793
4068
|
throw new Error('openData 模块未初始化');
|
|
3794
4069
|
case 2:
|
|
3795
|
-
|
|
4070
|
+
_context48.next = 4;
|
|
3796
4071
|
return this.loadOpenDataConfig();
|
|
3797
4072
|
case 4:
|
|
3798
|
-
return
|
|
4073
|
+
return _context48.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3799
4074
|
case 5:
|
|
3800
4075
|
case "end":
|
|
3801
|
-
return
|
|
4076
|
+
return _context48.stop();
|
|
3802
4077
|
}
|
|
3803
|
-
},
|
|
4078
|
+
}, _callee48, this);
|
|
3804
4079
|
}));
|
|
3805
4080
|
function checkOpenDataAvailability() {
|
|
3806
4081
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3810,27 +4085,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3810
4085
|
}, {
|
|
3811
4086
|
key: "setOtherParams",
|
|
3812
4087
|
value: function () {
|
|
3813
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3814
|
-
var
|
|
3815
|
-
|
|
4088
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
4089
|
+
var _ref13,
|
|
4090
|
+
_ref13$cover,
|
|
3816
4091
|
cover,
|
|
3817
|
-
|
|
3818
|
-
return _regeneratorRuntime().wrap(function
|
|
3819
|
-
while (1) switch (
|
|
4092
|
+
_args49 = arguments;
|
|
4093
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
4094
|
+
while (1) switch (_context49.prev = _context49.next) {
|
|
3820
4095
|
case 0:
|
|
3821
|
-
|
|
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();
|
|
3822
4098
|
if (cover) {
|
|
3823
4099
|
this.otherParams = params;
|
|
3824
4100
|
} else {
|
|
3825
4101
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3826
4102
|
}
|
|
3827
|
-
case
|
|
4103
|
+
case 3:
|
|
3828
4104
|
case "end":
|
|
3829
|
-
return
|
|
4105
|
+
return _context49.stop();
|
|
3830
4106
|
}
|
|
3831
|
-
},
|
|
4107
|
+
}, _callee49, this);
|
|
3832
4108
|
}));
|
|
3833
|
-
function setOtherParams(
|
|
4109
|
+
function setOtherParams(_x24) {
|
|
3834
4110
|
return _setOtherParams.apply(this, arguments);
|
|
3835
4111
|
}
|
|
3836
4112
|
return setOtherParams;
|