@pisell/pisellos 2.2.178 → 2.2.179

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 (182) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Customer/index.d.ts +0 -6
  3. package/dist/modules/Customer/index.js +83 -129
  4. package/dist/modules/Customer/types.d.ts +0 -2
  5. package/dist/modules/Discount/index.d.ts +4 -2
  6. package/dist/modules/Discount/index.js +93 -8
  7. package/dist/modules/Discount/types.d.ts +7 -1
  8. package/dist/modules/Order/index.d.ts +18 -88
  9. package/dist/modules/Order/index.js +501 -1357
  10. package/dist/modules/Order/types.d.ts +19 -198
  11. package/dist/modules/Order/types.js +0 -31
  12. package/dist/modules/Order/utils.d.ts +1 -50
  13. package/dist/modules/Order/utils.js +32 -261
  14. package/dist/modules/Quotation/index.d.ts +1 -0
  15. package/dist/modules/Quotation/index.js +21 -23
  16. package/dist/modules/Rules/index.d.ts +0 -4
  17. package/dist/modules/Rules/index.js +10 -26
  18. package/dist/modules/SalesSummary/index.js +2 -4
  19. package/dist/modules/SalesSummary/utils.js +7 -21
  20. package/dist/modules/Schedule/index.js +2 -6
  21. package/dist/modules/index.d.ts +0 -1
  22. package/dist/modules/index.js +1 -2
  23. package/dist/server/index.js +29 -87
  24. package/dist/server/modules/order/index.d.ts +0 -23
  25. package/dist/server/modules/order/index.js +46 -123
  26. package/dist/server/modules/order/types.d.ts +2 -0
  27. package/dist/server/modules/order/utils/filterOrders.js +6 -20
  28. package/dist/server/modules/products/index.d.ts +1 -1
  29. package/dist/server/modules/products/index.js +113 -130
  30. package/dist/server/modules/schedule/index.js +6 -13
  31. package/dist/solution/BaseSales/index.d.ts +7 -89
  32. package/dist/solution/BaseSales/index.js +375 -1494
  33. package/dist/solution/BaseSales/types.d.ts +1 -67
  34. package/dist/solution/BaseSales/types.js +1 -3
  35. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
  36. package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
  37. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
  38. package/dist/solution/BaseSales/utils.js +8 -46
  39. package/dist/solution/BookingByStep/index.d.ts +1 -1
  40. package/dist/solution/BookingTicket/index.d.ts +1 -133
  41. package/dist/solution/BookingTicket/index.js +175 -780
  42. package/dist/solution/BookingTicket/types.d.ts +0 -2
  43. package/dist/solution/BookingTicket/types.js +0 -3
  44. package/dist/solution/BookingTicket/utils/cartView.js +2 -4
  45. package/dist/solution/ScanOrder/index.d.ts +3 -9
  46. package/dist/solution/ScanOrder/index.js +128 -231
  47. package/dist/solution/ScanOrder/utils.js +8 -46
  48. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  49. package/dist/solution/ShopDiscount/index.js +23 -18
  50. package/dist/solution/VenueBooking/index.d.ts +9 -5
  51. package/dist/solution/VenueBooking/index.js +55 -103
  52. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  53. package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
  54. package/lib/modules/Customer/index.d.ts +0 -6
  55. package/lib/modules/Customer/index.js +11 -26
  56. package/lib/modules/Customer/types.d.ts +0 -2
  57. package/lib/modules/Discount/index.d.ts +4 -2
  58. package/lib/modules/Discount/index.js +63 -8
  59. package/lib/modules/Discount/types.d.ts +7 -1
  60. package/lib/modules/Order/index.d.ts +18 -88
  61. package/lib/modules/Order/index.js +149 -677
  62. package/lib/modules/Order/types.d.ts +19 -198
  63. package/lib/modules/Order/types.js +0 -1
  64. package/lib/modules/Order/utils.d.ts +1 -50
  65. package/lib/modules/Order/utils.js +22 -229
  66. package/lib/modules/Quotation/index.d.ts +1 -0
  67. package/lib/modules/Quotation/index.js +15 -18
  68. package/lib/modules/Rules/index.d.ts +0 -4
  69. package/lib/modules/Rules/index.js +14 -22
  70. package/lib/modules/SalesSummary/index.js +2 -4
  71. package/lib/modules/SalesSummary/utils.js +7 -21
  72. package/lib/modules/Schedule/index.js +1 -3
  73. package/lib/modules/index.d.ts +0 -1
  74. package/lib/modules/index.js +1 -3
  75. package/lib/server/index.js +4 -41
  76. package/lib/server/modules/order/index.d.ts +0 -23
  77. package/lib/server/modules/order/index.js +14 -46
  78. package/lib/server/modules/order/types.d.ts +2 -0
  79. package/lib/server/modules/order/utils/filterOrders.js +4 -12
  80. package/lib/server/modules/products/index.d.ts +1 -1
  81. package/lib/server/modules/products/index.js +20 -30
  82. package/lib/server/modules/schedule/index.js +1 -2
  83. package/lib/solution/BaseSales/index.d.ts +7 -89
  84. package/lib/solution/BaseSales/index.js +22 -736
  85. package/lib/solution/BaseSales/types.d.ts +1 -67
  86. package/lib/solution/BaseSales/types.js +1 -3
  87. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
  88. package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
  89. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
  90. package/lib/solution/BaseSales/utils.js +6 -46
  91. package/lib/solution/BookingByStep/index.d.ts +1 -1
  92. package/lib/solution/BookingTicket/index.d.ts +1 -133
  93. package/lib/solution/BookingTicket/index.js +8 -352
  94. package/lib/solution/BookingTicket/types.d.ts +0 -2
  95. package/lib/solution/BookingTicket/types.js +0 -6
  96. package/lib/solution/BookingTicket/utils/cartView.js +2 -4
  97. package/lib/solution/ScanOrder/index.d.ts +3 -9
  98. package/lib/solution/ScanOrder/index.js +66 -147
  99. package/lib/solution/ScanOrder/utils.js +6 -46
  100. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  101. package/lib/solution/ShopDiscount/index.js +4 -2
  102. package/lib/solution/VenueBooking/index.d.ts +9 -5
  103. package/lib/solution/VenueBooking/index.js +14 -50
  104. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
  105. package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
  106. package/package.json +2 -2
  107. package/dist/modules/BookingContext/index.d.ts +0 -37
  108. package/dist/modules/BookingContext/index.js +0 -436
  109. package/dist/modules/BookingContext/types.d.ts +0 -102
  110. package/dist/modules/BookingContext/types.js +0 -51
  111. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  112. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
  113. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  114. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
  115. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  116. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
  117. package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
  118. package/dist/modules/BookingContext/utils/flexible.js +0 -56
  119. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  120. package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
  121. package/dist/modules/BookingContext/utils/index.d.ts +0 -11
  122. package/dist/modules/BookingContext/utils/index.js +0 -11
  123. package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
  124. package/dist/modules/BookingContext/utils/noResource.js +0 -77
  125. package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
  126. package/dist/modules/BookingContext/utils/productExtend.js +0 -339
  127. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  128. package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
  129. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  130. package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
  131. package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
  132. package/dist/modules/BookingContext/utils/resources.js +0 -486
  133. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  134. package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
  135. package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  136. package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
  137. package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  138. package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
  139. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
  140. package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
  141. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  142. package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
  143. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  144. package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
  145. package/lib/modules/BookingContext/index.d.ts +0 -37
  146. package/lib/modules/BookingContext/index.js +0 -297
  147. package/lib/modules/BookingContext/types.d.ts +0 -102
  148. package/lib/modules/BookingContext/types.js +0 -34
  149. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
  150. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
  151. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
  152. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
  153. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
  154. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
  155. package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
  156. package/lib/modules/BookingContext/utils/flexible.js +0 -80
  157. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
  158. package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
  159. package/lib/modules/BookingContext/utils/index.d.ts +0 -11
  160. package/lib/modules/BookingContext/utils/index.js +0 -43
  161. package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
  162. package/lib/modules/BookingContext/utils/noResource.js +0 -90
  163. package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
  164. package/lib/modules/BookingContext/utils/productExtend.js +0 -283
  165. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
  166. package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
  167. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
  168. package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
  169. package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
  170. package/lib/modules/BookingContext/utils/resources.js +0 -377
  171. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
  172. package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
  173. package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
  174. package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
  175. package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
  176. package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
  177. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
  178. package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
  179. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
  180. package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
  181. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
  182. package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
@@ -1,14 +1,10 @@
1
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
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
2
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
3
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
4
  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); }
5
+ 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; }
9
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- 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; }
12
8
  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); } }
13
9
  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); }); }; }
14
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -27,16 +23,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
27
23
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
28
24
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
29
25
  import { BaseModule } from "../../modules/BaseModule";
30
- import { BaseSalesHookNames } from "./types";
31
26
  import { OrderModule } from "../../modules/Order";
32
27
  import Decimal from 'decimal.js';
33
28
  import { createModule } from "../BookingByStep/types";
34
- import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
29
+ import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
35
30
  import dayjs from 'dayjs';
36
31
  export * from "./types";
37
- import { QuotationModule } from "../../modules/Quotation";
38
32
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
39
- import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
40
33
  export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
41
34
  _inherits(BaseSalesImpl, _BaseModule);
42
35
  var _super = _createSuper(BaseSalesImpl);
@@ -50,7 +43,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
50
43
  _defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
51
44
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
52
45
  // LoggerManager 实例
53
- _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
54
46
  _defineProperty(_assertThisInitialized(_this), "store", {
55
47
  order: undefined
56
48
  });
@@ -64,19 +56,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
64
56
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
65
57
  // 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
66
58
  _defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
67
- _defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
68
- _defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
69
59
  return _this;
70
60
  }
71
61
 
72
62
  /**
73
63
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
74
- * 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation
64
+ * 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
75
65
  */
