@pisell/pisellos 2.1.120 → 2.1.122

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.
@@ -96,6 +96,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
96
96
  _defineProperty(_assertThisInitialized(_this), "loginEffectDisposers", []);
97
97
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshInFlight", null);
98
98
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
99
+ _defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
100
+ _defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
101
+ _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
99
102
  return _this;
100
103
  }
101
104
  _createClass(VenueBookingImpl, [{
@@ -770,27 +773,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
770
773
  key: "loadAllProducts",
771
774
  value: function () {
772
775
  var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
773
- var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
776
+ var _this5 = this;
774
777
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
775
778
  while (1) switch (_context10.prev = _context10.next) {
779
+ case 0:
780
+ if (!this.loadAllProductsInFlight) {
781
+ _context10.next = 2;
782
+ break;
783
+ }
784
+ return _context10.abrupt("return", this.loadAllProductsInFlight);
785
+ case 2:
786
+ this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
787
+ _this5.loadAllProductsInFlight = null;
788
+ });
789
+ return _context10.abrupt("return", this.loadAllProductsInFlight);
790
+ case 4:
791
+ case "end":
792
+ return _context10.stop();
793
+ }
794
+ }, _callee10, this);
795
+ }));
796
+ function loadAllProducts() {
797
+ return _loadAllProducts.apply(this, arguments);
798
+ }
799
+ return loadAllProducts;
800
+ }()
801
+ }, {
802
+ key: "_doLoadAllProducts",
803
+ value: function () {
804
+ var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
805
+ var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
806
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
807
+ while (1) switch (_context11.prev = _context11.next) {
776
808
  case 0:
777
809
  this.logMethodStart('loadAllProducts');
778
- _context10.prev = 1;
810
+ _context11.prev = 1;
779
811
  if (this.store.venueProducts) {
780
- _context10.next = 4;
812
+ _context11.next = 4;
781
813
  break;
782
814
  }
783
815
  throw new Error('venueProducts 模块未初始化');
784
816
  case 4:
785
817
  if (this.store.addonProducts) {
786
- _context10.next = 6;
818
+ _context11.next = 6;
787
819
  break;
788
820
  }
789
821
  throw new Error('addonProducts 模块未初始化');
790
822
  case 6:
791
823
  associatedMenus = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.openData) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus']) || [];
792
824
  if (associatedMenus.length) {
793
- _context10.next = 9;
825
+ _context11.next = 9;
794
826
  break;
795
827
  }
796
828
  throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
@@ -798,7 +830,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
798
830
  menuListIds = associatedMenus.map(function (n) {
799
831
  return Number(n.value);
800
832
  });
801
- _context10.next = 12;
833
+ _context11.next = 12;
802
834
  return this.store.venueProducts.loadProducts({
803
835
  menu_list_ids: menuListIds,
804
836
  cacheId: this.cacheId,
@@ -806,7 +838,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
806
838
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
807
839
  });
808
840
  case 12:
809
- allProducts = _context10.sent;
841
+ allProducts = _context11.sent;
810
842
  list = Array.isArray(allProducts) ? allProducts : [];
811
843
  venueList = list.filter(function (p) {
812
844
  return p.duration != null;
@@ -822,50 +854,51 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
822
854
  }
823
855
  this.store.addonProducts.addProduct(addonList);
824
856
  this.resourceProductMap = buildResourceProductMap(venueList);
857
+ this.productsLoaded = true;
825
858
  this.logMethodSuccess('loadAllProducts', {
826
859
  total: list.length,
827
860
  venueCount: venueList.length,
828
861
  addonCount: addonList.length,
829
862
  resourceCount: this.resourceProductMap.size
830
863
  });
831
- return _context10.abrupt("return", {
864
+ return _context11.abrupt("return", {
832
865
  venueProducts: venueList,
833
866
  addonProducts: addonList
834
867
  });
835
- case 24:
836
- _context10.prev = 24;
837
- _context10.t0 = _context10["catch"](1);
838
- this.logMethodError('loadAllProducts', _context10.t0);
839
- throw _context10.t0;
840
- case 28:
868
+ case 25:
869
+ _context11.prev = 25;
870
+ _context11.t0 = _context11["catch"](1);
871
+ this.logMethodError('loadAllProducts', _context11.t0);
872
+ throw _context11.t0;
873
+ case 29:
841
874
  case "end":
842
- return _context10.stop();
875
+ return _context11.stop();
843
876
  }
844
- }, _callee10, this, [[1, 24]]);
877
+ }, _callee11, this, [[1, 25]]);
845
878
  }));
846
- function loadAllProducts() {
847
- return _loadAllProducts.apply(this, arguments);
879
+ function _doLoadAllProducts() {
880
+ return _doLoadAllProducts2.apply(this, arguments);
848
881
  }
849
- return loadAllProducts;
882
+ return _doLoadAllProducts;
850
883
  }()
851
884
  }, {
852
885
  key: "loadVenueProducts",
853
886
  value: function () {
854
- var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
887
+ var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
855
888
  var result;
856
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
857
- while (1) switch (_context11.prev = _context11.next) {
889
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
890
+ while (1) switch (_context12.prev = _context12.next) {
858
891
  case 0:
859
- _context11.next = 2;
892
+ _context12.next = 2;
860
893
  return this.loadAllProducts();
861
894
  case 2:
862
- result = _context11.sent;
863
- return _context11.abrupt("return", result.venueProducts);
895
+ result = _context12.sent;
896
+ return _context12.abrupt("return", result.venueProducts);
864
897
  case 4:
865
898
  case "end":
866
- return _context11.stop();
899
+ return _context12.stop();
867
900
  }
868
- }, _callee11, this);
901
+ }, _callee12, this);
869
902
  }));
870
903
  function loadVenueProducts() {
871
904
  return _loadVenueProducts.apply(this, arguments);
@@ -875,21 +908,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
875
908
  }, {
876
909
  key: "loadAddonProducts",
877
910
  value: function () {
878
- var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
911
+ var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
879
912
  var result;
880
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
881
- while (1) switch (_context12.prev = _context12.next) {
913
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
914
+ while (1) switch (_context13.prev = _context13.next) {
882
915
  case 0:
883
- _context12.next = 2;
916
+ _context13.next = 2;
884
917
  return this.loadAllProducts();
885
918
  case 2:
886
- result = _context12.sent;
887
- return _context12.abrupt("return", result.addonProducts);
919
+ result = _context13.sent;
920
+ return _context13.abrupt("return", result.addonProducts);
888
921
  case 4:
889
922
  case "end":
890
- return _context12.stop();
923
+ return _context13.stop();
891
924
  }
892
- }, _callee12, this);
925
+ }, _callee13, this);
893
926
  }));
894
927
  function loadAddonProducts() {
895
928
  return _loadAddonProducts.apply(this, arguments);
@@ -913,36 +946,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
913
946
  }, {
914
947
  key: "loadQuotations",
915
948
  value: function () {
916
- var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
917
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
918
- while (1) switch (_context13.prev = _context13.next) {
949
+ var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
950
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
951
+ while (1) switch (_context14.prev = _context14.next) {
919
952
  case 0:
920
953
  this.logMethodStart('loadQuotations');
921
- _context13.prev = 1;
954
+ _context14.prev = 1;
922
955
  if (this.store.quotation) {
923
- _context13.next = 4;
956
+ _context14.next = 4;
924
957
  break;
925
958
  }
926
959
  throw new Error('quotation 模块未初始化');
927
960
  case 4:
928
- _context13.next = 6;
961
+ _context14.next = 6;
929
962
  return this.store.quotation.loadQuotations(params);
930
963
  case 6:
931
964
  this.logMethodSuccess('loadQuotations', {
932
965
  count: this.store.quotation.getQuotationList().length
933
966
  });
934
- _context13.next = 13;
967
+ _context14.next = 13;
935
968
  break;
936
969
  case 9:
937
- _context13.prev = 9;
938
- _context13.t0 = _context13["catch"](1);
939
- this.logMethodError('loadQuotations', _context13.t0);
940
- throw _context13.t0;
970
+ _context14.prev = 9;
971
+ _context14.t0 = _context14["catch"](1);
972
+ this.logMethodError('loadQuotations', _context14.t0);
973
+ throw _context14.t0;
941
974
  case 13:
942
975
  case "end":
943
- return _context13.stop();
976
+ return _context14.stop();
944
977
  }
945
- }, _callee13, this, [[1, 9]]);
978
+ }, _callee14, this, [[1, 9]]);
946
979
  }));
947
980
  function loadQuotations(_x6) {
948
981
  return _loadQuotations.apply(this, arguments);
@@ -952,46 +985,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
952
985
  }, {
953
986
  key: "fetchResourceAvailability",
954
987
  value: function () {
955
- var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
988
+ var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
956
989
  var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i2, _rawData, _item, mapping;
957
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
958
- while (1) switch (_context14.prev = _context14.next) {
990
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
991
+ while (1) switch (_context15.prev = _context15.next) {
959
992
  case 0:
960
993
  this.logMethodStart('fetchResourceAvailability', params);
961
- _context14.prev = 1;
994
+ _context15.prev = 1;
962
995
  venueProducts = this.getVenueProducts();
963
996
  if (venueProducts.length) {
964
- _context14.next = 7;
997
+ _context15.next = 7;
965
998
  break;
966
999
  }
967
1000
  this.store.rawResourceData = [];
968
1001
  this.logMethodSuccess('fetchResourceAvailability', {
969
1002
  resourceCount: 0
970
1003
  });
971
- return _context14.abrupt("return");
1004
+ return _context15.abrupt("return");
972
1005
  case 7:
973
1006
  resourceIds = extractResourceIds(venueProducts);
974
1007
  if (resourceIds.length) {
975
- _context14.next = 12;
1008
+ _context15.next = 12;
976
1009
  break;
977
1010
  }
978
1011
  this.store.rawResourceData = [];
979
1012
  this.logMethodSuccess('fetchResourceAvailability', {
980
1013
  resourceIds: []
981
1014
  });
982
- return _context14.abrupt("return");
1015
+ return _context15.abrupt("return");
983
1016
  case 12:
984
1017
  // 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
985
1018
  config = this.store.slotConfig;
986
1019
  crossDay = isBusinessHoursCrossDay(config);
987
1020
  effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
988
1021
  if (this.store.date) {
989
- _context14.next = 17;
1022
+ _context15.next = 17;
990
1023
  break;
991
1024
  }
992
1025
  throw new Error('date 模块未初始化');
993
1026
  case 17:
994
- _context14.next = 19;
1027
+ _context15.next = 19;
995
1028
  return this.store.date.fetchResourceDates({
996
1029
  query: {
997
1030
  start_date: params.startDate,
@@ -1001,7 +1034,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1001
1034
  useCache: false
1002
1035
  });
1003
1036
  case 19:
1004
- res = _context14.sent;
1037
+ res = _context15.sent;
1005
1038
  rawData = [];
1006
1039
  if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
1007
1040
  _iterator2 = _createForOfIteratorHelper(res.data);
@@ -1037,19 +1070,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1037
1070
  return sum + r.times.length;
1038
1071
  }, 0)
1039
1072
  });
1040
- _context14.next = 32;
1073
+ _context15.next = 32;
1041
1074
  break;
1042
1075
  case 27:
1043
- _context14.prev = 27;
1044
- _context14.t0 = _context14["catch"](1);
1076
+ _context15.prev = 27;
1077
+ _context15.t0 = _context15["catch"](1);
1045
1078
  this.store.rawResourceData = [];
1046
- this.logMethodError('fetchResourceAvailability', _context14.t0);
1047
- throw _context14.t0;
1079
+ this.logMethodError('fetchResourceAvailability', _context15.t0);
1080
+ throw _context15.t0;
1048
1081
  case 32:
1049
1082
  case "end":
1050
- return _context14.stop();
1083
+ return _context15.stop();
1051
1084
  }
