@pisell/pisellos 2.1.125 → 2.1.127

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 (48) 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/modules/Order/index.d.ts +1 -1
  9. package/dist/modules/Order/index.js +6 -40
  10. package/dist/modules/Order/utils.d.ts +24 -0
  11. package/dist/modules/Order/utils.js +87 -11
  12. package/dist/modules/SalesSummary/types.d.ts +2 -1
  13. package/dist/modules/SalesSummary/utils.js +10 -10
  14. package/dist/modules/Schedule/utils.d.ts +1 -1
  15. package/dist/solution/ScanOrder/index.d.ts +5 -0
  16. package/dist/solution/ScanOrder/index.js +205 -64
  17. package/dist/solution/ScanOrder/types.d.ts +19 -5
  18. package/dist/solution/ScanOrder/utils.d.ts +15 -0
  19. package/dist/solution/ScanOrder/utils.js +142 -62
  20. package/dist/solution/VenueBooking/index.d.ts +4 -0
  21. package/dist/solution/VenueBooking/index.js +219 -141
  22. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  23. package/dist/solution/VenueBooking/utils/dateSummary.js +6 -4
  24. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
  25. package/lib/model/strategy/adapter/itemRule/adapter.js +41 -2
  26. package/lib/model/strategy/adapter/itemRule/examples.d.ts +15 -0
  27. package/lib/model/strategy/adapter/itemRule/examples.js +47 -0
  28. package/lib/model/strategy/adapter/itemRule/index.d.ts +1 -1
  29. package/lib/model/strategy/adapter/itemRule/index.js +2 -0
  30. package/lib/model/strategy/adapter/itemRule/type.d.ts +20 -1
  31. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  32. package/lib/modules/Order/index.d.ts +1 -1
  33. package/lib/modules/Order/index.js +4 -37
  34. package/lib/modules/Order/utils.d.ts +24 -0
  35. package/lib/modules/Order/utils.js +65 -4
  36. package/lib/modules/SalesSummary/types.d.ts +2 -1
  37. package/lib/modules/SalesSummary/utils.js +2 -2
  38. package/lib/modules/Schedule/utils.d.ts +1 -1
  39. package/lib/solution/ScanOrder/index.d.ts +5 -0
  40. package/lib/solution/ScanOrder/index.js +94 -18
  41. package/lib/solution/ScanOrder/types.d.ts +19 -5
  42. package/lib/solution/ScanOrder/utils.d.ts +15 -0
  43. package/lib/solution/ScanOrder/utils.js +86 -19
  44. package/lib/solution/VenueBooking/index.d.ts +4 -0
  45. package/lib/solution/VenueBooking/index.js +85 -25
  46. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  47. package/lib/solution/VenueBooking/utils/dateSummary.js +13 -4
  48. package/package.json +1 -1
@@ -22,9 +22,10 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
22
22
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
23
  import { BaseModule } from "../../modules/BaseModule";
24
24
  import { ScanOrderHooks } from "./types";
25
- import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, createEmptySummary, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toNonNegativeNumber, toPriceString, toBoolean, toPositiveString } from "./utils";
25
+ import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, createEmptySummary, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toNonNegativeNumber, toPriceString, toBoolean, toPositiveString } from "./utils";
26
26
  import { createModule } from "../BookingByStep/types";
27
27
  import { ProductList } from "../../modules/ProductList";
28
+ import { normalizeSubmitCollectPaxValue } from "../../modules/Order/utils";
28
29
  import dayjs from 'dayjs';
29
30
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
30
31
  export * from "./types";
@@ -51,7 +52,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
51
52
  cartValidation: {
52
53
  passed: null,
53
54
  failures: []
54
- }
55
+ },
56
+ entryPaxNumber: 1
55
57
  });
56
58
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
57
59
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
@@ -635,7 +637,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
635
637
  key: "submitScanOrder",