76
66
  _createClass(BaseSalesImpl, [{
77
67
  key: "getRegisteredModuleNames",
78
68
  value: function getRegisteredModuleNames() {
79
- return ['products', 'order', 'salesSummary', 'schedule', 'payment', 'quotation'];
69
+ return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
80
70
  }
81
71
 
82
72
  /**
@@ -131,251 +121,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
131
121
  get: function get() {
132
122
  return this.store.payment;
133
123
  }
134
- }, {
135
- key: "getCurrentOrderCustomerId",
136
- value: function getCurrentOrderCustomerId() {
137
- var _this$store$order, _this$store$order$get;
138
- var tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
139
- var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
140
- if (customerId === null || customerId === undefined) return undefined;
141
- return customerId;
142
- }
143
- }, {
144
- key: "applyQuotationScheduleResolver",
145
- value: function applyQuotationScheduleResolver(quotation) {
146
- var scheduleModule = this.store.schedule;
147
- if (!scheduleModule) return;
148
- quotation.setScheduleResolver(function (id) {
149
- var _scheduleModule$getSc;
150
- var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
151
- return schedules[0];
152
- });
153
- }
154
- }, {
155
- key: "loadQuotationForPriceQuery",
156
- value: function () {
157
- var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
158
- var _this$otherParams;
159
- return _regeneratorRuntime().wrap(function _callee$(_context) {
160
- while (1) switch (_context.prev = _context.next) {
161
- case 0:
162
- if (params.quotation) {
163
- _context.next = 2;
164
- break;
165
- }
166
- return _context.abrupt("return");
167
- case 2:
168
- this.applyQuotationScheduleResolver(params.quotation);
169
- _context.next = 5;
170
- return params.quotation.loadQuotations({
171
- channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
172
- customer_id: params.customer_id
173
- });
174
- case 5:
175
- case "end":
176
- return _context.stop();
177
- }
178
- }, _callee, this);
179
- }));
180
- function loadQuotationForPriceQuery(_x) {
181
- return _loadQuotationForPriceQuery.apply(this, arguments);
182
- }
183
- return loadQuotationForPriceQuery;
184
- }()
185
- }, {
186
- key: "getPriceQueryProductId",
187
- value: function getPriceQueryProductId(product) {
188
- var _product$product_id;
189
- var productId = Number((_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id);
190
- if (!Number.isFinite(productId)) return null;
191
- return productId;
192
- }
193
- }, {
194
- key: "getPriceQuerySchedule",
195
- value: function getPriceQuerySchedule(params) {
196
- var booking = params.booking || {};
197
- if (typeof booking.start_date === 'string' && booking.start_date.trim()) {
198
- var scheduleDate = booking.start_date.trim();
199
- var startTime = typeof booking.start_time === 'string' && booking.start_time.trim() ? booking.start_time.trim() : '00:00:00';
200
- var datetime = dayjs("".concat(scheduleDate, " ").concat(startTime));
201
- return {
202
- schedule_date: scheduleDate,
203
- schedule_datetime: datetime.isValid() ? datetime.format('YYYY-MM-DD HH:mm:ss') : "".concat(scheduleDate, " ").concat(startTime)
204
- };
205
- }
206
- if (typeof params.datetime === 'string' && params.datetime.trim()) {
207
- var _datetime = dayjs(params.datetime.trim());
208
- if (_datetime.isValid()) {
209
- return {
210
- schedule_date: _datetime.format('YYYY-MM-DD'),
211
- schedule_datetime: _datetime.format('YYYY-MM-DD HH:mm:ss')
212
- };
213
- }
214
- }
215
- var now = dayjs();
216
- return {
217
- schedule_date: now.format('YYYY-MM-DD'),
218
- schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
219
- };
220
- }
221
- }, {
222
- key: "loadProductForPriceQuery",
223
- value: function () {
224
- var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, customerId) {
225
- var product, productId, schedule, _this$otherParams2, _response$data, response, list;
226
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
227
- while (1) switch (_context2.prev = _context2.next) {
228
- case 0:
229
- product = params.product || {};
230
- productId = this.getPriceQueryProductId(product);
231
- if (!(productId === null || !this.request)) {
232
- _context2.next = 4;
233
- break;
234
- }
235
- return _context2.abrupt("return", null);
236
- case 4:
237
- schedule = this.getPriceQuerySchedule(params);
238
- _context2.prev = 5;
239
- _context2.next = 8;
240
- return this.request.post('/product/query', {
241
- ids: [productId],
242
- open_quotation: 1,
243
- open_bundle: 1,
244
- status: 'published',
245
- num: 1,
246
- skip: 1,
247
- customer_id: customerId,
248
- schedule_date: schedule.schedule_date,
249
- schedule_datetime: schedule.schedule_datetime,
250
- application_code: params.channel || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel)
251
- }, {
252
- osServer: true,
253
- customToast: function customToast() {}
254
- });
255
- case 8:
256
- response = _context2.sent;
257
- list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
258
- if (Array.isArray(list)) {
259
- _context2.next = 12;
260
- break;
261
- }
262
- return _context2.abrupt("return", null);
263
- case 12:
264
- return _context2.abrupt("return", list.find(function (item) {
265
- var _item$id;
266
- return Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id) === productId;
267
- }) || null);
268
- case 15:
269
- _context2.prev = 15;
270
- _context2.t0 = _context2["catch"](5);
271
- this.logWarning('loadProductForPriceQuery: 商品重查失败,使用入参 fallback', {
272
- productId: productId,
273
- error: _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0)
274
- });
275
- return _context2.abrupt("return", null);
276
- case 19:
277
- case "end":
278
- return _context2.stop();
279
- }
280
- }, _callee2, this, [[5, 15]]);
281
- }));
282
- function loadProductForPriceQuery(_x2, _x3) {
283
- return _loadProductForPriceQuery.apply(this, arguments);
284
- }
285
- return loadProductForPriceQuery;
286
- }()
287
- }, {
288
- key: "getAuthoritativeBundleItems",
289
- value: function getAuthoritativeBundleItems(product) {
290
- if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product.product_bundle;
291
- var groups = Array.isArray(product === null || product === void 0 ? void 0 : product.bundle_group) ? product.bundle_group : Array.isArray(product === null || product === void 0 ? void 0 : product.bundleGroup) ? product.bundleGroup : [];
292
- return groups.flatMap(function (group) {
293
- var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
294
- return items.map(function (item) {
295
- var _item$group_id, _ref, _item$bundle_group_id;
296
- return _objectSpread(_objectSpread({}, item), {}, {
297
- group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
298
- bundle_group_id: (_ref = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref !== void 0 ? _ref : group === null || group === void 0 ? void 0 : group.id
299
- });
300
- });
301
- });
302
- }
303
- }, {
304
- key: "findAuthoritativeBundleItem",
305
- value: function findAuthoritativeBundleItem(bundle, candidates) {
306
- var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
307
- var bundleId = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id;
308
- if (bundleId != null) {
309
- var matchedById = candidates.find(function (item) {
310
- var _item$bundle_id;
311
- return String((_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) === String(bundleId);
312
- });
313
- if (matchedById) return matchedById;
314
- }
315
- var productId = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id;
316
- var groupId = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id;
317
- return candidates.find(function (item) {
318
- var _item$bundle_product_, _item$bundle_group_id2;
319
- var itemProductId = (_item$bundle_product_ = item === null || item === void 0 ? void 0 : item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item === null || item === void 0 ? void 0 : item._bundle_product_id;
320
- var itemGroupId = (_item$bundle_group_id2 = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id2 !== void 0 ? _item$bundle_group_id2 : item === null || item === void 0 ? void 0 : item.group_id;
321
- if (productId == null || String(itemProductId) !== String(productId)) return false;
322
- if (groupId == null) return true;
323
- return String(itemGroupId) === String(groupId);
324
- }) || null;
325
- }
326
- }, {
327
- key: "getAuthoritativeBundleUnitPrice",
328
- value: function getAuthoritativeBundleUnitPrice(bundle) {
329
- var _ref2, _ref3, _ref4, _bundle$price;
330
- return (_ref2 = (_ref3 = (_ref4 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundle.product_price) !== null && _ref2 !== void 0 ? _ref2 : bundle.base_price;
331
- }
332
- }, {
333
- key: "mergeProductForPriceQuery",
334
- value: function mergeProductForPriceQuery(product, authoritativeProduct) {
335
- var _this2 = this,
336
- _product$id,
337
- _ref5,
338
- _product$product_id2,
339
- _ref6,
340
- _product$product_vari,
341
- _ref7,
342
- _product$num,
343
- _ref8,
344
- _product$quantity,
345
- _product$product_opti,
346
- _product$metadata;
347
- if (!authoritativeProduct) return product;
348
- var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
349
- var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
350
- var productBundle = selectedBundles.map(function (bundle) {
351
- var _authoritativeBundle$, _authoritativeBundle$2;
352
- var authoritativeBundle = _this2.findAuthoritativeBundleItem(bundle, authoritativeBundles);
353
- var unitPrice = authoritativeBundle ? _this2.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
354
- if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
355
- return _objectSpread(_objectSpread({}, bundle), {}, {
356
- price: unitPrice,
357
- bundle_selling_price: unitPrice,
358
- base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
359
- product_price: (_authoritativeBundle$2 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.product_price) !== null && _authoritativeBundle$2 !== void 0 ? _authoritativeBundle$2 : bundle.product_price
360
- });
361
- });
362
- return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
363
- id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
364
- product_id: (_ref5 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref5 !== void 0 ? _ref5 : authoritativeProduct.id,
365
- product_variant_id: (_ref6 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref6 !== void 0 ? _ref6 : 0,
366
- num: (_ref7 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref7 !== void 0 ? _ref7 : authoritativeProduct.num,
367
- quantity: (_ref8 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref8 !== void 0 ? _ref8 : authoritativeProduct.quantity,
368
- product_option_item: (_product$product_opti = product.product_option_item) !== null && _product$product_opti !== void 0 ? _product$product_opti : authoritativeProduct.product_option_item,
369
- product_bundle: productBundle,
370
- metadata: (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 ? _product$metadata : authoritativeProduct.metadata
371
- });
372
- }
373
- }, {
374
- key: "getSubmitOrderSalesChannel",
375
- value: function getSubmitOrderSalesChannel() {
376
- var _this$otherParams3;
377
- return (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel;
378
- }
379
124
 
380
125
  /**
381
126
  * 工厂入口:根据子模块名实例化对应模块。
@@ -385,9 +130,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
385
130
  }, {
386
131
  key: "createSubModule",
387
132
  value: function createSubModule(moduleName) {
388
- if (moduleName === 'quotation') {
389
- return new QuotationModule("".concat(this.name, "_quotation"));
390
- }
391
133
  return createModule(moduleName, this.name);
392
134
  }
393
135
  }, {
@@ -421,124 +163,77 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
421
163
  return {};
422
164
  }
423
165
  }
424
- }, {
425
- key: "getAppData",
426
- value: function getAppData(key) {
427
- var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
428
- var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
429
- if (typeof getData === 'function') return getData(key);
430
- var app = this.appPlugin.getApp();
431
- var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
432
- return coreData === null || coreData === void 0 ? void 0 : coreData[key];
433
- }
434
- }, {
435
- key: "syncAppDataToTempOrder",
436
- value: function syncAppDataToTempOrder(tempOrder) {
437
- var isPriceIncludeTax = this.getAppData('is_price_include_tax');
438
- var taxCountryCode = this.getAppData('tax_country_code');
439
- var currencyCode = this.getAppData('shop_currency_code');
440
- var currencySymbol = this.getAppData('shop_symbol');
441
- var isChanged = false;
442
- if (isPriceIncludeTax !== undefined) {
443
- var nextIsPriceIncludeTax = Number(isPriceIncludeTax);
444
- if ((nextIsPriceIncludeTax === 0 || nextIsPriceIncludeTax === 1) && tempOrder.is_price_include_tax !== nextIsPriceIncludeTax) {
445
- tempOrder.is_price_include_tax = nextIsPriceIncludeTax;
446
- isChanged = true;
447
- }
448
- }
449
- if (taxCountryCode !== undefined) {
450
- var nextTaxCountryCode = String(taxCountryCode || '');
451
- if (tempOrder.tax_country_code !== nextTaxCountryCode) {
452
- tempOrder.tax_country_code = nextTaxCountryCode;
453
- isChanged = true;
454
- }
455
- }
456
- if (currencyCode !== undefined) {
457
- var nextCurrencyCode = String(currencyCode || '');
458
- if (tempOrder.currency_code !== nextCurrencyCode) {
459
- tempOrder.currency_code = nextCurrencyCode;
460
- isChanged = true;
461
- }
462
- }
463
- if (currencySymbol !== undefined) {
464
- var nextCurrencySymbol = String(currencySymbol || '');
465
- if (tempOrder.currency_symbol !== nextCurrencySymbol) {
466
- tempOrder.currency_symbol = nextCurrencySymbol;
467
- isChanged = true;
468
- }
469
- }
470
- return isChanged;
471
- }
472
166
  }, {
473
167
  key: "initialize",
474
168
  value: function () {
475
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(core) {
476
- var _this$otherParams4,
477
- _this3 = this;
169
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
170
+ var _this$otherParams,
171
+ _this2 = this;
478
172
  var options,
173
+ appPlugin,
479
174
  app,
480
175
  targetCacheData,
481
176
  moduleNames,
482
- _args3 = arguments;
483
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
484
- while (1) switch (_context3.prev = _context3.next) {
177
+ _args = arguments;
178
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
179
+ while (1) switch (_context.prev = _context.next) {
485
180
  case 0:
486
- options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
181
+ options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
487
182
  this.core = core;
488
183
  this.initializeOptions = options || {};
489
184
  // this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
490
185
  this.otherParams = options.otherParams || {};
491
- this.cacheId = (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.cacheId;
186
+ this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
492
187
  this.window = core.getPlugin('window');
493
188
  this.request = core.getPlugin('request');
494
189
 
495
190
  // 获取 logger 实例
496
- this.appPlugin = core.getPlugin('app');
497
- if (this.appPlugin) {
498
- _context3.next = 10;
191
+ appPlugin = core.getPlugin('app');
192
+ if (appPlugin) {
193
+ _context.next = 10;
499
194
  break;
500
195
  }
501
196
  throw new Error('Checkout 解决方案需要 app 插件支持');
502
197
  case 10:
503
- app = this.appPlugin.getApp();
198
+ app = appPlugin.getApp();
504
199
  this.logger = app.logger;
505
200
  targetCacheData = this.readSessionCacheData();
506
201
  moduleNames = this.getRegisteredModuleNames();
507
202
  moduleNames.forEach(function (step) {
508
- var targetModule = _this3.createSubModule(step);
203
+ var targetModule = _this2.createSubModule(step);
509
204
  if (!targetModule) {
510
205
  throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
511
206
  }
512
- var hooks = _this3.getSubModuleHooks(step);
513
- _this3.store[step] = targetModule;
514
- _this3.core.registerModule(targetModule, _objectSpread(_objectSpread({
207
+ var hooks = _this2.getSubModuleHooks(step);
208
+ _this2.store[step] = targetModule;
209
+ _this2.core.registerModule(targetModule, _objectSpread(_objectSpread({
515
210
  initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
516
211
  }, hooks ? {
517
212
  hooks: hooks
518
213
  } : {}), {}, {
519
- otherParams: _objectSpread(_objectSpread({}, _this3.otherParams), {}, {
520
- salesSummaryModuleName: "".concat(_this3.name, "_salesSummary"),
521
- fatherModule: _this3.name,
522
- openCache: _this3.cacheId ? true : false,
523
- cacheId: _this3.cacheId
214
+ otherParams: _objectSpread(_objectSpread({}, _this2.otherParams), {}, {
215
+ salesSummaryModuleName: "".concat(_this2.name, "_salesSummary"),
216
+ fatherModule: _this2.name,
217
+ openCache: _this2.cacheId ? true : false,
218
+ cacheId: _this2.cacheId
524
219
  })
525
220
  }));
526
221
  });
527
222
  if (!this.store.schedule) {
528
- _context3.next = 18;
223
+ _context.next = 18;
529
224
  break;
530
225
  }
531
- _context3.next = 18;
226
+ _context.next = 18;
532
227
  return this.store.schedule.loadAllSchedule();
533
228
  case 18:
534
229
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
535
230
  case 19:
536
231
  case "end":
537
- return _context3.stop();
232
+ return _context.stop();
538
233
  }
539
- }, _callee3, this);
234
+ }, _callee, this);
540
235
  }));
541
- function initialize(_x4) {
236
+ function initialize(_x) {
542
237
  return _initialize.apply(this, arguments);
543
238
  }
544
239
  return initialize;
@@ -546,13 +241,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
546
241
  }, {
547
242
  key: "destroy",
548
243
  value: function () {
549
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
550
- var _this4 = this;
551
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
552
- while (1) switch (_context4.prev = _context4.next) {
244
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
245
+ var _this3 = this;
246
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
247
+ while (1) switch (_context2.prev = _context2.next) {
553
248
  case 0:
554
249
  Object.keys(this.store).forEach(function (key) {
555
- var sub = _this4.store[key];
250
+ var sub = _this3.store[key];
556
251
  if (sub && typeof sub.destroy === 'function') {
557
252
  try {
558
253
  sub.destroy();
@@ -562,15 +257,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
562
257
  }
563
258
  });
564
259
  this.currentSalesDetail = null;
565
- _context4.next = 4;
260
+ _context2.next = 4;
566
261
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
567
262
  case 4:
568
263
  _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
569
264
  case 5:
570
265
  case "end":
571
- return _context4.stop();
266
+ return _context2.stop();
572
267
  }
573
- }, _callee4, this);
268
+ }, _callee2, this);
574
269
  }));
575
270
  function destroy() {
576
271
  return _destroy.apply(this, arguments);
@@ -587,13 +282,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
587
282
  }, {
588
283
  key: "loadSalesDetail",
589
284
  value: (function () {
590
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderIdOrParams) {
285
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(orderIdOrParams) {
591
286
  var params, externalSaleNumber, localRecord, _sales, res, message, sales;
592
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
593
- while (1) switch (_context5.prev = _context5.next) {
287
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
288
+ while (1) switch (_context3.prev = _context3.next) {
594
289
  case 0:
595
290
  if (this.store.order) {
596
- _context5.next = 2;
291
+ _context3.next = 2;
597
292
  break;
598
293
  }
599
294
  throw new Error('order 模块未初始化');
@@ -603,107 +298,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
603
298
  };
604
299
  externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
605
300
  if (params.forceRemote) {
606
- _context5.next = 35;
301
+ _context3.next = 35;
607
302
  break;
608
303
  }
609
304
  if (!(params.orderId !== undefined)) {
610
- _context5.next = 11;
305
+ _context3.next = 11;
611
306
  break;
612
307
  }
613
- _context5.next = 8;
308
+ _context3.next = 8;
614
309
  return this.store.order.getLocalOrderByOrderId(params.orderId);
615
310
  case 8:
616
- _context5.t0 = _context5.sent;
617
- _context5.next = 26;
311
+ _context3.t0 = _context3.sent;
312
+ _context3.next = 26;
618
313
  break;
619
314
  case 11:
620
315
  if (!externalSaleNumber) {
621
- _context5.next = 17;
316
+ _context3.next = 17;
622
317
  break;
623
318
  }
624
- _context5.next = 14;
319
+ _context3.next = 14;
625
320
  return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
626
321
  case 14:
627
- _context5.t1 = _context5.sent;
628
- _context5.next = 25;
322
+ _context3.t1 = _context3.sent;
323
+ _context3.next = 25;
629
324
  break;
630
325
  case 17:
631
326
  if (!params.orderNumber) {
632
- _context5.next = 23;
327
+ _context3.next = 23;
633
328
  break;
634
329
  }
635
- _context5.next = 20;
330
+ _context3.next = 20;
636
331
  return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
637
332
  case 20:
638
- _context5.t2 = _context5.sent;
639
- _context5.next = 24;
333
+ _context3.t2 = _context3.sent;
334
+ _context3.next = 24;
640
335
  break;
641
336
  case 23:
642
- _context5.t2 = null;
337
+ _context3.t2 = null;
643
338
  case 24:
644
- _context5.t1 = _context5.t2;
339
+ _context3.t1 = _context3.t2;
645
340
  case 25:
646
- _context5.t0 = _context5.t1;
341
+ _context3.t0 = _context3.t1;
647
342
  case 26:
648
- localRecord = _context5.t0;
343
+ localRecord = _context3.t0;
649
344
  if (!localRecord) {
650
- _context5.next = 35;
345
+ _context3.next = 35;
651
346
  break;
652
347
  }
653
- _context5.next = 30;
348
+ _context3.next = 30;
654
349
  return this.store.order.hydrateTempOrderFromRecord(localRecord, {
655
350
  recalcOnHydrate: false
656
351
  });
657
352
  case 30:
658
- _sales = _context5.sent;
353
+ _sales = _context3.sent;
659
354
  this.currentSalesDetail = _sales;
660
- _context5.next = 34;
355
+ _context3.next = 34;
661
356
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
662
357
  sales: _sales
663
358
  });
664
359
  case 34:
665
- return _context5.abrupt("return", _sales);
360
+ return _context3.abrupt("return", _sales);
666
361
  case 35:
667
362
  if (!(params.orderId === undefined || params.orderId === null)) {
668
- _context5.next = 37;
363
+ _context3.next = 37;
669
364
  break;
670
365
  }
671
366
  throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
672
367
  case 37:
673
- _context5.next = 39;
368
+ _context3.next = 39;
674
369
  return this.store.order.getOrderInfoByRemote(Number(params.orderId));
675
370
  case 39:
676
- res = _context5.sent;
371
+ res = _context3.sent;
677
372
  if (!(!res || res.code !== 200)) {
678
- _context5.next = 43;
373
+ _context3.next = 43;
679
374
  break;
680
375
  }
681
376
  message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
682
377
  throw new Error(message);
683
378
  case 43:
684
- _context5.next = 45;
379
+ _context3.next = 45;
685
380
  return this.store.order.hydrateTempOrderFromRecord(res.data, {
686
381
  recalcOnHydrate: false
687
382
  });
688
383
  case 45:
689
- sales = _context5.sent;
690
- _context5.next = 48;
384
+ sales = _context3.sent;
385
+ _context3.next = 48;
691
386
  return this.store.order.saveDraft();
692
387
  case 48:
693
388
  this.currentSalesDetail = sales;
694
- _context5.next = 51;
389
+ _context3.next = 51;
695
390
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
696
391
  sales: sales
697
392
  });
698
393
  case 51:
699
- return _context5.abrupt("return", sales);
394
+ return _context3.abrupt("return", sales);
700
395
  case 52:
701
396
  case "end":
702
- return _context5.stop();
397
+ return _context3.stop();
703
398
  }
704
- }, _callee5, this);
399
+ }, _callee3, this);
705
400
  }));
706
- function loadSalesDetail(_x5) {
401
+ function loadSalesDetail(_x2) {
707
402
  return _loadSalesDetail.apply(this, arguments);
708
403
  }
709
404
  return loadSalesDetail;
@@ -776,45 +471,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
776
471
  }, {
777
472
  key: "getTempOrder",
778
473
  value: function getTempOrder() {
779
- var _this$store$order2;
780
- var result = ((_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder()) || null;
474
+ var _this$store$order;
475
+ var result = ((_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.getTempOrder()) || null;
781
476
  return result;
782
477
  }
783
- }, {
784
- key: "replaceTempOrder",
785
- value: function () {
786
- var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(tempOrder) {
787
- var nextTempOrder;
788
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
789
- while (1) switch (_context6.prev = _context6.next) {
790
- case 0:
791
- if (this.store.order) {
792
- _context6.next = 2;
793
- break;
794
- }
795
- throw new Error('order 模块未初始化');
796
- case 2:
797
- _context6.next = 4;
798
- return this.store.order.replaceTempOrder(tempOrder);
799
- case 4:
800
- nextTempOrder = _context6.sent;
801
- _context6.next = 7;
802
- return this.effectsEmit('onTempOrderReplaced', {
803
- tempOrder: nextTempOrder
804
- });
805
- case 7:
806
- return _context6.abrupt("return", nextTempOrder);
807
- case 8:
808
- case "end":
809
- return _context6.stop();
810
- }
811
- }, _callee6, this);
812
- }));
813
- function replaceTempOrder(_x6) {
814
- return _replaceTempOrder.apply(this, arguments);
815
- }
816
- return replaceTempOrder;
817
- }()
818
478
  }, {
819
479
  key: "getOrderIdentity",
820
480
  value: function getOrderIdentity() {
@@ -848,21 +508,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
848
508
  }, {
849
509
  key: "updateTempOrderNote",
850
510
  value: function updateTempOrderNote(note) {
851
- var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
852
511
  try {
853
512
  if (!this.store.order) throw new Error('order 模块未初始化');
854
- var result = this.store.order.updateTempOrderNote(note, sync);
513
+ var result = this.store.order.updateTempOrderNote(note);
855
514
  return result;
856
515
  } catch (error) {
857
516
  throw error;
858
517
  }
859
518
  }
860
- }, {
861
- key: "updateRemoteOrderNote",
862
- value: function updateRemoteOrderNote(orderId, note) {
863
- if (!this.store.order) throw new Error('order 模块未初始化');
864
- this.store.order.syncTempOrderNoteToRemote(orderId, note);
865
- }
866
519
  }, {
867
520
  key: "updateTempOrderShopDiscount",
868
521
  value: function updateTempOrderShopDiscount(amount) {
@@ -875,22 +528,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
875
528
  if (!this.store.order) throw new Error('order 模块未初始化');
876
529
  return this.store.order.updateTempOrderContactsInfo(contactsInfo);
877
530
  }
878
-
879
- /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
880
- }, {
881
- key: "setEnableTempOrderPersist",
882
- value: function setEnableTempOrderPersist(enabled) {
883
- if (!this.store.order) throw new Error('order 模块未初始化');
884
- this.store.order.setEnableTempOrderPersist(enabled);
885
- }
886
-
887
- /** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
888
- }, {
889
- key: "isTempOrderPersistEnabled",
890
- value: function isTempOrderPersistEnabled() {
891
- if (!this.store.order) return false;
892
- return this.store.order.isTempOrderPersistEnabled();
893
- }
894
531
  }, {
895
532
  key: "ensureTempOrder",
896
533
  value: function ensureTempOrder() {
@@ -902,40 +539,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
902
539
  }, {
903
540
  key: "addNewOrder",
904
541
  value: function () {
905
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
542
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
906
543
  var tempOrder;
907
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
908
- while (1) switch (_context7.prev = _context7.next) {
544
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
545
+ while (1) switch (_context4.prev = _context4.next) {
909
546
  case 0:
910
- _context7.prev = 0;
547
+ _context4.prev = 0;
911
548
  if (this.store.order) {
912
- _context7.next = 3;
549
+ _context4.next = 3;
913
550
  break;
914
551
  }
915
552
  throw new Error('order 模块未初始化');
916
553
  case 3:
917
- _context7.next = 5;
554
+ _context4.next = 5;
918
555
  return this.store.order.addNewOrder();
919
556
  case 5:
920
- tempOrder = _context7.sent;
921
- if (!this.syncAppDataToTempOrder(tempOrder)) {
922
- _context7.next = 10;
923
- break;
924
- }
925
- this.store.order.persistTempOrder();
926
- _context7.next = 10;
927
- return this.store.order.saveDraft();
928
- case 10:
929
- return _context7.abrupt("return", tempOrder);
930
- case 13:
931
- _context7.prev = 13;
932
- _context7.t0 = _context7["catch"](0);
933
- throw _context7.t0;
934
- case 16:
557
+ tempOrder = _context4.sent;
558
+ return _context4.abrupt("return", tempOrder);
559
+ case 9:
560
+ _context4.prev = 9;
561
+ _context4.t0 = _context4["catch"](0);
562
+ throw _context4.t0;
563
+ case 12:
935
564
  case "end":
936
- return _context7.stop();
565
+ return _context4.stop();
937
566
  }
938
- }, _callee7, this, [[0, 13]]);
567
+ }, _callee4, this, [[0, 9]]);
939
568
  }));
940
569
  function addNewOrder() {
941
570
  return _addNewOrder.apply(this, arguments);
@@ -945,22 +574,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
945
574
  }, {
946
575
  key: "saveDraft",
947
576
  value: function () {
948
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
949
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
950
- while (1) switch (_context8.prev = _context8.next) {
577
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
578
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
579
+ while (1) switch (_context5.prev = _context5.next) {
951
580
  case 0:
952
581
  if (this.store.order) {
953
- _context8.next = 2;
582
+ _context5.next = 2;
954
583
  break;
955
584
  }
956
585
  throw new Error('order 模块未初始化');
957
586
  case 2:
958
- return _context8.abrupt("return", this.store.order.saveDraft());
587
+ return _context5.abrupt("return", this.store.order.saveDraft());
959
588
  case 3:
960
589
  case "end":
961
- return _context8.stop();
590
+ return _context5.stop();
962
591
  }
963
- }, _callee8, this);
592
+ }, _callee5, this);
964
593
  }));
965
594
  function saveDraft() {
966
595
  return _saveDraft.apply(this, arguments);
@@ -971,113 +600,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
971
600
  }, {
972
601
  key: "restoreOrder",
973
602
  value: function () {
974
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
603
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
975
604
  var tempOrder;
976
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
977
- while (1) switch (_context9.prev = _context9.next) {
605
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
606
+ while (1) switch (_context6.prev = _context6.next) {
978
607
  case 0:
979
- _context9.prev = 0;
608
+ _context6.prev = 0;
980
609
  if (this.store.order) {
981
- _context9.next = 3;
610
+ _context6.next = 3;
982
611
  break;
983
612
  }
984
613
  throw new Error('scanOrder 解决方案需要 order 模块支持');
985
614
  case 3:
986
615
  // this.store.resource = null;
987
616
  tempOrder = this.store.order.restoreOrder();
988
- this.currentSalesDetail = null;
989
- this.discountConfigCacheKey = null;
990
- this.hasManualDiscountSelection = false;
991
- _context9.next = 9;
992
- return this.effectsEmit('onTempOrderReplaced', {
993
- tempOrder: tempOrder
994
- });
995
- case 9:
996
- if (!this.syncAppDataToTempOrder(tempOrder)) {
997
- _context9.next = 13;
998
- break;
999
- }
1000
- this.store.order.persistTempOrder();
1001
- _context9.next = 13;
1002
- return this.store.order.saveDraft();
1003
- case 13:
1004
- return _context9.abrupt("return", tempOrder);
1005
- case 16:
1006
- _context9.prev = 16;
1007
- _context9.t0 = _context9["catch"](0);
1008
- throw _context9.t0;
1009
- case 19:
617
+ return _context6.abrupt("return", tempOrder);
618
+ case 7:
619
+ _context6.prev = 7;
620
+ _context6.t0 = _context6["catch"](0);
621
+ throw _context6.t0;
622
+ case 10:
1010
623
  case "end":
1011
- return _context9.stop();
624
+ return _context6.stop();
1012
625
  }
1013
- }, _callee9, this, [[0, 16]]);
626
+ }, _callee6, this, [[0, 7]]);
1014
627
  }));
1015
628
  function restoreOrder() {
1016
629
  return _restoreOrder.apply(this, arguments);
1017
630
  }
1018
631
  return restoreOrder;
1019
632
  }()
1020
- /**
1021
- * 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
1022
- * 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
1023
- */
1024
- }, {
1025
- key: "clearOrderCartLines",
1026
- value: (function () {
1027
- var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1028
- var tempOrder;
1029
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1030
- while (1) switch (_context10.prev = _context10.next) {
1031
- case 0:
1032
- _context10.prev = 0;
1033
- if (this.store.order) {
1034
- _context10.next = 3;
1035
- break;
1036
- }
1037
- throw new Error('order 模块未初始化');
1038
- case 3:
1039
- _context10.next = 5;
1040
- return this.store.order.clearOrderCartLines();
1041
- case 5:
1042
- tempOrder = _context10.sent;
1043
- if (this.currentSalesDetail) {
1044
- this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
1045
- products: [],
1046
- bookings: [],
1047
- rootBooking: null,
1048
- bookingsByProductUid: {},
1049
- discount_list: []
1050
- });
1051
- }
1052
- _context10.next = 9;
1053
- return this.effectsEmit('onTempOrderReplaced', {
1054
- tempOrder: tempOrder
1055
- });
1056
- case 9:
1057
- if (!this.syncAppDataToTempOrder(tempOrder)) {
1058
- _context10.next = 13;
1059
- break;
1060
- }
1061
- this.store.order.persistTempOrder();
1062
- _context10.next = 13;
1063
- return this.store.order.saveDraft();
1064
- case 13:
1065
- return _context10.abrupt("return", tempOrder);
1066
- case 16:
1067
- _context10.prev = 16;
1068
- _context10.t0 = _context10["catch"](0);
1069
- throw _context10.t0;
1070
- case 19:
1071
- case "end":
1072
- return _context10.stop();
1073
- }
1074
- }, _callee10, this, [[0, 16]]);
1075
- }));
1076
- function clearOrderCartLines() {
1077
- return _clearOrderCartLines.apply(this, arguments);
1078
- }
1079
- return clearOrderCartLines;
1080
- }())
1081
633
  }, {
1082
634
  key: "getOrderProducts",
1083
635
  value: function getOrderProducts() {
@@ -1088,384 +640,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1088
640
  }, {
1089
641
  key: "getSummary",
1090
642
  value: function () {
1091
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
643
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1092
644
  var summary;
1093
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1094
- while (1) switch (_context11.prev = _context11.next) {
1095
- case 0:
1096
- _context11.prev = 0;
1097
- if (this.store.order) {
1098
- _context11.next = 3;
1099
- break;
1100
- }
1101
- throw new Error('order 模块未初始化');
1102
- case 3:
1103
- _context11.next = 5;
1104
- return this.store.order.getOrderSummary();
1105
- case 5:
1106
- summary = _context11.sent;
1107
- return _context11.abrupt("return", summary);
1108
- case 9:
1109
- _context11.prev = 9;
1110
- _context11.t0 = _context11["catch"](0);
1111
- throw _context11.t0;
1112
- case 12:
1113
- case "end":
1114
- return _context11.stop();
1115
- }
1116
- }, _callee11, this, [[0, 9]]);
1117
- }));
1118
- function getSummary() {
1119
- return _getSummary.apply(this, arguments);
1120
- }
1121
- return getSummary;
1122
- }()
1123
- }, {
1124
- key: "getHistoricalProductDiscountList",
1125
- value: function getHistoricalProductDiscountList(products) {
1126
- var _this5 = this;
1127
- var historyDiscountList = [];
1128
- products.forEach(function (item) {
1129
- if (!_this5.isPersistedOrderProduct(item)) return;
1130
- (item.discount_list || []).forEach(function (discount) {
1131
- var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
1132
- var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
1133
- if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
1134
- var quantity = item.quantity || item.num || item.product_quantity || 1;
1135
- var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
1136
- var index = historyDiscountList.findIndex(function (n) {
1137
- return n.id === discountId;
1138
- });
1139
- if (index !== -1) {
1140
- historyDiscountList[index] = _objectSpread(_objectSpread({}, historyDiscountList[index]), {}, {
1141
- amount: new Decimal(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
1142
- savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
1143
- });
1144
- return;
1145
- }
1146
- historyDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
1147
- id: discountId,
1148
- tag: discount.tag || discount.type,
1149
- name: discount.name || ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 || (_discount$discount2 = _discount$discount2.title) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.auto),
1150
- format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
1151
- isEditMode: true,
1152
- limited_relation_product_data: {},
1153
- savedAmount: savedAmount.toNumber(),
1154
- isAvailable: true,
1155
- isDisabled: true,
1156
- isSelected: true,
1157
- product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
1158
- }));
1159
- });
1160
- });
1161
- return historyDiscountList;
1162
- }
1163
- }, {
1164
- key: "isPersistedOrderProduct",
1165
- value: function isPersistedOrderProduct(product) {
1166
- var _product$order_detail, _product$booking_id;
1167
- var orderDetailId = (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product.orderDetailId;
1168
- if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
1169
- return true;
1170
- }
1171
- var bookingId = (_product$booking_id = product.booking_id) !== null && _product$booking_id !== void 0 ? _product$booking_id : product.bookingId;
1172
- return bookingId !== undefined && bookingId !== null && bookingId !== '';
1173
- }
1174
- }, {
1175
- key: "mergeHistoricalDiscountList",
1176
- value: function mergeHistoricalDiscountList(discountList, products) {
1177
- var historyDiscountList = this.getHistoricalProductDiscountList(products);
1178
- var historyIds = new Set(historyDiscountList.map(function (discount) {
1179
- return discount.id;
1180
- }));
1181
- return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
1182
- return !historyIds.has(discount.id);
1183
- })));
1184
- }
1185
- }, {
1186
- key: "mergeCurrentDiscountSelectionState",
1187
- value: function mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
1188
- if (!currentDiscountList.length) return discountList;
1189
- var currentDiscountMap = new Map(currentDiscountList.map(function (discount) {
1190
- return [discount.id, discount];
1191
- }));
1192
- return discountList.map(function (discount) {
1193
- var currentDiscount = currentDiscountMap.get(discount.id);
1194
- if (!currentDiscount) return discount;
1195
- if (currentDiscount.isManualSelect) {
1196
- return _objectSpread(_objectSpread({}, discount), {}, {
1197
- isSelected: false,
1198
- isManualSelect: true
1199
- });
1200
- }
1201
- if (currentDiscount.isSelected) {
1202
- return _objectSpread(_objectSpread({}, discount), {}, {
1203
- isSelected: true,
1204
- isManualSelect: false
1205
- });
1206
- }
1207
- return discount;
1208
- });
1209
- }
1210
- }, {
1211
- key: "loadDiscountConfig",
1212
- value: function () {
1213
- var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
1214
- var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
1215
- var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata2, _tempOrder$_extend3, _product$metadata3, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
1216
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1217
- while (1) switch (_context12.prev = _context12.next) {
1218
- case 0:
1219
- if (this.store.order) {
1220
- _context12.next = 2;
1221
- break;
1222
- }
1223
- throw new Error('order 模块未初始化');
1224
- case 2:
1225
- tempOrder = this.store.order.ensureTempOrder();
1226
- orderStore = this.store.order.store || {};
1227
- discountModule = orderStore.discount;
1228
- rulesModule = orderStore.rules;
1229
- orderId = tempOrder.order_id || ((_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 || (_this$getOrderIdentit = _this$getOrderIdentit.call(this)) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.orderId);
1230
- customerId = Number((params === null || params === void 0 ? void 0 : params.customerId) || tempOrder.customer_id || ((_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id) || ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.customerSnapshot) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.id) || ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.customerSnapshot) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2.customer_id) || 0);
1231
- currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
1232
- originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
1233
- hasManualDiscountSelection = this.hasManualDiscountSelection || currentDiscountList.some(function (discount) {
1234
- return discount.isManualSelect;
1235
- });
1236
- discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
1237
- discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
1238
- preparedDiscountList = [];
1239
- if (!(customerId && customerId !== 1)) {
1240
- _context12.next = 25;
1241
- break;
1242
- }
1243
- if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
1244
- _context12.next = 19;
1245
- break;
1246
- }
1247
- preparedDiscountList = originalDiscountList;
1248
- _context12.next = 25;
1249
- break;
1250
- case 19:
1251
- _context12.next = 21;
1252
- return this.store.order.loadDiscountConfig({
1253
- customerId: customerId,
1254
- action: discountAction,
1255
- orderId: Number(orderId) || undefined,
1256
- apply: false
1257
- });
1258
- case 21:
1259
- preparedDiscountList = _context12.sent;
1260
- this.discountConfigCacheKey = discountConfigCacheKey;
1261
- _context12.next = 25;
1262
- return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
1263
- case 25:
1264
- if (!(hasManualDiscountSelection && currentDiscountList.length)) {
1265
- _context12.next = 27;
1266
- break;
1267
- }
1268
- return _context12.abrupt("return", {
1269
- productList: tempOrder.products || [],
1270
- discountList: currentDiscountList
1271
- });
1272
- case 27:
1273
- nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
1274
- nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
1275
- _context12.next = 31;
1276
- return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1277
- case 31:
1278
- if (!rulesModule) {
1279
- _context12.next = 67;
1280
- break;
1281
- }
1282
- holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
1283
- form_record_id: tempOrder.holder.form_record_id
1284
- }] : [];
1285
- result = rulesModule.calcDiscount({
1286
- productList: tempOrder.products,
1287
- discountList: nextDiscountList,
1288
- holders: holders,
1289
- isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
1290
- orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
1291
- }) || {
1292
- productList: tempOrder.products,
1293
- discountList: nextDiscountList
1294
- };
1295
- if (result.productList) {
1296
- tempOrder.products = result.productList;
1297
- }
1298
- _iterator = _createForOfIteratorHelper(tempOrder.products || []);
1299
- _context12.prev = 36;
1300
- _iterator.s();
1301
- case 38:
1302
- if ((_step = _iterator.n()).done) {
1303
- _context12.next = 53;
1304
- break;
1305
- }
1306
- product = _step.value;
1307
- productUid = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number;
1308
- runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
1309
- if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.is_manual_discount)) {
1310
- _context12.next = 44;
1311
- break;
1312
- }
1313
- return _context12.abrupt("continue", 51);
1314
- case 44:
1315
- totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
1316
- return sum + Number(pd.amount || 0);
1317
- }, 0);
1318
- optionSum = sumOptionUnitPrice(product.product_option_item);
1319
- 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';
1320
- newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1321
- newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
1322
- if (product.metadata) {
1323
- product.metadata.main_product_selling_price = newMainSellingPrice;
1324
- product.metadata.price_schema_version = 2;
1325
- }
1326
- product.selling_price = composeLinePrice({
1327
- mainPrice: newMainSellingPrice,
1328
- bundle: product.product_bundle
1329
- });
1330
- case 51:
1331
- _context12.next = 38;
1332
- break;
1333
- case 53:
1334
- _context12.next = 58;
1335
- break;
1336
- case 55:
1337
- _context12.prev = 55;
1338
- _context12.t0 = _context12["catch"](36);
1339
- _iterator.e(_context12.t0);
1340
- case 58:
1341
- _context12.prev = 58;
1342
- _iterator.f();
1343
- return _context12.finish(58);
1344
- case 61:
1345
- if (!result.discountList) {
1346
- _context12.next = 67;
1347
- break;
1348
- }
1349
- nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1350
- OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1351
- _context12.next = 66;
1352
- return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1353
- case 66:
1354
- tempOrder.discount_list = nextDiscountList.filter(function (discount) {
1355
- return discount.isSelected;
1356
- });
1357
- case 67:
1358
- _context12.next = 69;
1359
- return this.store.order.recalculateSummary({
1360
- createIfMissing: true
1361
- });
1362
- case 69:
1363
- summary = _context12.sent;
1364
- this.store.order.persistTempOrder();
1365
- _context12.next = 73;
1366
- return this.effectsEmit('onDiscountApplied', {
1367
- productList: tempOrder.products || [],
1368
- discountList: nextDiscountList,
1369
- selectedDiscountList: tempOrder.discount_list || [],
1370
- tempOrder: tempOrder
1371
- });
1372
- case 73:
1373
- return _context12.abrupt("return", {
1374
- productList: tempOrder.products || [],
1375
- discountList: nextDiscountList
1376
- });
1377
- case 74:
1378
- case "end":
1379
- return _context12.stop();
1380
- }
1381
- }, _callee12, this, [[36, 55, 58, 61]]);
1382
- }));
1383
- function loadDiscountConfig(_x7) {
1384
- return _loadDiscountConfig.apply(this, arguments);
1385
- }
1386
- return loadDiscountConfig;
1387
- }()
1388
- }, {
1389
- key: "bestDiscount",
1390
- value: function () {
1391
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(cb) {
1392
- var _discountModule$getOr2, _discountModule$getDi3;
1393
- var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
1394
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1395
- while (1) switch (_context13.prev = _context13.next) {
1396
- case 0:
1397
- if (this.store.order) {
1398
- _context13.next = 2;
1399
- break;
1400
- }
1401
- throw new Error('order 模块未初始化');
1402
- case 2:
1403
- tempOrder = this.store.order.ensureTempOrder();
1404
- orderStore = this.store.order.store || {};
1405
- discountModule = orderStore.discount;
1406
- rulesModule = orderStore.rules;
1407
- originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr2 = discountModule.getOriginalDiscountList) === null || _discountModule$getOr2 === void 0 ? void 0 : _discountModule$getOr2.call(discountModule)) || this.getDiscountList();
1408
- currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi3 = discountModule.getDiscountList) === null || _discountModule$getDi3 === void 0 ? void 0 : _discountModule$getDi3.call(discountModule)) || [];
1409
- nextDiscountList = this.mergeHistoricalDiscountList(originalDiscountList || [], tempOrder.products || []);
1410
- result = {
1411
- productList: tempOrder.products || [],
1412
- discountList: nextDiscountList
1413
- };
1414
- _context13.next = 12;
1415
- return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1416
- case 12:
1417
- if (!rulesModule) {
1418
- _context13.next = 23;
1419
- break;
1420
- }
1421
- holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
1422
- form_record_id: tempOrder.holder.form_record_id
1423
- }] : [];
1424
- result = rulesModule.calcDiscount({
1425
- productList: tempOrder.products,
1426
- discountList: nextDiscountList,
1427
- holders: holders,
1428
- isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
1429
- orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
1430
- }) || result;
1431
- if (result.productList) {
1432
- tempOrder.products = result.productList;
1433
- }
1434
- if (!result.discountList) {
1435
- _context13.next = 23;
1436
- break;
1437
- }
1438
- nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1439
- OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1440
- _context13.next = 21;
1441
- return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1442
- case 21:
1443
- tempOrder.discount_list = nextDiscountList.filter(function (discount) {
1444
- return discount.isSelected;
1445
- });
1446
- result = {
1447
- productList: tempOrder.products,
1448
- discountList: nextDiscountList
1449
- };
1450
- case 23:
1451
- _context13.next = 25;
1452
- return this.store.order.recalculateSummary({
1453
- createIfMissing: true
1454
- });
1455
- case 25:
1456
- this.store.order.persistTempOrder();
1457
- cb === null || cb === void 0 || cb(result);
1458
- return _context13.abrupt("return", result);
1459
- case 28:
645
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
646
+ while (1) switch (_context7.prev = _context7.next) {
647
+ case 0:
648
+ _context7.prev = 0;
649
+ if (this.store.order) {
650
+ _context7.next = 3;
651
+ break;
652
+ }
653
+ throw new Error('order 模块未初始化');
654
+ case 3:
655
+ _context7.next = 5;
656
+ return this.store.order.getOrderSummary();
657
+ case 5:
658
+ summary = _context7.sent;
659
+ return _context7.abrupt("return", summary);
660
+ case 9:
661
+ _context7.prev = 9;
662
+ _context7.t0 = _context7["catch"](0);
663
+ throw _context7.t0;
664
+ case 12:
1460
665
  case "end":
1461
- return _context13.stop();
666
+ return _context7.stop();
1462
667
  }
