@pisell/pisellos 0.0.500 → 0.0.501

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
  2. package/dist/model/strategy/adapter/itemRule/adapter.js +52 -8
  3. package/dist/model/strategy/adapter/itemRule/examples.d.ts +15 -0
  4. package/dist/model/strategy/adapter/itemRule/examples.js +68 -1
  5. package/dist/model/strategy/adapter/itemRule/index.d.ts +1 -1
  6. package/dist/model/strategy/adapter/itemRule/index.js +1 -1
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +20 -1
  8. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  9. package/dist/modules/Order/index.d.ts +6 -0
  10. package/dist/modules/Order/index.js +42 -38
  11. package/dist/modules/Order/types.d.ts +4 -0
  12. package/dist/modules/Order/utils.d.ts +28 -0
  13. package/dist/modules/Order/utils.js +93 -13
  14. package/dist/modules/ProductList/index.js +2 -2
  15. package/dist/modules/Quotation/index.js +6 -3
  16. package/dist/modules/SalesSummary/types.d.ts +2 -1
  17. package/dist/modules/SalesSummary/utils.js +10 -10
  18. package/dist/modules/Schedule/utils.d.ts +1 -1
  19. package/dist/solution/BookingByStep/index.d.ts +2 -2
  20. package/dist/solution/ScanOrder/index.d.ts +7 -0
  21. package/dist/solution/ScanOrder/index.js +284 -67
  22. package/dist/solution/ScanOrder/types.d.ts +22 -5
  23. package/dist/solution/ScanOrder/utils.d.ts +26 -0
  24. package/dist/solution/ScanOrder/utils.js +191 -44
  25. package/dist/solution/VenueBooking/index.d.ts +14 -0
  26. package/dist/solution/VenueBooking/index.js +318 -144
  27. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  28. package/dist/solution/VenueBooking/utils/dateSummary.js +6 -4
  29. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
  30. package/lib/model/strategy/adapter/itemRule/adapter.js +41 -2
  31. package/lib/model/strategy/adapter/itemRule/examples.d.ts +15 -0
  32. package/lib/model/strategy/adapter/itemRule/examples.js +47 -0
  33. package/lib/model/strategy/adapter/itemRule/index.d.ts +1 -1
  34. package/lib/model/strategy/adapter/itemRule/index.js +2 -0
  35. package/lib/model/strategy/adapter/itemRule/type.d.ts +20 -1
  36. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  37. package/lib/modules/Order/index.d.ts +6 -0
  38. package/lib/modules/Order/index.js +20 -36
  39. package/lib/modules/Order/types.d.ts +4 -0
  40. package/lib/modules/Order/utils.d.ts +28 -0
  41. package/lib/modules/Order/utils.js +78 -9
  42. package/lib/modules/ProductList/index.js +3 -2
  43. package/lib/modules/Quotation/index.js +3 -0
  44. package/lib/modules/SalesSummary/types.d.ts +2 -1
  45. package/lib/modules/SalesSummary/utils.js +2 -2
  46. package/lib/modules/Schedule/utils.d.ts +1 -1
  47. package/lib/solution/BookingByStep/index.d.ts +2 -2
  48. package/lib/solution/ScanOrder/index.d.ts +7 -0
  49. package/lib/solution/ScanOrder/index.js +162 -18
  50. package/lib/solution/ScanOrder/types.d.ts +22 -5
  51. package/lib/solution/ScanOrder/utils.d.ts +26 -0
  52. package/lib/solution/ScanOrder/utils.js +128 -19
  53. package/lib/solution/VenueBooking/index.d.ts +14 -0
  54. package/lib/solution/VenueBooking/index.js +156 -30
  55. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  56. package/lib/solution/VenueBooking/utils/dateSummary.js +13 -4
  57. package/package.json +1 -1
@@ -35,6 +35,7 @@ import { createModule } from "../BookingByStep/types";
35
35
  import { ProductList } from "../../modules/ProductList";
36
36
  import { DateModule } from "../../modules/Date";
37
37
  import { ScheduleModule } from "../../modules/Schedule";
38
+ import { calcMinTimeMaxTimeBySchedules } from "../../modules/Schedule/utils";
38
39
  import { QuotationModule } from "../../modules/Quotation";
39
40
  import { OpenDataModule } from "../../modules/OpenData";
40
41
  import { AccountHooks } from "../../modules/Account/types";
@@ -87,6 +88,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
87
88
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
88
89
  _defineProperty(_assertThisInitialized(_this), "window", void 0);
89
90
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
91
+ _defineProperty(_assertThisInitialized(_this), "baseSlotConfig", _objectSpread({}, DEFAULT_SLOT_CONFIG));
90
92
  _defineProperty(_assertThisInitialized(_this), "itemRuleEvaluator", new ItemRuleEvaluator());
91
93
  _defineProperty(_assertThisInitialized(_this), "itemRuleConfigs", []);
92
94
  _defineProperty(_assertThisInitialized(_this), "itemRuleConfigsPromise", null);
@@ -445,6 +447,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
445
447
  openDataModule,
446
448
  _this$store$order,
447
449
  _this$store$order2,
450
+ _this$store$quotation,
451
+ _this$otherParams6,
448
452
  _args6 = arguments;
