@pisell/pisellos 2.1.167 → 2.1.168

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.
Files changed (79) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -3
  3. package/dist/model/strategy/adapter/index.d.ts +0 -4
  4. package/dist/model/strategy/adapter/index.js +1 -5
  5. package/dist/modules/Cart/utils/changePrice.js +16 -9
  6. package/dist/modules/Discount/index.d.ts +2 -5
  7. package/dist/modules/Discount/index.js +1 -21
  8. package/dist/modules/Discount/types.d.ts +0 -4
  9. package/dist/modules/Order/index.d.ts +0 -1
  10. package/dist/modules/Order/index.js +6 -18
  11. package/dist/modules/Order/types.d.ts +0 -2
  12. package/dist/modules/ProductList/index.d.ts +1 -3
  13. package/dist/modules/ProductList/index.js +11 -22
  14. package/dist/modules/Schedule/getDateIsInSchedule.js +0 -5
  15. package/dist/solution/BookingByStep/index.d.ts +1 -1
  16. package/dist/solution/ScanOrder/index.js +1 -1
  17. package/dist/solution/ShopDiscount/index.js +15 -16
  18. package/dist/solution/VenueBooking/index.d.ts +3 -40
  19. package/dist/solution/VenueBooking/index.js +261 -394
  20. package/dist/solution/VenueBooking/types.d.ts +1 -3
  21. package/dist/solution/VenueBooking/types.js +0 -1
  22. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  23. package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
  24. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  25. package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
  26. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  27. package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
  28. package/lib/index.d.ts +0 -1
  29. package/lib/index.js +0 -3
  30. package/lib/model/strategy/adapter/index.d.ts +0 -4
  31. package/lib/model/strategy/adapter/index.js +2 -13
  32. package/lib/modules/Cart/utils/changePrice.js +13 -9
  33. package/lib/modules/Discount/index.d.ts +2 -5
  34. package/lib/modules/Discount/index.js +1 -11
  35. package/lib/modules/Discount/types.d.ts +0 -4
  36. package/lib/modules/Order/index.d.ts +0 -1
  37. package/lib/modules/Order/index.js +1 -11
  38. package/lib/modules/Order/types.d.ts +0 -2
  39. package/lib/modules/ProductList/index.d.ts +1 -3
  40. package/lib/modules/ProductList/index.js +39 -45
  41. package/lib/modules/Schedule/getDateIsInSchedule.js +0 -4
  42. package/lib/solution/BookingByStep/index.d.ts +1 -1
  43. package/lib/solution/ScanOrder/index.js +1 -1
  44. package/lib/solution/ShopDiscount/index.js +2 -3
  45. package/lib/solution/VenueBooking/index.d.ts +3 -40
  46. package/lib/solution/VenueBooking/index.js +111 -257
  47. package/lib/solution/VenueBooking/types.d.ts +1 -3
  48. package/lib/solution/VenueBooking/types.js +0 -1
  49. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  50. package/lib/solution/VenueBooking/utils/dateSummary.js +10 -5
  51. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
  52. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -3
  53. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
  54. package/lib/solution/VenueBooking/utils/timeSlot.js +3 -7
  55. package/package.json +1 -1
  56. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  57. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  58. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  59. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  60. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  61. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  62. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  63. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  64. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  65. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  66. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  67. package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
  68. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  69. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  70. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  71. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  72. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  73. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  74. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  75. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  76. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  77. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  78. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
  79. package/lib/solution/VenueBooking/utils/smartPricing.js +0 -180
@@ -45,7 +45,6 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
45
45
  import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
46
46
  import { buildDateRangeSummary } from "./utils/dateSummary";
47
47
  import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
- import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
49
48
  import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
50
49
  import { OrderModule } from "../../modules/Order";
51
50
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
@@ -99,15 +98,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
99
98
  _defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
100
99
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
101
100
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
102
- /** 最近一次确认登录的客户;登录事件与 user 插件更新之间可能存在时序差。 */
103
- _defineProperty(_assertThisInitialized(_this), "smartPricingCustomerId", void 0);
104
101
  _defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
105
102
  _defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
106
103
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
107
- /** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
108
- _defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
109
- /** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
110
- _defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
111
104
  return _this;
112
105
  }
113
106
  _createClass(VenueBookingImpl, [{
@@ -328,9 +321,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
328
321
  }, {
329
322
  key: "registerCustomerLoginListeners",
330
323
  value: function registerCustomerLoginListeners() {
331
- var _this2 = this;
324
+ var _this$core2,
325
+ _this$core3,
326
+ _accountModule$getCur,
327
+ _accountModule$getAcc,
328
+ _this2 = this;
332
329
  this.clearLoginEffectListeners();
333
- var createHandleLogin = function createHandleLogin() {
330
+ var accountModule = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getModule('account');
331
+ var registerAndLoginModule = (_this$core3 = this.core) === null || _this$core3 === void 0 ? void 0 : _this$core3.getModule('registerAndLogin');
332
+ var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
333
+ var createHandleLogin = function createHandleLogin(eventName) {
334
334
  return /*#__PURE__*/function () {
335
335
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payload) {
336
336
  var customerId;
@@ -359,9 +359,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
359
359
  };
360
360
  }();
361
361
  };
362
- this.registerLoginEffect(VenueBookingImpl.PISELL1_LOGIN_SUCCESS, createHandleLogin());
363
- this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin());
364
- this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin());
362
+ this.registerLoginEffect(AccountHooks.OnLogin, createHandleLogin(AccountHooks.OnLogin));
363
+ this.registerLoginEffect(RegisterAndLoginHooks.onLoginSuccess, createHandleLogin(RegisterAndLoginHooks.onLoginSuccess));
365
364
  }
