@pisell/pisellos 2.3.38 → 2.3.40

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 (229) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +0 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
  11. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  12. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
  13. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
  14. package/dist/modules/Discount/index.d.ts +1 -0
  15. package/dist/modules/Discount/index.js +40 -11
  16. package/dist/modules/Discount/types.d.ts +1 -0
  17. package/dist/modules/Holder/index.d.ts +48 -0
  18. package/dist/modules/Holder/index.js +640 -0
  19. package/dist/modules/Holder/types.d.ts +123 -0
  20. package/dist/modules/Holder/types.js +1 -0
  21. package/dist/modules/Holder/utils.d.ts +13 -0
  22. package/dist/modules/Holder/utils.js +34 -0
  23. package/dist/modules/OpenData/index.d.ts +0 -2
  24. package/dist/modules/OpenData/index.js +2 -10
  25. package/dist/modules/Order/index.d.ts +11 -28
  26. package/dist/modules/Order/index.js +509 -750
  27. package/dist/modules/Order/types.d.ts +10 -33
  28. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  29. package/dist/modules/Order/utils.d.ts +10 -0
  30. package/dist/modules/Order/utils.js +41 -13
  31. package/dist/modules/Payment/index.d.ts +0 -2
  32. package/dist/modules/Payment/index.js +50 -79
  33. package/dist/modules/Payment/types.d.ts +28 -99
  34. package/dist/modules/Payment/types.js +3 -20
  35. package/dist/modules/Payment/walletpass.d.ts +1 -25
  36. package/dist/modules/Payment/walletpass.js +157 -707
  37. package/dist/modules/Product/types.d.ts +1 -0
  38. package/dist/modules/ProductList/index.js +33 -14
  39. package/dist/modules/Quotation/index.d.ts +1 -1
  40. package/dist/modules/Quotation/index.js +2 -2
  41. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  42. package/dist/modules/ResourcePlanner/index.js +181 -0
  43. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  44. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  45. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  46. package/dist/modules/ResourcePlanner/types.js +1 -0
  47. package/dist/modules/Rules/index.d.ts +0 -1
  48. package/dist/modules/Rules/index.js +96 -89
  49. package/dist/modules/SalesSummary/index.js +12 -13
  50. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  51. package/dist/modules/ScanOrderLogger/index.js +15 -2
  52. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  53. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  54. package/dist/modules/Schedule/index.d.ts +3 -1
  55. package/dist/modules/Schedule/index.js +21 -16
  56. package/dist/modules/Summary/utils.js +38 -13
  57. package/dist/modules/index.d.ts +2 -0
  58. package/dist/modules/index.js +3 -1
  59. package/dist/plugins/window.d.ts +1 -0
  60. package/dist/server/index.d.ts +14 -16
  61. package/dist/server/index.js +1148 -1930
  62. package/dist/server/modules/order/index.d.ts +4 -54
  63. package/dist/server/modules/order/index.js +695 -1595
  64. package/dist/server/modules/order/types.d.ts +3 -11
  65. package/dist/server/modules/order/types.js +1 -1
  66. package/dist/solution/BaseSales/index.d.ts +20 -109
  67. package/dist/solution/BaseSales/index.js +481 -1797
  68. package/dist/solution/BaseSales/types.d.ts +0 -52
  69. package/dist/solution/BaseSales/types.js +1 -2
  70. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  71. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  72. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  73. package/dist/solution/BookingByStep/index.d.ts +17 -2
  74. package/dist/solution/BookingByStep/index.js +294 -215
  75. package/dist/solution/BookingByStep/types.d.ts +2 -1
  76. package/dist/solution/BookingByStep/types.js +3 -1
  77. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  78. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  79. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  80. package/dist/solution/BookingTicket/index.d.ts +4 -8
  81. package/dist/solution/BookingTicket/index.js +51 -134
  82. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
  83. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  84. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
  85. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  86. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  87. package/dist/solution/Sales/index.d.ts +0 -1
  88. package/dist/solution/Sales/index.js +2 -10
  89. package/dist/solution/ScanOrder/index.d.ts +26 -14
  90. package/dist/solution/ScanOrder/index.js +1148 -756
  91. package/dist/solution/ScanOrder/types.d.ts +21 -1
  92. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  93. package/dist/solution/ScanOrder/utils.js +66 -25
  94. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  95. package/dist/solution/ShopDiscount/index.js +125 -87
  96. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  97. package/dist/solution/UnifiedBookingSales/index.js +1871 -0
  98. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  99. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  100. package/dist/solution/VenueBooking/index.d.ts +39 -11
  101. package/dist/solution/VenueBooking/index.js +1176 -860
  102. package/dist/solution/VenueBooking/types.d.ts +3 -0
  103. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  104. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  105. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  106. package/dist/solution/index.d.ts +1 -0
  107. package/dist/solution/index.js +2 -1
  108. package/dist/types/index.d.ts +1 -1
  109. package/lib/core/index.d.ts +0 -2
  110. package/lib/core/index.js +0 -4
  111. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  112. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  113. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  114. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  115. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  116. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  117. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  118. package/lib/model/strategy/adapter/promotion/index.js +0 -2
  119. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  120. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  121. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
  122. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  123. package/lib/modules/Discount/index.d.ts +1 -0
  124. package/lib/modules/Discount/index.js +9 -0
  125. package/lib/modules/Discount/types.d.ts +1 -0
  126. package/lib/modules/Holder/index.d.ts +48 -0
  127. package/lib/modules/Holder/index.js +402 -0
  128. package/lib/modules/Holder/types.d.ts +123 -0
  129. package/lib/modules/Holder/types.js +17 -0
  130. package/lib/modules/Holder/utils.d.ts +13 -0
  131. package/lib/modules/Holder/utils.js +71 -0
  132. package/lib/modules/OpenData/index.d.ts +0 -2
  133. package/lib/modules/OpenData/index.js +1 -6
  134. package/lib/modules/Order/index.d.ts +11 -28
  135. package/lib/modules/Order/index.js +86 -196
  136. package/lib/modules/Order/types.d.ts +10 -33
  137. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  138. package/lib/modules/Order/utils.d.ts +10 -0
  139. package/lib/modules/Order/utils.js +40 -16
  140. package/lib/modules/Payment/index.d.ts +0 -2
  141. package/lib/modules/Payment/index.js +13 -34
  142. package/lib/modules/Payment/types.d.ts +28 -99
  143. package/lib/modules/Payment/types.js +3 -4
  144. package/lib/modules/Payment/walletpass.d.ts +1 -25
  145. package/lib/modules/Payment/walletpass.js +21 -470
  146. package/lib/modules/Product/types.d.ts +1 -0
  147. package/lib/modules/ProductList/index.js +40 -31
  148. package/lib/modules/Quotation/index.d.ts +1 -1
  149. package/lib/modules/Quotation/index.js +2 -2
  150. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  151. package/lib/modules/ResourcePlanner/index.js +148 -0
  152. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  153. package/lib/modules/ResourcePlanner/planner.js +933 -0
  154. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  155. package/lib/modules/ResourcePlanner/types.js +17 -0
  156. package/lib/modules/Rules/index.d.ts +0 -1
  157. package/lib/modules/Rules/index.js +40 -47
  158. package/lib/modules/SalesSummary/index.js +6 -7
  159. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  160. package/lib/modules/ScanOrderLogger/index.js +13 -1
  161. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  162. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  163. package/lib/modules/Schedule/index.d.ts +3 -1
  164. package/lib/modules/Schedule/index.js +10 -8
  165. package/lib/modules/Summary/utils.js +21 -1
  166. package/lib/modules/index.d.ts +2 -0
  167. package/lib/modules/index.js +5 -1
  168. package/lib/plugins/window.d.ts +1 -0
  169. package/lib/server/index.d.ts +14 -16
  170. package/lib/server/index.js +83 -675
  171. package/lib/server/modules/order/index.d.ts +4 -54
  172. package/lib/server/modules/order/index.js +66 -679
  173. package/lib/server/modules/order/types.d.ts +3 -11
  174. package/lib/solution/BaseSales/index.d.ts +20 -109
  175. package/lib/solution/BaseSales/index.js +70 -881
  176. package/lib/solution/BaseSales/types.d.ts +0 -52
  177. package/lib/solution/BaseSales/types.js +1 -2
  178. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  179. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  180. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  181. package/lib/solution/BookingByStep/index.d.ts +17 -2
  182. package/lib/solution/BookingByStep/index.js +60 -18
  183. package/lib/solution/BookingByStep/types.d.ts +2 -1
  184. package/lib/solution/BookingByStep/types.js +5 -0
  185. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  186. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  187. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  188. package/lib/solution/BookingTicket/index.d.ts +4 -8
  189. package/lib/solution/BookingTicket/index.js +19 -64
  190. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
  191. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  192. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
  193. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  194. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  195. package/lib/solution/Sales/index.d.ts +0 -1
  196. package/lib/solution/Sales/index.js +3 -5
  197. package/lib/solution/ScanOrder/index.d.ts +26 -14
  198. package/lib/solution/ScanOrder/index.js +449 -190
  199. package/lib/solution/ScanOrder/types.d.ts +21 -1
  200. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  201. package/lib/solution/ScanOrder/utils.js +31 -0
  202. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  203. package/lib/solution/ShopDiscount/index.js +14 -0
  204. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  205. package/lib/solution/UnifiedBookingSales/index.js +1076 -0
  206. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  207. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  208. package/lib/solution/VenueBooking/index.d.ts +39 -11
  209. package/lib/solution/VenueBooking/index.js +328 -123
  210. package/lib/solution/VenueBooking/types.d.ts +3 -0
  211. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  212. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  213. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  214. package/lib/solution/index.d.ts +1 -0
  215. package/lib/solution/index.js +3 -1
  216. package/lib/types/index.d.ts +1 -1
  217. package/package.json +1 -1
  218. package/dist/modules/Order/payment-utils.d.ts +0 -26
  219. package/dist/modules/Order/payment-utils.js +0 -225
  220. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  221. package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
  222. package/dist/utils/payment-number.d.ts +0 -9
  223. package/dist/utils/payment-number.js +0 -69
  224. package/lib/modules/Order/payment-utils.d.ts +0 -26
  225. package/lib/modules/Order/payment-utils.js +0 -224
  226. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
  227. package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
  228. package/lib/utils/payment-number.d.ts +0 -9
  229. package/lib/utils/payment-number.js +0 -64
@@ -26,27 +26,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
26
26
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
28
  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); }
29
- import { BaseModule } from "../../modules/BaseModule";
29
+ import { BaseSalesImpl } from "../BaseSales";
30
30
  import { ScanOrderHooks } from "./types";
31
31
  import { OrderModule } from "../../modules/Order";
32
32
  import { AccountHooks } from "../../modules/Account/types";
33
33
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
34
34
  import Decimal from 'decimal.js';
35
- import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, createEmptySummary, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
35
+ import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, collectLinkProductIdsFromReservationRules, computeResourceIsFull, filterProductsForScanOrderMore, findReservationRuleProductByResourceId, getProductIdentityIndex, getSafeProductNum, hasCustomCapacityProduct, pickFirstCustomCapacityDimensionId, pickFirstCustomCapacityPaxBounds, normalizeEnabledItemRuleIds, normalizeOrderProduct, normalizeItemRuleStrategies, pickFirstDurationMinutesFromProducts, toNonNegativeInt, toPriceString, toBoolean, toPositiveString } from "./utils";
36
36
  import { createModule } from "../BookingByStep/types";
37
37
  import { ProductList } from "../../modules/ProductList";
38
- import { ScheduleModule } from "../../modules/Schedule";
39
38
  import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