636
638
  value: function () {
637
639
  var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
638
- var _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, result, tempOrder;
640
+ var _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, pax, tempOrderForSubmit, result, tempOrder;
639
641
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
640
642
  while (1) switch (_context9.prev = _context9.next) {
641
643
  case 0:
@@ -650,7 +652,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
650
652
  }
651
653
  throw new Error('scanOrder解决方案需要 order 模块支持');
652
654
  case 6:
653
- _context9.next = 8;
655
+ pax = normalizeSubmitCollectPaxValue(this.store.entryPaxNumber);
656
+ this.store.entryPaxNumber = pax;
657
+ tempOrderForSubmit = this.store.order.ensureTempOrder();
658
+ tempOrderForSubmit.metadata = _objectSpread(_objectSpread({}, tempOrderForSubmit.metadata), {}, {
659
+ collect_pax: pax
660
+ });
661
+ this.store.order.persistTempOrder();
662
+ _context9.next = 13;
654
663
  return this.store.order.submitTempOrder({
655
664
  cacheId: this.cacheId,
656
665
  platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
@@ -658,23 +667,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
658
667
  channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel,
659
668
  type: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.type
660
669
  });
661
- case 8:
670
+ case 13:
662
671
  result = _context9.sent;
663
672
  tempOrder = this.store.order.getTempOrder();
664
673
  this.logMethodSuccess('submitScanOrder', {
665
674
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
666
675
  });
667
676
  return _context9.abrupt("return", result);
668
- case 14:
669
- _context9.prev = 14;
677
+ case 19:
678
+ _context9.prev = 19;
670
679
  _context9.t0 = _context9["catch"](1);
671
680
  this.logMethodError('submitScanOrder', _context9.t0);
672
681
  throw _context9.t0;
673
- case 18:
682
+ case 23:
674
683
  case "end":
675
684
  return _context9.stop();
676
685
  }
677
- }, _callee9, this, [[1, 14]]);
686
+ }, _callee9, this, [[1, 19]]);
678
687
  }));
679
688
  function submitScanOrder() {
680
689
  return _submitScanOrder.apply(this, arguments);
@@ -1160,7 +1169,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1160
1169
  key: "applyPrefillByItemRule",
1161
1170
  value: function () {
1162
1171
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1163
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator2, _step2, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _ref3, _sourceItem$original_, _ref4, _sourceItem$payment_p, sellingPrice, originalPrice, paymentPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
1172
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator2, _step2, _prefillItem$product_, _targetProduct$_origi, _targetProduct$_origi2, _targetProduct$_origi3, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
1164
1173
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1165
1174
  while (1) switch (_context20.prev = _context20.next) {
1166
1175
  case 0:
@@ -1210,7 +1219,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1210
1219
  _iterator2.s();
1211
1220
  case 22:
1212
1221
  if ((_step2 = _iterator2.n()).done) {
1213
- _context20.next = 49;
1222
+ _context20.next = 47;
1214
1223
  break;
1215
1224
  }
1216
1225
  prefillItem = _step2.value;
@@ -1221,13 +1230,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1221
1230
  _context20.next = 29;
1222
1231
  break;
1223
1232
  }
1224
- return _context20.abrupt("continue", 47);
1233
+ return _context20.abrupt("continue", 45);
1225
1234
  case 29:
1226
1235
  if (!Number.isNaN(productVariantId)) {
1227
1236
  _context20.next = 31;
1228
1237
  break;
1229
1238
  }
1230
- return _context20.abrupt("continue", 47);
1239
+ return _context20.abrupt("continue", 45);
1231
1240
  case 31:
1232
1241
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
1233
1242
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -1235,19 +1244,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1235
1244
  product_variant_id: productVariantId
1236
1245
  });
1237
1246
  if (!(productIndex === -1)) {
1238
- _context20.next = 40;
1247
+ _context20.next = 38;
1239
1248
  break;
1240
1249
  }
1241
1250
  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');