1052
- }, _callee14, this, [[1, 27]]);
1085
+ }, _callee15, this, [[1, 27]]);
1053
1086
  }));
1054
1087
  function fetchResourceAvailability(_x7) {
1055
1088
  return _fetchResourceAvailability.apply(this, arguments);
@@ -1103,25 +1136,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1103
1136
  }, {
1104
1137
  key: "toggleSlot",
1105
1138
  value: function () {
1106
- var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(slot) {
1139
+ var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(slot) {
1107
1140
  var mapping, currentSlots, existIndex, nextSlots, products;
1108
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1109
- while (1) switch (_context15.prev = _context15.next) {
1141
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1142
+ while (1) switch (_context16.prev = _context16.next) {
1110
1143
  case 0:
1111
1144
  this.logMethodStart('toggleSlot', {
1112
1145
  resourceId: slot.resourceId,
1113
1146
  startTime: slot.startTime
1114
1147
  });
1115
- _context15.prev = 1;
1148
+ _context16.prev = 1;
1116
1149
  mapping = this.resourceProductMap.get(slot.resourceId);
1117
1150
  if (mapping) {
1118
- _context15.next = 5;
1151
+ _context16.next = 5;
1119
1152
  break;
1120
1153
  }
1121
1154
  throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
1122
1155
  case 5:
1123
1156
  if (this.store.order) {
1124
- _context15.next = 7;
1157
+ _context16.next = 7;
1125
1158
  break;
1126
1159
  }
1127
1160
  throw new Error('order 模块未初始化');
@@ -1137,14 +1170,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1137
1170
  } else {
1138
1171
  nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
1139
1172
  }
1140
- _context15.next = 12;
1173
+ _context16.next = 12;
1141
1174
  return this.reconcileOrderForResource(slot.resourceId, nextSlots);
1142
1175
  case 12:
1143
1176
  products = this.store.order.getOrderProducts();
1144
- _context15.next = 15;
1177
+ _context16.next = 15;
1145
1178
  return this.refreshItemRuleQuantityLimits();
1146
1179
  case 15:
1147
- _context15.next = 17;
1180
+ _context16.next = 17;
1148
1181
  return this.refreshCartValidationPassed();
1149
1182
  case 17:
1150
1183
  this.logMethodSuccess('toggleSlot', {
@@ -1152,17 +1185,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1152
1185
  resourceId: slot.resourceId,
1153
1186
  slotCount: nextSlots.length
1154
1187
  });
1155
- return _context15.abrupt("return", products);
1188
+ return _context16.abrupt("return", products);
1156
1189
  case 21:
1157
- _context15.prev = 21;
1158
- _context15.t0 = _context15["catch"](1);
1159
- this.logMethodError('toggleSlot', _context15.t0);
1160
- throw _context15.t0;
1190
+ _context16.prev = 21;
1191
+ _context16.t0 = _context16["catch"](1);
1192
+ this.logMethodError('toggleSlot', _context16.t0);
1193
+ throw _context16.t0;
1161
1194
  case 25:
1162
1195
  case "end":
1163
- return _context15.stop();
1196
+ return _context16.stop();
1164
1197
  }
1165
- }, _callee15, this, [[1, 21]]);
1198
+ }, _callee16, this, [[1, 21]]);
1166
1199
  }));
1167
1200
  function toggleSlot(_x8) {
1168
1201
  return _toggleSlot.apply(this, arguments);
@@ -1270,17 +1303,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1270
1303
  }, {
1271
1304
  key: "reconcileOrderForResource",
1272
1305
  value: (function () {
1273
- var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(resourceId, slots) {
1306
+ var _reconcileOrderForResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resourceId, slots) {
1274
1307
  var mapping, tempOrder, merged, rawResource, venueProduct, i, _venueProduct$is_char, _rawResource$form_id, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, booking;
1275
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1276
- while (1) switch (_context16.prev = _context16.next) {
1308
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1309
+ while (1) switch (_context17.prev = _context17.next) {
1277
1310
  case 0:
1278
1311
  mapping = this.resourceProductMap.get(resourceId);
1279
1312
  if (!(!mapping || !this.store.order)) {
1280
- _context16.next = 3;
1313
+ _context17.next = 3;
1281
1314
  break;
1282
1315
  }
1283
- return _context16.abrupt("return");
1316
+ return _context17.abrupt("return");
1284
1317
  case 3:
1285
1318
  tempOrder = this.store.order.ensureTempOrder();
1286
1319
  tempOrder.products = tempOrder.products.filter(function (p) {
@@ -1292,17 +1325,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1292
1325
  return !((_b$metadata = b.metadata) !== null && _b$metadata !== void 0 && _b$metadata.venue_booking && String((_b$metadata2 = b.metadata) === null || _b$metadata2 === void 0 ? void 0 : _b$metadata2.resource_id) === String(resourceId));
1293
1326
  });
1294
1327
  if (slots.length) {
1295
- _context16.next = 12;
1328
+ _context17.next = 12;
1296
1329
  break;
1297
1330
  }
1298
1331
  this.store.order.applyDiscount();
1299
- _context16.next = 10;
1332
+ _context17.next = 10;
1300
1333
  return this.store.order.recalculateSummary({
1301
1334
  createIfMissing: true
1302
1335
  });
1303
1336
  case 10:
1304
1337
  this.store.order.persistTempOrder();
1305
- return _context16.abrupt("return");
1338
+ return _context17.abrupt("return");
1306
1339
  case 12:
1307
1340
  merged = mergeConsecutiveSlots(slots);
1308
1341
  rawResource = this.store.rawResourceData.find(function (r) {
@@ -1400,7 +1433,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1400
1433
  tempOrder.bookings.push(booking);
1401
1434
  }
1402
1435
  this.store.order.applyDiscount();
1403
- _context16.next = 20;
1436
+ _context17.next = 20;
1404
1437
  return this.store.order.recalculateSummary({
1405
1438
  createIfMissing: true
1406
1439
  });
@@ -1408,9 +1441,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1408
1441
  this.store.order.persistTempOrder();
1409
1442
  case 21:
1410
1443
  case "end":
1411
- return _context16.stop();
1444
+ return _context17.stop();
1412
1445
  }
1413
- }, _callee16, this);
1446
+ }, _callee17, this);
1414
1447
  }));
1415
1448
  function reconcileOrderForResource(_x9, _x10) {
1416
1449
  return _reconcileOrderForResource.apply(this, arguments);
@@ -1433,35 +1466,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1433
1466
  }, {
1434
1467
  key: "loadSchedules",
1435
1468
  value: function () {
1436
- var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1437
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1438
- while (1) switch (_context17.prev = _context17.next) {
1469
+ var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1470
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1471
+ while (1) switch (_context18.prev = _context18.next) {
1439
1472
  case 0:
1440
1473
  this.logMethodStart('loadSchedules');
1441
- _context17.prev = 1;
1474
+ _context18.prev = 1;
1442
1475
  if (this.store.schedule) {
1443
- _context17.next = 4;
1476
+ _context18.next = 4;
1444
1477
  break;
1445
1478
  }
1446
1479
  throw new Error('schedule 模块未初始化');
1447
1480
  case 4:
1448
- _context17.next = 6;
1481
+ _context18.next = 6;
1449
1482
  return this.store.schedule.loadAllSchedule();
1450
1483
  case 6:
1451
1484
  this.injectScheduleResolverToQuotation();
1452
1485
  this.logMethodSuccess('loadSchedules');
1453
- _context17.next = 14;
1486
+ _context18.next = 14;
1454
1487
  break;
1455
1488
  case 10:
1456
- _context17.prev = 10;
1457
- _context17.t0 = _context17["catch"](1);
1458
- this.logMethodError('loadSchedules', _context17.t0);
1459
- throw _context17.t0;
1489
+ _context18.prev = 10;
1490
+ _context18.t0 = _context18["catch"](1);
1491
+ this.logMethodError('loadSchedules', _context18.t0);
1492
+ throw _context18.t0;
1460
1493
  case 14:
1461
1494
  case "end":
1462
- return _context17.stop();
1495
+ return _context18.stop();
1463
1496
  }
1464
- }, _callee17, this, [[1, 10]]);
1497
+ }, _callee18, this, [[1, 10]]);
1465
1498
  }));
