@pisell/pisellos 0.0.557 → 0.0.559

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 (63) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +3 -0
  3. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  4. package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
  5. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  6. package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
  7. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  8. package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
  9. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  10. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  11. package/dist/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  12. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  13. package/dist/model/strategy/adapter/index.d.ts +4 -0
  14. package/dist/model/strategy/adapter/index.js +5 -1
  15. package/dist/modules/Order/index.d.ts +1 -1
  16. package/dist/modules/ProductList/index.d.ts +2 -1
  17. package/dist/modules/ProductList/index.js +21 -11
  18. package/dist/solution/BookingByStep/index.d.ts +1 -1
  19. package/dist/solution/BookingTicket/index.d.ts +1 -1
  20. package/dist/solution/ScanOrder/index.d.ts +1 -1
  21. package/dist/solution/ScanOrder/index.js +33 -32
  22. package/dist/solution/VenueBooking/index.d.ts +22 -3
  23. package/dist/solution/VenueBooking/index.js +261 -167
  24. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  25. package/dist/solution/VenueBooking/utils/dateSummary.js +12 -25
  26. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
  27. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -9
  28. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +69 -0
  29. package/dist/solution/VenueBooking/utils/smartPricing.js +233 -0
  30. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
  31. package/dist/solution/VenueBooking/utils/timeSlot.js +9 -4
  32. package/lib/index.d.ts +1 -0
  33. package/lib/index.js +3 -0
  34. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  35. package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
  36. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  37. package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
  38. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  39. package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
  40. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  41. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  42. package/lib/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  43. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  44. package/lib/model/strategy/adapter/index.d.ts +4 -0
  45. package/lib/model/strategy/adapter/index.js +13 -2
  46. package/lib/modules/Order/index.d.ts +1 -1
  47. package/lib/modules/ProductList/index.d.ts +2 -1
  48. package/lib/modules/ProductList/index.js +45 -40
  49. package/lib/solution/BookingByStep/index.d.ts +1 -1
  50. package/lib/solution/BookingTicket/index.d.ts +1 -1
  51. package/lib/solution/ScanOrder/index.d.ts +1 -1
  52. package/lib/solution/ScanOrder/index.js +2 -1
  53. package/lib/solution/VenueBooking/index.d.ts +22 -3
  54. package/lib/solution/VenueBooking/index.js +152 -63
  55. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  56. package/lib/solution/VenueBooking/utils/dateSummary.js +5 -10
  57. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
  58. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -4
  59. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +69 -0
  60. package/lib/solution/VenueBooking/utils/smartPricing.js +180 -0
  61. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
  62. package/lib/solution/VenueBooking/utils/timeSlot.js +7 -3
  63. package/package.json +1 -1
@@ -45,6 +45,7 @@ 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";
48
49
  import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
49
50
  import { OrderModule } from "../../modules/Order";
50
51
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
@@ -103,6 +104,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
103
104
  _defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
104
105
  _defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
105
106
  _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", []);
106
111
  return _this;
107
112
  }
