@pisell/pisellos 2.3.40 → 2.3.42

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 (230) hide show
  1. package/dist/core/index.d.ts +2 -0
  2. package/dist/core/index.js +7 -0
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -3
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -3
  15. package/dist/modules/Discount/index.d.ts +0 -1
  16. package/dist/modules/Discount/index.js +11 -40
  17. package/dist/modules/Discount/types.d.ts +0 -1
  18. package/dist/modules/OpenData/index.d.ts +2 -0
  19. package/dist/modules/OpenData/index.js +10 -2
  20. package/dist/modules/Order/index.d.ts +29 -12
  21. package/dist/modules/Order/index.js +751 -510
  22. package/dist/modules/Order/payment-utils.d.ts +26 -0
  23. package/dist/modules/Order/payment-utils.js +225 -0
  24. package/dist/modules/Order/types.d.ts +33 -10
  25. package/dist/modules/Order/utils/orderCollectionIdentity.js +7 -2
  26. package/dist/modules/Order/utils.d.ts +0 -10
  27. package/dist/modules/Order/utils.js +13 -41
  28. package/dist/modules/Payment/index.d.ts +2 -0
  29. package/dist/modules/Payment/index.js +79 -50
  30. package/dist/modules/Payment/types.d.ts +99 -28
  31. package/dist/modules/Payment/types.js +20 -3
  32. package/dist/modules/Payment/walletpass.d.ts +25 -1
  33. package/dist/modules/Payment/walletpass.js +707 -157
  34. package/dist/modules/Product/types.d.ts +0 -1
  35. package/dist/modules/ProductList/index.js +14 -33
  36. package/dist/modules/Quotation/index.d.ts +1 -1
  37. package/dist/modules/Quotation/index.js +2 -2
  38. package/dist/modules/Rules/index.d.ts +1 -0
  39. package/dist/modules/Rules/index.js +89 -96
  40. package/dist/modules/SalesSummary/index.js +13 -12
  41. package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
  42. package/dist/modules/ScanOrderLogger/index.js +2 -15
  43. package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
  44. package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
  45. package/dist/modules/Schedule/index.d.ts +1 -3
  46. package/dist/modules/Schedule/index.js +16 -21
  47. package/dist/modules/Summary/utils.js +13 -38
  48. package/dist/modules/index.d.ts +0 -2
  49. package/dist/modules/index.js +1 -3
  50. package/dist/plugins/window.d.ts +0 -1
  51. package/dist/server/index.d.ts +16 -14
  52. package/dist/server/index.js +1925 -1143
  53. package/dist/server/modules/order/index.d.ts +54 -4
  54. package/dist/server/modules/order/index.js +1600 -700
  55. package/dist/server/modules/order/types.d.ts +11 -3
  56. package/dist/server/modules/order/types.js +1 -1
  57. package/dist/solution/BaseSales/index.d.ts +109 -20
  58. package/dist/solution/BaseSales/index.js +1800 -480
  59. package/dist/solution/BaseSales/types.d.ts +52 -0
  60. package/dist/solution/BaseSales/types.js +2 -1
  61. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +90 -31
  63. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  64. package/dist/solution/BookingByStep/index.d.ts +2 -17
  65. package/dist/solution/BookingByStep/index.js +215 -294
  66. package/dist/solution/BookingByStep/types.d.ts +1 -2
  67. package/dist/solution/BookingByStep/types.js +1 -3
  68. package/dist/solution/BookingByStep/utils/capacity.js +1 -17
  69. package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  70. package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
  71. package/dist/solution/BookingTicket/index.d.ts +8 -4
  72. package/dist/solution/BookingTicket/index.js +134 -51
  73. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -0
  74. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  75. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +172 -82
  76. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  77. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
  78. package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  79. package/dist/solution/BookingTicket/utils/weighingProductSku.js +45 -0
  80. package/dist/solution/Sales/index.d.ts +1 -0
  81. package/dist/solution/Sales/index.js +10 -2
  82. package/dist/solution/ScanOrder/index.d.ts +14 -26
  83. package/dist/solution/ScanOrder/index.js +756 -1148
  84. package/dist/solution/ScanOrder/types.d.ts +1 -21
  85. package/dist/solution/ScanOrder/utils.d.ts +0 -8
  86. package/dist/solution/ScanOrder/utils.js +25 -66
  87. package/dist/solution/ShopDiscount/index.d.ts +0 -1
  88. package/dist/solution/ShopDiscount/index.js +87 -125
  89. package/dist/solution/VenueBooking/index.d.ts +11 -39
  90. package/dist/solution/VenueBooking/index.js +860 -1176
  91. package/dist/solution/VenueBooking/types.d.ts +0 -3
  92. package/dist/solution/VenueBooking/utils/resource.js +0 -1
  93. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  94. package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
  95. package/dist/solution/index.d.ts +0 -1
  96. package/dist/solution/index.js +1 -2
  97. package/dist/types/index.d.ts +1 -1
  98. package/dist/utils/payment-number.d.ts +9 -0
  99. package/dist/utils/payment-number.js +69 -0
  100. package/lib/core/index.d.ts +2 -0
  101. package/lib/core/index.js +4 -0
  102. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  103. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  104. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  105. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  106. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  107. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  108. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  109. package/lib/model/strategy/adapter/promotion/index.js +2 -0
  110. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  111. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  112. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +2 -1
  113. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
  114. package/lib/modules/Discount/index.d.ts +0 -1
  115. package/lib/modules/Discount/index.js +0 -9
  116. package/lib/modules/Discount/types.d.ts +0 -1
  117. package/lib/modules/OpenData/index.d.ts +2 -0
  118. package/lib/modules/OpenData/index.js +6 -1
  119. package/lib/modules/Order/index.d.ts +29 -12
  120. package/lib/modules/Order/index.js +197 -87
  121. package/lib/modules/Order/payment-utils.d.ts +26 -0
  122. package/lib/modules/Order/payment-utils.js +224 -0
  123. package/lib/modules/Order/types.d.ts +33 -10
  124. package/lib/modules/Order/utils/orderCollectionIdentity.js +3 -0
  125. package/lib/modules/Order/utils.d.ts +0 -10
  126. package/lib/modules/Order/utils.js +16 -40
  127. package/lib/modules/Payment/index.d.ts +2 -0
  128. package/lib/modules/Payment/index.js +34 -13
  129. package/lib/modules/Payment/types.d.ts +99 -28
  130. package/lib/modules/Payment/types.js +4 -3
  131. package/lib/modules/Payment/walletpass.d.ts +25 -1
  132. package/lib/modules/Payment/walletpass.js +470 -21
  133. package/lib/modules/Product/types.d.ts +0 -1
  134. package/lib/modules/ProductList/index.js +31 -40
  135. package/lib/modules/Quotation/index.d.ts +1 -1
  136. package/lib/modules/Quotation/index.js +2 -2
  137. package/lib/modules/Rules/index.d.ts +1 -0
  138. package/lib/modules/Rules/index.js +47 -40
  139. package/lib/modules/SalesSummary/index.js +7 -6
  140. package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
  141. package/lib/modules/ScanOrderLogger/index.js +1 -13
  142. package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
  143. package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
  144. package/lib/modules/Schedule/index.d.ts +1 -3
  145. package/lib/modules/Schedule/index.js +8 -10
  146. package/lib/modules/Summary/utils.js +1 -21
  147. package/lib/modules/index.d.ts +0 -2
  148. package/lib/modules/index.js +1 -5
  149. package/lib/plugins/window.d.ts +0 -1
  150. package/lib/server/index.d.ts +16 -14
  151. package/lib/server/index.js +675 -83
  152. package/lib/server/modules/order/index.d.ts +54 -4
  153. package/lib/server/modules/order/index.js +679 -66
  154. package/lib/server/modules/order/types.d.ts +11 -3
  155. package/lib/solution/BaseSales/index.d.ts +109 -20
  156. package/lib/solution/BaseSales/index.js +883 -70
  157. package/lib/solution/BaseSales/types.d.ts +52 -0
  158. package/lib/solution/BaseSales/types.js +2 -1
  159. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  160. package/lib/solution/BaseSales/utils/cartPromotion.js +63 -12
  161. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +6 -1
  162. package/lib/solution/BookingByStep/index.d.ts +2 -17
  163. package/lib/solution/BookingByStep/index.js +18 -60
  164. package/lib/solution/BookingByStep/types.d.ts +1 -2
  165. package/lib/solution/BookingByStep/types.js +0 -5
  166. package/lib/solution/BookingByStep/utils/capacity.js +1 -20
  167. package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
  168. package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
  169. package/lib/solution/BookingTicket/index.d.ts +8 -4
  170. package/lib/solution/BookingTicket/index.js +64 -19
  171. package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -0
  172. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +8 -0
  173. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +36 -4
  174. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
  175. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  176. package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
  177. package/lib/solution/BookingTicket/utils/weighingProductSku.js +63 -0
  178. package/lib/solution/Sales/index.d.ts +1 -0
  179. package/lib/solution/Sales/index.js +5 -3
  180. package/lib/solution/ScanOrder/index.d.ts +14 -26
  181. package/lib/solution/ScanOrder/index.js +190 -449
  182. package/lib/solution/ScanOrder/types.d.ts +1 -21
  183. package/lib/solution/ScanOrder/utils.d.ts +0 -8
  184. package/lib/solution/ScanOrder/utils.js +0 -31
  185. package/lib/solution/ShopDiscount/index.d.ts +0 -1
  186. package/lib/solution/ShopDiscount/index.js +0 -14
  187. package/lib/solution/VenueBooking/index.d.ts +11 -39
  188. package/lib/solution/VenueBooking/index.js +123 -328
  189. package/lib/solution/VenueBooking/types.d.ts +0 -3
  190. package/lib/solution/VenueBooking/utils/resource.js +0 -1
  191. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  192. package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
  193. package/lib/solution/index.d.ts +0 -1
  194. package/lib/solution/index.js +1 -3
  195. package/lib/types/index.d.ts +1 -1
  196. package/lib/utils/payment-number.d.ts +9 -0
  197. package/lib/utils/payment-number.js +64 -0
  198. package/package.json +1 -1
  199. package/dist/modules/Holder/index.d.ts +0 -48
  200. package/dist/modules/Holder/index.js +0 -640
  201. package/dist/modules/Holder/types.d.ts +0 -123
  202. package/dist/modules/Holder/types.js +0 -1
  203. package/dist/modules/Holder/utils.d.ts +0 -13
  204. package/dist/modules/Holder/utils.js +0 -34
  205. package/dist/modules/ResourcePlanner/index.d.ts +0 -24
  206. package/dist/modules/ResourcePlanner/index.js +0 -181
  207. package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
  208. package/dist/modules/ResourcePlanner/planner.js +0 -1069
  209. package/dist/modules/ResourcePlanner/types.d.ts +0 -227
  210. package/dist/modules/ResourcePlanner/types.js +0 -1
  211. package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
  212. package/dist/solution/UnifiedBookingSales/index.js +0 -1871
  213. package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
  214. package/dist/solution/UnifiedBookingSales/types.js +0 -11
  215. package/lib/modules/Holder/index.d.ts +0 -48
  216. package/lib/modules/Holder/index.js +0 -402
  217. package/lib/modules/Holder/types.d.ts +0 -123
  218. package/lib/modules/Holder/types.js +0 -17
  219. package/lib/modules/Holder/utils.d.ts +0 -13
  220. package/lib/modules/Holder/utils.js +0 -71
  221. package/lib/modules/ResourcePlanner/index.d.ts +0 -24
  222. package/lib/modules/ResourcePlanner/index.js +0 -148
  223. package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
  224. package/lib/modules/ResourcePlanner/planner.js +0 -933
  225. package/lib/modules/ResourcePlanner/types.d.ts +0 -227
  226. package/lib/modules/ResourcePlanner/types.js +0 -17
  227. package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
  228. package/lib/solution/UnifiedBookingSales/index.js +0 -1076
  229. package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
  230. package/lib/solution/UnifiedBookingSales/types.js +0 -33
@@ -1,16 +1,14 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
3
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
5
4
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
6
6
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
7
7
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
8
8
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
9
9
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
11
11
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
12
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
13
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
14
12
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
15
13
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16
14
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -30,7 +28,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
30
28
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
31
29
  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); }
32
30
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
33
- import { BaseSalesImpl } from "../BaseSales";
31
+ import { BaseModule } from "../../modules/BaseModule";
34
32
  import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
35
33
  import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
36
34
  import { createModule } from "../BookingByStep/types";
@@ -51,10 +49,12 @@ import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPric
51
49
  import { OrderModule } from "../../modules/Order";
52
50
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
53
51
  import Decimal from 'decimal.js';
54
- import { HolderModule } from "../../modules/Holder";
55
- import { getFormIdFromHolderConfig, getProductHolderConfig } from "../../modules/Holder/utils";
56
52
  export * from "./types";
57
53
  var OPEN_DATA_SECTION_CODES = ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow', 'checkout'];
54
+ function isItemRewardProductDiscount(discount) {
55
+ var _discount$metadata, _discount$metadata2;
56
+ 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';
57
+ }
58
58
  function cloneCustomDepositData(customDepositData) {
59
59
  if (!customDepositData || _typeof(customDepositData) !== 'object') return undefined;
60
60
  return _objectSpread(_objectSpread({}, customDepositData), {}, {
@@ -63,8 +63,8 @@ function cloneCustomDepositData(customDepositData) {
63
63
  deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? _toConsumableArray(customDepositData.deposit_policy_data) : []
64
64
  });
65
65
  }
66
- export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
67
- _inherits(VenueBookingImpl, _BaseSalesImpl);
66
+ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
67
+ _inherits(VenueBookingImpl, _BaseModule);
68
68
  var _super = _createSuper(VenueBookingImpl);
69
69
  function VenueBookingImpl(name, version) {
70
70
  var _this;
@@ -273,76 +273,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
273
273
  }
274
274
  return addLog;
275
275
  }()
276
- }, {
277
- key: "getRegisteredModuleNames",
278
- value: function getRegisteredModuleNames() {
279
- return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
280
- }
281
- }, {
282
- key: "createSubModule",
283
- value: function createSubModule(moduleName) {
284
- switch (moduleName) {
285
- case 'scanOrderLogger':
286
- return createModule('scanOrderLogger', this.name);
287
- case 'venueProducts':
288
- return new ProductList("".concat(this.name, "_venueProducts"));
289
- case 'addonProducts':
290
- return new ProductList("".concat(this.name, "_addonProducts"));
291
- case 'date':
292
- return new DateModule("".concat(this.name, "_date"));
293
- case 'openData':
294
- return new OpenDataModule("".concat(this.name, "_openData"));
295
- default:
296
- return _get(_getPrototypeOf(VenueBookingImpl.prototype), "createSubModule", this).call(this, moduleName);
297
- }
298
- }
299
- }, {
300
- key: "attachProductOriginToTempOrder",
301
- value: function attachProductOriginToTempOrder(tempOrder, productUid, origin) {
302
- var _tempOrder$_extend, _tempOrder$_extend2;
303
- if (!productUid || !origin) return;
304
- tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
305
- productsByUid: _objectSpread(_objectSpread({}, ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid) || {}), {}, _defineProperty({}, productUid, _objectSpread(_objectSpread({}, ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2[productUid]) || {}), {}, {
306
- origin: origin
307
- })))
308
- });
309
- }
310
- }, {
311
- key: "readProductOriginFromTempOrder",
312
- value: function readProductOriginFromTempOrder(tempOrder, product) {
313
- var _product$metadata, _tempOrder$_extend3;
314
- var uid = ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.identity_key;
315
- if (uid && (_tempOrder$_extend3 = tempOrder._extend) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3[uid]) !== null && _tempOrder$_extend3 !== void 0 && _tempOrder$_extend3.origin) {
316
- return tempOrder._extend.productsByUid[uid].origin;
317
- }
318
- return product._origin;
319
- }
320
- }, {
321
- key: "normalizeVenueProductTitle",
322
- value: function normalizeVenueProductTitle(value) {
323
- if (typeof value === 'string') {
324
- var text = value.trim();
325
- return text ? {
326
- auto: text
327
- } : undefined;
328
- }
329
- if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return undefined;
330
- var source = value;
331
- var normalized = {};
332
- Object.entries(source).forEach(function (_ref) {
333
- var _ref2 = _slicedToArray(_ref, 2),
334
- key = _ref2[0],
335
- text = _ref2[1];
336
- if (typeof text === 'string') normalized[key] = text;
337
- });
338
- if (!normalized.auto) {
339
- var fallback = normalized.original || normalized.en || normalized['zh-CN'] || normalized['zh-HK'];
340
- if (fallback) normalized.auto = fallback;
341
- }
342
- return Object.values(normalized).some(function (text) {
343
- return String(text || '').trim();
344
- }) ? normalized : undefined;
345
- }
346
276
  }, {
347
277
  key: "normalizeCustomerId",
348
278
  value: function normalizeCustomerId(value) {
@@ -362,115 +292,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
362
292
  }
363
293
  return null;
364
294
  }