366
365
  }, {
367
366
  key: "refreshOrderMarketingAfterLogin",
@@ -396,40 +395,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
396
395
  case 9:
397
396
  this.customerLoginRefreshIdInFlight = params.customerId;
398
397
  refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
399
- var _this3$core, _this3$core$emit;
398
+ var _this3$otherParams;
400
399
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
401
400
  while (1) switch (_context4.prev = _context4.next) {
402
401
  case 0:
403
- // 用户插件可能晚于登录 effect 更新;以已确认的登录 payload 作为本次及后续网格算价的身份来源。
404
- _this3.smartPricingCustomerId = params.customerId;
402
+ if (!_this3.store.quotation) {
403
+ _context4.next = 3;
404
+ break;
405
+ }
405
406
  _context4.next = 3;
407
+ return _this3.store.quotation.loadQuotations({
408
+ channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
409
+ });
410
+ case 3:
411
+ _this3.recalculateOrderPricesFromQuotation();
412
+ _context4.next = 6;
406
413
  return _this3.store.order.loadDiscountConfig({
407
414
  customerId: params.customerId
408
415
  });
409
- case 3:
410
- _this3.clearSlotPriceMapCache();
411
- _this3.recalculateOrderPricesFromSmartPricing();
412
- // loadDiscountConfig 会按登录前的订单价格预计算一次券;智能价更新后必须用新的
413
- // source/main 价格字段重新套券,否则购物车行价与 Summary 会使用两套基数。
414
- _this3.store.order.applyDiscount();
415
- _this3.normalizeDiscountedOrderPrices(_this3.store.order.getDiscountList());
416
- _context4.next = 9;
416
+ case 6:
417
+ _context4.next = 8;
417
418
  return _this3.store.order.recalculateSummary({
418
419
  createIfMissing: true
419
420
  });
420
- case 9:
421
+ case 8:
421
422
  _this3.store.order.persistTempOrder();
422
- _context4.next = 12;
423
+ _context4.next = 11;
423
424
  return _this3.refreshItemRuleQuantityLimits();
424
- case 12:
425
- _context4.next = 14;
425
+ case 11:
426
+ _context4.next = 13;
426
427
  return _this3.refreshCartValidationPassed();
427
- case 14:
428
- _context4.next = 16;
429
- return (_this3$core = _this3.core) === null || _this3$core === void 0 || (_this3$core = _this3$core.effects) === null || _this3$core === void 0 || (_this3$core$emit = _this3$core.emit) === null || _this3$core$emit === void 0 ? void 0 : _this3$core$emit.call(_this3$core, VenueBookingHooks.onSmartPricingUpdated, {
430
- customerId: params.customerId
431
- });
432
- case 16:
428
+ case 13:
433
429
  case "end":
434
430
  return _context4.stop();
435
431
  }
@@ -486,6 +482,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
486
482
  openDataModule,
487
483
  _this$store$order,
488
484
  _this$store$order2,
485
+ _this$store$quotation,
486
+ _this$otherParams6,
489
487
  _args6 = arguments;
490
488
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
491
489
  while (1) switch (_context6.prev = _context6.next) {
@@ -495,7 +493,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
495
493
  this.core = core;
496
494
  this.initializeOptions = options || {};
497
495
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
498
- this.smartPricingCustomerId = undefined;
499
496
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
500
497
  this.store.status = 'initializing';
501
498
  this.store.error = null;
@@ -516,19 +513,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
516
513
  this.window = core.getPlugin('window');
517
514
  this.request = core.getPlugin('request');
518
515
  if (this.window) {
519
- _context6.next = 25;
516
+ _context6.next = 24;
520
517
  break;
521
518
  }
522
519
  this.logMethodError('initialize', 'window plugin missing');
523
520
  throw new Error('venueBooking解决方案需要 window 插件支持');
524
- case 25:
521
+ case 24:
525
522
  if (this.request) {
526
- _context6.next = 28;
523
+ _context6.next = 27;
527
524
  break;
528
525
  }
529
526
  this.logMethodError('initialize', 'request plugin missing');
530
527
  throw new Error('venueBooking解决方案需要 request 插件支持');
531
- case 28:
528
+ case 27:
532
529
  // 注册基础模块(order, salesSummary, products, logger)
533
530
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
534
531
  baseModules.forEach(function (step) {
@@ -625,41 +622,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
625
622
  }
626
623
  this.registerCustomerLoginListeners();
627
624
  console.log('[VenueBooking] 初始化开始');
628
- _context6.prev = 51;
629
- _context6.next = 54;
625
+ _context6.prev = 50;
626
+ _context6.next = 53;
630
627
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
631
628
  createIfMissing: false
632
629
  });
633
- case 54:
630
+ case 53:
634
631
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
635
- _context6.next = 57;
632
+ _context6.next = 56;
636
633
  return this.loadRuntimeConfigs();
637
- case 57:
634
+ case 56:
638
635
  if (!this.store.schedule) {
639
- _context6.next = 60;
636
+ _context6.next = 61;
640
637
  break;
641
638
  }
642
- _context6.next = 60;
639
+ _context6.next = 59;
643
640
  return this.store.schedule.loadAllSchedule();
644
- case 60:
645
- _context6.next = 62;
641
+ case 59:
642
+ this.injectScheduleResolverToQuotation();
643
+ (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
644
+ channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel
645
+ });
646
+ case 61:
647
+ _context6.next = 63;
646
648
  return this.refreshItemRuleQuantityLimits();
647
- case 62:
649
+ case 63:
648
650
  this.store.status = 'ready';
649
651
  console.log('[VenueBooking] 初始化完成');
650
- _context6.next = 66;
652
+ _context6.next = 67;
651
653
  return this.core.effects.emit(VenueBookingHooks.onInited, {
652
654
  status: this.store.status
653
655
  });
654
- case 66:
656
+ case 67:
655
657
  this.logMethodSuccess('initialize', {
656
658
  status: this.store.status
657
659
  });
658
- _context6.next = 76;
660
+ _context6.next = 77;
659
661
  break;
660
- case 69:
661
- _context6.prev = 69;
662
- _context6.t0 = _context6["catch"](51);
662
+ case 70:
663
+ _context6.prev = 70;
664
+ _context6.t0 = _context6["catch"](50);
663
665
  this.store.status = 'error';
664
666
  this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
665
667
  console.error('[VenueBooking] 初始化失败', _context6.t0);
@@ -667,11 +669,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
667
669
  status: this.store.status
668
670
  });
669
671
  throw _context6.t0;
670
- case 76:
672
+ case 77:
671
673
  case "end":
672
674
  return _context6.stop();
673
675
  }
674
- }, _callee6, this, [[51, 69]]);
676
+ }, _callee6, this, [[50, 70]]);
675
677
  }));
