@pisell/pisellos 2.2.162 → 2.2.164

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 (116) hide show
  1. package/dist/modules/BookingContext/index.d.ts +37 -0
  2. package/dist/modules/BookingContext/index.js +436 -0
  3. package/dist/modules/BookingContext/types.d.ts +102 -0
  4. package/dist/modules/BookingContext/types.js +51 -0
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +157 -0
  7. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +107 -0
  9. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -0
  11. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  12. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  13. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  15. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  16. package/dist/modules/BookingContext/utils/index.js +11 -0
  17. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  18. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  19. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  20. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  21. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  23. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  25. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  26. package/dist/modules/BookingContext/utils/resources.js +486 -0
  27. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  29. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  31. package/dist/modules/Customer/index.js +23 -22
  32. package/dist/modules/Discount/index.js +4 -3
  33. package/dist/modules/Order/index.d.ts +17 -6
  34. package/dist/modules/Order/index.js +474 -287
  35. package/dist/modules/Order/types.d.ts +32 -12
  36. package/dist/modules/Order/utils.js +9 -8
  37. package/dist/modules/SalesSummary/index.js +4 -2
  38. package/dist/modules/index.d.ts +1 -0
  39. package/dist/modules/index.js +2 -1
  40. package/dist/solution/BaseSales/index.d.ts +38 -7
  41. package/dist/solution/BaseSales/index.js +797 -310
  42. package/dist/solution/BaseSales/types.d.ts +48 -1
  43. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  44. package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
  45. package/dist/solution/BookingByStep/index.d.ts +2 -2
  46. package/dist/solution/BookingTicket/index.d.ts +121 -1
  47. package/dist/solution/BookingTicket/index.js +401 -72
  48. package/dist/solution/BookingTicket/types.d.ts +2 -0
  49. package/dist/solution/BookingTicket/types.js +3 -0
  50. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  51. package/dist/solution/BookingTicket/utils/addProductDecision.js +326 -0
  52. package/dist/solution/ScanOrder/index.d.ts +9 -3
  53. package/dist/solution/ScanOrder/index.js +231 -128
  54. package/dist/solution/VenueBooking/index.d.ts +4 -2
  55. package/dist/solution/VenueBooking/index.js +103 -55
  56. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  57. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  58. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  59. package/lib/modules/BookingContext/index.d.ts +37 -0
  60. package/lib/modules/BookingContext/index.js +297 -0
  61. package/lib/modules/BookingContext/types.d.ts +102 -0
  62. package/lib/modules/BookingContext/types.js +34 -0
  63. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  64. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +174 -0
  65. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  66. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +115 -0
  67. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  68. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -0
  69. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  70. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  71. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  72. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  73. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  74. package/lib/modules/BookingContext/utils/index.js +43 -0
  75. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  76. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  77. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  78. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  79. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  80. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  81. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  82. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  83. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  84. package/lib/modules/BookingContext/utils/resources.js +377 -0
  85. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  86. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  87. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  88. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  89. package/lib/modules/Customer/index.js +8 -8
  90. package/lib/modules/Discount/index.js +5 -1
  91. package/lib/modules/Order/index.d.ts +17 -6
  92. package/lib/modules/Order/index.js +164 -68
  93. package/lib/modules/Order/types.d.ts +32 -12
  94. package/lib/modules/Order/utils.js +8 -6
  95. package/lib/modules/SalesSummary/index.js +4 -2
  96. package/lib/modules/index.d.ts +1 -0
  97. package/lib/modules/index.js +3 -1
  98. package/lib/solution/BaseSales/index.d.ts +38 -7
  99. package/lib/solution/BaseSales/index.js +304 -14
  100. package/lib/solution/BaseSales/types.d.ts +48 -1
  101. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  102. package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
  103. package/lib/solution/BookingByStep/index.d.ts +2 -2
  104. package/lib/solution/BookingTicket/index.d.ts +121 -1
  105. package/lib/solution/BookingTicket/index.js +207 -2
  106. package/lib/solution/BookingTicket/types.d.ts +2 -0
  107. package/lib/solution/BookingTicket/types.js +6 -0
  108. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  109. package/lib/solution/BookingTicket/utils/addProductDecision.js +300 -0
  110. package/lib/solution/ScanOrder/index.d.ts +9 -3
  111. package/lib/solution/ScanOrder/index.js +147 -66
  112. package/lib/solution/VenueBooking/index.d.ts +4 -2
  113. package/lib/solution/VenueBooking/index.js +50 -14
  114. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  115. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  116. package/package.json +1 -1
@@ -1,10 +1,14 @@
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."); }
2
4
  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); }
3
7
  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; }
4
8
  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; }
6
9
  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; }
7
10
  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; }
8
12
  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); } }
9
13
  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); }); }; }
10
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -29,7 +33,9 @@ import { createModule } from "../BookingByStep/types";
29
33
  import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
30
34
  import dayjs from 'dayjs';
31
35
  export * from "./types";
36
+ import { QuotationModule } from "../../modules/Quotation";
32
37
  import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
38
+ import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
33
39
  export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
34
40
  _inherits(BaseSalesImpl, _BaseModule);
35
41
  var _super = _createSuper(BaseSalesImpl);
@@ -43,6 +49,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
43
49
  _defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
44
50
  _defineProperty(_assertThisInitialized(_this), "logger", void 0);
45
51
  // LoggerManager 实例
52
+ _defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
46
53
  _defineProperty(_assertThisInitialized(_this), "store", {
47
54
  order: undefined
48
55
  });
@@ -61,12 +68,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
61
68
 
62
69
  /**
63
70
  * 子类可覆盖此方法以追加/收敛要注册的子模块。
64
- * 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
71
+ * 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation
65
72
  */