365
- }, {
366
- key: "resolveHolderCustomerId",
367
- value: function resolveHolderCustomerId() {
368
- var _this$window, _this$window$getLocal;
369
- var customer = JSON.parse(((_this$window = this.window) === null || _this$window === void 0 || (_this$window$getLocal = _this$window.getLocalStorage) === null || _this$window$getLocal === void 0 ? void 0 : _this$window$getLocal.call(_this$window, 'customer')) || '{}');
370
- if (customer !== null && customer !== void 0 && customer.id) return Number(customer.id);
371
- return undefined;
372
- }
373
-
374
- /**
375
- * 按商品 holder_config 预加载表单数据到 holderMap。
376
- * appointment_booking 在加购时触发;venueBooking 在商品加载后预加载,避免 getHolderFormMap 为空。
377
- */
378
- }, {
379
- key: "preloadHolderForms",
380
- value: (function () {
381
- var _preloadHolderForms = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(products) {
382
- var seenFormIds, _iterator, _step, _item$_origin, item, holderConfig, formId, _item$_origin2, _item$_origin3;
383
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
384
- while (1) switch (_context3.prev = _context3.next) {
385
- case 0:
386
- if (!(!this.store.holder || !products.length)) {
387
- _context3.next = 2;
388
- break;
389
- }
390
- return _context3.abrupt("return");
391
- case 2:
392
- seenFormIds = new Set();
393
- _iterator = _createForOfIteratorHelper(products);
394
- _context3.prev = 4;
395
- _iterator.s();
396
- case 6:
397
- if ((_step = _iterator.n()).done) {
398
- _context3.next = 25;
399
- break;
400
- }
401
- item = _step.value;
402
- holderConfig = getProductHolderConfig(item === null || item === void 0 || (_item$_origin = item._origin) === null || _item$_origin === void 0 ? void 0 : _item$_origin.product);
403
- if (holderConfig) {
404
- _context3.next = 11;
405
- break;
406
- }
407
- return _context3.abrupt("continue", 23);
408
- case 11:
409
- formId = getFormIdFromHolderConfig(holderConfig);
410
- if (!seenFormIds.has(formId)) {
411
- _context3.next = 14;
412
- break;
413
- }
414
- return _context3.abrupt("continue", 23);
415
- case 14:
416
- seenFormIds.add(formId);
417
- _context3.prev = 15;
418
- _context3.next = 18;
419
- return this.store.holder.ensureFormByProduct({
420
- product: (item === null || item === void 0 || (_item$_origin2 = item._origin) === null || _item$_origin2 === void 0 ? void 0 : _item$_origin2.product) || {},
421
- customer_id: this.resolveHolderCustomerId(),
422
- shop_id: item === null || item === void 0 || (_item$_origin3 = item._origin) === null || _item$_origin3 === void 0 || (_item$_origin3 = _item$_origin3.product) === null || _item$_origin3 === void 0 ? void 0 : _item$_origin3.shop_id,
423
- useCache: true
424
- });
425
- case 18:
426
- _context3.next = 23;
427
- break;
428
- case 20:
429
- _context3.prev = 20;
430
- _context3.t0 = _context3["catch"](15);
431
- console.error('[VenueBooking] 预加载 holder 表单失败', {
432
- formId: formId,
433
- error: _context3.t0
434
- });
435
- case 23:
436
- _context3.next = 6;
437
- break;
438
- case 25:
439
- _context3.next = 30;
440
- break;
441
- case 27:
442
- _context3.prev = 27;
443
- _context3.t1 = _context3["catch"](4);
444
- _iterator.e(_context3.t1);
445
- case 30:
446
- _context3.prev = 30;
447
- _iterator.f();
448
- return _context3.finish(30);
449
- case 33:
450
- case "end":
451
- return _context3.stop();
452
- }
453
- }, _callee3, this, [[4, 27, 30, 33], [15, 20]]);
454
- }));
455
- function preloadHolderForms(_x3) {
456
- return _preloadHolderForms.apply(this, arguments);
457
- }
458
- return preloadHolderForms;
459
- }())
460
295
  }, {
461
296
  key: "clearLoginEffectListeners",
462
297
  value: function clearLoginEffectListeners() {
463
- var _iterator2 = _createForOfIteratorHelper(this.loginEffectDisposers),
464
- _step2;
298
+ var _iterator = _createForOfIteratorHelper(this.loginEffectDisposers),
299
+ _step;
465
300
  try {
466
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
467
- var dispose = _step2.value;
301
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
302
+ var dispose = _step.value;
468
303
  dispose();
469
304
  }
470
305
  } catch (err) {
471
- _iterator2.e(err);
306
+ _iterator.e(err);
472
307
  } finally {
473
- _iterator2.f();
308
+ _iterator.f();
474
309
  }
475
310
  this.loginEffectDisposers = [];
476
311
  }
@@ -501,30 +336,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
501
336
  var currentAccount = (accountModule === null || accountModule === void 0 || (_accountModule$getCur = accountModule.getCurrentAccount) === null || _accountModule$getCur === void 0 ? void 0 : _accountModule$getCur.call(accountModule)) || (accountModule === null || accountModule === void 0 || (_accountModule$getAcc = accountModule.getAccount) === null || _accountModule$getAcc === void 0 ? void 0 : _accountModule$getAcc.call(accountModule)) || null;
502
337
  var createHandleLogin = function createHandleLogin(eventName) {
503
338
  return /*#__PURE__*/function () {
504
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
339
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payload) {
505
340
  var customerId;
506
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
507
- while (1) switch (_context4.prev = _context4.next) {
341
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
342
+ while (1) switch (_context3.prev = _context3.next) {
508
343
  case 0:
509
344
  customerId = _this2.resolveCustomerIdFromLoginPayload(payload);
510
345
  if (customerId) {
511
- _context4.next = 3;
346
+ _context3.next = 3;
512
347
  break;
513
348
  }
514
- return _context4.abrupt("return");
349
+ return _context3.abrupt("return");
515
350
  case 3:
516
- _context4.next = 5;
351
+ _context3.next = 5;
517
352
  return _this2.refreshOrderMarketingAfterLogin({
518
353
  customerId: customerId
519
354
  });
520
355
  case 5:
521
356
  case "end":
522
- return _context4.stop();
357
+ return _context3.stop();
523
358
  }
524
- }, _callee4);
359
+ }, _callee3);
525
360
  }));
526
- return function (_x4) {
527
- return _ref3.apply(this, arguments);
361
+ return function (_x3) {
362
+ return _ref.apply(this, arguments);
528
363
  };
529
364
  }();
530
365
  };
@@ -534,107 +369,97 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
534
369
  }, {
535
370
  key: "refreshOrderMarketingAfterLogin",
536
371
  value: function () {
537
- var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
372
+ var _refreshOrderMarketingAfterLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
538
373
  var _this3 = this;
539
374
  var refreshTask;
540
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
541
- while (1) switch (_context6.prev = _context6.next) {
375
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
376
+ while (1) switch (_context5.prev = _context5.next) {
542
377
  case 0:
543
378
  if (this.store.order) {
544
- _context6.next = 2;
379
+ _context5.next = 2;
545
380
  break;
546
381
  }
547
382
  throw new Error('order 模块未初始化');
548
383
  case 2:
549
384
  if (!this.customerLoginRefreshInFlight) {
550
- _context6.next = 9;
385
+ _context5.next = 9;
551
386
  break;
552
387
  }
553
388
  if (!(this.customerLoginRefreshIdInFlight === params.customerId)) {
554
- _context6.next = 7;
389
+ _context5.next = 7;
555
390
  break;
556
391
  }
557
- _context6.next = 6;
392
+ _context5.next = 6;
558
393
  return this.customerLoginRefreshInFlight;
559
394
  case 6:
560
- return _context6.abrupt("return");
395
+ return _context5.abrupt("return");
561
396
  case 7:
562
- _context6.next = 9;
397
+ _context5.next = 9;
563
398
  return this.customerLoginRefreshInFlight;
564
399
  case 9:
565
400
  this.customerLoginRefreshIdInFlight = params.customerId;
566
- refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
401
+ refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
567
402
  var _this3$otherParams;
568
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
569
- while (1) switch (_context5.prev = _context5.next) {
403
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
404
+ while (1) switch (_context4.prev = _context4.next) {
570
405
  case 0:
571
- if (!_this3.store.holder) {
572
- _context5.next = 3;
573
- break;
574
- }
575
- _context5.next = 3;
576
- return _this3.store.holder.refreshAllFormRecords({
577
- customer_id: params.customerId,
578
- useCache: false
579
- });
580
- case 3:
581
406
  if (!_this3.store.quotation) {
582
- _context5.next = 6;
407
+ _context4.next = 3;
583
408
  break;
584
409
  }
585
- _context5.next = 6;
410
+ _context4.next = 3;
586
411
  return _this3.store.quotation.loadQuotations({
587
412
  channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
588
413
  });
589
- case 6:
414
+ case 3:
590
415
  _this3.recalculateOrderPricesFromQuotation();
591
- _context5.next = 9;
416
+ _context4.next = 6;
592
417
  return _this3.store.order.loadDiscountConfig({
593
418
  customerId: params.customerId
594
419
  });
595
- case 9:
596
- _context5.next = 11;
420
+ case 6:
421
+ _context4.next = 8;
597
422
  return _this3.store.order.recalculateSummary({
598
423
  createIfMissing: true
599
424
  });
600
- case 11:
425
+ case 8:
601
426
  _this3.store.order.persistTempOrder();
602
- _context5.next = 14;
427
+ _context4.next = 11;
603
428
  return _this3.refreshItemRuleQuantityLimits();
604
- case 14:
605
- _context5.next = 16;
429
+ case 11:
430
+ _context4.next = 13;
606
431
  return _this3.refreshCartValidationPassed();
607
- case 16:
432
+ case 13:
608
433
  case "end":
609
- return _context5.stop();
434
+ return _context4.stop();
610
435
  }
611
- }, _callee5);
436
+ }, _callee4);
612
437
  }))();
613
438
  this.customerLoginRefreshInFlight = refreshTask;
614
- _context6.prev = 12;
615
- _context6.next = 15;
439
+ _context5.prev = 12;
440
+ _context5.next = 15;
616
441
  return refreshTask;
617
442
  case 15:
618
- _context6.next = 20;
443
+ _context5.next = 20;
619
444
  break;
620
445
  case 17:
621
- _context6.prev = 17;
622
- _context6.t0 = _context6["catch"](12);
623
- throw _context6.t0;
446
+ _context5.prev = 17;
447
+ _context5.t0 = _context5["catch"](12);
448
+ throw _context5.t0;
624
449
  case 20:
625
- _context6.prev = 20;
450
+ _context5.prev = 20;
626
451
  if (this.customerLoginRefreshInFlight === refreshTask) {
627
452
  this.customerLoginRefreshInFlight = null;
628
453
  this.customerLoginRefreshIdInFlight = null;
629
454
  }
630
- return _context6.finish(20);
455
+ return _context5.finish(20);
631
456
  case 23:
632
457
  case "end":
633
- return _context6.stop();
458
+ return _context5.stop();
634
459
  }
635
- }, _callee6, this, [[12, 17, 20, 23]]);
460
+ }, _callee5, this, [[12, 17, 20, 23]]);
636
461
  }));
637
- function refreshOrderMarketingAfterLogin(_x5) {
462
+ function refreshOrderMarketingAfterLogin(_x4) {
638
463
  return _refreshOrderMarketingAfterLogin.apply(this, arguments);
639
464
  }
640
465
  return refreshOrderMarketingAfterLogin;
@@ -642,21 +467,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
642
467
  }, {
643
468
  key: "initialize",
644
469
  value: function () {
645
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(core) {
470
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(core) {
646
471
  var _options$otherParams,
647
472
  _options$otherParams2,
648
473
  _this$otherParams,
649
474
  _this$otherParams2,
650
475
  _this$otherParams3,
651
476
  _this4 = this,
652
- _this$otherParams6,
653
- _this$otherParams7,
654
- _this$otherParams8,
655
- _this$otherParams9,
656
- _this$otherParams10;
657
- var options,
658
477
  _this$otherParams4,
659
- _this$otherParams5,
478
+ _this$otherParams5;
479
+ var options,
660
480
  baseModules,
661
481
  venueProductsModule,
662
482
  addonProductsModule,
@@ -664,21 +484,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
664
484
  scheduleModule,
665
485
  quotationModule,
666
486
  openDataModule,
667
- holderCacheState,
668
- sessionData,
669
- _data$this$otherParam,
670
- data,
671
- holderModule,
672
487
  _this$store$order,
673
488
  _this$store$order2,
674
489
  _this$store$quotation,
675
- _this$otherParams11,
676
- _args7 = arguments;
677
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
678
- while (1) switch (_context7.prev = _context7.next) {
490
+ _this$otherParams6,
491
+ _args6 = arguments;
492
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
493
+ while (1) switch (_context6.prev = _context6.next) {
679
494
  case 0:
680
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
495
+ options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
681
496
  this.logMethodStart('initialize');
497
+ this.core = core;
498
+ this.initializeOptions = options || {};
682
499
  this.store = _objectSpread(_objectSpread({}, this.store), options.store);
683
500
  this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
684
501
  this.store.status = 'initializing';
@@ -697,19 +514,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
697
514
  passed: null,
698
515
  failures: []
699
516
  };
700
- _context7.next = 19;
701
- return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
702
- case 19:
703
- if (this.store.scanOrderLogger) {
704
- this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
705
- this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
706
- feishu: {
707
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
708
- errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
709
- }
710
- });
711
- this.store.scanOrderLogger.setContext(this.getLoggerContext());
517
+ this.window = core.getPlugin('window');
518
+ this.request = core.getPlugin('request');
519
+ if (this.window) {
520
+ _context6.next = 24;
521
+ break;
522
+ }
523
+ this.logMethodError('initialize', 'window plugin missing');
524
+ throw new Error('venueBooking解决方案需要 window 插件支持');
525
+ case 24:
526
+ if (this.request) {
527
+ _context6.next = 27;
528
+ break;
712
529
  }
530
+ this.logMethodError('initialize', 'request plugin missing');
531
+ throw new Error('venueBooking解决方案需要 request 插件支持');
532
+ case 27:
713
533
  // 注册基础模块(order, salesSummary, products, logger)
714
534
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
715
535
  baseModules.forEach(function (step) {
@@ -722,10 +542,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
722
542
  } : {};
723
543
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
724
544
  var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
725
- // feishu: {
726
- // webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
727
- // errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
728
- // },
545
+ feishu: {
546
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
547
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
548
+ }
729
549
  };
730
550
  _this4.core.registerModule(targetModule, {
731
551
  initialState: initialState,
@@ -797,87 +617,69 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
797
617
  this.core.registerModule(openDataModule, {
798
618
  otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
799
619
  fatherModule: this.name,
800
- openCache: !!((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId),
801
- cacheId: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.cacheId
620
+ openCache: !!((_this$otherParams4 = this.otherParams) !== null && _this$otherParams4 !== void 0 && _this$otherParams4.cacheId),
621
+ cacheId: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.cacheId
802
622
  })
803
623
  });
804
- if ((_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.cacheId) {
805
- sessionData = this.window.sessionStorage.getItem(this.name);
806
- if (sessionData) {
807
- try {
808
- data = JSON.parse(sessionData);
809
- holderCacheState = (_data$this$otherParam = data[this.otherParams.cacheId]) === null || _data$this$otherParam === void 0 ? void 0 : _data$this$otherParam["".concat(this.name, "_holder")];
810
- } catch (_unused2) {
811
- // ignore invalid session cache
812
- }
813
- }
624
+ if (this.store.scanOrderLogger) {
625
+ this.store.scanOrderLogger.setContext(this.getLoggerContext());
814
626
  }
815
- holderModule = new HolderModule("".concat(this.name, "_holder"));
816
- this.store.holder = holderModule;
817
- this.core.registerModule(holderModule, {
818
- initialState: holderCacheState,
819
- otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
820
- fatherModule: this.name,
821
- openCache: !!((_this$otherParams9 = this.otherParams) !== null && _this$otherParams9 !== void 0 && _this$otherParams9.cacheId),
822
- cacheId: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId
823
- })
824
- });
825
627
  this.registerCustomerLoginListeners();
826
628
  console.log('[VenueBooking] 初始化开始');
827
- _context7.prev = 46;
828
- _context7.next = 49;
629
+ _context6.prev = 50;
630
+ _context6.next = 53;
829
631
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
830
632
  createIfMissing: false
831
633
  });
832
- case 49:
634
+ case 53:
833
635
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
834
- _context7.next = 52;
636
+ _context6.next = 56;
835
637
  return this.loadRuntimeConfigs();
836
- case 52:
638
+ case 56:
837
639
  if (!this.store.schedule) {
838
- _context7.next = 57;
640
+ _context6.next = 61;
839
641
  break;
840
642
  }
841
- _context7.next = 55;
643
+ _context6.next = 59;
842
644
  return this.store.schedule.loadAllSchedule();
843
- case 55:
645
+ case 59:
844
646
  this.injectScheduleResolverToQuotation();
845
647
  (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
846
- channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel
648
+ channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel
847
649
  });
848
- case 57:
849
- _context7.next = 59;
650
+ case 61:
651
+ _context6.next = 63;
850
652
  return this.refreshItemRuleQuantityLimits();
851
- case 59:
653
+ case 63:
852
654
  this.store.status = 'ready';
853
655
  console.log('[VenueBooking] 初始化完成');
854
- _context7.next = 63;
656
+ _context6.next = 67;
855
657
  return this.core.effects.emit(VenueBookingHooks.onInited, {
856
658
  status: this.store.status
857
659
  });
858
- case 63:
660
+ case 67:
859
661
  this.logMethodSuccess('initialize', {
860
662
  status: this.store.status
861
663
  });
862
- _context7.next = 73;
664
+ _context6.next = 77;
863
665
  break;
864
- case 66:
865
- _context7.prev = 66;
866
- _context7.t0 = _context7["catch"](46);
666
+ case 70:
667
+ _context6.prev = 70;
668
+ _context6.t0 = _context6["catch"](50);
867
669
  this.store.status = 'error';
868
- this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
869
- console.error('[VenueBooking] 初始化失败', _context7.t0);
870
- this.logMethodError('initialize', _context7.t0, {
670
+ this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
671
+ console.error('[VenueBooking] 初始化失败', _context6.t0);
672
+ this.logMethodError('initialize', _context6.t0, {
871
673
  status: this.store.status
872
674
  });
873
- throw _context7.t0;
874
- case 73:
675
+ throw _context6.t0;
676
+ case 77:
875
677
  case "end":
876
- return _context7.stop();
678
+ return _context6.stop();
877
679
  }
878
- }, _callee7, this, [[46, 66]]);
680
+ }, _callee6, this, [[50, 70]]);
879
681
  }));
880
- function initialize(_x6) {
682
+ function initialize(_x5) {
881
683
  return _initialize.apply(this, arguments);
882
684
  }
883
685
  return initialize;
@@ -885,22 +687,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
885
687
  }, {
886
688
  key: "destroy",
887
689
  value: function () {
888
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
889
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
890
- while (1) switch (_context8.prev = _context8.next) {
690
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
691
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
692
+ while (1) switch (_context7.prev = _context7.next) {
891
693
  case 0:
892
694
  this.logMethodStart('destroy');
893
695
  this.clearLoginEffectListeners();
894
- _context8.next = 4;
696
+ _context7.next = 4;
895
697
  return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
896
698
  case 4:
897
699
  console.log('[VenueBooking] 已销毁');
898
700
  this.logMethodSuccess('destroy');
899
701
  case 6:
900
702
  case "end":
901
- return _context8.stop();
703
+ return _context7.stop();
902
704
  }
903
- }, _callee8, this);
705
+ }, _callee7, this);
904
706
  }));
905
707
  function destroy() {
906
708
  return _destroy.apply(this, arguments);
@@ -910,32 +712,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
910
712
  }, {
911
713
  key: "retryInit",
912
714
  value: function () {
913
- var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
914
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
915
- while (1) switch (_context9.prev = _context9.next) {
715
+ var _retryInit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
716
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
717
+ while (1) switch (_context8.prev = _context8.next) {
916
718
  case 0:
917
719
  this.logMethodStart('retryInit');
918
720
  console.log('[VenueBooking] retryInit 调用');
919
- _context9.next = 4;
721
+ _context8.next = 4;
920
722
  return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
921
723
  case 4:
922
- _context9.prev = 4;
923
- _context9.next = 7;
724
+ _context8.prev = 4;
725
+ _context8.next = 7;
924
726
  return this.initialize(this.core, this.initializeOptions);
925
727
  case 7:
926
728
  this.logMethodSuccess('retryInit');
927
- _context9.next = 14;
729
+ _context8.next = 14;
928
730
  break;
929
731
  case 10:
930
- _context9.prev = 10;
931
- _context9.t0 = _context9["catch"](4);
932
- this.logMethodError('retryInit', _context9.t0);
933
- throw _context9.t0;
732
+ _context8.prev = 10;
733
+ _context8.t0 = _context8["catch"](4);
734
+ this.logMethodError('retryInit', _context8.t0);
735
+ throw _context8.t0;
934
736
  case 14:
935
737
  case "end":
936
- return _context9.stop();
738
+ return _context8.stop();
937
739
  }
938
- }, _callee9, this, [[4, 10]]);
740
+ }, _callee8, this, [[4, 10]]);
939
741
  }));