1466
1499
  function loadSchedules() {
1467
1500
  return _loadSchedules.apply(this, arguments);
@@ -1471,10 +1504,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1471
1504
  }, {
1472
1505
  key: "injectScheduleResolverToQuotation",
1473
1506
  value: function injectScheduleResolverToQuotation() {
1474
- var _this5 = this;
1507
+ var _this6 = this;
1475
1508
  if (this.store.quotation && this.store.schedule) {
1476
1509
  this.store.quotation.setScheduleResolver(function (id) {
1477
- return _this5.store.schedule.getScheduleListByIds([id])[0];
1510
+ return _this6.store.schedule.getScheduleListByIds([id])[0];
1478
1511
  });
1479
1512
  }
1480
1513
  }
@@ -1514,15 +1547,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1514
1547
  }, {
1515
1548
  key: "onCustomerLogin",
1516
1549
  value: function () {
1517
- var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1518
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1519
- while (1) switch (_context18.prev = _context18.next) {
1550
+ var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1551
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1552
+ while (1) switch (_context19.prev = _context19.next) {
1520
1553
  case 0:
1521
1554
  this.logMethodStart('onCustomerLogin', {
1522
1555
  customerId: params.customerId
1523
1556
  });
1524
- _context18.prev = 1;
1525
- _context18.next = 4;
1557
+ _context19.prev = 1;
1558
+ _context19.next = 4;
1526
1559
  return this.refreshOrderMarketingAfterLogin({
1527
1560
  customerId: params.customerId
1528
1561
  });
@@ -1530,18 +1563,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1530
1563
  this.logMethodSuccess('onCustomerLogin', {
1531
1564
  customerId: params.customerId
1532
1565
  });
1533
- _context18.next = 11;
1566
+ _context19.next = 11;
1534
1567
  break;
1535
1568
  case 7:
1536
- _context18.prev = 7;
1537
- _context18.t0 = _context18["catch"](1);
1538
- this.logMethodError('onCustomerLogin', _context18.t0);
1539
- throw _context18.t0;
1569
+ _context19.prev = 7;
1570
+ _context19.t0 = _context19["catch"](1);
1571
+ this.logMethodError('onCustomerLogin', _context19.t0);
1572
+ throw _context19.t0;
1540
1573
  case 11:
1541
1574
  case "end":
1542
- return _context18.stop();
1575
+ return _context19.stop();
1543
1576
  }
1544
- }, _callee18, this, [[1, 7]]);
1577
+ }, _callee19, this, [[1, 7]]);
1545
1578
  }));
1546
1579
  function onCustomerLogin(_x11) {
1547
1580
  return _onCustomerLogin.apply(this, arguments);
@@ -1552,7 +1585,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1552
1585
  key: "recalculateOrderPricesFromQuotation",
1553
1586
  value: function recalculateOrderPricesFromQuotation() {
1554
1587
  var _tempOrder$products,
1555
- _this6 = this;
1588
+ _this7 = this;
1556
1589
  if (!this.store.order || !this.store.quotation) return;
1557
1590
  var tempOrder = this.store.order.getTempOrder();
1558
1591
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
@@ -1564,13 +1597,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1564
1597
  var _product$metadata2;
1565
1598
  var product = _step6.value;
1566
1599
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
1567
- var mapping = _this6.resourceProductMap.get(product.metadata.resource_id);
1600
+ var mapping = _this7.resourceProductMap.get(product.metadata.resource_id);
1568
1601
  if (!mapping) return 1; // continue
1569
- var slots = expandMergedSlotToIndividual(product, _this6.store.slotConfig.slotDurationMinutes);
1602
+ var slots = expandMergedSlotToIndividual(product, _this7.store.slotConfig.slotDurationMinutes);
1570
1603
  var updatedSlots = slots.map(function (slot) {
1571
1604
  var _getPriceForProduct;
1572
1605
  return _objectSpread(_objectSpread({}, slot), {}, {
1573
- price: (_getPriceForProduct = _this6.store.quotation.getPriceForProduct({
1606
+ price: (_getPriceForProduct = _this7.store.quotation.getPriceForProduct({
1574
1607
  productId: mapping.productId,
1575
1608
  datetime: slot.startTime
1576
1609
  })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
@@ -1583,12 +1616,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1583
1616
  product.metadata.price_breakdown = buildPriceBreakdown({
1584
1617
  group: merged[0],
1585
1618
  productId: mapping.productId,
1586
- quotation: _this6.store.quotation
1619
+ quotation: _this7.store.quotation
1587
1620
  });
1588
1621
  }
1589
1622
  } else if (product.product_id != null) {
1590
1623
  var _product$product_vari;
1591
- var quotationPrice = _this6.store.quotation.getPriceForProduct({
1624
+ var quotationPrice = _this7.store.quotation.getPriceForProduct({
1592
1625
  productId: product.product_id,
1593
1626
  variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
1594
1627
  datetime: now
@@ -1611,30 +1644,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1611
1644
  }, {
1612
1645
  key: "scanCode",
1613
1646
  value: function () {
1614
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(code, customerId) {
1647
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(code, customerId) {
1615
1648
  var result;
1616
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1617
- while (1) switch (_context19.prev = _context19.next) {
1649
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1650
+ while (1) switch (_context20.prev = _context20.next) {
1618
1651
  case 0:
1619
1652
  this.logMethodStart('scanCode', {
1620
1653
  code: code
1621
1654
  });
1622
- _context19.prev = 1;
1655
+ _context20.prev = 1;
1623
1656
  if (this.store.order) {
1624
- _context19.next = 4;
1657
+ _context20.next = 4;
1625
1658
  break;
1626
1659
  }
1627
1660
  throw new Error('order 模块未初始化');
1628
1661
  case 4:
1629
- _context19.next = 6;
1662
+ _context20.next = 6;
1630
1663
  return this.store.order.scanCode(code, customerId);
1631
1664
  case 6:
1632
- result = _context19.sent;
1665
+ result = _context20.sent;
1633
1666
  if (!result.isAvailable) {
1634
- _context19.next = 11;
1667
+ _context20.next = 11;
1635
1668
  break;
1636
1669
  }
1637
- _context19.next = 10;
1670
+ _context20.next = 10;
1638
1671
  return this.store.order.recalculateSummary({
1639
1672
  createIfMissing: true
1640
1673
  });
@@ -1644,17 +1677,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1644
1677
  this.logMethodSuccess('scanCode', {
1645
1678
  isAvailable: result.isAvailable
1646
1679
  });
1647
- return _context19.abrupt("return", result);
1680
+ return _context20.abrupt("return", result);
1648
1681
  case 15:
1649
- _context19.prev = 15;
1650
- _context19.t0 = _context19["catch"](1);
1651
- this.logMethodError('scanCode', _context19.t0);
1652
- throw _context19.t0;
1682
+ _context20.prev = 15;
1683
+ _context20.t0 = _context20["catch"](1);
1684
+ this.logMethodError('scanCode', _context20.t0);
1685
+ throw _context20.t0;
1653
1686
  case 19:
1654
1687
  case "end":
1655
- return _context19.stop();
1688
+ return _context20.stop();
1656
1689
  }
1657
- }, _callee19, this, [[1, 15]]);
1690
+ }, _callee20, this, [[1, 15]]);
1658
1691
  }));
1659
1692
  function scanCode(_x12, _x13) {
1660
1693
  return _scanCode.apply(this, arguments);
@@ -1672,15 +1705,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1672
1705
  }, {
1673
1706
  key: "setDiscountSelected",
1674
1707
  value: (function () {
1675
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1708
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1676
1709
  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, _iterator7, _step7, d, selectedResourceIds, _iterator8, _step8, _product$discount_lis, product, before, totalDiscountAmount, newPaymentPrice, paymentStr, afterApplyTarget, finalSummary, finalProduct, finalTarget;
1677
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1678
- while (1) switch (_context20.prev = _context20.next) {
1710
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1711
+ while (1) switch (_context21.prev = _context21.next) {
1679
1712
  case 0:
1680
1713
  this.logMethodStart('setDiscountSelected', params);
1681
- _context20.prev = 1;
1714
+ _context21.prev = 1;
1682
1715
  if (this.store.order) {
1683
- _context20.next = 4;
1716
+ _context21.next = 4;
1684
1717
  break;
1685
1718
  }
1686
1719
  throw new Error('order 模块未初始化');
@@ -1706,7 +1739,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1706
1739
  form_record_id: tempOrder.holder.form_record_id
1707
1740
  }] : [];
1708
1741
  nextDiscountList = updated;
1709
- _context20.next = 16;
1742
+ _context21.next = 16;
1710
1743
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1711
1744
  case 16:
1712
1745
  if (rulesModule) {
@@ -1755,19 +1788,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1755
1788
  return d.id;
1756
1789
  }));
1757
1790
  _iterator8 = _createForOfIteratorHelper(tempOrder.products);
1758
- _context20.prev = 19;
1791
+ _context21.prev = 19;
1759
1792
  _iterator8.s();
1760
1793
  case 21:
1761
1794
  if ((_step8 = _iterator8.n()).done) {
1762
- _context20.next = 30;
1795
+ _context21.next = 30;
1763
1796
  break;
1764
1797
  }
1765
1798
  product = _step8.value;
1766
1799
  if ((_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length) {
1767
- _context20.next = 25;
1800
+ _context21.next = 25;
1768
1801
  break;
1769
1802
  }
1770
- return _context20.abrupt("continue", 28);
1803
+ return _context21.abrupt("continue", 28);
1771
1804
  case 25:
1772
1805
  before = product.discount_list.length;
1773
1806
  product.discount_list = product.discount_list.filter(function (pd) {
@@ -1787,22 +1820,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1787
1820
  }
1788
1821
  }
1789
1822
  case 28:
1790
- _context20.next = 21;
1823
+ _context21.next = 21;
1791
1824
  break;
1792
1825
  case 30:
1793
- _context20.next = 35;
1826
+ _context21.next = 35;
1794
1827
  break;
1795
1828
  case 32:
1796
- _context20.prev = 32;
1797
- _context20.t0 = _context20["catch"](19);
1798
- _iterator8.e(_context20.t0);
1829
+ _context21.prev = 32;
1830
+ _context21.t0 = _context21["catch"](19);
1831
+ _iterator8.e(_context21.t0);
1799
1832
  case 35:
1800
- _context20.prev = 35;
1833
+ _context21.prev = 35;
1801
1834
  _iterator8.f();
1802
- return _context20.finish(35);
1835
+ return _context21.finish(35);
1803
1836
  case 38:
1804
1837
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1805
- _context20.next = 41;
1838
+ _context21.next = 41;
1806
1839
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1807
1840
  case 41:
1808
1841
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
@@ -1811,7 +1844,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1811
1844
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
1812
1845
  return d.id === params.discountId;
1813
1846
  }) || null;
1814
- _context20.next = 45;
1847
+ _context21.next = 45;
1815
1848
  return this.store.order.recalculateSummary({
1816
1849
  createIfMissing: true
1817
1850
  });
@@ -1823,17 +1856,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1823
1856
  finalTarget = this.store.order.getDiscountList().find(function (d) {
1824
1857
  return d.id === params.discountId;
1825
1858
  }) || null;
1826
- return _context20.abrupt("return", this.store.order.getDiscountList());
1859
+ return _context21.abrupt("return", this.store.order.getDiscountList());
1827
1860
  case 53:
1828
- _context20.prev = 53;
1829
- _context20.t1 = _context20["catch"](1);
1830
- this.logMethodError('setDiscountSelected', _context20.t1);
1831
- throw _context20.t1;
1861
+ _context21.prev = 53;
1862
+ _context21.t1 = _context21["catch"](1);
1863
+ this.logMethodError('setDiscountSelected', _context21.t1);
1864
+ throw _context21.t1;
1832
1865
  case 57:
1833
1866
  case "end":
1834
- return _context20.stop();
1867
+ return _context21.stop();
1835
1868
  }
1836
- }, _callee20, this, [[1, 53], [19, 32, 35, 38]]);
1869
+ }, _callee21, this, [[1, 53], [19, 32, 35, 38]]);
1837
1870
  }));
1838
1871
  function setDiscountSelected(_x14) {
1839
1872
  return _setDiscountSelected.apply(this, arguments);
@@ -1843,37 +1876,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1843
1876
  }, {
1844
1877
  key: "addNewOrder",
1845
1878
  value: function () {
1846
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1879
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1847
1880
  var tempOrder;
1848
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1849
- while (1) switch (_context21.prev = _context21.next) {
1881
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1882
+ while (1) switch (_context22.prev = _context22.next) {
1850
1883
  case 0:
1851
1884
  this.logMethodStart('addNewOrder');
1852
- _context21.prev = 1;
1885
+ _context22.prev = 1;
1853
1886
  if (this.store.order) {
1854
- _context21.next = 4;
1887
+ _context22.next = 4;
1855
1888
  break;
1856
1889
  }
1857
1890
  throw new Error('order 模块未初始化');
1858
1891
  case 4:
1859
- _context21.next = 6;
1892
+ _context22.next = 6;
1860
1893
  return this.store.order.addNewOrder();
1861
1894
  case 6:
1862
- tempOrder = _context21.sent;
1895
+ tempOrder = _context22.sent;
1863
1896
  this.logMethodSuccess('addNewOrder', {
1864
1897
  productCount: tempOrder.products.length
1865
1898
  });
1866
- return _context21.abrupt("return", tempOrder);
1899
+ return _context22.abrupt("return", tempOrder);
1867
1900
  case 11:
1868
- _context21.prev = 11;
1869
- _context21.t0 = _context21["catch"](1);
1870
- this.logMethodError('addNewOrder', _context21.t0);
1871
- throw _context21.t0;
1901
+ _context22.prev = 11;
1902
+ _context22.t0 = _context22["catch"](1);
1903
+ this.logMethodError('addNewOrder', _context22.t0);
1904
+ throw _context22.t0;
1872
1905
  case 15:
1873
1906
  case "end":
1874
- return _context21.stop();
1907
+ return _context22.stop();
1875
1908
  }
1876
- }, _callee21, this, [[1, 11]]);
1909
+ }, _callee22, this, [[1, 11]]);
1877
1910
  }));