108
113
  _createClass(VenueBookingImpl, [{
@@ -496,43 +501,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
496
501
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
497
502
  while (1) switch (_context5.prev = _context5.next) {
498
503
  case 0:
504
+ _this3.clearSlotPriceMapCache();
505
+ _this3.recalculateOrderPricesFromSmartPricing();
506
+ // 刷新 holder 表单数据
499
507
  if (!_this3.store.holder) {
500
- _context5.next = 3;
508
+ _context5.next = 5;
501
509
  break;
502
510
  }
503
- _context5.next = 3;
511
+ _context5.next = 5;
504
512
  return _this3.store.holder.refreshAllFormRecords({
505
513
  customer_id: params.customerId,
506
514
  useCache: false
507
515
  });
508
- case 3:
516
+ case 5:
509
517
  if (!_this3.store.quotation) {
510
- _context5.next = 6;
518
+ _context5.next = 8;
511
519
  break;
512
520
  }
513
- _context5.next = 6;
521
+ _context5.next = 8;
514
522
  return _this3.store.quotation.loadQuotations({
515
523
  channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
516
524
  });
517
- case 6:
518
- _this3.recalculateOrderPricesFromQuotation();
519
- _context5.next = 9;
525
+ case 8:
526
+ _context5.next = 10;
520
527
  return _this3.store.order.loadDiscountConfig({
521
528
  customerId: params.customerId
522
529
  });
523
- case 9:
524
- _context5.next = 11;
530
+ case 10:
531
+ _context5.next = 12;
525
532
  return _this3.store.order.recalculateSummary({
526
533
  createIfMissing: true
527
534
  });
528
- case 11:
535
+ case 12:
529
536
  _this3.store.order.persistTempOrder();
530
- _context5.next = 14;
537
+ _context5.next = 15;
531
538
  return _this3.refreshItemRuleQuantityLimits();
532
- case 14:
533
- _context5.next = 16;
539
+ case 15:
540
+ _context5.next = 17;
534
541
  return _this3.refreshCartValidationPassed();
535
- case 16:
542
+ case 17:
536
543
  case "end":
537
544
  return _context5.stop();
538
545
  }
@@ -597,8 +604,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
597
604
  holderModule,
598
605
  _this$store$order,
599
606
  _this$store$order2,
600
- _this$store$quotation,
601
- _this$otherParams9,
602
607
  _args7 = arguments;
603
608
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
604
609
  while (1) switch (_context7.prev = _context7.next) {
@@ -769,34 +774,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
769
774
  return this.loadRuntimeConfigs();
770
775
  case 60:
771
776
  if (!this.store.schedule) {
772
- _context7.next = 65;
777
+ _context7.next = 63;
773
778
  break;
774
779
  }
775
780
  _context7.next = 63;
776
781
  return this.store.schedule.loadAllSchedule();
777
782
  case 63:
778
- this.injectScheduleResolverToQuotation();
779
- (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
780
- channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel
781
- });
782
- case 65:
783
- _context7.next = 67;
783
+ _context7.next = 65;
784
784
  return this.refreshItemRuleQuantityLimits();
785
- case 67:
785
+ case 65:
786
786
  this.store.status = 'ready';
787
787
  console.log('[VenueBooking] 初始化完成');
788
- _context7.next = 71;
788
+ _context7.next = 69;
789
789
  return this.core.effects.emit(VenueBookingHooks.onInited, {
790
790
  status: this.store.status
791
791
  });
792
- case 71:
792
+ case 69:
793
793
  this.logMethodSuccess('initialize', {
794
794
  status: this.store.status
795
795
  });
796
- _context7.next = 81;
796
+ _context7.next = 79;
797
797
  break;
798
- case 74:
799
- _context7.prev = 74;
798
+ case 72:
799
+ _context7.prev = 72;
800
800
  _context7.t0 = _context7["catch"](54);
801
801
  this.store.status = 'error';
802
802
  this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
@@ -805,11 +805,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
805
805
  status: this.store.status
806
806
  });
807
807
  throw _context7.t0;
808
- case 81:
808
+ case 79:
809
809
  case "end":
810
810
  return _context7.stop();
811
811
  }
812
- }, _callee7, this, [[54, 74]]);
812
+ }, _callee7, this, [[54, 72]]);
813
813
  }));
814
814
  function initialize(_x6) {
815
815
  return _initialize.apply(this, arguments);
@@ -950,6 +950,96 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
950
950
  };
951
951
  }
952
952
 