940
742
  function retryInit() {
941
743
  return _retryInit.apply(this, arguments);
@@ -945,22 +747,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
945
747
  }, {
946
748
  key: "refresh",
947
749
  value: function () {
948
- var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
949
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
950
- while (1) switch (_context10.prev = _context10.next) {
750
+ var _refresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
751
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
752
+ while (1) switch (_context9.prev = _context9.next) {
951
753
  case 0:
952
754
  this.logMethodStart('refresh');
953
755
  console.log('[VenueBooking] refresh 调用');
954
- _context10.prev = 2;
756
+ _context9.prev = 2;
955
757
  this.store.status = 'initializing';
956
- _context10.next = 6;
758
+ _context9.next = 6;
957
759
  return this.loadRuntimeConfigs();
958
760
  case 6:
959
- _context10.next = 8;
761
+ _context9.next = 8;
960
762
  return this.refreshItemRuleQuantityLimits();
961
763
  case 8:
962
764
  this.store.status = 'ready';
963
- _context10.next = 11;
765
+ _context9.next = 11;
964
766
  return this.core.effects.emit(VenueBookingHooks.onRefresh, {
965
767
  status: this.store.status
966
768
  });
@@ -968,18 +770,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
968
770
  this.logMethodSuccess('refresh', {
969
771
  status: this.store.status
970
772
  });
971
- _context10.next = 18;
773
+ _context9.next = 18;
972
774
  break;
973
775
  case 14:
974
- _context10.prev = 14;
975
- _context10.t0 = _context10["catch"](2);
976
- this.logMethodError('refresh', _context10.t0);
977
- throw _context10.t0;
776
+ _context9.prev = 14;
777
+ _context9.t0 = _context9["catch"](2);
778
+ this.logMethodError('refresh', _context9.t0);
779
+ throw _context9.t0;
978
780
  case 18:
979
781
  case "end":
980
- return _context10.stop();
782
+ return _context9.stop();
981
783
  }
982
- }, _callee10, this, [[2, 14]]);
784
+ }, _callee9, this, [[2, 14]]);
983
785
  }));
984
786
  function refresh() {
985
787
  return _refresh.apply(this, arguments);
@@ -1020,26 +822,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1020
822
  }, {
1021
823
  key: "loadAllProducts",
1022
824
  value: function () {
1023
- var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
825
+ var _loadAllProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1024
826
  var _this5 = this;
1025
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1026
- while (1) switch (_context11.prev = _context11.next) {
827
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
828
+ while (1) switch (_context10.prev = _context10.next) {
1027
829
  case 0:
1028
830
  if (!this.loadAllProductsInFlight) {
1029
- _context11.next = 2;
831
+ _context10.next = 2;
1030
832
  break;
1031
833
  }
1032
- return _context11.abrupt("return", this.loadAllProductsInFlight);
834
+ return _context10.abrupt("return", this.loadAllProductsInFlight);
1033
835
  case 2:
1034
836
  this.loadAllProductsInFlight = this._doLoadAllProducts().finally(function () {
1035
837
  _this5.loadAllProductsInFlight = null;
1036
838
  });
1037
- return _context11.abrupt("return", this.loadAllProductsInFlight);
839
+ return _context10.abrupt("return", this.loadAllProductsInFlight);
1038
840
  case 4:
1039
841
  case "end":
1040
- return _context11.stop();
842
+ return _context10.stop();
1041
843
  }
1042
- }, _callee11, this);
844
+ }, _callee10, this);
1043
845
  }));
1044
846
  function loadAllProducts() {
1045
847
  return _loadAllProducts.apply(this, arguments);
@@ -1049,31 +851,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1049
851
  }, {
1050
852
  key: "_doLoadAllProducts",
1051
853
  value: function () {
1052
- var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1053
- var _this$otherParams12, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
1054
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1055
- while (1) switch (_context12.prev = _context12.next) {
854
+ var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
855
+ var _this$otherParams7, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
856
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
857
+ while (1) switch (_context11.prev = _context11.next) {
1056
858
  case 0:
1057
859
  this.logMethodStart('loadAllProducts');
1058
- _context12.prev = 1;
860
+ _context11.prev = 1;
1059
861
  if (this.store.venueProducts) {
1060
- _context12.next = 4;
862
+ _context11.next = 4;
1061
863
  break;
1062
864
  }
1063
865
  throw new Error('venueProducts 模块未初始化');
1064
866
  case 4:
1065
867
  if (this.store.addonProducts) {
1066
- _context12.next = 6;
868
+ _context11.next = 6;
1067
869
  break;
1068
870
  }
1069
871
  throw new Error('addonProducts 模块未初始化');
1070
872
  case 6:
1071
- _context12.next = 8;
873
+ _context11.next = 8;
1072
874
  return this.loadOpenDataConfig();
1073
875
  case 8:
1074
- associatedMenus = ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12 = _this$otherParams12.openData) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12['menu.associated_menus']) || [];
876
+ associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
1075
877
  if (associatedMenus.length) {
1076
- _context12.next = 12;
878
+ _context11.next = 12;
1077
879
  break;
1078
880
  }
1079
881
  this.logMethodError('loadAllProducts', new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置'));
@@ -1082,7 +884,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1082
884
  menuListIds = associatedMenus.map(function (n) {
1083
885
  return Number(n.value);
1084
886
  });
1085
- _context12.next = 15;
887
+ _context11.next = 15;
1086
888
  return this.store.venueProducts.loadProducts({
1087
889
  menu_list_ids: menuListIds,
1088
890
  cacheId: this.cacheId,
@@ -1090,7 +892,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1090
892
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1091
893
  });
1092
894
  case 15:
1093
- allProducts = _context12.sent;
895
+ allProducts = _context11.sent;
1094
896
  list = Array.isArray(allProducts) ? allProducts : [];
1095
897
  venueList = list.filter(function (p) {
1096
898
  return p.duration != null;
@@ -1106,16 +908,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1106
908
  }
1107
909
  this.store.addonProducts.addProduct(addonList);
1108
910
  this.resourceProductMap = buildResourceProductMap(venueList);
1109
-
1110
- // 加载 holder 表单
1111
- if (!this.store.order) {
1112
- _context12.next = 27;
1113
- break;
1114
- }
1115
- products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
1116
- _context12.next = 27;
1117
- return this.preloadHolderForms(products);
1118
- case 27:
1119
911
  this.productsLoaded = true;
1120
912
  this.logMethodSuccess('loadAllProducts', {
1121
913
  total: list.length,
@@ -1123,20 +915,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1123
915
  addonCount: addonList.length,
1124
916
  resourceCount: this.resourceProductMap.size
1125
917
  });
1126
- return _context12.abrupt("return", {
918
+ return _context11.abrupt("return", {
1127
919
  venueProducts: venueList,
1128
920
  addonProducts: addonList
1129
921
  });
922
+ case 28:
923
+ _context11.prev = 28;
924
+ _context11.t0 = _context11["catch"](1);
925
+ this.logMethodError('loadAllProducts', _context11.t0);
926
+ throw _context11.t0;
1130
927
  case 32:
1131
- _context12.prev = 32;
1132
- _context12.t0 = _context12["catch"](1);
1133
- this.logMethodError('loadAllProducts', _context12.t0);
1134
- throw _context12.t0;
1135
- case 36:
1136
928
  case "end":
1137
- return _context12.stop();
929
+ return _context11.stop();
1138
930
  }
1139
- }, _callee12, this, [[1, 32]]);
931
+ }, _callee11, this, [[1, 28]]);
1140
932
  }));
1141
933
  function _doLoadAllProducts() {
1142
934
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1146,21 +938,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1146
938
  }, {
1147
939
  key: "loadVenueProducts",
1148
940
  value: function () {
1149
- var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
941
+ var _loadVenueProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1150
942
  var result;
1151
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1152
- while (1) switch (_context13.prev = _context13.next) {
943
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
944
+ while (1) switch (_context12.prev = _context12.next) {
1153
945
  case 0:
1154
- _context13.next = 2;
946
+ _context12.next = 2;
1155
947
  return this.loadAllProducts();
1156
948
  case 2:
1157
- result = _context13.sent;
1158
- return _context13.abrupt("return", result.venueProducts);
949
+ result = _context12.sent;
950
+ return _context12.abrupt("return", result.venueProducts);
1159
951
  case 4:
1160
952
  case "end":
1161
- return _context13.stop();
953
+ return _context12.stop();
1162
954
  }
1163
- }, _callee13, this);
955
+ }, _callee12, this);
1164
956
  }));
1165
957
  function loadVenueProducts() {
1166
958
  return _loadVenueProducts.apply(this, arguments);
@@ -1170,21 +962,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1170
962
  }, {
1171
963
  key: "loadAddonProducts",
1172
964
  value: function () {
1173
- var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
965
+ var _loadAddonProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1174
966
  var result;
1175
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1176
- while (1) switch (_context14.prev = _context14.next) {
967
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
968
+ while (1) switch (_context13.prev = _context13.next) {
1177
969
  case 0:
1178
- _context14.next = 2;
970
+ _context13.next = 2;
1179
971
  return this.loadAllProducts();
1180
972
  case 2:
1181
- result = _context14.sent;
1182
- return _context14.abrupt("return", result.addonProducts);
973
+ result = _context13.sent;
974
+ return _context13.abrupt("return", result.addonProducts);
1183
975
  case 4:
1184
976
  case "end":
1185
- return _context14.stop();
977
+ return _context13.stop();
1186
978
  }
1187
- }, _callee14, this);
979
+ }, _callee13, this);
1188
980
  }));
1189
981
  function loadAddonProducts() {
1190
982
  return _loadAddonProducts.apply(this, arguments);
@@ -1208,38 +1000,38 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1208
1000
  }, {
1209
1001
  key: "loadQuotations",
1210
1002
  value: function () {
1211
- var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1212
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1213
- while (1) switch (_context15.prev = _context15.next) {
1003
+ var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1004
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1005
+ while (1) switch (_context14.prev = _context14.next) {
1214
1006
  case 0:
1215
1007
  this.logMethodStart('loadQuotations');
1216
- _context15.prev = 1;
1008
+ _context14.prev = 1;
1217
1009
  if (this.store.quotation) {
1218
- _context15.next = 4;
1010
+ _context14.next = 4;
1219
1011
  break;
1220
1012
  }
1221
1013
  throw new Error('quotation 模块未初始化');
1222
1014
  case 4:
1223
- _context15.next = 6;
1015
+ _context14.next = 6;
1224
1016
  return this.store.quotation.loadQuotations(params);
1225
1017
  case 6:
1226
1018
  this.logMethodSuccess('loadQuotations', {
1227
1019
  count: this.store.quotation.getQuotationList().length
1228
1020
  });
1229
- _context15.next = 13;
1021
+ _context14.next = 13;
1230
1022
  break;
1231
1023
  case 9:
1232
- _context15.prev = 9;
1233
- _context15.t0 = _context15["catch"](1);
1234
- this.logMethodError('loadQuotations', _context15.t0);
1235
- throw _context15.t0;
1024
+ _context14.prev = 9;
1025
+ _context14.t0 = _context14["catch"](1);
1026
+ this.logMethodError('loadQuotations', _context14.t0);
1027
+ throw _context14.t0;
1236
1028
  case 13:
1237
1029
  case "end":
1238
- return _context15.stop();
1030
+ return _context14.stop();
1239
1031
  }
1240
- }, _callee15, this, [[1, 9]]);
1032
+ }, _callee14, this, [[1, 9]]);
1241
1033
  }));
1242
- function loadQuotations(_x7) {
1034
+ function loadQuotations(_x6) {
1243
1035
  return _loadQuotations.apply(this, arguments);
1244
1036
  }
1245
1037
  return loadQuotations;
@@ -1247,46 +1039,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1247
1039
  }, {
1248
1040
  key: "fetchResourceAvailability",
1249
1041
  value: function () {
1250
- var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1251
- var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator3, _step3, item, _i3, _rawData, _item, mappings, _iterator4, _step4, mapping;
1252
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1253
- while (1) switch (_context16.prev = _context16.next) {
1042
+ var _fetchResourceAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1043
+ var venueProducts, resourceIds, config, crossDay, effectiveEndDate, res, rawData, _iterator2, _step2, item, _i3, _rawData, _item, mappings, _iterator3, _step3, mapping;
1044
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1045
+ while (1) switch (_context15.prev = _context15.next) {
1254
1046
  case 0:
1255
1047
  this.logMethodStart('fetchResourceAvailability', params);
1256
- _context16.prev = 1;
1048
+ _context15.prev = 1;
1257
1049
  venueProducts = this.getVenueProducts();
1258
1050
  if (venueProducts.length) {
1259
- _context16.next = 7;
1051
+ _context15.next = 7;
1260
1052
  break;
1261
1053
  }
1262
1054
  this.store.rawResourceData = [];
1263
1055
  this.logMethodSuccess('fetchResourceAvailability', {
1264
1056
  resourceCount: 0
1265
1057
  });
1266
- return _context16.abrupt("return");
1058
+ return _context15.abrupt("return");
1267
1059
  case 7:
1268
1060
  resourceIds = extractResourceIds(venueProducts);
1269
1061
  if (resourceIds.length) {
1270
- _context16.next = 12;
1062
+ _context15.next = 12;
1271
1063
  break;
1272
1064
  }
1273
1065
  this.store.rawResourceData = [];
1274
1066
  this.logMethodSuccess('fetchResourceAvailability', {
1275
1067
  resourceIds: []
1276
1068
  });
1277
- return _context16.abrupt("return");
1069
+ return _context15.abrupt("return");
1278
1070
  case 12:
1279
1071
  // 跨天营业时,endDate 扩展一天以覆盖次日凌晨时段
1280
1072
  config = this.store.slotConfig;
1281
1073
  crossDay = isBusinessHoursCrossDay(config);
1282
1074
  effectiveEndDate = crossDay ? dayjs(params.endDate).add(1, 'day').format('YYYY-MM-DD') : params.endDate;
1283
1075
  if (this.store.date) {
1284
- _context16.next = 17;
1076
+ _context15.next = 17;
1285
1077
  break;
1286
1078
  }
1287
1079
  throw new Error('date 模块未初始化');
1288
1080
  case 17:
1289
- _context16.next = 19;
1081
+ _context15.next = 19;
1290
1082
  return this.store.date.fetchResourceDates({
1291
1083
  query: {
1292
1084
  start_date: params.startDate,
@@ -1296,13 +1088,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1296
1088
  useCache: false
1297
1089
  });
1298
1090
  case 19:
1299
- res = _context16.sent;
1091
+ res = _context15.sent;
1300
1092
  rawData = [];
1301
1093
  if (res !== null && res !== void 0 && res.data && Array.isArray(res.data)) {
1302
- _iterator3 = _createForOfIteratorHelper(res.data);
1094
+ _iterator2 = _createForOfIteratorHelper(res.data);
1303
1095
  try {
1304
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1305
- item = _step3.value;
1096
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1097
+ item = _step2.value;
1306
1098
  rawData.push(_objectSpread({
1307
1099
  resourceId: item.id,
1308
1100
  formId: item.form_id,
@@ -1310,41 +1102,41 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1310
1102
  }, item));
1311
1103
  }
1312
1104
  } catch (err) {
1313
- _iterator3.e(err);
1105
+ _iterator2.e(err);
1314
1106
  } finally {
1315
- _iterator3.f();
1107
+ _iterator2.f();
1316
1108
  }
1317
1109
  }
1318
1110
  this.store.rawResourceData = rawData;
1319
1111
  _i3 = 0, _rawData = rawData;
1320
1112
  case 24:
1321
1113
  if (!(_i3 < _rawData.length)) {
1322
- _context16.next = 34;
1114
+ _context15.next = 34;
1323
1115
  break;
1324
1116
  }
1325
1117
  _item = _rawData[_i3];
1326
1118
  mappings = this.resourceProductMap.get(_item.resourceId);
1327
1119
  if (mappings) {
1328
- _context16.next = 29;
1120
+ _context15.next = 29;
1329
1121
  break;
1330
1122
  }
1331
- return _context16.abrupt("continue", 31);
1123
+ return _context15.abrupt("continue", 31);
1332
1124
  case 29:
1333
- _iterator4 = _createForOfIteratorHelper(mappings);
1125
+ _iterator3 = _createForOfIteratorHelper(mappings);
1334
1126
  try {
1335
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1336
- mapping = _step4.value;
1127
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1128
+ mapping = _step3.value;
1337
1129
  if (_item.main_field) mapping.resourceName = _item.main_field;
1338
1130
  if (_item.resource_form_id) mapping.formId = _item.resource_form_id;
1339
1131
  }
1340
1132
  } catch (err) {
1341
- _iterator4.e(err);
1133
+ _iterator3.e(err);
1342
1134
  } finally {
1343
- _iterator4.f();
1135
+ _iterator3.f();
1344
1136
  }
1345
1137
  case 31:
1346
1138
  _i3++;
1347
- _context16.next = 24;
1139
+ _context15.next = 24;
1348
1140
  break;
1349
1141
  case 34:
1350
1142
  this.logMethodSuccess('fetchResourceAvailability', {
@@ -1353,21 +1145,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1353
1145
  return sum + r.times.length;
1354
1146
  }, 0)
1355
1147
  });
1356
- _context16.next = 42;
1148
+ _context15.next = 42;
1357
1149
  break;
1358
1150
  case 37:
1359
- _context16.prev = 37;
1360
- _context16.t0 = _context16["catch"](1);
1151
+ _context15.prev = 37;
1152
+ _context15.t0 = _context15["catch"](1);
1361
1153
  this.store.rawResourceData = [];
1362
- this.logMethodError('fetchResourceAvailability', _context16.t0);
1363
- throw _context16.t0;
1154
+ this.logMethodError('fetchResourceAvailability', _context15.t0);
1155
+ throw _context15.t0;
1364
1156
  case 42:
1365
1157
  case "end":
1366
- return _context16.stop();
1158
+ return _context15.stop();
1367
1159
  }
1368
- }, _callee16, this, [[1, 37]]);
1160
+ }, _callee15, this, [[1, 37]]);
1369
1161
  }));
1370
- function fetchResourceAvailability(_x8) {
1162
+ function fetchResourceAvailability(_x7) {
1371
1163
  return _fetchResourceAvailability.apply(this, arguments);
1372
1164
  }
1373
1165
  return fetchResourceAvailability;
@@ -1399,18 +1191,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1399
1191
  var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
1400
1192
  var earliestStart = null;
1401
1193
  var latestEnd = null;
1402
- var _iterator5 = _createForOfIteratorHelper(scheduleList),
1403
- _step5;
1194
+ var _iterator4 = _createForOfIteratorHelper(scheduleList),
1195
+ _step4;
1404
1196
  try {
1405
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1197
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1406
1198
  var _timeRangeMap$schedul;
1407
- var schedule = _step5.value;
1199
+ var schedule = _step4.value;
1408
1200
  var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
1409
- var _iterator6 = _createForOfIteratorHelper(dateRangeList),
1410
- _step6;
1201
+ var _iterator5 = _createForOfIteratorHelper(dateRangeList),
1202
+ _step5;
1411
1203
  try {
1412
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1413
- var range = _step6.value;
1204
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1205
+ var range = _step5.value;
1414
1206
  var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
1415
1207
  var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
1416
1208
  if (!start.isValid() || !end.isValid()) continue;
@@ -1422,15 +1214,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1422
1214
  }
1423
1215
  }
1424
1216
  } catch (err) {
1425
- _iterator6.e(err);
1217
+ _iterator5.e(err);
1426
1218
  } finally {
1427
- _iterator6.f();
1219
+ _iterator5.f();
1428
1220
  }