449
453
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
450
454
  while (1) switch (_context6.prev = _context6.next) {
@@ -458,7 +462,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
458
462
  this.store.status = 'initializing';
459
463
  this.store.error = null;
460
464
  this.store.rawResourceData = [];
461
- this.store.slotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
465
+ this.baseSlotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
466
+ this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
462
467
  this.otherParams = options.otherParams || {};
463
468
  this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
464
469
  this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.venueBookingItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
@@ -473,19 +478,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
473
478
  this.window = core.getPlugin('window');
474
479
  this.request = core.getPlugin('request');
475
480
  if (this.window) {
476
- _context6.next = 23;
481
+ _context6.next = 24;
477
482
  break;
478
483
  }
479
484
  this.logMethodError('initialize', 'window plugin missing');
480
485
  throw new Error('venueBooking解决方案需要 window 插件支持');
481
- case 23:
486
+ case 24:
482
487
  if (this.request) {
483
- _context6.next = 26;
488
+ _context6.next = 27;
484
489
  break;
485
490
  }
486
491
  this.logMethodError('initialize', 'request plugin missing');
487
492
  throw new Error('venueBooking解决方案需要 request 插件支持');
488
- case 26:
493
+ case 27:
489
494
  // 注册基础模块(order, salesSummary, products, logger)
490
495
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
491
496
  baseModules.forEach(function (step) {
@@ -579,44 +584,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
579
584
  }
580
585
  this.registerCustomerLoginListeners();
581
586
  console.log('[VenueBooking] 初始化开始');
582
- _context6.prev = 49;
583
- _context6.next = 52;
587
+ _context6.prev = 50;
588
+ _context6.next = 53;
584
589
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
585
590
  createIfMissing: false
586
591
  });
587
- case 52:
592
+ case 53:
588
593
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
589
- _context6.next = 55;
594
+ _context6.next = 56;
590
595
  return this.loadRuntimeConfigs();
591
- case 55:
596
+ case 56:
592
597
  if (!this.store.schedule) {
593
- _context6.next = 59;
598
+ _context6.next = 61;
594
599
  break;
595
600
  }
596
- _context6.next = 58;
601
+ _context6.next = 59;
597
602
  return this.store.schedule.loadAllSchedule();
598
- case 58:
599
- this.injectScheduleResolverToQuotation();
600
603
  case 59:
601
- this.loadQuotations();
602
- _context6.next = 62;
604
+ this.injectScheduleResolverToQuotation();
605
+ (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
606
+ channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel
607
+ });
608
+ case 61:
609
+ _context6.next = 63;
603
610
  return this.refreshItemRuleQuantityLimits();
604
- case 62:
611
+ case 63:
605
612
  this.store.status = 'ready';
606
613
  console.log('[VenueBooking] 初始化完成');
607
- _context6.next = 66;
614
+ _context6.next = 67;
608
615
  return this.core.effects.emit(VenueBookingHooks.onInited, {
609
616
  status: this.store.status
610
617
  });
611
- case 66:
618
+ case 67:
612
619
  this.logMethodSuccess('initialize', {
613
620
  status: this.store.status
614
621
  });
615
- _context6.next = 76;
622
+ _context6.next = 77;
616
623
  break;
617
- case 69:
618
- _context6.prev = 69;
619
- _context6.t0 = _context6["catch"](49);
624
+ case 70:
625
+ _context6.prev = 70;
626
+ _context6.t0 = _context6["catch"](50);
620
627
  this.store.status = 'error';
621
628
  this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
622
629
  console.error('[VenueBooking] 初始化失败', _context6.t0);
@@ -624,11 +631,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
624
631
  status: this.store.status
625
632
  });
626
633
  throw _context6.t0;
627
- case 76:
634
+ case 77:
628
635
  case "end":
629
636
  return _context6.stop();
630
637
  }
631
- }, _callee6, this, [[49, 69]]);
638
+ }, _callee6, this, [[50, 70]]);
632
639
  }));