1463
- }, _callee13, this);
668
+ }, _callee7, this, [[0, 9]]);
1464
669
  }));
1465
- function bestDiscount(_x8) {
1466
- return _bestDiscount.apply(this, arguments);
670
+ function getSummary() {
671
+ return _getSummary.apply(this, arguments);
1467
672
  }
1468
- return bestDiscount;
673
+ return getSummary;
1469
674
  }()
1470
675
  }, {
1471
676
  key: "getDiscountList",
@@ -1476,49 +681,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1476
681
  }, {
1477
682
  key: "scanPromotionCode",
1478
683
  value: function () {
1479
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(code, customerId) {
684
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(code, customerId) {
1480
685
  var raw;
1481
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1482
- while (1) switch (_context14.prev = _context14.next) {
686
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
687
+ while (1) switch (_context8.prev = _context8.next) {
1483
688
  case 0:
1484
- _context14.prev = 0;
689
+ _context8.prev = 0;
1485
690
  if (this.store.order) {
1486
- _context14.next = 3;
691
+ _context8.next = 3;
1487
692
  break;
1488
693
  }
1489
694
  throw new Error('order 模块未初始化');
1490
695
  case 3:
1491
- _context14.next = 5;
696
+ _context8.next = 5;
1492
697
  return this.store.order.scanCode(code, customerId);
1493
698
  case 5:
1494
- raw = _context14.sent;
699
+ raw = _context8.sent;
1495
700
  if (!raw.isAvailable) {
1496
- _context14.next = 10;
701
+ _context8.next = 10;
1497
702
  break;
1498
703
  }
1499
- _context14.next = 9;
704
+ _context8.next = 9;
1500
705
  return this.store.order.recalculateSummary({
1501
706
  createIfMissing: true
1502
707
  });
1503
708
  case 9:
1504
709
  this.store.order.persistTempOrder();
1505
710
  case 10:
1506
- return _context14.abrupt("return", {
711
+ return _context8.abrupt("return", {
1507
712
  isAvailable: raw.isAvailable,
1508
713
  type: raw.type,
1509
714
  unavailableReason: raw.unavailableReason
1510
715
  });
1511
716
  case 13:
1512
- _context14.prev = 13;
1513
- _context14.t0 = _context14["catch"](0);
1514
- throw _context14.t0;
717
+ _context8.prev = 13;
718
+ _context8.t0 = _context8["catch"](0);
719
+ throw _context8.t0;
1515
720
  case 16:
1516
721
  case "end":
1517
- return _context14.stop();
722
+ return _context8.stop();
1518
723
  }
1519
- }, _callee14, this, [[0, 13]]);
724
+ }, _callee8, this, [[0, 13]]);
1520
725
  }));