40
- import { composeLinePrice, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
39
+ import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
41
40
  import dayjs from 'dayjs';
42
41
  import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
43
42
  export * from "./types";
44
- function isItemRewardProductDiscount(discount) {
45
- var _discount$metadata, _discount$metadata2;
46
- return (discount === null || discount === void 0 ? void 0 : discount.type) === 'product' && (discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.source) === 'promotion' && (discount === null || discount === void 0 || (_discount$metadata2 = discount.metadata) === null || _discount$metadata2 === void 0 ? void 0 : _discount$metadata2.actionType) === 'ITEM_REWARD';
47
- }
48
- export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
49
- _inherits(ScanOrderImpl, _BaseModule);
43
+ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
44
+ _inherits(ScanOrderImpl, _BaseSalesImpl);
50
45
  var _super = _createSuper(ScanOrderImpl);
51
46
  function ScanOrderImpl(name, version) {
52
47
  var _this;
@@ -87,8 +82,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
87
82
  _defineProperty(_assertThisInitialized(_this), "customerLoginRefreshIdInFlight", null);
88
83
  return _this;
89
84
  }
90
-
91
- /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
92
85
  _createClass(ScanOrderImpl, [{
93
86
  key: "getScanOrderLoggerContext",
94
87
  value: function getScanOrderLoggerContext() {
@@ -439,70 +432,42 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
439
432
  }
440
433
  return refreshOrderMarketingAfterLogin;
441
434
  }()
435
+ }, {
436
+ key: "getRegisteredModuleNames",
437
+ value: function getRegisteredModuleNames() {
438
+ return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'schedule'];
439
+ }
440
+ }, {
441
+ key: "createSubModule",
442
+ value: function createSubModule(moduleName) {
443
+ if (moduleName === 'scanOrderLogger') {
444
+ return createModule('scanOrderLogger', this.name);
445
+ }
446
+ return _get(_getPrototypeOf(ScanOrderImpl.prototype), "createSubModule", this).call(this, moduleName);
447
+ }
448
+
449
+ /** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
442
450
  }, {
443
451
  key: "getCacheId",
444
452
  value: function getCacheId() {
445
453
  return this.cacheId;
446
454
  }
447
- }, {
448
- key: "destroyRegisteredChildModules",
449
- value: function () {
450
- var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
451
- var modules, _i3, _modules, mod;
452
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
453
- while (1) switch (_context6.prev = _context6.next) {
454
- case 0:
455
- modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
456
- _i3 = 0, _modules = modules;
457
- case 2:
458
- if (!(_i3 < _modules.length)) {
459
- _context6.next = 10;
460
- break;
461
- }
462
- mod = _modules[_i3];
463
- if (!(mod && typeof mod.destroy === 'function')) {
464
- _context6.next = 7;
465
- break;
466
- }
467
- _context6.next = 7;
468
- return Promise.resolve(mod.destroy());
469
- case 7:
470
- _i3++;
471
- _context6.next = 2;
472
- break;
473
- case 10:
474
- case "end":
475
- return _context6.stop();
476
- }
477
- }, _callee6, this);
478
- }));
479
- function destroyRegisteredChildModules() {
480
- return _destroyRegisteredChildModules.apply(this, arguments);
481
- }
482
- return destroyRegisteredChildModules;
483
- }()
484
455
  }, {
485
456
  key: "initialize",
486
457
  value: function () {
487
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
488
- var _options$otherParams,
489
- _this$otherParams,
490
- _this$otherParams2,
491
- _this$otherParams3,
492
- _this4 = this;
458
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
459
+ var _options$otherParams, _this$otherParams, _this$otherParams2, _this$otherParams3;
493
460
  var options,
494
- moduleArr,
495
- scheduleModule,
461
+ _this$otherParams4,
462
+ _this$otherParams5,
496
463
  _this$store$order,
497
464
  _this$store$order2,
498
- _args7 = arguments;
499
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
500
- while (1) switch (_context7.prev = _context7.next) {
465
+ _args6 = arguments;
466
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
467
+ while (1) switch (_context6.prev = _context6.next) {
501
468
  case 0:
502
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
469
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
503
470
  this.logMethodStart('initialize');
504
- this.core = core;
505
- this.initializeOptions = options || {};
506
471
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
507
472
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
508
473
  this.store.status = 'initializing';
@@ -518,122 +483,76 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
518
483
  passed: null,
519
484
  failures: []
520
485
  };
521
- this.window = core.getPlugin('window');
522
- this.request = core.getPlugin('request');
523
- if (this.window) {
524
- _context7.next = 21;
525
- break;
526
- }
527
- this.logMethodError('initialize', 'window plugin missing');
528
- throw new Error('scanOrder解决方案需要 window 插件支持');
529
- case 21:
530
- if (this.request) {
531
- _context7.next = 24;
532
- break;
533
- }
534
- this.logMethodError('initialize', 'request plugin missing');
535
- throw new Error('scanOrder解决方案需要 request 插件支持');
536
- case 24:
537
- moduleArr = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
538
- moduleArr.forEach(function (step) {
539
- var targetModule = createModule(step, _this4.name);
540
- if (targetModule) {
541
- var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
542
- _this4.store[step] = targetModule;
543
- var initialState = step === 'salesSummary' ? {
544
- summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
545
- } : {};
546
- var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
547
- var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
548
- feishu: {
549
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
550
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
551
- }
552
- };
553
- _this4.core.registerModule(targetModule, {
554
- initialState: initialState,
555
- otherParams: _objectSpread(_objectSpread({}, _this4.otherParams), {}, {
556
- fatherModule: _this4.name,
557
- openCache: (_this4$otherParams3 = _this4.otherParams) !== null && _this4$otherParams3 !== void 0 && _this4$otherParams3.cacheId ? true : false,
558
- cacheId: (_this4$otherParams4 = _this4.otherParams) === null || _this4$otherParams4 === void 0 ? void 0 : _this4$otherParams4.cacheId,
559
- salesSummaryModuleName: "".concat(_this4.name, "_salesSummary"),
560
- provider: loggerProvider,
561
- providerConfig: loggerConfig,
562
- context: _this4.getScanOrderLoggerContext()
563
- })
564
- });
565
- } else {
566
- _this4.logMethodError('initialize', "module ".concat(step, " missing"));
567
- throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
568
- }
569
- });
486
+ _context6.next = 16;
487
+ return _get(_getPrototypeOf(ScanOrderImpl.prototype), "initialize", this).call(this, core, options);
488
+ case 16:
570
489
  if (this.store.scanOrderLogger) {
490
+ this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.scanOrderLoggerProvider) || 'feishu');
491
+ this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.scanOrderLoggerConfig) || {
492
+ feishu: {
493
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
494
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
495
+ }
496
+ });
571
497
  this.store.scanOrderLogger.setContext(this.getScanOrderLoggerContext());
572
498
  }
573
- scheduleModule = new ScheduleModule("".concat(this.name, "_schedule"));
574
- this.store.schedule = scheduleModule;
575
- this.core.registerModule(scheduleModule, {
576
- otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
577
- fatherModule: this.name
578
- })
579
- });
580
499
  this.registerCustomerLoginListeners();
581
500
  console.log('[ScanOrder] 初始化开始');
582
- _context7.prev = 32;
583
- _context7.next = 35;
501
+ _context6.prev = 19;
502
+ _context6.next = 22;
584
503
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
585
504
  createIfMissing: false
586
505
  });
587
- case 35:
506
+ case 22:
588
507
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
589
- _context7.next = 38;
508
+ _context6.next = 25;
590
509
  return this.loadRuntimeConfigs();
591
- case 38:
510
+ case 25:
592
511
  if (!this.store.schedule) {
593
- _context7.next = 47;
512
+ _context6.next = 34;
594
513
  break;
595
514
  }
596
- _context7.prev = 39;
597
- _context7.next = 42;
515
+ _context6.prev = 26;
516
+ _context6.next = 29;
598
517
  return this.store.schedule.loadAllSchedule();
599
- case 42:
600
- _context7.next = 47;
518
+ case 29:
519
+ _context6.next = 34;
601
520
  break;
602
- case 44:
603
- _context7.prev = 44;
604
- _context7.t0 = _context7["catch"](39);
605
- console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context7.t0);
606
- case 47:
607
- _context7.next = 49;
521
+ case 31:
522
+ _context6.prev = 31;
523
+ _context6.t0 = _context6["catch"](26);
524
+ console.warn('[ScanOrder] loadAllSchedule 失败,operating_hours 判定将跳过', _context6.t0);
525
+ case 34:
526
+ _context6.next = 36;
608
527
  return this.refreshItemRuleQuantityLimits();
609
- case 49:
528
+ case 36:
610
529
  this.store.status = 'ready';
611
530
  console.log('[ScanOrder] 初始化完成');
612
- _context7.next = 53;
531
+ _context6.next = 40;
613
532
  return this.core.effects.emit(ScanOrderHooks.onInited, {
614
533
  status: this.store.status
615
534
  });
616
- case 53:
535
+ case 40:
617
536
  this.logMethodSuccess('initialize', {
618
537
  status: this.store.status
619
538
  });
620
- _context7.next = 63;
539
+ _context6.next = 50;
621
540
  break;
622
- case 56:
623
- _context7.prev = 56;
624
- _context7.t1 = _context7["catch"](32);
541
+ case 43:
542
+ _context6.prev = 43;
543
+ _context6.t1 = _context6["catch"](19);
625
544
  this.store.status = 'error';
626
- this.store.error = _context7.t1 instanceof Error ? _context7.t1.message : '初始化失败';
627
- console.error('[ScanOrder] 初始化失败', _context7.t1);
628
- this.logMethodError('initialize', _context7.t1, {
545
+ this.store.error = _context6.t1 instanceof Error ? _context6.t1.message : '初始化失败';
546
+ console.error('[ScanOrder] 初始化失败', _context6.t1);
547
+ this.logMethodError('initialize', _context6.t1, {
629
548
  status: this.store.status
630
549
  });
631
- throw _context7.t1;
632
- case 63:
550
+ throw _context6.t1;
551
+ case 50:
633
552
  case "end":
634
- return _context7.stop();
553
+ return _context6.stop();
635
554
  }
636
- }, _callee7, this, [[32, 56], [39, 44]]);
555
+ }, _callee6, this, [[19, 43], [26, 31]]);
637
556
  }));
638
557
  function initialize(_x5) {
639
558
  return _initialize.apply(this, arguments);
@@ -643,26 +562,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
643
562
  }, {
644
563
  key: "destroy",
645
564
  value: function () {
646
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
647
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
648
- while (1) switch (_context8.prev = _context8.next) {
565
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
566
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
567
+ while (1) switch (_context7.prev = _context7.next) {
649
568
  case 0:
650
569
  this.logMethodStart('destroy');
651
570
  this.clearLoginEffectListeners();
652
- _context8.next = 4;
571
+ _context7.next = 4;
653
572
  return this.core.effects.emit(ScanOrderHooks.onDestroy, {});
654
573
  case 4:
655
- _context8.next = 6;
656
- return this.destroyRegisteredChildModules();
657
- case 6:
658
574
  _get(_getPrototypeOf(ScanOrderImpl.prototype), "destroy", this).call(this);
659
575
  console.log('[ScanOrder] 已销毁');
660
576
  this.logMethodSuccess('destroy');
661
- case 9:
577
+ case 7:
662
578
  case "end":
663
- return _context8.stop();
579
+ return _context7.stop();
664
580
  }
665
- }, _callee8, this);
581
+ }, _callee7, this);
666
582
  }));
667
583
  function destroy() {
668
584
  return _destroy.apply(this, arguments);
@@ -672,33 +588,33 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
672
588
  }, {
673
589
  key: "retryInit",
674
590
  value: function () {
675
- var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
676
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
677
- while (1) switch (_context9.prev = _context9.next) {
591
+ var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
592
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
593
+ while (1) switch (_context8.prev = _context8.next) {
678
594
  case 0:
679
595
  this.logMethodStart('retryInit');
680
596
  // TODO: 细化重试策略(指数退避、最大重试次数)后替换当前实现
681
597
  console.log('[ScanOrder] retryInit 调用');
682
- _context9.next = 4;
598
+ _context8.next = 4;
683
599
  return this.core.effects.emit(ScanOrderHooks.onRetryInit, {});
684
600
  case 4:
685
- _context9.prev = 4;
686
- _context9.next = 7;
601
+ _context8.prev = 4;
602
+ _context8.next = 7;
687
603
  return this.initialize(this.core, this.initializeOptions);
688
604
  case 7:
689
605
  this.logMethodSuccess('retryInit');
690
- _context9.next = 14;
606
+ _context8.next = 14;
691
607
  break;
692
608
  case 10:
693
- _context9.prev = 10;
694
- _context9.t0 = _context9["catch"](4);
695
- this.logMethodError('retryInit', _context9.t0);
696
- throw _context9.t0;
609
+ _context8.prev = 10;
610
+ _context8.t0 = _context8["catch"](4);
611
+ this.logMethodError('retryInit', _context8.t0);
612
+ throw _context8.t0;
697
613
  case 14:
698
614
  case "end":
699
- return _context9.stop();
615
+ return _context8.stop();
700
616
  }
701
- }, _callee9, this, [[4, 10]]);
617
+ }, _callee8, this, [[4, 10]]);
702
618
  }));
703
619
  function retryInit() {
704
620
  return _retryInit.apply(this, arguments);
@@ -708,23 +624,23 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
708
624
  }, {
709
625
  key: "refresh",
710
626
  value: function () {
711
- var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
712
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
713
- while (1) switch (_context10.prev = _context10.next) {
627
+ var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
628
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
629
+ while (1) switch (_context9.prev = _context9.next) {
714
630
  case 0:
715
631
  this.logMethodStart('refresh');
716
632
  // TODO: 接入真实刷新逻辑(资源重拉取、流程重建)后替换当前实现
717
633
  console.log('[ScanOrder] refresh 调用');
718
- _context10.prev = 2;
634
+ _context9.prev = 2;
719
635
  this.store.status = 'initializing';
720
- _context10.next = 6;
636
+ _context9.next = 6;
721
637
  return this.loadRuntimeConfigs();
722
638
  case 6:
723
- _context10.next = 8;
639
+ _context9.next = 8;
724
640
  return this.refreshItemRuleQuantityLimits();
725
641
  case 8:
726
642
  this.store.status = 'ready';
727
- _context10.next = 11;
643
+ _context9.next = 11;
728
644
  return this.core.effects.emit(ScanOrderHooks.onRefresh, {
729
645
  status: this.store.status
730
646
  });
@@ -732,18 +648,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
732
648
  this.logMethodSuccess('refresh', {
733
649
  status: this.store.status
734
650
  });
735
- _context10.next = 18;
651
+ _context9.next = 18;
736
652
  break;
737
653
  case 14:
738
- _context10.prev = 14;
739
- _context10.t0 = _context10["catch"](2);
740
- this.logMethodError('refresh', _context10.t0);
741
- throw _context10.t0;
654
+ _context9.prev = 14;
655
+ _context9.t0 = _context9["catch"](2);
656
+ this.logMethodError('refresh', _context9.t0);
657
+ throw _context9.t0;
742
658
  case 18:
743
659
  case "end":
744
- return _context10.stop();
660
+ return _context9.stop();
745
661
  }
746
- }, _callee10, this, [[2, 14]]);
662
+ }, _callee9, this, [[2, 14]]);
747
663
  }));
748
664
  function refresh() {
749
665
  return _refresh.apply(this, arguments);
@@ -831,16 +747,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
831
747
  }, {
832
748
  key: "updateTempOrderNote",
833
749
  value: function updateTempOrderNote(note) {
750
+ var _this4 = this;
751
+ var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
834
752
  this.logMethodStart('updateTempOrderNote', {
835
753
  noteLength: String(note || '').length
836
754
  });
837
755
  try {
838
756
  if (!this.store.order) throw new Error('order 模块未初始化');
839
- var result = this.store.order.updateTempOrderNote(note);
757
+ var result = this.store.order.updateTempOrderNote(note, sync);
758
+ if (result && typeof result.then === 'function') {
759
+ return result.then(function (nextNote) {
760
+ _this4.logMethodSuccess('updateTempOrderNote', {
761
+ noteLength: nextNote.length
762
+ });
763
+ return nextNote;
764
+ });
765
+ }
766
+ var nextNote = result;
840
767
  this.logMethodSuccess('updateTempOrderNote', {
841
- noteLength: result.length
768
+ noteLength: nextNote.length
842
769
  });
843
- return result;
770
+ return nextNote;
844
771
  } catch (error) {
845
772
  this.logMethodError('updateTempOrderNote', error);
846
773
  throw error;
@@ -856,11 +783,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
856
783
  mode: mode
857
784
  });
858
785
  try {
786
+ var _this$otherParams6;
859
787
  if (!this.store.order) throw new Error('order 模块未初始化');
860
788
  var tempOrder = this.store.order.ensureTempOrder();
861
789
  tempOrder.metadata = _objectSpread(_objectSpread({}, tempOrder.metadata || {}), {}, {
862
790
  shop_service_data: _objectSpread(_objectSpread({}, (tempOrder.metadata || {}).shop_service_data || {}), {}, {
863
- service_type: 'dine_in',
791
+ service_type: ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode) === 'dine_in' ? 'dine_in' : '',
864
792
  pickup_reference_mode: mode
865
793
  })
866
794
  });
@@ -897,8 +825,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
897
825
  }
898
826
  }
899
827
  }, {
900
- key: "ensureTempOrder",
901
- value: function ensureTempOrder() {
828
+ key: "ensureScanOrderTempOrder",
829
+ value: function ensureScanOrderTempOrder() {
902
830
  if (!this.store.order) throw new Error('order 模块未初始化');
903
831
  return this.store.order.ensureTempOrder();
904
832
  }
@@ -907,37 +835,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
907
835
  }, {
908
836
  key: "addNewOrder",
909
837
  value: function () {
910
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
838
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
911
839
  var tempOrder;
912
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
913
- while (1) switch (_context11.prev = _context11.next) {
840
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
841
+ while (1) switch (_context10.prev = _context10.next) {
914
842
  case 0:
915
843
  this.logMethodStart('addNewOrder');
916
- _context11.prev = 1;
844
+ _context10.prev = 1;
917
845
  if (this.store.order) {
918
- _context11.next = 4;
846
+ _context10.next = 4;
919
847
  break;
920
848
  }
921
849
  throw new Error('order 模块未初始化');
922
850
  case 4:
923
- _context11.next = 6;
851
+ _context10.next = 6;
924
852
  return this.store.order.addNewOrder();
925
853
  case 6:
926
- tempOrder = _context11.sent;
854
+ tempOrder = _context10.sent;
927
855
  this.logMethodSuccess('addNewOrder', {
928
856
  productCount: tempOrder.products.length
929
857
  });
930
- return _context11.abrupt("return", tempOrder);
858
+ return _context10.abrupt("return", tempOrder);
931
859
  case 11:
932
- _context11.prev = 11;
933
- _context11.t0 = _context11["catch"](1);
934
- this.logMethodError('addNewOrder', _context11.t0);
935
- throw _context11.t0;
860
+ _context10.prev = 11;
861
+ _context10.t0 = _context10["catch"](1);
862
+ this.logMethodError('addNewOrder', _context10.t0);
863
+ throw _context10.t0;
936
864
  case 15:
937
865
  case "end":
938
- return _context11.stop();
866
+ return _context10.stop();
939
867
  }
940
- }, _callee11, this, [[1, 11]]);
868
+ }, _callee10, this, [[1, 11]]);
941
869
  }));
942
870
  function addNewOrder() {
943
871
  return _addNewOrder.apply(this, arguments);
@@ -948,15 +876,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
948
876
  }, {
949
877
  key: "restoreOrder",
950
878
  value: function () {
951
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
879
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
952
880
  var tempOrder;
953
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
954
- while (1) switch (_context12.prev = _context12.next) {
881
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
882
+ while (1) switch (_context11.prev = _context11.next) {
955
883
  case 0:
956
884
  this.logMethodStart('restoreOrder');
957
- _context12.prev = 1;
885
+ _context11.prev = 1;
958
886
  if (this.store.order) {
959
- _context12.next = 4;
887
+ _context11.next = 4;
960
888
  break;
961
889
  }
962
890
  throw new Error('scanOrder 解决方案需要 order 模块支持');
@@ -966,17 +894,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
966
894
  this.enabledReservationRuleProducts = [];
967
895
  tempOrder = this.store.order.restoreOrder();
968
896
  this.logMethodSuccess('restoreOrder');
969
- return _context12.abrupt("return", tempOrder);
897
+ return _context11.abrupt("return", tempOrder);
970
898
  case 12:
971
- _context12.prev = 12;
972
- _context12.t0 = _context12["catch"](1);
973
- this.logMethodError('restoreOrder', _context12.t0);
974
- throw _context12.t0;
899
+ _context11.prev = 12;
900
+ _context11.t0 = _context11["catch"](1);
901
+ this.logMethodError('restoreOrder', _context11.t0);
902
+ throw _context11.t0;
975
903
  case 16:
976
904
  case "end":
977
- return _context12.stop();
905
+ return _context11.stop();
978
906
  }
979
- }, _callee12, this, [[1, 12]]);
907
+ }, _callee11, this, [[1, 12]]);
980
908
  }));
981
909
  function restoreOrder() {
982
910
  return _restoreOrder.apply(this, arguments);
@@ -997,37 +925,37 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
997
925
  }, {
998
926
  key: "getSummary",
999
927
  value: function () {
1000
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
928
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1001
929
  var summary;
1002
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1003
- while (1) switch (_context13.prev = _context13.next) {
930
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
931
+ while (1) switch (_context12.prev = _context12.next) {
1004
932
  case 0:
1005
933
  this.logMethodStart('getSummary');
1006
- _context13.prev = 1;
934
+ _context12.prev = 1;
1007
935
  if (this.store.order) {
1008
- _context13.next = 4;
936
+ _context12.next = 4;
1009
937
  break;
1010
938
  }
1011
939
  throw new Error('order 模块未初始化');
1012
940
  case 4:
1013
- _context13.next = 6;
941
+ _context12.next = 6;
1014
942
  return this.store.order.getOrderSummary();
1015
943
  case 6:
1016
- summary = _context13.sent;
944
+ summary = _context12.sent;
1017
945
  this.logMethodSuccess('getSummary', {
1018
946
  totalAmount: summary.total_amount
1019
947
  });
1020
- return _context13.abrupt("return", summary);
948
+ return _context12.abrupt("return", summary);
1021
949
  case 11:
1022
- _context13.prev = 11;
1023
- _context13.t0 = _context13["catch"](1);
1024
- this.logMethodError('getSummary', _context13.t0);
1025
- throw _context13.t0;
950
+ _context12.prev = 11;
951
+ _context12.t0 = _context12["catch"](1);
952
+ this.logMethodError('getSummary', _context12.t0);
953
+ throw _context12.t0;
1026
954
  case 15:
1027
955
  case "end":
1028
- return _context13.stop();
956
+ return _context12.stop();
1029
957
  }
1030
- }, _callee13, this, [[1, 11]]);
958
+ }, _callee12, this, [[1, 11]]);
1031
959
  }));
1032
960
  function getSummary() {
1033
961
  return _getSummary.apply(this, arguments);
@@ -1043,30 +971,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1043
971
  }, {
1044
972
  key: "scanCode",
1045
973
  value: function () {
1046
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(code, customerId) {
974
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
1047
975
  var raw;
1048
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1049
- while (1) switch (_context14.prev = _context14.next) {
976
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
977
+ while (1) switch (_context13.prev = _context13.next) {
1050
978
  case 0:
1051
979
  this.logMethodStart('scanCode', {
1052
980
  code: code
1053
981
  });
1054
- _context14.prev = 1;
982
+ _context13.prev = 1;
1055
983
  if (this.store.order) {
1056
- _context14.next = 4;
984
+ _context13.next = 4;
1057
985
  break;
1058
986
  }
1059
987
  throw new Error('order 模块未初始化');
1060
988
  case 4:
1061
- _context14.next = 6;
989
+ _context13.next = 6;
1062
990
  return this.store.order.scanCode(code, customerId);
1063
991
  case 6:
1064
- raw = _context14.sent;
992
+ raw = _context13.sent;
1065
993
  if (!raw.isAvailable) {
1066
- _context14.next = 11;
994
+ _context13.next = 11;
1067
995
  break;
1068
996
  }
1069
- _context14.next = 10;
997
+ _context13.next = 10;
1070
998
  return this.store.order.recalculateSummary({
1071
999
  createIfMissing: true
1072
1000
  });
@@ -1076,21 +1004,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1076
1004
  this.logMethodSuccess('scanCode', {
1077
1005
  isAvailable: raw.isAvailable
1078
1006
  });
1079
- return _context14.abrupt("return", {
1007
+ return _context13.abrupt("return", {
1080
1008
  isAvailable: raw.isAvailable,
1081
1009
  type: raw.type,
1082
1010
  unavailableReason: raw.unavailableReason
1083
1011
  });
1084
1012
  case 15:
1085
- _context14.prev = 15;
1086
- _context14.t0 = _context14["catch"](1);
1087
- this.logMethodError('scanCode', _context14.t0);
1088
- throw _context14.t0;
1013
+ _context13.prev = 15;
1014
+ _context13.t0 = _context13["catch"](1);
1015
+ this.logMethodError('scanCode', _context13.t0);
1016
+ throw _context13.t0;
1089
1017
  case 19:
1090
1018
  case "end":
1091
- return _context14.stop();
1019
+ return _context13.stop();
1092
1020
  }
1093
- }, _callee14, this, [[1, 15]]);
1021
+ }, _callee13, this, [[1, 15]]);
1094
1022
  }));
1095
1023
  function scanCode(_x6, _x7) {
1096
1024
  return _scanCode.apply(this, arguments);
@@ -1100,15 +1028,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1100
1028
  }, {
1101
1029
  key: "setDiscountSelected",
1102
1030
  value: function () {
1103
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1031
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1104
1032
  var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _origin, _product$metadata$sou, _product$metadata, _product$metadata2, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1105
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1106
- while (1) switch (_context15.prev = _context15.next) {
1033
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1034
+ while (1) switch (_context14.prev = _context14.next) {
1107
1035
  case 0:
1108
1036
  this.logMethodStart('setDiscountSelected', params);
1109
- _context15.prev = 1;
1037
+ _context14.prev = 1;
1110
1038
  if (this.store.order) {
1111
- _context15.next = 4;
1039
+ _context14.next = 4;
1112
1040
  break;
1113
1041
  }
1114
1042
  throw new Error('order 模块未初始化');
@@ -1128,7 +1056,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1128
1056
  form_record_id: tempOrder.holder.form_record_id
1129
1057
  }] : [];
1130
1058
  nextDiscountList = updated;
1131
- _context15.next = 14;
1059
+ _context14.next = 14;
1132
1060
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1133
1061
  case 14:
1134
1062
  if (rulesModule) {
@@ -1177,27 +1105,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1177
1105
  return d.id;
1178
1106
  }));
1179
1107
  _iterator3 = _createForOfIteratorHelper(tempOrder.products);
1180
- _context15.prev = 17;
1108
+ _context14.prev = 17;
1181
1109
  _iterator3.s();
1182
1110
  case 19:
1183
1111
  if ((_step3 = _iterator3.n()).done) {
1184
- _context15.next = 36;
1112
+ _context14.next = 33;
1185
1113
  break;
1186
1114
  }
1187
1115
  product = _step3.value;
1188
1116
  if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
1189
- _context15.next = 23;
1117
+ _context14.next = 23;
1190
1118
  break;
1191
1119
  }
1192
- return _context15.abrupt("continue", 34);
1120
+ return _context14.abrupt("continue", 31);
1193
1121
  case 23:
1194
- if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
1195
- _context15.next = 26;
1196
- break;
1197
- }
1198
- product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
1199
- return _context15.abrupt("continue", 34);
1200
- case 26:
1201
1122
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1202
1123
  var _pd$discount$resource, _pd$discount;
1203
1124
  var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
@@ -1221,47 +1142,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1221
1142
  mainPrice: newMainSellingPrice,
1222
1143
  bundle: product.product_bundle
1223
1144
  });
1224
- case 34:
1225
- _context15.next = 19;
1145
+ case 31:
1146
+ _context14.next = 19;
1226
1147
  break;
1227
- case 36:
1228
- _context15.next = 41;
1148
+ case 33:
1149
+ _context14.next = 38;
1229
1150
  break;
1151
+ case 35:
1152
+ _context14.prev = 35;
1153
+ _context14.t0 = _context14["catch"](17);
1154
+ _iterator3.e(_context14.t0);
1230
1155
  case 38:
1231
- _context15.prev = 38;
1232
- _context15.t0 = _context15["catch"](17);
1233
- _iterator3.e(_context15.t0);
1234
- case 41:
1235
- _context15.prev = 41;
1156
+ _context14.prev = 38;
1236
1157
  _iterator3.f();
1237
- return _context15.finish(41);
1238
- case 44:
1158
+ return _context14.finish(38);
1159
+ case 41:
1239
1160
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1240
- _context15.next = 47;
1161
+ _context14.next = 44;
1241
1162
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1242
- case 47:
1163
+ case 44:
1243
1164
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1244
1165
  return d.isSelected;
1245
1166
  });
1246
- _context15.next = 50;
1167
+ _context14.next = 47;
1247
1168
  return this.store.order.recalculateSummary({
1248
1169
  createIfMissing: true
1249
1170
  });
1250
- case 50:
1171
+ case 47:
1251
1172
  this.store.order.persistTempOrder();
1252
1173
  this.logMethodSuccess('setDiscountSelected', params);
1253
- _context15.next = 58;
1174
+ _context14.next = 55;
1254
1175
  break;
1255
- case 54:
1256
- _context15.prev = 54;
1257
- _context15.t1 = _context15["catch"](1);
1258
- this.logMethodError('setDiscountSelected', _context15.t1);
1259
- throw _context15.t1;
1260
- case 58:
1176
+ case 51:
1177
+ _context14.prev = 51;
1178
+ _context14.t1 = _context14["catch"](1);
1179
+ this.logMethodError('setDiscountSelected', _context14.t1);
1180
+ throw _context14.t1;
1181
+ case 55:
1261
1182
  case "end":
1262
- return _context15.stop();
1183
+ return _context14.stop();
1263
1184
  }
1264
- }, _callee15, this, [[1, 54], [17, 38, 41, 44]]);
1185
+ }, _callee14, this, [[1, 51], [17, 35, 38, 41]]);
1265
1186
  }));
1266
1187
  function setDiscountSelected(_x8) {
1267
1188
  return _setDiscountSelected.apply(this, arguments);
@@ -1271,15 +1192,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1271
1192
  }, {
1272
1193
  key: "onCustomerLogin",
1273
1194
  value: function () {
1274
- var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1275
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1276
- while (1) switch (_context16.prev = _context16.next) {
1195
+ var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1196
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1197
+ while (1) switch (_context15.prev = _context15.next) {
1277
1198
  case 0:
1278
1199
  this.logMethodStart('onCustomerLogin', {
1279
1200
  customerId: params.customerId
1280
1201
  });
1281
- _context16.prev = 1;
1282
- _context16.next = 4;
1202
+ _context15.prev = 1;
1203
+ _context15.next = 4;
1283
1204
  return this.refreshOrderMarketingAfterLogin({
1284
1205
  customerId: params.customerId
1285
1206
  });
@@ -1287,18 +1208,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1287
1208
  this.logMethodSuccess('onCustomerLogin', {
1288
1209
  customerId: params.customerId
1289
1210
  });
1290
- _context16.next = 11;
1211
+ _context15.next = 11;
1291
1212
  break;
1292
1213
  case 7:
1293
- _context16.prev = 7;
1294
- _context16.t0 = _context16["catch"](1);
1295
- this.logMethodError('onCustomerLogin', _context16.t0);
1296
- throw _context16.t0;
1214
+ _context15.prev = 7;
1215
+ _context15.t0 = _context15["catch"](1);
1216
+ this.logMethodError('onCustomerLogin', _context15.t0);
1217
+ throw _context15.t0;
1297
1218
  case 11:
1298
1219
  case "end":
1299
- return _context16.stop();
1220
+ return _context15.stop();
1300
1221
  }
1301
- }, _callee16, this, [[1, 7]]);
1222
+ }, _callee15, this, [[1, 7]]);
1302
1223
  }));
1303
1224
  function onCustomerLogin(_x9) {
1304
1225
  return _onCustomerLogin.apply(this, arguments);
@@ -1346,8 +1267,70 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1346
1267
  combined_resource: isCombined ? combined : null
1347
1268
  };
1348
1269
  }
1349
-
1350
- // ScanOrder 提交 payload enhancer:
1270
+ }, {
1271
+ key: "prepareRetailAvailability",
1272
+ value: function () {
1273
+ var _prepareRetailAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1274
+ var _this$store$order4, _this$otherParams7;
1275
+ var tempOrder, hasOrderId, resourceId, reason, resourceState, availabilityInfo;
1276
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1277
+ while (1) switch (_context16.prev = _context16.next) {
1278
+ case 0:
1279
+ tempOrder = params.tempOrder, hasOrderId = params.hasOrderId, resourceId = params.resourceId, reason = params.reason;
1280
+ this.enabledReservationRuleProducts = [];
1281
+ tempOrder.bookings = [];
1282
+ tempOrder.order_id = null;
1283
+ delete tempOrder.relation_id;
1284
+ delete tempOrder.table_form_id;
1285
+ delete tempOrder.resource_id;
1286
+ delete tempOrder.table_number;
1287
+ tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
1288
+ delete tempOrder.metadata.table_occupancy_duration;
1289
+ resourceState = {
1290
+ mode: 'idle',
1291
+ deskmate_valid: false,
1292
+ allowSnack: false,
1293
+ deskmateValid: false,
1294
+ isExclusive: false,
1295
+ isFull: false,
1296
+ raw: null
1297
+ };
1298
+ this.store.resource = resourceState;
1299
+ (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || _this$store$order4.persistTempOrder();
1300
+ _context16.next = 15;
1301
+ return this.addNewOrder();
1302
+ case 15:
1303
+ _context16.next = 17;
1304
+ return this.setItemRuleRuntimeConfig({
1305
+ serviceType: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode,
1306
+ submissionIndex: hasOrderId ? 1 : 0,
1307
+ historicalItems: []
1308
+ });
1309
+ case 17:
1310
+ availabilityInfo = {
1311
+ mode: 'idle',
1312
+ deskmate_valid: false
1313
+ };
1314
+ this.logMethodSuccess('checkResourceAvailable', {
1315
+ resourceId: resourceId,
1316
+ mode: availabilityInfo.mode,
1317
+ retailMode: true,
1318
+ retailReason: reason,
1319
+ relationId: resourceState.relationId,
1320
+ persistedResourceId: resourceState.relationId
1321
+ });
1322
+ return _context16.abrupt("return", availabilityInfo);
1323
+ case 20:
1324
+ case "end":
1325
+ return _context16.stop();
1326
+ }
1327
+ }, _callee16, this);
1328
+ }));
1329
+ function prepareRetailAvailability(_x10) {
1330
+ return _prepareRetailAvailability.apply(this, arguments);
1331
+ }
1332
+ return prepareRetailAvailability;
1333
+ }() // ScanOrder 提交 payload enhancer:
1351
1334
  // - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
1352
1335
  // - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
1353
1336
  // - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
@@ -1360,25 +1343,32 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1360
1343
  var resourceState = this.store.resource;
1361
1344
  var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
1362
1345
 
1363
- // collect_pax 时的资源占用兜底:single 独占整张桌台,其余模式占 1 个容量位。
1364
- var resolveResourceCapacity = function resolveResourceCapacity() {
1346
+ // ScanOrder booking 容量只由预约规则决定:single 占用整张桌台,multiple 占用 1 个容量位。
1347
+ var resolveBookingCapacityValue = function resolveBookingCapacityValue() {
1365
1348
  if (resourceSelectType === 'single') {
1366
1349
  var _resourceState$table_;
1367
1350
  var raw = resourceState === null || resourceState === void 0 || (_resourceState$table_ = resourceState.table_form_record) === null || _resourceState$table_ === void 0 ? void 0 : _resourceState$table_.capacity;
1368
1351
  var num = Number(raw);
1369
- if (Number.isFinite(num) && num > 0) return num;
1352
+ if (Number.isFinite(num) && num > 0) return Math.max(1, Math.floor(num));
1370
1353
  return 1;
1371
1354
  }
1372
1355
  return 1;
1373
1356
  };
1374
1357
  return function (payload, _ref3) {
1375
- var _resource_id, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
1358
+ var _resourceState$relati, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati2, _pickFirstCustomCapac;
1376
1359
  var bookingUuid = _ref3.bookingUuid,
1377
1360
  tempOrder = _ref3.tempOrder;
1378
- var resourceId = (_resource_id = tempOrder.resource_id) !== null && _resource_id !== void 0 ? _resource_id : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
1361
+ var resourceId = String((_resourceState$relati = resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : '').trim();
1362
+ var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
1363
+ if (!hasReservationBookingContext) {
1364
+ return _objectSpread(_objectSpread({}, payload), {}, {
1365
+ bookings: [],
1366
+ products: _toConsumableArray(payload.products || [])
1367
+ });
1368
+ }
1379
1369
  var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1380
- var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1381
- var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1370
+ var hasExplicitCollectPax = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1371
+ var bookingCapacityValue = resolveBookingCapacityValue();
1382
1372
  var pickOriginal = function pickOriginal(value) {
1383
1373
  if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
1384
1374
  var original = value.original;
@@ -1393,22 +1383,26 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1393
1383
  id: Number(resourceId),
1394
1384
  main_field: mainField,
1395
1385
  form_id: resourceState.tableFormId,
1396
- relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
1397
- capacity: resourceCapacityValue,
1386
+ relation_id: (_resourceState$relati2 = resourceState.relationId) !== null && _resourceState$relati2 !== void 0 ? _resourceState$relati2 : resourceId,
1387
+ capacity: bookingCapacityValue,
1398
1388
  metadata: _this5.buildScanOrderResourceMetadata({
1399
1389
  resourceState: resourceState,
1400
1390
  resourceName: mainField
1401
1391
  })
1402
1392
  } : undefined;
1403
1393
  var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
1404
- // 有 collect_pax 时 booking/resource capacity 与 number 都代表本次 pax;否则使用资源占用兜底值。
1405
- var bookingCapacityValue = resourceCapacityValue;
1406
1394
  var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
1407
1395
  var nextBookings = (payload.bookings || []).map(function (booking, idx) {
1396
+ var metadata = _objectSpread({}, booking.metadata || {});
1397
+ if (hasExplicitCollectPax) {
1398
+ metadata.collect_pax = normalizeSubmitCollectPaxValue(rawCollectPax);
1399
+ } else {
1400
+ delete metadata.collect_pax;
1401
+ }
1408
1402
  return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
1409
1403
  number: bookingCapacityValue,
1410
1404
  appointment_status: 'started',
1411
- metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), resourceSelectType ? {
1405
+ metadata: _objectSpread(_objectSpread(_objectSpread({}, metadata), resourceSelectType ? {
1412
1406
  resource_select_type: resourceSelectType
1413
1407
  } : {}), resourceSelectType ? {
1414
1408
  capacity: [{
@@ -1457,20 +1451,98 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1457
1451
  };
1458
1452
  }
1459
1453
  }, {
1460
- key: "submitScanOrder",
1454
+ key: "isScanOrderMoreMode",
1455
+ value: function isScanOrderMoreMode(tempOrder) {
1456
+ var _this$store$resource, _this$store$entryCont;
1457
+ var mode = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.mode;
1458
+ return Boolean(tempOrder.order_id && (mode === 'additional_order' || mode === 'additional_order_with_code' || ((_this$store$entryCont = this.store.entryContext) === null || _this$store$entryCont === void 0 ? void 0 : _this$store$entryCont.mode) === 'append'));
1459
+ }
1460
+ }, {
1461
+ key: "submitScanOrderMore",
1461
1462
  value: function () {
1462
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1463
- var _this$store$resource, _this$otherParams4, _this$otherParams5, _this$otherParams6, _this$otherParams7, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
1463
+ var _submitScanOrderMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1464
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12;
1465
+ var tempOrder, enhancePayload, latestSummary, payload, products, orderId, result;
1464
1466
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1465
1467
  while (1) switch (_context17.prev = _context17.next) {
1468
+ case 0:
1469
+ if (this.request) {
1470
+ _context17.next = 2;
1471
+ break;
1472
+ }
1473
+ throw new Error('scanOrder解决方案需要 request 插件支持');
1474
+ case 2:
1475
+ if (this.store.order) {
1476
+ _context17.next = 4;
1477
+ break;
1478
+ }
1479
+ throw new Error('scanOrder解决方案需要 order 模块支持');
1480
+ case 4:
1481
+ tempOrder = params.tempOrder, enhancePayload = params.enhancePayload;
1482
+ _context17.next = 7;
1483
+ return this.store.order.recalculateSummary({
1484
+ createIfMissing: true
1485
+ });
1486
+ case 7:
1487
+ latestSummary = _context17.sent;
1488
+ payload = buildSubmitPayload({
1489
+ tempOrder: tempOrder,
1490
+ cacheId: this.cacheId,
1491
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
1492
+ businessCode: ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.business_code),
1493
+ channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
1494
+ type: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.type,
1495
+ summary: latestSummary,
1496
+ enhance: enhancePayload
1497
+ });
1498
+ products = filterProductsForScanOrderMore(payload.products);
1499
+ orderId = tempOrder.order_id;
1500
+ _context17.next = 13;
1501
+ return this.request.put("/order/order/product/".concat(orderId), {
1502
+ products: products,
1503
+ request_unique_idempotency_token: payload.request_unique_idempotency_token
1504
+ }, {
1505
+ customToast: function customToast() {}
1506
+ });
1507
+ case 13:
1508
+ result = _context17.sent;
1509
+ if (!((result === null || result === void 0 ? void 0 : result.code) === 200 && !(result !== null && result !== void 0 && result.data))) {
1510
+ _context17.next = 16;
1511
+ break;
1512
+ }
1513
+ return _context17.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
1514
+ data: {
1515
+ order_id: orderId
1516
+ }
1517
+ }));
1518
+ case 16:
1519
+ return _context17.abrupt("return", result);
1520
+ case 17:
1521
+ case "end":
1522
+ return _context17.stop();
1523
+ }
1524
+ }, _callee17, this);
1525
+ }));
1526
+ function submitScanOrderMore(_x11) {
1527
+ return _submitScanOrderMore.apply(this, arguments);
1528
+ }
1529
+ return submitScanOrderMore;
1530
+ }()
1531
+ }, {
1532
+ key: "submitScanOrder",
1533
+ value: function () {
1534
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1535
+ var _this$store$resource2, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, enhancePayload, result, tempOrder;
1536
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1537
+ while (1) switch (_context18.prev = _context18.next) {
1466
1538
  case 0:
1467
1539
  this.logMethodStart('submitScanOrder');
1468
- _context17.prev = 1;
1469
- _context17.next = 4;
1540
+ _context18.prev = 1;
1541
+ _context18.next = 4;
1470
1542
  return this.validateBeforeSubmitByItemRule();
1471
1543
  case 4:
1472
1544
  if (this.store.order) {
1473
- _context17.next = 6;
1545
+ _context18.next = 6;
1474
1546
  break;
1475
1547
  }
1476
1548
  throw new Error('scanOrder解决方案需要 order 模块支持');
@@ -1482,7 +1554,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1482
1554
  collect_pax: pax
1483
1555
  });
1484
1556
  tempOrderForSubmit.delivery_type = 'shop_service';
1485
- resourceTableName = (_this$store$resource = this.store.resource) === null || _this$store$resource === void 0 || (_this$store$resource = _this$store$resource.table_form_record) === null || _this$store$resource === void 0 ? void 0 : _this$store$resource.name;
1557
+ resourceTableName = (_this$store$resource2 = this.store.resource) === null || _this$store$resource2 === void 0 || (_this$store$resource2 = _this$store$resource2.table_form_record) === null || _this$store$resource2 === void 0 ? void 0 : _this$store$resource2.name;
1486
1558
  if (resourceTableName && _typeof(resourceTableName) === 'object') {
1487
1559
  tempOrderForSubmit.table_number = resourceTableName;
1488
1560
  } else {
@@ -1490,32 +1562,43 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1490
1562
  }
1491
1563
  this.store.order.persistTempOrder();
1492
1564
  enhancePayload = this.buildSubmitPayloadEnhancer();
1493
- _context17.next = 17;
1494
- return this.store.order.submitTempOrder({
1495
- cacheId: this.cacheId,
1496
- platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
1497
- businessCode: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode,
1498
- channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel,
1499
- type: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.type,
1565
+ if (!this.isScanOrderMoreMode(tempOrderForSubmit)) {
1566
+ _context18.next = 21;
1567
+ break;
1568
+ }
1569
+ _context18.next = 18;
1570
+ return this.submitScanOrderMore({
1571
+ tempOrder: tempOrderForSubmit,
1500
1572
  enhancePayload: enhancePayload
1501
1573
  });
1502
- case 17:
1503
- result = _context17.sent;
1574
+ case 18:
1575
+ _context18.t0 = _context18.sent;
1576
+ _context18.next = 24;
1577
+ break;
1578
+ case 21:
1579
+ _context18.next = 23;
1580
+ return this.submitSalesOrder({
1581
+ enhancePayload: enhancePayload
1582
+ });
1583
+ case 23:
1584
+ _context18.t0 = _context18.sent;
1585
+ case 24:
1586
+ result = _context18.t0;
1504
1587
  tempOrder = this.store.order.getTempOrder();
1505
1588
  this.logMethodSuccess('submitScanOrder', {
1506
1589
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
1507
1590
  });
1508
- return _context17.abrupt("return", result);
1509
- case 23:
1510
- _context17.prev = 23;
1511
- _context17.t0 = _context17["catch"](1);
1512
- this.logMethodError('submitScanOrder', _context17.t0);
1513
- throw _context17.t0;
1514
- case 27:
1591
+ return _context18.abrupt("return", result);
1592
+ case 30:
1593
+ _context18.prev = 30;
1594
+ _context18.t1 = _context18["catch"](1);
1595
+ this.logMethodError('submitScanOrder', _context18.t1);
1596
+ throw _context18.t1;
1597
+ case 34:
1515
1598
  case "end":
1516
- return _context17.stop();
1599
+ return _context18.stop();
1517
1600
  }
1518
- }, _callee17, this, [[1, 23]]);
1601
+ }, _callee18, this, [[1, 30]]);
1519
1602
  }));
1520
1603
  function submitScanOrder() {
1521
1604
  return _submitScanOrder.apply(this, arguments);
@@ -1525,48 +1608,48 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1525
1608
  }, {
1526
1609
  key: "addProductToOrder",
1527
1610
  value: function () {
1528
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(product) {
1611
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(product) {
1529
1612
  var products;
1530
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1531
- while (1) switch (_context18.prev = _context18.next) {
1613
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1614
+ while (1) switch (_context19.prev = _context19.next) {
1532
1615
  case 0:
1533
1616
  this.logMethodStart('addProductToOrder', {
1534
1617
  product_id: product.product_id,
1535
1618
  product_variant_id: product.product_variant_id
1536
1619
  });
1537
- _context18.prev = 1;
1620
+ _context19.prev = 1;
1538
1621
  if (this.store.order) {
1539
- _context18.next = 4;
1622
+ _context19.next = 4;
1540
1623
  break;
1541
1624
  }
1542
1625
  throw new Error('order 模块未初始化');
1543
1626
  case 4:
1544
- _context18.next = 6;
1627
+ _context19.next = 6;
1545
1628
  return this.store.order.addProductToOrder(product);
1546
1629
  case 6:
1547
- products = _context18.sent;
1548
- _context18.next = 9;
1630
+ products = _context19.sent;
1631
+ _context19.next = 9;
1549
1632
  return this.refreshItemRuleQuantityLimits();
1550
1633
  case 9:
1551
- _context18.next = 11;
1634
+ _context19.next = 11;
1552
1635
  return this.refreshCartValidationPassed();
1553
1636
  case 11:
1554
1637
  this.logMethodSuccess('addProductToOrder', {
1555
1638
  productCount: products.length
1556
1639
  });
1557
- return _context18.abrupt("return", products);
1640
+ return _context19.abrupt("return", products);
1558
1641
  case 15:
1559
- _context18.prev = 15;
1560
- _context18.t0 = _context18["catch"](1);
1561
- this.logMethodError('addProductToOrder', _context18.t0);
1562
- throw _context18.t0;
1642
+ _context19.prev = 15;
1643
+ _context19.t0 = _context19["catch"](1);
1644
+ this.logMethodError('addProductToOrder', _context19.t0);
1645
+ throw _context19.t0;
1563
1646
  case 19:
1564
1647
  case "end":
1565
- return _context18.stop();
1648
+ return _context19.stop();
1566
1649
  }
1567
- }, _callee18, this, [[1, 15]]);
1650
+ }, _callee19, this, [[1, 15]]);
1568
1651
  }));
1569
- function addProductToOrder(_x10) {
1652
+ function addProductToOrder(_x12) {
1570
1653
  return _addProductToOrder.apply(this, arguments);
1571
1654
  }
1572
1655
  return addProductToOrder;
@@ -1574,48 +1657,48 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1574
1657
  }, {
1575
1658
  key: "updateOrderProduct",
1576
1659
  value: function () {
1577
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1660
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1578
1661
  var products;
1579
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1580
- while (1) switch (_context19.prev = _context19.next) {
1662
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1663
+ while (1) switch (_context20.prev = _context20.next) {
1581
1664
  case 0:
1582
1665
  this.logMethodStart('updateOrderProduct', {
1583
1666
  product_id: params.product_id,
1584
1667
  product_variant_id: params.product_variant_id
1585
1668
  });
1586
- _context19.prev = 1;
1669
+ _context20.prev = 1;
1587
1670
  if (this.store.order) {
1588
- _context19.next = 4;
1671
+ _context20.next = 4;
1589
1672
  break;
1590
1673
  }
1591
1674
  throw new Error('order 模块未初始化');
1592
1675
  case 4:
1593
- _context19.next = 6;
1676
+ _context20.next = 6;
1594
1677
  return this.store.order.updateOrderProduct(params);
1595
1678
  case 6:
1596
- products = _context19.sent;
1597
- _context19.next = 9;
1679
+ products = _context20.sent;
1680
+ _context20.next = 9;
1598
1681
  return this.refreshItemRuleQuantityLimits();
1599
1682
  case 9:
1600
- _context19.next = 11;
1683
+ _context20.next = 11;
1601
1684
  return this.refreshCartValidationPassed();
1602
1685
  case 11:
1603
1686
  this.logMethodSuccess('updateOrderProduct', {
1604
1687
  productCount: products.length
1605
1688
  });
1606
- return _context19.abrupt("return", products);
1689
+ return _context20.abrupt("return", products);
1607
1690
  case 15:
1608
- _context19.prev = 15;
1609
- _context19.t0 = _context19["catch"](1);
1610
- this.logMethodError('updateOrderProduct', _context19.t0);
1611
- throw _context19.t0;
1691
+ _context20.prev = 15;
1692
+ _context20.t0 = _context20["catch"](1);
1693
+ this.logMethodError('updateOrderProduct', _context20.t0);
1694
+ throw _context20.t0;
1612
1695
  case 19:
1613
1696
  case "end":
1614
- return _context19.stop();
1697
+ return _context20.stop();
1615
1698
  }
1616
- }, _callee19, this, [[1, 15]]);
1699
+ }, _callee20, this, [[1, 15]]);
1617
1700
  }));
1618
- function updateOrderProduct(_x11) {
1701
+ function updateOrderProduct(_x13) {
1619
1702
  return _updateOrderProduct.apply(this, arguments);
1620
1703
  }
1621
1704
  return updateOrderProduct;
@@ -1627,16 +1710,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1627
1710
  }, {
1628
1711
  key: "setOrderProductLineNote",
1629
1712
  value: (function () {
1630
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(identity, note) {
1713
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(identity, note) {
1631
1714
  var params, products;
1632
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1633
- while (1) switch (_context20.prev = _context20.next) {
1715
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1716
+ while (1) switch (_context21.prev = _context21.next) {
1634
1717
  case 0:
1635
1718
  this.logMethodStart('setOrderProductLineNote', {
1636
1719
  product_id: identity.product_id,
1637
1720
  product_variant_id: identity.product_variant_id
1638
1721
  });
1639
- _context20.prev = 1;
1722
+ _context21.prev = 1;
1640
1723
  params = {
1641
1724
  product_id: identity.product_id,
1642
1725
  product_variant_id: identity.product_variant_id,
@@ -1649,26 +1732,26 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1649
1732
  params.product_sku = identity.product_sku;
1650
1733
  }
1651
1734
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1652
- _context20.next = 8;
1735
+ _context21.next = 8;
1653
1736
  return this.updateOrderProduct(params);
1654
1737
  case 8:
1655
- products = _context20.sent;
1738
+ products = _context21.sent;
1656
1739
  this.logMethodSuccess('setOrderProductLineNote', {
1657
1740
  productCount: products.length
1658
1741
  });
1659
- return _context20.abrupt("return", products);
1742
+ return _context21.abrupt("return", products);
1660
1743
  case 13:
1661
- _context20.prev = 13;
1662
- _context20.t0 = _context20["catch"](1);
1663
- this.logMethodError('setOrderProductLineNote', _context20.t0);
1664
- throw _context20.t0;
1744
+ _context21.prev = 13;
1745
+ _context21.t0 = _context21["catch"](1);
1746
+ this.logMethodError('setOrderProductLineNote', _context21.t0);
1747
+ throw _context21.t0;
1665
1748
  case 17:
1666
1749
  case "end":
1667
- return _context20.stop();
1750
+ return _context21.stop();
1668
1751
  }
1669
- }, _callee20, this, [[1, 13]]);
1752
+ }, _callee21, this, [[1, 13]]);
1670
1753
  }));
1671
- function setOrderProductLineNote(_x12, _x13) {
1754
+ function setOrderProductLineNote(_x14, _x15) {
1672
1755
  return _setOrderProductLineNote.apply(this, arguments);
1673
1756
  }
1674
1757
  return setOrderProductLineNote;
@@ -1676,48 +1759,48 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1676
1759
  }, {
1677
1760
  key: "removeProductFromOrder",
1678
1761
  value: function () {
1679
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(identity) {
1762
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(identity) {
1680
1763
  var products;
1681
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1682
- while (1) switch (_context21.prev = _context21.next) {
1764
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1765
+ while (1) switch (_context22.prev = _context22.next) {
1683
1766
  case 0:
1684
1767
  this.logMethodStart('removeProductFromOrder', {
1685
1768
  product_id: identity.product_id,
1686
1769
  product_variant_id: identity.product_variant_id
1687
1770
  });
1688
- _context21.prev = 1;
1771
+ _context22.prev = 1;
1689
1772
  if (this.store.order) {
1690
- _context21.next = 4;
1773
+ _context22.next = 4;
1691
1774
  break;
1692
1775
  }
1693
1776
  throw new Error('order 模块未初始化');
1694
1777
  case 4:
1695
- _context21.next = 6;
1778
+ _context22.next = 6;
1696
1779
  return this.store.order.removeProductFromOrder(identity);
1697
1780
  case 6:
1698
- products = _context21.sent;
1699
- _context21.next = 9;
1781
+ products = _context22.sent;
1782
+ _context22.next = 9;
1700
1783
  return this.refreshItemRuleQuantityLimits();
1701
1784
  case 9:
1702
- _context21.next = 11;
1785
+ _context22.next = 11;
1703
1786
  return this.refreshCartValidationPassed();
1704
1787
  case 11:
1705
1788
  this.logMethodSuccess('removeProductFromOrder', {
1706
1789
  productCount: products.length
1707
1790
  });
1708
- return _context21.abrupt("return", products);
1791
+ return _context22.abrupt("return", products);
1709
1792
  case 15:
1710
- _context21.prev = 15;
1711
- _context21.t0 = _context21["catch"](1);
1712
- this.logMethodError('removeProductFromOrder', _context21.t0);
1713
- throw _context21.t0;
1793
+ _context22.prev = 15;
1794
+ _context22.t0 = _context22["catch"](1);
1795
+ this.logMethodError('removeProductFromOrder', _context22.t0);
1796
+ throw _context22.t0;
1714
1797
  case 19:
1715
1798
  case "end":
1716
- return _context21.stop();
1799
+ return _context22.stop();
1717
1800
  }
1718
- }, _callee21, this, [[1, 15]]);
1801
+ }, _callee22, this, [[1, 15]]);
1719
1802
  }));
1720
- function removeProductFromOrder(_x14) {
1803
+ function removeProductFromOrder(_x16) {
1721
1804
  return _removeProductFromOrder.apply(this, arguments);
1722
1805
  }
1723
1806
  return removeProductFromOrder;
@@ -1725,26 +1808,26 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1725
1808
  }, {
1726
1809
  key: "loadRuntimeConfigs",
1727
1810
  value: function () {
1728
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1811
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1729
1812
  var itemRuleConfigs;
1730
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1731
- while (1) switch (_context22.prev = _context22.next) {
1813
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1814
+ while (1) switch (_context23.prev = _context23.next) {
1732
1815
  case 0:
1733
- _context22.next = 2;
1816
+ _context23.next = 2;
1734
1817
  return this.ensureItemRuleConfigsLoaded();
1735
1818
  case 2:
1736
- itemRuleConfigs = _context22.sent;
1819
+ itemRuleConfigs = _context23.sent;
1737
1820
  this.logMethodSuccess('loadRuntimeConfigs', {
1738
1821
  itemRuleCount: itemRuleConfigs.length
1739
1822
  });
1740
- return _context22.abrupt("return", {
1823
+ return _context23.abrupt("return", {
1741
1824
  itemRuleConfigs: itemRuleConfigs
1742
1825
  });
1743
1826
  case 5:
1744
1827
  case "end":
1745
- return _context22.stop();
1828
+ return _context23.stop();
1746
1829
  }
1747
- }, _callee22, this);
1830
+ }, _callee23, this);
1748
1831
  }));
1749
1832
  function loadRuntimeConfigs() {
1750
1833
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -1754,15 +1837,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1754
1837
  }, {
1755
1838
  key: "syncItemRuleConfigsFromDineInConfig",
1756
1839
  value: function () {
1757
- var _syncItemRuleConfigsFromDineInConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(dineInConfig) {
1840
+ var _syncItemRuleConfigsFromDineInConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(dineInConfig) {
1758
1841
  var enableItemRules, strategyModelIds, itemRuleConfigs;
1759
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1760
- while (1) switch (_context23.prev = _context23.next) {
1842
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1843
+ while (1) switch (_context24.prev = _context24.next) {
1761
1844
  case 0:
1762
1845
  enableItemRules = toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.enable_item_rules']);
1763
1846
  strategyModelIds = normalizeEnabledItemRuleIds(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.enabled_item_rules']);
1764
1847
  if (!(!enableItemRules || !strategyModelIds.length)) {
1765
- _context23.next = 8;
1848
+ _context24.next = 8;
1766
1849
  break;
1767
1850
  }
1768
1851
  this.itemRuleConfigs = [];
@@ -1773,12 +1856,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1773
1856
  strategyModelIds: [],
1774
1857
  itemRuleCount: 0
1775
1858
  });
1776
- return _context23.abrupt("return", []);
1859
+ return _context24.abrupt("return", []);
1777
1860
  case 8:
1778
- _context23.next = 10;
1861
+ _context24.next = 10;
1779
1862
  return this.fetchItemRuleConfigsByModelIds(strategyModelIds);
1780
1863
  case 10:
1781
- itemRuleConfigs = _context23.sent;
1864
+ itemRuleConfigs = _context24.sent;
1782
1865
  this.itemRuleConfigs = itemRuleConfigs;
1783
1866
  this.itemRuleConfigsPromise = Promise.resolve(itemRuleConfigs);
1784
1867
  this.itemRuleEvaluator.setStrategyConfigs(itemRuleConfigs);
@@ -1787,14 +1870,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1787
1870
  strategyModelIds: strategyModelIds,
1788
1871
  itemRuleCount: itemRuleConfigs.length
1789
1872
  });
1790
- return _context23.abrupt("return", itemRuleConfigs);
1873
+ return _context24.abrupt("return", itemRuleConfigs);
1791
1874
  case 16:
1792
1875
  case "end":
1793
- return _context23.stop();
1876
+ return _context24.stop();
1794
1877
  }
1795
- }, _callee23, this);
1878
+ }, _callee24, this);
1796
1879
  }));
1797
- function syncItemRuleConfigsFromDineInConfig(_x15) {
1880
+ function syncItemRuleConfigsFromDineInConfig(_x17) {
1798
1881
  return _syncItemRuleConfigsFromDineInConfig.apply(this, arguments);
1799
1882
  }
1800
1883
  return syncItemRuleConfigsFromDineInConfig;
@@ -1802,22 +1885,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1802
1885
  }, {
1803
1886
  key: "fetchItemRuleConfigsByModelIds",
1804
1887
  value: function () {
1805
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(strategyModelIds) {
1888
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(strategyModelIds) {
1806
1889
  var result, configs;
1807
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1808
- while (1) switch (_context24.prev = _context24.next) {
1890
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1891
+ while (1) switch (_context25.prev = _context25.next) {
1809
1892
  case 0:
1810
1893
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
1811
1894
  strategyModelIds: strategyModelIds
1812
1895
  });
1813
1896
  if (strategyModelIds.length) {
1814
- _context24.next = 3;
1897
+ _context25.next = 3;
1815
1898
  break;
1816
1899
  }
1817
- return _context24.abrupt("return", []);
1900
+ return _context25.abrupt("return", []);
1818
1901
  case 3:
1819
- _context24.prev = 3;
1820
- _context24.next = 6;
1902
+ _context25.prev = 3;
1903
+ _context25.next = 6;
1821
1904
  return this.request.get('/promotion', {
1822
1905
  skip: 1,
1823
1906
  num: 99,
@@ -1825,7 +1908,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1825
1908
  ids: strategyModelIds
1826
1909
  });
1827
1910
  case 6:
1828
- result = _context24.sent;
1911
+ result = _context25.sent;
1829
1912
  configs = [];
1830
1913
  if (result.code === 200) {
1831
1914
  configs = result.data.list.map(function (item) {
@@ -1836,22 +1919,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1836
1919
  strategyModelIds: strategyModelIds,
1837
1920
  strategyCount: configs.length
1838
1921
  });
1839
- return _context24.abrupt("return", configs);
1922
+ return _context25.abrupt("return", configs);
1840
1923
  case 13:
1841
- _context24.prev = 13;
1842
- _context24.t0 = _context24["catch"](3);
1843
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context24.t0, {
1924
+ _context25.prev = 13;
1925
+ _context25.t0 = _context25["catch"](3);
1926
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context25.t0, {
1844
1927
  strategyModelIds: strategyModelIds
1845
1928
  });
1846
1929
  // A:策略加载失败时不阻塞下单
1847
- return _context24.abrupt("return", []);
1930
+ return _context25.abrupt("return", []);
1848
1931
  case 17:
1849
1932
  case "end":
1850
- return _context24.stop();
1933
+ return _context25.stop();
1851
1934
  }
1852
- }, _callee24, this, [[3, 13]]);
1935
+ }, _callee25, this, [[3, 13]]);
1853
1936
  }));
1854
- function fetchItemRuleConfigsByModelIds(_x16) {
1937
+ function fetchItemRuleConfigsByModelIds(_x18) {
1855
1938
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
1856
1939
  }
1857
1940
  return fetchItemRuleConfigsByModelIds;
@@ -1859,22 +1942,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1859
1942
  }, {
1860
1943
  key: "buildPrefillProductSourceMap",
1861
1944
  value: function () {
1862
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1945
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1863
1946
  var sourceMap, productList, visited, collectFromValue;
1864
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1865
- while (1) switch (_context25.prev = _context25.next) {
1947
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1948
+ while (1) switch (_context26.prev = _context26.next) {
1866
1949
  case 0:
1867
1950
  sourceMap = new Map();
1868
- _context25.prev = 1;
1869
- _context25.next = 4;
1951
+ _context26.prev = 1;
1952
+ _context26.next = 4;
1870
1953
  return this.getProductList();
1871
1954
  case 4:
1872
- productList = _context25.sent;
1955
+ productList = _context26.sent;
1873
1956
  if (Array.isArray(productList)) {
1874
- _context25.next = 7;
1957
+ _context26.next = 7;
1875
1958
  break;
1876
1959
  }
1877
- return _context25.abrupt("return", sourceMap);
1960
+ return _context26.abrupt("return", sourceMap);
1878
1961
  case 7:
1879
1962
  visited = new Set();
1880
1963
  collectFromValue = function collectFromValue(value) {
@@ -1909,27 +1992,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1909
1992
  sourceMap.set(key, node);
1910
1993
  }
1911
1994
  }
1912
- for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
1913
- var childValue = _Object$values[_i4];
1995
+ for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
1996
+ var childValue = _Object$values[_i3];
1914
1997
  if (childValue && _typeof(childValue) === 'object') {
1915
1998
  collectFromValue(childValue);
1916
1999
  }
1917
2000
  }
1918
2001
  };
1919
2002
  collectFromValue(productList);
1920
- _context25.next = 15;
2003
+ _context26.next = 15;
1921
2004
  break;
1922
2005
  case 12:
1923
- _context25.prev = 12;
1924
- _context25.t0 = _context25["catch"](1);
1925
- this.logMethodError('buildPrefillProductSourceMap', _context25.t0);
2006
+ _context26.prev = 12;
2007
+ _context26.t0 = _context26["catch"](1);
2008
+ this.logMethodError('buildPrefillProductSourceMap', _context26.t0);
1926
2009
  case 15:
1927
- return _context25.abrupt("return", sourceMap);
2010
+ return _context26.abrupt("return", sourceMap);
1928
2011
  case 16:
1929
2012
  case "end":
1930
- return _context25.stop();
2013
+ return _context26.stop();
1931
2014
  }
1932
- }, _callee25, this, [[1, 12]]);
2015
+ }, _callee26, this, [[1, 12]]);
1933
2016
  }));
1934
2017
  function buildPrefillProductSourceMap() {
1935
2018
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -1944,58 +2027,58 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1944
2027
  }, {
1945
2028
  key: "ensureItemRuleConfigsLoaded",
1946
2029
  value: function () {
1947
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2030
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1948
2031
  var _this6 = this;
1949
2032
  var loadedConfigs;
1950
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1951
- while (1) switch (_context27.prev = _context27.next) {
2033
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2034
+ while (1) switch (_context28.prev = _context28.next) {
1952
2035
  case 0:
1953
2036
  if (!(this.itemRuleConfigs.length > 0)) {
1954
- _context27.next = 2;
2037
+ _context28.next = 2;
1955
2038
  break;
1956
2039
  }
1957
- return _context27.abrupt("return", this.itemRuleConfigs);
2040
+ return _context28.abrupt("return", this.itemRuleConfigs);
1958
2041
  case 2:
1959
2042
  if (!this.itemRuleConfigsPromise) {
1960
- _context27.next = 4;
2043
+ _context28.next = 4;
1961
2044
  break;
1962
2045
  }
1963
- return _context27.abrupt("return", this.itemRuleConfigsPromise);
2046
+ return _context28.abrupt("return", this.itemRuleConfigsPromise);
1964
2047
  case 4:
1965
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2048
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
1966
2049
  var runtimeConfig, staticConfigs;
1967
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1968
- while (1) switch (_context26.prev = _context26.next) {
2050
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2051
+ while (1) switch (_context27.prev = _context27.next) {
1969
2052
  case 0:
1970
2053
  runtimeConfig = _this6.getItemRuleRuntimeConfig();
1971
2054
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
1972
2055
  if (!(staticConfigs.length > 0)) {
1973
- _context26.next = 6;
2056
+ _context27.next = 6;
1974
2057
  break;
1975
2058
  }
1976
2059
  _this6.itemRuleConfigs = staticConfigs;
1977
2060
  _this6.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
1978
- return _context26.abrupt("return", _this6.itemRuleConfigs);
2061
+ return _context27.abrupt("return", _this6.itemRuleConfigs);
1979
2062
  case 6:
1980
2063
  _this6.itemRuleConfigs = [];
1981
2064
  _this6.itemRuleEvaluator.setStrategyConfigs([]);
1982
- return _context26.abrupt("return", _this6.itemRuleConfigs);
2065
+ return _context27.abrupt("return", _this6.itemRuleConfigs);
1983
2066
  case 9:
1984
2067
  case "end":
1985
- return _context26.stop();
2068
+ return _context27.stop();
1986
2069
  }
1987
- }, _callee26);
2070
+ }, _callee27);
1988
2071
  }))();
1989
- _context27.next = 7;
2072
+ _context28.next = 7;
1990
2073
  return this.itemRuleConfigsPromise;
1991
2074
  case 7:
1992
- loadedConfigs = _context27.sent;
1993
- return _context27.abrupt("return", loadedConfigs);
2075
+ loadedConfigs = _context28.sent;
2076
+ return _context28.abrupt("return", loadedConfigs);
1994
2077
  case 9:
1995
2078
  case "end":
1996
- return _context27.stop();
2079
+ return _context28.stop();
1997
2080
  }
1998
- }, _callee27, this);
2081
+ }, _callee28, this);
1999
2082
  }));
2000
2083
  function ensureItemRuleConfigsLoaded() {
2001
2084
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -2005,25 +2088,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2005
2088
  }, {
2006
2089
  key: "refreshItemRuleQuantityLimits",
2007
2090
  value: function () {
2008
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2091
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2009
2092
  var strategyConfigs, businessData, limits;
2010
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2011
- while (1) switch (_context28.prev = _context28.next) {
2093
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2094
+ while (1) switch (_context29.prev = _context29.next) {
2012
2095
  case 0:
2013
- _context28.prev = 0;
2014
- _context28.next = 3;
2096
+ _context29.prev = 0;
2097
+ _context29.next = 3;
2015
2098
  return this.ensureItemRuleConfigsLoaded();
2016
2099
  case 3:
2017
- strategyConfigs = _context28.sent;
2100
+ strategyConfigs = _context29.sent;
2018
2101
  if (strategyConfigs.length) {
2019
- _context28.next = 7;
2102
+ _context29.next = 7;
2020
2103
  break;
2021
2104
  }
2022
2105
  this.store.itemRuleQuantityLimits = [];
2023
- return _context28.abrupt("return", []);
2106
+ return _context29.abrupt("return", []);
2024
2107
  case 7:
2025
2108
  businessData = buildItemRuleBusinessData({
2026
- tempOrder: this.ensureTempOrder(),
2109
+ tempOrder: this.ensureScanOrderTempOrder(),
2027
2110
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2028
2111
  itemRuleConfigs: this.itemRuleConfigs
2029
2112
  });
@@ -2032,18 +2115,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2032
2115
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
2033
2116
  limitCount: limits.length
2034
2117
  });
2035
- return _context28.abrupt("return", limits);
2118
+ return _context29.abrupt("return", limits);
2036
2119
  case 14:
2037
- _context28.prev = 14;
2038
- _context28.t0 = _context28["catch"](0);
2120
+ _context29.prev = 14;
2121
+ _context29.t0 = _context29["catch"](0);
2039
2122
  this.store.itemRuleQuantityLimits = [];
2040
- this.logMethodError('refreshItemRuleQuantityLimits', _context28.t0);
2041
- return _context28.abrupt("return", []);
2123
+ this.logMethodError('refreshItemRuleQuantityLimits', _context29.t0);
2124
+ return _context29.abrupt("return", []);
2042
2125
  case 19:
2043
2126
  case "end":
2044
- return _context28.stop();
2127
+ return _context29.stop();
2045
2128
  }
2046
- }, _callee28, this, [[0, 14]]);
2129
+ }, _callee29, this, [[0, 14]]);
2047
2130
  }));
2048
2131
  function refreshItemRuleQuantityLimits() {
2049
2132
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -2053,58 +2136,58 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2053
2136
  }, {
2054
2137
  key: "applyPrefillByItemRule",
2055
2138
  value: function () {
2056
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2139
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2057
2140
  var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
2058
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2059
- while (1) switch (_context29.prev = _context29.next) {
2141
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2142
+ while (1) switch (_context30.prev = _context30.next) {
2060
2143
  case 0:
2061
2144
  if (!this.itemRulePrefillApplied) {
2062
- _context29.next = 2;
2145
+ _context30.next = 2;
2063
2146
  break;
2064
2147
  }
2065
- return _context29.abrupt("return");
2148
+ return _context30.abrupt("return");
2066
2149
  case 2:
2067
2150
  if (this.store.order) {
2068
- _context29.next = 4;
2151
+ _context30.next = 4;
2069
2152
  break;
2070
2153
  }
2071
- return _context29.abrupt("return");
2154
+ return _context30.abrupt("return");
2072
2155
  case 4:
2073
- _context29.next = 6;
2156
+ _context30.next = 6;
2074
2157
  return this.ensureItemRuleConfigsLoaded();
2075
2158
  case 6:
2076
- strategyConfigs = _context29.sent;
2159
+ strategyConfigs = _context30.sent;
2077
2160
  if (strategyConfigs.length) {
2078
- _context29.next = 9;
2161
+ _context30.next = 9;
2079
2162
  break;
2080
2163
  }
2081
- return _context29.abrupt("return");
2164
+ return _context30.abrupt("return");
2082
2165
  case 9:
2083
2166
  businessData = buildItemRuleBusinessData({
2084
- tempOrder: this.ensureTempOrder(),
2167
+ tempOrder: this.ensureScanOrderTempOrder(),
2085
2168
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2086
2169
  itemRuleConfigs: this.itemRuleConfigs
2087
2170
  });
2088
2171
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
2089
2172
  if (prefillItems.length) {
2090
- _context29.next = 14;
2173
+ _context30.next = 14;
2091
2174
  break;
2092
2175
  }
2093
2176
  this.itemRulePrefillApplied = true;
2094
- return _context29.abrupt("return");
2177
+ return _context30.abrupt("return");
2095
2178
  case 14:
2096
- _context29.next = 16;
2179
+ _context30.next = 16;
2097
2180
  return this.buildPrefillProductSourceMap();
2098
2181
  case 16:
2099
- productSourceMap = _context29.sent;
2100
- tempOrder = this.ensureTempOrder();
2182
+ productSourceMap = _context30.sent;
2183
+ tempOrder = this.ensureScanOrderTempOrder();
2101
2184
  hasChanges = false;
2102
2185
  _iterator6 = _createForOfIteratorHelper(prefillItems);
2103
- _context29.prev = 20;
2186
+ _context30.prev = 20;
2104
2187
  _iterator6.s();
2105
2188
  case 22:
2106
2189
  if ((_step6 = _iterator6.n()).done) {
2107
- _context29.next = 47;
2190
+ _context30.next = 47;
2108
2191
  break;
2109
2192
  }
2110
2193
  prefillItem = _step6.value;
@@ -2112,16 +2195,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2112
2195
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
2113
2196
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
2114
2197
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
2115
- _context29.next = 29;
2198
+ _context30.next = 29;
2116
2199
  break;
2117
2200
  }
2118
- return _context29.abrupt("continue", 45);
2201
+ return _context30.abrupt("continue", 45);
2119
2202
  case 29:
2120
2203
  if (!Number.isNaN(productVariantId)) {
2121
- _context29.next = 31;
2204
+ _context30.next = 31;
2122
2205
  break;
2123
2206
  }
2124
- return _context29.abrupt("continue", 45);
2207
+ return _context30.abrupt("continue", 45);
2125
2208
  case 31:
2126
2209
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
2127
2210
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -2129,7 +2212,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2129
2212
  product_variant_id: productVariantId
2130
2213
  });
2131
2214
  if (!(productIndex === -1)) {
2132
- _context29.next = 38;
2215
+ _context30.next = 38;
2133
2216
  break;
2134
2217
  }
2135
2218
  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');
@@ -2149,7 +2232,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2149
2232
  })
2150
2233
  })));
2151
2234
  hasChanges = true;
2152
- return _context29.abrupt("continue", 45);
2235
+ return _context30.abrupt("continue", 45);
2153
2236
  case 38:
2154
2237
  targetProduct = tempOrder.products[productIndex];
2155
2238
  existedQuantity = toNonNegativeInt(targetProduct.num);
@@ -2170,34 +2253,34 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2170
2253
  hasChanges = true;
2171
2254
  }
2172
2255
  case 45:
2173
- _context29.next = 22;
2256
+ _context30.next = 22;
2174
2257
  break;
2175
2258
  case 47:
2176
- _context29.next = 52;
2259
+ _context30.next = 52;
2177
2260
  break;
2178
2261
  case 49:
2179
- _context29.prev = 49;
2180
- _context29.t0 = _context29["catch"](20);
2181
- _iterator6.e(_context29.t0);
2262
+ _context30.prev = 49;
2263
+ _context30.t0 = _context30["catch"](20);
2264
+ _iterator6.e(_context30.t0);
2182
2265
  case 52:
2183
- _context29.prev = 52;
2266
+ _context30.prev = 52;
2184
2267
  _iterator6.f();
2185
- return _context29.finish(52);
2268
+ return _context30.finish(52);
2186
2269
  case 55:
2187
2270
  if (!hasChanges) {
2188
- _context29.next = 60;
2271
+ _context30.next = 60;
2189
2272
  break;
2190
2273
  }
2191
2274
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
2192
2275
  this.store.order.applyDiscount();
2193
- _context29.next = 59;
2276
+ _context30.next = 59;
2194
2277
  return this.store.order.recalculateSummary({
2195
2278
  createIfMissing: true
2196
2279
  });
2197
2280
  case 59:
2198
2281
  this.store.order.persistTempOrder();
2199
2282
  case 60:
2200
- _context29.next = 62;
2283
+ _context30.next = 62;
2201
2284
  return this.refreshItemRuleQuantityLimits();
2202
2285
  case 62:
2203
2286
  this.itemRulePrefillApplied = true;
@@ -2207,9 +2290,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2207
2290
  });
2208
2291
  case 64:
2209
2292
  case "end":
2210
- return _context29.stop();
2293
+ return _context30.stop();
2211
2294
  }
2212
- }, _callee29, this, [[20, 49, 52, 55]]);
2295
+ }, _callee30, this, [[20, 49, 52, 55]]);
2213
2296
  }));
2214
2297
  function applyPrefillByItemRule() {
2215
2298
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -2219,31 +2302,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2219
2302
  }, {
2220
2303
  key: "applyItemRulePrefill",
2221
2304
  value: function () {
2222
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2223
- var _this$store$order4, _this$store$order4$ge;
2224
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2225
- while (1) switch (_context30.prev = _context30.next) {
2305
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2306
+ var _this$store$order5, _this$store$order5$ge;
2307
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2308
+ while (1) switch (_context31.prev = _context31.next) {
2226
2309
  case 0:
2227
- 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))) {
2228
- _context30.next = 2;
2310
+ if (!((_this$store$order5 = this.store.order) !== null && _this$store$order5 !== void 0 && (_this$store$order5$ge = _this$store$order5.getLastOrderInfo) !== null && _this$store$order5$ge !== void 0 && _this$store$order5$ge.call(_this$store$order5))) {
2311
+ _context31.next = 2;
2229
2312
  break;
2230
2313
  }
2231
- return _context30.abrupt("return");
2314
+ return _context31.abrupt("return");
2232
2315
  case 2:
2233
2316
  this.logMethodStart('applyItemRulePrefill');
2234
- _context30.next = 5;
2317
+ _context31.next = 5;
2235
2318
  return this.applyPrefillByItemRule();
2236
2319
  case 5:
2237
- _context30.next = 7;
2320
+ _context31.next = 7;
2238
2321
  return this.refreshItemRuleQuantityLimits();
2239
2322
  case 7:
2240
- _context30.next = 9;
2323
+ _context31.next = 9;
2241
2324
  return this.refreshCartValidationPassed();
2242
2325
  case 9:
2243
2326
  case "end":
2244
- return _context30.stop();
2327
+ return _context31.stop();
2245
2328
  }
2246
- }, _callee30, this);
2329
+ }, _callee31, this);
2247
2330
  }));
2248
2331
  function applyItemRulePrefill() {
2249
2332
  return _applyItemRulePrefill.apply(this, arguments);
@@ -2253,35 +2336,35 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2253
2336
  }, {
2254
2337
  key: "evaluateCartValidationByItemRule",
2255
2338
  value: function () {
2256
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2339
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2257
2340
  var strategyConfigs, businessData;
2258
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2259
- while (1) switch (_context31.prev = _context31.next) {
2341
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2342
+ while (1) switch (_context32.prev = _context32.next) {
2260
2343
  case 0:
2261
- _context31.next = 2;
2344
+ _context32.next = 2;
2262
2345
  return this.ensureItemRuleConfigsLoaded();
2263
2346
  case 2:
2264
- strategyConfigs = _context31.sent;
2347
+ strategyConfigs = _context32.sent;
2265
2348
  if (strategyConfigs.length) {
2266
- _context31.next = 5;
2349
+ _context32.next = 5;
2267
2350
  break;
2268
2351
  }
2269
- return _context31.abrupt("return", {
2352
+ return _context32.abrupt("return", {
2270
2353
  passed: true,
2271
2354
  failures: []
2272
2355
  });
2273
2356
  case 5:
2274
2357
  businessData = buildItemRuleBusinessData({
2275
- tempOrder: this.ensureTempOrder(),
2358
+ tempOrder: this.ensureScanOrderTempOrder(),
2276
2359
  runtimeConfig: this.getItemRuleRuntimeConfig(),
2277
2360
  itemRuleConfigs: this.itemRuleConfigs
2278
2361
  });
2279
- return _context31.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
2362
+ return _context32.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
2280
2363
  case 7:
2281
2364
  case "end":
2282
- return _context31.stop();
2365
+ return _context32.stop();
2283
2366
  }
2284
- }, _callee31, this);
2367
+ }, _callee32, this);
2285
2368
  }));
2286
2369
  function evaluateCartValidationByItemRule() {
2287
2370
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -2291,20 +2374,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2291
2374
  }, {
2292
2375
  key: "validateBeforeSubmitByItemRule",
2293
2376
  value: function () {
2294
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2377
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2295
2378
  var validationResult, firstFailure, errorMessage, error;
2296
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2297
- while (1) switch (_context32.prev = _context32.next) {
2379
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2380
+ while (1) switch (_context33.prev = _context33.next) {
2298
2381
  case 0:
2299
- _context32.next = 2;
2382
+ _context33.next = 2;
2300
2383
  return this.evaluateCartValidationByItemRule();
2301
2384
  case 2:
2302
- validationResult = _context32.sent;
2385
+ validationResult = _context33.sent;
2303
2386
  if (!validationResult.passed) {
2304
- _context32.next = 5;
2387
+ _context33.next = 5;
2305
2388
  break;
2306
2389
  }
2307
- return _context32.abrupt("return");
2390
+ return _context33.abrupt("return");
2308
2391
  case 5:
2309
2392
  firstFailure = validationResult.failures[0];
2310
2393
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -2313,9 +2396,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2313
2396
  throw error;
2314
2397
  case 10:
2315
2398
  case "end":
2316
- return _context32.stop();
2399
+ return _context33.stop();
2317
2400
  }
2318
- }, _callee32, this);
2401
+ }, _callee33, this);
2319
2402
  }));
2320
2403
  function validateBeforeSubmitByItemRule() {
2321
2404
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -2325,10 +2408,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2325
2408
  }, {
2326
2409
  key: "refreshCartValidationPassed",
2327
2410
  value: function () {
2328
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2411
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2329
2412
  var previous, nextState, validationResult, changed;
2330
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2331
- while (1) switch (_context33.prev = _context33.next) {
2413
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2414
+ while (1) switch (_context34.prev = _context34.next) {
2332
2415
  case 0:
2333
2416
  previous = this.store.cartValidation || {
2334
2417
  passed: null,
@@ -2338,20 +2421,20 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2338
2421
  passed: null,
2339
2422
  failures: []
2340
2423
  };
2341
- _context33.prev = 2;
2342
- _context33.next = 5;
2424
+ _context34.prev = 2;
2425
+ _context34.next = 5;
2343
2426
  return this.evaluateCartValidationByItemRule();
2344
2427
  case 5:
2345
- validationResult = _context33.sent;
2428
+ validationResult = _context34.sent;
2346
2429
  nextState = {
2347
2430
  passed: validationResult.passed,
2348
2431
  failures: validationResult.failures || []
2349
2432
  };
2350
- _context33.next = 12;
2433
+ _context34.next = 12;
2351
2434
  break;
2352
2435
  case 9:
2353
- _context33.prev = 9;
2354
- _context33.t0 = _context33["catch"](2);
2436
+ _context34.prev = 9;
2437
+ _context34.t0 = _context34["catch"](2);
2355
2438
  nextState = {
2356
2439
  passed: false,
2357
2440
  failures: []
@@ -2360,21 +2443,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2360
2443
  this.store.cartValidation = nextState;
2361
2444
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
2362
2445
  if (!changed) {
2363
- _context33.next = 17;
2446
+ _context34.next = 17;
2364
2447
  break;
2365
2448
  }
2366
- _context33.next = 17;
2449
+ _context34.next = 17;
2367
2450
  return this.core.effects.emit(ScanOrderHooks.onCartValidationChanged, {
2368
2451
  cartValidation: nextState,
2369
2452
  cartValidationPassed: nextState.passed
2370
2453
  });
2371
2454
  case 17:
2372
- return _context33.abrupt("return", nextState.passed);
2455
+ return _context34.abrupt("return", nextState.passed);
2373
2456
  case 18:
2374
2457
  case "end":
2375
- return _context33.stop();
2458
+ return _context34.stop();
2376
2459
  }
2377
- }, _callee33, this, [[2, 9]]);
2460
+ }, _callee34, this, [[2, 9]]);
2378
2461
  }));
2379
2462
  function refreshCartValidationPassed() {
2380
2463
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -2384,14 +2467,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2384
2467
  }, {
2385
2468
  key: "setItemRuleRuntimeConfig",
2386
2469
  value: function () {
2387
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2470
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2388
2471
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
2389
2472
  var config,
2390
- _args34 = arguments;
2391
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2392
- while (1) switch (_context34.prev = _context34.next) {
2473
+ _args35 = arguments;
2474
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2475
+ while (1) switch (_context35.prev = _context35.next) {
2393
2476
  case 0:
2394
- config = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
2477
+ config = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
2395
2478
  this.logMethodStart('setItemRuleRuntimeConfig');
2396
2479
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
2397
2480
  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) || {}),
@@ -2403,10 +2486,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2403
2486
  this.itemRuleEvaluator.setStrategyConfigs([]);
2404
2487
  }
2405
2488
  this.itemRulePrefillApplied = false;
2406
- _context34.next = 7;
2489
+ _context35.next = 7;
2407
2490
  return this.refreshItemRuleQuantityLimits();
2408
2491
  case 7:
2409
- _context34.next = 9;
2492
+ _context35.next = 9;
2410
2493
  return this.refreshCartValidationPassed();
2411
2494
  case 9:
2412
2495
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -2414,9 +2497,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2414
2497
  });
2415
2498
  case 10:
2416
2499
  case "end":
2417
- return _context34.stop();
2500
+ return _context35.stop();
2418
2501
  }
2419
- }, _callee34, this);
2502
+ }, _callee35, this);
2420
2503
  }));
2421
2504
  function setItemRuleRuntimeConfig() {
2422
2505
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -2426,14 +2509,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2426
2509
  }, {
2427
2510
  key: "normalizeResourceState",
2428
2511
  value: function normalizeResourceState(detail, resourceSelectType, hasOrderId) {
2429
- var _detail$form_record, _this$otherParams8, _detail$resource_capa, _detail$resource_capa2;
2512
+ var _detail$form_record, _this$otherParams13, _detail$resource_capa, _detail$resource_capa2;
2430
2513
  var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
2431
2514
  var lastOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.last_order_id);
2432
2515
  var relationId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_record_id);
2433
2516
  var tableFormId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_id);
2434
2517
  var formRecord = (_detail$form_record = detail === null || detail === void 0 ? void 0 : detail.form_record) !== null && _detail$form_record !== void 0 ? _detail$form_record : null;
2435
2518
  // 是否允许加餐
2436
- var allowSnack = ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 || (_this$otherParams8 = _this$otherParams8.dineInConfig) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8['sale.allow_add_items']) || false;
2519
+ var allowSnack = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['sale.allow_add_items']) || false;
2437
2520
  // 开启同桌验证 - 本期没有这个配置,默认关掉
2438
2521
  var deskmateValid = false;
2439
2522
  var isExclusive = resourceSelectType === 'single';
@@ -2513,29 +2596,29 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2513
2596
  return matched === null || matched === void 0 ? void 0 : matched.type;
2514
2597
  }
2515
2598
  }, {
2516
- key: "fetchResourceOccupyDetailByResourceId",
2599
+ key: "fetchResourceOccupyDetailsByResourceId",
2517
2600
  value: function () {
2518
- var _fetchResourceOccupyDetailByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(resourceId) {
2519
- var _this$otherParams9, _this$otherParams9$ge, _response$data$occupy, _response$data;
2601
+ var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
2602
+ var _this$otherParams14, _this$otherParams14$g, _response$data$occupy, _response$data;
2520
2603
  var formRecordId, shopId, response;
2521
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2522
- while (1) switch (_context35.prev = _context35.next) {
2604
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2605
+ while (1) switch (_context36.prev = _context36.next) {
2523
2606
  case 0:
2524
2607
  formRecordId = Number(resourceId);
2525
2608
  if (!(!Number.isFinite(formRecordId) || formRecordId <= 0)) {
2526
- _context35.next = 3;
2609
+ _context36.next = 3;
2527
2610
  break;
2528
2611
  }
2529
2612
  throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
2530
2613
  case 3:
2531
- shopId = (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 || (_this$otherParams9$ge = _this$otherParams9.getStateData) === null || _this$otherParams9$ge === void 0 ? void 0 : _this$otherParams9$ge.call(_this$otherParams9, 'shop_id');
2614
+ shopId = (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14$g = _this$otherParams14.getStateData) === null || _this$otherParams14$g === void 0 ? void 0 : _this$otherParams14$g.call(_this$otherParams14, 'shop_id');
2532
2615
  if (shopId) {
2533
- _context35.next = 6;
2616
+ _context36.next = 6;
2534
2617
  break;
2535
2618
  }
2536
2619
  throw new Error('[ScanOrder] 无法获取 shop_id');
2537
2620
  case 6:
2538
- _context35.next = 8;
2621
+ _context36.next = 8;
2539
2622
  return this.request.get('/order/resource/occupy-detail', {
2540
2623
  shop_id: shopId,
2541
2624
  'form_record_ids[]': formRecordId,
@@ -2544,61 +2627,175 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2544
2627
  with_resource_form_info: 1
2545
2628
  });
2546
2629
  case 8:
2547
- response = _context35.sent;
2630
+ response = _context36.sent;
2548
2631
  if (response !== null && response !== void 0 && response.status) {
2549
- _context35.next = 11;
2632
+ _context36.next = 11;
2550
2633
  break;
2551
2634
  }
2552
2635
  throw new Error((response === null || response === void 0 ? void 0 : response.message) || '获取资源占用详情失败');
2553
2636
  case 11:
2554
- return _context35.abrupt("return", (_response$data$occupy = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.occupy_details) === null || _response$data === void 0 ? void 0 : _response$data[0]) !== null && _response$data$occupy !== void 0 ? _response$data$occupy : null);
2637
+ return _context36.abrupt("return", (_response$data$occupy = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.occupy_details) !== null && _response$data$occupy !== void 0 ? _response$data$occupy : []);
2555
2638
  case 12:
2556
2639
  case "end":
2557
- return _context35.stop();
2640
+ return _context36.stop();
2558
2641
  }
2559
- }, _callee35, this);
2642
+ }, _callee36, this);
2560
2643
  }));
2561
- function fetchResourceOccupyDetailByResourceId(_x17) {
2562
- return _fetchResourceOccupyDetailByResourceId.apply(this, arguments);
2644
+ function fetchResourceOccupyDetailsByResourceId(_x19) {
2645
+ return _fetchResourceOccupyDetailsByResourceId.apply(this, arguments);
2646
+ }
2647
+ return fetchResourceOccupyDetailsByResourceId;
2648
+ }()
2649
+ }, {
2650
+ key: "resolveAdditionalOrderFromOccupyDetail",
2651
+ value: function resolveAdditionalOrderFromOccupyDetail(detail, resourceSelectType, allowAddItems) {
2652
+ var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
2653
+ if (currentOrderId) {
2654
+ return {
2655
+ matched: true,
2656
+ order_id: currentOrderId
2657
+ };
2658
+ }
2659
+ var orderListIds = (Array.isArray(detail === null || detail === void 0 ? void 0 : detail.order_list) ? (detail === null || detail === void 0 ? void 0 : detail.order_list) || [] : []).map(function (order) {
2660
+ return toPositiveString(order === null || order === void 0 ? void 0 : order.id);
2661
+ }).filter(Boolean);
2662
+ if (resourceSelectType !== 'single') {
2663
+ return {
2664
+ matched: false,
2665
+ reason: 'no_order'
2666
+ };
2563
2667
  }
2564
- return fetchResourceOccupyDetailByResourceId;
2565
- }() // 检测当前链接是否可用
2668
+ if (!orderListIds.length) {
2669
+ return {
2670
+ matched: false,
2671
+ reason: 'no_order'
2672
+ };
2673
+ }
2674
+ if (!allowAddItems) {
2675
+ return {
2676
+ matched: false,
2677
+ reason: 'add_items_disabled'
2678
+ };
2679
+ }
2680
+ if (orderListIds.length === 1) {
2681
+ return {
2682
+ matched: true,
2683
+ order_id: orderListIds[0]
2684
+ };
2685
+ }
2686
+ if (orderListIds.length > 1) {
2687
+ return {
2688
+ matched: false,
2689
+ reason: 'multiple_orders'
2690
+ };
2691
+ }
2692
+ return {
2693
+ matched: false,
2694
+ reason: 'no_order'
2695
+ };
2696
+ }
2697
+
2698
+ // 检测当前链接是否可用
2566
2699
  // 通过 resource_id + 店铺配置
2567
2700
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
2568
2701
  }, {
2569
2702
  key: "checkResourceAvailable",
2570
2703
  value: function () {
2571
- var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
2572
- var _this$otherParams$bus, _this$otherParams10, _this$otherParams$cha, _this$otherParams11, _this$otherParams12, _this$otherParams12$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams13, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams14, businessCode, channel, openDataTarget, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, error, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
2573
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2574
- while (1) switch (_context36.prev = _context36.next) {
2704
+ var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(resourceId) {
2705
+ var hasOrderId,
2706
+ normalizedResourceId,
2707
+ _this$otherParams$bus,
2708
+ _this$otherParams15,
2709
+ _this$otherParams$cha,
2710
+ _this$otherParams16,
2711
+ _this$otherParams17,
2712
+ _this$otherParams17$g,
2713
+ _occupyDetails$,
2714
+ _occupyDetail$form_re,
2715
+ _occupyDetail$form_re2,
2716
+ _this$store$order6,
2717
+ _this$store$order7,
2718
+ _this$store$order7$ge,
2719
+ _this$otherParams18,
2720
+ _this$store$resource3,
2721
+ _this$store$resource4,
2722
+ businessCode,
2723
+ channel,
2724
+ openDataTarget,
2725
+ openData,
2726
+ dineInConfig,
2727
+ closedBehaviorValue,
2728
+ closedMessage,
2729
+ basicUnavailableMessage,
2730
+ pauseMessage,
2731
+ makeShopClosed,
2732
+ operatingHourIds,
2733
+ outsideOperatingHours,
2734
+ scheduleList,
2735
+ now,
2736
+ tempOrder,
2737
+ reservationLinkIds,
2738
+ pendingRequestEntryPax,
2739
+ pendingRequestPaxMin,
2740
+ pendingRequestPaxMax,
2741
+ reservationProductList,
2742
+ scheduleDate,
2743
+ scheduleDatetime,
2744
+ loaded,
2745
+ matchedRuleProduct,
2746
+ ruleProductsForResource,
2747
+ occupancyMinutes,
2748
+ paxBounds,
2749
+ error,
2750
+ _occupancyMinutes,
2751
+ _paxBounds,
2752
+ _error,
2753
+ occupyDetails,
2754
+ occupyDetail,
2755
+ resourceSelectType,
2756
+ allowAddItems,
2757
+ additionalOrderResult,
2758
+ _occupyDetail$order_l,
2759
+ multipleOrdersState,
2760
+ _availabilityInfo,
2761
+ resourceState,
2762
+ additionalOrderId,
2763
+ availabilityInfo,
2764
+ isAdditionalOrderMode,
2765
+ lastOrderInfo,
2766
+ historicalItems,
2767
+ _args37 = arguments;
2768
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2769
+ while (1) switch (_context37.prev = _context37.next) {
2575
2770
  case 0:
2771
+ hasOrderId = _args37.length > 1 && _args37[1] !== undefined ? _args37[1] : false;
2772
+ normalizedResourceId = String(resourceId !== null && resourceId !== void 0 ? resourceId : '').trim();
2576
2773
  this.logMethodStart('checkResourceAvailable', {
2577
- resourceId: resourceId
2774
+ resourceId: normalizedResourceId
2578
2775
  });
2579
- _context36.prev = 1;
2580
- businessCode = String((_this$otherParams$bus = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2581
- channel = String((_this$otherParams$cha = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2776
+ _context37.prev = 3;
2777
+ businessCode = String((_this$otherParams$bus = (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2778
+ channel = String((_this$otherParams$cha = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2582
2779
  openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
2583
- _context36.next = 7;
2584
- return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
2780
+ _context37.next = 9;
2781
+ return (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17$g = _this$otherParams17.getOpenData) === null || _this$otherParams17$g === void 0 ? void 0 : _this$otherParams17$g.call(_this$otherParams17, {
2585
2782
  scope: 'board',
2586
2783
  target: openDataTarget,
2587
2784
  section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
2588
2785
  });
2589
- case 7:
2590
- openData = _context36.sent;
2786
+ case 9:
2787
+ openData = _context37.sent;
2591
2788
  if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
2592
- _context36.next = 10;
2789
+ _context37.next = 12;
2593
2790
  break;
2594
2791
  }
2595
2792
  throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
2596
- case 10:
2793
+ case 12:
2597
2794
  dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
2598
2795
  this.otherParams.dineInConfig = dineInConfig;
2599
- _context36.next = 14;
2796
+ _context37.next = 16;
2600
2797
  return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
2601
- case 14:
2798
+ case 16:
2602
2799
  closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
2603
2800
  closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
2604
2801
  basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
@@ -2615,21 +2812,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2615
2812
  };
2616
2813
  }; // 1. 基础开关 basic.enable 关闭
2617
2814
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
2618
- _context36.next = 21;
2815
+ _context37.next = 23;
2619
2816
  break;
2620
2817
  }
2621
- return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
2622
- case 21:
2818
+ return _context37.abrupt("return", makeShopClosed(basicUnavailableMessage));
2819
+ case 23:
2623
2820
  if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
2624
- _context36.next = 24;
2821
+ _context37.next = 26;
2625
2822
  break;
2626
2823
  }
2627
2824
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
2628
- _context36.next = 24;
2825
+ _context37.next = 26;
2629
2826
  break;
2630
2827
  }
2631
- return _context36.abrupt("return", makeShopClosed(pauseMessage));
2632
- case 24:
2828
+ return _context37.abrupt("return", makeShopClosed(pauseMessage));
2829
+ case 26:
2633
2830
  // 3. 营业时间 operating_hours 闸门
2634
2831
  operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
2635
2832
  return Number(id);
@@ -2645,27 +2842,33 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2645
2842
  }
2646
2843
  }
2647
2844
  if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
2648
- _context36.next = 29;
2845
+ _context37.next = 31;
2649
2846
  break;
2650
2847
  }
2651
- return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
2652
- case 29:
2848
+ return _context37.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
2849
+ case 31:
2653
2850
  // Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
2654
2851
  // (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
2655
- tempOrder = this.ensureTempOrder();
2852
+ tempOrder = this.ensureScanOrderTempOrder();
2656
2853
  reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
2657
- if (!(reservationLinkIds.length === 0)) {
2658
- _context36.next = 35;
2854
+ if (!(!normalizedResourceId || reservationLinkIds.length === 0)) {
2855
+ _context37.next = 37;
2659
2856
  break;
2660
2857
  }
2661
- this.enabledReservationRuleProducts = [];
2662
- _context36.next = 46;
2663
- break;
2664
- case 35:
2858
+ _context37.next = 36;
2859
+ return this.prepareRetailAvailability({
2860
+ tempOrder: tempOrder,
2861
+ hasOrderId: hasOrderId,
2862
+ resourceId: normalizedResourceId,
2863
+ reason: !normalizedResourceId ? 'missing_resource_id' : 'missing_enabled_resource_rules'
2864
+ });
2865
+ case 36:
2866
+ return _context37.abrupt("return", _context37.sent);
2867
+ case 37:
2665
2868
  tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
2666
2869
  delete tempOrder.metadata.table_occupancy_duration;
2667
2870
  reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
2668
- _context36.next = 40;
2871
+ _context37.next = 42;
2669
2872
  return reservationProductList.initialize(this.core, {
2670
2873
  store: {
2671
2874
  list: [],
@@ -2677,27 +2880,29 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2677
2880
  cacheId: this.cacheId
2678
2881
  })
2679
2882
  });
2680
- case 40:
2883
+ case 42:
2681
2884
  scheduleDate = dayjs().format('YYYY-MM-DD');
2682
2885
  scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
2683
- _context36.next = 44;
2886
+ _context37.next = 46;
2684
2887
  return reservationProductList.loadProducts({
2685
2888
  product_ids: reservationLinkIds,
2686
2889
  schedule_date: scheduleDate,
2687
2890
  schedule_datetime: scheduleDatetime,
2688
2891
  cacheId: this.cacheId
2689
2892
  });
2690
- case 44:
2691
- loaded = _context36.sent;
2893
+ case 46:
2894
+ loaded = _context37.sent;
2692
2895
  if (Array.isArray(loaded)) {
2693
- this.enabledReservationRuleProducts = loaded;
2694
- occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
2896
+ matchedRuleProduct = findReservationRuleProductByResourceId(loaded, normalizedResourceId);
2897
+ ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
2898
+ this.enabledReservationRuleProducts = ruleProductsForResource;
2899
+ occupancyMinutes = pickFirstDurationMinutesFromProducts(ruleProductsForResource);
2695
2900
  if (occupancyMinutes !== undefined) {
2696
2901
  tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
2697
2902
  }
2698
- if (hasCustomCapacityProduct(loaded)) {
2903
+ if (hasCustomCapacityProduct(ruleProductsForResource)) {
2699
2904
  pendingRequestEntryPax = 1;
2700
- paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
2905
+ paxBounds = pickFirstCustomCapacityPaxBounds(ruleProductsForResource);
2701
2906
  if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.min) !== undefined) pendingRequestPaxMin = paxBounds.min;
2702
2907
  if ((paxBounds === null || paxBounds === void 0 ? void 0 : paxBounds.max) !== undefined) pendingRequestPaxMax = paxBounds.max;
2703
2908
  }
@@ -2705,22 +2910,83 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2705
2910
  this.enabledReservationRuleProducts = [];
2706
2911
  error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
2707
2912
  this.logMethodError('loadReservationRuleProducts', error, {
2708
- resourceId: resourceId,
2913
+ resourceId: normalizedResourceId,
2709
2914
  reservationLinkIds: reservationLinkIds,
2710
2915
  scheduleDate: scheduleDate,
2711
2916
  scheduleDatetime: scheduleDatetime,
2712
2917
  cacheId: this.cacheId
2713
2918
  });
2919
+ if (Array.isArray(loaded)) {
2920
+ this.enabledReservationRuleProducts = loaded;
2921
+ _occupancyMinutes = pickFirstDurationMinutesFromProducts(loaded);
2922
+ if (_occupancyMinutes !== undefined) {
2923
+ tempOrder.metadata.table_occupancy_duration = _occupancyMinutes;
2924
+ }
2925
+ if (hasCustomCapacityProduct(loaded)) {
2926
+ pendingRequestEntryPax = 1;
2927
+ _paxBounds = pickFirstCustomCapacityPaxBounds(loaded);
2928
+ if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.min) !== undefined) pendingRequestPaxMin = _paxBounds.min;
2929
+ if ((_paxBounds === null || _paxBounds === void 0 ? void 0 : _paxBounds.max) !== undefined) pendingRequestPaxMax = _paxBounds.max;
2930
+ }
2931
+ } else {
2932
+ this.enabledReservationRuleProducts = [];
2933
+ _error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
2934
+ this.logMethodError('loadReservationRuleProducts', _error, {
2935
+ resourceId: resourceId,
2936
+ reservationLinkIds: reservationLinkIds,
2937
+ scheduleDate: scheduleDate,
2938
+ scheduleDatetime: scheduleDatetime,
2939
+ cacheId: this.cacheId
2940
+ });
2941
+ }
2714
2942
  }
2715
- case 46:
2716
- _context36.next = 48;
2717
- return this.fetchResourceOccupyDetailByResourceId(resourceId);
2718
- case 48:
2719
- occupyDetail = _context36.sent;
2720
- // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2943
+
2944
+ // Step2: 请求新的资源占用详情接口。occupy_details 第一维是资源,不是订单。
2945
+ _context37.next = 50;
2946
+ return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
2947
+ case 50:
2948
+ occupyDetails = _context37.sent;
2949
+ occupyDetail = (_occupyDetails$ = occupyDetails[0]) !== null && _occupyDetails$ !== void 0 ? _occupyDetails$ : null; // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2721
2950
  // 计算当前桌台的 resourceSelectType(single/multiple/capacity)
2722
- resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id)); // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
2951
+ resourceSelectType = this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
2952
+ allowAddItems = toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['sale.allow_add_items']);
2953
+ additionalOrderResult = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
2954
+ if (!(additionalOrderResult.reason === 'multiple_orders')) {
2955
+ _context37.next = 61;
2956
+ break;
2957
+ }
2958
+ multipleOrdersState = _objectSpread(_objectSpread({}, this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId)), {}, {
2959
+ mode: 'multiple_orders'
2960
+ });
2961
+ this.store.resource = multipleOrdersState;
2962
+ _availabilityInfo = {
2963
+ mode: 'multiple_orders',
2964
+ deskmate_valid: multipleOrdersState.deskmate_valid,
2965
+ relation_id: multipleOrdersState.relationId,
2966
+ table_form_id: multipleOrdersState.tableFormId,
2967
+ table_form_record: multipleOrdersState.table_form_record
2968
+ };
2969
+ this.logMethodSuccess('checkResourceAvailable', {
2970
+ resourceId: normalizedResourceId,
2971
+ mode: _availabilityInfo.mode,
2972
+ orderListCount: (occupyDetail === null || occupyDetail === void 0 || (_occupyDetail$order_l = occupyDetail.order_list) === null || _occupyDetail$order_l === void 0 ? void 0 : _occupyDetail$order_l.length) || 0,
2973
+ resourceSelectType: resourceSelectType
2974
+ });
2975
+ return _context37.abrupt("return", _availabilityInfo);
2976
+ case 61:
2977
+ // Step4: 用 occupyDetail + resourceSelectType 规整为 resourceState
2723
2978
  resourceState = this.normalizeResourceState(occupyDetail, resourceSelectType, hasOrderId);
2979
+ additionalOrderId = additionalOrderResult.order_id;
2980
+ if (additionalOrderId) {
2981
+ resourceState.mode = 'additional_order';
2982
+ resourceState.order_id = additionalOrderId;
2983
+ } else if (additionalOrderResult.reason === 'add_items_disabled') {
2984
+ resourceState.mode = 'resource_busy';
2985
+ resourceState.order_id = '0';
2986
+ } else if (resourceSelectType === 'multiple' && resourceState.isFull) {
2987
+ resourceState.mode = 'resource_busy';
2988
+ resourceState.order_id = '0';
2989
+ }
2724
2990
  this.store.resource = resourceState;
2725
2991
 
2726
2992
  // Step5: 把预约规则商品阶段暂存的 requestEntryPax 等注入 store.resource
@@ -2749,47 +3015,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2749
3015
  } : {}), this.store.resource.requestPaxMax !== undefined ? {
2750
3016
  requestPaxMax: this.store.resource.requestPaxMax
2751
3017
  } : {});
2752
- tempOrder.relation_id = resourceId || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.relation_id);
2753
- tempOrder.table_form_id = resourceState.tableFormId;
2754
- tempOrder.resource_id = resourceId;
2755
- (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
3018
+ (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || _this$store$order6.persistTempOrder();
2756
3019
 
2757
3020
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
2758
3021
  if (!(availabilityInfo.mode === 'idle')) {
2759
- _context36.next = 63;
3022
+ _context37.next = 73;
2760
3023
  break;
2761
3024
  }
2762
- _context36.next = 63;
3025
+ _context37.next = 73;
2763
3026
  return this.addNewOrder();
2764
- case 63:
2765
- // 如果是加单模式,tempOrder 需要记录 lastOrderId,提交的时候走加单接口
2766
- if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
2767
- tempOrder.order_id = resourceState.lastOrderId;
3027
+ case 73:
3028
+ isAdditionalOrderMode = availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code'; // 如果是加单模式,tempOrder 里需要记录目标订单 id,提交的时候走加单接口
3029
+ if (isAdditionalOrderMode) {
3030
+ tempOrder.order_id = additionalOrderId;
2768
3031
  }
2769
- if (!tempOrder.order_id) {
2770
- _context36.next = 72;
2771
- break;
2772
- }
2773
- _context36.next = 67;
2774
- return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getSalesOrderByLookup({
2775
- lookup: tempOrder.order_id
2776
- });
2777
- case 67:
2778
- res = _context36.sent;
2779
- // 找到下单的时候输入的 entryPaxNumber
2780
- 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) {
2781
- var _p$metadata;
2782
- return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
2783
- })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
2784
- if (!entryPaxNumber) {
2785
- _context36.next = 72;
2786
- break;
2787
- }
2788
- _context36.next = 72;
2789
- return this.setEntryPaxNumber(entryPaxNumber);
2790
- case 72:
2791
3032
  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);
2792
- historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
3033
+ historicalItems = isAdditionalOrderMode && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
2793
3034
  if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
2794
3035
  acc.push(_objectSpread({
2795
3036
  product_id: p.product_id,
@@ -2799,13 +3040,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2799
3040
  } : {}));
2800
3041
  return acc;
2801
3042
  }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
2802
- _context36.next = 76;
3043
+ _context37.next = 79;
2803
3044
  return this.setItemRuleRuntimeConfig({
2804
- serviceType: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2805
- submissionIndex: hasOrderId ? 1 : 0,
3045
+ serviceType: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
3046
+ submissionIndex: isAdditionalOrderMode ? 1 : 0,
2806
3047
  historicalItems: historicalItems
2807
3048
  });
2808
- case 76:
3049
+ case 79:
2809
3050
  // operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
2810
3051
  // 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
2811
3052
  if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
@@ -2814,44 +3055,90 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2814
3055
  availabilityInfo.closed_behavior = closedBehaviorValue;
2815
3056
  }
2816
3057
  this.logMethodSuccess('checkResourceAvailable', {
2817
- resourceId: resourceId,
3058
+ resourceId: normalizedResourceId,
2818
3059
  mode: availabilityInfo.mode,
2819
3060
  orderId: availabilityInfo.order_id,
2820
3061
  relationId: availabilityInfo.relation_id,
2821
3062
  tableFormId: availabilityInfo.table_form_id,
2822
- persistedRelationId: tempOrder.relation_id,
2823
- persistedResourceId: tempOrder.resource_id,
3063
+ persistedRelationId: (_this$store$resource3 = this.store.resource) === null || _this$store$resource3 === void 0 ? void 0 : _this$store$resource3.relationId,
3064
+ persistedResourceId: (_this$store$resource4 = this.store.resource) === null || _this$store$resource4 === void 0 ? void 0 : _this$store$resource4.relationId,
2824
3065
  deskmateValid: availabilityInfo.deskmate_valid,
2825
3066
  resourceSelectType: resourceState.resourceSelectType,
2826
3067
  isExclusive: resourceState.isExclusive,
2827
3068
  isFull: resourceState.isFull
2828
3069
  });
2829
- return _context36.abrupt("return", availabilityInfo);
2830
- case 81:
2831
- _context36.prev = 81;
2832
- _context36.t0 = _context36["catch"](1);
2833
- this.logMethodError('checkResourceAvailable', _context36.t0.message, {
2834
- resourceId: resourceId
3070
+ return _context37.abrupt("return", availabilityInfo);
3071
+ case 84:
3072
+ _context37.prev = 84;
3073
+ _context37.t0 = _context37["catch"](3);
3074
+ this.logMethodError('checkResourceAvailable', _context37.t0.message, {
3075
+ resourceId: normalizedResourceId
2835
3076
  });
2836
- throw _context36.t0;
2837
- case 85:
3077
+ throw _context37.t0;
3078
+ case 88:
2838
3079
  case "end":
2839
- return _context36.stop();
3080
+ return _context37.stop();
2840
3081
  }
2841
- }, _callee36, this, [[1, 81]]);
3082
+ }, _callee37, this, [[3, 84]]);
2842
3083
  }));
2843
- function checkResourceAvailable(_x18, _x19) {
3084
+ function checkResourceAvailable(_x20) {
2844
3085
  return _checkResourceAvailable.apply(this, arguments);
2845
3086
  }
2846
3087
  return checkResourceAvailable;
3088
+ }() // 恢复之前订单的数据,读取 entrypax
3089
+ }, {
3090
+ key: "restorePreviousOrderData",
3091
+ value: function () {
3092
+ var _restorePreviousOrderData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3093
+ var orderModule, tempOrder, _res$data, res, entryPaxNumber;
3094
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3095
+ while (1) switch (_context38.prev = _context38.next) {
3096
+ case 0:
3097
+ orderModule = this.store.order;
3098
+ if (orderModule) {
3099
+ _context38.next = 3;
3100
+ break;
3101
+ }
3102
+ return _context38.abrupt("return");
3103
+ case 3:
3104
+ tempOrder = orderModule.ensureTempOrder();
3105
+ if (!tempOrder.order_id) {
3106
+ _context38.next = 12;
3107
+ break;
3108
+ }
3109
+ _context38.next = 7;
3110
+ return orderModule.getOrderInfo(tempOrder.order_id);
3111
+ case 7:
3112
+ res = _context38.sent;
3113
+ // 找到下单的时候输入的 entryPaxNumber
3114
+ 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) {
3115
+ var _p$metadata;
3116
+ return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
3117
+ })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
3118
+ if (!entryPaxNumber) {
3119
+ _context38.next = 12;
3120
+ break;
3121
+ }
3122
+ _context38.next = 12;
3123
+ return this.setEntryPaxNumber(entryPaxNumber);
3124
+ case 12:
3125
+ case "end":
3126
+ return _context38.stop();
3127
+ }
3128
+ }, _callee38, this);
3129
+ }));
3130
+ function restorePreviousOrderData() {
3131
+ return _restorePreviousOrderData.apply(this, arguments);
3132
+ }
3133
+ return restorePreviousOrderData;
2847
3134
  }() // 如果是加单的情况,提供返回当前订单相关信息的能力
2848
3135
  }, {
2849
3136
  key: "getAdditionalOrderInfo",
2850
3137
  value: function () {
2851
- var _getAdditionalOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3138
+ var _getAdditionalOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
2852
3139
  var result;
2853
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2854
- while (1) switch (_context37.prev = _context37.next) {
3140
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3141
+ while (1) switch (_context39.prev = _context39.next) {
2855
3142
  case 0:
2856
3143
  this.logMethodStart('getAdditionalOrderInfo');
2857
3144
  result = {
@@ -2865,12 +3152,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2865
3152
  orderId: result.orderId,
2866
3153
  orderStatus: result.orderStatus
2867
3154
  });
2868
- return _context37.abrupt("return", result);
3155
+ return _context39.abrupt("return", result);
2869
3156
  case 4:
2870
3157
  case "end":
2871
- return _context37.stop();
3158
+ return _context39.stop();
2872
3159
  }
2873
- }, _callee37, this);
3160
+ }, _callee39, this);
2874
3161
  }));
2875
3162
  function getAdditionalOrderInfo() {
2876
3163
  return _getAdditionalOrderInfo.apply(this, arguments);
@@ -2880,33 +3167,34 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2880
3167
  }, {
2881
3168
  key: "getProductList",
2882
3169
  value: function () {
2883
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2884
- var _this$otherParams15;
2885
- var menu_list_ids, res, productList, formattedRes;
2886
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2887
- while (1) switch (_context38.prev = _context38.next) {
3170
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3171
+ var _this$otherParams19;
3172
+ var associatedMenus, menu_list_ids, res, productList, formattedRes;
3173
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3174
+ while (1) switch (_context40.prev = _context40.next) {
2888
3175
  case 0:
2889
3176
  this.logMethodStart('getProductList');
2890
3177
  // 可以直接通过配置里的 menu 读取
2891
- menu_list_ids = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 || (_this$otherParams15 = _this$otherParams15.dineInConfig) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15['menu.associated_menus'].map(function (n) {
3178
+ associatedMenus = (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 || (_this$otherParams19 = _this$otherParams19.dineInConfig) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19['menu.associated_menus'];
3179
+ menu_list_ids = associatedMenus.map(function (n) {
2892
3180
  return Number(n.value);
2893
- })) || [];
2894
- _context38.prev = 2;
3181
+ }) || [];
3182
+ _context40.prev = 3;
2895
3183
  if (this.store.products) {
2896
- _context38.next = 5;
3184
+ _context40.next = 6;
2897
3185
  break;
2898
3186
  }
2899
3187
  throw new Error('products 模块未初始化');
2900
- case 5:
2901
- _context38.next = 7;
3188
+ case 6:
3189
+ _context40.next = 8;
2902
3190
  return this.store.products.loadProducts({
2903
3191
  menu_list_ids: menu_list_ids,
2904
3192
  cacheId: this.cacheId,
2905
3193
  schedule_date: dayjs().format('YYYY-MM-DD'),
2906
3194
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2907
3195
  });
2908
- case 7:
2909
- res = _context38.sent;
3196
+ case 8:
3197
+ res = _context40.sent;
2910
3198
  productList = this.assertProductListLoaded('getProductList', res, {
2911
3199
  menu_list_ids: menu_list_ids,
2912
3200
  cacheId: this.cacheId
@@ -2915,22 +3203,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2915
3203
  this.logMethodSuccess('getProductList', {
2916
3204
  menuCount: menu_list_ids.length
2917
3205
  });
2918
- return _context38.abrupt("return", formattedRes);
2919
- case 14:
2920
- _context38.prev = 14;
2921
- _context38.t0 = _context38["catch"](2);
2922
- if (!(_context38.t0 !== null && _context38.t0 !== void 0 && _context38.t0.__scanOrderLogged)) {
2923
- this.logMethodError('getProductList', _context38.t0, {
3206
+ return _context40.abrupt("return", formattedRes);
3207
+ case 15:
3208
+ _context40.prev = 15;
3209
+ _context40.t0 = _context40["catch"](3);
3210
+ if (!(_context40.t0 !== null && _context40.t0 !== void 0 && _context40.t0.__scanOrderLogged)) {
3211
+ this.logMethodError('getProductList', _context40.t0, {
2924
3212
  menu_list_ids: menu_list_ids,
2925
3213
  cacheId: this.cacheId
2926
3214
  });
2927
3215
  }
2928
- throw _context38.t0;
2929
- case 18:
3216
+ throw _context40.t0;
3217
+ case 19:
2930
3218
  case "end":
2931
- return _context38.stop();
3219
+ return _context40.stop();
2932
3220
  }
2933
- }, _callee38, this, [[2, 14]]);
3221
+ }, _callee40, this, [[3, 15]]);
2934
3222
  }));
2935
3223
  function getProductList() {
2936
3224
  return _getProductList.apply(this, arguments);
@@ -2945,15 +3233,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2945
3233
  }, {
2946
3234
  key: "setOtherParams",
2947
3235
  value: function () {
2948
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
3236
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
2949
3237
  var _ref8,
2950
3238
  _ref8$cover,
2951
3239
  cover,
2952
- _args39 = arguments;
2953
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2954
- while (1) switch (_context39.prev = _context39.next) {
3240
+ _args41 = arguments;
3241
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3242
+ while (1) switch (_context41.prev = _context41.next) {
2955
3243
  case 0:
2956
- _ref8 = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
3244
+ _ref8 = _args41.length > 1 && _args41[1] !== undefined ? _args41[1] : {}, _ref8$cover = _ref8.cover, cover = _ref8$cover === void 0 ? false : _ref8$cover;
2957
3245
  if (cover) {
2958
3246
  this.otherParams = params;
2959
3247
  } else {
@@ -2961,11 +3249,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2961
3249
  }
2962
3250
  case 2:
2963
3251
  case "end":
2964
- return _context39.stop();
3252
+ return _context41.stop();
2965
3253
  }
2966
- }, _callee39, this);
3254
+ }, _callee41, this);
2967
3255
  }));
2968
- function setOtherParams(_x20) {
3256
+ function setOtherParams(_x21) {
2969
3257
  return _setOtherParams.apply(this, arguments);
2970
3258
  }
2971
3259
  return setOtherParams;
@@ -3055,10 +3343,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3055
3343
  }, {
3056
3344
  key: "setEntryPaxNumber",
3057
3345
  value: function () {
3058
- var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(number) {
3346
+ var _setEntryPaxNumber = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(number) {
3059
3347
  var pax, t;
3060
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3061
- while (1) switch (_context40.prev = _context40.next) {
3348
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3349
+ while (1) switch (_context42.prev = _context42.next) {
3062
3350
  case 0:
3063
3351
  pax = normalizeSubmitCollectPaxValue(number);
3064
3352
  this.store.entryPaxNumber = pax;
@@ -3079,18 +3367,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3079
3367
  }
3080
3368
  });
3081
3369
  this.itemRulePrefillApplied = false;
3082
- _context40.next = 7;
3370
+ _context42.next = 7;
3083
3371
  return this.refreshItemRuleQuantityLimits();
3084
3372
  case 7:
3085
- _context40.next = 9;
3373
+ _context42.next = 9;
3086
3374
  return this.refreshCartValidationPassed();
3087
3375
  case 9:
3088
3376
  case "end":
3089
- return _context40.stop();
3377
+ return _context42.stop();
3090
3378
  }
3091
- }, _callee40, this);
3379
+ }, _callee42, this);
3092
3380
  }));
3093
- function setEntryPaxNumber(_x21) {
3381
+ function setEntryPaxNumber(_x22) {
3094
3382
  return _setEntryPaxNumber.apply(this, arguments);
3095
3383
  }
3096
3384
  return setEntryPaxNumber;
@@ -3100,15 +3388,119 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3100
3388
  value: function getEntryPaxNumber() {
3101
3389
  return this.store.entryPaxNumber;
3102
3390
  }
3391
+ }, {
3392
+ key: "syncAdditionalOrderFromResource",
3393
+ value: function () {
3394
+ var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
3395
+ var _ref9, _ref10, _ref11, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams20, _this$store$order8;
3396
+ var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
3397
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3398
+ while (1) switch (_context43.prev = _context43.next) {
3399
+ case 0:
3400
+ if (this.store.order) {
3401
+ _context43.next = 2;
3402
+ break;
3403
+ }
3404
+ throw new Error('order 模块未初始化');
3405
+ case 2:
3406
+ tempOrder = this.store.order.ensureTempOrder();
3407
+ normalizedResourceId = String((_ref9 = (_ref10 = (_ref11 = resourceId !== null && resourceId !== void 0 ? resourceId : tempOrder.resource_id) !== null && _ref11 !== void 0 ? _ref11 : (_this$store$resource5 = this.store.resource) === null || _this$store$resource5 === void 0 ? void 0 : _this$store$resource5.relationId) !== null && _ref10 !== void 0 ? _ref10 : (_this$store$resource6 = this.store.resource) === null || _this$store$resource6 === void 0 ? void 0 : _this$store$resource6.relation_id) !== null && _ref9 !== void 0 ? _ref9 : '').trim();
3408
+ this.logMethodStart('syncAdditionalOrderFromResource', {
3409
+ resourceId: normalizedResourceId
3410
+ });
3411
+ if (normalizedResourceId) {
3412
+ _context43.next = 9;
3413
+ break;
3414
+ }
3415
+ _result = {
3416
+ matched: false,
3417
+ reason: 'missing_resource_id'
3418
+ };
3419
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _result);
3420
+ return _context43.abrupt("return", _result);
3421
+ case 9:
3422
+ _context43.next = 11;
3423
+ return this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
3424
+ case 11:
3425
+ occupyDetails = _context43.sent;
3426
+ occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
3427
+ resourceSelectType = ((_this$store$resource7 = this.store.resource) === null || _this$store$resource7 === void 0 ? void 0 : _this$store$resource7.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
3428
+ allowAddItems = toBoolean((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 || (_this$otherParams20 = _this$otherParams20.dineInConfig) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20['sale.allow_add_items']);
3429
+ result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
3430
+ if (!(!result.matched || !result.order_id)) {
3431
+ _context43.next = 19;
3432
+ break;
3433
+ }
3434
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
3435
+ resourceId: normalizedResourceId,
3436
+ resourceSelectType: resourceSelectType,
3437
+ allowAddItems: allowAddItems
3438
+ }));
3439
+ return _context43.abrupt("return", result);
3440
+ case 19:
3441
+ tempOrder.order_id = result.order_id;
3442
+ tempOrder.resource_id = normalizedResourceId;
3443
+ tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
3444
+ tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
3445
+ (_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
3446
+ this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
3447
+ resourceId: normalizedResourceId,
3448
+ resourceSelectType: resourceSelectType,
3449
+ allowAddItems: allowAddItems
3450
+ }));
3451
+ return _context43.abrupt("return", result);
3452
+ case 26:
3453
+ case "end":
3454
+ return _context43.stop();
3455
+ }
3456
+ }, _callee43, this);
3457
+ }));
3458
+ function syncAdditionalOrderFromResource(_x23) {
3459
+ return _syncAdditionalOrderFromResource.apply(this, arguments);
3460
+ }
3461
+ return syncAdditionalOrderFromResource;
3462
+ }() // 读取预约规则商品的资源选择类型:single=单个预约,multiple=多个预约,capacity=容量型预约
3463
+ // 依赖 checkResourceAvailable 已根据预约规则商品与 occupy-detail 的 form_id 计算并缓存 store.resource
3464
+ }, {
3465
+ key: "getReservationResourceSelectType",
3466
+ value: function getReservationResourceSelectType() {
3467
+ var _this$store$resource8;
3468
+ this.logMethodStart('getReservationResourceSelectType');
3469
+ var resourceSelectType = (_this$store$resource8 = this.store.resource) === null || _this$store$resource8 === void 0 ? void 0 : _this$store$resource8.resourceSelectType;
3470
+ var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
3471
+ resourceSelectType: resourceSelectType
3472
+ } : {}), {}, {
3473
+ isSingleReservation: resourceSelectType === 'single',
3474
+ isMultipleReservation: resourceSelectType === 'multiple',
3475
+ isCapacityReservation: resourceSelectType === 'capacity'
3476
+ });
3477
+ this.logMethodSuccess('getReservationResourceSelectType', result);
3478
+ return result;
3479
+ }
3480
+
3481
+ // 判定后台是否开启允许加餐
3482
+ // 依赖 checkResourceAvailable 已缓存的 dineInConfig
3483
+ }, {
3484
+ key: "checkAllowAddItems",
3485
+ value: function checkAllowAddItems() {
3486
+ var _this$otherParams21;
3487
+ this.logMethodStart('checkAllowAddItems');
3488
+ var dineInConfig = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.dineInConfig) || {};
3489
+ var result = {
3490
+ enabled: toBoolean(dineInConfig['sale.allow_add_items'])
3491
+ };
3492
+ this.logMethodSuccess('checkAllowAddItems', result);
3493
+ return result;
3494
+ }
3103
3495
 
3104
3496
  // 读取取餐/送餐开关
3105
3497
  // 依赖 checkResourceAvailable 已缓存的 dineInConfig
3106
3498
  }, {
3107
3499
  key: "getFulfillmentModes",
3108
3500
  value: function getFulfillmentModes() {
3109
- var _this$otherParams16;
3501
+ var _this$otherParams22;
3110
3502
  this.logMethodStart('getFulfillmentModes');
3111
- var dineInConfig = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.dineInConfig) || {};
3503
+ var dineInConfig = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.dineInConfig) || {};
3112
3504
  var result = {
3113
3505
  enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
3114
3506
  enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
@@ -3122,9 +3514,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3122
3514
  }, {
3123
3515
  key: "checkManualPickupRef",
3124
3516
  value: function checkManualPickupRef() {
3125
- var _this$otherParams17;
3517
+ var _this$otherParams23;
3126
3518
  this.logMethodStart('checkManualPickupRef');
3127
- var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
3519
+ var dineInConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.dineInConfig) || {};
3128
3520
  var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
3129
3521
  var manualInputType = dineInConfig['fulfillment.manual_input_type'];
3130
3522
  var enabled = refMode === 'manual_input';
@@ -3142,6 +3534,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3142
3534
  }
3143
3535
  }]);
3144
3536
  return ScanOrderImpl;
3145
- }(BaseModule);
3537
+ }(BaseSalesImpl);
3146
3538
  _defineProperty(ScanOrderImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
3147
3539
  _defineProperty(ScanOrderImpl, "UI_STATE_KEY_PREFIX", 'pisell.scanOrder.uiState:');