633
640
  function initialize(_x5) {
634
641
  return _initialize.apply(this, arguments);
@@ -803,7 +810,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
803
810
  key: "_doLoadAllProducts",
804
811
  value: function () {
805
812
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
806
- var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
813
+ var _this$otherParams7, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
807
814
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
808
815
  while (1) switch (_context11.prev = _context11.next) {
809
816
  case 0:
@@ -821,7 +828,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
821
828
  }
822
829
  throw new Error('addonProducts 模块未初始化');
823
830
  case 6:
824
- 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']) || [];
831
+ associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
825
832
  if (associatedMenus.length) {
826
833
  _context11.next = 9;
827
834
  break;
@@ -1090,27 +1097,105 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1090
1097
  }
1091
1098
  return fetchResourceAvailability;
1092
1099
  }() // ─── 日期概览 & 时间槽矩阵(纯计算,不发请求) ───
1100
+ }, {
1101
+ key: "getOperatingHoursScheduleIds",
1102
+ value: function getOperatingHoursScheduleIds() {
1103
+ var _this$store$openData, _this$store$openData$;
1104
+ var openData = this.otherParams.openData || ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || (_this$store$openData$ = _this$store$openData.getOpenData) === null || _this$store$openData$ === void 0 ? void 0 : _this$store$openData$.call(_this$store$openData)) || null;
1105
+ var rawIds = openData === null || openData === void 0 ? void 0 : openData['availability.operating_hours'];
1106
+ if (!Array.isArray(rawIds)) return [];
1107
+ return _toConsumableArray(new Set(rawIds.map(function (id) {
1108
+ return Number(id);
1109
+ }).filter(function (id) {
1110
+ return Number.isFinite(id) && id > 0;
1111
+ }).map(function (id) {
1112
+ return Math.floor(id);
1113
+ })));
1114
+ }
1115
+ }, {
1116
+ key: "resolveSlotConfigForDate",
1117
+ value: function resolveSlotConfigForDate(date) {
1118
+ var nextSlotConfig = _objectSpread({}, this.baseSlotConfig);
1119
+ if (!date || !this.store.schedule) return nextSlotConfig;
1120
+ var operatingHoursScheduleIds = this.getOperatingHoursScheduleIds();
1121
+ if (!operatingHoursScheduleIds.length) return nextSlotConfig;
1122
+ var scheduleList = this.store.schedule.getScheduleListByIds(operatingHoursScheduleIds);
1123
+ if (!scheduleList.length) return nextSlotConfig;
1124
+ var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
1125
+ var earliestStart = null;
1126
+ var latestEnd = null;
1127
+ var _iterator3 = _createForOfIteratorHelper(scheduleList),
1128
+ _step3;
1129
+ try {
1130
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1131
+ var _timeRangeMap$schedul;
1132
+ var schedule = _step3.value;
1133
+ var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
1134
+ var _iterator4 = _createForOfIteratorHelper(dateRangeList),
1135
+ _step4;
1136
+ try {
1137
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1138
+ var range = _step4.value;
1139
+ var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
1140
+ var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
1141
+ if (!start.isValid() || !end.isValid()) continue;
1142
+ if (!earliestStart || start.isBefore(earliestStart)) {
1143
+ earliestStart = start;
1144
+ }
1145
+ if (!latestEnd || end.isAfter(latestEnd)) {
1146
+ latestEnd = end;
1147
+ }
1148
+ }
1149
+ } catch (err) {
1150
+ _iterator4.e(err);
1151
+ } finally {
1152
+ _iterator4.f();
1153
+ }
1154
+ }
1155
+ } catch (err) {
1156
+ _iterator3.e(err);
1157
+ } finally {
1158
+ _iterator3.f();
1159
+ }
1160
+ if (!earliestStart || !latestEnd) return nextSlotConfig;
1161
+ return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
1162
+ businessStartTime: earliestStart.format('HH:mm'),
1163
+ businessEndTime: latestEnd.format('HH:mm')
1164
+ });
1165
+ }
1166
+ }, {
1167
+ key: "syncOperatingHoursToSlotConfig",
1168
+ value: function syncOperatingHoursToSlotConfig(date) {
1169
+ var resolvedSlotConfig = this.resolveSlotConfigForDate(date);
1170
+ this.store.slotConfig = resolvedSlotConfig;
1171
+ return resolvedSlotConfig;
1172
+ }
1093
1173
  }, {
1094
1174
  key: "getDateRangeSummary",
1095
1175
  value: function getDateRangeSummary(params) {
1176
+ var _this6 = this;
1096
1177
  return buildDateRangeSummary({
1097
1178
  startDate: params.startDate,
1098
1179
  endDate: params.endDate,
1099
- config: this.store.slotConfig,
1180
+ config: this.baseSlotConfig,
1100
1181
  rawResources: this.store.rawResourceData,
1101
1182
  resourceProductMap: this.resourceProductMap,
1102
- quotationModule: this.store.quotation
1183
+ quotationModule: this.store.quotation,
1184
+ resolveConfig: function resolveConfig(date) {
1185
+ return _this6.resolveSlotConfigForDate(date);
1186
+ }
1103
1187
  });
1104
1188
  }
1105
1189
  }, {
1106
1190
  key: "getTimeSlotGrid",
1107
1191
  value: function getTimeSlotGrid(date) {
1192
+ var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1108
1193
  var quotationPriceMap;
1109
1194
  if (this.store.quotation) {
1110
1195
  var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).map(function (m) {
1111
1196
  return m.productId;
1112
1197
  })));
1113
- var timeLabels = generateTimeLabels(this.store.slotConfig);
1198
+ var timeLabels = generateTimeLabels(resolvedSlotConfig);
1114
1199
  var timePoints = timeLabels.map(function (label) {
1115
1200
  return "".concat(date, " ").concat(label);
1116
1201
  });
@@ -1121,7 +1206,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1121
1206
  }
1122
1207
  return buildTimeSlotGrid({
1123
1208
  date: date,
1124
- config: this.store.slotConfig,
1209
+ config: resolvedSlotConfig,
1125
1210
  rawResources: this.store.rawResourceData,
1126
1211
  resourceProductMap: this.resourceProductMap,
1127
1212
  quotationPriceMap: quotationPriceMap
@@ -1218,17 +1303,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1218
1303
  });
1219
1304
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1220
1305
  var slots = [];
1221
- var _iterator3 = _createForOfIteratorHelper(venueProducts),
1222
- _step3;
1306
+ var _iterator5 = _createForOfIteratorHelper(venueProducts),
1307
+ _step5;
1223
1308
  try {
1224
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1225
- var product = _step3.value;
1309
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1310
+ var product = _step5.value;
1226
1311
  slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration)));