1429
1221
  }
1430
1222
  } catch (err) {
1431
- _iterator5.e(err);
1223
+ _iterator4.e(err);
1432
1224
  } finally {
1433
- _iterator5.f();
1225
+ _iterator4.f();
1434
1226
  }
1435
1227
  if (!earliestStart || !latestEnd) return nextSlotConfig;
1436
1228
  return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
@@ -1500,20 +1292,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1500
1292
  }, {
1501
1293
  key: "toggleSlot",
1502
1294
  value: function () {
1503
- var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(slot) {
1295
+ var _toggleSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(slot) {
1504
1296
  var mappings, mapping, currentSlots, existIndex, nextSlots, products;
1505
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1506
- while (1) switch (_context17.prev = _context17.next) {
1297
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1298
+ while (1) switch (_context16.prev = _context16.next) {
1507
1299
  case 0:
1508
1300
  this.logMethodStart('toggleSlot', {
1509
1301
  resourceId: slot.resourceId,
1510
1302
  productId: slot.productId,
1511
1303
  startTime: slot.startTime
1512
1304
  });
1513
- _context17.prev = 1;
1305
+ _context16.prev = 1;
1514
1306
  mappings = this.resourceProductMap.get(slot.resourceId);
1515
1307
  if (!(!mappings || !mappings.length)) {
1516
- _context17.next = 5;
1308
+ _context16.next = 5;
1517
1309
  break;
1518
1310
  }
1519
1311
  throw new Error("\u672A\u627E\u5230\u8D44\u6E90 ".concat(slot.resourceId, " \u7684\u5546\u54C1\u6620\u5C04"));
@@ -1522,13 +1314,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1522
1314
  return m.productId === slot.productId;
1523
1315
  });
1524
1316
  if (mapping) {
1525
- _context17.next = 8;
1317
+ _context16.next = 8;
1526
1318
  break;
1527
1319
  }
1528
1320
  throw new Error("\u8D44\u6E90 ".concat(slot.resourceId, " \u672A\u5173\u8054\u5546\u54C1 ").concat(slot.productId));
1529
1321
  case 8:
1530
1322
  if (this.store.order) {
1531
- _context17.next = 10;
1323
+ _context16.next = 10;
1532
1324
  break;
1533
1325
  }
1534
1326
  throw new Error('order 模块未初始化');
@@ -1544,14 +1336,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1544
1336
  } else {
1545
1337
  nextSlots = [].concat(_toConsumableArray(currentSlots), [slot]);
1546
1338
  }
1547
- _context17.next = 15;
1339
+ _context16.next = 15;
1548
1340
  return this.reconcileOrderForResourceProduct(slot.resourceId, slot.productId, nextSlots);
1549
1341
  case 15:
1550
1342
  products = this.store.order.getOrderProducts();
1551
- _context17.next = 18;
1343
+ _context16.next = 18;
1552
1344
  return this.refreshItemRuleQuantityLimits();
1553
1345
  case 18:
1554
- _context17.next = 20;
1346
+ _context16.next = 20;
1555
1347
  return this.refreshCartValidationPassed();
1556
1348
  case 20:
1557
1349
  this.logMethodSuccess('toggleSlot', {
@@ -1560,19 +1352,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1560
1352
  productId: slot.productId,
1561
1353
  slotCount: nextSlots.length
1562
1354
  });
1563
- return _context17.abrupt("return", products);
1355
+ return _context16.abrupt("return", products);
1564
1356
  case 24:
1565
- _context17.prev = 24;
1566
- _context17.t0 = _context17["catch"](1);
1567
- this.logMethodError('toggleSlot', _context17.t0);
1568
- throw _context17.t0;
1357
+ _context16.prev = 24;
1358
+ _context16.t0 = _context16["catch"](1);
1359
+ this.logMethodError('toggleSlot', _context16.t0);
1360
+ throw _context16.t0;
1569
1361
  case 28:
1570
1362
  case "end":
1571
- return _context17.stop();
1363
+ return _context16.stop();
1572
1364
  }
1573
- }, _callee17, this, [[1, 24]]);
1365
+ }, _callee16, this, [[1, 24]]);
1574
1366
  }));
1575
- function toggleSlot(_x9) {
1367
+ function toggleSlot(_x8) {
1576
1368
  return _toggleSlot.apply(this, arguments);
1577
1369
  }
1578
1370
  return toggleSlot;
@@ -1584,8 +1376,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1584
1376
  }, {
1585
1377
  key: "getSelectedSlotsForResource",
1586
1378
  value: function getSelectedSlotsForResource(resourceId, productId) {
1587
- var _this$store$order4;
1588
- var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
1379
+ var _this$store$order3;
1380
+ var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
1589
1381
  if (!tempOrder) return [];
1590
1382
  var venueProducts = tempOrder.products.filter(function (p) {
1591
1383
  var _p$metadata, _p$metadata2;
@@ -1596,24 +1388,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1596
1388
  });
1597
1389
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1598
1390
  var slots = [];
1599
- var _iterator7 = _createForOfIteratorHelper(venueProducts),
1600
- _step7;
1391
+ var _iterator6 = _createForOfIteratorHelper(venueProducts),
1392
+ _step6;
1601
1393
  try {
1602
1394
  var _loop = function _loop() {
1603
- var product = _step7.value;
1395
+ var product = _step6.value;
1604
1396
  slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration).map(function (s) {
1605
1397
  return _objectSpread(_objectSpread({}, s), {}, {
1606
1398
  productId: Number(product.product_id)
1607
1399
  });
1608
1400
  })));
1609
1401
  };
1610
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1402
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1611
1403
  _loop();
1612
1404
  }
1613
1405
  } catch (err) {
1614
- _iterator7.e(err);
1406
+ _iterator6.e(err);
1615
1407
  } finally {
1616
- _iterator7.f();
1408
+ _iterator6.f();
1617
1409
  }
1618
1410
  return slots.sort(function (a, b) {
1619
1411
  return a.startTime.localeCompare(b.startTime);
@@ -1686,28 +1478,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1686
1478
 
1687
1479
  // 规则 2:当前是组合资源,任一子资源被选 → 禁用
1688
1480
  if (currentIsCombined) {
1689
- var _iterator8 = _createForOfIteratorHelper(currentChildIds),
1690
- _step8;
1481
+ var _iterator7 = _createForOfIteratorHelper(currentChildIds),
1482
+ _step7;
1691
1483
  try {
1692
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1693
- var childId = _step8.value;
1484
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1485
+ var childId = _step7.value;
1694
1486
  if (getSelectedAt(childId).length > 0) return true;
1695
1487
  }
1696
1488
  } catch (err) {
1697
- _iterator8.e(err);
1489
+ _iterator7.e(err);
1698
1490
  } finally {
1699
- _iterator8.f();
1491
+ _iterator7.f();
1700
1492
  }
1701
1493
  }
1702
1494
 
1703
1495
  // 规则 3 & 4:扫描所有已选的 (resId),若是组合资源,检查其 children 是否包含当前 resourceId 或与当前 child 集合有交集
1704
- var _iterator9 = _createForOfIteratorHelper(allSelected),
1705
- _step9;
1496
+ var _iterator8 = _createForOfIteratorHelper(allSelected),
1497
+ _step8;
1706
1498
  try {
1707
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1708
- var _step9$value = _slicedToArray(_step9.value, 2),
1709
- selectedResId = _step9$value[0],
1710
- slots = _step9$value[1];
1499
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1500
+ var _step8$value = _slicedToArray(_step8.value, 2),
1501
+ selectedResId = _step8$value[0],
1502
+ slots = _step8$value[1];
1711
1503
  if (!slots.some(function (s) {
1712
1504
  return s.startTime === startTime;
1713
1505
  })) continue;
@@ -1733,9 +1525,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1733
1525
  }
1734
1526
  }
1735
1527
  } catch (err) {
1736
- _iterator9.e(err);
1528
+ _iterator8.e(err);
1737
1529
  } finally {
1738
- _iterator9.f();
1530
+ _iterator8.f();
1739
1531
  }
1740
1532
  return false;
1741
1533
  }
@@ -1746,22 +1538,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1746
1538
  }, {
1747
1539
  key: "getAllSelectedSlots",
1748
1540
  value: function getAllSelectedSlots() {
1749
- var _this$store$order5;
1541
+ var _this$store$order4;
1750
1542
  var result = new Map();
1751
- var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
1543
+ var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
1752
1544
  if (!tempOrder) return result;
1753
1545
  var venueProducts = tempOrder.products.filter(function (p) {
1754
1546
  var _p$metadata3;
1755
1547
  return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
1756
1548
  });
1757
1549
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1758
- var _iterator10 = _createForOfIteratorHelper(venueProducts),
1759
- _step10;
1550
+ var _iterator9 = _createForOfIteratorHelper(venueProducts),
1551
+ _step9;
1760
1552
  try {
1761
1553
  var _loop2 = function _loop2() {
1762
- var _product$metadata2;
1763
- var product = _step10.value;
1764
- var resourceId = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.resource_id;
1554
+ var _product$metadata;
1555
+ var product = _step9.value;
1556
+ var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
1765
1557
  if (resourceId == null) return 1; // continue
1766
1558
  var productId = Number(product.product_id);
1767
1559
  var existing = result.get(resourceId) || [];
@@ -1772,29 +1564,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1772
1564
  })));
1773
1565
  result.set(resourceId, existing);
1774
1566
  };
1775
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1567
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1776
1568
  if (_loop2()) continue;
1777
1569
  }
1778
1570
  } catch (err) {
1779
- _iterator10.e(err);
1571
+ _iterator9.e(err);
1780
1572
  } finally {
1781
- _iterator10.f();
1573
+ _iterator9.f();
1782
1574
  }
1783
- var _iterator11 = _createForOfIteratorHelper(result),
1784
- _step11;
1575
+ var _iterator10 = _createForOfIteratorHelper(result),
1576
+ _step10;
1785
1577
  try {
1786
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1787
- var _step11$value = _slicedToArray(_step11.value, 2),
1788
- key = _step11$value[0],
1789
- slots = _step11$value[1];
1578
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1579
+ var _step10$value = _slicedToArray(_step10.value, 2),
1580
+ key = _step10$value[0],
1581
+ slots = _step10$value[1];
1790
1582
  result.set(key, slots.sort(function (a, b) {
1791
1583
  return a.startTime.localeCompare(b.startTime);
1792
1584
  }));
1793
1585
  }
1794
1586
  } catch (err) {
1795
- _iterator11.e(err);
1587
+ _iterator10.e(err);
1796
1588
  } finally {
1797
- _iterator11.f();
1589
+ _iterator10.f();
1798
1590
  }
1799
1591
  return result;
1800
1592
  }
@@ -1807,27 +1599,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1807
1599
  }, {
1808
1600
  key: "reconcileOrderForResourceProduct",
1809
1601
  value: (function () {
1810
- var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
1811
- var _this$store$order6, _this$store$order6$ge;
1812
- var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
1813
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1814
- while (1) switch (_context18.prev = _context18.next) {
1602
+ var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resourceId, productId, slots) {
1603
+ var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, resourceEntry, booking;
1604
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1605
+ while (1) switch (_context17.prev = _context17.next) {
1815
1606
  case 0:
1816
1607
  mappings = this.resourceProductMap.get(resourceId);
1817
1608
  if (!(!mappings || !mappings.length || !this.store.order)) {
1818
- _context18.next = 3;
1609
+ _context17.next = 3;
1819
1610
  break;
1820
1611
  }
1821
- return _context18.abrupt("return");
1612
+ return _context17.abrupt("return");
1822
1613
  case 3:
1823
1614
  mapping = mappings.find(function (m) {
1824
1615
  return m.productId === productId;
1825
1616
  });
1826
1617
  if (mapping) {
1827
- _context18.next = 6;
1618
+ _context17.next = 6;
1828
1619
  break;
1829
1620
  }
1830
- return _context18.abrupt("return");
1621
+ return _context17.abrupt("return");
1831
1622
  case 6:
1832
1623
  tempOrder = this.store.order.ensureTempOrder();
1833
1624
  matchesCurrent = function matchesCurrent(meta, pid) {
@@ -1845,17 +1636,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1845
1636
  return Number(bookingProductId) !== Number(productId);
1846
1637
  });
1847
1638
  if (slots.length) {
1848
- _context18.next = 16;
1639
+ _context17.next = 16;
1849
1640
  break;
1850
1641
  }
1851
1642
  this.store.order.applyDiscount();
1852
- _context18.next = 14;
1643
+ _context17.next = 14;
1853
1644
  return this.store.order.recalculateSummary({
1854
1645
  createIfMissing: true
1855
1646
  });
1856
1647
  case 14:
1857
1648
  this.store.order.persistTempOrder();
1858
- return _context18.abrupt("return");
1649
+ return _context17.abrupt("return");
1859
1650
  case 16:
1860
1651
  merged = mergeConsecutiveSlots(slots);
1861
1652
  rawResource = this.store.rawResourceData.find(function (r) {
@@ -1874,7 +1665,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1874
1665
  endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
1875
1666
  duration = endMoment.diff(startMoment, 'minute');
1876
1667
  customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
1877
- productTitle = this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
1878
1668
  resourceEntry = {
1879
1669
  relation_type: 'form',
1880
1670
  like_status: 'common',
@@ -1903,45 +1693,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1903
1693
  };
1904
1694
  });
1905
1695
  }
1906
- venueProductOrigin = {
1907
- name: mapping.productTitle,
1908
- product_title: productTitle,
1909
- cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
1910
- custom_deposit_data: customDepositData,
1911
- id: 0,
1912
- number: 1,
1913
- registration_type: 'all',
1914
- relation_products: [],
1915
- is_all: false,
1916
- product: {
1917
- product_id: mapping.productId,
1918
- product_variant_id: 0,
1919
- num: 1,
1920
- product_bundle: [],
1921
- product_sku: {
1922
- option: []
1923
- },
1924
- discount_list: [],
1925
- custom_deposit_data: customDepositData,
1926
- metadata: {}
1927
- },
1928
- sub_type: 'minutes',
1929
- duration: duration,
1930
- like_status: 'common',
1931
- resources: [resourceEntry],
1932
- schedule_id: 0,
1933
- select_date: startMoment.format('YYYY-MM-DD'),
1934
- start_date: startMoment.format('YYYY-MM-DD'),
1935
- start_time: startMoment.format('HH:mm'),
1936
- end_date: endMoment.format('YYYY-MM-DD'),
1937
- end_time: endMoment.format('HH:mm'),
1938
- metadata: {
1939
- venue_booking: true,
1940
- slot_count: group.slotCount
1941
- },
1942
- holder: null
1943
- };
1944
- normalizedVenueOrderProduct = normalizeOrderProduct({
1696
+ tempOrder.products.push(normalizeOrderProduct({
1945
1697
  product_id: mapping.productId,
1946
1698
  product_variant_id: 0,
1947
1699
  identity_key: identityKey,
@@ -1949,11 +1701,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1949
1701
  selling_price: group.totalPrice,
1950
1702
  original_price: group.totalPrice,
1951
1703
  is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
1952
- metadata: _objectSpread(_objectSpread({
1953
- venue_booking: true
1954
- }, productTitle ? {
1955
- product_title: productTitle
1956
- } : {}), {}, {
1704
+ metadata: {
1705
+ venue_booking: true,
1957
1706
  resource_id: resourceId,
1958
1707
  resource_form_id: mapping.formId,
1959
1708
  resource_name: mapping.resourceName,
@@ -1966,14 +1715,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1966
1715
  productId: mapping.productId,
1967
1716
  quotation: this.store.quotation
1968
1717
  })
1969
- }),
1970
- _origin: venueProductOrigin
1971
- });
1972
- venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
1973
- product_title: productTitle
1974
- }) : normalizedVenueOrderProduct;
1975
- this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
1976
- tempOrder.products.push(venueOrderProduct);
1718
+ },
1719
+ _origin: {
1720
+ name: mapping.productTitle,
1721
+ cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
1722
+ custom_deposit_data: customDepositData,
1723
+ id: 0,
1724
+ number: 1,
1725
+ registration_type: 'all',
1726
+ relation_products: [],
1727
+ is_all: false,
1728
+ product: {
1729
+ product_id: mapping.productId,
1730
+ product_variant_id: 0,
1731
+ num: 1,
1732
+ product_bundle: [],
1733
+ product_sku: {
1734
+ option: []
1735
+ },
1736
+ discount_list: [],
1737
+ custom_deposit_data: customDepositData,
1738
+ metadata: {}
1739
+ },
1740
+ sub_type: 'minutes',
1741
+ duration: duration,
1742
+ like_status: 'common',
1743
+ resources: [resourceEntry],
1744
+ schedule_id: 0,
1745
+ select_date: startMoment.format('YYYY-MM-DD'),
1746
+ start_date: startMoment.format('YYYY-MM-DD'),
1747
+ start_time: startMoment.format('HH:mm'),
1748
+ end_date: endMoment.format('YYYY-MM-DD'),
1749
+ end_time: endMoment.format('HH:mm'),
1750
+ metadata: {
1751
+ venue_booking: true,
1752
+ slot_count: group.slotCount
1753
+ },
1754
+ holder: null
1755
+ }
1756
+ }));
1977
1757
  booking = buildVenueBookingEntry({
1978
1758
  group: group,
1979
1759
  resourceId: resourceId,
@@ -1985,26 +1765,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1985
1765
  });
1986
1766
  tempOrder.bookings.push(booking);
1987
1767
  }
1988
-
1989
- // 获取表单信息
1990
- products = ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getOrderProducts) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6)) || [];
1991
- _context18.next = 25;
1992
- return this.preloadHolderForms(products);
1993
- case 25:
1994
1768
  this.store.order.applyDiscount();
1995
- _context18.next = 28;
1769
+ _context17.next = 25;
1996
1770
  return this.store.order.recalculateSummary({
1997
1771
  createIfMissing: true
1998
1772
  });
1999
- case 28:
1773
+ case 25:
2000
1774
  this.store.order.persistTempOrder();
2001
- case 29:
1775
+ case 26:
2002
1776
  case "end":
2003
- return _context18.stop();
1777
+ return _context17.stop();
2004
1778
  }
2005
- }, _callee18, this);
1779
+ }, _callee17, this);
2006
1780
  }));
2007
- function reconcileOrderForResourceProduct(_x10, _x11, _x12) {
1781
+ function reconcileOrderForResourceProduct(_x9, _x10, _x11) {
2008
1782
  return _reconcileOrderForResourceProduct.apply(this, arguments);
2009
1783
  }
2010
1784
  return reconcileOrderForResourceProduct;
@@ -2019,23 +1793,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2019
1793
  return undefined;
2020
1794
  }
2021
1795
  var children = [];