1242
- originalPrice = toPriceString((_ref3 = (_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 && _ref3 !== void 0 ? _ref3 : sellingPrice, sellingPrice);
1243
- paymentPrice = toPriceString((_ref4 = (_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 && _ref4 !== void 0 ? _ref4 : sellingPrice, sellingPrice);
1244
1251
  tempOrder.products.push(normalizeOrderProduct({
1245
1252
  product_id: productId,
1246
1253
  product_variant_id: productVariantId,
1247
1254
  num: targetQuantity,
1248
1255
  selling_price: sellingPrice,
1249
- original_price: originalPrice,
1250
- payment_price: paymentPrice,
1256
+ original_price: sellingPrice,
1251
1257
  metadata: {
1252
1258
  item_rule_prefill: true,
1253
1259
  item_rule_id: prefillItem.ruleId
@@ -1258,8 +1264,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1258
1264
  })
1259
1265
  }));
1260
1266
  hasChanges = true;
1261
- return _context20.abrupt("continue", 47);
1262
- case 40:
1267
+ return _context20.abrupt("continue", 45);
1268
+ case 38:
1263
1269
  targetProduct = tempOrder.products[productIndex];
1264
1270
  existedQuantity = toNonNegativeInt(targetProduct.num);
1265
1271
  delta = targetQuantity - existedQuantity;
@@ -1278,45 +1284,45 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1278
1284
  tempOrder.products[productIndex] = nextProduct;
1279
1285
  hasChanges = true;
1280
1286
  }
1281
- case 47:
1287
+ case 45:
1282
1288
  _context20.next = 22;
1283
1289
  break;
1284
- case 49:
1285
- _context20.next = 54;
1290
+ case 47:
1291
+ _context20.next = 52;
1286
1292
  break;
1287
- case 51:
1288
- _context20.prev = 51;
1293
+ case 49:
1294
+ _context20.prev = 49;
1289
1295
  _context20.t0 = _context20["catch"](20);
1290
1296
  _iterator2.e(_context20.t0);
1291
- case 54:
1292
- _context20.prev = 54;
1297
+ case 52:
1298
+ _context20.prev = 52;
1293
1299
  _iterator2.f();
1294
- return _context20.finish(54);
1295
- case 57:
1300
+ return _context20.finish(52);
1301
+ case 55:
1296
1302
  if (!hasChanges) {
1297
- _context20.next = 61;
1303
+ _context20.next = 59;
1298
1304
  break;
1299
1305
  }
1300
- _context20.next = 60;
1306
+ _context20.next = 58;
1301
1307
  return this.store.order.recalculateSummary({
1302
1308
  createIfMissing: true
1303
1309
  });
1304
- case 60:
1310
+ case 58:
1305
1311
  this.store.order.persistTempOrder();
1306
- case 61:
1307
- _context20.next = 63;
1312
+ case 59:
1313
+ _context20.next = 61;
1308
1314
  return this.refreshItemRuleQuantityLimits();
1309
- case 63:
1315
+ case 61:
1310
1316
  this.itemRulePrefillApplied = true;
1311
1317
  this.logMethodSuccess('applyPrefillByItemRule', {
1312
1318
  prefillCount: prefillItems.length,
1313
1319
  hasChanges: hasChanges
1314
1320
  });
1315
- case 65:
1321
+ case 63:
1316
1322
  case "end":
1317
1323
  return _context20.stop();
1318
1324
  }
1319
- }, _callee20, this, [[20, 51, 54, 57]]);
1325
+ }, _callee20, this, [[20, 49, 52, 55]]);
1320
1326
  }));