1227
1312
  }
1228
1313
  } catch (err) {
1229
- _iterator3.e(err);
1314
+ _iterator5.e(err);
1230
1315
  } finally {
1231
- _iterator3.f();
1316
+ _iterator5.f();
1232
1317
  }
1233
1318
  return slots.sort(function (a, b) {
1234
1319
  return a.startTime.localeCompare(b.startTime);
@@ -1261,12 +1346,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1261
1346
  return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
1262
1347
  });
1263
1348
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1264
- var _iterator4 = _createForOfIteratorHelper(venueProducts),
1265
- _step4;
1349
+ var _iterator6 = _createForOfIteratorHelper(venueProducts),
1350
+ _step6;
1266
1351
  try {
1267
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1352
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1268
1353
  var _product$metadata;
1269
- var product = _step4.value;
1354
+ var product = _step6.value;
1270
1355
  var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
1271
1356
  if (resourceId == null) continue;
1272
1357
  var existing = result.get(resourceId) || [];
@@ -1274,25 +1359,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1274
1359
  result.set(resourceId, existing);
1275
1360
  }
1276
1361
  } catch (err) {
1277
- _iterator4.e(err);
1362
+ _iterator6.e(err);
1278
1363
  } finally {
1279
- _iterator4.f();
1364
+ _iterator6.f();
1280
1365
  }
1281
- var _iterator5 = _createForOfIteratorHelper(result),
1282
- _step5;
1366
+ var _iterator7 = _createForOfIteratorHelper(result),
1367
+ _step7;
1283
1368
  try {
1284
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1285
- var _step5$value = _slicedToArray(_step5.value, 2),
1286
- key = _step5$value[0],
1287
- slots = _step5$value[1];
1369
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1370
+ var _step7$value = _slicedToArray(_step7.value, 2),
1371
+ key = _step7$value[0],
1372
+ slots = _step7$value[1];
1288
1373
  result.set(key, slots.sort(function (a, b) {
1289
1374
  return a.startTime.localeCompare(b.startTime);
1290
1375
  }));
1291
1376
  }
1292
1377
  } catch (err) {
1293
- _iterator5.e(err);
1378
+ _iterator7.e(err);
1294
1379
  } finally {
1295
- _iterator5.f();
1380
+ _iterator7.f();
1296
1381
  }
1297
1382
  return result;
1298
1383
  }
@@ -1361,7 +1446,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1361
1446
  num: 1,
1362
1447
  selling_price: group.totalPrice,
1363
1448
  original_price: group.totalPrice,
1364
- payment_price: group.totalPrice,
1365
1449
  is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