953
+ /** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
954
+ }, {
955
+ key: "clearSlotPriceMapCache",
956
+ value: function clearSlotPriceMapCache() {
957
+ this.slotPriceMapCache.clear();
958
+ }
959
+
960
+ /** 读取当前登录 customerId */
961
+ }, {
962
+ key: "resolveCustomerIdForSmartPricing",
963
+ value: function resolveCustomerIdForSmartPricing() {
964
+ try {
965
+ var _this$core4, _userPlugin$get;
966
+ var userPlugin = (_this$core4 = this.core) === null || _this$core4 === void 0 ? void 0 : _this$core4.getPlugin('user');
967
+ 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);
968
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
969
+ } catch (_unused3) {
970
+ return undefined;
971
+ }
972
+ }
973
+
974
+ /** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
975
+ }, {
976
+ key: "getScheduleListForSmartPricing",
977
+ value: function getScheduleListForSmartPricing() {
978
+ var _store;
979
+ var scheduleModule = this.store.schedule;
980
+ var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
981
+ return Array.isArray(list) ? list : [];
982
+ }
983
+
984
+ /** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
985
+ }, {
986
+ key: "buildSmartPricingContext",
987
+ value: function buildSmartPricingContext(customerId) {
988
+ var _this$core5, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15;
989
+ var evaluator = (_this$core5 = this.core) === null || _this$core5 === void 0 || (_this$core5 = _this$core5.context) === null || _this$core5 === void 0 ? void 0 : _this$core5.dataVariantEvaluator;
990
+ return {
991
+ evaluator: evaluator,
992
+ scheduleList: this.getScheduleListForSmartPricing(),
993
+ menuList: ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.menuList) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.openData) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.menuList) || [],
994
+ customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
995
+ channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
996
+ businessCode: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
997
+ orderType: ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.orderType) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type),
998
+ strategy_context: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.strategy_context
999
+ };
1000
+ }
1001
+
1002
+ /** venue + addon 全量商品,供智能定价评估 */
1003
+ }, {
1004
+ key: "getAllProductsForSmartPricing",
1005
+ value: function getAllProductsForSmartPricing() {
1006
+ if (this.smartPricingProductCatalog.length) {
1007
+ return this.smartPricingProductCatalog;
1008
+ }
1009
+ var venueList = this.getVenueProducts();
1010
+ var addonList = this.getAddonProductsList();
1011
+ return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
1012
+ }
1013
+ }, {
1014
+ key: "getSlotPriceMapCacheKey",
1015
+ value: function getSlotPriceMapCacheKey(date, context) {
1016
+ var _context$customerId, _context$channel, _context$businessCode;
1017
+ return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
1018
+ }
1019
+
1020
+ /**
1021
+ * 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
1022
+ */
1023
+ }, {
1024
+ key: "buildSlotPriceMapForDate",
1025
+ value: function buildSlotPriceMapForDate(date, config, productIds) {
1026
+ var context = this.buildSmartPricingContext();
1027
+ var cacheKey = this.getSlotPriceMapCacheKey(date, context);
1028
+ var cached = this.slotPriceMapCache.get(cacheKey);
1029
+ if (cached) return cached;
1030
+ var timeLabels = generateTimeLabels(config);
1031
+ var slotPriceMap = buildSlotPriceMapByScheduleSegments({
1032
+ products: this.getAllProductsForSmartPricing(),
1033
+ productIds: productIds,
1034
+ date: date,
1035
+ timeLabels: timeLabels,
1036
+ config: config,
1037
+ context: context
1038
+ });
1039
+ this.slotPriceMapCache.set(cacheKey, slotPriceMap);
1040
+ return slotPriceMap;
1041
+ }
1042
+
953
1043
  // ─── 场地商品 & 附加商品 ───
954
1044
  }, {
955
1045
  key: "loadAllProducts",
@@ -984,7 +1074,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
984
1074
  key: "_doLoadAllProducts",
985
1075
  value: function () {
986
1076
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
987
- var _this$otherParams10, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
1077
+ var _this$otherParams16, _this$store$venueProd, associatedMenus, menuListIds, allProducts, rawList, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
988
1078
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
989
1079
  while (1) switch (_context12.prev = _context12.next) {
990
1080
  case 0:
@@ -1005,7 +1095,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1005
1095
  _context12.next = 8;
1006
1096
  return this.loadOpenDataConfig();
1007
1097
  case 8:
1008
- associatedMenus = ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.openData) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10['menu.associated_menus']) || [];
1098
+ associatedMenus = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16['menu.associated_menus']) || [];
1009
1099
  if (associatedMenus.length) {
1010
1100
  _context12.next = 12;
1011
1101
  break;
@@ -1021,11 +1111,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1021
1111
  menu_list_ids: menuListIds,
1022
1112
  cacheId: this.cacheId,
1023
1113
  schedule_date: dayjs().format('YYYY-MM-DD'),
1024
- schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1114
+ schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
1115
+ with_extra: ['dataVariants']
1025
1116
  });
1026
1117
  case 15:
1027
1118
  allProducts = _context12.sent;
1028
- list = Array.isArray(allProducts) ? allProducts : [];
1119
+ rawList = Array.isArray(allProducts) ? allProducts : [];
1120
+ list = rawList;
1121
+ this.smartPricingProductCatalog = rawList.slice();
1122
+ list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
1123
+ this.clearSlotPriceMapCache();
1029
1124
  venueList = list.filter(function (p) {
1030
1125
  return p.duration != null;
1031
1126
  });
@@ -1043,13 +1138,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1043
1138
 
1044
1139
  // 加载 holder 表单
1045
1140
  if (!this.store.order) {
1046
- _context12.next = 27;
1141
+ _context12.next = 31;
1047
1142
  break;
1048
1143
  }