1321
1327
  function applyPrefillByItemRule() {
1322
1328
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -1327,19 +1333,26 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1327
1333
  key: "applyItemRulePrefill",
1328
1334
  value: function () {
1329
1335
  var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1336
+ var _this$store$order4, _this$store$order4$ge;
1330
1337
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1331
1338
  while (1) switch (_context21.prev = _context21.next) {
1332
1339
  case 0:
1340
+ if (!((_this$store$order4 = this.store.order) !== null && _this$store$order4 !== void 0 && (_this$store$order4$ge = _this$store$order4.getLastOrderInfo) !== null && _this$store$order4$ge !== void 0 && _this$store$order4$ge.call(_this$store$order4))) {
1341
+ _context21.next = 2;
1342
+ break;
1343
+ }
1344
+ return _context21.abrupt("return");
1345
+ case 2:
1333
1346
  this.logMethodStart('applyItemRulePrefill');
1334
- _context21.next = 3;
1335
- return this.applyPrefillByItemRule();
1336
- case 3:
1337
1347
  _context21.next = 5;
1338
- return this.refreshItemRuleQuantityLimits();
1348
+ return this.applyPrefillByItemRule();
1339
1349
  case 5:
1340
1350
  _context21.next = 7;
1341
- return this.refreshCartValidationPassed();
1351
+ return this.refreshItemRuleQuantityLimits();
1342
1352
  case 7:
1353
+ _context21.next = 9;
1354
+ return this.refreshCartValidationPassed();
1355
+ case 9:
1343
1356
  case "end":
1344
1357
  return _context21.stop();
1345
1358
  }
@@ -1526,7 +1539,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1526
1539
  }, {
1527
1540
  key: "normalizeResourceState",
1528
1541
  value: function normalizeResourceState(config, hasOrderId) {
1529
- var _this$otherParams8;
1542
+ var _this$otherParams8, _config$table_form_re;
1530
1543
  var orderNumberPrefix = Array.isArray(config === null || config === void 0 ? void 0 : config.order_number_prefix) ? (config === null || config === void 0 ? void 0 : config.order_number_prefix) || [] : [];
1531
1544
  var tableMaxNumber = Number((config === null || config === void 0 ? void 0 : config.table_max_number) || 1);
1532
1545
  var orderCount = toNonNegativeNumber(config === null || config === void 0 ? void 0 : config.order_count);
@@ -1605,7 +1618,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1605
1618
  isExclusive: isExclusive,
1606
1619
  isFull: isFull,
1607
1620
  orderNumberPrefix: orderNumberPrefix,
1608
- raw: config
1621
+ raw: config,
1622
+ table_form_record: (_config$table_form_re = config === null || config === void 0 ? void 0 : config.table_form_record) !== null && _config$table_form_re !== void 0 ? _config$table_form_re : null
1609
1623
  });
1610
1624
  }