1366
1450
  metadata: {
1367
1451
  venue_booking: true,
@@ -1455,7 +1539,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1455
1539
  }, {
1456
1540
  key: "setSlotConfig",
1457
1541
  value: function setSlotConfig(config) {
1458
- this.store.slotConfig = _objectSpread(_objectSpread({}, this.store.slotConfig), config);
1542
+ this.baseSlotConfig = _objectSpread(_objectSpread({}, this.baseSlotConfig), config);
1543
+ this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
1459
1544
  }
1460
1545
  }, {
1461
1546
  key: "getSlotConfig",
@@ -1505,10 +1590,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1505
1590
  }, {
1506
1591
  key: "injectScheduleResolverToQuotation",
1507
1592
  value: function injectScheduleResolverToQuotation() {
1508
- var _this6 = this;
1593
+ var _this7 = this;
1509
1594
  if (this.store.quotation && this.store.schedule) {
1510
1595
  this.store.quotation.setScheduleResolver(function (id) {
1511
- return _this6.store.schedule.getScheduleListByIds([id])[0];
1596
+ return _this7.store.schedule.getScheduleListByIds([id])[0];
1512
1597
  });
1513
1598
  }
1514
1599
  }
@@ -1586,25 +1671,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1586
1671
  key: "recalculateOrderPricesFromQuotation",
1587
1672
  value: function recalculateOrderPricesFromQuotation() {
1588
1673
  var _tempOrder$products,
1589
- _this7 = this;
1674
+ _this8 = this;
1590
1675
  if (!this.store.order || !this.store.quotation) return;
1591
1676
  var tempOrder = this.store.order.getTempOrder();
1592
1677
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
1593
1678
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
1594
- var _iterator6 = _createForOfIteratorHelper(tempOrder.products),
1595
- _step6;
1679
+ var _iterator8 = _createForOfIteratorHelper(tempOrder.products),
1680
+ _step8;
1596
1681
  try {
1597
1682
  var _loop = function _loop() {
1598
1683
  var _product$metadata2;
1599
- var product = _step6.value;
1684
+ var product = _step8.value;
1600
1685
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
1601
- var mapping = _this7.resourceProductMap.get(product.metadata.resource_id);
1686
+ var mapping = _this8.resourceProductMap.get(product.metadata.resource_id);
1602
1687
  if (!mapping) return 1; // continue
1603
- var slots = expandMergedSlotToIndividual(product, _this7.store.slotConfig.slotDurationMinutes);
1688
+ var slots = expandMergedSlotToIndividual(product, _this8.store.slotConfig.slotDurationMinutes);
1604
1689
  var updatedSlots = slots.map(function (slot) {
1605
1690
  var _getPriceForProduct;
1606
1691
  return _objectSpread(_objectSpread({}, slot), {}, {
1607
- price: (_getPriceForProduct = _this7.store.quotation.getPriceForProduct({
1692
+ price: (_getPriceForProduct = _this8.store.quotation.getPriceForProduct({
1608
1693
  productId: mapping.productId,
1609
1694
  datetime: slot.startTime
1610
1695
  })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
@@ -1613,33 +1698,33 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1613
1698
  var merged = mergeConsecutiveSlots(updatedSlots);
1614
1699
  if (merged.length === 1) {
1615
1700
  product.selling_price = merged[0].totalPrice;
1616
- product.payment_price = merged[0].totalPrice;
1701
+ product.original_price = merged[0].totalPrice;
1617
1702
  product.metadata.price_breakdown = buildPriceBreakdown({
1618
1703
  group: merged[0],
1619
1704
  productId: mapping.productId,
1620
- quotation: _this7.store.quotation
1705
+ quotation: _this8.store.quotation
1621
1706
  });
1622
1707
  }
1623
1708
  } else if (product.product_id != null) {
1624
1709
  var _product$product_vari;
1625
- var quotationPrice = _this7.store.quotation.getPriceForProduct({
1710
+ var quotationPrice = _this8.store.quotation.getPriceForProduct({
1626
1711
  productId: product.product_id,
1627
1712
  variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
1628
1713
  datetime: now
1629
1714
  });
1630
1715
  if (quotationPrice !== null) {
1631
1716
  product.selling_price = quotationPrice;
1632
- product.payment_price = quotationPrice;
1717
+ product.original_price = quotationPrice;
1633
1718
  }
1634
1719
  }
1635
1720
  };
1636
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1721
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1637
1722
  if (_loop()) continue;
1638
1723
  }
1639
1724
  } catch (err) {
1640
- _iterator6.e(err);
1725
+ _iterator8.e(err);
1641
1726
  } finally {
1642
- _iterator6.f();
1727
+ _iterator8.f();
1643
1728
  }
1644
1729
  }
1645
1730
  }, {
@@ -1707,7 +1792,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1707
1792
  key: "setDiscountSelected",
1708
1793
  value: (function () {
1709
1794
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1710
- 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;
1795
+ 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, _iterator9, _step9, d, selectedResourceIds, _iterator10, _step10, _product$discount_lis, product, before, totalPerUnitDiscount, newSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
1711
1796
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1712
1797
  while (1) switch (_context21.prev = _context21.next) {
1713
1798
  case 0:
@@ -1767,18 +1852,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1767
1852
  }).map(function (d) {
1768
1853
  return d.id;
1769
1854
  }));
1770
- _iterator7 = _createForOfIteratorHelper(nextDiscountList);
1855
+ _iterator9 = _createForOfIteratorHelper(nextDiscountList);
1771
1856
  try {
1772
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1773
- d = _step7.value;
1857
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1858
+ d = _step9.value;
1774
1859
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
1775
1860
  d.isSelected = false;
1776
1861
  }
1777
1862
  }
1778
1863
  } catch (err) {
1779
- _iterator7.e(err);
1864
+ _iterator9.e(err);
1780
1865
  } finally {
1781
- _iterator7.f();
1866
+ _iterator9.f();
1782
1867
  }
1783
1868
  }
1784
1869
  }
@@ -1788,15 +1873,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1788
1873
  }).map(function (d) {
1789
1874
  return d.id;
1790
1875
  }));
1791
- _iterator8 = _createForOfIteratorHelper(tempOrder.products);
1876
+ _iterator10 = _createForOfIteratorHelper(tempOrder.products);
1792
1877
  _context21.prev = 19;
1793
- _iterator8.s();
1878
+ _iterator10.s();
1794
1879
  case 21:
1795
- if ((_step8 = _iterator8.n()).done) {
1880
+ if ((_step10 = _iterator10.n()).done) {
1796
1881
  _context21.next = 30;
1797
1882
  break;
1798
1883
  }
1799
- product = _step8.value;
1884
+ product = _step10.value;
1800
1885
  if ((_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length) {
1801
1886
  _context21.next = 25;
1802
1887
  break;
@@ -1810,14 +1895,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1810
1895
  return rid != null && selectedResourceIds.has(rid);
1811
1896
  });
1812
1897
  if (product.discount_list.length < before) {
1813
- totalDiscountAmount = product.discount_list.reduce(function (sum, pd) {
1898
+ // 基于剩余的 discount_list 重算 selling_price。
1899
+ // 约定:pd.amount 为 per-unit 折扣额,remaining 加总即单品券后总折扣。
1900
+ totalPerUnitDiscount = product.discount_list.reduce(function (sum, pd) {
1814
1901
  return sum + (pd.amount || 0);
1815
1902
  }, 0);
1816
- newPaymentPrice = new Decimal(product.selling_price || 0).minus(totalDiscountAmount).toNumber();
1817
- paymentStr = toPriceString(newPaymentPrice);
1818
- product.payment_price = paymentStr;
1903
+ newSellingPrice = new Decimal(product.original_price || product.selling_price || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1904
+ product.selling_price = newSellingPrice;
1819
1905
  if (product.metadata) {
1820
- product.metadata.main_product_selling_price = paymentStr;
1906
+ product.metadata.main_product_selling_price = newSellingPrice;
1821
1907
  }
1822
1908
  }
1823
1909
  case 28:
@@ -1829,10 +1915,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1829
1915
  case 32:
1830
1916
  _context21.prev = 32;
1831
1917
  _context21.t0 = _context21["catch"](19);
1832
- _iterator8.e(_context21.t0);
1918
+ _iterator10.e(_context21.t0);
1833
1919
  case 35:
1834
1920
  _context21.prev = 35;
1835
- _iterator8.f();
1921
+ _iterator10.f();
1836
1922
  return _context21.finish(35);
1837
1923
  case 38:
1838
1924
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
@@ -1964,7 +2050,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1964
2050
  key: "submitOrder",
1965
2051
  value: function () {
1966
2052
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1967
- var _tempOrder$products2, result, tempOrder;
2053
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _tempOrder$products2, result, tempOrder;
1968
2054
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1969
2055
  while (1) switch (_context24.prev = _context24.next) {
1970
2056
  case 0:
@@ -1981,7 +2067,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1981
2067
  case 6:
1982
2068
  _context24.next = 8;
1983
2069
  return this.store.order.submitTempOrder({
1984
- cacheId: this.cacheId
2070
+ cacheId: this.cacheId,
2071
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
2072
+ businessCode: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode,
2073
+ channel: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.channel,
2074
+ type: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type
1985
2075
  });
1986
2076
  case 8:
1987
2077
  result = _context24.sent;
@@ -2033,10 +2123,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2033
2123
  });
2034
2124
  if (quotationPrice !== null) {
2035
2125
  product.selling_price = quotationPrice;
2036
- if (product.original_price == null) {
2037
- product.original_price = quotationPrice;
2038
- }
2039
- product.payment_price = quotationPrice;
2126
+ product.original_price = quotationPrice;
2127
+ } else if (product.selling_price != null) {
2128
+ product.original_price = product.selling_price;
2040
2129
  }
2041
2130
  }
2042
2131
  _context25.next = 7;
@@ -2201,7 +2290,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2201
2290
  key: "loadOpenDataConfig",
2202
2291
  value: function () {
2203
2292
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2204
- var _this8 = this;
2293
+ var _this9 = this;
2205
2294
  var lastFetchedAt, cachedData;
2206
2295
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2207
2296
  while (1) switch (_context29.prev = _context29.next) {
@@ -2232,10 +2321,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2232
2321
  target: 'venue_booking+online_store',
2233
2322
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2234
2323
  }).then(function (openDataConfig) {
2235
- _this8.otherParams.openData = openDataConfig;
2324
+ _this9.otherParams.openData = openDataConfig;
2236
2325
  return openDataConfig;
2237
2326
  }).finally(function () {
2238
- _this8.loadOpenDataConfigInFlight = null;
2327
+ _this9.loadOpenDataConfigInFlight = null;
2239
2328
  });
2240
2329
  return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2241
2330
  case 11:
@@ -2364,17 +2453,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2364
2453
  if (visited.has(value)) return;
2365
2454
  visited.add(value);
2366
2455
  if (Array.isArray(value)) {
2367
- var _iterator9 = _createForOfIteratorHelper(value),
2368
- _step9;
2456
+ var _iterator11 = _createForOfIteratorHelper(value),
2457
+ _step11;
2369
2458
  try {
2370
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
2371
- var item = _step9.value;
2459
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2460
+ var item = _step11.value;
2372
2461
  collectFromValue(item);
2373
2462
  }
2374
2463
  } catch (err) {
2375
- _iterator9.e(err);
2464
+ _iterator11.e(err);
2376
2465
  } finally {
2377
- _iterator9.f();
2466
+ _iterator11.f();
2378
2467
  }
2379
2468
  return;
2380
2469
  }
@@ -2422,7 +2511,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2422
2511
  key: "ensureItemRuleConfigsLoaded",
2423
2512
  value: function () {
2424
2513
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2425
- var _this9 = this;
2514
+ var _this10 = this;
2426
2515
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2427
2516
  while (1) switch (_context34.prev = _context34.next) {
2428
2517
  case 0:
@@ -2443,19 +2532,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2443
2532
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2444
2533
  while (1) switch (_context33.prev = _context33.next) {
2445
2534
  case 0:
2446
- runtimeConfig = _this9.getItemRuleRuntimeConfig();
2535
+ runtimeConfig = _this10.getItemRuleRuntimeConfig();
2447
2536
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2448
2537
  if (!(staticConfigs.length > 0)) {
2449
2538
  _context33.next = 6;
2450
2539
  break;
2451
2540
  }
2452
- _this9.itemRuleConfigs = staticConfigs;
2453
- _this9.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2454
- return _context33.abrupt("return", _this9.itemRuleConfigs);
2541
+ _this10.itemRuleConfigs = staticConfigs;
2542
+ _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2543
+ return _context33.abrupt("return", _this10.itemRuleConfigs);
2455
2544
  case 6:
2456
- _this9.itemRuleConfigs = [];
2457
- _this9.itemRuleEvaluator.setStrategyConfigs([]);
2458
- return _context33.abrupt("return", _this9.itemRuleConfigs);
2545
+ _this10.itemRuleConfigs = [];
2546
+ _this10.itemRuleEvaluator.setStrategyConfigs([]);
2547
+ return _context33.abrupt("return", _this10.itemRuleConfigs);
2459
2548
  case 9:
2460
2549
  case "end":
2461
2550
  return _context33.stop();
@@ -2529,7 +2618,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2529
2618
  key: "applyPrefillByItemRule",
2530
2619
  value: function () {
2531
2620
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2532
- 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;
2621
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator12, _step12, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
2533
2622
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2534
2623
  while (1) switch (_context36.prev = _context36.next) {
2535
2624
  case 0:
@@ -2574,15 +2663,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2574
2663
  productSourceMap = _context36.sent;
2575
2664
  tempOrder = this.ensureTempOrder();
2576
2665
  hasChanges = false;
2577
- _iterator10 = _createForOfIteratorHelper(prefillItems);
2666
+ _iterator12 = _createForOfIteratorHelper(prefillItems);
2578
2667
  _context36.prev = 20;
2579
- _iterator10.s();
2668
+ _iterator12.s();
2580
2669
  case 22:
2581
- if ((_step10 = _iterator10.n()).done) {
2582
- _context36.next = 47;
2670
+ if ((_step12 = _iterator12.n()).done) {
2671
+ _context36.next = 45;
2583
2672
  break;
2584
2673
  }
2585
- prefillItem = _step10.value;
2674
+ prefillItem = _step12.value;
2586
2675
  productId = Number(prefillItem.product_id);
2587
2676
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
2588
2677
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -2590,13 +2679,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2590
2679
  _context36.next = 29;
2591
2680
  break;
2592
2681
  }
2593
- return _context36.abrupt("continue", 45);
2682
+ return _context36.abrupt("continue", 43);
2594
2683
  case 29:
2595
2684
  if (!Number.isNaN(productVariantId)) {
2596
2685
  _context36.next = 31;
2597
2686
  break;
2598
2687
  }
2599
- return _context36.abrupt("continue", 45);
2688
+ return _context36.abrupt("continue", 43);
2600
2689
  case 31:
2601
2690
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
2602
2691
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -2604,19 +2693,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2604
2693
  product_variant_id: productVariantId
2605
2694
  });
2606
2695
  if (!(productIndex === -1)) {
2607
- _context36.next = 40;
2696
+ _context36.next = 38;
2608
2697
  break;
2609
2698
  }
2610
2699
  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');
2611
- originalPrice = toPriceString((_ref5 = (_sourceItem$original_ = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.original_price) !== null && _sourceItem$original_ !== void 0 ? _sourceItem$original_ : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _ref5 !== void 0 ? _ref5 : sellingPrice, sellingPrice);
2612
- paymentPrice = toPriceString((_ref6 = (_sourceItem$payment_p = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.payment_price) !== null && _sourceItem$payment_p !== void 0 ? _sourceItem$payment_p : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _ref6 !== void 0 ? _ref6 : sellingPrice, sellingPrice);
2613
2700
  tempOrder.products.push(normalizeOrderProduct({
2614
2701
  product_id: productId,
2615
2702
  product_variant_id: productVariantId,
2616
2703
  num: targetQuantity,
2617
2704
  selling_price: sellingPrice,
2618
- original_price: originalPrice,
2619
- payment_price: paymentPrice,
2705
+ original_price: sellingPrice,
2620
2706
  metadata: {
2621
2707
  item_rule_prefill: true,
2622
2708
  item_rule_id: prefillItem.ruleId
@@ -2627,8 +2713,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2627
2713
  })
2628
2714
  }));
2629
2715
  hasChanges = true;
2630
- return _context36.abrupt("continue", 45);
2631
- case 40:
2716
+ return _context36.abrupt("continue", 43);
2717
+ case 38:
2632
2718
  targetProduct = tempOrder.products[productIndex];
2633
2719
  existedQuantity = toNonNegativeInt(targetProduct.num);
2634
2720
  delta = targetQuantity - existedQuantity;
@@ -2645,45 +2731,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2645
2731
  tempOrder.products[productIndex] = nextProduct;
2646
2732
  hasChanges = true;
2647
2733
  }
2648
- case 45:
2734
+ case 43:
2649
2735
  _context36.next = 22;
2650
2736
  break;
2651
- case 47:
2652
- _context36.next = 52;
2737
+ case 45:
2738
+ _context36.next = 50;
2653
2739
  break;
2654
- case 49:
2655
- _context36.prev = 49;
2740
+ case 47:
2741
+ _context36.prev = 47;
2656
2742
  _context36.t0 = _context36["catch"](20);
2657
- _iterator10.e(_context36.t0);
2658
- case 52:
2659
- _context36.prev = 52;
2660
- _iterator10.f();
2661
- return _context36.finish(52);
2662
- case 55:
2743
+ _iterator12.e(_context36.t0);
2744
+ case 50:
2745
+ _context36.prev = 50;
2746
+ _iterator12.f();
2747
+ return _context36.finish(50);
2748
+ case 53:
2663
2749
  if (!hasChanges) {
2664
- _context36.next = 59;
2750
+ _context36.next = 57;
2665
2751
  break;
2666
2752
  }
2667
- _context36.next = 58;
2753
+ _context36.next = 56;
2668
2754
  return this.store.order.recalculateSummary({
2669
2755
  createIfMissing: true
2670
2756
  });
2671
- case 58:
2757
+ case 56:
2672
2758
  this.store.order.persistTempOrder();
2673
- case 59:
2674
- _context36.next = 61;
2759
+ case 57:
2760
+ _context36.next = 59;
2675
2761
  return this.refreshItemRuleQuantityLimits();
2676
- case 61:
2762
+ case 59:
2677
2763
  this.itemRulePrefillApplied = true;
2678
2764
  this.logMethodSuccess('applyPrefillByItemRule', {
2679
2765
  prefillCount: prefillItems.length,
2680
2766
  hasChanges: hasChanges
2681
2767
  });
2682
- case 63:
2768
+ case 61:
2683
2769
  case "end":
2684
2770
  return _context36.stop();
2685
2771
  }
2686
- }, _callee36, this, [[20, 49, 52, 55]]);
2772
+ }, _callee36, this, [[20, 47, 50, 53]]);
2687
2773
  }));