1049
1144
  products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
1050
- _context12.next = 27;
1145
+ _context12.next = 31;
1051
1146
  return this.preloadHolderForms(products);
1052
- case 27:
1147
+ case 31:
1053
1148
  this.productsLoaded = true;
1054
1149
  this.logMethodSuccess('loadAllProducts', {
1055
1150
  total: list.length,
@@ -1061,16 +1156,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1061
1156
  venueProducts: venueList,
1062
1157
  addonProducts: addonList
1063
1158
  });
1064
- case 32:
1065
- _context12.prev = 32;
1159
+ case 36:
1160
+ _context12.prev = 36;
1066
1161
  _context12.t0 = _context12["catch"](1);
1067
1162
  this.logMethodError('loadAllProducts', _context12.t0);
1068
1163
  throw _context12.t0;
1069
- case 36:
1164
+ case 40:
1070
1165
  case "end":
1071
1166
  return _context12.stop();
1072
1167
  }
1073
- }, _callee12, this, [[1, 32]]);
1168
+ }, _callee12, this, [[1, 36]]);
1074
1169
  }));
1075
1170
  function _doLoadAllProducts() {
1076
1171
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1389,9 +1484,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1389
1484
  config: this.baseSlotConfig,
1390
1485
  rawResources: this.store.rawResourceData,
1391
1486
  resourceProductMap: this.resourceProductMap,
1392
- quotationModule: this.store.quotation,
1393
1487
  resolveConfig: function resolveConfig(date) {
1394
1488
  return _this6.resolveSlotConfigForDate(date);
1489
+ },
1490
+ buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
1491
+ return _this6.buildSlotPriceMapForDate(date, config, productIds);
1395
1492
  }
1396
1493
  });
1397
1494
  }
@@ -1399,26 +1496,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1399
1496
  key: "getTimeSlotGrid",
1400
1497
  value: function getTimeSlotGrid(date) {
1401
1498
  var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1402
- var quotationPriceMap;
1403
- if (this.store.quotation) {
1404
- var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1405
- return m.productId;
1406
- })));
1407
- var timeLabels = generateTimeLabels(resolvedSlotConfig);
1408
- var timePoints = timeLabels.map(function (label) {
1409
- return "".concat(date, " ").concat(label);
1410
- });
1411
- quotationPriceMap = this.store.quotation.buildProductPriceMap({
1412
- productIds: productIds,
1413
- timePoints: timePoints
1414
- });
1415
- }
1499
+ var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1500
+ return m.productId;
1501
+ })));
1502
+ var slotPriceMap = productIds.length ? this.buildSlotPriceMapForDate(date, resolvedSlotConfig, productIds) : undefined;
1416
1503
  return buildTimeSlotGrid({
1417
1504
  date: date,
1418
1505
  config: resolvedSlotConfig,
1419
1506
  rawResources: this.store.rawResourceData,
1420
1507
  resourceProductMap: this.resourceProductMap,
1421
- quotationPriceMap: quotationPriceMap
1508
+ slotPriceMap: slotPriceMap
1422
1509
  });
1423
1510
  }
1424
1511
 
@@ -1855,8 +1942,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1855
1942
  booking_uid: bookingUuid,
1856
1943
  price_breakdown: buildPriceBreakdown({
1857
1944
  group: group,
1858
- productId: mapping.productId,
1859
- quotation: this.store.quotation
1945
+ productId: mapping.productId
1860
1946
  })
1861
1947
  },
1862
1948
  _origin: {
@@ -1996,36 +2082,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1996
2082
  _context19.next = 6;
1997
2083
  return this.store.schedule.loadAllSchedule();
1998
2084
  case 6:
1999
- this.injectScheduleResolverToQuotation();
2000
2085
  this.logMethodSuccess('loadSchedules');
2001
- _context19.next = 14;
2086
+ _context19.next = 13;
2002
2087
  break;
2003
- case 10:
2004
- _context19.prev = 10;
2088
+ case 9:
2089
+ _context19.prev = 9;
2005
2090
  _context19.t0 = _context19["catch"](1);
2006
2091
  this.logMethodError('loadSchedules', _context19.t0);
2007
2092
  throw _context19.t0;
2008
- case 14:
2093
+ case 13:
2009
2094
  case "end":
2010
2095
  return _context19.stop();
2011
2096
  }
2012
- }, _callee19, this, [[1, 10]]);
2097
+ }, _callee19, this, [[1, 9]]);
2013
2098
  }));