1611
1625
  }, {
@@ -1654,7 +1668,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1654
1668
  key: "checkResourceAvailable",
1655
1669
  value: function () {
1656
1670
  var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(resourceId, hasOrderId) {
1657
- var _this$otherParams9, _this$otherParams9$ge, _config$table_form_re, _config$table_form_re2, _this$otherParams10, _this$store$order4, openData, dineInConfig, shopClosedInfo, config, resourceState, availabilityInfo, tempOrder, reservationLinkIds, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, _this$store$order5;
1671
+ var _this$otherParams9, _this$otherParams9$ge, _config$table_form_re2, _config$table_form_re3, _this$otherParams10, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams11, openData, dineInConfig, shopClosedInfo, config, resourceState, availabilityInfo, tempOrder, reservationLinkIds, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
1658
1672
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1659
1673
  while (1) switch (_context27.prev = _context27.next) {
1660
1674
  case 0:
@@ -1713,8 +1727,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1713
1727
  relation_id: resourceState.relationId,
1714
1728
  table_form_id: resourceState.tableFormId,
1715
1729
  deskmate_valid: resourceState.deskmate_valid,
1716
- policy: config === null || config === void 0 || (_config$table_form_re = config.table_form_record) === null || _config$table_form_re === void 0 ? void 0 : _config$table_form_re.policy,
1717
- partyroom_booking: config === null || config === void 0 || (_config$table_form_re2 = config.table_form_record) === null || _config$table_form_re2 === void 0 ? void 0 : _config$table_form_re2.partyroom_booking
1730
+ table_form_record: resourceState.table_form_record,
1731
+ policy: config === null || config === void 0 || (_config$table_form_re2 = config.table_form_record) === null || _config$table_form_re2 === void 0 ? void 0 : _config$table_form_re2.policy,
1732
+ partyroom_booking: config === null || config === void 0 || (_config$table_form_re3 = config.table_form_record) === null || _config$table_form_re3 === void 0 ? void 0 : _config$table_form_re3.partyroom_booking
1718
1733
  };
1719
1734
  tempOrder = this.ensureTempOrder();
1720
1735
  tempOrder.relation_id = resourceId || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.relation_id);
@@ -1726,7 +1741,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1726
1741
  break;
1727
1742
  }
1728
1743
  this.enabledReservationRuleProducts = [];
1729
- if (this.store.resource) delete this.store.resource.requestEntryPax;
1744
+ if (this.store.resource) {
1745
+ delete this.store.resource.requestEntryPax;
1746
+ delete this.store.resource.requestPaxMin;
1747
+ delete this.store.resource.requestPaxMax;
1748
+ }
1730
1749
  _context27.next = 42;
1731
1750
  break;
1732
1751
  case 31:
@@ -1766,12 +1785,33 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1766
1785
  if (hasCustomCapacityProduct(loaded)) {
1767
1786
  availabilityInfo.requestEntryPax = 1;
1768
1787
  if (this.store.resource) this.store.resource.requestEntryPax = 1;
1788
+ delete availabilityInfo.requestPaxMin;
1789
+ delete availabilityInfo.requestPaxMax;
1790
+ if (this.store.resource) {
1791
+ delete this.store.resource.requestPaxMin;
1792
+ delete this.store.resource.requestPaxMax;
1793
+ }
1794
+ paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
1795
+ if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.min) !== undefined) {
1796
+ availabilityInfo.requestPaxMin = paxBounds.min;
1797
+ if (this.store.resource) this.store.resource.requestPaxMin = paxBounds.min;
1798
+ }
1799
+ if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) {
1800
+ availabilityInfo.requestPaxMax = paxBounds.max;
1801
+ if (this.store.resource) this.store.resource.requestPaxMax = paxBounds.max;
1802
+ }
1769
1803
  } else if (this.store.resource) {
1770
1804
  delete this.store.resource.requestEntryPax;
1805
+ delete this.store.resource.requestPaxMin;
1806
+ delete this.store.resource.requestPaxMax;
1771
1807
  }
1772
1808
  } else {
1773
1809
  this.enabledReservationRuleProducts = [];
1774
- if (this.store.resource) delete this.store.resource.requestEntryPax;
1810
+ if (this.store.resource) {
1811
+ delete this.store.resource.requestEntryPax;
1812
+ delete this.store.resource.requestPaxMin;
1813
+ delete this.store.resource.requestPaxMax;
1814
+ }
1775
1815
  void this.addScanOrderLog({
1776
1816
  level: 'error',
1777
1817
  title: '[ScanOrder] enabled_reservation_rules product query failed',
@@ -1782,7 +1822,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1782
1822
  });
1783
1823
  }
1784
1824
  case 42:
1785
- (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
1825
+ (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
1786
1826
 
1787
1827
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
1788
1828
  if (!(availabilityInfo.mode === 'idle')) {
@@ -1797,18 +1837,43 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1797
1837
  tempOrder.order_id = resourceState.lastOrderId;
1798
1838
  }
1799
1839
  if (!tempOrder.order_id) {
1800
- _context27.next = 50;
1840
+ _context27.next = 55;
1801
1841
  break;
1802
1842
  }
1803
1843
  _context27.next = 50;
1804
- return (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getOrderInfoByRemote(tempOrder.order_id);
1844
+ return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
1805
1845
  case 50:
1806
- _context27.next = 52;
1807
- return this.refreshItemRuleQuantityLimits();
1808
- case 52:
1809
- _context27.next = 54;
1810
- return this.refreshCartValidationPassed();
1811
- case 54:
1846
+ res = _context27.sent;
1847
+ // 找到下单的时候输入的 entryPaxNumber
1848
+ entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
1849
+ var _p$metadata;
1850
+ return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
1851
+ })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
1852
+ if (!entryPaxNumber) {
1853
+ _context27.next = 55;
1854
+ break;
1855
+ }
1856
+ _context27.next = 55;
1857
+ return this.setEntryPaxNumber(entryPaxNumber);
1858
+ case 55:
1859
+ lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
1860
+ historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
1861
+ if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
1862
+ acc.push(_objectSpread({
1863
+ product_id: p.product_id,
1864
+ quantity: Number(p.product_quantity) || 0
1865
+ }, typeof p.product_variant_id === 'number' ? {
1866
+ product_variant_id: p.product_variant_id
1867
+ } : {}));
1868
+ return acc;
1869
+ }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
1870
+ _context27.next = 59;
1871
+ return this.setItemRuleRuntimeConfig({
1872
+ serviceType: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode,
1873
+ submissionIndex: hasOrderId ? 1 : 0,
1874
+ historicalItems: historicalItems
1875
+ });
1876
+ case 59:
1812
1877
  this.logMethodSuccess('checkResourceAvailable', {
1813
1878
  resourceId: resourceId,
1814
1879
  mode: availabilityInfo.mode,
@@ -1824,18 +1889,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1824
1889
  isFull: resourceState.isFull
1825
1890
  });