676
678
  function initialize(_x5) {
677
679
  return _initialize.apply(this, arguments);
@@ -812,113 +814,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
812
814
  };
813
815
  }
814
816
 
815
- /** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
816
- }, {
817
- key: "clearSlotPriceMapCache",
818
- value: function clearSlotPriceMapCache() {
819
- this.slotPriceMapCache.clear();
820
- }
821
-
822
- /** 读取当前登录 customerId */
823
- }, {
824
- key: "resolveCustomerIdForSmartPricing",
825
- value: function resolveCustomerIdForSmartPricing() {
826
- if (this.smartPricingCustomerId) return this.smartPricingCustomerId;
827
- try {
828
- var _this$core2, _userPlugin$get;
829
- var userPlugin = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.getPlugin('user');
830
- var customerId = Number(userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get) === null || _userPlugin$get === void 0 || (_userPlugin$get = _userPlugin$get.call(userPlugin)) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
831
- return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
832
- } catch (_unused2) {
833
- return undefined;
834
- }
835
- }
836
- }, {
837
- key: "resolveAvailableWalletIdsForSmartPricing",
838
- value: function resolveAvailableWalletIdsForSmartPricing() {
839
- var _this$store$order3, _this$store$order3$ge, _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
840
- 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);
841
- var fallbackWalletIds = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.available_wallet_ids) || ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.availableWalletIds) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 || (_this$otherParams8 = _this$otherParams8.strategy_context) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.available_wallet_ids) || ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9 = _this$otherParams9.strategy_context) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.availableWalletIds);
842
- var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
843
- if (!Array.isArray(source)) return [];
844
- var ids = source.map(function (item) {
845
- return Number(item);
846
- }).filter(function (item) {
847
- return Number.isFinite(item) && item > 0;
848
- });
849
- return Array.from(new Set(ids));
850
- }
851
-
852
- /** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
853
- }, {
854
- key: "getScheduleListForSmartPricing",
855
- value: function getScheduleListForSmartPricing() {
856
- var _store;
857
- var scheduleModule = this.store.schedule;
858
- var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
859
- return Array.isArray(list) ? list : [];
860
- }
861
-
862
- /** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
863
- }, {
864
- key: "buildSmartPricingContext",
865
- value: function buildSmartPricingContext(customerId) {
866
- var _this$core3, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16;
867
- var 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;
868
- return {
869
- evaluator: evaluator,
870
- scheduleList: this.getScheduleListForSmartPricing(),
871
- menuList: ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.menuList) || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11 = _this$otherParams11.openData) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.menuList) || [],
872
- customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
873
- availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
874
- channel: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.channel,
875
- businessCode: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.businessCode,
876
- orderType: ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.orderType) || ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.type),
877
- strategy_context: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.strategy_context
878
- };
879
- }
880
-
881
- /** venue + addon 全量商品,供智能定价评估 */
882
- }, {
883
- key: "getAllProductsForSmartPricing",
884
- value: function getAllProductsForSmartPricing() {
885
- if (this.smartPricingProductCatalog.length) {
886
- return this.smartPricingProductCatalog;
887
- }
888
- var venueList = this.getVenueProducts();
889
- var addonList = this.getAddonProductsList();
890
- return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
891
- }
892
- }, {
893
- key: "getSlotPriceMapCacheKey",
894
- value: function getSlotPriceMapCacheKey(date, context) {
895
- var _context$customerId, _context$channel, _context$businessCode;
896
- return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (context.availableWalletIds || []).join(','), (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
897
- }
898
-
899
- /**
900
- * 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
901
- */
902
- }, {
903
- key: "buildSlotPriceMapForDate",
904
- value: function buildSlotPriceMapForDate(date, config, productIds) {
905
- var context = this.buildSmartPricingContext();
906
- var cacheKey = this.getSlotPriceMapCacheKey(date, context);
907
- var cached = this.slotPriceMapCache.get(cacheKey);
908
- if (cached) return cached;
909
- var timeLabels = generateTimeLabels(config);
910
- var slotPriceMap = buildSlotPriceMapByScheduleSegments({
911
- products: this.getAllProductsForSmartPricing(),
912
- productIds: productIds,
913
- date: date,
914
- timeLabels: timeLabels,
915
- config: config,
916
- context: context
917
- });
918
- this.slotPriceMapCache.set(cacheKey, slotPriceMap);
919
- return slotPriceMap;
920
- }
921
-
922
817
  // ─── 场地商品 & 附加商品 ───
923
818
  }, {
924
819
  key: "loadAllProducts",
@@ -953,7 +848,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
953
848
  key: "_doLoadAllProducts",
954
849
  value: function () {
955
850
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
956
- var _this$otherParams17, _this$store$venueProd, associatedMenus, menuListIds, allProducts, rawList, list, venueList, addonList, venueStore;
851
+ var _this$otherParams7, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
957
852
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
958
853
  while (1) switch (_context11.prev = _context11.next) {
959
854
  case 0:
@@ -974,7 +869,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
974
869
  _context11.next = 8;
975
870
  return this.loadOpenDataConfig();
976
871
  case 8:
977
- associatedMenus = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17 = _this$otherParams17.openData) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17['menu.associated_menus']) || [];
872
+ associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
978
873
  if (associatedMenus.length) {
979
874
  _context11.next = 12;
980
875
  break;
@@ -990,16 +885,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
990
885
  menu_list_ids: menuListIds,
991
886
  cacheId: this.cacheId,
992
887
  schedule_date: dayjs().format('YYYY-MM-DD'),
993
- schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
994
- with_extra: ['dataVariants']
888
+ schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
995
889
  });
996
890
  case 15:
997
891
  allProducts = _context11.sent;
998
- rawList = Array.isArray(allProducts) ? allProducts : [];
999
- list = rawList;
1000
- this.smartPricingProductCatalog = rawList.slice();
1001
- list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
1002
- this.clearSlotPriceMapCache();
892
+ list = Array.isArray(allProducts) ? allProducts : [];
1003
893
  venueList = list.filter(function (p) {
1004
894
  return p.duration != null;
1005
895
  });
@@ -1025,16 +915,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1025
915
  venueProducts: venueList,
1026
916
  addonProducts: addonList
1027
917
  });