66
73
  _createClass(BaseSalesImpl, [{
67
74
  key: "getRegisteredModuleNames",
68
75
  value: function getRegisteredModuleNames() {
69
- return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
76
+ return ['products', 'order', 'salesSummary', 'schedule', 'payment', 'quotation'];
70
77
  }
71
78
 
72
79
  /**
@@ -121,6 +128,63 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
121
128
  get: function get() {
122
129
  return this.store.payment;
123
130
  }
131
+ }, {
132
+ key: "getCurrentOrderCustomerId",
133
+ value: function getCurrentOrderCustomerId() {
134
+ var _this$store$order, _this$store$order$get;
135
+ 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);
136
+ var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
137
+ if (customerId === null || customerId === undefined) return undefined;
138
+ return customerId;
139
+ }
140
+ }, {
141
+ key: "applyQuotationScheduleResolver",
142
+ value: function applyQuotationScheduleResolver(quotation) {
143
+ var scheduleModule = this.store.schedule;
144
+ if (!scheduleModule) return;
145
+ quotation.setScheduleResolver(function (id) {
146
+ var _scheduleModule$getSc;
147
+ var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
148
+ return schedules[0];
149
+ });
150
+ }
151
+ }, {
152
+ key: "loadQuotationForPriceQuery",
153
+ value: function () {
154
+ var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
155
+ var _this$otherParams;
156
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
157
+ while (1) switch (_context.prev = _context.next) {
158
+ case 0:
159
+ if (params.quotation) {
160
+ _context.next = 2;
161
+ break;
162
+ }
163
+ return _context.abrupt("return");
164
+ case 2:
165
+ this.applyQuotationScheduleResolver(params.quotation);
166
+ _context.next = 5;
167
+ return params.quotation.loadQuotations({
168
+ channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
169
+ customer_id: params.customer_id
170
+ });
171
+ case 5:
172
+ case "end":
173
+ return _context.stop();
174
+ }
175
+ }, _callee, this);
176
+ }));
177
+ function loadQuotationForPriceQuery(_x) {
178
+ return _loadQuotationForPriceQuery.apply(this, arguments);
179
+ }
180
+ return loadQuotationForPriceQuery;
181
+ }()
182
+ }, {
183
+ key: "getSubmitOrderSalesChannel",
184
+ value: function getSubmitOrderSalesChannel() {
185
+ var _this$otherParams2;
186
+ return (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel;
187
+ }
124
188
 
125
189
  /**
126
190
  * 工厂入口:根据子模块名实例化对应模块。
@@ -130,6 +194,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
130
194
  }, {
131
195
  key: "createSubModule",
132
196
  value: function createSubModule(moduleName) {
197
+ if (moduleName === 'quotation') {
198
+ return new QuotationModule("".concat(this.name, "_quotation"));
199
+ }
133
200
  return createModule(moduleName, this.name);
134
201
  }
135
202
  }, {
@@ -163,39 +230,78 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
163
230
  return {};
164
231
  }
165
232
  }
233
+ }, {
234
+ key: "getAppData",
235
+ value: function getAppData(key) {
236
+ var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
237
+ var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
238
+ if (typeof getData === 'function') return getData(key);
239
+ var app = this.appPlugin.getApp();
240
+ 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');
241
+ return coreData === null || coreData === void 0 ? void 0 : coreData[key];
242
+ }
243
+ }, {
244
+ key: "syncAppDataToTempOrder",
245
+ value: function syncAppDataToTempOrder(tempOrder) {
246
+ var taxCountryCode = this.getAppData('tax_country_code');
247
+ var currencyCode = this.getAppData('shop_currency_code');
248
+ var currencySymbol = this.getAppData('shop_symbol');
249
+ var isChanged = false;
250
+ if (taxCountryCode !== undefined) {
251
+ var nextTaxCountryCode = String(taxCountryCode || '');
252
+ if (tempOrder.tax_country_code !== nextTaxCountryCode) {
253
+ tempOrder.tax_country_code = nextTaxCountryCode;
254
+ isChanged = true;
255
+ }
256
+ }
257
+ if (currencyCode !== undefined) {
258
+ var nextCurrencyCode = String(currencyCode || '');
259
+ if (tempOrder.currency_code !== nextCurrencyCode) {
260
+ tempOrder.currency_code = nextCurrencyCode;
261
+ isChanged = true;
262
+ }
263
+ }
264
+ if (currencySymbol !== undefined) {
265
+ var nextCurrencySymbol = String(currencySymbol || '');
266
+ if (tempOrder.currency_symbol !== nextCurrencySymbol) {
267
+ tempOrder.currency_symbol = nextCurrencySymbol;
268
+ isChanged = true;
269
+ }
270
+ }
271
+ return isChanged;
272
+ }
166
273
  }, {
167
274
  key: "initialize",
168
275
  value: function () {
169
- var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
170
- var _this$otherParams,
276
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(core) {
277
+ var _this$otherParams3,
171
278
  _this2 = this;
172
279
  var options,
173
- appPlugin,
174
280
  app,
175
281
  targetCacheData,
176
282
  moduleNames,
177
- _args = arguments;
178
- return _regeneratorRuntime().wrap(function _callee$(_context) {
179
- while (1) switch (_context.prev = _context.next) {
283
+ _args2 = arguments;
284
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
285
+ while (1) switch (_context2.prev = _context2.next) {
180
286
  case 0:
181
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
287
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
182
288
  this.core = core;
183
289
  this.initializeOptions = options || {};
184
290
  // this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
185
291
  this.otherParams = options.otherParams || {};
186
- this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
292
+ this.cacheId = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.cacheId;
187
293
  this.window = core.getPlugin('window');
188
294
  this.request = core.getPlugin('request');
189
295
 
190
296
  // 获取 logger 实例
191
- appPlugin = core.getPlugin('app');
192
- if (appPlugin) {
193
- _context.next = 10;
297
+ this.appPlugin = core.getPlugin('app');
298
+ if (this.appPlugin) {
299
+ _context2.next = 10;
194
300
  break;
195
301
  }
196
302
  throw new Error('Checkout 解决方案需要 app 插件支持');
197
303
  case 10:
198
- app = appPlugin.getApp();
304
+ app = this.appPlugin.getApp();
199
305
  this.logger = app.logger;
200
306
  targetCacheData = this.readSessionCacheData();
201
307
  moduleNames = this.getRegisteredModuleNames();
@@ -220,20 +326,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
220
326
  }));
221
327
  });
222
328
  if (!this.store.schedule) {
223
- _context.next = 18;
329
+ _context2.next = 18;
224
330
  break;
225
331
  }
226
- _context.next = 18;
332
+ _context2.next = 18;
227
333
  return this.store.schedule.loadAllSchedule();
228
334
  case 18:
229
335
  this.core.effects.emit("".concat(this.name, ":onInited"), {});
230
336
  case 19:
231
337
  case "end":
232
- return _context.stop();
338
+ return _context2.stop();
233
339
  }
234
- }, _callee, this);
340
+ }, _callee2, this);
235
341
  }));
236
- function initialize(_x) {
342
+ function initialize(_x2) {
237
343
  return _initialize.apply(this, arguments);
238
344
  }
239
345
  return initialize;
@@ -241,10 +347,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
241
347
  }, {
242
348
  key: "destroy",
243
349
  value: function () {
244
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
350
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
245
351
  var _this3 = this;
246
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
247
- while (1) switch (_context2.prev = _context2.next) {
352
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
353
+ while (1) switch (_context3.prev = _context3.next) {
248
354
  case 0:
249
355
  Object.keys(this.store).forEach(function (key) {
250
356
  var sub = _this3.store[key];
@@ -257,15 +363,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
257
363
  }
258
364
  });
259
365
  this.currentSalesDetail = null;
260
- _context2.next = 4;
366
+ _context3.next = 4;
261
367
  return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
262
368
  case 4:
263
369
  _get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
264
370
  case 5:
265
371
  case "end":
266
- return _context2.stop();
372
+ return _context3.stop();
267
373
  }
268
- }, _callee2, this);
374
+ }, _callee3, this);
269
375
  }));
270
376
  function destroy() {
271
377
  return _destroy.apply(this, arguments);
@@ -282,13 +388,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
282
388
  }, {
283
389
  key: "loadSalesDetail",
284
390
  value: (function () {
285
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(orderIdOrParams) {
391
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderIdOrParams) {
286
392
  var params, externalSaleNumber, localRecord, _sales, res, message, sales;
287
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
288
- while (1) switch (_context3.prev = _context3.next) {
393
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
394
+ while (1) switch (_context4.prev = _context4.next) {
289
395
  case 0:
290
396
  if (this.store.order) {
291
- _context3.next = 2;
397
+ _context4.next = 2;
292
398
  break;
293
399
  }
294
400
  throw new Error('order 模块未初始化');
@@ -298,107 +404,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
298
404
  };
299
405
  externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
300
406
  if (params.forceRemote) {
301
- _context3.next = 35;
407
+ _context4.next = 35;
302
408
  break;
303
409
  }
304
410
  if (!(params.orderId !== undefined)) {
305
- _context3.next = 11;
411
+ _context4.next = 11;
306
412
  break;
307
413
  }
308
- _context3.next = 8;
414
+ _context4.next = 8;
309
415
  return this.store.order.getLocalOrderByOrderId(params.orderId);
310
416
  case 8:
311
- _context3.t0 = _context3.sent;
312
- _context3.next = 26;
417
+ _context4.t0 = _context4.sent;
418
+ _context4.next = 26;
313
419
  break;
314
420
  case 11:
315
421
  if (!externalSaleNumber) {
316
- _context3.next = 17;
422
+ _context4.next = 17;
317
423
  break;
318
424
  }
319
- _context3.next = 14;
425
+ _context4.next = 14;
320
426
  return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
321
427
  case 14:
322
- _context3.t1 = _context3.sent;
323
- _context3.next = 25;
428
+ _context4.t1 = _context4.sent;
429
+ _context4.next = 25;
324
430
  break;
325
431
  case 17:
326
432
  if (!params.orderNumber) {
327
- _context3.next = 23;
433
+ _context4.next = 23;
328
434
  break;
329
435
  }
330
- _context3.next = 20;
436
+ _context4.next = 20;
331
437
  return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
332
438
  case 20:
333
- _context3.t2 = _context3.sent;
334
- _context3.next = 24;
439
+ _context4.t2 = _context4.sent;
440
+ _context4.next = 24;
335
441
  break;
336
442
  case 23:
337
- _context3.t2 = null;
443
+ _context4.t2 = null;
338
444
  case 24:
339
- _context3.t1 = _context3.t2;
445
+ _context4.t1 = _context4.t2;
340
446
  case 25:
341
- _context3.t0 = _context3.t1;
447
+ _context4.t0 = _context4.t1;
342
448
  case 26:
343
- localRecord = _context3.t0;
449
+ localRecord = _context4.t0;
344
450
  if (!localRecord) {
345
- _context3.next = 35;
451
+ _context4.next = 35;
346
452
  break;
347
453
  }
348
- _context3.next = 30;
454
+ _context4.next = 30;
349
455
  return this.store.order.hydrateTempOrderFromRecord(localRecord, {
350
456
  recalcOnHydrate: false
351
457
  });
352
458
  case 30:
353
- _sales = _context3.sent;
459
+ _sales = _context4.sent;
354
460
  this.currentSalesDetail = _sales;
355
- _context3.next = 34;
461
+ _context4.next = 34;
356
462
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
357
463
  sales: _sales
358
464
  });
359
465
  case 34:
360
- return _context3.abrupt("return", _sales);
466
+ return _context4.abrupt("return", _sales);
361
467
  case 35:
362
468
  if (!(params.orderId === undefined || params.orderId === null)) {
363
- _context3.next = 37;
469
+ _context4.next = 37;
364
470
  break;
365
471
  }
366
472
  throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
367
473
  case 37:
368
- _context3.next = 39;
474
+ _context4.next = 39;
369
475
  return this.store.order.getOrderInfoByRemote(Number(params.orderId));
370
476
  case 39:
371
- res = _context3.sent;
477
+ res = _context4.sent;
372
478
  if (!(!res || res.code !== 200)) {
373
- _context3.next = 43;
479
+ _context4.next = 43;
374
480
  break;
375
481
  }
376
482
  message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
377
483
  throw new Error(message);
378
484
  case 43:
379
- _context3.next = 45;
485
+ _context4.next = 45;
380
486
  return this.store.order.hydrateTempOrderFromRecord(res.data, {
381
487
  recalcOnHydrate: false
382
488
  });
383
489
  case 45:
384
- sales = _context3.sent;
385
- _context3.next = 48;
490
+ sales = _context4.sent;
491
+ _context4.next = 48;
386
492
  return this.store.order.saveDraft();
387
493
  case 48:
388
494
  this.currentSalesDetail = sales;
389
- _context3.next = 51;
495
+ _context4.next = 51;
390
496
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
391
497
  sales: sales
392
498
  });
393
499
  case 51:
394
- return _context3.abrupt("return", sales);
500
+ return _context4.abrupt("return", sales);
395
501
  case 52:
396
502
  case "end":
397
- return _context3.stop();
503
+ return _context4.stop();
398
504
  }
399
- }, _callee3, this);
505
+ }, _callee4, this);
400
506
  }));
401
- function loadSalesDetail(_x2) {
507
+ function loadSalesDetail(_x3) {
402
508
  return _loadSalesDetail.apply(this, arguments);
403
509
  }
404
510
  return loadSalesDetail;
@@ -471,10 +577,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
471
577
  }, {
472
578
  key: "getTempOrder",
473
579
  value: function getTempOrder() {
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;
580
+ var _this$store$order2;
581
+ var result = ((_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder()) || null;
476
582
  return result;
477
583
  }
584
+ }, {
585
+ key: "replaceTempOrder",
586
+ value: function () {
587
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(tempOrder) {
588
+ var nextTempOrder;
589
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
590
+ while (1) switch (_context5.prev = _context5.next) {
591
+ case 0:
592
+ if (this.store.order) {
593
+ _context5.next = 2;
594
+ break;
595
+ }
596
+ throw new Error('order 模块未初始化');
597
+ case 2:
598
+ _context5.next = 4;
599
+ return this.store.order.replaceTempOrder(tempOrder);
600
+ case 4:
601
+ nextTempOrder = _context5.sent;
602
+ _context5.next = 7;
603
+ return this.effectsEmit('onTempOrderReplaced', {
604
+ tempOrder: nextTempOrder
605
+ });
606
+ case 7:
607
+ return _context5.abrupt("return", nextTempOrder);
608
+ case 8:
609
+ case "end":
610
+ return _context5.stop();
611
+ }
612
+ }, _callee5, this);
613
+ }));
614
+ function replaceTempOrder(_x4) {
615
+ return _replaceTempOrder.apply(this, arguments);
616
+ }
617
+ return replaceTempOrder;
618
+ }()
478
619
  }, {
479
620
  key: "getOrderIdentity",
480
621
  value: function getOrderIdentity() {
@@ -508,9 +649,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
508
649
  }, {
509
650
  key: "updateTempOrderNote",
510
651
  value: function updateTempOrderNote(note) {
652
+ var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
511
653
  try {
512
654
  if (!this.store.order) throw new Error('order 模块未初始化');
513
- var result = this.store.order.updateTempOrderNote(note);
655
+ var result = this.store.order.updateTempOrderNote(note, sync);
514
656
  return result;
515
657
  } catch (error) {
516
658
  throw error;
@@ -539,32 +681,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
539
681
  }, {
540
682
  key: "addNewOrder",
541
683
  value: function () {
542
- var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
684
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
543
685
  var tempOrder;
544
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
545
- while (1) switch (_context4.prev = _context4.next) {
686
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
687
+ while (1) switch (_context6.prev = _context6.next) {
546
688
  case 0:
547
- _context4.prev = 0;
689
+ _context6.prev = 0;
548
690
  if (this.store.order) {
549
- _context4.next = 3;
691
+ _context6.next = 3;
550
692
  break;
551
693
  }
552
694
  throw new Error('order 模块未初始化');
553
695
  case 3:
554
- _context4.next = 5;
696
+ _context6.next = 5;
555
697
  return this.store.order.addNewOrder();
556
698
  case 5:
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:
699
+ tempOrder = _context6.sent;
700
+ if (!this.syncAppDataToTempOrder(tempOrder)) {
701
+ _context6.next = 10;
702
+ break;
703
+ }
704
+ this.store.order.persistTempOrder();
705
+ _context6.next = 10;
706
+ return this.store.order.saveDraft();
707
+ case 10:
708
+ return _context6.abrupt("return", tempOrder);
709
+ case 13:
710
+ _context6.prev = 13;
711
+ _context6.t0 = _context6["catch"](0);
712
+ throw _context6.t0;
713
+ case 16:
564
714
  case "end":
565
- return _context4.stop();
715
+ return _context6.stop();
566
716
  }
567
- }, _callee4, this, [[0, 9]]);
717
+ }, _callee6, this, [[0, 13]]);
568
718
  }));
569
719
  function addNewOrder() {
570
720
  return _addNewOrder.apply(this, arguments);
@@ -574,22 +724,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
574
724
  }, {
575
725
  key: "saveDraft",
576
726
  value: function () {
577
- var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
578
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
579
- while (1) switch (_context5.prev = _context5.next) {
727
+ var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
728
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
729
+ while (1) switch (_context7.prev = _context7.next) {
580
730
  case 0:
581
731
  if (this.store.order) {
582
- _context5.next = 2;
732
+ _context7.next = 2;
583
733
  break;
584
734
  }
585
735
  throw new Error('order 模块未初始化');
586
736
  case 2:
587
- return _context5.abrupt("return", this.store.order.saveDraft());
737
+ return _context7.abrupt("return", this.store.order.saveDraft());
588
738
  case 3:
589
739
  case "end":
590
- return _context5.stop();
740
+ return _context7.stop();
591
741
  }
592
- }, _callee5, this);
742
+ }, _callee7, this);
593
743
  }));
594
744
  function saveDraft() {
595
745
  return _saveDraft.apply(this, arguments);
@@ -600,30 +750,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
600
750
  }, {
601
751
  key: "restoreOrder",
602
752
  value: function () {
603
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
753
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
604
754
  var tempOrder;
605
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
606
- while (1) switch (_context6.prev = _context6.next) {
755
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
756
+ while (1) switch (_context8.prev = _context8.next) {
607
757
  case 0:
608
- _context6.prev = 0;
758
+ _context8.prev = 0;
609
759
  if (this.store.order) {
610
- _context6.next = 3;
760
+ _context8.next = 3;
611
761
  break;
612
762
  }
613
763
  throw new Error('scanOrder 解决方案需要 order 模块支持');
614
764
  case 3:
615
765
  // this.store.resource = null;
616
766
  tempOrder = this.store.order.restoreOrder();
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:
767
+ if (!this.syncAppDataToTempOrder(tempOrder)) {
768
+ _context8.next = 8;
769
+ break;
770
+ }
771
+ this.store.order.persistTempOrder();
772
+ _context8.next = 8;
773
+ return this.store.order.saveDraft();
774
+ case 8:
775
+ return _context8.abrupt("return", tempOrder);
776
+ case 11:
777
+ _context8.prev = 11;
778
+ _context8.t0 = _context8["catch"](0);
779
+ throw _context8.t0;
780
+ case 14:
623
781
  case "end":
624
- return _context6.stop();
782
+ return _context8.stop();
625
783
  }
626
- }, _callee6, this, [[0, 7]]);
784
+ }, _callee8, this, [[0, 11]]);
627
785
  }));
628
786
  function restoreOrder() {
629
787
  return _restoreOrder.apply(this, arguments);
@@ -640,38 +798,259 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
640
798
  }, {
641
799
  key: "getSummary",
642
800
  value: function () {
643
- var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
801
+ var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
644
802
  var summary;
645
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
646
- while (1) switch (_context7.prev = _context7.next) {
803
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
804
+ while (1) switch (_context9.prev = _context9.next) {
647
805
  case 0:
648
- _context7.prev = 0;
806
+ _context9.prev = 0;
649
807
  if (this.store.order) {
650
- _context7.next = 3;
808
+ _context9.next = 3;
651
809
  break;
652
810
  }
653
811
  throw new Error('order 模块未初始化');
654
812
  case 3:
655
- _context7.next = 5;
813
+ _context9.next = 5;
656
814
  return this.store.order.getOrderSummary();
657
815
  case 5:
658
- summary = _context7.sent;
659
- return _context7.abrupt("return", summary);
816
+ summary = _context9.sent;
817
+ return _context9.abrupt("return", summary);
660
818
  case 9:
661
- _context7.prev = 9;
662
- _context7.t0 = _context7["catch"](0);
663
- throw _context7.t0;
819
+ _context9.prev = 9;
820
+ _context9.t0 = _context9["catch"](0);
821
+ throw _context9.t0;
664
822
  case 12:
665
823
  case "end":
666
- return _context7.stop();
824
+ return _context9.stop();
667
825
  }
668
- }, _callee7, this, [[0, 9]]);
826
+ }, _callee9, this, [[0, 9]]);
669
827
  }));
670
828
  function getSummary() {
671
829
  return _getSummary.apply(this, arguments);
672
830
  }
673
831
  return getSummary;
674
832
  }()
833
+ }, {
834
+ key: "getHistoricalProductDiscountList",
835
+ value: function getHistoricalProductDiscountList(products) {
836
+ var historyDiscountList = [];
837
+ products.forEach(function (item) {
838
+ (item.discount_list || []).forEach(function (discount) {
839
+ var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
840
+ var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
841
+ if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
842
+ var quantity = item.quantity || item.num || item.product_quantity || 1;
843
+ 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);
844
+ var index = historyDiscountList.findIndex(function (n) {
845
+ return n.id === discountId;
846
+ });
847
+ if (index !== -1) {
848
+ historyDiscountList[index] = _objectSpread(_objectSpread({}, historyDiscountList[index]), {}, {
849
+ amount: new Decimal(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
850
+ savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
851
+ });
852
+ return;
853
+ }
854
+ historyDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
855
+ id: discountId,
856
+ tag: discount.tag || discount.type,
857
+ 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),
858
+ format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
859
+ isEditMode: true,
860
+ limited_relation_product_data: {},
861
+ savedAmount: savedAmount.toNumber(),
862
+ isAvailable: true,
863
+ isDisabled: true,
864
+ isSelected: true,
865
+ product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
866
+ }));
867
+ });
868
+ });
869
+ return historyDiscountList;
870
+ }
871
+ }, {
872
+ key: "mergeHistoricalDiscountList",
873
+ value: function mergeHistoricalDiscountList(discountList, products) {
874
+ var historyDiscountList = this.getHistoricalProductDiscountList(products);
875
+ var historyIds = new Set(historyDiscountList.map(function (discount) {
876
+ return discount.id;
877
+ }));
878
+ return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
879
+ return !historyIds.has(discount.id);
880
+ })));
881
+ }
882
+ }, {
883
+ key: "loadDiscountConfig",
884
+ value: function () {
885
+ var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
886
+ var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi;
887
+ var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result;
888
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
889
+ while (1) switch (_context10.prev = _context10.next) {
890
+ case 0:
891
+ if (this.store.order) {
892
+ _context10.next = 2;
893
+ break;
894
+ }
895
+ throw new Error('order 模块未初始化');
896
+ case 2:
897
+ tempOrder = this.store.order.ensureTempOrder();
898
+ orderStore = this.store.order.store || {};
899
+ discountModule = orderStore.discount;
900
+ rulesModule = orderStore.rules;
901
+ 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);
902
+ 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);
903
+ preparedDiscountList = [];
904
+ if (!(customerId && customerId !== 1)) {
905
+ _context10.next = 15;
906
+ break;
907
+ }
908
+ _context10.next = 12;
909
+ return this.store.order.loadDiscountConfig({
910
+ customerId: customerId,
911
+ action: (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create'),
912
+ orderId: Number(orderId) || undefined,
913
+ apply: false
914
+ });
915
+ case 12:
916
+ preparedDiscountList = _context10.sent;
917
+ _context10.next = 15;
918
+ return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
919
+ case 15:
920
+ nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [], tempOrder.products || []);
921
+ _context10.next = 18;
922
+ return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
923
+ case 18:
924
+ if (!rulesModule) {
925
+ _context10.next = 28;
926
+ break;
927
+ }
928
+ holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
929
+ form_record_id: tempOrder.holder.form_record_id
930
+ }] : [];
931
+ result = rulesModule.calcDiscount({
932
+ productList: tempOrder.products,
933
+ discountList: nextDiscountList,
934
+ holders: holders,
935
+ isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
936
+ orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
937
+ }) || {
938
+ productList: tempOrder.products,
939
+ discountList: nextDiscountList
940
+ };
941
+ if (result.productList) {
942
+ tempOrder.products = result.productList;
943
+ }
944
+ if (!result.discountList) {
945
+ _context10.next = 28;
946
+ break;
947
+ }
948
+ nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
949
+ OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
950
+ _context10.next = 27;
951
+ return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
952
+ case 27:
953
+ tempOrder.discount_list = nextDiscountList.filter(function (discount) {
954
+ return discount.isSelected;
955
+ });
956
+ case 28:
957
+ this.store.order.persistTempOrder();
958
+ return _context10.abrupt("return", {
959
+ productList: tempOrder.products || [],
960
+ discountList: nextDiscountList
961
+ });
962
+ case 30:
963
+ case "end":
964
+ return _context10.stop();
965
+ }
966
+ }, _callee10, this);
967
+ }));
968
+ function loadDiscountConfig(_x5) {
969
+ return _loadDiscountConfig.apply(this, arguments);
970
+ }
971
+ return loadDiscountConfig;
972
+ }()
973
+ }, {
974
+ key: "bestDiscount",
975
+ value: function () {
976
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(cb) {
977
+ var _discountModule$getOr;
978
+ var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
979
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
980
+ while (1) switch (_context11.prev = _context11.next) {
981
+ case 0:
982
+ if (this.store.order) {
983
+ _context11.next = 2;
984
+ break;
985
+ }
986
+ throw new Error('order 模块未初始化');
987
+ case 2:
988
+ tempOrder = this.store.order.ensureTempOrder();
989
+ orderStore = this.store.order.store || {};
990
+ discountModule = orderStore.discount;
991
+ rulesModule = orderStore.rules;
992
+ originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || this.getDiscountList();
993
+ nextDiscountList = this.mergeHistoricalDiscountList(originalDiscountList || [], tempOrder.products || []);
994
+ result = {
995
+ productList: tempOrder.products || [],
996
+ discountList: nextDiscountList
997
+ };
998
+ _context11.next = 11;
999
+ return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1000
+ case 11:
1001
+ if (!rulesModule) {
1002
+ _context11.next = 22;
1003
+ break;
1004
+ }
1005
+ holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
1006
+ form_record_id: tempOrder.holder.form_record_id
1007
+ }] : [];
1008
+ result = rulesModule.calcDiscount({
1009
+ productList: tempOrder.products,
1010
+ discountList: nextDiscountList,
1011
+ holders: holders,
1012
+ isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
1013
+ orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
1014
+ }) || result;
1015
+ if (result.productList) {
1016
+ tempOrder.products = result.productList;
1017
+ }
1018
+ if (!result.discountList) {
1019
+ _context11.next = 22;
1020
+ break;
1021
+ }
1022
+ nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
1023
+ OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
1024
+ _context11.next = 20;
1025
+ return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
1026
+ case 20:
1027
+ tempOrder.discount_list = nextDiscountList.filter(function (discount) {
1028
+ return discount.isSelected;
1029
+ });
1030
+ result = {
1031
+ productList: tempOrder.products,
1032
+ discountList: nextDiscountList
1033
+ };
1034
+ case 22:
1035
+ _context11.next = 24;
1036
+ return this.store.order.recalculateSummary({
1037
+ createIfMissing: true
1038
+ });
1039
+ case 24:
1040
+ this.store.order.persistTempOrder();
1041
+ cb === null || cb === void 0 || cb(result);
1042
+ return _context11.abrupt("return", result);
1043
+ case 27:
1044
+ case "end":
1045
+ return _context11.stop();
1046
+ }
1047
+ }, _callee11, this);
1048
+ }));
1049
+ function bestDiscount(_x6) {
1050
+ return _bestDiscount.apply(this, arguments);
1051
+ }
1052
+ return bestDiscount;
1053
+ }()
675
1054
  }, {
676
1055
  key: "getDiscountList",
677
1056
  value: function getDiscountList() {
@@ -681,49 +1060,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
681
1060
  }, {
682
1061
  key: "scanPromotionCode",
683
1062
  value: function () {
684
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(code, customerId) {
1063
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
685
1064
  var raw;
686
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
687
- while (1) switch (_context8.prev = _context8.next) {
1065
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1066
+ while (1) switch (_context12.prev = _context12.next) {
688
1067
  case 0:
689
- _context8.prev = 0;
1068
+ _context12.prev = 0;
690
1069
  if (this.store.order) {
691
- _context8.next = 3;
1070
+ _context12.next = 3;
692
1071
  break;
693
1072
  }
694
1073
  throw new Error('order 模块未初始化');
695
1074
  case 3:
696
- _context8.next = 5;
1075
+ _context12.next = 5;
697
1076
  return this.store.order.scanCode(code, customerId);
698
1077
  case 5:
699
- raw = _context8.sent;
1078
+ raw = _context12.sent;
700
1079
  if (!raw.isAvailable) {
701
- _context8.next = 10;
1080
+ _context12.next = 10;
702
1081
  break;
703
1082
  }
704
- _context8.next = 9;
1083
+ _context12.next = 9;
705
1084
  return this.store.order.recalculateSummary({
706
1085
  createIfMissing: true
707
1086
  });
708
1087
  case 9:
709
1088
  this.store.order.persistTempOrder();
710
1089
  case 10:
711
- return _context8.abrupt("return", {
1090
+ return _context12.abrupt("return", {
712
1091
  isAvailable: raw.isAvailable,
713
1092
  type: raw.type,
714
1093
  unavailableReason: raw.unavailableReason
715
1094
  });
716
1095
  case 13:
717
- _context8.prev = 13;
718
- _context8.t0 = _context8["catch"](0);
719
- throw _context8.t0;
1096
+ _context12.prev = 13;
1097
+ _context12.t0 = _context12["catch"](0);
1098
+ throw _context12.t0;
720
1099
  case 16:
721
1100
  case "end":
722
- return _context8.stop();
1101
+ return _context12.stop();
723
1102
  }
724
- }, _callee8, this, [[0, 13]]);
1103
+ }, _callee12, this, [[0, 13]]);
725
1104
  }));
726
- function scanPromotionCode(_x3, _x4) {
1105
+ function scanPromotionCode(_x7, _x8) {
727
1106
  return _scanPromotionCode.apply(this, arguments);
728
1107
  }
729
1108
  return scanPromotionCode;
@@ -731,14 +1110,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
731
1110
  }, {
732
1111
  key: "setDiscountSelected",
733
1112
  value: function () {
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) {
1113
+ var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1114
+ var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator, _step, d, selectedResourceIds, _iterator2, _step2, _product$metadata, _tempOrder$_extend3, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
1115
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1116
+ while (1) switch (_context13.prev = _context13.next) {
738
1117
  case 0:
739
- _context9.prev = 0;
1118
+ _context13.prev = 0;
740
1119
  if (this.store.order) {
741
- _context9.next = 3;
1120
+ _context13.next = 3;
742
1121
  break;
743
1122
  }
744
1123
  throw new Error('order 模块未初始化');
@@ -754,11 +1133,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
754
1133
  orderStore = this.store.order.store || {};
755
1134
  discountModule = orderStore.discount;
756
1135
  rulesModule = orderStore.rules;
757
- holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
1136
+ holders = (_tempOrder$holder5 = tempOrder.holder) !== null && _tempOrder$holder5 !== void 0 && _tempOrder$holder5.form_record_id ? [{
758
1137
  form_record_id: tempOrder.holder.form_record_id
759
1138
  }] : [];
760
1139
  nextDiscountList = updated;
761
- _context9.next = 13;
1140
+ _context13.next = 13;
762
1141
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
763
1142
  case 13:
764
1143
  if (rulesModule) {
@@ -766,7 +1145,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
766
1145
  productList: tempOrder.products,
767
1146
  discountList: updated,
768
1147
  holders: holders,
769
- isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
1148
+ isFormSubject: !!((_tempOrder$holder6 = tempOrder.holder) !== null && _tempOrder$holder6 !== void 0 && _tempOrder$holder6.type) && tempOrder.holder.type === 'form'
770
1149
  }, {
771
1150
  discountId: params.discountId,
772
1151
  isSelected: params.isSelected
@@ -807,21 +1186,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
807
1186
  return d.id;
808
1187
  }));
809
1188
  _iterator2 = _createForOfIteratorHelper(tempOrder.products);
810
- _context9.prev = 16;
1189
+ _context13.prev = 16;
811
1190
  _iterator2.s();
812
1191
  case 18:
813
1192
  if ((_step2 = _iterator2.n()).done) {
814
- _context9.next = 34;
1193
+ _context13.next = 34;
815
1194
  break;
816
1195
  }
817
1196
  product = _step2.value;
818
1197
  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;
1198
+ 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;
820
1199
  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;
1200
+ _context13.next = 24;
822
1201
  break;
823
1202
  }
824
- return _context9.abrupt("continue", 32);
1203
+ return _context13.abrupt("continue", 32);
825
1204
  case 24:
826
1205
  product.discount_list = (product.discount_list || []).filter(function (pd) {
827
1206
  var _pd$discount$resource, _pd$discount;
@@ -847,65 +1226,127 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
847
1226
  bundle: product.product_bundle
848
1227
  });
849
1228
  case 32:
850
- _context9.next = 18;
1229
+ _context13.next = 18;
851
1230
  break;
852
1231
  case 34:
853
- _context9.next = 39;
1232
+ _context13.next = 39;
854
1233
  break;
855
1234
  case 36:
856
- _context9.prev = 36;
857
- _context9.t0 = _context9["catch"](16);
858
- _iterator2.e(_context9.t0);
1235
+ _context13.prev = 36;
1236
+ _context13.t0 = _context13["catch"](16);
1237
+ _iterator2.e(_context13.t0);
859
1238
  case 39:
860
- _context9.prev = 39;
1239
+ _context13.prev = 39;
861
1240
  _iterator2.f();
862
- return _context9.finish(39);
1241
+ return _context13.finish(39);
863
1242
  case 42:
864
1243
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
865
- _context9.next = 45;
1244
+ _context13.next = 45;
866
1245
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
867
1246
  case 45:
868
1247
  tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
869
1248
  return d.isSelected;
870
1249
  });
871
- _context9.next = 48;
1250
+ _context13.next = 48;
872
1251
  return this.store.order.recalculateSummary({
873
1252
  createIfMissing: true
874
1253
  });
875
1254
  case 48:
876
1255
  this.store.order.persistTempOrder();
877
- _context9.next = 54;
1256
+ _context13.next = 54;
878
1257
  break;
879
1258
  case 51:
880
- _context9.prev = 51;
881
- _context9.t1 = _context9["catch"](0);
882
- throw _context9.t1;
1259
+ _context13.prev = 51;
1260
+ _context13.t1 = _context13["catch"](0);
1261
+ throw _context13.t1;
883
1262
  case 54:
884
1263
  case "end":
885
- return _context9.stop();
1264
+ return _context13.stop();
886
1265
  }
887
- }, _callee9, this, [[0, 51], [16, 36, 39, 42]]);
1266
+ }, _callee13, this, [[0, 51], [16, 36, 39, 42]]);
888
1267
  }));
889
- function setDiscountSelected(_x5) {
1268
+ function setDiscountSelected(_x9) {
890
1269
  return _setDiscountSelected.apply(this, arguments);
891
1270
  }
892
1271
  return setDiscountSelected;
893
1272
  }()
1273
+ }, {
1274
+ key: "applyDiscountCalculationResult",
1275
+ value: function () {
1276
+ var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(result) {
1277
+ var tempOrder, orderStore, discountModule;
1278
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1279
+ while (1) switch (_context14.prev = _context14.next) {
1280
+ case 0:
1281
+ _context14.prev = 0;
1282
+ if (this.store.order) {
1283
+ _context14.next = 3;
1284
+ break;
1285
+ }
1286
+ throw new Error('order 模块未初始化');
1287
+ case 3:
1288
+ if (result) {
1289
+ _context14.next = 5;
1290
+ break;
1291
+ }
1292
+ return _context14.abrupt("return");
1293
+ case 5:
1294
+ tempOrder = this.store.order.ensureTempOrder();
1295
+ orderStore = this.store.order.store || {};
1296
+ discountModule = orderStore.discount;
1297
+ if (result.productList) {
1298
+ tempOrder.products = result.productList;
1299
+ }
1300
+ if (!result.discountList) {
1301
+ _context14.next = 14;
1302
+ break;
1303
+ }
1304
+ OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
1305
+ _context14.next = 13;
1306
+ return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
1307
+ case 13:
1308
+ tempOrder.discount_list = result.discountList.filter(function (discount) {
1309
+ return discount.isSelected;
1310
+ });
1311
+ case 14:
1312
+ _context14.next = 16;
1313
+ return this.store.order.recalculateSummary({
1314
+ createIfMissing: true
1315
+ });
1316
+ case 16:
1317
+ this.store.order.persistTempOrder();
1318
+ _context14.next = 22;
1319
+ break;
1320
+ case 19:
1321
+ _context14.prev = 19;
1322
+ _context14.t0 = _context14["catch"](0);
1323
+ throw _context14.t0;
1324
+ case 22:
1325
+ case "end":
1326
+ return _context14.stop();
1327
+ }
1328
+ }, _callee14, this, [[0, 19]]);
1329
+ }));
1330
+ function applyDiscountCalculationResult(_x10) {
1331
+ return _applyDiscountCalculationResult.apply(this, arguments);
1332
+ }
1333
+ return applyDiscountCalculationResult;
1334
+ }()
894
1335
  }, {
895
1336
  key: "submitScanOrder",
896
1337
  value: function () {
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) {
1338
+ var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1339
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1340
+ while (1) switch (_context15.prev = _context15.next) {
900
1341
  case 0:
901
- return _context10.abrupt("return", this.submitSalesOrder(params));
1342
+ return _context15.abrupt("return", this.submitSalesOrder(params));
902
1343
  case 1:
903
1344
  case "end":
904
- return _context10.stop();
1345
+ return _context15.stop();
905
1346
  }
906
- }, _callee10, this);
1347
+ }, _callee15, this);
907
1348
  }));
908
- function submitScanOrder(_x6) {
1349
+ function submitScanOrder(_x11) {
909
1350
  return _submitScanOrder.apply(this, arguments);
910
1351
  }
911
1352
  return submitScanOrder;
@@ -919,14 +1360,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
919
1360
  }, {
920
1361
  key: "submitSalesOrder",
921
1362
  value: (function () {
922
- var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
923
- var _this$otherParams2, _this$otherParams3, _this$otherParams4, _this$otherParams5;
1363
+ var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1364
+ var _this$otherParams4, _this$otherParams5, _this$otherParams6;
924
1365
  var submitParams;
925
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
926
- while (1) switch (_context11.prev = _context11.next) {
1366
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1367
+ while (1) switch (_context16.prev = _context16.next) {
927
1368
  case 0:
928
1369
  if (this.store.order) {
929
- _context11.next = 2;
1370
+ _context16.next = 2;
930
1371
  break;
931
1372
  }
932
1373
  throw new Error('BaseSales 解决方案需要 order 模块支持');
@@ -934,10 +1375,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
934
1375
  this.store.order.persistTempOrder();
935
1376
  submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
936
1377
  cacheId: this.cacheId,
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
1378
+ platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
1379
+ businessCode: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode,
1380
+ channel: this.getSubmitOrderSalesChannel(),
1381
+ type: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.type
941
1382
  }, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
942
1383
  payments: params.payments
943
1384
  } : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
@@ -947,14 +1388,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
947
1388
  } : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
948
1389
  enhancePayload: params.enhancePayload
949
1390
  } : {});
950
- return _context11.abrupt("return", this.store.order.submitTempOrder(submitParams));
951
- case 5:
1391
+ console.log(submitParams, 'submitParams123');
1392
+ return _context16.abrupt("return", this.store.order.submitTempOrder(submitParams));
1393
+ case 6:
952
1394
  case "end":
953
- return _context11.stop();
1395
+ return _context16.stop();
954
1396
  }
955
- }, _callee11, this);
1397
+ }, _callee16, this);
956
1398
  }));
957
- function submitSalesOrder(_x7) {
1399
+ function submitSalesOrder(_x12) {
958
1400
  return _submitSalesOrder.apply(this, arguments);
959
1401
  }
960
1402
  return submitSalesOrder;
@@ -962,24 +1404,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
962
1404
  }, {
963
1405
  key: "syncPaymentsToOrder",
964
1406
  value: function () {
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) {
1407
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1408
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1409
+ while (1) switch (_context17.prev = _context17.next) {
968
1410
  case 0:
969
1411
  if (this.store.order) {
970
- _context12.next = 2;
1412
+ _context17.next = 2;
971
1413
  break;
972
1414
  }
973
1415
  throw new Error('order 模块未初始化');
974
1416
  case 2:
975
- return _context12.abrupt("return", this.store.order.syncPaymentsToOrder(params));
1417
+ return _context17.abrupt("return", this.store.order.syncPaymentsToOrder(params));
976
1418
  case 3:
977
1419
  case "end":
978
- return _context12.stop();
1420
+ return _context17.stop();
979
1421
  }
980
- }, _callee12, this);
1422
+ }, _callee17, this);
981
1423
  }));
982
- function syncPaymentsToOrder(_x8) {
1424
+ function syncPaymentsToOrder(_x13) {
983
1425
  return _syncPaymentsToOrder.apply(this, arguments);
984
1426
  }
985
1427
  return syncPaymentsToOrder;
@@ -1033,8 +1475,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1033
1475
  }, {
1034
1476
  key: "getWalletProductList",
1035
1477
  value: function getWalletProductList() {
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();
1478
+ var _this$store$order3, _tempOrder$products;
1479
+ var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
1038
1480
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
1039
1481
  return tempOrder.products.map(function (product) {
1040
1482
  var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
@@ -1047,6 +1489,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1047
1489
  is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
1048
1490
  tax_fee: product.tax_fee,
1049
1491
  selling_price: Number(product.selling_price || 0),
1492
+ discount_list: product.discount_list || [],
1050
1493
  holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
1051
1494
  original_price: product.original_price,
1052
1495
  main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
@@ -1082,20 +1525,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1082
1525
  }, {
1083
1526
  key: "initWalletData",
1084
1527
  value: function () {
1085
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1528
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1086
1529
  var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
1087
1530
  var snapshot, tempOrder, amount, walletBusinessData, result;
1088
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1089
- while (1) switch (_context13.prev = _context13.next) {
1531
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1532
+ while (1) switch (_context18.prev = _context18.next) {
1090
1533
  case 0:
1091
1534
  if (this.store.order) {
1092
- _context13.next = 2;
1535
+ _context18.next = 2;
1093
1536
  break;
1094
1537
  }
1095
1538
  throw new Error('order 模块未初始化');
1096
1539
  case 2:
1097
1540
  if (this.store.payment) {
1098
- _context13.next = 4;
1541
+ _context18.next = 4;
1099
1542
  break;
1100
1543
  }
1101
1544
  throw new Error('payment 模块未初始化');
@@ -1104,10 +1547,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1104
1547
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
1105
1548
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
1106
1549
  if (!(!tempOrder || !amount)) {
1107
- _context13.next = 9;
1550
+ _context18.next = 9;
1108
1551
  break;
1109
1552
  }
1110
- return _context13.abrupt("return", {
1553
+ return _context18.abrupt("return", {
1111
1554
  walletRecommendList: [],
1112
1555
  userIdentificationCodes: [],
1113
1556
  transformList: [],
@@ -1130,11 +1573,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1130
1573
  }, snapshot.identity.orderId ? {
1131
1574
  payment_order_id: String(snapshot.identity.orderId)
1132
1575
  } : {});
1133
- _context13.next = 12;
1576
+ _context18.next = 12;
1134
1577
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
1135
1578
  case 12:
1136
- result = _context13.sent;
1137
- _context13.next = 15;
1579
+ result = _context18.sent;
1580
+ _context18.next = 15;
1138
1581
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
1139
1582
  orderId: snapshot.identity.orderId,
1140
1583
  customerId: walletBusinessData.customer_id,
@@ -1146,14 +1589,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1146
1589
  timestamp: Date.now()
1147
1590
  });
1148
1591
  case 15:
1149
- return _context13.abrupt("return", result);
1592
+ return _context18.abrupt("return", result);
1150
1593
  case 16:
1151
1594
  case "end":
1152
- return _context13.stop();
1595
+ return _context18.stop();
1153
1596
  }
1154
- }, _callee13, this);
1597
+ }, _callee18, this);
1155
1598
  }));
1156
- function initWalletData(_x9) {
1599
+ function initWalletData(_x14) {
1157
1600
  return _initWalletData.apply(this, arguments);
1158
1601
  }
1159
1602
  return initWalletData;
@@ -1180,27 +1623,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1180
1623
  }, {
1181
1624
  key: "getPaymentMethodsAsync",
1182
1625
  value: (function () {
1183
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1626
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1184
1627
  var response;
1185
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1186
- while (1) switch (_context14.prev = _context14.next) {
1628
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1629
+ while (1) switch (_context19.prev = _context19.next) {
1187
1630
  case 0:
1188
1631
  if (!this.store.payment) {
1189
- _context14.next = 2;
1632
+ _context19.next = 2;
1190
1633
  break;
1191
1634
  }
1192
- return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
1635
+ return _context19.abrupt("return", this.store.payment.getPayMethodListAsync());
1193
1636
  case 2:
1194
- _context14.next = 4;
1637
+ _context19.next = 4;
1195
1638
  return this.request.get('/pay/custom-payment/all');
1196
1639
  case 4:
1197
- response = _context14.sent;
1198
- return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1640
+ response = _context19.sent;
1641
+ return _context19.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
1199
1642
  case 6:
1200
1643
  case "end":
1201
- return _context14.stop();
1644
+ return _context19.stop();
1202
1645
  }
1203
- }, _callee14, this);
1646
+ }, _callee19, this);
1204
1647
  }));
1205
1648
  function getPaymentMethodsAsync() {
1206
1649
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -1241,49 +1684,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1241
1684
  }, {
1242
1685
  key: "sendCustomerPayLink",
1243
1686
  value: (function () {
1244
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1687
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1245
1688
  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) {
1689
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1690
+ while (1) switch (_context20.prev = _context20.next) {
1248
1691
  case 0:
1249
1692
  if (this.store.order) {
1250
- _context15.next = 2;
1693
+ _context20.next = 2;
1251
1694
  break;
1252
1695
  }
1253
1696
  throw new Error('order 模块未初始化');
1254
1697
  case 2:
1255
1698
  orderIds = params.order_ids || params.orderIds || [];
1256
1699
  if (!(!orderIds.length || params.submitBeforeSend)) {
1257
- _context15.next = 11;
1700
+ _context20.next = 11;
1258
1701
  break;
1259
1702
  }
1260
- _context15.next = 6;
1703
+ _context20.next = 6;
1261
1704
  return this.submitSalesOrder({
1262
1705
  smallTicketDataFlag: 1
1263
1706
  });
1264
1707
  case 6:
1265
- submitResult = _context15.sent;
1708
+ submitResult = _context20.sent;
1266
1709
  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;
1267
1710
  if (orderId) {
1268
- _context15.next = 10;
1711
+ _context20.next = 10;
1269
1712
  break;
1270
1713
  }
1271
1714
  throw new Error('本地订单提交云端失败,无法发送支付链接');
1272
1715
  case 10:
1273
1716
  orderIds = [orderId];
1274
1717
  case 11:
1275
- return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
1718
+ return _context20.abrupt("return", this.store.order.sendCustomerPayLink({
1276
1719
  emails: params.emails,
1277
1720
  notify_action: params.notify_action,
1278
1721
  order_ids: orderIds
1279
1722
  }));
1280
1723
  case 12:
1281
1724
  case "end":
1282
- return _context15.stop();
1725
+ return _context20.stop();
1283
1726
  }
1284
- }, _callee15, this);
1727
+ }, _callee20, this);
1285
1728
  }));
1286
- function sendCustomerPayLink(_x10) {
1729
+ function sendCustomerPayLink(_x15) {
1287
1730
  return _sendCustomerPayLink.apply(this, arguments);
1288
1731
  }
1289
1732
  return sendCustomerPayLink;
@@ -1293,76 +1736,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1293
1736
  value: function transformBaseProductToOrderProduct(params) {
1294
1737
  return _transformBaseProductToOrderProduct(params);
1295
1738
  }
1739
+ }, {
1740
+ key: "calculateProductBookingPrice",
1741
+ value: function () {
1742
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1743
+ var _params$customer_id;
1744
+ var quotation, customerId;
1745
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1746
+ while (1) switch (_context21.prev = _context21.next) {
1747
+ case 0:
1748
+ quotation = this.store.quotation;
1749
+ customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
1750
+ _context21.next = 4;
1751
+ return this.loadQuotationForPriceQuery({
1752
+ quotation: quotation,
1753
+ customer_id: customerId,
1754
+ channel: params.channel
1755
+ });
1756
+ case 4:
1757
+ return _context21.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
1758
+ customer_id: customerId,
1759
+ quotation: quotation
1760
+ })));
1761
+ case 5:
1762
+ case "end":
1763
+ return _context21.stop();
1764
+ }
1765
+ }, _callee21, this);
1766
+ }));
1767
+ function calculateProductBookingPrice(_x16) {
1768
+ return _calculateProductBookingPrice.apply(this, arguments);
1769
+ }
1770
+ return calculateProductBookingPrice;
1771
+ }()
1296
1772
  }, {
1297
1773
  key: "addProductToOrder",
1298
1774
  value: function () {
1299
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
1775
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(product, booking) {
1300
1776
  var products;
1301
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1302
- while (1) switch (_context16.prev = _context16.next) {
1777
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1778
+ while (1) switch (_context22.prev = _context22.next) {
1303
1779
  case 0:
1304
- _context16.prev = 0;
1780
+ _context22.prev = 0;
1305
1781
  if (this.store.order) {
1306
- _context16.next = 3;
1782
+ _context22.next = 3;
1307
1783
  break;
1308
1784
  }
1309
1785
  throw new Error('order 模块未初始化');
1310
1786
  case 3:
1311
- _context16.next = 5;
1787
+ _context22.next = 5;
1312
1788
  return this.store.order.addProductToOrder(product, booking);
1313
1789
  case 5:
1314
- products = _context16.sent;
1315
- return _context16.abrupt("return", products);
1790
+ products = _context22.sent;
1791
+ return _context22.abrupt("return", products);
1316
1792
  case 9:
1317
- _context16.prev = 9;
1318
- _context16.t0 = _context16["catch"](0);
1319
- throw _context16.t0;
1793
+ _context22.prev = 9;
1794
+ _context22.t0 = _context22["catch"](0);
1795
+ throw _context22.t0;
1320
1796
  case 12:
1321
1797
  case "end":
1322
- return _context16.stop();
1798
+ return _context22.stop();
1323
1799
  }
1324
- }, _callee16, this, [[0, 9]]);
1800
+ }, _callee22, this, [[0, 9]]);
1325
1801
  }));
1326
- function addProductToOrder(_x11, _x12) {
1802
+ function addProductToOrder(_x17, _x18) {
1327
1803
  return _addProductToOrder.apply(this, arguments);
1328
1804
  }
1329
1805
  return addProductToOrder;
1330
1806
  }()
1331
1807
  }, {
1332
- key: "updateProductInOrder",
1808
+ key: "updateOrderProduct",
1333
1809
  value: function () {
1334
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1810
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1335
1811
  var products;
1336
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1337
- while (1) switch (_context17.prev = _context17.next) {
1812
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1813
+ while (1) switch (_context23.prev = _context23.next) {
1338
1814
  case 0:
1339
- _context17.prev = 0;
1815
+ _context23.prev = 0;
1340
1816
  if (this.store.order) {
1341
- _context17.next = 3;
1817
+ _context23.next = 3;
1342
1818
  break;
1343
1819
  }
1344
1820
  throw new Error('order 模块未初始化');
1345
1821
  case 3:
1346
- _context17.next = 5;
1347
- return this.store.order.updateProductInOrder(params);
1822
+ _context23.next = 5;
1823
+ return this.store.order.updateOrderProduct(params);
1348
1824
  case 5:
1349
- products = _context17.sent;
1350
- return _context17.abrupt("return", products);
1825
+ products = _context23.sent;
1826
+ return _context23.abrupt("return", products);
1351
1827
  case 9:
1352
- _context17.prev = 9;
1353
- _context17.t0 = _context17["catch"](0);
1354
- throw _context17.t0;
1828
+ _context23.prev = 9;
1829
+ _context23.t0 = _context23["catch"](0);
1830
+ throw _context23.t0;
1355
1831
  case 12:
1356
1832
  case "end":
1357
- return _context17.stop();
1833
+ return _context23.stop();
1358
1834
  }
1359
- }, _callee17, this, [[0, 9]]);
1835
+ }, _callee23, this, [[0, 9]]);
1360
1836
  }));
1361
- function updateProductInOrder(_x13) {
1362
- return _updateProductInOrder.apply(this, arguments);
1837
+ function updateOrderProduct(_x19) {
1838
+ return _updateOrderProduct.apply(this, arguments);
1363
1839
  }
1364
- return updateProductInOrder;
1840
+ return updateOrderProduct;
1365
1841
  }()
1842
+ }, {
1843
+ key: "updateOrderBooking",
1844
+ value: function updateOrderBooking(params) {
1845
+ try {
1846
+ if (!this.store.order) throw new Error('order 模块未初始化');
1847
+ return this.store.order.updateOrderBooking(params);
1848
+ } catch (error) {
1849
+ throw error;
1850
+ }
1851
+ }
1852
+
1366
1853
  /**
1367
1854
  * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
1368
1855
  * 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
@@ -1370,12 +1857,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1370
1857
  }, {
1371
1858
  key: "setOrderProductLineNote",
1372
1859
  value: (function () {
1373
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
1860
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(identity, note) {
1374
1861
  var params, products;
1375
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1376
- while (1) switch (_context18.prev = _context18.next) {
1862
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1863
+ while (1) switch (_context24.prev = _context24.next) {
1377
1864
  case 0:
1378
- _context18.prev = 0;
1865
+ _context24.prev = 0;
1379
1866
  params = {
1380
1867
  product_id: identity.product_id,
1381
1868
  product_variant_id: identity.product_variant_id,
@@ -1390,22 +1877,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1390
1877
  params.product_option_item = identity.product_option_item;
1391
1878
  }
1392
1879
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1393
- _context18.next = 7;
1394
- return this.updateProductInOrder(params);
1880
+ _context24.next = 7;
1881
+ return this.updateOrderProduct(params);
1395
1882
  case 7:
1396
- products = _context18.sent;
1397
- return _context18.abrupt("return", products);
1883
+ products = _context24.sent;
1884
+ return _context24.abrupt("return", products);
1398
1885
  case 11:
1399
- _context18.prev = 11;
1400
- _context18.t0 = _context18["catch"](0);
1401
- throw _context18.t0;
1886
+ _context24.prev = 11;
1887
+ _context24.t0 = _context24["catch"](0);
1888
+ throw _context24.t0;
1402
1889
  case 14:
1403
1890
  case "end":
1404
- return _context18.stop();
1891
+ return _context24.stop();
1405
1892
  }
1406
- }, _callee18, this, [[0, 11]]);
1893
+ }, _callee24, this, [[0, 11]]);
1407
1894
  }));
1408
- function setOrderProductLineNote(_x14, _x15) {
1895
+ function setOrderProductLineNote(_x20, _x21) {
1409
1896
  return _setOrderProductLineNote.apply(this, arguments);
1410
1897
  }
1411
1898
  return setOrderProductLineNote;
@@ -1413,34 +1900,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1413
1900
  }, {
1414
1901
  key: "removeProductFromOrder",
1415
1902
  value: function () {
1416
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
1903
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(identity) {
1417
1904
  var products;
1418
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1419
- while (1) switch (_context19.prev = _context19.next) {
1905
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1906
+ while (1) switch (_context25.prev = _context25.next) {
1420
1907
  case 0:
1421
- _context19.prev = 0;
1908
+ _context25.prev = 0;
1422
1909
  if (this.store.order) {
1423
- _context19.next = 3;
1910
+ _context25.next = 3;
1424
1911
  break;
1425
1912
  }
1426
1913
  throw new Error('order 模块未初始化');
1427
1914
  case 3:
1428
- _context19.next = 5;
1915
+ _context25.next = 5;
1429
1916
  return this.store.order.removeProductFromOrder(identity);
1430
1917
  case 5:
1431
- products = _context19.sent;
1432
- return _context19.abrupt("return", products);
1918
+ products = _context25.sent;
1919
+ return _context25.abrupt("return", products);
1433
1920
  case 9:
1434
- _context19.prev = 9;
1435
- _context19.t0 = _context19["catch"](0);
1436
- throw _context19.t0;
1921
+ _context25.prev = 9;
1922
+ _context25.t0 = _context25["catch"](0);
1923
+ throw _context25.t0;
1437
1924
  case 12:
1438
1925
  case "end":
1439
- return _context19.stop();
1926
+ return _context25.stop();
1440
1927
  }
1441
- }, _callee19, this, [[0, 9]]);
1928
+ }, _callee25, this, [[0, 9]]);
1442
1929
  }));
1443
- function removeProductFromOrder(_x16) {
1930
+ function removeProductFromOrder(_x22) {
1444
1931
  return _removeProductFromOrder.apply(this, arguments);
1445
1932
  }
1446
1933
  return removeProductFromOrder;
@@ -1449,18 +1936,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1449
1936
  }, {
1450
1937
  key: "getProductList",
1451
1938
  value: function () {
1452
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1453
- var _this$otherParams6;
1939
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1940
+ var _this$otherParams7;
1454
1941
  var menu_list_ids, _this$store$products, res;
1455
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1456
- while (1) switch (_context20.prev = _context20.next) {
1942
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1943
+ while (1) switch (_context26.prev = _context26.next) {
1457
1944
  case 0:
1458
1945
  // 可以直接通过配置里的 menu 读取
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) {
1946
+ menu_list_ids = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.dineInConfig) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus'].map(function (n) {
1460
1947
  return Number(n.value);
1461
1948
  })) || [];
1462
- _context20.prev = 1;
1463
- _context20.next = 4;
1949
+ _context26.prev = 1;
1950
+ _context26.next = 4;
1464
1951
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
1465
1952
  menu_list_ids: menu_list_ids,
1466
1953
  cacheId: this.cacheId,
@@ -1468,17 +1955,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1468
1955
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1469
1956
  });
1470
1957
  case 4:
1471
- res = _context20.sent;
1472
- return _context20.abrupt("return", res);
1958
+ res = _context26.sent;
1959
+ return _context26.abrupt("return", res);
1473
1960
  case 8:
1474
- _context20.prev = 8;
1475
- _context20.t0 = _context20["catch"](1);
1476
- throw _context20.t0;
1961
+ _context26.prev = 8;
1962
+ _context26.t0 = _context26["catch"](1);
1963
+ throw _context26.t0;
1477
1964
  case 11:
1478
1965
  case "end":
1479
- return _context20.stop();
1966
+ return _context26.stop();
1480
1967
  }
1481
- }, _callee20, this, [[1, 8]]);
1968
+ }, _callee26, this, [[1, 8]]);
1482
1969
  }));
1483
1970
  function getProductList() {
1484
1971
  return _getProductList.apply(this, arguments);
@@ -1493,15 +1980,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1493
1980
  }, {
1494
1981
  key: "setOtherParams",
1495
1982
  value: function () {
1496
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1983
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
1497
1984
  var _ref4,
1498
1985
  _ref4$cover,
1499
1986
  cover,
1500
- _args21 = arguments;
1501
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1502
- while (1) switch (_context21.prev = _context21.next) {
1987
+ _args27 = arguments;
1988
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1989
+ while (1) switch (_context27.prev = _context27.next) {
1503
1990
  case 0:
1504
- _ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
1991
+ _ref4 = _args27.length > 1 && _args27[1] !== undefined ? _args27[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
1505
1992
  if (cover) {
1506
1993
  this.otherParams = params;
1507
1994
  } else {
@@ -1509,11 +1996,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1509
1996
  }
1510
1997
  case 2:
1511
1998
  case "end":
1512
- return _context21.stop();
1999
+ return _context27.stop();
1513
2000
  }
1514
- }, _callee21, this);
2001
+ }, _callee27, this);
1515
2002
  }));
1516
- function setOtherParams(_x17) {
2003
+ function setOtherParams(_x23) {
1517
2004
  return _setOtherParams.apply(this, arguments);
1518
2005
  }
1519
2006
  return setOtherParams;