1878
1911
  function addNewOrder() {
1879
1912
  return _addNewOrder.apply(this, arguments);
@@ -1889,37 +1922,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1889
1922
  }, {
1890
1923
  key: "getSummary",
1891
1924
  value: function () {
1892
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1925
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1893
1926
  var summary;
1894
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1895
- while (1) switch (_context22.prev = _context22.next) {
1927
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1928
+ while (1) switch (_context23.prev = _context23.next) {
1896
1929
  case 0:
1897
1930
  this.logMethodStart('getSummary');
1898
- _context22.prev = 1;
1931
+ _context23.prev = 1;
1899
1932
  if (this.store.order) {
1900
- _context22.next = 4;
1933
+ _context23.next = 4;
1901
1934
  break;
1902
1935
  }
1903
1936
  throw new Error('order 模块未初始化');
1904
1937
  case 4:
1905
- _context22.next = 6;
1938
+ _context23.next = 6;
1906
1939
  return this.store.order.getScanOrderSummary();
1907
1940
  case 6:
1908
- summary = _context22.sent;
1941
+ summary = _context23.sent;
1909
1942
  this.logMethodSuccess('getSummary', {
1910
1943
  totalAmount: summary.total_amount
1911
1944
  });
1912
- return _context22.abrupt("return", summary);
1945
+ return _context23.abrupt("return", summary);
1913
1946
  case 11:
1914
- _context22.prev = 11;
1915
- _context22.t0 = _context22["catch"](1);
1916
- this.logMethodError('getSummary', _context22.t0);
1917
- throw _context22.t0;
1947
+ _context23.prev = 11;
1948
+ _context23.t0 = _context23["catch"](1);
1949
+ this.logMethodError('getSummary', _context23.t0);
1950
+ throw _context23.t0;
1918
1951
  case 15:
1919
1952
  case "end":
1920
- return _context22.stop();
1953
+ return _context23.stop();
1921
1954
  }
1922
- }, _callee22, this, [[1, 11]]);
1955
+ }, _callee23, this, [[1, 11]]);
1923
1956
  }));
1924
1957
  function getSummary() {
1925
1958
  return _getSummary.apply(this, arguments);
@@ -1929,43 +1962,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1929
1962
  }, {
1930
1963
  key: "submitOrder",
1931
1964
  value: function () {
1932
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1933
- var _tempOrder$products2, result, tempOrder;
1934
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1935
- while (1) switch (_context23.prev = _context23.next) {
1965
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1966
+ var _this$otherParams7, _this$otherParams8, _this$otherParams9, _this$otherParams10, _tempOrder$products2, result, tempOrder;
1967
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1968
+ while (1) switch (_context24.prev = _context24.next) {
1936
1969
  case 0:
1937
1970
  this.logMethodStart('submitOrder');
1938
- _context23.prev = 1;
1939
- _context23.next = 4;
1971
+ _context24.prev = 1;
1972
+ _context24.next = 4;
1940
1973
  return this.validateBeforeSubmitByItemRule();
1941
1974
  case 4:
1942
1975
  if (this.store.order) {
1943
- _context23.next = 6;
1976
+ _context24.next = 6;
1944
1977
  break;
1945
1978
  }
1946
1979
  throw new Error('venueBooking解决方案需要 order 模块支持');
1947
1980
  case 6:
1948
- _context23.next = 8;
1981
+ _context24.next = 8;
1949
1982
  return this.store.order.submitTempOrder({
1950
- cacheId: this.cacheId
1983
+ cacheId: this.cacheId,
1984
+ platform: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform,
1985
+ businessCode: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.businessCode,
1986
+ channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel,
1987
+ type: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.type
1951
1988
  });
1952
1989
  case 8:
1953
- result = _context23.sent;
1990
+ result = _context24.sent;
1954
1991
  tempOrder = this.store.order.getTempOrder();
1955
1992
  this.logMethodSuccess('submitOrder', {
1956
1993
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
1957
1994
  });
1958
- return _context23.abrupt("return", result);
1995
+ return _context24.abrupt("return", result);
1959
1996
  case 14:
1960
- _context23.prev = 14;
1961
- _context23.t0 = _context23["catch"](1);
1962
- this.logMethodError('submitOrder', _context23.t0);
1963
- throw _context23.t0;
1997
+ _context24.prev = 14;
1998
+ _context24.t0 = _context24["catch"](1);
1999
+ this.logMethodError('submitOrder', _context24.t0);
2000
+ throw _context24.t0;
1964
2001
  case 18:
1965
2002
  case "end":
1966
- return _context23.stop();
2003
+ return _context24.stop();
1967
2004
  }
1968
- }, _callee23, this, [[1, 14]]);
2005
+ }, _callee24, this, [[1, 14]]);
1969
2006
  }));
1970
2007
  function submitOrder() {
1971
2008
  return _submitOrder.apply(this, arguments);
@@ -1975,18 +2012,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1975
2012
  }, {
1976
2013
  key: "addProductToOrder",
1977
2014
  value: function () {
1978
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(product) {
2015
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
1979
2016
  var _product$metadata3, _product$product_vari2, quotationPrice, products;
1980
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1981
- while (1) switch (_context24.prev = _context24.next) {
2017
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2018
+ while (1) switch (_context25.prev = _context25.next) {
1982
2019
  case 0:
1983
2020
  this.logMethodStart('addProductToOrder', {
1984
2021
  product_id: product.product_id,
1985
2022
  product_variant_id: product.product_variant_id
1986
2023
  });
1987
- _context24.prev = 1;
2024
+ _context25.prev = 1;
1988
2025
  if (this.store.order) {
1989
- _context24.next = 4;
2026
+ _context25.next = 4;
1990
2027
  break;
1991
2028
  }
1992
2029
  throw new Error('order 模块未初始化');
@@ -2005,30 +2042,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2005
2042
  product.payment_price = quotationPrice;
2006
2043
  }
2007
2044
  }
2008
- _context24.next = 7;
2045
+ _context25.next = 7;
2009
2046
  return this.store.order.addProductToOrder(product);
2010
2047
  case 7:
2011
- products = _context24.sent;
2012
- _context24.next = 10;
2048
+ products = _context25.sent;
2049
+ _context25.next = 10;
2013
2050
  return this.refreshItemRuleQuantityLimits();
2014
2051
  case 10:
2015
- _context24.next = 12;
2052
+ _context25.next = 12;
2016
2053
  return this.refreshCartValidationPassed();
2017
2054
  case 12:
2018
2055
  this.logMethodSuccess('addProductToOrder', {
2019
2056
  productCount: products.length
2020
2057
  });
2021
- return _context24.abrupt("return", products);
2058
+ return _context25.abrupt("return", products);
2022
2059
  case 16:
2023
- _context24.prev = 16;
2024
- _context24.t0 = _context24["catch"](1);
2025
- this.logMethodError('addProductToOrder', _context24.t0);
2026
- throw _context24.t0;
2060
+ _context25.prev = 16;
2061
+ _context25.t0 = _context25["catch"](1);
2062
+ this.logMethodError('addProductToOrder', _context25.t0);
2063
+ throw _context25.t0;
2027
2064
  case 20:
2028
2065
  case "end":
2029
- return _context24.stop();
2066
+ return _context25.stop();
2030
2067
  }
2031
- }, _callee24, this, [[1, 16]]);
2068
+ }, _callee25, this, [[1, 16]]);
2032
2069
  }));