1028
- case 32:
1029
- _context11.prev = 32;
918
+ case 28:
919
+ _context11.prev = 28;
1030
920
  _context11.t0 = _context11["catch"](1);
1031
921
  this.logMethodError('loadAllProducts', _context11.t0);
1032
922
  throw _context11.t0;
1033
- case 36:
923
+ case 32:
1034
924
  case "end":
1035
925
  return _context11.stop();
1036
926
  }
1037
- }, _callee11, this, [[1, 32]]);
927
+ }, _callee11, this, [[1, 28]]);
1038
928
  }));
1039
929
  function _doLoadAllProducts() {
1040
930
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1353,11 +1243,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1353
1243
  config: this.baseSlotConfig,
1354
1244
  rawResources: this.store.rawResourceData,
1355
1245
  resourceProductMap: this.resourceProductMap,
1246
+ quotationModule: this.store.quotation,
1356
1247
  resolveConfig: function resolveConfig(date) {
1357
1248
  return _this6.resolveSlotConfigForDate(date);
1358
- },
1359
- buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
1360
- return _this6.buildSlotPriceMapForDate(date, config, productIds);
1361
1249
  }
1362
1250
  });
1363
1251
  }
@@ -1365,16 +1253,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1365
1253
  key: "getTimeSlotGrid",
1366
1254
  value: function getTimeSlotGrid(date) {
1367
1255
  var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1368
- var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1369
- return m.productId;
1370
- })));
1371
- var slotPriceMap = productIds.length ? this.buildSlotPriceMapForDate(date, resolvedSlotConfig, productIds) : undefined;
1256
+ var quotationPriceMap;
1257
+ if (this.store.quotation) {
1258
+ var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1259
+ return m.productId;
1260
+ })));
1261
+ var timeLabels = generateTimeLabels(resolvedSlotConfig);
1262
+ var timePoints = timeLabels.map(function (label) {
1263
+ return "".concat(date, " ").concat(label);
1264
+ });
1265
+ quotationPriceMap = this.store.quotation.buildProductPriceMap({
1266
+ productIds: productIds,
1267
+ timePoints: timePoints
1268
+ });
1269
+ }
1372
1270
  return buildTimeSlotGrid({
1373
1271
  date: date,
1374
1272
  config: resolvedSlotConfig,
1375
1273
  rawResources: this.store.rawResourceData,
1376
1274
  resourceProductMap: this.resourceProductMap,
1377
- slotPriceMap: slotPriceMap
1275
+ quotationPriceMap: quotationPriceMap
1378
1276
  });
1379
1277
  }
1380
1278
 
@@ -1474,8 +1372,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1474
1372
  }, {
1475
1373
  key: "getSelectedSlotsForResource",
1476
1374
  value: function getSelectedSlotsForResource(resourceId, productId) {
1477
- var _this$store$order4;
1478
- var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
1375
+ var _this$store$order3;
1376
+ var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
1479
1377
  if (!tempOrder) return [];
1480
1378
  var venueProducts = tempOrder.products.filter(function (p) {
1481
1379
  var _p$metadata, _p$metadata2;
@@ -1636,9 +1534,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1636
1534
  }, {
1637
1535
  key: "getAllSelectedSlots",
1638
1536
  value: function getAllSelectedSlots() {
1639
- var _this$store$order5;
1537
+ var _this$store$order4;
1640
1538
  var result = new Map();
1641
- var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
1539
+ var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
1642
1540
  if (!tempOrder) return result;
1643
1541
  var venueProducts = tempOrder.products.filter(function (p) {
1644
1542
  var _p$metadata3;
@@ -1810,7 +1708,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1810
1708
  booking_uid: bookingUuid,
1811
1709
  price_breakdown: buildPriceBreakdown({
1812
1710
  group: group,
1813
- productId: mapping.productId
1711
+ productId: mapping.productId,
1712
+ quotation: this.store.quotation
1814
1713
  })
1815
1714
  },
1816
1715
  _origin: {
@@ -1941,25 +1840,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1941
1840
  _context18.next = 6;
1942
1841
  return this.store.schedule.loadAllSchedule();
1943
1842
  case 6:
1843
+ this.injectScheduleResolverToQuotation();
1944
1844
  this.logMethodSuccess('loadSchedules');
1945
- _context18.next = 13;
1845
+ _context18.next = 14;
1946
1846
  break;
1947
- case 9:
1948
- _context18.prev = 9;
1847
+ case 10:
1848
+ _context18.prev = 10;
1949
1849
  _context18.t0 = _context18["catch"](1);
1950
1850
  this.logMethodError('loadSchedules', _context18.t0);
1951
1851
  throw _context18.t0;
1952
- case 13:
1852
+ case 14:
1953
1853
  case "end":
1954
1854
  return _context18.stop();
1955
1855
  }
1956
- }, _callee18, this, [[1, 9]]);
1856
+ }, _callee18, this, [[1, 10]]);
1957
1857
  }));
1958
1858
  function loadSchedules() {
1959
1859
  return _loadSchedules.apply(this, arguments);
1960
1860
  }
1961
1861
  return loadSchedules;
1962
1862
  }()
1863
+ }, {
1864
+ key: "injectScheduleResolverToQuotation",
1865
+ value: function injectScheduleResolverToQuotation() {
1866
+ var _this9 = this;
1867
+ if (this.store.quotation && this.store.schedule) {
1868
+ this.store.quotation.setScheduleResolver(function (id) {
1869
+ return _this9.store.schedule.getScheduleListByIds([id])[0];
1870
+ });
1871
+ }
1872
+ }
1963
1873
  }, {
1964
1874
  key: "getScheduleListByIds",
1965
1875
  value: function getScheduleListByIds(ids) {
@@ -1971,8 +1881,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1971
1881
  }, {
1972
1882
  key: "getTempOrder",
1973
1883
  value: function getTempOrder() {
1974
- var _this$store$order6;
1975
- var result = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder()) || null;
1884
+ var _this$store$order5;
1885
+ var result = ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder()) || null;
1976
1886
  return result;
1977
1887
  }
1978
1888
  }, {
@@ -2031,16 +1941,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2031
1941
  return onCustomerLogin;
2032
1942
  }()