2022
- var _iterator12 = _createForOfIteratorHelper(combined.resource_ids),
2023
- _step12;
1796
+ var _iterator11 = _createForOfIteratorHelper(combined.resource_ids),
1797
+ _step11;
2024
1798
  try {
2025
1799
  var _loop3 = function _loop3() {
2026
- var id = _step12.value;
1800
+ var id = _step11.value;
2027
1801
  var child = _this8.store.rawResourceData.find(function (r) {
2028
1802
  return String(r.resourceId) === String(id);
2029
1803
  });
2030
1804
  if (child) children.push(child);
2031
1805
  };
2032
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
1806
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2033
1807
  _loop3();
2034
1808
  }
2035
1809
  } catch (err) {
2036
- _iterator12.e(err);
1810
+ _iterator11.e(err);
2037
1811
  } finally {
2038
- _iterator12.f();
1812
+ _iterator11.f();
2039
1813
  }
2040
1814
  return children.length ? children : undefined;
2041
1815
  }
@@ -2057,35 +1831,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2057
1831
  }, {
2058
1832
  key: "loadSchedules",
2059
1833
  value: function () {
2060
- var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
2061
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2062
- while (1) switch (_context19.prev = _context19.next) {
1834
+ var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1835
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1836
+ while (1) switch (_context18.prev = _context18.next) {
2063
1837
  case 0:
2064
1838
  this.logMethodStart('loadSchedules');
2065
- _context19.prev = 1;
1839
+ _context18.prev = 1;
2066
1840
  if (this.store.schedule) {
2067
- _context19.next = 4;
1841
+ _context18.next = 4;
2068
1842
  break;
2069
1843
  }
2070
1844
  throw new Error('schedule 模块未初始化');
2071
1845
  case 4:
2072
- _context19.next = 6;
1846
+ _context18.next = 6;
2073
1847
  return this.store.schedule.loadAllSchedule();
2074
1848
  case 6:
2075
1849
  this.injectScheduleResolverToQuotation();
2076
1850
  this.logMethodSuccess('loadSchedules');
2077
- _context19.next = 14;
1851
+ _context18.next = 14;
2078
1852
  break;
2079
1853
  case 10:
2080
- _context19.prev = 10;
2081
- _context19.t0 = _context19["catch"](1);
2082
- this.logMethodError('loadSchedules', _context19.t0);
2083
- throw _context19.t0;
1854
+ _context18.prev = 10;
1855
+ _context18.t0 = _context18["catch"](1);
1856
+ this.logMethodError('loadSchedules', _context18.t0);
1857
+ throw _context18.t0;
2084
1858
  case 14:
2085
1859
  case "end":
2086
- return _context19.stop();
1860
+ return _context18.stop();
2087
1861
  }
2088
- }, _callee19, this, [[1, 10]]);
1862
+ }, _callee18, this, [[1, 10]]);
2089
1863
  }));
2090
1864
  function loadSchedules() {
2091
1865
  return _loadSchedules.apply(this, arguments);
@@ -2113,16 +1887,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2113
1887
  }, {
2114
1888
  key: "getTempOrder",
2115
1889
  value: function getTempOrder() {
2116
- var _this$store$order7;
2117
- var result = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getTempOrder()) || null;
1890
+ var _this$store$order5;
1891
+ var result = ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder()) || null;
2118
1892
  return result;
2119
1893
  }
2120
1894
  }, {
2121
1895
  key: "updateTempOrderNote",
2122
1896
  value: function updateTempOrderNote(note) {
2123
- var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
2124
1897
  if (!this.store.order) throw new Error('order 模块未初始化');
2125
- return this.store.order.updateTempOrderNote(note, sync);
1898
+ return this.store.order.updateTempOrderNote(note);
2126
1899
  }
2127
1900
  }, {
2128
1901
  key: "updateTempOrderContactsInfo",
@@ -2131,23 +1904,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2131
1904
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
2132
1905
  }
2133
1906
  }, {
2134
- key: "ensureVenueTempOrder",
2135
- value: function ensureVenueTempOrder() {
1907
+ key: "ensureTempOrder",
1908
+ value: function ensureTempOrder() {
2136
1909
  if (!this.store.order) throw new Error('order 模块未初始化');
2137
1910
  return this.store.order.ensureTempOrder();
2138
1911
  }
2139
1912
  }, {
2140
1913
  key: "onCustomerLogin",
2141
1914
  value: function () {
2142
- var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2143
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2144
- while (1) switch (_context20.prev = _context20.next) {
1915
+ var _onCustomerLogin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1916
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1917
+ while (1) switch (_context19.prev = _context19.next) {
2145
1918
  case 0:
2146
1919
  this.logMethodStart('onCustomerLogin', {
2147
1920
  customerId: params.customerId
2148
1921
  });
2149
- _context20.prev = 1;
2150
- _context20.next = 4;
1922
+ _context19.prev = 1;
1923
+ _context19.next = 4;
2151
1924
  return this.refreshOrderMarketingAfterLogin({
2152
1925
  customerId: params.customerId
2153
1926
  });
@@ -2155,20 +1928,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2155
1928
  this.logMethodSuccess('onCustomerLogin', {
2156
1929
  customerId: params.customerId
2157
1930
  });
2158
- _context20.next = 11;
1931
+ _context19.next = 11;
2159
1932
  break;
2160
1933
  case 7:
2161
- _context20.prev = 7;
2162
- _context20.t0 = _context20["catch"](1);
2163
- this.logMethodError('onCustomerLogin', _context20.t0);
2164
- throw _context20.t0;
1934
+ _context19.prev = 7;
1935
+ _context19.t0 = _context19["catch"](1);
1936
+ this.logMethodError('onCustomerLogin', _context19.t0);
1937
+ throw _context19.t0;
2165
1938
  case 11:
2166
1939
  case "end":
2167
- return _context20.stop();
1940
+ return _context19.stop();
2168
1941
  }
2169
- }, _callee20, this, [[1, 7]]);
1942
+ }, _callee19, this, [[1, 7]]);
2170
1943
  }));
2171
- function onCustomerLogin(_x13) {
1944
+ function onCustomerLogin(_x12) {
2172
1945
  return _onCustomerLogin.apply(this, arguments);
2173
1946
  }
2174
1947
  return onCustomerLogin;
@@ -2182,13 +1955,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2182
1955
  var tempOrder = this.store.order.getTempOrder();
2183
1956
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
2184
1957
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
2185
- var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
2186
- _step13;
1958
+ var _iterator12 = _createForOfIteratorHelper(tempOrder.products),
1959
+ _step12;
2187
1960
  try {
2188
1961
  var _loop4 = function _loop4() {
2189
- var _product$metadata3;
2190
- var product = _step13.value;
2191
- if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
1962
+ var _product$metadata2;
1963
+ var product = _step12.value;
1964
+ if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2192
1965
  var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2193
1966
  if (!mappings || !mappings.length) return 0; // continue
2194
1967
  var mapping = mappings.find(function (m) {
@@ -2230,43 +2003,43 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2230
2003
  }
2231
2004
  },
2232
2005
  _ret;
2233
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2006
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
2234
2007
  _ret = _loop4();
2235
2008
  if (_ret === 0) continue;
2236
2009
  }
2237
2010
  } catch (err) {
2238
- _iterator13.e(err);
2011
+ _iterator12.e(err);
2239
2012
  } finally {
2240
- _iterator13.f();
2013
+ _iterator12.f();
2241
2014
  }
2242
2015
  }
2243
2016
  }, {
2244
2017
  key: "scanCode",
2245
2018
  value: function () {
2246
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(code, customerId) {
2019
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(code, customerId) {
2247
2020
  var result;
2248
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2249
- while (1) switch (_context21.prev = _context21.next) {
2021
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2022
+ while (1) switch (_context20.prev = _context20.next) {
2250
2023
  case 0:
2251
2024
  this.logMethodStart('scanCode', {
2252
2025
  code: code
2253
2026
  });
2254
- _context21.prev = 1;
2027
+ _context20.prev = 1;
2255
2028
  if (this.store.order) {
2256
- _context21.next = 4;
2029
+ _context20.next = 4;
2257
2030
  break;
2258
2031
  }
2259
2032
  throw new Error('order 模块未初始化');
2260
2033
  case 4:
2261
- _context21.next = 6;
2034
+ _context20.next = 6;
2262
2035
  return this.store.order.scanCode(code, customerId);
2263
2036
  case 6:
2264
- result = _context21.sent;
2037
+ result = _context20.sent;
2265
2038
  if (!result.isAvailable) {
2266
- _context21.next = 11;
2039
+ _context20.next = 11;
2267
2040
  break;
2268
2041
  }
2269
- _context21.next = 10;
2042
+ _context20.next = 10;
2270
2043
  return this.store.order.recalculateSummary({
2271
2044
  createIfMissing: true
2272
2045
  });
@@ -2276,19 +2049,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2276
2049
  this.logMethodSuccess('scanCode', {
2277
2050
  isAvailable: result.isAvailable
2278
2051
  });
2279
- return _context21.abrupt("return", result);
2052
+ return _context20.abrupt("return", result);
2280
2053
  case 15:
2281
- _context21.prev = 15;
2282
- _context21.t0 = _context21["catch"](1);
2283
- this.logMethodError('scanCode', _context21.t0);
2284
- throw _context21.t0;
2054
+ _context20.prev = 15;
2055
+ _context20.t0 = _context20["catch"](1);
2056
+ this.logMethodError('scanCode', _context20.t0);
2057
+ throw _context20.t0;
2285
2058
  case 19:
2286
2059
  case "end":
2287
- return _context21.stop();
2060
+ return _context20.stop();
2288
2061
  }
2289
- }, _callee21, this, [[1, 15]]);
2062
+ }, _callee20, this, [[1, 15]]);
2290
2063
  }));
2291
- function scanCode(_x14, _x15) {
2064
+ function scanCode(_x13, _x14) {
2292
2065
  return _scanCode.apply(this, arguments);
2293
2066
  }
2294
2067
  return scanCode;
@@ -2304,15 +2077,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2304
2077
  }, {
2305
2078
  key: "setDiscountSelected",
2306
2079
  value: (function () {
2307
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2308
- var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2309
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2310
- while (1) switch (_context22.prev = _context22.next) {
2080
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2081
+ var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator13, _step13, d, selectedResourceIds, _iterator14, _step14, _origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2082
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2083
+ while (1) switch (_context21.prev = _context21.next) {
2311
2084
  case 0:
2312
2085
  this.logMethodStart('setDiscountSelected', params);
2313
- _context22.prev = 1;
2086
+ _context21.prev = 1;
2314
2087
  if (this.store.order) {
2315
- _context22.next = 4;
2088
+ _context21.next = 4;
2316
2089
  break;
2317
2090
  }
2318
2091
  throw new Error('order 模块未初始化');
@@ -2338,7 +2111,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2338
2111
  form_record_id: tempOrder.holder.form_record_id
2339
2112
  }] : [];
2340
2113
  nextDiscountList = updated;
2341
- _context22.next = 16;
2114
+ _context21.next = 16;
2342
2115
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
2343
2116
  case 16:
2344
2117
  if (rulesModule) {
@@ -2365,18 +2138,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2365
2138
  }).map(function (d) {
2366
2139
  return d.id;
2367
2140
  }));
2368
- _iterator14 = _createForOfIteratorHelper(nextDiscountList);
2141
+ _iterator13 = _createForOfIteratorHelper(nextDiscountList);
2369
2142
  try {
2370
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2371
- d = _step14.value;
2143
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
2144
+ d = _step13.value;
2372
2145
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
2373
2146
  d.isSelected = false;
2374
2147
  }
2375
2148
  }
2376
2149
  } catch (err) {
2377
- _iterator14.e(err);
2150
+ _iterator13.e(err);
2378
2151
  } finally {
2379
- _iterator14.f();
2152
+ _iterator13.f();
2380
2153
  }
2381
2154
  }
2382
2155
  }
@@ -2389,22 +2162,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2389
2162
  // 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
2390
2163
  // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2391
2164
  // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2392
- _iterator15 = _createForOfIteratorHelper(tempOrder.products);
2393
- _context22.prev = 19;
2394
- _iterator15.s();
2165
+ _iterator14 = _createForOfIteratorHelper(tempOrder.products);
2166
+ _context21.prev = 19;
2167
+ _iterator14.s();
2395
2168
  case 21:
2396
- if ((_step15 = _iterator15.n()).done) {
2397
- _context22.next = 36;
2169
+ if ((_step14 = _iterator14.n()).done) {
2170
+ _context21.next = 38;
2398
2171
  break;
2399
2172
  }
2400
- product = _step15.value;
2401
- origin = this.readProductOriginFromTempOrder(tempOrder, product);
2402
- if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
2403
- _context22.next = 26;
2173
+ product = _step14.value;
2174
+ if (!((_origin = product._origin) !== null && _origin !== void 0 && _origin.isManualDiscount)) {
2175
+ _context21.next = 25;
2404
2176
  break;
2405
2177
  }
2406
- return _context22.abrupt("continue", 34);
2407
- case 26:
2178
+ return _context21.abrupt("continue", 36);
2179
+ case 25:
2180
+ if (!(product.discount_list || []).some(isItemRewardProductDiscount)) {
2181
+ _context21.next = 28;
2182
+ break;
2183
+ }
2184
+ product.discount_list = (product.discount_list || []).filter(isItemRewardProductDiscount);
2185
+ return _context21.abrupt("continue", 36);
2186
+ case 28:
2408
2187
  // 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
2409
2188
  product.discount_list = (product.discount_list || []).filter(function (pd) {
2410
2189
  var _pd$discount$resource, _pd$discount;
@@ -2418,7 +2197,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2418
2197
  return sum + (pd.amount || 0);
2419
2198
  }, 0);
2420
2199
  optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
2421
- sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
2200
+ sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
2422
2201
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
2423
2202
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
2424
2203
  if (product.metadata) {
@@ -2429,36 +2208,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2429
2208
  mainPrice: newMainSellingPrice,
2430
2209
  bundle: product.product_bundle
2431
2210
  });
2432
- case 34:
2433
- _context22.next = 21;
2434
- break;
2435
2211
  case 36:
2436
- _context22.next = 41;
2212
+ _context21.next = 21;
2437
2213
  break;
2438
2214
  case 38:
2439
- _context22.prev = 38;
2440
- _context22.t0 = _context22["catch"](19);
2441
- _iterator15.e(_context22.t0);
2442
- case 41:
2443
- _context22.prev = 41;
2444
- _iterator15.f();
2445
- return _context22.finish(41);
2446
- case 44:
2215
+ _context21.next = 43;
2216
+ break;
2217
+ case 40:
2218
+ _context21.prev = 40;
2219
+ _context21.t0 = _context21["catch"](19);
2220
+ _iterator14.e(_context21.t0);
2221
+ case 43:
2222
+ _context21.prev = 43;
2223
+ _iterator14.f();
2224
+ return _context21.finish(43);
2225
+ case 46:
2447
2226
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2448
- _context22.next = 47;
2227
+ _context21.next = 49;
2449
2228
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2450
- case 47:
2229
+ case 49:
2451
2230
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
2452
2231
  return d.isSelected;
2453
2232
  });
2454
2233
  afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
2455
2234
  return d.id === params.discountId;
2456
2235
  }) || null;
2457
- _context22.next = 51;
2236
+ _context21.next = 53;
2458
2237
  return this.store.order.recalculateSummary({
2459
2238
  createIfMissing: true
2460
2239
  });
2461
- case 51:
2240
+ case 53:
2462
2241
  this.store.order.persistTempOrder();
2463
2242
  finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
2464
2243
  finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
@@ -2466,19 +2245,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2466
2245
  finalTarget = this.store.order.getDiscountList().find(function (d) {
2467
2246
  return d.id === params.discountId;
2468
2247
  }) || null;
2469
- return _context22.abrupt("return", this.store.order.getDiscountList());
2470
- case 59:
2471
- _context22.prev = 59;
2472
- _context22.t1 = _context22["catch"](1);
2473
- this.logMethodError('setDiscountSelected', _context22.t1);
2474
- throw _context22.t1;
2475
- case 63:
2248
+ return _context21.abrupt("return", this.store.order.getDiscountList());
2249
+ case 61:
2250
+ _context21.prev = 61;
2251
+ _context21.t1 = _context21["catch"](1);
2252
+ this.logMethodError('setDiscountSelected', _context21.t1);
2253
+ throw _context21.t1;
2254
+ case 65:
2476
2255
  case "end":
2477
- return _context22.stop();
2256
+ return _context21.stop();
2478
2257
  }
2479
- }, _callee22, this, [[1, 59], [19, 38, 41, 44]]);
2258
+ }, _callee21, this, [[1, 61], [19, 40, 43, 46]]);
2480
2259
  }));
2481
- function setDiscountSelected(_x16) {
2260
+ function setDiscountSelected(_x15) {
2482
2261
  return _setDiscountSelected.apply(this, arguments);
2483
2262
  }
2484
2263
  return setDiscountSelected;
@@ -2486,37 +2265,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2486
2265
  }, {
2487
2266
  key: "addNewOrder",
2488
2267
  value: function () {
2489
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2268
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2490
2269
  var tempOrder;
2491
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2492
- while (1) switch (_context23.prev = _context23.next) {
2270
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2271
+ while (1) switch (_context22.prev = _context22.next) {
2493
2272
  case 0:
2494
2273
  this.logMethodStart('addNewOrder');
2495
- _context23.prev = 1;
2274
+ _context22.prev = 1;
2496
2275
  if (this.store.order) {
2497
- _context23.next = 4;
2276
+ _context22.next = 4;
2498
2277
  break;
2499
2278
  }
2500
2279
  throw new Error('order 模块未初始化');
2501
2280
  case 4:
2502
- _context23.next = 6;
2281
+ _context22.next = 6;
2503
2282
  return this.store.order.addNewOrder();
2504
2283
  case 6:
2505
- tempOrder = _context23.sent;
2284
+ tempOrder = _context22.sent;
2506
2285
  this.logMethodSuccess('addNewOrder', {
2507
2286
  productCount: tempOrder.products.length
2508
2287
  });
2509
- return _context23.abrupt("return", tempOrder);
2288
+ return _context22.abrupt("return", tempOrder);
2510
2289
  case 11:
2511
- _context23.prev = 11;
2512
- _context23.t0 = _context23["catch"](1);
2513
- this.logMethodError('addNewOrder', _context23.t0);
2514
- throw _context23.t0;
2290
+ _context22.prev = 11;
2291
+ _context22.t0 = _context22["catch"](1);
2292
+ this.logMethodError('addNewOrder', _context22.t0);
2293
+ throw _context22.t0;
2515
2294
  case 15:
2516
2295
  case "end":
2517
- return _context23.stop();
2296
+ return _context22.stop();
2518
2297
  }
2519
- }, _callee23, this, [[1, 11]]);
2298
+ }, _callee22, this, [[1, 11]]);
2520
2299
  }));