1521
- function scanPromotionCode(_x9, _x10) {
726
+ function scanPromotionCode(_x3, _x4) {
1522
727
  return _scanPromotionCode.apply(this, arguments);
1523
728
  }
1524
729
  return scanPromotionCode;
@@ -1526,14 +731,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1526
731
  }, {
1527
732
  key: "setDiscountSelected",
1528
733
  value: function () {
1529
- var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1530
- var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$metadata6, _tempOrder$_extend4, _product$metadata7, _product$metadata$sou2, _product$metadata8, _product$metadata9, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1531
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1532
- while (1) switch (_context15.prev = _context15.next) {
734
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
735
+ var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator, _step, d, selectedResourceIds, _iterator2, _step2, _product$metadata, _tempOrder$_extend, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
736
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
737
+ while (1) switch (_context9.prev = _context9.next) {
1533
738
  case 0:
1534
- _context15.prev = 0;
739
+ _context9.prev = 0;
1535
740
  if (this.store.order) {
1536
- _context15.next = 3;
741
+ _context9.next = 3;
1537
742
  break;
1538
743
  }
1539
744
  throw new Error('order 模块未初始化');
@@ -1545,24 +750,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1545
750
  isManualSelect: !params.isSelected
1546
751
  }) : d;
1547
752
  });