1826
1891
  return _context27.abrupt("return", availabilityInfo);
1827
- case 58:
1828
- _context27.prev = 58;
1892
+ case 63:
1893
+ _context27.prev = 63;
1829
1894
  _context27.t0 = _context27["catch"](1);
1830
1895
  this.logMethodError('checkResourceAvailable', _context27.t0, {
1831
1896
  resourceId: resourceId
1832
1897
  });
1833
1898
  throw _context27.t0;
1834
- case 62:
1899
+ case 67:
1835
1900
  case "end":
1836
1901
  return _context27.stop();
1837
1902
  }
1838
- }, _callee27, this, [[1, 58]]);
1903
+ }, _callee27, this, [[1, 63]]);
1839
1904
  }));
1840
1905
  function checkResourceAvailable(_x10, _x11) {
1841
1906
  return _checkResourceAvailable.apply(this, arguments);
@@ -1878,14 +1943,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1878
1943
  key: "getProductList",
1879
1944
  value: function () {
1880
1945
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
1881
- var _this$otherParams11;
1946
+ var _this$otherParams12;
1882
1947
  var menu_list_ids, _this$store$products, res, formattedRes;
1883
1948
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1884
1949
  while (1) switch (_context29.prev = _context29.next) {
1885
1950
  case 0:
1886
1951
  this.logMethodStart('getProductList');
1887
1952
  // 可以直接通过配置里的 menu 读取
1888
- menu_list_ids = ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 || (_this$otherParams11 = _this$otherParams11.dineInConfig) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11['menu.associated_menus'].map(function (n) {
1953
+ menu_list_ids = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.dineInConfig) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus'].map(function (n) {
1889
1954
  return Number(n.value);
1890
1955
  })) || [];
1891
1956
  _context29.prev = 2;
@@ -1924,6 +1989,82 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1924
1989
  value: function getOtherParams() {
1925
1990
  return this.otherParams;
1926
1991
  }
1992
+ }, {
1993
+ key: "setOtherParams",
1994
+ value: function () {
1995
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
1996
+ var _ref3,
1997
+ _ref3$cover,
1998
+ cover,
1999
+ _args30 = arguments;
2000
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2001
+ while (1) switch (_context30.prev = _context30.next) {
2002
+ case 0:
2003
+ _ref3 = _args30.length > 1 && _args30[1] !== undefined ? _args30[1] : {}, _ref3$cover = _ref3.cover, cover = _ref3$cover === void 0 ? false : _ref3$cover;
2004
+ if (cover) {
2005
+ this.otherParams = params;
2006
+ } else {
2007
+ this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
2008
+ }
2009
+ case 2:
2010
+ case "end":
2011
+ return _context30.stop();
2012
+ }
2013
+ }, _callee30, this);
2014
+ }));
2015
+ function setOtherParams(_x12) {
2016
+ return _setOtherParams.apply(this, arguments);
2017
+ }
2018
+ return setOtherParams;
2019
+ }()
2020
+ }, {
2021
+ key: "setEntryPaxNumber",
2022
+ value: function () {
2023
+ var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(number) {
2024
+ var pax, t;
2025
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2026
+ while (1) switch (_context31.prev = _context31.next) {
2027
+ case 0:
2028
+ pax = normalizeSubmitCollectPaxValue(number);
2029
+ this.store.entryPaxNumber = pax;
2030
+ if (this.store.order) {
2031
+ t = this.store.order.ensureTempOrder();
2032
+ t.metadata = _objectSpread(_objectSpread({}, t.metadata), {}, {
2033
+ collect_pax: pax
2034
+ });
2035
+ this.store.order.persistTempOrder();
2036
+ }
2037
+
2038
+ // pax 变化后同步到 itemRuleRuntimeConfig,并刷新限购 / 校验
2039
+ this.itemRuleRuntimeConfig = _objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), {}, {
2040
+ pax: {
2041
+ total: pax,
2042
+ adult: 0,
2043
+ child: 0
2044
+ }
2045
+ });
2046
+ this.itemRulePrefillApplied = false;
2047
+ _context31.next = 7;
2048
+ return this.refreshItemRuleQuantityLimits();
2049
+ case 7:
2050
+ _context31.next = 9;
2051
+ return this.refreshCartValidationPassed();
2052
+ case 9:
2053
+ case "end":
2054
+ return _context31.stop();
2055
+ }
2056
+ }, _callee31, this);
2057
+ }));
2058
+ function setEntryPaxNumber(_x13) {
2059
+ return _setEntryPaxNumber.apply(this, arguments);
2060
+ }
2061
+ return setEntryPaxNumber;
2062
+ }()
2063
+ }, {
2064
+ key: "getEntryPaxNumber",
2065
+ value: function getEntryPaxNumber() {
2066
+ return this.store.entryPaxNumber;
2067
+ }
1927
2068
  }]);