2521
2300
  function addNewOrder() {
2522
2301
  return _addNewOrder.apply(this, arguments);
@@ -2533,37 +2312,37 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2533
2312
  }, {
2534
2313
  key: "getSummary",
2535
2314
  value: function () {
2536
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2315
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2537
2316
  var summary;
2538
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2539
- while (1) switch (_context24.prev = _context24.next) {
2317
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2318
+ while (1) switch (_context23.prev = _context23.next) {
2540
2319
  case 0:
2541
2320
  this.logMethodStart('getSummary');
2542
- _context24.prev = 1;
2321
+ _context23.prev = 1;
2543
2322
  if (this.store.order) {
2544
- _context24.next = 4;
2323
+ _context23.next = 4;
2545
2324
  break;
2546
2325
  }
2547
2326
  throw new Error('order 模块未初始化');
2548
2327
  case 4:
2549
- _context24.next = 6;
2328
+ _context23.next = 6;
2550
2329
  return this.store.order.getOrderSummary();
2551
2330
  case 6:
2552
- summary = _context24.sent;
2331
+ summary = _context23.sent;
2553
2332
  this.logMethodSuccess('getSummary', {
2554
2333
  totalAmount: summary.total_amount
2555
2334
  });
2556
- return _context24.abrupt("return", summary);
2335
+ return _context23.abrupt("return", summary);
2557
2336
  case 11:
2558
- _context24.prev = 11;
2559
- _context24.t0 = _context24["catch"](1);
2560
- this.logMethodError('getSummary', _context24.t0);
2561
- throw _context24.t0;
2337
+ _context23.prev = 11;
2338
+ _context23.t0 = _context23["catch"](1);
2339
+ this.logMethodError('getSummary', _context23.t0);
2340
+ throw _context23.t0;
2562
2341
  case 15:
2563
2342
  case "end":
2564
- return _context24.stop();
2343
+ return _context23.stop();
2565
2344
  }
2566
- }, _callee24, this, [[1, 11]]);
2345
+ }, _callee23, this, [[1, 11]]);
2567
2346
  }));
2568
2347
  function getSummary() {
2569
2348
  return _getSummary.apply(this, arguments);
@@ -2573,47 +2352,47 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2573
2352
  }, {
2574
2353
  key: "submitOrder",
2575
2354
  value: function () {
2576
- var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2577
- var _this$otherParams13, _this$otherParams14, _this$otherParams15, _this$otherParams16, _tempOrder$products2, result, tempOrder;
2578
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2579
- while (1) switch (_context25.prev = _context25.next) {
2355
+ var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2356
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _tempOrder$products2, result, tempOrder;
2357
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2358
+ while (1) switch (_context24.prev = _context24.next) {
2580
2359
  case 0:
2581
2360
  this.logMethodStart('submitOrder');
2582
- _context25.prev = 1;
2583
- _context25.next = 4;
2361
+ _context24.prev = 1;
2362
+ _context24.next = 4;
2584
2363
  return this.validateBeforeSubmitByItemRule();
2585
2364
  case 4:
2586
2365
  if (this.store.order) {
2587
- _context25.next = 6;
2366
+ _context24.next = 6;
2588
2367
  break;
2589
2368
  }
2590
2369
  throw new Error('venueBooking解决方案需要 order 模块支持');
2591
2370
  case 6:
2592
- _context25.next = 8;
2371
+ _context24.next = 8;
2593
2372
  return this.store.order.submitTempOrder({
2594
2373
  cacheId: this.cacheId,
2595
- platform: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.platform,
2596
- businessCode: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2597
- channel: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.channel,
2598
- type: (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.type
2374
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
2375
+ businessCode: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode,
2376
+ channel: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.channel,
2377
+ type: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type
2599
2378
  });
2600
2379
  case 8:
2601
- result = _context25.sent;
2380
+ result = _context24.sent;
2602
2381
  tempOrder = this.store.order.getTempOrder();
2603
2382
  this.logMethodSuccess('submitOrder', {
2604
2383
  productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.length) || 0
2605
2384
  });
2606
- return _context25.abrupt("return", result);
2385
+ return _context24.abrupt("return", result);
2607
2386
  case 14:
2608
- _context25.prev = 14;
2609
- _context25.t0 = _context25["catch"](1);
2610
- this.logMethodError('submitOrder', _context25.t0);
2611
- throw _context25.t0;
2387
+ _context24.prev = 14;
2388
+ _context24.t0 = _context24["catch"](1);
2389
+ this.logMethodError('submitOrder', _context24.t0);
2390
+ throw _context24.t0;
2612
2391
  case 18:
2613
2392
  case "end":
2614
- return _context25.stop();
2393
+ return _context24.stop();
2615
2394
  }
2616
- }, _callee25, this, [[1, 14]]);
2395
+ }, _callee24, this, [[1, 14]]);
2617
2396
  }));
2618
2397
  function submitOrder() {
2619
2398
  return _submitOrder.apply(this, arguments);
@@ -2623,23 +2402,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2623
2402
  }, {
2624
2403
  key: "addProductToOrder",
2625
2404
  value: function () {
2626
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2627
- var _product$metadata6, _product$product_vari2, quotationPrice, products;
2628
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2629
- while (1) switch (_context26.prev = _context26.next) {
2405
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
2406
+ var _product$metadata5, _product$product_vari2, quotationPrice, products;
2407
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2408
+ while (1) switch (_context25.prev = _context25.next) {
2630
2409
  case 0:
2631
2410
  this.logMethodStart('addProductToOrder', {
2632
2411
  product_id: product.product_id,
2633
2412
  product_variant_id: product.product_variant_id
2634
2413
  });
2635
- _context26.prev = 1;
2414
+ _context25.prev = 1;
2636
2415
  if (this.store.order) {
2637
- _context26.next = 4;
2416
+ _context25.next = 4;
2638
2417
  break;
2639
2418
  }
2640
2419
  throw new Error('order 模块未初始化');
2641
2420
  case 4:
2642
- if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && this.store.quotation && product.product_id != null) {
2421
+ if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
2643
2422
  quotationPrice = this.store.quotation.getPriceForProduct({
2644
2423
  productId: product.product_id,
2645
2424
  variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
@@ -2652,32 +2431,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2652
2431
  product.original_price = product.selling_price;
2653
2432
  }
2654
2433
  }
2655
- _context26.next = 7;
2434
+ _context25.next = 7;
2656
2435
  return this.store.order.addProductToOrder(product);
2657
2436
  case 7:
2658
- products = _context26.sent;
2659
- _context26.next = 10;
2437
+ products = _context25.sent;
2438
+ _context25.next = 10;
2660
2439
  return this.refreshItemRuleQuantityLimits();
2661
2440
  case 10:
2662
- _context26.next = 12;
2441
+ _context25.next = 12;
2663
2442
  return this.refreshCartValidationPassed();
2664
2443
  case 12:
2665
2444
  this.logMethodSuccess('addProductToOrder', {
2666
2445
  productCount: products.length
2667
2446
  });
2668
- return _context26.abrupt("return", products);
2447
+ return _context25.abrupt("return", products);
2669
2448
  case 16:
2670
- _context26.prev = 16;
2671
- _context26.t0 = _context26["catch"](1);
2672
- this.logMethodError('addProductToOrder', _context26.t0);
2673
- throw _context26.t0;
2449
+ _context25.prev = 16;
2450
+ _context25.t0 = _context25["catch"](1);
2451
+ this.logMethodError('addProductToOrder', _context25.t0);
2452
+ throw _context25.t0;
2674
2453
  case 20:
2675
2454
  case "end":
2676
- return _context26.stop();
2455
+ return _context25.stop();
2677
2456
  }
2678
- }, _callee26, this, [[1, 16]]);
2457
+ }, _callee25, this, [[1, 16]]);
2679
2458
  }));
2680
- function addProductToOrder(_x17) {
2459
+ function addProductToOrder(_x16) {
2681
2460
  return _addProductToOrder.apply(this, arguments);
2682
2461
  }
2683
2462
  return addProductToOrder;
@@ -2685,48 +2464,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2685
2464
  }, {
2686
2465
  key: "updateOrderProduct",
2687
2466
  value: function () {
2688
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2467
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2689
2468
  var products;
2690
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2691
- while (1) switch (_context27.prev = _context27.next) {
2469
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2470
+ while (1) switch (_context26.prev = _context26.next) {
2692
2471
  case 0:
2693
2472
  this.logMethodStart('updateOrderProduct', {
2694
2473
  product_id: params.product_id,
2695
2474
  product_variant_id: params.product_variant_id
2696
2475
  });
2697
- _context27.prev = 1;
2476
+ _context26.prev = 1;
2698
2477
  if (this.store.order) {
2699
- _context27.next = 4;
2478
+ _context26.next = 4;
2700
2479
  break;
2701
2480
  }
2702
2481
  throw new Error('order 模块未初始化');
2703
2482
  case 4:
2704
- _context27.next = 6;
2483
+ _context26.next = 6;
2705
2484
  return this.store.order.updateOrderProduct(params);
2706
2485
  case 6:
2707
- products = _context27.sent;
2708
- _context27.next = 9;
2486
+ products = _context26.sent;
2487
+ _context26.next = 9;
2709
2488
  return this.refreshItemRuleQuantityLimits();
2710
2489
  case 9:
2711
- _context27.next = 11;
2490
+ _context26.next = 11;
2712
2491
  return this.refreshCartValidationPassed();
2713
2492
  case 11:
2714
2493
  this.logMethodSuccess('updateOrderProduct', {
2715
2494
  productCount: products.length
2716
2495
  });
2717
- return _context27.abrupt("return", products);
2496
+ return _context26.abrupt("return", products);
2718
2497
  case 15:
2719
- _context27.prev = 15;
2720
- _context27.t0 = _context27["catch"](1);
2721
- this.logMethodError('updateOrderProduct', _context27.t0);
2722
- throw _context27.t0;
2498
+ _context26.prev = 15;
2499
+ _context26.t0 = _context26["catch"](1);
2500
+ this.logMethodError('updateOrderProduct', _context26.t0);
2501
+ throw _context26.t0;
2723
2502
  case 19:
2724
2503
  case "end":
2725
- return _context27.stop();
2504
+ return _context26.stop();
2726
2505
  }
2727
- }, _callee27, this, [[1, 15]]);
2506
+ }, _callee26, this, [[1, 15]]);
2728
2507
  }));
2729
- function updateOrderProduct(_x18) {
2508
+ function updateOrderProduct(_x17) {
2730
2509
  return _updateOrderProduct.apply(this, arguments);
2731
2510
  }
2732
2511
  return updateOrderProduct;
@@ -2734,66 +2513,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2734
2513
  }, {
2735
2514
  key: "removeProductFromOrder",
2736
2515
  value: function () {
2737
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2738
- var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2739
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2740
- while (1) switch (_context28.prev = _context28.next) {
2516
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
2517
+ var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator15, _step15, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order8;
2518
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2519
+ while (1) switch (_context27.prev = _context27.next) {
2741
2520
  case 0:
2742
2521
  this.logMethodStart('removeProductFromOrder', {
2743
2522
  product_id: identity.product_id,
2744
2523
  product_variant_id: identity.product_variant_id
2745
2524
  });
2746
- _context28.prev = 1;
2525
+ _context27.prev = 1;
2747
2526
  if (this.store.order) {
2748
- _context28.next = 4;
2527
+ _context27.next = 4;
2749
2528
  break;
2750
2529
  }
2751
2530
  throw new Error('order 模块未初始化');
2752
2531
  case 4:
2753
- tempOrder = ((_this$store$order$get3 = (_this$store$order8 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order8)) || ((_this$store$order$ens = (_this$store$order9 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order9));
2754
- _context28.next = 7;
2532
+ tempOrder = ((_this$store$order$get3 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6)) || ((_this$store$order$ens = (_this$store$order7 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order7));
2533
+ _context27.next = 7;
2755
2534
  return this.store.order.removeProductFromOrder(identity);
2756
2535
  case 7:
2757
- products = _context28.sent;
2536
+ products = _context27.sent;
2758
2537
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
2759
- _context28.next = 33;
2538
+ _context27.next = 33;
2760
2539
  break;
2761
2540
  }
2762
2541
  venueProductUids = new Set();
2763
2542
  venueBookingUids = new Set();
2764
- _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2765
- _context28.prev = 12;
2766
- _iterator16.s();
2543
+ _iterator15 = _createForOfIteratorHelper(tempOrder.products || []);
2544
+ _context27.prev = 12;
2545
+ _iterator15.s();
2767
2546
  case 14:
2768
- if ((_step16 = _iterator16.n()).done) {
2769
- _context28.next = 22;
2547
+ if ((_step15 = _iterator15.n()).done) {
2548
+ _context27.next = 22;
2770
2549
  break;
2771
2550
  }
2772
- product = _step16.value;
2773
- if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2774
- _context28.next = 18;
2551
+ product = _step15.value;
2552
+ if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
2553
+ _context27.next = 18;
2775
2554
  break;
2776
2555
  }
2777
- return _context28.abrupt("continue", 20);
2556
+ return _context27.abrupt("continue", 20);
2778
2557
  case 18:
2779
2558
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2780
- if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2559
+ if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2781
2560
  venueBookingUids.add(String(product.metadata.booking_uid));
2782
2561
  }
2783
2562
  case 20:
2784
- _context28.next = 14;
2563
+ _context27.next = 14;
2785
2564
  break;
2786
2565
  case 22:
2787
- _context28.next = 27;
2566
+ _context27.next = 27;
2788
2567
  break;
2789
2568
  case 24:
2790
- _context28.prev = 24;
2791
- _context28.t0 = _context28["catch"](12);
2792
- _iterator16.e(_context28.t0);
2569
+ _context27.prev = 24;
2570
+ _context27.t0 = _context27["catch"](12);
2571
+ _iterator15.e(_context27.t0);
2793
2572
  case 27:
2794
- _context28.prev = 27;
2795
- _iterator16.f();
2796
- return _context28.finish(27);
2573
+ _context27.prev = 27;
2574
+ _iterator15.f();
2575
+ return _context27.finish(27);
2797
2576
  case 30:
2798
2577
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
2799
2578
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
@@ -2807,31 +2586,31 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2807
2586
  return true;
2808
2587
  });
2809
2588
  if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
2810
- (_this$store$order$per = (_this$store$order10 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order10);
2589
+ (_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
2811
2590
  }
2812
2591
  case 33:
2813
- _context28.next = 35;
2592
+ _context27.next = 35;
2814
2593
  return this.refreshItemRuleQuantityLimits();
2815
2594
  case 35:
2816
- _context28.next = 37;
2595
+ _context27.next = 37;
2817
2596
  return this.refreshCartValidationPassed();
2818
2597
  case 37:
2819
2598
  this.logMethodSuccess('removeProductFromOrder', {
2820
2599
  productCount: products.length
2821
2600
  });
2822
- return _context28.abrupt("return", products);
2601
+ return _context27.abrupt("return", products);
2823
2602
  case 41:
2824
- _context28.prev = 41;
2825
- _context28.t1 = _context28["catch"](1);
2826
- this.logMethodError('removeProductFromOrder', _context28.t1);
2827
- throw _context28.t1;
2603
+ _context27.prev = 41;
2604
+ _context27.t1 = _context27["catch"](1);
2605
+ this.logMethodError('removeProductFromOrder', _context27.t1);
2606
+ throw _context27.t1;
2828
2607
  case 45:
2829
2608
  case "end":
2830
- return _context28.stop();
2609
+ return _context27.stop();
2831
2610
  }
2832
- }, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
2611
+ }, _callee27, this, [[1, 41], [12, 24, 27, 30]]);
2833
2612
  }));
2834
- function removeProductFromOrder(_x19) {
2613
+ function removeProductFromOrder(_x18) {
2835
2614
  return _removeProductFromOrder.apply(this, arguments);
2836
2615
  }
2837
2616
  return removeProductFromOrder;
@@ -2839,27 +2618,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2839
2618
  }, {
2840
2619
  key: "getProductList",
2841
2620
  value: function () {
2842
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2621
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2843
2622
  var result;
2844
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2845
- while (1) switch (_context29.prev = _context29.next) {
2623
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2624
+ while (1) switch (_context28.prev = _context28.next) {
2846
2625
  case 0:
2847
2626
  if (!this.productsLoaded) {
2848
- _context29.next = 2;
2627
+ _context28.next = 2;
2849
2628
  break;
2850
2629
  }
2851
- return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2630
+ return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2852
2631
  case 2:
2853
- _context29.next = 4;
2632
+ _context28.next = 4;
2854
2633
  return this.loadAllProducts();
2855
2634
  case 4:
2856
- result = _context29.sent;
2857
- return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2635
+ result = _context28.sent;
2636
+ return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2858
2637
  case 6:
2859
2638
  case "end":
2860
- return _context29.stop();
2639
+ return _context28.stop();
2861
2640
  }
2862
- }, _callee29, this);
2641
+ }, _callee28, this);
2863
2642
  }));
2864
2643
  function getProductList() {
2865
2644
  return _getProductList.apply(this, arguments);
@@ -2869,13 +2648,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2869
2648
  }, {
2870
2649
  key: "loadOpenDataConfig",
2871
2650
  value: function () {
2872
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2651
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2873
2652
  var lastFetchedAt, cachedData, openDataConfig;
2874
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2875
- while (1) switch (_context30.prev = _context30.next) {
2653
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2654
+ while (1) switch (_context29.prev = _context29.next) {
2876
2655
  case 0:
2877
2656
  if (this.store.openData) {
2878
- _context30.next = 2;
2657
+ _context29.next = 2;
2879
2658
  break;
2880
2659
  }
2881
2660
  throw new Error('openData 模块未初始化');
@@ -2883,42 +2662,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2883
2662
  lastFetchedAt = this.store.openData.getLastFetchedAt();
2884
2663
  cachedData = this.store.openData.getOpenData();
2885
2664
  if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
2886
- _context30.next = 7;
2665
+ _context29.next = 7;
2887
2666
  break;
2888
2667
  }
2889
2668
  this.otherParams.openData = cachedData;
2890
- return _context30.abrupt("return", cachedData);
2669
+ return _context29.abrupt("return", cachedData);
2891
2670
  case 7:
2892
2671
  if (!this.loadOpenDataConfigInFlight) {
2893
- _context30.next = 11;
2672
+ _context29.next = 11;
2894
2673
  break;
2895
2674
  }
2896
- _context30.next = 10;
2675
+ _context29.next = 10;
2897
2676
  return this.loadOpenDataConfigInFlight;
2898
2677
  case 10:
2899
- return _context30.abrupt("return", _context30.sent);
2678
+ return _context29.abrupt("return", _context29.sent);
2900
2679
  case 11:
2901
2680
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2902
2681
  scope: 'board',
2903
2682
  target: 'venue_booking+online_store',
2904
2683
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2905
2684
  });
2906
- _context30.prev = 12;
2907
- _context30.next = 15;
2685
+ _context29.prev = 12;
2686
+ _context29.next = 15;
2908
2687
  return this.loadOpenDataConfigInFlight;
2909
2688
  case 15:
2910
- openDataConfig = _context30.sent;
2689
+ openDataConfig = _context29.sent;
2911
2690
  this.otherParams.openData = openDataConfig;
2912
- return _context30.abrupt("return", openDataConfig);
2691
+ return _context29.abrupt("return", openDataConfig);
2913
2692
  case 18:
2914
- _context30.prev = 18;
2693
+ _context29.prev = 18;
2915
2694
  this.loadOpenDataConfigInFlight = null;
2916
- return _context30.finish(18);
2695
+ return _context29.finish(18);
2917
2696
  case 21:
2918
2697
  case "end":
2919
- return _context30.stop();
2698
+ return _context29.stop();
2920
2699
  }