2033
2070
  function addProductToOrder(_x15) {
2034
2071
  return _addProductToOrder.apply(this, arguments);
@@ -2038,46 +2075,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2038
2075
  }, {
2039
2076
  key: "updateProductInOrder",
2040
2077
  value: function () {
2041
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2078
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2042
2079
  var products;
2043
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2044
- while (1) switch (_context25.prev = _context25.next) {
2080
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2081
+ while (1) switch (_context26.prev = _context26.next) {
2045
2082
  case 0:
2046
2083
  this.logMethodStart('updateProductInOrder', {
2047
2084
  product_id: params.product_id,
2048
2085
  product_variant_id: params.product_variant_id
2049
2086
  });
2050
- _context25.prev = 1;
2087
+ _context26.prev = 1;
2051
2088
  if (this.store.order) {
2052
- _context25.next = 4;
2089
+ _context26.next = 4;
2053
2090
  break;
2054
2091
  }
2055
2092
  throw new Error('order 模块未初始化');
2056
2093
  case 4:
2057
- _context25.next = 6;
2094
+ _context26.next = 6;
2058
2095
  return this.store.order.updateProductInOrder(params);
2059
2096
  case 6:
2060
- products = _context25.sent;
2061
- _context25.next = 9;
2097
+ products = _context26.sent;
2098
+ _context26.next = 9;
2062
2099
  return this.refreshItemRuleQuantityLimits();
2063
2100
  case 9:
2064
- _context25.next = 11;
2101
+ _context26.next = 11;
2065
2102
  return this.refreshCartValidationPassed();
2066
2103
  case 11:
2067
2104
  this.logMethodSuccess('updateProductInOrder', {
2068
2105
  productCount: products.length
2069
2106
  });
2070
- return _context25.abrupt("return", products);
2107
+ return _context26.abrupt("return", products);
2071
2108
  case 15:
2072
- _context25.prev = 15;
2073
- _context25.t0 = _context25["catch"](1);
2074
- this.logMethodError('updateProductInOrder', _context25.t0);
2075
- throw _context25.t0;
2109
+ _context26.prev = 15;
2110
+ _context26.t0 = _context26["catch"](1);
2111
+ this.logMethodError('updateProductInOrder', _context26.t0);
2112
+ throw _context26.t0;
2076
2113
  case 19:
2077
2114
  case "end":
2078
- return _context25.stop();
2115
+ return _context26.stop();
2079
2116
  }
2080
- }, _callee25, this, [[1, 15]]);
2117
+ }, _callee26, this, [[1, 15]]);
2081
2118
  }));
2082
2119
  function updateProductInOrder(_x16) {
2083
2120
  return _updateProductInOrder.apply(this, arguments);
@@ -2087,46 +2124,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2087
2124
  }, {
2088
2125
  key: "removeProductFromOrder",
2089
2126
  value: function () {
2090
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(identity) {
2127
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
2091
2128
  var products;
2092
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2093
- while (1) switch (_context26.prev = _context26.next) {
2129
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2130
+ while (1) switch (_context27.prev = _context27.next) {
2094
2131
  case 0:
2095
2132
  this.logMethodStart('removeProductFromOrder', {
2096
2133
  product_id: identity.product_id,
2097
2134
  product_variant_id: identity.product_variant_id
2098
2135
  });
2099
- _context26.prev = 1;
2136
+ _context27.prev = 1;
2100
2137
  if (this.store.order) {
2101
- _context26.next = 4;
2138
+ _context27.next = 4;
2102
2139
  break;
2103
2140
  }
2104
2141
  throw new Error('order 模块未初始化');
2105
2142
  case 4:
2106
- _context26.next = 6;
2143
+ _context27.next = 6;
2107
2144
  return this.store.order.removeProductFromOrder(identity);
2108
2145
  case 6:
2109
- products = _context26.sent;
2110
- _context26.next = 9;
2146
+ products = _context27.sent;
2147
+ _context27.next = 9;
2111
2148
  return this.refreshItemRuleQuantityLimits();
2112
2149
  case 9:
2113
- _context26.next = 11;
2150
+ _context27.next = 11;
2114
2151
  return this.refreshCartValidationPassed();
2115
2152
  case 11:
2116
2153
  this.logMethodSuccess('removeProductFromOrder', {
2117
2154
  productCount: products.length
2118
2155
  });
2119
- return _context26.abrupt("return", products);
2156
+ return _context27.abrupt("return", products);
2120
2157
  case 15:
2121
- _context26.prev = 15;
2122
- _context26.t0 = _context26["catch"](1);
2123
- this.logMethodError('removeProductFromOrder', _context26.t0);
2124
- throw _context26.t0;
2158
+ _context27.prev = 15;
2159
+ _context27.t0 = _context27["catch"](1);
2160
+ this.logMethodError('removeProductFromOrder', _context27.t0);
2161
+ throw _context27.t0;
2125
2162
  case 19:
2126
2163
  case "end":
2127
- return _context26.stop();
2164
+ return _context27.stop();
2128
2165
  }
2129
- }, _callee26, this, [[1, 15]]);
2166
+ }, _callee27, this, [[1, 15]]);
2130
2167
  }));
2131
2168
  function removeProductFromOrder(_x17) {
2132
2169
  return _removeProductFromOrder.apply(this, arguments);
@@ -2136,21 +2173,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2136
2173
  }, {
2137
2174
  key: "getProductList",
2138
2175
  value: function () {
2139
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2176
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2140
2177
  var result;
2141
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2142
- while (1) switch (_context27.prev = _context27.next) {
2178
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2179
+ while (1) switch (_context28.prev = _context28.next) {
2143
2180
  case 0:
2144
- _context27.next = 2;
2145
- return this.loadAllProducts();
2181
+ if (!this.productsLoaded) {
2182
+ _context28.next = 2;
2183
+ break;
2184
+ }
2185
+ return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2146
2186
  case 2:
2147
- result = _context27.sent;
2148
- return _context27.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2187
+ _context28.next = 4;
2188
+ return this.loadAllProducts();
2149
2189
  case 4:
2190
+ result = _context28.sent;
2191
+ return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2192
+ case 6:
2150
2193
  case "end":
2151
- return _context27.stop();
2194
+ return _context28.stop();
2152
2195
  }
2153
- }, _callee27, this);
2196
+ }, _callee28, this);
2154
2197
  }));
2155
2198
  function getProductList() {
2156
2199
  return _getProductList.apply(this, arguments);
@@ -2160,32 +2203,49 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2160
2203
  }, {
2161
2204
  key: "loadOpenDataConfig",
2162
2205
  value: function () {
2163
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2164
- var openDataConfig;
2165
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2166
- while (1) switch (_context28.prev = _context28.next) {
2206
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2207
+ var _this8 = this;
2208
+ var lastFetchedAt, cachedData;
2209
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2210
+ while (1) switch (_context29.prev = _context29.next) {
2167
2211
  case 0:
2168
2212
  if (this.store.openData) {
2169
- _context28.next = 2;
2213
+ _context29.next = 2;
2170
2214
  break;
2171
2215
  }
2172
2216
  throw new Error('openData 模块未初始化');
2173
2217
  case 2:
2174
- _context28.next = 4;
2175
- return this.store.openData.fetchOpenData({
2218
+ lastFetchedAt = this.store.openData.getLastFetchedAt();
2219
+ cachedData = this.store.openData.getOpenData();
2220
+ if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
2221
+ _context29.next = 7;
2222
+ break;
2223
+ }
2224
+ this.otherParams.openData = cachedData;
2225
+ return _context29.abrupt("return", cachedData);
2226
+ case 7:
2227
+ if (!this.loadOpenDataConfigInFlight) {
2228
+ _context29.next = 9;
2229
+ break;
2230
+ }
2231
+ return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2232
+ case 9:
2233
+ this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2176
2234
  scope: 'board',
2177
2235
  target: 'venue_booking+online_store',
2178
2236
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2237
+ }).then(function (openDataConfig) {
2238
+ _this8.otherParams.openData = openDataConfig;
2239
+ return openDataConfig;
2240
+ }).finally(function () {
2241
+ _this8.loadOpenDataConfigInFlight = null;
2179
2242
  });
2180
- case 4:
2181
- openDataConfig = _context28.sent;
2182
- this.otherParams.openData = openDataConfig;
2183
- return _context28.abrupt("return", openDataConfig);
2184
- case 7:
2243
+ return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2244
+ case 11:
2185
2245
  case "end":
2186
- return _context28.stop();
2246
+ return _context29.stop();
2187
2247
  }
2188
- }, _callee28, this);
2248
+ }, _callee29, this);
2189
2249
  }));
2190
2250
  function loadOpenDataConfig() {
2191
2251
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2195,29 +2255,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2195
2255
  }, {
2196
2256
  key: "loadRuntimeConfigs",
2197
2257
  value: function () {
2198
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2258
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2199
2259
  var itemRuleConfigs;
2200
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2201
- while (1) switch (_context29.prev = _context29.next) {
2260
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2261
+ while (1) switch (_context30.prev = _context30.next) {
2202
2262
  case 0:
2203
- _context29.next = 2;
2263
+ _context30.next = 2;
2204
2264
  return this.loadOpenDataConfig();
2205
2265
  case 2:
2206
- _context29.next = 4;
2266
+ _context30.next = 4;
2207
2267
  return this.ensureItemRuleConfigsLoaded();
2208
2268
  case 4:
2209
- itemRuleConfigs = _context29.sent;
2269
+ itemRuleConfigs = _context30.sent;
2210
2270
  this.logMethodSuccess('loadRuntimeConfigs', {
2211
2271
  itemRuleCount: itemRuleConfigs.length
2212
2272
  });
2213
- return _context29.abrupt("return", {
2273
+ return _context30.abrupt("return", {
2214
2274
  itemRuleConfigs: itemRuleConfigs
2215
2275
  });
2216
2276
  case 7:
2217
2277
  case "end":
2218
- return _context29.stop();
2278
+ return _context30.stop();
2219
2279
  }
2220
- }, _callee29, this);
2280
+ }, _callee30, this);
2221
2281
  }));