2033
1943
  }, {
2034
- key: "recalculateOrderPricesFromSmartPricing",
2035
- value: function recalculateOrderPricesFromSmartPricing() {
1944
+ key: "recalculateOrderPricesFromQuotation",
1945
+ value: function recalculateOrderPricesFromQuotation() {
2036
1946
  var _tempOrder$products,
2037
- _this9 = this;
2038
- if (!this.store.order) return;
1947
+ _this10 = this;
1948
+ if (!this.store.order || !this.store.quotation) return;
2039
1949
  var tempOrder = this.store.order.getTempOrder();
2040
1950
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
2041
1951
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
2042
- var catalog = this.getAllProductsForSmartPricing();
2043
- var context = this.buildSmartPricingContext();
2044
1952
  var _iterator12 = _createForOfIteratorHelper(tempOrder.products),
2045
1953
  _step12;
2046
1954
  try {
@@ -2048,65 +1956,44 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2048
1956
  var _product$metadata2;
2049
1957
  var product = _step12.value;
2050
1958
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2051
- var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
1959
+ var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2052
1960
  if (!mappings || !mappings.length) return 0; // continue
2053
1961
  var mapping = mappings.find(function (m) {
2054
1962
  return Number(m.productId) === Number(product.product_id);
2055
1963
  }) || mappings[0];
2056
1964
  if (!mapping) return 0; // continue
2057
- var slots = expandMergedSlotToIndividual(product, _this9.store.slotConfig.slotDurationMinutes);
2058
- var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
2059
- return dayjs(slot.startTime).format('YYYY-MM-DD');
2060
- })));
2061
- var slotPriceMaps = new Map();
2062
- var _iterator13 = _createForOfIteratorHelper(uniqueDates),
2063
- _step13;
2064
- try {
2065
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2066
- var slotDate = _step13.value;
2067
- slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
2068
- }
2069
- } catch (err) {
2070
- _iterator13.e(err);
2071
- } finally {
2072
- _iterator13.f();
2073
- }
1965
+ var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
2074
1966
  var updatedSlots = slots.map(function (slot) {
2075
- var slotDate = dayjs(slot.startTime).format('YYYY-MM-DD');
2076
- var slotPriceMap = slotPriceMaps.get(slotDate);
1967
+ var _getPriceForProduct;
2077
1968
  return _objectSpread(_objectSpread({}, slot), {}, {
2078
1969
  productId: mapping.productId,
2079
- price: slotPriceMap ? getSlotPriceFromMap({
2080
- slotPriceMap: slotPriceMap,
1970
+ price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
2081
1971
  productId: mapping.productId,
2082
- slotStartTime: slot.startTime,
2083
- fallbackPrice: mapping.price
2084
- }) : mapping.price
1972
+ datetime: slot.startTime
1973
+ })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
2085
1974
  });
2086
1975
  });
2087
1976
  var merged = mergeConsecutiveSlots(updatedSlots);
2088
1977
  if (merged.length === 1) {
2089
- _this9.resetProductPriceForSmartPricing({
2090
- product: product,
2091
- price: merged[0].totalPrice,
2092
- priceBreakdown: buildPriceBreakdown({
2093
- group: merged[0],
2094
- productId: mapping.productId
2095
- })
1978
+ product.selling_price = merged[0].totalPrice;
1979
+ product.original_price = merged[0].totalPrice;
1980
+ product.metadata.price_breakdown = buildPriceBreakdown({
1981
+ group: merged[0],
1982
+ productId: mapping.productId,
1983
+ quotation: _this10.store.quotation
2096
1984
  });
2097
1985
  }
2098
1986
  } else if (product.product_id != null) {
2099
- var smartPrice = getPriceForProductAtDatetime({
2100
- products: catalog,
2101
- context: context,
2102
- productId: Number(product.product_id),
2103
- datetime: now,
2104
- fallbackPrice: product.selling_price
2105
- });
2106
- _this9.resetProductPriceForSmartPricing({
2107
- product: product,
2108
- price: smartPrice
1987
+ var _product$product_vari;
1988
+ var quotationPrice = _this10.store.quotation.getPriceForProduct({
1989
+ productId: product.product_id,
1990
+ variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
1991
+ datetime: now
2109
1992
  });
1993
+ if (quotationPrice !== null) {
1994
+ product.selling_price = quotationPrice;
1995
+ product.original_price = quotationPrice;
1996
+ }
2110
1997
  }
2111
1998
  },
2112
1999
  _ret;
@@ -2120,30 +2007,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2120
2007
  _iterator12.f();
2121
2008
  }
2122
2009
  }
2123
-
2124
- /**
2125
- * DataVariant 重算价格后,同步刷新订单展示、Rules 与 Summary 共用的价格口径。
2126
- * Rules 会在本轮结束后根据当前客户的 discountList 重新写入实际折扣。
2127
- */
2128
- }, {
2129
- key: "resetProductPriceForSmartPricing",
2130
- value: function resetProductPriceForSmartPricing(params) {
2131
- var product = params.product,
2132
- price = params.price,
2133
- priceBreakdown = params.priceBreakdown;
2134
- var metadata = product.metadata || {};
2135
- product.selling_price = price;
2136
- product.original_price = price;
2137
- product.discount_list = [];
2138
- product.metadata = _objectSpread(_objectSpread(_objectSpread({}, metadata), priceBreakdown ? {
2139
- price_breakdown: priceBreakdown
2140
- } : {}), {}, {
2141
- source_product_price: price,
2142
- main_product_original_price: price,
2143
- main_product_selling_price: price,
2144
- price_schema_version: 2
2145
- });
2146
- }
2147
2010
  }, {
2148
2011
  key: "scanCode",
2149
2012
  value: function () {
@@ -2209,7 +2072,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2209
2072
  key: "setDiscountSelected",
2210
2073
  value: (function () {
2211
2074
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2212
- 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, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2075
+ 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, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2213
2076
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2214
2077
  while (1) switch (_context21.prev = _context21.next) {
2215
2078
  case 0:
@@ -2269,38 +2132,99 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2269
2132
  }).map(function (d) {
2270
2133
  return d.id;
2271
2134
  }));
2272
- _iterator14 = _createForOfIteratorHelper(nextDiscountList);
2135
+ _iterator13 = _createForOfIteratorHelper(nextDiscountList);
2273
2136
  try {
2274
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2275
- d = _step14.value;
2137
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2138
+ d = _step13.value;
2276
2139
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
2277
2140
  d.isSelected = false;
2278
2141
  }
2279
2142
  }
2280
2143
  } catch (err) {
2281
- _iterator14.e(err);
2144
+ _iterator13.e(err);
2282
2145
  } finally {
2283
- _iterator14.f();
2146
+ _iterator13.f();
2284
2147
  }