2014
2099
  function loadSchedules() {
2015
2100
  return _loadSchedules.apply(this, arguments);
2016
2101
  }
2017
2102
  return loadSchedules;
2018
2103
  }()
2019
- }, {
2020
- key: "injectScheduleResolverToQuotation",
2021
- value: function injectScheduleResolverToQuotation() {
2022
- var _this9 = this;
2023
- if (this.store.quotation && this.store.schedule) {
2024
- this.store.quotation.setScheduleResolver(function (id) {
2025
- return _this9.store.schedule.getScheduleListByIds([id])[0];
2026
- });
2027
- }
2028
- }
2029
2104
  }, {
2030
2105
  key: "getScheduleListByIds",
2031
2106
  value: function getScheduleListByIds(ids) {
@@ -2097,14 +2172,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2097
2172
  return onCustomerLogin;
2098
2173
  }()
2099
2174
  }, {
2100
- key: "recalculateOrderPricesFromQuotation",
2101
- value: function recalculateOrderPricesFromQuotation() {
2175
+ key: "recalculateOrderPricesFromSmartPricing",
2176
+ value: function recalculateOrderPricesFromSmartPricing() {
2102
2177
  var _tempOrder$products,
2103
- _this10 = this;
2104
- if (!this.store.order || !this.store.quotation) return;
2178
+ _this9 = this;
2179
+ if (!this.store.order) return;
2105
2180
  var tempOrder = this.store.order.getTempOrder();
2106
2181
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
2107
2182
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
2183
+ var catalog = this.getAllProductsForSmartPricing();
2184
+ var context = this.buildSmartPricingContext();
2108
2185
  var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
2109
2186
  _step13;
2110
2187
  try {
@@ -2112,21 +2189,40 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2112
2189
  var _product$metadata2;
2113
2190
  var product = _step13.value;
2114
2191
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2115
- var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2192
+ var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
2116
2193
  if (!mappings || !mappings.length) return 0; // continue
2117
2194
  var mapping = mappings.find(function (m) {
2118
2195
  return Number(m.productId) === Number(product.product_id);
2119
2196
  }) || mappings[0];
2120
2197
  if (!mapping) return 0; // continue
2121
- var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
2198
+ var slots = expandMergedSlotToIndividual(product, _this9.store.slotConfig.slotDurationMinutes);
2199
+ var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
2200
+ return dayjs(slot.startTime).format('YYYY-MM-DD');
2201
+ })));
2202
+ var slotPriceMaps = new Map();
2203
+ var _iterator14 = _createForOfIteratorHelper(uniqueDates),
2204
+ _step14;
2205
+ try {
2206
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2207
+ var slotDate = _step14.value;
2208
+ slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
2209
+ }
2210
+ } catch (err) {
2211
+ _iterator14.e(err);
2212
+ } finally {
2213
+ _iterator14.f();
2214
+ }
2122
2215
  var updatedSlots = slots.map(function (slot) {
2123
- var _getPriceForProduct;
2216
+ var slotDate = dayjs(slot.startTime).format('YYYY-MM-DD');
2217
+ var slotPriceMap = slotPriceMaps.get(slotDate);
2124
2218
  return _objectSpread(_objectSpread({}, slot), {}, {
2125
2219
  productId: mapping.productId,
2126
- price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
2220
+ price: slotPriceMap ? getSlotPriceFromMap({
2221
+ slotPriceMap: slotPriceMap,
2127
2222
  productId: mapping.productId,
2128
- datetime: slot.startTime
2129
- })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
2223
+ slotStartTime: slot.startTime,
2224
+ fallbackPrice: mapping.price
2225
+ }) : mapping.price
2130
2226
  });
2131
2227
  });
2132
2228
  var merged = mergeConsecutiveSlots(updatedSlots);
@@ -2135,21 +2231,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2135
2231
  product.original_price = merged[0].totalPrice;
2136
2232
  product.metadata.price_breakdown = buildPriceBreakdown({
2137
2233
  group: merged[0],
2138
- productId: mapping.productId,
2139
- quotation: _this10.store.quotation
2234
+ productId: mapping.productId
2140
2235
  });
2141
2236
  }