2921
- }, _callee30, this, [[12,, 18, 21]]);
2700
+ }, _callee29, this, [[12,, 18, 21]]);
2922
2701
  }));
2923
2702
  function loadOpenDataConfig() {
2924
2703
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2928,29 +2707,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2928
2707
  }, {
2929
2708
  key: "loadRuntimeConfigs",
2930
2709
  value: function () {
2931
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2710
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2932
2711
  var itemRuleConfigs;
2933
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2934
- while (1) switch (_context31.prev = _context31.next) {
2712
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2713
+ while (1) switch (_context30.prev = _context30.next) {
2935
2714
  case 0:
2936
- _context31.next = 2;
2715
+ _context30.next = 2;
2937
2716
  return this.loadOpenDataConfig();
2938
2717
  case 2:
2939
- _context31.next = 4;
2718
+ _context30.next = 4;
2940
2719
  return this.ensureItemRuleConfigsLoaded();
2941
2720
  case 4:
2942
- itemRuleConfigs = _context31.sent;
2721
+ itemRuleConfigs = _context30.sent;
2943
2722
  this.logMethodSuccess('loadRuntimeConfigs', {
2944
2723
  itemRuleCount: itemRuleConfigs.length
2945
2724
  });
2946
- return _context31.abrupt("return", {
2725
+ return _context30.abrupt("return", {
2947
2726
  itemRuleConfigs: itemRuleConfigs
2948
2727
  });
2949
2728
  case 7:
2950
2729
  case "end":
2951
- return _context31.stop();
2730
+ return _context30.stop();
2952
2731
  }
2953
- }, _callee31, this);
2732
+ }, _callee30, this);
2954
2733
  }));
2955
2734
  function loadRuntimeConfigs() {
2956
2735
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -2960,22 +2739,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2960
2739
  }, {
2961
2740
  key: "fetchItemRuleConfigsByModelIds",
2962
2741
  value: function () {
2963
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
2742
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(strategyModelIds) {
2964
2743
  var result, configs;
2965
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2966
- while (1) switch (_context32.prev = _context32.next) {
2744
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2745
+ while (1) switch (_context31.prev = _context31.next) {
2967
2746
  case 0:
2968
2747
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
2969
2748
  strategyModelIds: strategyModelIds
2970
2749
  });
2971
2750
  if (strategyModelIds.length) {
2972
- _context32.next = 3;
2751
+ _context31.next = 3;
2973
2752
  break;
2974
2753
  }
2975
- return _context32.abrupt("return", []);
2754
+ return _context31.abrupt("return", []);
2976
2755
  case 3:
2977
- _context32.prev = 3;
2978
- _context32.next = 6;
2756
+ _context31.prev = 3;
2757
+ _context31.next = 6;
2979
2758
  return this.request.get('/promotion', {
2980
2759
  skip: 1,
2981
2760
  num: 99,
@@ -2983,7 +2762,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2983
2762
  ids: strategyModelIds
2984
2763
  });
2985
2764
  case 6:
2986
- result = _context32.sent;
2765
+ result = _context31.sent;
2987
2766
  configs = [];
2988
2767
  if (result.code === 200) {
2989
2768
  configs = result.data.list.map(function (item) {
@@ -2994,21 +2773,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2994
2773
  strategyModelIds: strategyModelIds,
2995
2774
  strategyCount: configs.length
2996
2775
  });
2997
- return _context32.abrupt("return", configs);
2776
+ return _context31.abrupt("return", configs);
2998
2777
  case 13:
2999
- _context32.prev = 13;
3000
- _context32.t0 = _context32["catch"](3);
3001
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
2778
+ _context31.prev = 13;
2779
+ _context31.t0 = _context31["catch"](3);
2780
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context31.t0, {
3002
2781
  strategyModelIds: strategyModelIds
3003
2782
  });
3004
- return _context32.abrupt("return", []);
2783
+ return _context31.abrupt("return", []);
3005
2784
  case 17:
3006
2785
  case "end":
3007
- return _context32.stop();
2786
+ return _context31.stop();
3008
2787
  }
3009
- }, _callee32, this, [[3, 13]]);
2788
+ }, _callee31, this, [[3, 13]]);
3010
2789
  }));
3011
- function fetchItemRuleConfigsByModelIds(_x20) {
2790
+ function fetchItemRuleConfigsByModelIds(_x19) {
3012
2791
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
3013
2792
  }
3014
2793
  return fetchItemRuleConfigsByModelIds;
@@ -3016,22 +2795,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3016
2795
  }, {
3017
2796
  key: "buildPrefillProductSourceMap",
3018
2797
  value: function () {
3019
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2798
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
3020
2799
  var sourceMap, productList, visited, collectFromValue;
3021
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3022
- while (1) switch (_context33.prev = _context33.next) {
2800
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2801
+ while (1) switch (_context32.prev = _context32.next) {
3023
2802
  case 0:
3024
2803
  sourceMap = new Map();
3025
- _context33.prev = 1;
3026
- _context33.next = 4;
2804
+ _context32.prev = 1;
2805
+ _context32.next = 4;
3027
2806
  return this.getProductList();
3028
2807
  case 4:
3029
- productList = _context33.sent;
2808
+ productList = _context32.sent;
3030
2809
  if (Array.isArray(productList)) {
3031
- _context33.next = 7;
2810
+ _context32.next = 7;
3032
2811
  break;
3033
2812
  }
3034
- return _context33.abrupt("return", sourceMap);
2813
+ return _context32.abrupt("return", sourceMap);
3035
2814
  case 7:
3036
2815
  visited = new Set();
3037
2816
  collectFromValue = function collectFromValue(value) {
@@ -3040,17 +2819,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3040
2819
  if (visited.has(value)) return;
3041
2820
  visited.add(value);
3042
2821
  if (Array.isArray(value)) {
3043
- var _iterator17 = _createForOfIteratorHelper(value),
3044
- _step17;
2822
+ var _iterator16 = _createForOfIteratorHelper(value),
2823
+ _step16;
3045
2824
  try {
3046
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
3047
- var item = _step17.value;
2825
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
2826
+ var item = _step16.value;
3048
2827
  collectFromValue(item);
3049
2828
  }
3050
2829
  } catch (err) {
3051
- _iterator17.e(err);
2830
+ _iterator16.e(err);
3052
2831
  } finally {
3053
- _iterator17.f();
2832
+ _iterator16.f();
3054
2833
  }
3055
2834
  return;
3056
2835
  }
@@ -3058,8 +2837,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3058
2837
  var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
3059
2838
  var productId = Number(rawProductId);
3060
2839
  if (Number.isFinite(productId) && productId > 0) {
3061
- var _ref5, _node$product_variant;
3062
- var productVariantId = Number((_ref5 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0);
2840
+ var _ref3, _node$product_variant;
2841
+ var productVariantId = Number((_ref3 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref3 !== void 0 ? _ref3 : 0);
3063
2842
  var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
3064
2843
  var key = buildProductKey(productId, normalizedVariantId);
3065
2844
  if (!sourceMap.has(key)) sourceMap.set(key, node);
@@ -3070,19 +2849,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3070
2849
  }
3071
2850
  };
3072
2851
  collectFromValue(productList);
3073
- _context33.next = 15;
2852
+ _context32.next = 15;
3074
2853
  break;
3075
2854
  case 12:
3076
- _context33.prev = 12;
3077
- _context33.t0 = _context33["catch"](1);
3078
- this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
2855
+ _context32.prev = 12;
2856
+ _context32.t0 = _context32["catch"](1);
2857
+ this.logMethodError('buildPrefillProductSourceMap', _context32.t0);
3079
2858
  case 15:
3080
- return _context33.abrupt("return", sourceMap);
2859
+ return _context32.abrupt("return", sourceMap);
3081
2860
  case 16:
3082
2861
  case "end":
3083
- return _context33.stop();
2862
+ return _context32.stop();
3084
2863
  }
3085
- }, _callee33, this, [[1, 12]]);
2864
+ }, _callee32, this, [[1, 12]]);
3086
2865
  }));
3087
2866
  function buildPrefillProductSourceMap() {
3088
2867
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -3097,56 +2876,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3097
2876
  }, {
3098
2877
  key: "ensureItemRuleConfigsLoaded",
3099
2878
  value: function () {
3100
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2879
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3101
2880
  var _this11 = this;
3102
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3103
- while (1) switch (_context35.prev = _context35.next) {
2881
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2882
+ while (1) switch (_context34.prev = _context34.next) {
3104
2883
  case 0:
3105
2884
  if (!(this.itemRuleConfigs.length > 0)) {
3106
- _context35.next = 2;
2885
+ _context34.next = 2;
3107
2886
  break;
3108
2887
  }
3109
- return _context35.abrupt("return", this.itemRuleConfigs);
2888
+ return _context34.abrupt("return", this.itemRuleConfigs);
3110
2889
  case 2:
3111
2890
  if (!this.itemRuleConfigsPromise) {
3112
- _context35.next = 4;
2891
+ _context34.next = 4;
3113
2892
  break;
3114
2893
  }
3115
- return _context35.abrupt("return", this.itemRuleConfigsPromise);
2894
+ return _context34.abrupt("return", this.itemRuleConfigsPromise);
3116
2895
  case 4:
3117
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2896
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3118
2897
  var runtimeConfig, staticConfigs;
3119
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3120
- while (1) switch (_context34.prev = _context34.next) {
2898
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2899
+ while (1) switch (_context33.prev = _context33.next) {
3121
2900
  case 0:
3122
2901
  runtimeConfig = _this11.getItemRuleRuntimeConfig();
3123
2902
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3124
2903
  if (!(staticConfigs.length > 0)) {
3125
- _context34.next = 6;
2904
+ _context33.next = 6;
3126
2905
  break;
3127
2906
  }
3128
2907
  _this11.itemRuleConfigs = staticConfigs;
3129
2908
  _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3130
- return _context34.abrupt("return", _this11.itemRuleConfigs);
2909
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
3131
2910
  case 6:
3132
2911
  _this11.itemRuleConfigs = [];
3133
2912
  _this11.itemRuleEvaluator.setStrategyConfigs([]);
3134
- return _context34.abrupt("return", _this11.itemRuleConfigs);
2913
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
3135
2914
  case 9:
3136
2915
  case "end":
3137
- return _context34.stop();
2916
+ return _context33.stop();
3138
2917
  }
3139
- }, _callee34);
2918
+ }, _callee33);
3140
2919
  }))();
3141
- _context35.next = 7;
2920
+ _context34.next = 7;
3142
2921
  return this.itemRuleConfigsPromise;
3143
2922
  case 7:
3144
- return _context35.abrupt("return", _context35.sent);
2923
+ return _context34.abrupt("return", _context34.sent);
3145
2924
  case 8:
3146
2925
  case "end":
3147
- return _context35.stop();
2926
+ return _context34.stop();
3148
2927
  }
3149
- }, _callee35, this);
2928
+ }, _callee34, this);
3150
2929
  }));
3151
2930
  function ensureItemRuleConfigsLoaded() {
3152
2931
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -3156,25 +2935,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3156
2935
  }, {
3157
2936
  key: "refreshItemRuleQuantityLimits",
3158
2937
  value: function () {
3159
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2938
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3160
2939
  var strategyConfigs, businessData, limits;
3161
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3162
- while (1) switch (_context36.prev = _context36.next) {
2940
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2941
+ while (1) switch (_context35.prev = _context35.next) {
3163
2942
  case 0:
3164
- _context36.prev = 0;
3165
- _context36.next = 3;
2943
+ _context35.prev = 0;
2944
+ _context35.next = 3;
3166
2945
  return this.ensureItemRuleConfigsLoaded();
3167
2946
  case 3:
3168
- strategyConfigs = _context36.sent;
2947
+ strategyConfigs = _context35.sent;
3169
2948
  if (strategyConfigs.length) {
3170
- _context36.next = 7;
2949
+ _context35.next = 7;
3171
2950
  break;
3172
2951
  }
3173
2952
  this.store.itemRuleQuantityLimits = [];
3174
- return _context36.abrupt("return", []);
2953
+ return _context35.abrupt("return", []);
3175
2954
  case 7:
3176
2955
  businessData = buildItemRuleBusinessData({
3177
- tempOrder: this.ensureVenueTempOrder(),
2956
+ tempOrder: this.ensureTempOrder(),
3178
2957
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3179
2958
  itemRuleConfigs: this.itemRuleConfigs
3180
2959
  });
@@ -3183,18 +2962,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3183
2962
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
3184
2963
  limitCount: limits.length
3185
2964
  });
3186
- return _context36.abrupt("return", limits);
2965
+ return _context35.abrupt("return", limits);
3187
2966
  case 14:
3188
- _context36.prev = 14;
3189
- _context36.t0 = _context36["catch"](0);
2967
+ _context35.prev = 14;
2968
+ _context35.t0 = _context35["catch"](0);
3190
2969
  this.store.itemRuleQuantityLimits = [];
3191
- this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
3192
- return _context36.abrupt("return", []);
2970
+ this.logMethodError('refreshItemRuleQuantityLimits', _context35.t0);
2971
+ return _context35.abrupt("return", []);
3193
2972
  case 19:
3194
2973
  case "end":
3195
- return _context36.stop();
2974
+ return _context35.stop();
3196
2975
  }
3197
- }, _callee36, this, [[0, 14]]);
2976
+ }, _callee35, this, [[0, 14]]);
3198
2977
  }));
3199
2978
  function refreshItemRuleQuantityLimits() {
3200
2979
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -3204,75 +2983,75 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3204
2983
  }, {
3205
2984
  key: "applyPrefillByItemRule",
3206
2985
  value: function () {
3207
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3208
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata9, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
3209
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3210
- while (1) switch (_context37.prev = _context37.next) {
2986
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2987
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator17, _step17, _prefillItem$product_, _origin2, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
2988
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2989
+ while (1) switch (_context36.prev = _context36.next) {
3211
2990
  case 0:
3212
2991
  if (!this.itemRulePrefillApplied) {
3213
- _context37.next = 2;
2992
+ _context36.next = 2;
3214
2993
  break;
3215
2994
  }
3216
- return _context37.abrupt("return");
2995
+ return _context36.abrupt("return");
3217
2996
  case 2:
3218
2997
  if (this.store.order) {
3219
- _context37.next = 4;
2998
+ _context36.next = 4;
3220
2999
  break;
3221
3000
  }
3222
- return _context37.abrupt("return");
3001
+ return _context36.abrupt("return");
3223
3002
  case 4:
3224
- _context37.next = 6;
3003
+ _context36.next = 6;
3225
3004
  return this.ensureItemRuleConfigsLoaded();
3226
3005
  case 6:
3227
- strategyConfigs = _context37.sent;
3006
+ strategyConfigs = _context36.sent;
3228
3007
  if (strategyConfigs.length) {
3229
- _context37.next = 9;
3008
+ _context36.next = 9;
3230
3009
  break;
3231
3010
  }
3232
- return _context37.abrupt("return");
3011
+ return _context36.abrupt("return");
3233
3012
  case 9:
3234
3013
  businessData = buildItemRuleBusinessData({
3235
- tempOrder: this.ensureVenueTempOrder(),
3014
+ tempOrder: this.ensureTempOrder(),
3236
3015
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3237
3016
  itemRuleConfigs: this.itemRuleConfigs
3238
3017
  });
3239
3018
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
3240
3019
  if (prefillItems.length) {
3241
- _context37.next = 14;
3020
+ _context36.next = 14;
3242
3021
  break;
3243
3022
  }
3244
3023
  this.itemRulePrefillApplied = true;
3245
- return _context37.abrupt("return");
3024
+ return _context36.abrupt("return");
3246
3025
  case 14:
3247
- _context37.next = 16;
3026
+ _context36.next = 16;
3248
3027
  return this.buildPrefillProductSourceMap();
3249
3028
  case 16:
3250
- productSourceMap = _context37.sent;
3251
- tempOrder = this.ensureVenueTempOrder();
3029
+ productSourceMap = _context36.sent;
3030
+ tempOrder = this.ensureTempOrder();
3252
3031
  hasChanges = false;
3253
- _iterator18 = _createForOfIteratorHelper(prefillItems);
3254
- _context37.prev = 20;
3255
- _iterator18.s();
3032
+ _iterator17 = _createForOfIteratorHelper(prefillItems);
3033
+ _context36.prev = 20;
3034
+ _iterator17.s();
3256
3035
  case 22:
3257
- if ((_step18 = _iterator18.n()).done) {
3258
- _context37.next = 51;
3036
+ if ((_step17 = _iterator17.n()).done) {
3037
+ _context36.next = 45;
3259
3038
  break;
3260
3039
  }
3261
- prefillItem = _step18.value;
3040
+ prefillItem = _step17.value;
3262
3041
  productId = Number(prefillItem.product_id);
3263
3042
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3264
3043
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
3265
3044
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
3266
- _context37.next = 29;
3045
+ _context36.next = 29;
3267
3046
  break;
3268
3047
  }
3269
- return _context37.abrupt("continue", 49);
3048
+ return _context36.abrupt("continue", 43);
3270
3049
  case 29:
3271
3050
  if (!Number.isNaN(productVariantId)) {
3272
- _context37.next = 31;
3051
+ _context36.next = 31;
3273
3052
  break;
3274
3053
  }
3275
- return _context37.abrupt("continue", 49);
3054
+ return _context36.abrupt("continue", 43);
3276
3055
  case 31:
3277
3056
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
3278
3057
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -3280,15 +3059,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3280
3059
  product_variant_id: productVariantId
3281
3060
  });
3282
3061
  if (!(productIndex === -1)) {
3283
- _context37.next = 42;
3062
+ _context36.next = 38;
3284
3063
  break;
3285
3064
  }
3286
3065
  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');
3287
- origin = _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3288
- item_rule_prefill: true,
3289
- item_rule_id: prefillItem.ruleId
3290
- });
3291
- product = normalizeOrderProduct({
3066
+ tempOrder.products.push(normalizeOrderProduct({
3292
3067
  product_id: productId,
3293
3068
  product_variant_id: productVariantId,
3294
3069
  num: targetQuantity,
@@ -3298,17 +3073,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3298
3073
  item_rule_prefill: true,
3299
3074
  item_rule_id: prefillItem.ruleId
3300
3075
  },
3301
- _origin: origin
3302
- });
3303
- productUid = String(((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number) || '');
3304
- this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
3305
- tempOrder.products.push(product);
3076
+ _origin: _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
3077
+ item_rule_prefill: true,
3078
+ item_rule_id: prefillItem.ruleId
3079
+ })
3080
+ }));
3306
3081
  hasChanges = true;
3307
- return _context37.abrupt("continue", 49);
3308
- case 42:
3082
+ return _context36.abrupt("continue", 43);
3083
+ case 38:
3309
3084
  targetProduct = tempOrder.products[productIndex];
3310
- previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
3311
- nextOrigin = sourceItem ? _objectSpread(_objectSpread({}, previousOrigin || {}), sourceItem) : previousOrigin;
3312
3085
  existedQuantity = toNonNegativeInt(targetProduct.num);
3313
3086
  delta = targetQuantity - existedQuantity;