1548
- this.hasManualDiscountSelection = true;
1549
753
  tempOrder = this.store.order.ensureTempOrder();
1550
754
  orderStore = this.store.order.store || {};
1551
755
  discountModule = orderStore.discount;
1552
756
  rulesModule = orderStore.rules;
1553
- holders = (_tempOrder$holder5 = tempOrder.holder) !== null && _tempOrder$holder5 !== void 0 && _tempOrder$holder5.form_record_id ? [{
757
+ holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
1554
758
  form_record_id: tempOrder.holder.form_record_id
1555
759
  }] : [];
1556
760
  nextDiscountList = updated;
1557
- _context15.next = 14;
761
+ _context9.next = 13;
1558
762
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
1559
- case 14:
763
+ case 13:
1560
764
  if (rulesModule) {
1561
765
  result = rulesModule.calcDiscount({
1562
766
  productList: tempOrder.products,
1563
767
  discountList: updated,
1564
768
  holders: holders,
1565
- isFormSubject: !!((_tempOrder$holder6 = tempOrder.holder) !== null && _tempOrder$holder6 !== void 0 && _tempOrder$holder6.type) && tempOrder.holder.type === 'form'
769
+ isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
1566
770
  }, {
1567
771
  discountId: params.discountId,
1568
772
  isSelected: params.isSelected
@@ -1581,19 +785,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1581
785
  }).map(function (d) {
1582
786
  return d.id;
1583
787
  }));
1584
- _iterator2 = _createForOfIteratorHelper(nextDiscountList);
788
+ _iterator = _createForOfIteratorHelper(nextDiscountList);
1585
789
  try {
1586
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1587
- d = _step2.value;
790
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
791
+ d = _step.value;
1588
792
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
1589
793
  d.isSelected = false;
1590
- d.isManualSelect = true;
1591
794
  }
1592
795
  }
1593
796
  } catch (err) {
1594
- _iterator2.e(err);
797
+ _iterator.e(err);
1595
798
  } finally {
1596
- _iterator2.f();
799
+ _iterator.f();
1597
800
  }
1598
801
  }
1599
802
  }
@@ -1603,23 +806,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1603
806
  }).map(function (d) {
1604
807
  return d.id;
1605
808
  }));
1606
- _iterator3 = _createForOfIteratorHelper(tempOrder.products);
1607
- _context15.prev = 17;
1608
- _iterator3.s();
1609
- case 19:
1610
- if ((_step3 = _iterator3.n()).done) {
1611
- _context15.next = 35;
809
+ _iterator2 = _createForOfIteratorHelper(tempOrder.products);
810
+ _context9.prev = 16;
811
+ _iterator2.s();
812
+ case 18:
813
+ if ((_step2 = _iterator2.n()).done) {
814
+ _context9.next = 34;
1612
815
  break;
1613
816
  }
1614
- product = _step3.value;
1615
- productUid = (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number;
1616
- runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
1617
- if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.is_manual_discount)) {
1618
- _context15.next = 25;
817
+ product = _step2.value;
818
+ productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
819
+ runtimeOrigin = productUid ? (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.productsByUid) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend[productUid]) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.origin : undefined;
820
+ if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
821
+ _context9.next = 24;
1619
822
  break;
1620
823
  }
1621
- return _context15.abrupt("continue", 33);
1622
- case 25:
824
+ return _context9.abrupt("continue", 32);
825
+ case 24:
1623
826
  product.discount_list = (product.discount_list || []).filter(function (pd) {
1624
827
  var _pd$discount$resource, _pd$discount;
1625
828
  var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
@@ -1632,7 +835,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1632
835
  return sum + (pd.amount || 0);
1633
836
  }, 0); // TODO 这块逻辑需要拿掉