2688
2774
  function applyPrefillByItemRule() {
2689
2775
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -2896,6 +2982,65 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2896
2982
  return this.otherParams;
2897
2983
  }
2898
2984
 
2985
+ // ─── UI 状态缓存(按 cacheId 分桶,sessionStorage) ───
2986
+ //
2987
+ // 用于物料层持久化 UI 层面的轻量状态(如当前步骤、登录回跳意图等)。
2988
+ // 桶键:pisell.venueBooking.uiState:<cacheId>;内部以 JSON object 形式存储多个字段。
2989
+ // 无 cacheId 时所有方法自动降级为 no-op,上层不用判空。
2990
+ }, {
2991
+ key: "getUIStateBucketKey",
2992
+ value: function getUIStateBucketKey() {
2993
+ if (!this.cacheId) return null;
2994
+ return "".concat(VenueBookingImpl.UI_STATE_KEY_PREFIX).concat(this.cacheId);
2995
+ }
2996
+ }, {
2997
+ key: "readUIStateBucket",
2998
+ value: function readUIStateBucket() {
2999
+ var _this$window;
3000
+ var key = this.getUIStateBucketKey();
3001
+ if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) return {};
3002
+ try {
3003
+ var raw = this.window.sessionStorage.getItem(key) || '{}';
3004
+ var parsed = JSON.parse(raw);
3005
+ return parsed && _typeof(parsed) === 'object' ? parsed : {};
3006
+ } catch (_unused2) {
3007
+ return {};
3008
+ }
3009
+ }
3010
+ }, {
3011
+ key: "writeUIStateBucket",
3012
+ value: function writeUIStateBucket(bucket) {
3013
+ var _this$window2;
3014
+ var key = this.getUIStateBucketKey();
3015
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return;
3016
+ this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
3017
+ }
3018
+ }, {
3019
+ key: "setUIState",
3020
+ value: function setUIState(key, value) {
3021
+ if (!this.getUIStateBucketKey()) return;
3022
+ var bucket = this.readUIStateBucket();
3023
+ bucket[key] = value;
3024
+ this.writeUIStateBucket(bucket);
3025
+ }
3026
+ }, {
3027
+ key: "getUIState",
3028
+ value: function getUIState(key) {
3029
+ if (!this.getUIStateBucketKey()) return undefined;
3030
+ var bucket = this.readUIStateBucket();
3031
+ return bucket[key];
3032
+ }
3033
+ }, {
3034
+ key: "deleteUIState",
3035
+ value: function deleteUIState(key) {
3036
+ if (!this.getUIStateBucketKey()) return;
3037
+ var bucket = this.readUIStateBucket();
3038
+ if (key in bucket) {
3039
+ delete bucket[key];
3040
+ this.writeUIStateBucket(bucket);
3041
+ }
3042
+ }
3043
+
2899
3044
  // ─── OpenData 可用性 ───
2900
3045
  }, {
2901
3046
  key: "checkOpenDataAvailability",
@@ -2925,7 +3070,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2925
3070
  }
2926
3071
  return checkOpenDataAvailability;
2927
3072
  }()
3073
+ }, {
3074
+ key: "setOtherParams",
3075
+ value: function () {
3076
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3077
+ var _ref5,
3078
+ _ref5$cover,
3079
+ cover,
3080
+ _args43 = arguments;
3081
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3082
+ while (1) switch (_context43.prev = _context43.next) {
3083
+ case 0:
3084
+ _ref5 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3085
+ if (cover) {
3086
+ this.otherParams = params;
3087
+ } else {
3088
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
3089
+ }
3090
+ case 2:
3091
+ case "end":
3092
+ return _context43.stop();
3093
+ }
3094
+ }, _callee43, this);
3095
+ }));
3096
+ function setOtherParams(_x19) {
3097
+ return _setOtherParams.apply(this, arguments);
3098
+ }
3099
+ return setOtherParams;
3100
+ }()
2928
3101
  }]);
2929
3102
  return VenueBookingImpl;
2930
3103
  }(BaseModule);
2931
- _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3104
+ _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3105
+ _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');