3314
3087
  nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), delta > 0 ? {
@@ -3317,55 +3090,54 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3317
3090
  metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
3318
3091
  item_rule_prefill: true,
3319
3092
  item_rule_id: prefillItem.ruleId
3320
- })
3093
+ }),
3094
+ _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
3321
3095
  });
3322
- if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
3323
- _productUid = String(((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.unique_identification_number) || '');
3324
- this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
3096
+ if (delta > 0 || Boolean(sourceItem && (!targetProduct._origin || ((_origin2 = targetProduct._origin) === null || _origin2 === void 0 ? void 0 : _origin2.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
3325
3097
  tempOrder.products[productIndex] = nextProduct;
3326
3098
  hasChanges = true;
3327
3099
  }
3328
- case 49:
3329
- _context37.next = 22;
3100
+ case 43:
3101
+ _context36.next = 22;
3330
3102
  break;
3331
- case 51:
3332
- _context37.next = 56;
3103
+ case 45:
3104
+ _context36.next = 50;
3333
3105
  break;
3106
+ case 47:
3107
+ _context36.prev = 47;
3108
+ _context36.t0 = _context36["catch"](20);
3109
+ _iterator17.e(_context36.t0);
3110
+ case 50:
3111
+ _context36.prev = 50;
3112
+ _iterator17.f();
3113
+ return _context36.finish(50);
3334
3114
  case 53:
3335
- _context37.prev = 53;
3336
- _context37.t0 = _context37["catch"](20);
3337
- _iterator18.e(_context37.t0);
3338
- case 56:
3339
- _context37.prev = 56;
3340
- _iterator18.f();
3341
- return _context37.finish(56);
3342
- case 59:
3343
3115
  if (!hasChanges) {
3344
- _context37.next = 64;
3116
+ _context36.next = 58;
3345
3117
  break;
3346
3118
  }
3347
3119
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
3348
3120
  this.store.order.applyDiscount();
3349
- _context37.next = 63;
3121
+ _context36.next = 57;
3350
3122
  return this.store.order.recalculateSummary({
3351
3123
  createIfMissing: true
3352
3124
  });
3353
- case 63:
3125
+ case 57:
3354
3126
  this.store.order.persistTempOrder();
3355
- case 64:
3356
- _context37.next = 66;
3127
+ case 58:
3128
+ _context36.next = 60;
3357
3129
  return this.refreshItemRuleQuantityLimits();
3358
- case 66:
3130
+ case 60:
3359
3131
  this.itemRulePrefillApplied = true;
3360
3132
  this.logMethodSuccess('applyPrefillByItemRule', {
3361
3133
  prefillCount: prefillItems.length,
3362
3134
  hasChanges: hasChanges
3363
3135
  });
3364
- case 68:
3136
+ case 62:
3365
3137
  case "end":
3366
- return _context37.stop();
3138
+ return _context36.stop();
3367
3139
  }
3368
- }, _callee37, this, [[20, 53, 56, 59]]);
3140
+ }, _callee36, this, [[20, 47, 50, 53]]);
3369
3141
  }));
3370
3142
  function applyPrefillByItemRule() {
3371
3143
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -3375,24 +3147,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3375
3147
  }, {
3376
3148
  key: "applyItemRulePrefill",
3377
3149
  value: function () {
3378
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3379
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3380
- while (1) switch (_context38.prev = _context38.next) {
3150
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3151
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3152
+ while (1) switch (_context37.prev = _context37.next) {
3381
3153
  case 0:
3382
3154
  this.logMethodStart('applyItemRulePrefill');
3383
- _context38.next = 3;
3155
+ _context37.next = 3;
3384
3156
  return this.applyPrefillByItemRule();
3385
3157
  case 3:
3386
- _context38.next = 5;
3158
+ _context37.next = 5;
3387
3159
  return this.refreshItemRuleQuantityLimits();
3388
3160
  case 5:
3389
- _context38.next = 7;
3161
+ _context37.next = 7;
3390
3162
  return this.refreshCartValidationPassed();
3391
3163
  case 7:
3392
3164
  case "end":
3393
- return _context38.stop();
3165
+ return _context37.stop();
3394
3166
  }
3395
- }, _callee38, this);
3167
+ }, _callee37, this);
3396
3168
  }));
3397
3169
  function applyItemRulePrefill() {
3398
3170
  return _applyItemRulePrefill.apply(this, arguments);
@@ -3402,35 +3174,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3402
3174
  }, {
3403
3175
  key: "evaluateCartValidationByItemRule",
3404
3176
  value: function () {
3405
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3177
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3406
3178
  var strategyConfigs, businessData;
3407
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3408
- while (1) switch (_context39.prev = _context39.next) {
3179
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3180
+ while (1) switch (_context38.prev = _context38.next) {
3409
3181
  case 0:
3410
- _context39.next = 2;
3182
+ _context38.next = 2;
3411
3183
  return this.ensureItemRuleConfigsLoaded();
3412
3184
  case 2:
3413
- strategyConfigs = _context39.sent;
3185
+ strategyConfigs = _context38.sent;
3414
3186
  if (strategyConfigs.length) {
3415
- _context39.next = 5;
3187
+ _context38.next = 5;
3416
3188
  break;
3417
3189
  }
3418
- return _context39.abrupt("return", {
3190
+ return _context38.abrupt("return", {
3419
3191
  passed: true,
3420
3192
  failures: []
3421
3193
  });
3422
3194
  case 5:
3423
3195
  businessData = buildItemRuleBusinessData({
3424
- tempOrder: this.ensureVenueTempOrder(),
3196
+ tempOrder: this.ensureTempOrder(),
3425
3197
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3426
3198
  itemRuleConfigs: this.itemRuleConfigs
3427
3199
  });
3428
- return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3200
+ return _context38.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3429
3201
  case 7:
3430
3202
  case "end":
3431
- return _context39.stop();
3203
+ return _context38.stop();
3432
3204
  }
3433
- }, _callee39, this);
3205
+ }, _callee38, this);
3434
3206
  }));
3435
3207
  function evaluateCartValidationByItemRule() {
3436
3208
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -3440,20 +3212,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3440
3212
  }, {
3441
3213
  key: "validateBeforeSubmitByItemRule",
3442
3214
  value: function () {
3443
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3215
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3444
3216
  var validationResult, firstFailure, errorMessage, error;
3445
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3446
- while (1) switch (_context40.prev = _context40.next) {
3217
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3218
+ while (1) switch (_context39.prev = _context39.next) {
3447
3219
  case 0:
3448
- _context40.next = 2;
3220
+ _context39.next = 2;
3449
3221
  return this.evaluateCartValidationByItemRule();
3450
3222
  case 2:
3451
- validationResult = _context40.sent;
3223
+ validationResult = _context39.sent;
3452
3224
  if (!validationResult.passed) {
3453
- _context40.next = 5;
3225
+ _context39.next = 5;
3454
3226
  break;
3455
3227
  }
3456
- return _context40.abrupt("return");
3228
+ return _context39.abrupt("return");
3457
3229
  case 5:
3458
3230
  firstFailure = validationResult.failures[0];
3459
3231
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -3462,9 +3234,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3462
3234
  throw error;
3463
3235
  case 10:
3464
3236
  case "end":
3465
- return _context40.stop();
3237
+ return _context39.stop();
3466
3238
  }
3467
- }, _callee40, this);
3239
+ }, _callee39, this);
3468
3240
  }));
3469
3241
  function validateBeforeSubmitByItemRule() {
3470
3242
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -3474,10 +3246,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3474
3246
  }, {
3475
3247
  key: "refreshCartValidationPassed",
3476
3248
  value: function () {
3477
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3249
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3478
3250
  var previous, nextState, validationResult, changed;
3479
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3480
- while (1) switch (_context41.prev = _context41.next) {
3251
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3252
+ while (1) switch (_context40.prev = _context40.next) {
3481
3253
  case 0:
3482
3254
  previous = this.store.cartValidation || {
3483
3255
  passed: null,
@@ -3487,20 +3259,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3487
3259
  passed: null,
3488
3260
  failures: []
3489
3261
  };
3490
- _context41.prev = 2;
3491
- _context41.next = 5;
3262
+ _context40.prev = 2;
3263
+ _context40.next = 5;
3492
3264
  return this.evaluateCartValidationByItemRule();
3493
3265
  case 5:
3494
- validationResult = _context41.sent;
3266
+ validationResult = _context40.sent;
3495
3267
  nextState = {
3496
3268
  passed: validationResult.passed,
3497
3269
  failures: validationResult.failures || []
3498
3270
  };
3499
- _context41.next = 12;
3271
+ _context40.next = 12;
3500
3272
  break;
3501
3273
  case 9:
3502
- _context41.prev = 9;
3503
- _context41.t0 = _context41["catch"](2);
3274
+ _context40.prev = 9;
3275
+ _context40.t0 = _context40["catch"](2);
3504
3276
  nextState = {
3505
3277
  passed: false,
3506
3278
  failures: []
@@ -3509,21 +3281,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3509
3281
  this.store.cartValidation = nextState;
3510
3282
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
3511
3283
  if (!changed) {
3512
- _context41.next = 17;
3284
+ _context40.next = 17;
3513
3285
  break;
3514
3286
  }
3515
- _context41.next = 17;
3287
+ _context40.next = 17;
3516
3288
  return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
3517
3289
  cartValidation: nextState,
3518
3290
  cartValidationPassed: nextState.passed
3519
3291
  });
3520
3292
  case 17:
3521
- return _context41.abrupt("return", nextState.passed);
3293
+ return _context40.abrupt("return", nextState.passed);
3522
3294
  case 18:
3523
3295
  case "end":
3524
- return _context41.stop();
3296
+ return _context40.stop();
3525
3297
  }
3526
- }, _callee41, this, [[2, 9]]);
3298
+ }, _callee40, this, [[2, 9]]);
3527
3299
  }));
3528
3300
  function refreshCartValidationPassed() {
3529
3301
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -3533,14 +3305,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3533
3305
  }, {
3534
3306
  key: "setItemRuleRuntimeConfig",
3535
3307
  value: function () {
3536
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3308
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3537
3309
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
3538
3310
  var config,
3539
- _args42 = arguments;
3540
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3541
- while (1) switch (_context42.prev = _context42.next) {
3311
+ _args41 = arguments;
3312
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3313
+ while (1) switch (_context41.prev = _context41.next) {
3542
3314
  case 0:
3543
- config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
3315
+ config = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
3544
3316
  this.logMethodStart('setItemRuleRuntimeConfig');
3545
3317
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
3546
3318
  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) || {}),
@@ -3552,10 +3324,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3552
3324
  this.itemRuleEvaluator.setStrategyConfigs([]);
3553
3325
  }
3554
3326
  this.itemRulePrefillApplied = false;
3555
- _context42.next = 7;
3327
+ _context41.next = 7;
3556
3328
  return this.refreshItemRuleQuantityLimits();
3557
3329
  case 7:
3558
- _context42.next = 9;
3330
+ _context41.next = 9;
3559
3331
  return this.refreshCartValidationPassed();
3560
3332
  case 9:
3561
3333
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -3563,9 +3335,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3563
3335
  });
3564
3336
  case 10:
3565
3337
  case "end":
3566
- return _context42.stop();
3338
+ return _context41.stop();
3567
3339
  }
3568
- }, _callee42, this);
3340
+ }, _callee41, this);
3569
3341
  }));
3570
3342
  function setItemRuleRuntimeConfig() {
3571
3343
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -3592,23 +3364,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3592
3364
  }, {
3593
3365
  key: "readUIStateBucket",
3594
3366
  value: function readUIStateBucket() {
3595
- var _this$window2;
3367
+ var _this$window;
3596
3368
  var key = this.getUIStateBucketKey();
3597
- if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return {};
3369
+ if (!key || !((_this$window = this.window) !== null && _this$window !== void 0 && _this$window.sessionStorage)) return {};
3598
3370
  try {
3599
3371
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3600
3372
  var parsed = JSON.parse(raw);
3601
3373
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3602
- } catch (_unused4) {
3374
+ } catch (_unused3) {
3603
3375
  return {};
3604
3376
  }
3605
3377
  }
3606
3378
  }, {
3607
3379
  key: "writeUIStateBucket",
3608
3380
  value: function writeUIStateBucket(bucket) {
3609
- var _this$window3;
3381
+ var _this$window2;
3610
3382
  var key = this.getUIStateBucketKey();
3611
- if (!key || !((_this$window3 = this.window) !== null && _this$window3 !== void 0 && _this$window3.sessionStorage)) return;
3383
+ if (!key || !((_this$window2 = this.window) !== null && _this$window2 !== void 0 && _this$window2.sessionStorage)) return;
3612
3384
  this.window.sessionStorage.setItem(key, JSON.stringify(bucket));
3613
3385
  }
3614
3386
  }, {
@@ -3636,118 +3408,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3636
3408
  this.writeUIStateBucket(bucket);
3637
3409
  }
3638
3410
  }
3639
- }, {
3640
- key: "setBookingHolder",
3641
- value: function setBookingHolder(bookingUid, holder) {
3642
- var _tempOrder$bookings4;
3643
- if (!this.store.order) return;
3644
- var tempOrder = this.store.order.ensureTempOrder();
3645
- var booking = (_tempOrder$bookings4 = tempOrder.bookings) === null || _tempOrder$bookings4 === void 0 ? void 0 : _tempOrder$bookings4.find(function (b) {
3646
- var _b$metadata4;
3647
- return ((_b$metadata4 = b.metadata) === null || _b$metadata4 === void 0 ? void 0 : _b$metadata4.unique_identification_number) === bookingUid;
3648
- });
3649
- if (booking) {
3650
- booking.holder = holder;
3651
- }
3652
- var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
3653
- _step19;
3654
- try {
3655
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
3656
- var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
3657
- var product = _step19.value;
3658
- var runtimeProduct = product;
3659
- var productBookingUid = (_runtimeProduct$metad = (_runtimeProduct$metad2 = runtimeProduct.metadata) === null || _runtimeProduct$metad2 === void 0 ? void 0 : _runtimeProduct$metad2.booking_uid) !== null && _runtimeProduct$metad !== void 0 ? _runtimeProduct$metad : (_runtimeProduct$_orig = runtimeProduct._origin) === null || _runtimeProduct$_orig === void 0 || (_runtimeProduct$_orig = _runtimeProduct$_orig.product) === null || _runtimeProduct$_orig === void 0 ? void 0 : _runtimeProduct$_orig.bookingUuid;
3660
- if (String(productBookingUid) !== String(bookingUid)) continue;
3661
- var origin = runtimeProduct._origin && _typeof(runtimeProduct._origin) === 'object' ? runtimeProduct._origin : {};
3662
- origin.holder = holder;
3663
- runtimeProduct._origin = origin;
3664
- }
3665
- } catch (err) {
3666
- _iterator19.e(err);
3667
- } finally {
3668
- _iterator19.f();
3669
- }
3670
- this.store.order.notifyTempOrderChanged();
3671
- }
3672
-
3673
- /**
3674
- * 获取 holder 表单 map
3675
- */
3676
- }, {
3677
- key: "getHolderFormMap",
3678
- value: function getHolderFormMap() {
3679
- if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
3680
- return this.store.holder.getHolderFormMap();
3681
- }
3682
-
3683
- /**
3684
- * UI 层触发:按当前 holderMap 批量刷新所有表单的 records
3685
- */
3686
- }, {
3687
- key: "refreshAllHolderFormRecords",
3688
- value: (function () {
3689
- var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3690
- var _params$customer_id, _params$useCache;
3691
- var customer_id;
3692
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3693
- while (1) switch (_context43.prev = _context43.next) {
3694
- case 0:
3695
- if (this.store.holder) {
3696
- _context43.next = 2;
3697
- break;
3698
- }
3699
- throw new Error('[VenueBooking] holder 模块未初始化');
3700
- case 2:
3701
- customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
3702
- return _context43.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
3703
- customer_id: customer_id,
3704
- useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
3705
- })));
3706
- case 4:
3707
- case "end":
3708
- return _context43.stop();
3709
- }
3710
- }, _callee43, this);
3711
- }));
3712
- function refreshAllHolderFormRecords(_x21) {
3713
- return _refreshAllHolderFormRecords.apply(this, arguments);
3714
- }
3715
- return refreshAllHolderFormRecords;
3716
- }()
3717
- /**
3718
- * 添加表单记录
3719
- */
3720
- )
3721
- }, {
3722
- key: "appendFormRecord",
3723
- value: function appendFormRecord(params) {
3724
- if (!this.store.holder) throw new Error('[VenueBooking] holder 模块未初始化');
3725
- return this.store.holder.appendFormRecord(params);
3726
- }
3727
3411
 
3728
3412
  // ─── OpenData 可用性 ───
3729
3413
  }, {
3730
3414
  key: "checkOpenDataAvailability",
3731
3415
  value: function () {
3732
- var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44() {
3733
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3734
- while (1) switch (_context44.prev = _context44.next) {
3416
+ var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3417
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3418
+ while (1) switch (_context42.prev = _context42.next) {
3735
3419
  case 0:
3736
3420
  if (this.store.openData) {
3737
- _context44.next = 2;
3421
+ _context42.next = 2;
3738
3422
  break;
3739
3423
  }
3740
3424
  throw new Error('openData 模块未初始化');
3741
3425
  case 2:
3742
- _context44.next = 4;
3426
+ _context42.next = 4;
3743
3427
  return this.loadOpenDataConfig();
3744
3428
  case 4:
3745
- return _context44.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3429
+ return _context42.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3746
3430
  case 5:
3747
3431
  case "end":
3748
- return _context44.stop();
3432
+ return _context42.stop();
3749
3433
  }
3750
- }, _callee44, this);
3434
+ }, _callee42, this);
3751
3435
  }));
3752
3436
  function checkOpenDataAvailability() {
3753
3437
  return _checkOpenDataAvailability.apply(this, arguments);
@@ -3757,15 +3441,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3757
3441
  }, {
3758
3442
  key: "setOtherParams",
3759
3443
  value: function () {
3760
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3761
- var _ref7,
3762
- _ref7$cover,
3444
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3445
+ var _ref5,
3446
+ _ref5$cover,
3763
3447
  cover,
3764
- _args45 = arguments;
3765
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3766
- while (1) switch (_context45.prev = _context45.next) {
3448
+ _args43 = arguments;
3449
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3450
+ while (1) switch (_context43.prev = _context43.next) {
3767
3451
  case 0:
3768
- _ref7 = _args45.length > 1 && _args45[1] !== undefined ? _args45[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
3452
+ _ref5 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3769
3453
  if (cover) {
3770
3454
  this.otherParams = params;
3771
3455
  } else {
@@ -3773,17 +3457,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3773
3457
  }
3774
3458
  case 2:
3775
3459
  case "end":
3776
- return _context45.stop();
3460
+ return _context43.stop();
3777
3461
  }
3778
- }, _callee45, this);
3462
+ }, _callee43, this);
3779
3463
  }));
3780
- function setOtherParams(_x22) {
3464
+ function setOtherParams(_x20) {
3781
3465
  return _setOtherParams.apply(this, arguments);
3782
3466
  }
3783
3467
  return setOtherParams;
3784
3468
  }()
3785
3469
  }]);
3786
3470
  return VenueBookingImpl;
3787
- }(BaseSalesImpl);
3471
+ }(BaseModule);
3788
3472
  _defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
3789
3473
  _defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');