1634
837
  optionSum = sumOptionUnitPrice(product.product_option_item);
1635
- sourcePrice = (_product$metadata$sou2 = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.source_product_price) !== null && _product$metadata$sou2 !== void 0 ? _product$metadata$sou2 : ((_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
838
+ 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';
1636
839
  newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
1637
840
  newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
1638
841
  if (product.metadata) {
@@ -1643,134 +846,66 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1643
846
  mainPrice: newMainSellingPrice,
1644
847
  bundle: product.product_bundle
1645
848
  });
1646
- case 33:
1647
- _context15.next = 19;
849
+ case 32:
850
+ _context9.next = 18;
1648
851
  break;
1649
- case 35:
1650
- _context15.next = 40;
852
+ case 34:
853
+ _context9.next = 39;
1651
854
  break;
1652
- case 37:
1653
- _context15.prev = 37;
1654
- _context15.t0 = _context15["catch"](17);
1655
- _iterator3.e(_context15.t0);
1656
- case 40:
1657
- _context15.prev = 40;
1658
- _iterator3.f();
1659
- return _context15.finish(40);
1660
- case 43:
855
+ case 36:
856
+ _context9.prev = 36;
857
+ _context9.t0 = _context9["catch"](16);
858
+ _iterator2.e(_context9.t0);
859
+ case 39:
860
+ _context9.prev = 39;
861
+ _iterator2.f();
862
+ return _context9.finish(39);
863
+ case 42:
1661
864
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1662
- _context15.next = 46;
865
+ _context9.next = 45;
1663
866
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1664
- case 46:
867
+ case 45:
1665
868
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
1666
869
  return d.isSelected;
1667
870
  });
1668
- _context15.next = 49;
871
+ _context9.next = 48;
1669
872
  return this.store.order.recalculateSummary({
1670
873
  createIfMissing: true
1671
874
  });
1672
- case 49:
875
+ case 48:
1673
876
  this.store.order.persistTempOrder();
1674
- this.effectsEmit('onDiscountApplied', {
1675
- productList: tempOrder.products,
1676
- discountList: nextDiscountList,
1677
- selectedDiscountList: tempOrder.discount_list,
1678
- tempOrder: tempOrder
1679
- });
1680
- _context15.next = 56;
877
+ _context9.next = 54;
1681
878
  break;
1682
- case 53:
1683
- _context15.prev = 53;
1684
- _context15.t1 = _context15["catch"](0);
1685
- throw _context15.t1;
1686
- case 56:
879
+ case 51:
880
+ _context9.prev = 51;
881
+ _context9.t1 = _context9["catch"](0);
882
+ throw _context9.t1;
883
+ case 54:
1687
884
  case "end":
1688
- return _context15.stop();
885
+ return _context9.stop();
1689
886
  }
1690
- }, _callee15, this, [[0, 53], [17, 37, 40, 43]]);
887
+ }, _callee9, this, [[0, 51], [16, 36, 39, 42]]);
1691
888
  }));
1692
- function setDiscountSelected(_x11) {
889
+ function setDiscountSelected(_x5) {
1693
890
  return _setDiscountSelected.apply(this, arguments);
1694
891
  }
1695
892
  return setDiscountSelected;
1696
893
  }()
1697
- }, {
1698
- key: "applyDiscountCalculationResult",
1699
- value: function () {
1700
- var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(result) {
1701
- var tempOrder, orderStore, discountModule;
1702
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1703
- while (1) switch (_context16.prev = _context16.next) {
1704
- case 0:
1705
- _context16.prev = 0;
1706
- if (this.store.order) {
1707
- _context16.next = 3;
1708
- break;
1709
- }
1710
- throw new Error('order 模块未初始化');
1711
- case 3:
1712
- if (result) {
1713
- _context16.next = 5;
1714
- break;
1715
- }
1716
- return _context16.abrupt("return");
1717
- case 5:
1718
- tempOrder = this.store.order.ensureTempOrder();
1719
- orderStore = this.store.order.store || {};
1720
- discountModule = orderStore.discount;
1721
- if (result.productList) {
1722
- tempOrder.products = result.productList;
1723
- }
1724
- if (!result.discountList) {
1725
- _context16.next = 14;
1726
- break;
1727
- }
1728
- OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
1729
- _context16.next = 13;
1730
- return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
1731
- case 13:
1732
- tempOrder.discount_list = result.discountList.filter(function (discount) {
1733
- return discount.isSelected;
1734
- });
1735
- case 14:
1736
- _context16.next = 16;
1737
- return this.store.order.recalculateSummary({
1738
- createIfMissing: true
1739
- });
1740
- case 16:
1741
- this.store.order.persistTempOrder();
1742
- _context16.next = 22;
1743
- break;
1744
- case 19:
1745
- _context16.prev = 19;
1746
- _context16.t0 = _context16["catch"](0);
1747
- throw _context16.t0;
1748
- case 22:
1749
- case "end":
1750
- return _context16.stop();
1751
- }
1752
- }, _callee16, this, [[0, 19]]);
1753
- }));
1754
- function applyDiscountCalculationResult(_x12) {
1755
- return _applyDiscountCalculationResult.apply(this, arguments);
1756
- }
1757
- return applyDiscountCalculationResult;
1758
- }()
1759
894
  }, {
1760
895
  key: "submitScanOrder",
1761
896
  value: function () {
1762
- var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1763
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1764
- while (1) switch (_context17.prev = _context17.next) {
897
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
898
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
899
+ while (1) switch (_context10.prev = _context10.next) {
1765
900
  case 0:
1766
- return _context17.abrupt("return", this.submitSalesOrder(params));
901
+ return _context10.abrupt("return", this.submitSalesOrder(params));
1767
902
  case 1:
1768
903
  case "end":
1769
- return _context17.stop();
904
+ return _context10.stop();
1770
905
  }
1771
- }, _callee17, this);
906
+ }, _callee10, this);
1772
907
  }));
1773
- function submitScanOrder(_x13) {
908
+ function submitScanOrder(_x6) {
1774
909
  return _submitScanOrder.apply(this, arguments);
1775
910
  }
1776
911
  return submitScanOrder;
@@ -1784,14 +919,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1784
919
  }, {
1785
920
  key: "submitSalesOrder",
1786
921
  value: (function () {
1787
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1788
- var _this$otherParams5, _this$otherParams6, _this$otherParams7;
922
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
923
+ var _this$otherParams2, _this$otherParams3, _this$otherParams4, _this$otherParams5;
1789
924
  var submitParams;
1790
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1791
- while (1) switch (_context18.prev = _context18.next) {
925
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
926
+ while (1) switch (_context11.prev = _context11.next) {
1792
927
  case 0:
1793
928
  if (this.store.order) {
1794
- _context18.next = 2;
929
+ _context11.next = 2;
1795
930
  break;
1796
931
  }
1797
932
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -1799,10 +934,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1799
934
  this.store.order.persistTempOrder();
1800
935
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
1801
936
  cacheId: this.cacheId,
1802
- platform: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform,
1803
- businessCode: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.businessCode,
1804
- channel: this.getSubmitOrderSalesChannel(),
1805
- type: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.type
937
+ platform: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform,
938
+ businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode,
939
+ channel: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.channel,
940
+ type: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.type
1806
941
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
1807
942
  payments: params.payments
1808
943
  } : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
@@ -1812,15 +947,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1812
947
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
1813
948
  enhancePayload: params.enhancePayload
1814
949
  } : {});
1815
- console.log(submitParams, 'submitParams123');
1816
- return _context18.abrupt("return", this.store.order.submitTempOrder(submitParams));
1817
- case 6:
950
+ return _context11.abrupt("return", this.store.order.submitTempOrder(submitParams));
951
+ case 5:
1818
952
  case "end":
1819
- return _context18.stop();
953
+ return _context11.stop();
1820
954
  }
1821
- }, _callee18, this);
955
+ }, _callee11, this);
1822
956
  }));
1823
- function submitSalesOrder(_x14) {
957
+ function submitSalesOrder(_x7) {
1824
958
  return _submitSalesOrder.apply(this, arguments);
1825
959
  }
1826
960
  return submitSalesOrder;
@@ -1828,75 +962,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1828
962
  }, {
1829
963
  key: "syncPaymentsToOrder",
1830
964
  value: function () {
1831
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1832
- var _params$channel;
1833
- var channel, syncParams, syncState, payments, syncResult;
1834
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1835
- while (1) switch (_context19.prev = _context19.next) {
965
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
966
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
967
+ while (1) switch (_context12.prev = _context12.next) {
1836
968
  case 0:
1837
969
  if (this.store.order) {
1838
- _context19.next = 2;
970
+ _context12.next = 2;
1839
971
  break;
1840
972
  }
1841
973
  throw new Error('order 模块未初始化');
1842
974
  case 2:
1843
- channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
1844
- syncParams = _objectSpread(_objectSpread({}, params), channel !== undefined ? {
1845
- channel: channel
1846
- } : {});
1847
- syncState = this.store.order.getOrderSyncState();
1848
- if (!(params.submitWhenPaid && syncState === 'submitting')) {
1849
- _context19.next = 7;
1850
- break;
1851
- }
1852
- return _context19.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
1853
- case 7:
1854
- payments = params.payments || [];
1855
- _context19.next = 10;
1856
- return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
1857
- payments: payments,
1858
- params: syncParams,
1859
- amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1860
- orderSnapshot: this.store.order.getOrderSnapshot()
1861
- });
1862
- case 10:
1863
- _context19.prev = 10;
1864
- _context19.next = 13;
1865
- return this.store.order.syncPaymentsToOrder(syncParams);
1866
- case 13:
1867
- syncResult = _context19.sent;
1868
- _context19.next = 16;
1869
- return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1870
- ok: true,
1871
- syncResult: syncResult,
1872
- payments: this.store.order.getOrderPayments(),
1873
- params: syncParams,
1874
- amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1875
- orderSnapshot: this.store.order.getOrderSnapshot()
1876
- });
1877
- case 16:
1878
- return _context19.abrupt("return", syncResult);
1879
- case 19:
1880
- _context19.prev = 19;
1881
- _context19.t0 = _context19["catch"](10);
1882
- _context19.next = 23;
1883
- return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1884
- ok: false,
1885
- error: _context19.t0,
1886
- payments: this.store.order.getOrderPayments(),
1887
- params: syncParams,
1888
- amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1889
- orderSnapshot: this.store.order.getOrderSnapshot()
1890
- });
1891
- case 23:
1892
- throw _context19.t0;
1893
- case 24:
975
+ return _context12.abrupt("return", this.store.order.syncPaymentsToOrder(params));
976
+ case 3:
1894
977
  case "end":
1895
- return _context19.stop();
978
+ return _context12.stop();
1896
979
  }
1897
- }, _callee19, this, [[10, 19]]);
980
+ }, _callee12, this);
1898
981
  }));
1899
- function syncPaymentsToOrder(_x15) {
982
+ function syncPaymentsToOrder(_x8) {
1900
983
  return _syncPaymentsToOrder.apply(this, arguments);
1901
984
  }
1902
985
  return syncPaymentsToOrder;
@@ -1920,32 +1003,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1920
1003
  }, {
1921
1004
  key: "addOrderPayment",
1922
1005
  value: function addOrderPayment(payment) {
1923
- var _this6 = this;
1924
1006
  if (!this.store.order) throw new Error('order 模块未初始化');
1925
- var paymentRecord = payment;
1926
- var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
1927
- if (!metadata.unique_identification_number) {
1928
- metadata.unique_identification_number = createUuidV4();
1929
- }
1930
- var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread({}, paymentRecord), {}, {
1931
- metadata: metadata
1932
- }));
1933
- var amountSnapshot = this.store.order.getOrderAmountSnapshot();
1934
- var syncState = this.store.order.getOrderSyncState();
1935
- if (amountSnapshot && syncState !== 'submitting') {
1936
- var paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? 'paid' : 'partially_paid';
1937
- void this.syncPaymentsToOrder({
1938
- payments: payments,
1939
- paymentStatus: paymentStatus,
1940
- submitWhenPaid: true,
1941
- smallTicketDataFlag: 1
1942
- }).catch(function (error) {
1943
- _this6.logError('auto sync payments failed', {
1944
- error: error instanceof Error ? error.message : String(error)
1945
- });
1946
- });
1947
- }
1948
- return payments;
1007
+ return this.store.order.addOrderPayment(payment);
1949
1008
  }
1950
1009
 
1951
1010
  /** 更新当前订单中的指定支付项。 */