2222
2282
  function loadRuntimeConfigs() {
2223
2283
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -2227,22 +2287,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2227
2287
  }, {
2228
2288
  key: "fetchItemRuleConfigsByModelIds",
2229
2289
  value: function () {
2230
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(strategyModelIds) {
2290
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(strategyModelIds) {
2231
2291
  var result, configs;
2232
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2233
- while (1) switch (_context30.prev = _context30.next) {
2292
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2293
+ while (1) switch (_context31.prev = _context31.next) {
2234
2294
  case 0:
2235
2295
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
2236
2296
  strategyModelIds: strategyModelIds
2237
2297
  });
2238
2298
  if (strategyModelIds.length) {
2239
- _context30.next = 3;
2299
+ _context31.next = 3;
2240
2300
  break;
2241
2301
  }
2242
- return _context30.abrupt("return", []);
2302
+ return _context31.abrupt("return", []);
2243
2303
  case 3:
2244
- _context30.prev = 3;
2245
- _context30.next = 6;
2304
+ _context31.prev = 3;
2305
+ _context31.next = 6;
2246
2306
  return this.request.get('/promotion', {
2247
2307
  skip: 1,
2248
2308
  num: 99,
@@ -2250,7 +2310,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2250
2310
  ids: strategyModelIds
2251
2311
  });
2252
2312
  case 6:
2253
- result = _context30.sent;
2313
+ result = _context31.sent;
2254
2314
  configs = [];
2255
2315
  if (result.code === 200) {
2256
2316
  configs = result.data.list.map(function (item) {
@@ -2261,19 +2321,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2261
2321
  strategyModelIds: strategyModelIds,
2262
2322
  strategyCount: configs.length
2263
2323
  });
2264
- return _context30.abrupt("return", configs);
2324
+ return _context31.abrupt("return", configs);
2265
2325
  case 13:
2266
- _context30.prev = 13;
2267
- _context30.t0 = _context30["catch"](3);
2268
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context30.t0, {
2326
+ _context31.prev = 13;
2327
+ _context31.t0 = _context31["catch"](3);
2328
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context31.t0, {
2269
2329
  strategyModelIds: strategyModelIds
2270
2330
  });
2271
- return _context30.abrupt("return", []);
2331
+ return _context31.abrupt("return", []);
2272
2332
  case 17:
2273
2333
  case "end":
2274
- return _context30.stop();
2334
+ return _context31.stop();
2275
2335
  }
2276
- }, _callee30, this, [[3, 13]]);
2336
+ }, _callee31, this, [[3, 13]]);
2277
2337
  }));
2278
2338
  function fetchItemRuleConfigsByModelIds(_x18) {
2279
2339
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
@@ -2283,22 +2343,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2283
2343
  }, {
2284
2344
  key: "buildPrefillProductSourceMap",
2285
2345
  value: function () {
2286
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2346
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2287
2347
  var sourceMap, productList, visited, collectFromValue;
2288
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2289
- while (1) switch (_context31.prev = _context31.next) {
2348
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2349
+ while (1) switch (_context32.prev = _context32.next) {
2290
2350
  case 0:
2291
2351
  sourceMap = new Map();
2292
- _context31.prev = 1;
2293
- _context31.next = 4;
2352
+ _context32.prev = 1;
2353
+ _context32.next = 4;
2294
2354
  return this.getProductList();
2295
2355
  case 4:
2296
- productList = _context31.sent;
2356
+ productList = _context32.sent;
2297
2357
  if (Array.isArray(productList)) {
2298
- _context31.next = 7;
2358
+ _context32.next = 7;
2299
2359
  break;
2300
2360
  }
2301
- return _context31.abrupt("return", sourceMap);
2361
+ return _context32.abrupt("return", sourceMap);
2302
2362
  case 7:
2303
2363
  visited = new Set();
2304
2364
  collectFromValue = function collectFromValue(value) {
@@ -2337,19 +2397,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2337
2397
  }
2338
2398
  };
2339
2399
  collectFromValue(productList);
2340
- _context31.next = 15;
2400
+ _context32.next = 15;
2341
2401
  break;
2342
2402
  case 12:
2343
- _context31.prev = 12;
2344
- _context31.t0 = _context31["catch"](1);
2345
- this.logMethodError('buildPrefillProductSourceMap', _context31.t0);
2403
+ _context32.prev = 12;
2404
+ _context32.t0 = _context32["catch"](1);
2405
+ this.logMethodError('buildPrefillProductSourceMap', _context32.t0);
2346
2406
  case 15:
2347
- return _context31.abrupt("return", sourceMap);
2407
+ return _context32.abrupt("return", sourceMap);
2348
2408
  case 16:
2349
2409
  case "end":
2350
- return _context31.stop();
2410
+ return _context32.stop();
2351
2411
  }
2352
- }, _callee31, this, [[1, 12]]);
2412
+ }, _callee32, this, [[1, 12]]);
2353
2413
  }));
2354
2414
  function buildPrefillProductSourceMap() {
2355
2415
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -2364,56 +2424,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2364
2424
  }, {
2365
2425
  key: "ensureItemRuleConfigsLoaded",
2366
2426
  value: function () {
2367
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2368
- var _this7 = this;
2369
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2370
- while (1) switch (_context33.prev = _context33.next) {
2427
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2428
+ var _this9 = this;
2429
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2430
+ while (1) switch (_context34.prev = _context34.next) {
2371
2431
  case 0:
2372
2432
  if (!(this.itemRuleConfigs.length > 0)) {
2373
- _context33.next = 2;
2433
+ _context34.next = 2;
2374
2434
  break;
2375
2435
  }
2376
- return _context33.abrupt("return", this.itemRuleConfigs);
2436
+ return _context34.abrupt("return", this.itemRuleConfigs);
2377
2437
  case 2:
2378
2438
  if (!this.itemRuleConfigsPromise) {
2379
- _context33.next = 4;
2439
+ _context34.next = 4;
2380
2440
  break;
2381
2441
  }
2382
- return _context33.abrupt("return", this.itemRuleConfigsPromise);
2442
+ return _context34.abrupt("return", this.itemRuleConfigsPromise);
2383
2443
  case 4:
2384
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2444
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2385
2445
  var runtimeConfig, staticConfigs;
2386
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2387
- while (1) switch (_context32.prev = _context32.next) {
2446
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2447
+ while (1) switch (_context33.prev = _context33.next) {
2388
2448
  case 0:
2389
- runtimeConfig = _this7.getItemRuleRuntimeConfig();
2449
+ runtimeConfig = _this9.getItemRuleRuntimeConfig();
2390
2450
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2391
2451
  if (!(staticConfigs.length > 0)) {
2392
- _context32.next = 6;
2452
+ _context33.next = 6;
2393
2453
  break;
2394
2454
  }
2395
- _this7.itemRuleConfigs = staticConfigs;
2396
- _this7.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2397
- return _context32.abrupt("return", _this7.itemRuleConfigs);
2455
+ _this9.itemRuleConfigs = staticConfigs;
2456
+ _this9.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2457
+ return _context33.abrupt("return", _this9.itemRuleConfigs);
2398
2458
  case 6:
2399
- _this7.itemRuleConfigs = [];
2400
- _this7.itemRuleEvaluator.setStrategyConfigs([]);
2401
- return _context32.abrupt("return", _this7.itemRuleConfigs);
2459
+ _this9.itemRuleConfigs = [];
2460
+ _this9.itemRuleEvaluator.setStrategyConfigs([]);
2461
+ return _context33.abrupt("return", _this9.itemRuleConfigs);
2402
2462
  case 9:
2403
2463
  case "end":
2404
- return _context32.stop();
2464
+ return _context33.stop();
2405
2465
  }
2406
- }, _callee32);
2466
+ }, _callee33);
2407
2467
  }))();
2408
- _context33.next = 7;
2468
+ _context34.next = 7;
2409
2469
  return this.itemRuleConfigsPromise;
2410
2470
  case 7:
2411
- return _context33.abrupt("return", _context33.sent);
2471
+ return _context34.abrupt("return", _context34.sent);
2412
2472
  case 8:
2413
2473
  case "end":
2414
- return _context33.stop();
2474
+ return _context34.stop();
2415
2475
  }
2416
- }, _callee33, this);
2476
+ }, _callee34, this);
2417
2477
  }));
2418
2478
  function ensureItemRuleConfigsLoaded() {
2419
2479
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -2423,22 +2483,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2423
2483
  }, {
2424
2484
  key: "refreshItemRuleQuantityLimits",
2425
2485
  value: function () {
2426
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2486
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2427
2487
  var strategyConfigs, businessData, limits;
2428
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2429
- while (1) switch (_context34.prev = _context34.next) {
2488
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2489
+ while (1) switch (_context35.prev = _context35.next) {
2430
2490
  case 0:
2431
- _context34.prev = 0;
2432
- _context34.next = 3;
2491
+ _context35.prev = 0;
2492
+ _context35.next = 3;
2433
2493
  return this.ensureItemRuleConfigsLoaded();
2434
2494
  case 3:
2435
- strategyConfigs = _context34.sent;
2495
+ strategyConfigs = _context35.sent;
2436
2496
  if (strategyConfigs.length) {
2437
- _context34.next = 7;
2497
+ _context35.next = 7;
2438
2498
  break;
2439
2499
  }
2440
2500
  this.store.itemRuleQuantityLimits = [];
2441
- return _context34.abrupt("return", []);
2501
+ return _context35.abrupt("return", []);
2442
2502
  case 7:
2443
2503
  businessData = buildItemRuleBusinessData({
2444
2504
  tempOrder: this.ensureTempOrder(),
@@ -2450,18 +2510,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2450
2510
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
2451
2511
  limitCount: limits.length
2452
2512
  });
2453
- return _context34.abrupt("return", limits);
2513
+ return _context35.abrupt("return", limits);
2454
2514
  case 14:
2455
- _context34.prev = 14;
2456
- _context34.t0 = _context34["catch"](0);
2515
+ _context35.prev = 14;
2516
+ _context35.t0 = _context35["catch"](0);
2457
2517
  this.store.itemRuleQuantityLimits = [];
2458
- this.logMethodError('refreshItemRuleQuantityLimits', _context34.t0);
2459
- return _context34.abrupt("return", []);
2518
+ this.logMethodError('refreshItemRuleQuantityLimits', _context35.t0);
2519
+ return _context35.abrupt("return", []);
2460
2520
  case 19:
2461
2521
  case "end":
2462
- return _context34.stop();
2522
+ return _context35.stop();
2463
2523
  }
2464
- }, _callee34, this, [[0, 14]]);
2524
+ }, _callee35, this, [[0, 14]]);
2465
2525
  }));