2285
2148
  }
2286
2149
  }
2287
2150
  }
2288
- this.normalizeDiscountedOrderPrices(nextDiscountList);
2289
- OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2151
+ selectedResourceIds = new Set(nextDiscountList.filter(function (d) {
2152
+ return d.isSelected;
2153
+ }).map(function (d) {
2154
+ return d.id;
2155
+ })); // 无条件归一化:不论 Rules 是否清空 discount_list、长度是否变化,
2156
+ // 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
2157
+ // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2158
+ // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2159
+ _iterator14 = _createForOfIteratorHelper(tempOrder.products);
2160
+ _context21.prev = 19;
2161
+ _iterator14.s();
2162
+ case 21:
2163
+ if ((_step14 = _iterator14.n()).done) {
2164
+ _context21.next = 35;
2165
+ break;
2166
+ }
2167
+ product = _step14.value;
2168
+ if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
2169
+ _context21.next = 25;
2170
+ break;
2171
+ }
2172
+ return _context21.abrupt("continue", 33);
2173
+ case 25:
2174
+ // 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
2175
+ product.discount_list = (product.discount_list || []).filter(function (pd) {
2176
+ var _pd$discount$resource, _pd$discount;
2177
+ var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
2178
+ return rid != null && selectedResourceIds.has(rid);
2179
+ });
2180
+
2181
+ // 2. 以 source_product_price 为券作用基准:券作用于 source(不含 option),
2182
+ // 再把 option 加回得到含 option 的 main_product_selling_price,最后合成 composite。
2183
+ totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2184
+ return sum + (pd.amount || 0);
2185
+ }, 0);
2186
+ optionSum = sumOptionUnitPrice(product.product_option_item);
2187
+ sourcePrice = (_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$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.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';
2188
+ newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2189
+ newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
2190
+ if (product.metadata) {
2191
+ product.metadata.main_product_selling_price = newMainSellingPrice;
2192
+ product.metadata.price_schema_version = 2;
2193
+ }
2194
+ product.selling_price = composeLinePrice({
2195
+ mainPrice: newMainSellingPrice,
2196
+ bundle: product.product_bundle
2197
+ });
2198
+ case 33:
2290
2199
  _context21.next = 21;
2200
+ break;
2201
+ case 35:
2202
+ _context21.next = 40;
2203
+ break;
2204
+ case 37:
2205
+ _context21.prev = 37;
2206
+ _context21.t0 = _context21["catch"](19);
2207
+ _iterator14.e(_context21.t0);
2208
+ case 40:
2209
+ _context21.prev = 40;
2210
+ _iterator14.f();
2211
+ return _context21.finish(40);
2212
+ case 43:
2213
+ OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2214
+ _context21.next = 46;
2291
2215
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2292
- case 21:
2216
+ case 46:
2293
2217
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
2294
2218
  return d.isSelected;
2295
2219
  });
2296
2220
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
2297
2221
  return d.id === params.discountId;
2298
2222
  }) || null;
2299
- _context21.next = 25;
2223
+ _context21.next = 50;
2300
2224
  return this.store.order.recalculateSummary({
2301
2225
  createIfMissing: true
2302
2226
  });
2303
- case 25:
2227
+ case 50:
2304
2228
  this.store.order.persistTempOrder();
2305
2229
  finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
2306
2230
  finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
@@ -2309,78 +2233,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2309
2233
  return d.id === params.discountId;
2310
2234
  }) || null;
2311
2235
  return _context21.abrupt("return", this.store.order.getDiscountList());
2312
- case 33:
2313
- _context21.prev = 33;
2314
- _context21.t0 = _context21["catch"](1);
2315
- this.logMethodError('setDiscountSelected', _context21.t0);
2316
- throw _context21.t0;
2317
- case 37:
2236
+ case 58:
2237
+ _context21.prev = 58;
2238
+ _context21.t1 = _context21["catch"](1);
2239
+ this.logMethodError('setDiscountSelected', _context21.t1);
2240
+ throw _context21.t1;
2241
+ case 62:
2318
2242
  case "end":
2319
2243
  return _context21.stop();
2320
2244
  }
2321
- }, _callee21, this, [[1, 33]]);
2245
+ }, _callee21, this, [[1, 58], [19, 37, 40, 43]]);
2322
2246
  }));
2323
2247
  function setDiscountSelected(_x15) {
2324
2248
  return _setDiscountSelected.apply(this, arguments);
2325
2249
  }
2326
2250
  return setDiscountSelected;