@@ -1974,25 +1033,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1974
1033
  }, {
1975
1034
  key: "getWalletProductList",
1976
1035
  value: function getWalletProductList() {
1977
- var _this$store$order3, _tempOrder$products, _tempOrder$products2;
1978
- var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
1036
+ var _this$store$order2, _tempOrder$products;
1037
+ var tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder();
1979
1038
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
1980
- // 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
1981
- var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
1982
- return n.product_id;
1983
- });
1984
- return products.map(function (product) {
1985
- var _product$product_vari2, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
1039
+ return tempOrder.products.map(function (product) {
1040
+ var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
1986
1041
  var metadata = product.metadata || {};
1987
1042
  return {
1988
1043
  product_id: product.product_id,
1989
- product_variant_id: String((_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : ''),
1044
+ product_variant_id: String((_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : ''),
1990
1045
  quantity: product.num || 1,
1991
1046
  is_price_include_tax: tempOrder.is_price_include_tax,
1992
1047
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
1993
1048
  tax_fee: product.tax_fee,
1994
1049
  selling_price: Number(product.selling_price || 0),
1995
- discount_list: product.discount_list || [],
1996
1050
  holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
1997
1051
  original_price: product.original_price,
1998
1052
  main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
@@ -2003,14 +1057,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2003
1057
  surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
2004
1058
  },
2005
1059
  product_bundle: (product.product_bundle || []).map(function (bundle) {
2006
- var _bundle$bundle_id2, _bundle$bundle_produc2, _bundle$bundle_group_2;
2007
1060
  var bundleMetadata = bundle.metadata || {};
2008
1061
  return {
2009
1062
  is_price_include_tax: tempOrder.is_price_include_tax,
2010
- // 套餐子项在 tempOrder 上常为 id(如 1718),prepare/deduction 协议要求 bundle_id
2011
- bundle_id: (_bundle$bundle_id2 = bundle.bundle_id) !== null && _bundle$bundle_id2 !== void 0 ? _bundle$bundle_id2 : bundle.id,
2012
- bundle_product_id: (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id,
2013
- bundle_group_id: (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id,
1063
+ bundle_id: bundle.bundle_id,
1064
+ bundle_product_id: bundle.bundle_product_id,
2014
1065
  bundle_variant_id: bundle.bundle_variant_id,
2015
1066
  price_type: bundle.price_type,
2016
1067
  price_type_ext: bundle.price_type_ext,
@@ -2031,20 +1082,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2031
1082
  }, {
2032
1083
  key: "initWalletData",
2033
1084
  value: function () {
2034
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2035
- var _params$order_wait_pa, _ref9, _tempOrder$is_price_i;
1085
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1086
+ var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
2036
1087
  var snapshot, tempOrder, amount, walletBusinessData, result;
2037
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2038
- while (1) switch (_context20.prev = _context20.next) {
1088
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1089
+ while (1) switch (_context13.prev = _context13.next) {
2039
1090
  case 0:
2040
1091
  if (this.store.order) {
2041
- _context20.next = 2;
1092
+ _context13.next = 2;
2042
1093
  break;
2043
1094
  }
2044
1095
  throw new Error('order 模块未初始化');
2045
1096
  case 2:
2046
1097
  if (this.store.payment) {
2047
- _context20.next = 4;
1098
+ _context13.next = 4;
2048
1099
  break;
2049
1100
  }
2050
1101
  throw new Error('payment 模块未初始化');
@@ -2053,10 +1104,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2053
1104
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
2054
1105
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
2055
1106
  if (!(!tempOrder || !amount)) {
2056
- _context20.next = 9;
1107
+ _context13.next = 9;
2057
1108
  break;
2058
1109
  }
2059
- return _context20.abrupt("return", {
1110
+ return _context13.abrupt("return", {
2060
1111
  walletRecommendList: [],
2061
1112
  userIdentificationCodes: [],
2062
1113
  transformList: [],
@@ -2075,15 +1126,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2075
1126
  },
2076
1127
  products: this.getWalletProductList(),
2077
1128
  order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
2078
- is_price_include_tax: (_ref9 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref9 !== void 0 ? _ref9 : 1
1129
+ is_price_include_tax: (_ref = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref !== void 0 ? _ref : 1
2079
1130
  }, snapshot.identity.orderId ? {
2080
1131
  payment_order_id: String(snapshot.identity.orderId)
2081
1132
  } : {});
2082
- _context20.next = 12;
1133
+ _context13.next = 12;
2083
1134
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
2084
1135
  case 12:
2085
- result = _context20.sent;
2086
- _context20.next = 15;
1136
+ result = _context13.sent;
1137
+ _context13.next = 15;
2087
1138
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
2088
1139
  orderId: snapshot.identity.orderId,
2089
1140
  customerId: walletBusinessData.customer_id,
@@ -2095,14 +1146,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2095
1146
  timestamp: Date.now()
2096
1147
  });
2097
1148
  case 15:
2098
- return _context20.abrupt("return", result);
1149
+ return _context13.abrupt("return", result);
2099
1150
  case 16:
2100
1151
  case "end":
2101
- return _context20.stop();
1152
+ return _context13.stop();
2102
1153
  }
2103
- }, _callee20, this);
1154
+ }, _callee13, this);
2104
1155
  }));
2105
- function initWalletData(_x16) {
1156
+ function initWalletData(_x9) {
2106
1157
  return _initWalletData.apply(this, arguments);
2107
1158
  }
2108
1159
  return initWalletData;
@@ -2129,27 +1180,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2129
1180
  }, {
2130
1181
  key: "getPaymentMethodsAsync",
2131
1182
  value: (function () {
2132
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1183
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
2133
1184
  var response;
2134
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2135
- while (1) switch (_context21.prev = _context21.next) {
1185
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1186
+ while (1) switch (_context14.prev = _context14.next) {
2136
1187
  case 0:
2137
1188
  if (!this.store.payment) {
2138
- _context21.next = 2;
1189
+ _context14.next = 2;
2139
1190
  break;
2140
1191
  }
2141
- return _context21.abrupt("return", this.store.payment.getPayMethodListAsync());
1192
+ return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
2142
1193
  case 2:
2143
- _context21.next = 4;
1194
+ _context14.next = 4;
2144
1195
  return this.request.get('/pay/custom-payment/all');
2145
1196
  case 4:
2146
- response = _context21.sent;
2147
- return _context21.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1197
+ response = _context14.sent;
1198
+ return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
2148
1199
  case 6:
2149
1200
  case "end":
2150
- return _context21.stop();
1201
+ return _context14.stop();
2151
1202
  }
2152
- }, _callee21, this);
1203
+ }, _callee14, this);
2153
1204
  }));
2154
1205
  function getPaymentMethodsAsync() {
2155
1206
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -2190,49 +1241,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2190
1241
  }, {
2191
1242
  key: "sendCustomerPayLink",
2192
1243
  value: (function () {
2193
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2194
- var orderIds, _ref10, _ref11, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2195
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2196
- while (1) switch (_context22.prev = _context22.next) {
1244
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1245
+ var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
1246
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1247
+ while (1) switch (_context15.prev = _context15.next) {
2197
1248
  case 0:
2198
1249
  if (this.store.order) {
2199
- _context22.next = 2;
1250
+ _context15.next = 2;
2200
1251
  break;
2201
1252
  }
2202
1253
  throw new Error('order 模块未初始化');
2203
1254
  case 2:
2204
1255
  orderIds = params.order_ids || params.orderIds || [];
2205
1256
  if (!(!orderIds.length || params.submitBeforeSend)) {
2206
- _context22.next = 11;
1257
+ _context15.next = 11;
2207
1258
  break;
2208
1259
  }
2209
- _context22.next = 6;
1260
+ _context15.next = 6;
2210
1261
  return this.submitSalesOrder({
2211
1262
  smallTicketDataFlag: 1
2212
1263
  });
2213
1264
  case 6:
2214
- submitResult = _context22.sent;
2215
- orderId = (_ref10 = (_ref11 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref11 !== void 0 ? _ref11 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref10 !== void 0 ? _ref10 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
1265
+ submitResult = _context15.sent;
1266
+ orderId = (_ref2 = (_ref3 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref3 !== void 0 ? _ref3 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref2 !== void 0 ? _ref2 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
2216
1267
  if (orderId) {
2217
- _context22.next = 10;
1268
+ _context15.next = 10;
2218
1269
  break;
2219
1270
  }
2220
1271
  throw new Error('本地订单提交云端失败,无法发送支付链接');
2221
1272
  case 10:
2222
1273
  orderIds = [orderId];
2223
1274
  case 11:
2224
- return _context22.abrupt("return", this.store.order.sendCustomerPayLink({
1275
+ return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
2225
1276
  emails: params.emails,
2226
1277
  notify_action: params.notify_action,
2227
1278
  order_ids: orderIds
2228
1279
  }));
2229
1280
  case 12:
2230
1281
  case "end":
2231
- return _context22.stop();
1282
+ return _context15.stop();
2232
1283
  }
2233
- }, _callee22, this);
1284
+ }, _callee15, this);
2234
1285
  }));
2235
- function sendCustomerPayLink(_x17) {
1286
+ function sendCustomerPayLink(_x10) {
2236
1287
  return _sendCustomerPayLink.apply(this, arguments);
2237
1288
  }
2238
1289
  return sendCustomerPayLink;
@@ -2242,162 +1293,76 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2242
1293
  value: function transformBaseProductToOrderProduct(params) {
2243
1294
  return _transformBaseProductToOrderProduct(params);
2244
1295
  }
2245
- }, {
2246
- key: "calculateProductBookingPrice",
2247
- value: function () {
2248
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2249
- var _params$customer_id;
2250
- var quotation, customerId, authoritativeProduct, product;
2251
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2252
- while (1) switch (_context23.prev = _context23.next) {
2253
- case 0:
2254
- quotation = this.store.quotation;
2255
- customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
2256
- _context23.next = 4;
2257
- return this.loadProductForPriceQuery(params, customerId);
2258
- case 4:
2259
- authoritativeProduct = _context23.sent;
2260
- product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
2261
- _context23.next = 8;
2262
- return this.loadQuotationForPriceQuery({
2263
- quotation: quotation,
2264
- customer_id: customerId,
2265
- channel: params.channel
2266
- });
2267
- case 8:
2268
- return _context23.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
2269
- product: product,
2270
- fallback_price: authoritativeProduct ? undefined : params.fallback_price,
2271
- customer_id: customerId,
2272
- quotation: quotation
2273
- })));
2274
- case 9:
2275
- case "end":
2276
- return _context23.stop();
2277
- }
2278
- }, _callee23, this);
2279
- }));
2280
- function calculateProductBookingPrice(_x18) {
2281
- return _calculateProductBookingPrice.apply(this, arguments);
2282
- }
2283
- return calculateProductBookingPrice;
2284
- }()
2285
1296
  }, {
2286
1297
  key: "addProductToOrder",
2287
1298
  value: function () {
2288
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(product, booking) {
1299
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
2289
1300
  var products;
2290
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2291
- while (1) switch (_context24.prev = _context24.next) {
1301
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1302
+ while (1) switch (_context16.prev = _context16.next) {
2292
1303
  case 0:
2293
- _context24.prev = 0;
1304
+ _context16.prev = 0;
2294
1305
  if (this.store.order) {
2295
- _context24.next = 3;
1306
+ _context16.next = 3;
2296
1307
  break;
2297
1308
  }
2298
1309
  throw new Error('order 模块未初始化');
2299
1310
  case 3:
2300
- _context24.next = 5;
1311
+ _context16.next = 5;
2301
1312
  return this.store.order.addProductToOrder(product, booking);
2302
1313
  case 5:
2303
- products = _context24.sent;
2304
- return _context24.abrupt("return", products);
1314
+ products = _context16.sent;
1315
+ return _context16.abrupt("return", products);
2305
1316
  case 9:
2306
- _context24.prev = 9;
2307
- _context24.t0 = _context24["catch"](0);
2308
- throw _context24.t0;
1317
+ _context16.prev = 9;
1318
+ _context16.t0 = _context16["catch"](0);
1319
+ throw _context16.t0;
2309
1320
  case 12:
2310
1321
  case "end":
2311
- return _context24.stop();
1322
+ return _context16.stop();
2312
1323
  }
2313
- }, _callee24, this, [[0, 9]]);
1324
+ }, _callee16, this, [[0, 9]]);
2314
1325
  }));
2315
- function addProductToOrder(_x19, _x20) {
1326
+ function addProductToOrder(_x11, _x12) {
2316
1327
  return _addProductToOrder.apply(this, arguments);
2317
1328
  }
2318
1329
  return addProductToOrder;
2319
1330
  }()