2466
2526
  function refreshItemRuleQuantityLimits() {
2467
2527
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -2471,32 +2531,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2471
2531
  }, {
2472
2532
  key: "applyPrefillByItemRule",
2473
2533
  value: function () {
2474
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2534
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2475
2535
  var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator10, _step10, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _ref5, _sourceItem$original_, _ref6, _sourceItem$payment_p, sellingPrice, originalPrice, paymentPrice, targetProduct, existedQuantity, delta, nextProduct;
2476
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2477
- while (1) switch (_context35.prev = _context35.next) {
2536
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2537
+ while (1) switch (_context36.prev = _context36.next) {
2478
2538
  case 0:
2479
2539
  if (!this.itemRulePrefillApplied) {
2480
- _context35.next = 2;
2540
+ _context36.next = 2;
2481
2541
  break;
2482
2542
  }
2483
- return _context35.abrupt("return");
2543
+ return _context36.abrupt("return");
2484
2544
  case 2:
2485
2545
  if (this.store.order) {
2486
- _context35.next = 4;
2546
+ _context36.next = 4;
2487
2547
  break;
2488
2548
  }
2489
- return _context35.abrupt("return");
2549
+ return _context36.abrupt("return");
2490
2550
  case 4:
2491
- _context35.next = 6;
2551
+ _context36.next = 6;
2492
2552
  return this.ensureItemRuleConfigsLoaded();
2493
2553
  case 6:
2494
- strategyConfigs = _context35.sent;
2554
+ strategyConfigs = _context36.sent;
2495
2555
  if (strategyConfigs.length) {
2496
- _context35.next = 9;
2556
+ _context36.next = 9;
2497
2557
  break;
2498
2558
  }
2499
- return _context35.abrupt("return");
2559
+ return _context36.abrupt("return");
2500
2560
  case 9:
2501
2561
  businessData = buildItemRuleBusinessData({
2502
2562
  tempOrder: this.ensureTempOrder(),
@@ -2505,24 +2565,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2505
2565
  });
2506
2566
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
2507
2567
  if (prefillItems.length) {
2508
- _context35.next = 14;
2568
+ _context36.next = 14;
2509
2569
  break;
2510
2570
  }
2511
2571
  this.itemRulePrefillApplied = true;
2512
- return _context35.abrupt("return");
2572
+ return _context36.abrupt("return");
2513
2573
  case 14:
2514
- _context35.next = 16;
2574
+ _context36.next = 16;
2515
2575
  return this.buildPrefillProductSourceMap();
2516
2576
  case 16:
2517
- productSourceMap = _context35.sent;
2577
+ productSourceMap = _context36.sent;
2518
2578
  tempOrder = this.ensureTempOrder();
2519
2579
  hasChanges = false;
2520
2580
  _iterator10 = _createForOfIteratorHelper(prefillItems);
2521
- _context35.prev = 20;
2581
+ _context36.prev = 20;
2522
2582
  _iterator10.s();
2523
2583
  case 22:
2524
2584
  if ((_step10 = _iterator10.n()).done) {
2525
- _context35.next = 47;
2585
+ _context36.next = 47;
2526
2586
  break;
2527
2587
  }
2528
2588
  prefillItem = _step10.value;
@@ -2530,16 +2590,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2530
2590
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
2531
2591
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
2532
2592
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
2533
- _context35.next = 29;
2593
+ _context36.next = 29;
2534
2594
  break;
2535
2595
  }
2536
- return _context35.abrupt("continue", 45);
2596
+ return _context36.abrupt("continue", 45);
2537
2597
  case 29:
2538
2598
  if (!Number.isNaN(productVariantId)) {
2539
- _context35.next = 31;
2599
+ _context36.next = 31;
2540
2600
  break;
2541
2601
  }
2542
- return _context35.abrupt("continue", 45);
2602
+ return _context36.abrupt("continue", 45);
2543
2603
  case 31:
2544
2604
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
2545
2605
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -2547,7 +2607,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2547
2607
  product_variant_id: productVariantId
2548
2608
  });
2549
2609
  if (!(productIndex === -1)) {
2550
- _context35.next = 40;
2610
+ _context36.next = 40;
2551
2611
  break;
2552
2612
  }
2553
2613
  sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
@@ -2570,7 +2630,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2570
2630
  })
2571
2631
  }));
2572
2632
  hasChanges = true;
2573
- return _context35.abrupt("continue", 45);
2633
+ return _context36.abrupt("continue", 45);
2574
2634
  case 40:
2575
2635
  targetProduct = tempOrder.products[productIndex];
2576
2636
  existedQuantity = toNonNegativeInt(targetProduct.num);
@@ -2589,32 +2649,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2589
2649
  hasChanges = true;
2590
2650
  }
2591
2651
  case 45:
2592
- _context35.next = 22;
2652
+ _context36.next = 22;
2593
2653
  break;
2594
2654
  case 47:
2595
- _context35.next = 52;
2655
+ _context36.next = 52;
2596
2656
  break;
2597
2657
  case 49:
2598
- _context35.prev = 49;
2599
- _context35.t0 = _context35["catch"](20);
2600
- _iterator10.e(_context35.t0);
2658
+ _context36.prev = 49;
2659
+ _context36.t0 = _context36["catch"](20);
2660
+ _iterator10.e(_context36.t0);
2601
2661
  case 52:
2602
- _context35.prev = 52;
2662
+ _context36.prev = 52;
2603
2663
  _iterator10.f();
2604
- return _context35.finish(52);
2664
+ return _context36.finish(52);
2605
2665
  case 55:
2606
2666
  if (!hasChanges) {
2607
- _context35.next = 59;
2667
+ _context36.next = 59;
2608
2668
  break;
2609
2669
  }
2610
- _context35.next = 58;
2670
+ _context36.next = 58;
2611
2671
  return this.store.order.recalculateSummary({
2612
2672
  createIfMissing: true
2613
2673
  });
2614
2674
  case 58:
2615
2675
  this.store.order.persistTempOrder();
2616
2676
  case 59:
2617
- _context35.next = 61;
2677
+ _context36.next = 61;
2618
2678
  return this.refreshItemRuleQuantityLimits();
2619
2679
  case 61:
2620
2680
  this.itemRulePrefillApplied = true;
@@ -2624,9 +2684,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2624
2684
  });
2625
2685
  case 63:
2626
2686
  case "end":
2627
- return _context35.stop();
2687
+ return _context36.stop();
2628
2688
  }
2629
- }, _callee35, this, [[20, 49, 52, 55]]);
2689
+ }, _callee36, this, [[20, 49, 52, 55]]);
2630
2690
  }));
2631
2691
  function applyPrefillByItemRule() {
2632
2692
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -2636,24 +2696,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2636
2696
  }, {
2637
2697
  key: "applyItemRulePrefill",
2638
2698
  value: function () {
2639
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2640
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2641
- while (1) switch (_context36.prev = _context36.next) {
2699
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2700
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2701
+ while (1) switch (_context37.prev = _context37.next) {
2642
2702
  case 0:
2643
2703
  this.logMethodStart('applyItemRulePrefill');
2644
- _context36.next = 3;
2704
+ _context37.next = 3;
2645
2705
  return this.applyPrefillByItemRule();
2646
2706
  case 3:
2647
- _context36.next = 5;
2707
+ _context37.next = 5;
2648
2708
  return this.refreshItemRuleQuantityLimits();
2649
2709
  case 5:
2650
- _context36.next = 7;
2710
+ _context37.next = 7;
2651
2711
  return this.refreshCartValidationPassed();
2652
2712
  case 7:
2653
2713
  case "end":
2654
- return _context36.stop();
2714
+ return _context37.stop();
2655
2715
  }
2656
- }, _callee36, this);
2716
+ }, _callee37, this);
2657
2717
  }));
2658
2718
  function applyItemRulePrefill() {
2659
2719
  return _applyItemRulePrefill.apply(this, arguments);
@@ -2663,20 +2723,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2663
2723
  }, {
2664
2724
  key: "evaluateCartValidationByItemRule",
2665
2725
  value: function () {
2666
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2726
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2667
2727
  var strategyConfigs, businessData;
2668
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2669
- while (1) switch (_context37.prev = _context37.next) {
2728
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2729
+ while (1) switch (_context38.prev = _context38.next) {
2670
2730
  case 0:
2671
- _context37.next = 2;
2731
+ _context38.next = 2;
2672
2732
  return this.ensureItemRuleConfigsLoaded();
2673
2733
  case 2:
2674
- strategyConfigs = _context37.sent;
2734
+ strategyConfigs = _context38.sent;
2675
2735
  if (strategyConfigs.length) {
2676
- _context37.next = 5;
2736
+ _context38.next = 5;
2677
2737
  break;
2678
2738
  }
2679
- return _context37.abrupt("return", {
2739
+ return _context38.abrupt("return", {
2680
2740
  passed: true,
2681
2741
  failures: []
2682
2742
  });
@@ -2686,12 +2746,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2686
2746
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2687
2747
  itemRuleConfigs: this.itemRuleConfigs
2688
2748
  });
2689
- return _context37.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
2749
+ return _context38.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
2690
2750
  case 7:
2691
2751
  case "end":
2692
- return _context37.stop();
2752
+ return _context38.stop();
2693
2753
  }
2694
- }, _callee37, this);
2754
+ }, _callee38, this);
2695
2755
  }));