1928
2069
  return ScanOrderImpl;
1929
2070
  }(BaseModule);
@@ -36,9 +36,10 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
36
36
  order_detail_id: number | null;
37
37
  num: number;
38
38
  product_option_item: any[];
39
+ /** 券后单品单价(= 订单域实际成交单价)。未应用券时等同 original_price。 */
39
40
  selling_price: string;
41
+ /** 券前单品单价(= 店铺售价),不承载后台划线价语义。 */
40
42
  original_price: string;
41
- payment_price: string;
42
43
  tax_fee: string;
43
44
  is_charge_tax: number;
44
45
  discount_list: any[];
@@ -47,6 +48,11 @@ export interface ScanOrderOrderProduct extends ScanOrderOrderProductIdentity {
47
48
  _origin?: Record<string, any>;
48
49
  }
49
50
  export interface ScanOrderSubmitProduct extends Omit<ScanOrderOrderProduct, '_origin' | 'identity_key'> {
51
+ /**
52
+ * 出站兼容字段:SDK 内部不再消费 payment_price,
53
+ * 仅在提交后端时由 selling_price 派生,保持原有后端契约。
54
+ */
55
+ payment_price: string;
50
56
  }
51
57
  export interface ScanOrderSummary {
52
58
  product_quantity: number;
@@ -133,6 +139,11 @@ export interface ScanOrderSubmitPayload extends Omit<ScanOrderTempOrder, 'platfo
133
139
  products: ScanOrderSubmitProduct[];
134
140
  }
135
141
  export type ScanOrderAvailabilityMode = 'idle' | 'shop_closed' | 'resource_block' | 'resource_busy' | 'additional_order_with_code' | 'additional_order';