2327
- }()
2328
- /**
2329
- * 统一 VenueBooking 折扣后的订单行价。
2330
- *
2331
- * Rules 的 `discount_list.amount` 是已经按适用规则计算出的每件优惠额;它是这里唯一
2332
- * 的折扣金额来源。使用智能定价写入的 source_product_price 减去该金额,再同步
2333
- * selling_price 与 Summary 使用的 main_product_selling_price,避免 UI 的购物车行价、
2334
- * 小计和提交订单各自读取到不同的价格字段。
2335
- */
2336
- )
2337
- }, {
2338
- key: "normalizeDiscountedOrderPrices",
2339
- value: function normalizeDiscountedOrderPrices(discountList) {
2340
- var order = this.store.order;
2341
- if (!order) return;
2342
- var tempOrder = order.ensureTempOrder();
2343
- var selectedResourceIds = new Set((discountList || []).filter(function (discount) {
2344
- return discount.isSelected;
2345
- }).map(function (discount) {
2346
- return discount.id;
2347
- }));
2348
- var _iterator15 = _createForOfIteratorHelper(tempOrder.products),
2349
- _step15;
2350
- try {
2351
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2352
- var _product$_origin, _metadata$source_prod, _product$original_pri;
2353
- var product = _step15.value;
2354
- // 手动改价商品不参与券流程归一化,保留手工价格。
2355
- if ((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount) continue;
2356
-
2357
- // Rules 可能保留已取消折扣的明细;先使行级明细和当前选择状态一致。
2358
- product.discount_list = (product.discount_list || []).filter(function (detail) {
2359
- var _detail$discount$reso, _detail$discount;
2360
- var resourceId = (_detail$discount$reso = (_detail$discount = detail.discount) === null || _detail$discount === void 0 ? void 0 : _detail$discount.resource_id) !== null && _detail$discount$reso !== void 0 ? _detail$discount$reso : detail.id;
2361
- return resourceId != null && selectedResourceIds.has(resourceId);
2362
- });
2363
- var totalPerUnitDiscount = (product.discount_list || []).reduce(function (total, detail) {
2364
- return total.plus(detail.amount || 0);
2365
- }, new Decimal(0));
2366
- var metadata = product.metadata || (product.metadata = {});
2367
- var optionSum = sumOptionUnitPrice(product.product_option_item);
2368
- var sourcePrice = (_metadata$source_prod = metadata.source_product_price) !== null && _metadata$source_prod !== void 0 ? _metadata$source_prod : metadata.main_product_original_price != null ? new Decimal(Number(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';
2369
- var nextSourceSellingPrice = Decimal.max(0, new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount)).toDecimalPlaces(2).toString();
2370
- var nextMainSellingPrice = new Decimal(Number(nextSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
2371
- metadata.main_product_selling_price = nextMainSellingPrice;
2372
- metadata.price_schema_version = 2;
2373
- product.selling_price = composeLinePrice({
2374
- mainPrice: nextMainSellingPrice,
2375
- bundle: product.product_bundle
2376
- });
2377
- }
2378
- } catch (err) {
2379
- _iterator15.e(err);
2380
- } finally {
2381
- _iterator15.f();
2382
- }
2383
- }
2251
+ }())
2384
2252
  }, {
2385
2253
  key: "addNewOrder",
2386
2254
  value: function () {
@@ -2471,7 +2339,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2471
2339
  key: "submitOrder",
2472
2340
  value: function () {
2473
2341
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2474
- var _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21, _tempOrder$products2, result, tempOrder;
2342
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _tempOrder$products2, result, tempOrder;
2475
2343
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2476
2344
  while (1) switch (_context24.prev = _context24.next) {
2477
2345
  case 0:
@@ -2489,10 +2357,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2489
2357
  _context24.next = 8;
2490
2358
  return this.store.order.submitTempOrder({
2491
2359
  cacheId: this.cacheId,
2492
- platform: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.platform,
2493
- businessCode: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.businessCode,
2494
- channel: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.channel,
2495
- type: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.type
2360
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
2361
+ businessCode: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode,
2362
+ channel: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.channel,
2363
+ type: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type
2496
2364
  });
2497
2365
  case 8:
2498
2366
  result = _context24.sent;
@@ -2568,7 +2436,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2568
2436
  key: "addProductToOrder",
2569
2437
  value: function () {
2570
2438
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2571
- var _product$metadata3, _product$metadata4, smartPrice, products;
2439
+ var _product$metadata5, _product$product_vari2, quotationPrice, products;
2572
2440
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2573
2441
  while (1) switch (_context26.prev = _context26.next) {
2574
2442
  case 0:
@@ -2583,18 +2451,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2583
2451
  }
2584
2452
  throw new Error('order 模块未初始化');
2585
2453
  case 4:
2586
- if (!((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) && product.product_id != null) {
2587
- smartPrice = getPriceForProductAtDatetime({
2588
- products: this.getAllProductsForSmartPricing(),
2589
- context: this.buildSmartPricingContext(),
2590
- productId: Number(product.product_id),
2591
- datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
2592
- fallbackPrice: product.selling_price
2454
+ if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
2455
+ quotationPrice = this.store.quotation.getPriceForProduct({
2456
+ productId: product.product_id,
2457
+ variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
2458
+ datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2593
2459
  });
2594
- product.selling_price = smartPrice;
2595
- product.original_price = smartPrice;
2596
- } else if (product.selling_price != null && !((_product$metadata4 = product.metadata) !== null && _product$metadata4 !== void 0 && _product$metadata4.venue_booking)) {
2597
- product.original_price = product.selling_price;
2460
+ if (quotationPrice !== null) {
2461
+ product.selling_price = quotationPrice;
2462
+ product.original_price = quotationPrice;
2463
+ } else if (product.selling_price != null) {
2464
+ product.original_price = product.selling_price;
2465
+ }
2598
2466
  }
2599
2467
  _context26.next = 7;
2600
2468
  return this.store.order.addProductToOrder(product);
@@ -2679,7 +2547,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2679
2547
  key: "removeProductFromOrder",
2680
2548
  value: function () {
2681
2549
  var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2682
- var _this$store$order$get3, _this$store$order7, _this$store$order$ens, _this$store$order8, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata5, _product$metadata6, product, beforeBookingCount, _this$store$order$per, _this$store$order9;
2550
+ var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator15, _step15, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order8;
2683
2551
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2684
2552
  while (1) switch (_context28.prev = _context28.next) {
2685
2553
  case 0:
@@ -2694,7 +2562,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2694
2562
  }
2695
2563
  throw new Error('order 模块未初始化');
2696
2564
  case 4:
2697
- tempOrder = ((_this$store$order$get3 = (_this$store$order7 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order7)) || ((_this$store$order$ens = (_this$store$order8 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order8));
2565
+ tempOrder = ((_this$store$order$get3 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6)) || ((_this$store$order$ens = (_this$store$order7 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order7));
2698
2566
  _context28.next = 7;
2699
2567
  return this.store.order.removeProductFromOrder(identity);
2700
2568
  case 7:
@@ -2705,23 +2573,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2705
2573
  }
2706
2574
  venueProductUids = new Set();
2707
2575
  venueBookingUids = new Set();
2708
- _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2576
+ _iterator15 = _createForOfIteratorHelper(tempOrder.products || []);
2709
2577
  _context28.prev = 12;
2710
- _iterator16.s();
2578
+ _iterator15.s();
2711
2579
  case 14:
2712
- if ((_step16 = _iterator16.n()).done) {
2580
+ if ((_step15 = _iterator15.n()).done) {
2713
2581
  _context28.next = 22;
2714
2582
  break;
2715
2583
  }
2716
- product = _step16.value;
2717
- if (product !== null && product !== void 0 && (_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) {
2584
+ product = _step15.value;
2585
+ if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
2718
2586
  _context28.next = 18;
2719
2587
  break;
2720
2588
  }
2721
2589
  return _context28.abrupt("continue", 20);
2722
2590
  case 18:
2723
2591
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2724
- if ((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.booking_uid) {
2592
+ if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2725
2593
  venueBookingUids.add(String(product.metadata.booking_uid));
2726
2594
  }
2727
2595
  case 20:
@@ -2733,10 +2601,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2733
2601
  case 24:
2734
2602
  _context28.prev = 24;
2735
2603
  _context28.t0 = _context28["catch"](12);
2736
- _iterator16.e(_context28.t0);
2604
+ _iterator15.e(_context28.t0);
2737
2605
  case 27:
2738
2606
  _context28.prev = 27;
2739
- _iterator16.f();
2607
+ _iterator15.f();
2740
2608
  return _context28.finish(27);
2741
2609
  case 30:
2742
2610
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
@@ -2751,7 +2619,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2751
2619
  return true;
2752
2620
  });
2753
2621
  if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
2754
- (_this$store$order$per = (_this$store$order9 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order9);
2622
+ (_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
2755
2623
  }
2756
2624
  case 33:
2757
2625
  _context28.next = 35;
@@ -2984,17 +2852,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2984
2852
  if (visited.has(value)) return;
2985
2853
  visited.add(value);
2986
2854
  if (Array.isArray(value)) {
2987
- var _iterator17 = _createForOfIteratorHelper(value),
2988
- _step17;
2855
+ var _iterator16 = _createForOfIteratorHelper(value),
2856
+ _step16;
2989
2857
  try {
2990
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
2991
- var item = _step17.value;
2858
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
2859
+ var item = _step16.value;
2992
2860
  collectFromValue(item);
2993
2861
  }
2994
2862
  } catch (err) {
2995
- _iterator17.e(err);
2863
+ _iterator16.e(err);
2996
2864
  } finally {
2997
- _iterator17.f();
2865
+ _iterator16.f();
2998
2866
  }
2999
2867
  return;
3000
2868
  }
@@ -3042,7 +2910,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3042
2910
  key: "ensureItemRuleConfigsLoaded",
3043
2911
  value: function () {
3044
2912
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3045
- var _this10 = this;
2913
+ var _this11 = this;
3046
2914
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3047
2915
  while (1) switch (_context35.prev = _context35.next) {
3048
2916
  case 0:
@@ -3063,19 +2931,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3063
2931
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3064
2932
  while (1) switch (_context34.prev = _context34.next) {
3065
2933
  case 0:
3066
- runtimeConfig = _this10.getItemRuleRuntimeConfig();
2934
+ runtimeConfig = _this11.getItemRuleRuntimeConfig();
3067
2935
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3068
2936
  if (!(staticConfigs.length > 0)) {
3069
2937
  _context34.next = 6;
3070
2938
  break;
3071
2939
  }
3072
- _this10.itemRuleConfigs = staticConfigs;
3073
- _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3074
- return _context34.abrupt("return", _this10.itemRuleConfigs);
2940
+ _this11.itemRuleConfigs = staticConfigs;
2941
+ _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2942
+ return _context34.abrupt("return", _this11.itemRuleConfigs);
3075
2943
  case 6:
3076
- _this10.itemRuleConfigs = [];
3077
- _this10.itemRuleEvaluator.setStrategyConfigs([]);
3078
- return _context34.abrupt("return", _this10.itemRuleConfigs);
2944
+ _this11.itemRuleConfigs = [];
2945
+ _this11.itemRuleEvaluator.setStrategyConfigs([]);
2946
+ return _context34.abrupt("return", _this11.itemRuleConfigs);
3079
2947
  case 9:
3080
2948
  case "end":
3081
2949
  return _context34.stop();
@@ -3149,7 +3017,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3149
3017
  key: "applyPrefillByItemRule",
3150
3018
  value: function () {
3151
3019
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3152
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3020
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator17, _step17, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3153
3021
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3154
3022
  while (1) switch (_context37.prev = _context37.next) {
3155
3023
  case 0:
@@ -3194,15 +3062,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3194
3062
  productSourceMap = _context37.sent;
3195
3063
  tempOrder = this.ensureTempOrder();
3196
3064
  hasChanges = false;
3197
- _iterator18 = _createForOfIteratorHelper(prefillItems);
3065
+ _iterator17 = _createForOfIteratorHelper(prefillItems);
3198
3066
  _context37.prev = 20;
3199
- _iterator18.s();
3067
+ _iterator17.s();
3200
3068
  case 22:
3201
- if ((_step18 = _iterator18.n()).done) {
3069
+ if ((_step17 = _iterator17.n()).done) {
3202
3070
  _context37.next = 45;
3203
3071
  break;
3204
3072
  }
3205
- prefillItem = _step18.value;
3073
+ prefillItem = _step17.value;
3206
3074
  productId = Number(prefillItem.product_id);
3207
3075
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3208
3076
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -3271,10 +3139,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3271
3139
  case 47:
3272
3140
  _context37.prev = 47;
3273
3141
  _context37.t0 = _context37["catch"](20);
3274
- _iterator18.e(_context37.t0);
3142
+ _iterator17.e(_context37.t0);
3275
3143
  case 50:
3276
3144
  _context37.prev = 50;
3277
- _iterator18.f();
3145
+ _iterator17.f();
3278
3146
  return _context37.finish(50);
3279
3147
  case 53:
3280
3148
  if (!hasChanges) {
@@ -3536,7 +3404,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3536
3404
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3537
3405
  var parsed = JSON.parse(raw);
3538
3406
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3539
- } catch (_unused4) {
3407
+ } catch (_unused3) {
3540
3408
  return {};
3541
3409
  }
3542
3410
  }
@@ -3648,5 +3516,4 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3648
3516
  return VenueBookingImpl;
3649
3517
  }(BaseModule);
3650
3518
  _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3651
- _defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
3652
3519
  _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');