2320
1331
  }, {
2321
- key: "updateOrderProduct",
2322
- value: function () {
2323
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2324
- var products;
2325
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2326
- while (1) switch (_context25.prev = _context25.next) {
2327
- case 0:
2328
- _context25.prev = 0;
2329
- if (this.store.order) {
2330
- _context25.next = 3;
2331
- break;
2332
- }
2333
- throw new Error('order 模块未初始化');
2334
- case 3:
2335
- _context25.next = 5;
2336
- return this.store.order.updateOrderProduct(params);
2337
- case 5:
2338
- products = _context25.sent;
2339
- return _context25.abrupt("return", products);
2340
- case 9:
2341
- _context25.prev = 9;
2342
- _context25.t0 = _context25["catch"](0);
2343
- throw _context25.t0;
2344
- case 12:
2345
- case "end":
2346
- return _context25.stop();
2347
- }
2348
- }, _callee25, this, [[0, 9]]);
2349
- }));
2350
- function updateOrderProduct(_x21) {
2351
- return _updateOrderProduct.apply(this, arguments);
2352
- }
2353
- return updateOrderProduct;
2354
- }()
2355
- }, {
2356
- key: "updateOrderProductQuantity",
1332
+ key: "updateProductInOrder",
2357
1333
  value: function () {
2358
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
1334
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
2359
1335
  var products;
2360
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2361
- while (1) switch (_context26.prev = _context26.next) {
1336
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1337
+ while (1) switch (_context17.prev = _context17.next) {
2362
1338
  case 0:
2363
- _context26.prev = 0;
1339
+ _context17.prev = 0;
2364
1340
  if (this.store.order) {
2365
- _context26.next = 3;
1341
+ _context17.next = 3;
2366
1342
  break;
2367
1343
  }
2368
1344
  throw new Error('order 模块未初始化');
2369
1345
  case 3:
2370
- _context26.next = 5;
2371
- return this.store.order.updateOrderProductQuantity(params);
1346
+ _context17.next = 5;
1347
+ return this.store.order.updateProductInOrder(params);
2372
1348
  case 5:
2373
- products = _context26.sent;
2374
- return _context26.abrupt("return", products);
1349
+ products = _context17.sent;
1350
+ return _context17.abrupt("return", products);
2375
1351
  case 9:
2376
- _context26.prev = 9;
2377
- _context26.t0 = _context26["catch"](0);
2378
- throw _context26.t0;
1352
+ _context17.prev = 9;
1353
+ _context17.t0 = _context17["catch"](0);
1354
+ throw _context17.t0;
2379
1355
  case 12:
2380
1356
  case "end":
2381
- return _context26.stop();
1357
+ return _context17.stop();
2382
1358
  }
2383
- }, _callee26, this, [[0, 9]]);
1359
+ }, _callee17, this, [[0, 9]]);
2384
1360
  }));
2385
- function updateOrderProductQuantity(_x22) {
2386
- return _updateOrderProductQuantity.apply(this, arguments);
1361
+ function updateProductInOrder(_x13) {
1362
+ return _updateProductInOrder.apply(this, arguments);
2387
1363
  }
2388
- return updateOrderProductQuantity;
1364
+ return updateProductInOrder;
2389
1365
  }()
2390
- }, {
2391
- key: "updateOrderBooking",
2392
- value: function updateOrderBooking(params) {
2393
- try {
2394
- if (!this.store.order) throw new Error('order 模块未初始化');
2395
- return this.store.order.updateOrderBooking(params);
2396
- } catch (error) {
2397
- throw error;
2398
- }
2399
- }
2400
-
2401
1366
  /**
2402
1367
  * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
2403
1368
  * 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
@@ -2405,12 +1370,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2405
1370
  }, {
2406
1371
  key: "setOrderProductLineNote",
2407
1372
  value: (function () {
2408
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity, note) {
1373
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
2409
1374
  var params, products;
2410
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2411
- while (1) switch (_context27.prev = _context27.next) {
1375
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1376
+ while (1) switch (_context18.prev = _context18.next) {
2412
1377
  case 0:
2413
- _context27.prev = 0;
1378
+ _context18.prev = 0;
2414
1379
  params = {
2415
1380
  product_id: identity.product_id,
2416
1381
  product_variant_id: identity.product_variant_id,
@@ -2425,22 +1390,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2425
1390
  params.product_option_item = identity.product_option_item;
2426
1391
  }
2427
1392
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
2428
- _context27.next = 7;
2429
- return this.updateOrderProduct(params);
1393
+ _context18.next = 7;
1394
+ return this.updateProductInOrder(params);
2430
1395
  case 7:
2431
- products = _context27.sent;
2432
- return _context27.abrupt("return", products);
1396
+ products = _context18.sent;
1397
+ return _context18.abrupt("return", products);
2433
1398
  case 11:
2434
- _context27.prev = 11;
2435
- _context27.t0 = _context27["catch"](0);
2436
- throw _context27.t0;
1399
+ _context18.prev = 11;
1400
+ _context18.t0 = _context18["catch"](0);
1401
+ throw _context18.t0;
2437
1402
  case 14:
2438
1403
  case "end":
2439
- return _context27.stop();
1404
+ return _context18.stop();
2440
1405
  }
2441
- }, _callee27, this, [[0, 11]]);
1406
+ }, _callee18, this, [[0, 11]]);
2442
1407
  }));
2443
- function setOrderProductLineNote(_x23, _x24) {
1408
+ function setOrderProductLineNote(_x14, _x15) {
2444
1409
  return _setOrderProductLineNote.apply(this, arguments);
2445
1410
  }
2446
1411
  return setOrderProductLineNote;
@@ -2448,138 +1413,54 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2448
1413
  }, {
2449
1414
  key: "removeProductFromOrder",
2450
1415
  value: function () {
2451
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
1416
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
2452
1417
  var products;
2453
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2454
- while (1) switch (_context28.prev = _context28.next) {
1418
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1419
+ while (1) switch (_context19.prev = _context19.next) {
2455
1420
  case 0:
2456
- _context28.prev = 0;
1421
+ _context19.prev = 0;
2457
1422
  if (this.store.order) {
2458
- _context28.next = 3;
1423
+ _context19.next = 3;
2459
1424
  break;
2460
1425
  }
2461
1426
  throw new Error('order 模块未初始化');
2462
1427
  case 3:
2463
- _context28.next = 5;
1428
+ _context19.next = 5;
2464
1429
  return this.store.order.removeProductFromOrder(identity);
2465
1430
  case 5:
2466
- products = _context28.sent;
2467
- return _context28.abrupt("return", products);
1431
+ products = _context19.sent;
1432
+ return _context19.abrupt("return", products);
2468
1433
  case 9:
2469
- _context28.prev = 9;
2470
- _context28.t0 = _context28["catch"](0);
2471
- throw _context28.t0;
1434
+ _context19.prev = 9;
1435
+ _context19.t0 = _context19["catch"](0);
1436
+ throw _context19.t0;
2472
1437
  case 12:
2473
1438
  case "end":
2474
- return _context28.stop();
1439
+ return _context19.stop();
2475
1440
  }
2476
- }, _callee28, this, [[0, 9]]);
1441
+ }, _callee19, this, [[0, 9]]);
2477
1442
  }));
2478
- function removeProductFromOrder(_x25) {
1443
+ function removeProductFromOrder(_x16) {
2479
1444
  return _removeProductFromOrder.apply(this, arguments);
2480
1445
  }
2481
1446
  return removeProductFromOrder;
2482
- }() // ─── 促销/赠品 透传(迁移自 booking usePromotion) ────────────────
2483
- /**
2484
- * 注入促销评估器到底层 OrderModule。
2485
- *
2486
- * @example
2487
- * solution.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
2488
- */
2489
- }, {
2490
- key: "setPromotionEvaluator",
2491
- value: function setPromotionEvaluator(evaluator) {
2492
- if (!this.store.order) throw new Error('order 模块未初始化');
2493
- this.store.order.setPromotionEvaluator(evaluator);
2494
- }
2495
-
2496
- /**
2497
- * 注入赠品选择 resolver。UI 层(SalesSdk)通过 bridge 提供。
2498
- *
2499
- * @example
2500
- * solution.setGiftSelectResolver(async (ctx) => bridge.request(ctx));
2501
- */
2502
- }, {
2503
- key: "setGiftSelectResolver",
2504
- value: function setGiftSelectResolver(resolver) {
2505
- if (!this.store.order) throw new Error('order 模块未初始化');
2506
- this.store.order.setGiftSelectResolver(resolver);
2507
- }
2508
-
2509
- /**
2510
- * 为商品目录追加促销标签,供 SalesSdkProductProvider 等商品列表入口复用。
2511
- *
2512
- * @example
2513
- * const products = solution.appendPromotionTags(catalogProducts);
2514
- */
2515
- }, {
2516
- key: "appendPromotionTags",
2517
- value: function appendPromotionTags(products) {
2518
- if (!this.store.order) throw new Error('order 模块未初始化');
2519
- return this.store.order.appendPromotionTags(products);
2520
- }
2521
-
2522
- /**
2523
- * 主动触发一次促销应用(一般写路径会自动触发,少数场景如客户切换后可手动调)。
2524
- */
2525
- }, {
2526
- key: "applyPromotion",
2527
- value: (function () {
2528
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2529
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2530
- while (1) switch (_context29.prev = _context29.next) {
2531
- case 0:
2532
- if (this.store.order) {
2533
- _context29.next = 2;
2534
- break;
2535
- }
2536
- throw new Error('order 模块未初始化');
2537
- case 2:
2538
- _context29.next = 4;
2539
- return this.store.order.applyPromotion();
2540
- case 4:
2541
- case "end":
2542
- return _context29.stop();
2543
- }
2544
- }, _callee29, this);
2545
- }));
2546
- function applyPromotion() {
2547
- return _applyPromotion.apply(this, arguments);
2548
- }
2549
- return applyPromotion;
2550
- }() /** 最近一次促销计算输出的未满足提示。 */)
2551
- }, {
2552
- key: "getUnfulfilledPromotions",
2553
- value: function getUnfulfilledPromotions() {
2554
- var _this$store$order4;
2555
- return ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getUnfulfilledPromotions()) || [];
2556
- }
2557
-
2558
- /** 最近一次促销计算输出的赠品操作 diff。 */
2559
- }, {
2560
- key: "getLastGiftActions",
2561
- value: function getLastGiftActions() {
2562
- var _this$store$order5;
2563
- return ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getLastGiftActions()) || null;
2564
- }
2565
-
2566
- // 获取商品列表
1447
+ }() // 获取商品列表
2567
1448
  // TODO 需要跟 webpos 内的对齐一下
2568
1449
  }, {
2569
1450
  key: "getProductList",
2570
1451
  value: function () {
2571
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2572
- var _this$otherParams8;
1452
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1453
+ var _this$otherParams6;
2573
1454
  var menu_list_ids, _this$store$products, res;
2574
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2575
- while (1) switch (_context30.prev = _context30.next) {
1455
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1456
+ while (1) switch (_context20.prev = _context20.next) {
2576
1457
  case 0:
2577
1458
  // 可以直接通过配置里的 menu 读取
2578
- menu_list_ids = ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 || (_this$otherParams8 = _this$otherParams8.dineInConfig) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8['menu.associated_menus'].map(function (n) {
1459
+ menu_list_ids = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.dineInConfig) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus'].map(function (n) {
2579
1460
  return Number(n.value);
2580
1461
  })) || [];
2581
- _context30.prev = 1;
2582
- _context30.next = 4;
1462
+ _context20.prev = 1;
1463
+ _context20.next = 4;
2583
1464
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
2584
1465
  menu_list_ids: menu_list_ids,
2585
1466
  cacheId: this.cacheId,
@@ -2587,17 +1468,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2587
1468
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2588
1469
  });
2589
1470
  case 4:
2590
- res = _context30.sent;
2591
- return _context30.abrupt("return", res);
1471
+ res = _context20.sent;
1472
+ return _context20.abrupt("return", res);
2592
1473
  case 8:
2593
- _context30.prev = 8;
2594
- _context30.t0 = _context30["catch"](1);
2595
- throw _context30.t0;
1474
+ _context20.prev = 8;
1475
+ _context20.t0 = _context20["catch"](1);
1476
+ throw _context20.t0;
2596
1477
  case 11:
2597
1478
  case "end":
2598
- return _context30.stop();
1479
+ return _context20.stop();
2599
1480
  }
2600
- }, _callee30, this, [[1, 8]]);
1481
+ }, _callee20, this, [[1, 8]]);
2601
1482
  }));
2602
1483
  function getProductList() {
2603
1484
  return _getProductList.apply(this, arguments);
@@ -2612,15 +1493,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2612
1493
  }, {
2613
1494
  key: "setOtherParams",
2614
1495
  value: function () {
2615
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2616
- var _ref12,
2617
- _ref12$cover,
1496
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1497
+ var _ref4,
1498
+ _ref4$cover,
2618
1499
  cover,
2619
- _args31 = arguments;
2620
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2621
- while (1) switch (_context31.prev = _context31.next) {
1500
+ _args21 = arguments;
1501
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1502
+ while (1) switch (_context21.prev = _context21.next) {
2622
1503
  case 0:
2623
- _ref12 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref12$cover = _ref12.cover, cover = _ref12$cover === void 0 ? false : _ref12$cover;
1504
+ _ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
2624
1505
  if (cover) {
2625
1506
  this.otherParams = params;
2626
1507
  } else {
@@ -2628,11 +1509,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2628
1509
  }
2629
1510
  case 2:
2630
1511
  case "end":
2631
- return _context31.stop();
1512
+ return _context21.stop();
2632
1513
  }
2633
- }, _callee31, this);
1514
+ }, _callee21, this);
2634
1515
  }));
2635
- function setOtherParams(_x26) {
1516
+ function setOtherParams(_x17) {
2636
1517
  return _setOtherParams.apply(this, arguments);
2637
1518
  }
2638
1519
  return setOtherParams;