2142
2237
  } else if (product.product_id != null) {
2143
- var _product$product_vari;
2144
- var quotationPrice = _this10.store.quotation.getPriceForProduct({
2145
- productId: product.product_id,
2146
- variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
2147
- datetime: now
2148
- });
2149
- if (quotationPrice !== null) {
2150
- product.selling_price = quotationPrice;
2151
- product.original_price = quotationPrice;
2152
- }
2238
+ var smartPrice = getPriceForProductAtDatetime({
2239
+ products: catalog,
2240
+ context: context,
2241
+ productId: Number(product.product_id),
2242
+ datetime: now,
2243
+ fallbackPrice: product.selling_price
2244
+ });
2245
+ product.selling_price = smartPrice;
2246
+ product.original_price = smartPrice;
2153
2247
  }
2154
2248
  },
2155
2249
  _ret;
@@ -2228,7 +2322,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2228
2322
  key: "setDiscountSelected",
2229
2323
  value: (function () {
2230
2324
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2231
- 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, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2325
+ 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, _iterator15, _step15, d, selectedResourceIds, _iterator16, _step16, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2232
2326
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2233
2327
  while (1) switch (_context22.prev = _context22.next) {
2234
2328
  case 0:
@@ -2288,18 +2382,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2288
2382
  }).map(function (d) {
2289
2383
  return d.id;
2290
2384
  }));
2291
- _iterator14 = _createForOfIteratorHelper(nextDiscountList);
2385
+ _iterator15 = _createForOfIteratorHelper(nextDiscountList);
2292
2386
  try {
2293
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2294
- d = _step14.value;
2387
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2388
+ d = _step15.value;
2295
2389
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
2296
2390
  d.isSelected = false;
2297
2391
  }
2298
2392
  }
2299
2393
  } catch (err) {
2300
- _iterator14.e(err);
2394
+ _iterator15.e(err);
2301
2395
  } finally {
2302
- _iterator14.f();
2396
+ _iterator15.f();
2303
2397
  }
2304
2398
  }
2305
2399
  }
@@ -2312,15 +2406,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2312
2406
  // 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
2313
2407
  // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2314
2408
  // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2315
- _iterator15 = _createForOfIteratorHelper(tempOrder.products);
2409
+ _iterator16 = _createForOfIteratorHelper(tempOrder.products);
2316
2410
  _context22.prev = 19;
2317
- _iterator15.s();
2411
+ _iterator16.s();
2318
2412
  case 21:
2319
- if ((_step15 = _iterator15.n()).done) {
2413
+ if ((_step16 = _iterator16.n()).done) {
2320
2414
  _context22.next = 35;
2321
2415
  break;
2322
2416
  }
2323
- product = _step15.value;
2417
+ product = _step16.value;
2324
2418
  if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
2325
2419
  _context22.next = 25;
2326
2420
  break;
@@ -2360,10 +2454,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2360
2454
  case 37:
2361
2455
  _context22.prev = 37;
2362
2456
  _context22.t0 = _context22["catch"](19);
2363
- _iterator15.e(_context22.t0);
2457
+ _iterator16.e(_context22.t0);
2364
2458
  case 40:
2365
2459
  _context22.prev = 40;
2366
- _iterator15.f();
2460
+ _iterator16.f();
2367
2461
  return _context22.finish(40);
2368
2462
  case 43:
2369
2463
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
@@ -2495,7 +2589,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2495
2589
  key: "submitOrder",
2496
2590
  value: function () {
2497
2591
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2498
- var _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _tempOrder$products2, result, tempOrder;
2592
+ var _this$otherParams17, _this$otherParams18, _this$otherParams19, _this$otherParams20, _tempOrder$products2, result, tempOrder;
2499
2593
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2500
2594
  while (1) switch (_context25.prev = _context25.next) {
2501
2595
  case 0:
@@ -2513,10 +2607,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2513
2607
  _context25.next = 8;
2514
2608
  return this.store.order.submitTempOrder({
2515
2609
  cacheId: this.cacheId,
2516
- platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
2517
- businessCode: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
2518
- channel: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel,
2519
- type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type
2610
+ platform: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform,
2611
+ businessCode: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
2612
+ channel: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.channel,
2613
+ type: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type
2520
2614
  });
2521
2615
  case 8:
2522
2616
  result = _context25.sent;
@@ -2545,7 +2639,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2545
2639
  key: "addProductToOrder",
2546
2640
  value: function () {
2547
2641
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2548
- var _product$metadata5, _product$product_vari2, quotationPrice, products;
2642
+ var _product$metadata5, _product$metadata6, smartPrice, products;
2549
2643
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2550
2644
  while (1) switch (_context26.prev = _context26.next) {
2551
2645
  case 0:
@@ -2560,18 +2654,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2560
2654
  }
2561
2655
  throw new Error('order 模块未初始化');
2562
2656
  case 4:
2563
- if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
2564
- quotationPrice = this.store.quotation.getPriceForProduct({
2565
- productId: product.product_id,
2566
- variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
2567
- datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2657
+ if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && product.product_id != null) {
2658
+ smartPrice = getPriceForProductAtDatetime({
2659
+ products: this.getAllProductsForSmartPricing(),
2660
+ context: this.buildSmartPricingContext(),
2661
+ productId: Number(product.product_id),
2662
+ datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
2663
+ fallbackPrice: product.selling_price
2568
2664
  });
2569
- if (quotationPrice !== null) {
2570
- product.selling_price = quotationPrice;
2571
- product.original_price = quotationPrice;
2572
- } else if (product.selling_price != null) {
2573
- product.original_price = product.selling_price;
2574
- }
2665
+ product.selling_price = smartPrice;
2666
+ product.original_price = smartPrice;
2667
+ } else if (product.selling_price != null && !((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking)) {
2668
+ product.original_price = product.selling_price;
2575
2669
  }
2576
2670
  _context26.next = 7;
2577
2671
  return this.store.order.addProductToOrder(product);
@@ -2656,7 +2750,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2656
2750
  key: "removeProductFromOrder",
2657
2751
  value: function () {
2658
2752
  var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2659
- var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2753
+ var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2660
2754
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2661
2755
  while (1) switch (_context28.prev = _context28.next) {
2662
2756
  case 0:
@@ -2682,23 +2776,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2682
2776
  }
2683
2777
  venueProductUids = new Set();
2684
2778
  venueBookingUids = new Set();
2685
- _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2779
+ _iterator17 = _createForOfIteratorHelper(tempOrder.products || []);
2686
2780
  _context28.prev = 12;
2687
- _iterator16.s();
2781
+ _iterator17.s();
2688
2782
  case 14:
2689
- if ((_step16 = _iterator16.n()).done) {
2783
+ if ((_step17 = _iterator17.n()).done) {
2690
2784
  _context28.next = 22;
2691
2785
  break;
2692
2786
  }
2693
- product = _step16.value;
2694
- if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
2787
+ product = _step17.value;
2788
+ if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2695
2789
  _context28.next = 18;
2696
2790
  break;
2697
2791
  }
2698
2792
  return _context28.abrupt("continue", 20);
2699
2793
  case 18:
2700
2794
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2701
- if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2795
+ if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2702
2796
  venueBookingUids.add(String(product.metadata.booking_uid));
2703
2797
  }
2704
2798
  case 20:
@@ -2710,10 +2804,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2710
2804
  case 24:
2711
2805
  _context28.prev = 24;
2712
2806
  _context28.t0 = _context28["catch"](12);
2713
- _iterator16.e(_context28.t0);
2807
+ _iterator17.e(_context28.t0);
2714
2808
  case 27:
2715
2809
  _context28.prev = 27;
2716
- _iterator16.f();
2810
+ _iterator17.f();
2717
2811
  return _context28.finish(27);
2718
2812
  case 30:
2719
2813
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
@@ -2961,17 +3055,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2961
3055
  if (visited.has(value)) return;
2962
3056
  visited.add(value);
2963
3057
  if (Array.isArray(value)) {
2964
- var _iterator17 = _createForOfIteratorHelper(value),
2965
- _step17;
3058
+ var _iterator18 = _createForOfIteratorHelper(value),
3059
+ _step18;
2966
3060
  try {
2967
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
2968
- var item = _step17.value;
3061
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
3062
+ var item = _step18.value;
2969
3063
  collectFromValue(item);
2970
3064
  }
2971
3065
  } catch (err) {
2972
- _iterator17.e(err);
3066
+ _iterator18.e(err);
2973
3067
  } finally {
2974
- _iterator17.f();
3068
+ _iterator18.f();
2975
3069
  }
2976
3070
  return;
2977
3071
  }
@@ -3019,7 +3113,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3019
3113
  key: "ensureItemRuleConfigsLoaded",
3020
3114
  value: function () {
3021
3115
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3022
- var _this11 = this;
3116
+ var _this10 = this;
3023
3117
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3024
3118
  while (1) switch (_context35.prev = _context35.next) {
3025
3119
  case 0:
@@ -3040,19 +3134,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3040
3134
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3041
3135
  while (1) switch (_context34.prev = _context34.next) {
3042
3136
  case 0:
3043
- runtimeConfig = _this11.getItemRuleRuntimeConfig();
3137
+ runtimeConfig = _this10.getItemRuleRuntimeConfig();
3044
3138
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3045
3139
  if (!(staticConfigs.length > 0)) {
3046
3140
  _context34.next = 6;
3047
3141
  break;
3048
3142
  }
3049
- _this11.itemRuleConfigs = staticConfigs;
3050
- _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3051
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3143
+ _this10.itemRuleConfigs = staticConfigs;
3144
+ _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3145
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3052
3146
  case 6:
3053
- _this11.itemRuleConfigs = [];
3054
- _this11.itemRuleEvaluator.setStrategyConfigs([]);
3055
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3147
+ _this10.itemRuleConfigs = [];
3148
+ _this10.itemRuleEvaluator.setStrategyConfigs([]);
3149
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3056
3150
  case 9:
3057
3151
  case "end":
3058
3152
  return _context34.stop();
@@ -3126,7 +3220,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3126
3220
  key: "applyPrefillByItemRule",
3127
3221
  value: function () {
3128
3222
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3129
- 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;
3223
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3130
3224
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3131
3225
  while (1) switch (_context37.prev = _context37.next) {
3132
3226
  case 0:
@@ -3171,15 +3265,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3171
3265
  productSourceMap = _context37.sent;
3172
3266
  tempOrder = this.ensureTempOrder();
3173
3267
  hasChanges = false;
3174
- _iterator18 = _createForOfIteratorHelper(prefillItems);
3268
+ _iterator19 = _createForOfIteratorHelper(prefillItems);
3175
3269
  _context37.prev = 20;
3176
- _iterator18.s();
3270
+ _iterator19.s();
3177
3271
  case 22:
3178
- if ((_step18 = _iterator18.n()).done) {
3272
+ if ((_step19 = _iterator19.n()).done) {
3179
3273
  _context37.next = 45;
3180
3274
  break;
3181
3275
  }
3182
- prefillItem = _step18.value;
3276
+ prefillItem = _step19.value;
3183
3277
  productId = Number(prefillItem.product_id);
3184
3278
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3185
3279
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -3248,10 +3342,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3248
3342
  case 47:
3249
3343
  _context37.prev = 47;
3250
3344
  _context37.t0 = _context37["catch"](20);
3251
- _iterator18.e(_context37.t0);
3345
+ _iterator19.e(_context37.t0);
3252
3346
  case 50:
3253
3347
  _context37.prev = 50;
3254
- _iterator18.f();
3348
+ _iterator19.f();
3255
3349
  return _context37.finish(50);
3256
3350
  case 53:
3257
3351
  if (!hasChanges) {
@@ -3513,7 +3607,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3513
3607
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3514
3608
  var parsed = JSON.parse(raw);
3515
3609
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3516
- } catch (_unused4) {
3610
+ } catch (_unused5) {
3517
3611
  return {};
3518
3612
  }
3519
3613
  }
@@ -3563,22 +3657,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3563
3657
  if (booking) {
3564
3658
  booking.holder = holder;
3565
3659
  }
3566
- var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
3567
- _step19;
3660
+ var _iterator20 = _createForOfIteratorHelper(tempOrder.products),
3661
+ _step20;
3568
3662
  try {
3569
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
3570
- var _product$metadata$boo, _product$metadata8, _product$_origin2;
3571
- var product = _step19.value;
3572
- var productBookingUid = (_product$metadata$boo = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
3663
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
3664
+ var _product$metadata$boo, _product$metadata9, _product$_origin2;
3665
+ var product = _step20.value;
3666
+ var productBookingUid = (_product$metadata$boo = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
3573
3667
  if (String(productBookingUid) !== String(bookingUid)) continue;
3574
3668
  var origin = product._origin && _typeof(product._origin) === 'object' ? product._origin : {};
3575
3669
  origin.holder = holder;
3576
3670
  product._origin = origin;
3577
3671
  }
3578
3672
  } catch (err) {
3579
- _iterator19.e(err);
3673
+ _iterator20.e(err);
3580
3674
  } finally {
3581
- _iterator19.f();
3675
+ _iterator20.f();
3582
3676
  }
3583
3677
  this.store.order.notifyTempOrderChanged();
3584
3678
  }