142
+ export interface ScanOrderTableFormRecord {
143
+ policy?: string | null;
144
+ partyroom_booking?: string | null;
145
+ [key: string]: any;
146
+ }
136
147
  export interface ScanOrderAvailabilityInfo {
137
148
  mode: ScanOrderAvailabilityMode;
138
149
  order_id?: string;
@@ -140,10 +151,16 @@ export interface ScanOrderAvailabilityInfo {
140
151
  table_form_id?: string;
141
152
  deskmate_valid?: boolean;
142
153
  errorTips?: string;
154
+ /** `/order/dining/table/config` 返回的 `table_form_record` 原样透出 */
155
+ table_form_record?: ScanOrderTableFormRecord | null;
143
156
  policy?: string | null;
144
157
  partyroom_booking?: string | null;
145
158
  /** 预约规则关联商品存在 custom 容量时,由 checkResourceAvailable 置为 1 */
146
159
  requestEntryPax?: number;
160
+ /** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 min(人数下限) */
161
+ requestPaxMin?: number;
162
+ /** 首个 `capacity.type === 'custom'` 商品里 `custom[0]` 的 max(人数上限) */
163
+ requestPaxMax?: number;
147
164
  }
148
165
  export interface ScanOrderTableSnackConfig {
149
166
  snack?: boolean | number | string;
@@ -153,9 +170,6 @@ export interface ScanOrderOrderNumberPrefixConfig {
153
170
  table_order?: string;
154
171
  pos?: string;
155
172
  }
156
- export interface ScanOrderTableFormRecord {
157
- policy?: string | null;
158
- }
159
173
  export interface ScanOrderTableConfigApiData {
160
174
  table_max_number?: number | string | null;
161
175
  order_count?: number | string | null;
@@ -186,7 +200,6 @@ export interface ScanOrderResourceState extends ScanOrderAvailabilityInfo {
186
200
  isFull: boolean;
187
201
  orderNumberPrefix: ScanOrderOrderNumberPrefixConfig[];
188
202
  raw: ScanOrderTableConfigApiData | null;
189
- table_form_record?: ScanOrderTableFormRecord | null;
190
203
  }
191
204
  export interface ScanOrderState {
192
205
  entryContext: ScanOrderEntryContext | null;
@@ -204,6 +217,7 @@ export interface ScanOrderState {
204
217
  passed: boolean | null;
205
218
  failures: QuantityCheckResult[];
206
219
  };
220
+ entryPaxNumber: number | null;
207
221
  }
208
222
  export interface ScanOrderLoggerRuntimeConfig {
209
223
  provider?: ScanOrderLoggerProviderType;
@@ -59,8 +59,15 @@ export declare function resolveSkuMatchedQuantityLimits(params: {
59
59
  export declare function aggregateItemRuleLimit(matchedLimits: QuantityLimitResult[]): {
60
60
  min: number | undefined;
61
61
  max: number | undefined;
62
+ remainingMax: number | undefined;
62
63
  exact: number | undefined;
63
64
  mustInclude: boolean;
65
+ validationMessage: string | undefined;
66
+ rawValidationMessage: string | Record<string, string> | undefined;
67
+ maxValidationMessage: string | undefined;
68
+ rawMaxValidationMessage: string | Record<string, string> | undefined;
69
+ minValidationMessage: string | undefined;
70
+ rawMinValidationMessage: string | Record<string, string> | undefined;
64
71
  } | null;
65
72
  export declare function buildItemRuleBusinessData(params: {
66
73
  tempOrder: ScanOrderTempOrder;
@@ -102,3 +109,11 @@ export declare function collectLinkProductIdsFromReservationRules(rules: unknown
102
109
  export declare function pickFirstDurationMinutesFromProducts(products: ProductData[]): number | undefined;
103
110
  /** 是否存在 capacity.type === 'custom' 的商品 */
104
111
  export declare function hasCustomCapacityProduct(products: ProductData[]): boolean;
112
+ /**
113
+ * 在商品列表中找到第一个 `capacity.type === 'custom'` 的商品,取其 `custom` 数组第一项的 min/max。
114
+ * 仅返回有限数字字段;若均无法解析则返回 `undefined`。
115
+ */
116
+ export declare function pickFirstCustomCapacityPaxBounds(products: ProductData[]): {
117
+ min?: number;
118
+ max?: number;
119
+ } | undefined;