2696
2756
  function evaluateCartValidationByItemRule() {
2697
2757
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -2701,20 +2761,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2701
2761
  }, {
2702
2762
  key: "validateBeforeSubmitByItemRule",
2703
2763
  value: function () {
2704
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2764
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
2705
2765
  var validationResult, firstFailure, errorMessage, error;
2706
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2707
- while (1) switch (_context38.prev = _context38.next) {
2766
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2767
+ while (1) switch (_context39.prev = _context39.next) {
2708
2768
  case 0:
2709
- _context38.next = 2;
2769
+ _context39.next = 2;
2710
2770
  return this.evaluateCartValidationByItemRule();
2711
2771
  case 2:
2712
- validationResult = _context38.sent;
2772
+ validationResult = _context39.sent;
2713
2773
  if (!validationResult.passed) {
2714
- _context38.next = 5;
2774
+ _context39.next = 5;
2715
2775
  break;
2716
2776
  }
2717
- return _context38.abrupt("return");
2777
+ return _context39.abrupt("return");
2718
2778
  case 5:
2719
2779
  firstFailure = validationResult.failures[0];
2720
2780
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -2723,9 +2783,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2723
2783
  throw error;
2724
2784
  case 10:
2725
2785
  case "end":
2726
- return _context38.stop();
2786
+ return _context39.stop();
2727
2787
  }
2728
- }, _callee38, this);
2788
+ }, _callee39, this);
2729
2789
  }));
2730
2790
  function validateBeforeSubmitByItemRule() {
2731
2791
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -2735,10 +2795,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2735
2795
  }, {
2736
2796
  key: "refreshCartValidationPassed",
2737
2797
  value: function () {
2738
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
2798
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
2739
2799
  var previous, nextState, validationResult, changed;
2740
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2741
- while (1) switch (_context39.prev = _context39.next) {
2800
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
2801
+ while (1) switch (_context40.prev = _context40.next) {
2742
2802
  case 0:
2743
2803
  previous = this.store.cartValidation || {
2744
2804
  passed: null,
@@ -2748,20 +2808,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2748
2808
  passed: null,
2749
2809
  failures: []
2750
2810
  };
2751
- _context39.prev = 2;
2752
- _context39.next = 5;
2811
+ _context40.prev = 2;
2812
+ _context40.next = 5;
2753
2813
  return this.evaluateCartValidationByItemRule();
2754
2814
  case 5:
2755
- validationResult = _context39.sent;
2815
+ validationResult = _context40.sent;
2756
2816
  nextState = {
2757
2817
  passed: validationResult.passed,
2758
2818
  failures: validationResult.failures || []
2759
2819
  };
2760
- _context39.next = 12;
2820
+ _context40.next = 12;
2761
2821
  break;
2762
2822
  case 9:
2763
- _context39.prev = 9;
2764
- _context39.t0 = _context39["catch"](2);
2823
+ _context40.prev = 9;
2824
+ _context40.t0 = _context40["catch"](2);
2765
2825
  nextState = {
2766
2826
  passed: false,
2767
2827
  failures: []
@@ -2770,21 +2830,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2770
2830
  this.store.cartValidation = nextState;
2771
2831
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
2772
2832
  if (!changed) {
2773
- _context39.next = 17;
2833
+ _context40.next = 17;
2774
2834
  break;
2775
2835
  }
2776
- _context39.next = 17;
2836
+ _context40.next = 17;
2777
2837
  return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
2778
2838
  cartValidation: nextState,
2779
2839
  cartValidationPassed: nextState.passed
2780
2840
  });
2781
2841
  case 17:
2782
- return _context39.abrupt("return", nextState.passed);
2842
+ return _context40.abrupt("return", nextState.passed);
2783
2843
  case 18:
2784
2844
  case "end":
2785
- return _context39.stop();
2845
+ return _context40.stop();
2786
2846
  }
2787
- }, _callee39, this, [[2, 9]]);
2847
+ }, _callee40, this, [[2, 9]]);
2788
2848
  }));
2789
2849
  function refreshCartValidationPassed() {
2790
2850
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -2794,14 +2854,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2794
2854
  }, {
2795
2855
  key: "setItemRuleRuntimeConfig",
2796
2856
  value: function () {
2797
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
2857
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
2798
2858
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
2799
2859
  var config,
2800
- _args40 = arguments;
2801
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
2802
- while (1) switch (_context40.prev = _context40.next) {
2860
+ _args41 = arguments;
2861
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
2862
+ while (1) switch (_context41.prev = _context41.next) {
2803
2863
  case 0:
2804
- config = _args40.length > 0 && _args40[0] !== undefined ? _args40[0] : {};
2864
+ config = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
2805
2865
  this.logMethodStart('setItemRuleRuntimeConfig');
2806
2866
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
2807
2867
  pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
@@ -2813,10 +2873,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2813
2873
  this.itemRuleEvaluator.setStrategyConfigs([]);
2814
2874
  }
2815
2875
  this.itemRulePrefillApplied = false;
2816
- _context40.next = 7;
2876
+ _context41.next = 7;
2817
2877
  return this.refreshItemRuleQuantityLimits();
2818
2878
  case 7:
2819
- _context40.next = 9;
2879
+ _context41.next = 9;
2820
2880
  return this.refreshCartValidationPassed();
2821
2881
  case 9:
2822
2882
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -2824,9 +2884,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2824
2884
  });
2825
2885
  case 10:
2826
2886
  case "end":
2827
- return _context40.stop();
2887
+ return _context41.stop();
2828
2888
  }
2829
- }, _callee40, this);
2889
+ }, _callee41, this);
2830
2890
  }));
2831
2891
  function setItemRuleRuntimeConfig() {
2832
2892
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -2839,35 +2899,124 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2839
2899
  return this.otherParams;
2840
2900
  }
2841
2901
 
2902
+ // ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
2903
+ //
2904
+ // 用于物料层持久化 UI 层面的轻量状态(如当前步骤、登录回跳意图等)。
2905
+ // 桶键:pisell.venueBooking.uiState:<cacheId>;内部以 JSON object 形式存储多个字段。
2906
+ // 无 cacheId 时所有方法自动降级为 no-op,上层不用判空。
2907
+ }, {
2908
+ key: "getUIStateBucketKey",
2909
+ value: function getUIStateBucketKey() {
2910
+ if (!this.cacheId) return null;
2911
+ return "".concat(VenueBookingImpl.UI_STATE_KEY_PREFIX).concat(this.cacheId);
2912
+ }
2913
+ }, {
2914
+ key: "readUIStateBucket",
2915
+ value: function readUIStateBucket() {
2916
+ var _this$window;
2917
+ var key = this.getUIStateBucketKey();
2918
+ if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) return {};
2919
+ try {
2920
+ var raw = this.window.sessionStorage.getItem(key) || '{}';
2921
+ var parsed = JSON.parse(raw);
2922
+ return parsed && _typeof(parsed) === 'object' ? parsed : {};
2923
+ } catch (_unused2) {
2924
+ return {};
2925
+ }
2926
+ }
2927
+ }, {
2928
+ key: "writeUIStateBucket",
2929
+ value: function writeUIStateBucket(bucket) {
2930
+ var _this$window2;
2931
+ var key = this.getUIStateBucketKey();
2932
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return;
2933
+ this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
2934
+ }
2935
+ }, {
2936
+ key: "setUIState",
2937
+ value: function setUIState(key, value) {
2938
+ if (!this.getUIStateBucketKey()) return;
2939
+ var bucket = this.readUIStateBucket();
2940
+ bucket[key] = value;
2941
+ this.writeUIStateBucket(bucket);
2942
+ }
2943
+ }, {
2944
+ key: "getUIState",
2945
+ value: function getUIState(key) {
2946
+ if (!this.getUIStateBucketKey()) return undefined;
2947
+ var bucket = this.readUIStateBucket();
2948
+ return bucket[key];
2949
+ }
2950
+ }, {
2951
+ key: "deleteUIState",
2952
+ value: function deleteUIState(key) {
2953
+ if (!this.getUIStateBucketKey()) return;
2954
+ var bucket = this.readUIStateBucket();
2955
+ if (key in bucket) {
2956
+ delete bucket[key];
2957
+ this.writeUIStateBucket(bucket);
2958
+ }
2959
+ }
2960
+
2842
2961
  // ─── OpenData 可用性 ───
2843
2962
  }, {
2844
2963
  key: "checkOpenDataAvailability",
2845
2964
  value: function () {
2846
- var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
2847
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
2848
- while (1) switch (_context41.prev = _context41.next) {
2965
+ var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
2966
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
2967
+ while (1) switch (_context42.prev = _context42.next) {
2849
2968
  case 0:
2850
2969
  if (this.store.openData) {
2851
- _context41.next = 2;
2970
+ _context42.next = 2;
2852
2971
  break;
2853
2972
  }
2854
2973
  throw new Error('openData 模块未初始化');
2855
2974
  case 2:
2856
- _context41.next = 4;
2975
+ _context42.next = 4;
2857
2976
  return this.loadOpenDataConfig();
2858
2977
  case 4:
2859
- return _context41.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
2978
+ return _context42.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
2860
2979
  case 5:
2861
2980
  case "end":
2862
- return _context41.stop();
2981
+ return _context42.stop();
2863
2982
  }
2864
- }, _callee41, this);
2983
+ }, _callee42, this);
2865
2984
  }));
2866
2985
  function checkOpenDataAvailability() {
2867
2986
  return _checkOpenDataAvailability.apply(this, arguments);
2868
2987
  }
2869
2988
  return checkOpenDataAvailability;
2870
2989
  }()
2990
+ }, {
2991
+ key: "setOtherParams",
2992
+ value: function () {
2993
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
2994
+ var _ref7,
2995
+ _ref7$cover,
2996
+ cover,
2997
+ _args43 = arguments;
2998
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
2999
+ while (1) switch (_context43.prev = _context43.next) {
3000
+ case 0:
3001
+ _ref7 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3002
+ if (cover) {
3003
+ this.otherParams = params;
3004
+ } else {
3005
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
3006
+ }
3007
+ case 2:
3008
+ case "end":
3009
+ return _context43.stop();
3010
+ }
3011
+ }, _callee43, this);
3012
+ }));
3013
+ function setOtherParams(_x19) {
3014
+ return _setOtherParams.apply(this, arguments);
3015
+ }
3016
+ return setOtherParams;
3017
+ }()
2871
3018
  }]);
2872
3019
  return VenueBookingImpl;
2873
- }(BaseModule);
3020
+ }(BaseModule);
3021
+ _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3022
+ _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');