@pisell/pisellos 2.2.171 → 2.2.173
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.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +193 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.d.ts +6 -0
- package/dist/modules/Customer/index.js +129 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -4
- package/dist/modules/Discount/index.js +8 -93
- package/dist/modules/Discount/types.d.ts +1 -7
- package/dist/modules/Order/index.d.ts +33 -17
- package/dist/modules/Order/index.js +757 -395
- package/dist/modules/Order/types.d.ts +58 -17
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +212 -0
- package/dist/modules/Order/utils.d.ts +39 -1
- package/dist/modules/Order/utils.js +219 -31
- package/dist/modules/Quotation/index.js +16 -5
- package/dist/modules/Rules/index.d.ts +4 -0
- package/dist/modules/Rules/index.js +26 -10
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/Schedule/index.js +6 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/server/index.js +10 -6
- package/dist/server/modules/order/utils/filterOrders.js +20 -6
- package/dist/server/modules/products/index.js +113 -94
- package/dist/server/modules/schedule/index.js +13 -6
- package/dist/solution/BaseSales/index.d.ts +53 -7
- package/dist/solution/BaseSales/index.js +1160 -339
- package/dist/solution/BaseSales/types.d.ts +67 -1
- package/dist/solution/BaseSales/types.js +3 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +65 -15
- package/dist/solution/BaseSales/utils.js +46 -8
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +134 -2
- package/dist/solution/BookingTicket/index.js +776 -175
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +46 -8
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +18 -23
- package/dist/solution/VenueBooking/index.d.ts +5 -9
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +207 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.d.ts +6 -0
- package/lib/modules/Customer/index.js +26 -11
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -4
- package/lib/modules/Discount/index.js +8 -63
- package/lib/modules/Discount/types.d.ts +1 -7
- package/lib/modules/Order/index.d.ts +33 -17
- package/lib/modules/Order/index.js +402 -148
- package/lib/modules/Order/types.d.ts +58 -17
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils.d.ts +39 -1
- package/lib/modules/Order/utils.js +197 -22
- package/lib/modules/Quotation/index.js +17 -6
- package/lib/modules/Rules/index.d.ts +4 -0
- package/lib/modules/Rules/index.js +22 -14
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/Schedule/index.js +3 -1
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/server/index.js +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +12 -4
- package/lib/server/modules/products/index.js +23 -12
- package/lib/server/modules/schedule/index.js +2 -1
- package/lib/solution/BaseSales/index.d.ts +53 -7
- package/lib/solution/BaseSales/index.js +527 -20
- package/lib/solution/BaseSales/types.d.ts +67 -1
- package/lib/solution/BaseSales/types.js +3 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +70 -11
- package/lib/solution/BaseSales/utils.js +46 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +134 -2
- package/lib/solution/BookingTicket/index.js +349 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +46 -6
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +2 -4
- package/lib/solution/VenueBooking/index.d.ts +5 -9
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +2 -2
|
@@ -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"); } }
|
|
@@ -23,13 +27,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
23
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
28
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
29
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
|
+
import { BaseSalesHookNames } from "./types";
|
|
26
31
|
import { OrderModule } from "../../modules/Order";
|
|
27
32
|
import Decimal from 'decimal.js';
|
|
28
33
|
import { createModule } from "../BookingByStep/types";
|
|
29
34
|
import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
30
35
|
import dayjs from 'dayjs';
|
|
31
36
|
export * from "./types";
|
|
37
|
+
import { QuotationModule } from "../../modules/Quotation";
|
|
32
38
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
39
|
+
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
33
40
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
34
41
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
35
42
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -43,6 +50,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
43
50
|
_defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
|
|
44
51
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
45
52
|
// LoggerManager 实例
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
46
54
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
47
55
|
order: undefined
|
|
48
56
|
});
|
|
@@ -56,17 +64,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
56
64
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
57
65
|
// 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
|
|
58
66
|
_defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
59
69
|
return _this;
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
/**
|
|
63
73
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
64
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
74
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment / quotation。
|
|
65
75
|
*/
|
|
66
76
|
_createClass(BaseSalesImpl, [{
|
|
67
77
|
key: "getRegisteredModuleNames",
|
|
68
78
|
value: function getRegisteredModuleNames() {
|
|
69
|
-
return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
|
|
79
|
+
return ['products', 'order', 'salesSummary', 'schedule', 'payment', 'quotation'];
|
|
70
80
|
}
|
|
71
81
|
|
|
72
82
|
/**
|
|
@@ -121,6 +131,63 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
121
131
|
get: function get() {
|
|
122
132
|
return this.store.payment;
|
|
123
133
|
}
|
|
134
|
+
}, {
|
|
135
|
+
key: "getCurrentOrderCustomerId",
|
|
136
|
+
value: function getCurrentOrderCustomerId() {
|
|
137
|
+
var _this$store$order, _this$store$order$get;
|
|
138
|
+
var tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
139
|
+
var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
140
|
+
if (customerId === null || customerId === undefined) return undefined;
|
|
141
|
+
return customerId;
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "applyQuotationScheduleResolver",
|
|
145
|
+
value: function applyQuotationScheduleResolver(quotation) {
|
|
146
|
+
var scheduleModule = this.store.schedule;
|
|
147
|
+
if (!scheduleModule) return;
|
|
148
|
+
quotation.setScheduleResolver(function (id) {
|
|
149
|
+
var _scheduleModule$getSc;
|
|
150
|
+
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
|
|
151
|
+
return schedules[0];
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "loadQuotationForPriceQuery",
|
|
156
|
+
value: function () {
|
|
157
|
+
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
158
|
+
var _this$otherParams;
|
|
159
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
160
|
+
while (1) switch (_context.prev = _context.next) {
|
|
161
|
+
case 0:
|
|
162
|
+
if (params.quotation) {
|
|
163
|
+
_context.next = 2;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
return _context.abrupt("return");
|
|
167
|
+
case 2:
|
|
168
|
+
this.applyQuotationScheduleResolver(params.quotation);
|
|
169
|
+
_context.next = 5;
|
|
170
|
+
return params.quotation.loadQuotations({
|
|
171
|
+
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
172
|
+
customer_id: params.customer_id
|
|
173
|
+
});
|
|
174
|
+
case 5:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context.stop();
|
|
177
|
+
}
|
|
178
|
+
}, _callee, this);
|
|
179
|
+
}));
|
|
180
|
+
function loadQuotationForPriceQuery(_x) {
|
|
181
|
+
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
182
|
+
}
|
|
183
|
+
return loadQuotationForPriceQuery;
|
|
184
|
+
}()
|
|
185
|
+
}, {
|
|
186
|
+
key: "getSubmitOrderSalesChannel",
|
|
187
|
+
value: function getSubmitOrderSalesChannel() {
|
|
188
|
+
var _this$otherParams2;
|
|
189
|
+
return (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel;
|
|
190
|
+
}
|
|
124
191
|
|
|
125
192
|
/**
|
|
126
193
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -130,6 +197,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
130
197
|
}, {
|
|
131
198
|
key: "createSubModule",
|
|
132
199
|
value: function createSubModule(moduleName) {
|
|
200
|
+
if (moduleName === 'quotation') {
|
|
201
|
+
return new QuotationModule("".concat(this.name, "_quotation"));
|
|
202
|
+
}
|
|
133
203
|
return createModule(moduleName, this.name);
|
|
134
204
|
}
|
|
135
205
|
}, {
|
|
@@ -163,39 +233,78 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
163
233
|
return {};
|
|
164
234
|
}
|
|
165
235
|
}
|
|
236
|
+
}, {
|
|
237
|
+
key: "getAppData",
|
|
238
|
+
value: function getAppData(key) {
|
|
239
|
+
var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
240
|
+
var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
241
|
+
if (typeof getData === 'function') return getData(key);
|
|
242
|
+
var app = this.appPlugin.getApp();
|
|
243
|
+
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');
|
|
244
|
+
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
245
|
+
}
|
|
246
|
+
}, {
|
|
247
|
+
key: "syncAppDataToTempOrder",
|
|
248
|
+
value: function syncAppDataToTempOrder(tempOrder) {
|
|
249
|
+
var taxCountryCode = this.getAppData('tax_country_code');
|
|
250
|
+
var currencyCode = this.getAppData('shop_currency_code');
|
|
251
|
+
var currencySymbol = this.getAppData('shop_symbol');
|
|
252
|
+
var isChanged = false;
|
|
253
|
+
if (taxCountryCode !== undefined) {
|
|
254
|
+
var nextTaxCountryCode = String(taxCountryCode || '');
|
|
255
|
+
if (tempOrder.tax_country_code !== nextTaxCountryCode) {
|
|
256
|
+
tempOrder.tax_country_code = nextTaxCountryCode;
|
|
257
|
+
isChanged = true;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (currencyCode !== undefined) {
|
|
261
|
+
var nextCurrencyCode = String(currencyCode || '');
|
|
262
|
+
if (tempOrder.currency_code !== nextCurrencyCode) {
|
|
263
|
+
tempOrder.currency_code = nextCurrencyCode;
|
|
264
|
+
isChanged = true;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (currencySymbol !== undefined) {
|
|
268
|
+
var nextCurrencySymbol = String(currencySymbol || '');
|
|
269
|
+
if (tempOrder.currency_symbol !== nextCurrencySymbol) {
|
|
270
|
+
tempOrder.currency_symbol = nextCurrencySymbol;
|
|
271
|
+
isChanged = true;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return isChanged;
|
|
275
|
+
}
|
|
166
276
|
}, {
|
|
167
277
|
key: "initialize",
|
|
168
278
|
value: function () {
|
|
169
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
170
|
-
var _this$
|
|
279
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(core) {
|
|
280
|
+
var _this$otherParams3,
|
|
171
281
|
_this2 = this;
|
|
172
282
|
var options,
|
|
173
|
-
appPlugin,
|
|
174
283
|
app,
|
|
175
284
|
targetCacheData,
|
|
176
285
|
moduleNames,
|
|
177
|
-
|
|
178
|
-
return _regeneratorRuntime().wrap(function
|
|
179
|
-
while (1) switch (
|
|
286
|
+
_args2 = arguments;
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
288
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
180
289
|
case 0:
|
|
181
|
-
options =
|
|
290
|
+
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
|
|
182
291
|
this.core = core;
|
|
183
292
|
this.initializeOptions = options || {};
|
|
184
293
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
185
294
|
this.otherParams = options.otherParams || {};
|
|
186
|
-
this.cacheId = (_this$
|
|
295
|
+
this.cacheId = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.cacheId;
|
|
187
296
|
this.window = core.getPlugin('window');
|
|
188
297
|
this.request = core.getPlugin('request');
|
|
189
298
|
|
|
190
299
|
// 获取 logger 实例
|
|
191
|
-
appPlugin = core.getPlugin('app');
|
|
192
|
-
if (appPlugin) {
|
|
193
|
-
|
|
300
|
+
this.appPlugin = core.getPlugin('app');
|
|
301
|
+
if (this.appPlugin) {
|
|
302
|
+
_context2.next = 10;
|
|
194
303
|
break;
|
|
195
304
|
}
|
|
196
305
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
197
306
|
case 10:
|
|
198
|
-
app = appPlugin.getApp();
|
|
307
|
+
app = this.appPlugin.getApp();
|
|
199
308
|
this.logger = app.logger;
|
|
200
309
|
targetCacheData = this.readSessionCacheData();
|
|
201
310
|
moduleNames = this.getRegisteredModuleNames();
|
|
@@ -220,20 +329,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
220
329
|
}));
|
|
221
330
|
});
|
|
222
331
|
if (!this.store.schedule) {
|
|
223
|
-
|
|
332
|
+
_context2.next = 18;
|
|
224
333
|
break;
|
|
225
334
|
}
|
|
226
|
-
|
|
335
|
+
_context2.next = 18;
|
|
227
336
|
return this.store.schedule.loadAllSchedule();
|
|
228
337
|
case 18:
|
|
229
338
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
230
339
|
case 19:
|
|
231
340
|
case "end":
|
|
232
|
-
return
|
|
341
|
+
return _context2.stop();
|
|
233
342
|
}
|
|
234
|
-
},
|
|
343
|
+
}, _callee2, this);
|
|
235
344
|
}));
|
|
236
|
-
function initialize(
|
|
345
|
+
function initialize(_x2) {
|
|
237
346
|
return _initialize.apply(this, arguments);
|
|
238
347
|
}
|
|
239
348
|
return initialize;
|
|
@@ -241,10 +350,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
241
350
|
}, {
|
|
242
351
|
key: "destroy",
|
|
243
352
|
value: function () {
|
|
244
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
353
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
245
354
|
var _this3 = this;
|
|
246
|
-
return _regeneratorRuntime().wrap(function
|
|
247
|
-
while (1) switch (
|
|
355
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
356
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
248
357
|
case 0:
|
|
249
358
|
Object.keys(this.store).forEach(function (key) {
|
|
250
359
|
var sub = _this3.store[key];
|
|
@@ -257,15 +366,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
257
366
|
}
|
|
258
367
|
});
|
|
259
368
|
this.currentSalesDetail = null;
|
|
260
|
-
|
|
369
|
+
_context3.next = 4;
|
|
261
370
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
262
371
|
case 4:
|
|
263
372
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
264
373
|
case 5:
|
|
265
374
|
case "end":
|
|
266
|
-
return
|
|
375
|
+
return _context3.stop();
|
|
267
376
|
}
|
|
268
|
-
},
|
|
377
|
+
}, _callee3, this);
|
|
269
378
|
}));
|
|
270
379
|
function destroy() {
|
|
271
380
|
return _destroy.apply(this, arguments);
|
|
@@ -282,13 +391,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
282
391
|
}, {
|
|
283
392
|
key: "loadSalesDetail",
|
|
284
393
|
value: (function () {
|
|
285
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
394
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderIdOrParams) {
|
|
286
395
|
var params, externalSaleNumber, localRecord, _sales, res, message, sales;
|
|
287
|
-
return _regeneratorRuntime().wrap(function
|
|
288
|
-
while (1) switch (
|
|
396
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
397
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
289
398
|
case 0:
|
|
290
399
|
if (this.store.order) {
|
|
291
|
-
|
|
400
|
+
_context4.next = 2;
|
|
292
401
|
break;
|
|
293
402
|
}
|
|
294
403
|
throw new Error('order 模块未初始化');
|
|
@@ -298,107 +407,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
298
407
|
};
|
|
299
408
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
300
409
|
if (params.forceRemote) {
|
|
301
|
-
|
|
410
|
+
_context4.next = 35;
|
|
302
411
|
break;
|
|
303
412
|
}
|
|
304
413
|
if (!(params.orderId !== undefined)) {
|
|
305
|
-
|
|
414
|
+
_context4.next = 11;
|
|
306
415
|
break;
|
|
307
416
|
}
|
|
308
|
-
|
|
417
|
+
_context4.next = 8;
|
|
309
418
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
310
419
|
case 8:
|
|
311
|
-
|
|
312
|
-
|
|
420
|
+
_context4.t0 = _context4.sent;
|
|
421
|
+
_context4.next = 26;
|
|
313
422
|
break;
|
|
314
423
|
case 11:
|
|
315
424
|
if (!externalSaleNumber) {
|
|
316
|
-
|
|
425
|
+
_context4.next = 17;
|
|
317
426
|
break;
|
|
318
427
|
}
|
|
319
|
-
|
|
428
|
+
_context4.next = 14;
|
|
320
429
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
321
430
|
case 14:
|
|
322
|
-
|
|
323
|
-
|
|
431
|
+
_context4.t1 = _context4.sent;
|
|
432
|
+
_context4.next = 25;
|
|
324
433
|
break;
|
|
325
434
|
case 17:
|
|
326
435
|
if (!params.orderNumber) {
|
|
327
|
-
|
|
436
|
+
_context4.next = 23;
|
|
328
437
|
break;
|
|
329
438
|
}
|
|
330
|
-
|
|
439
|
+
_context4.next = 20;
|
|
331
440
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
332
441
|
case 20:
|
|
333
|
-
|
|
334
|
-
|
|
442
|
+
_context4.t2 = _context4.sent;
|
|
443
|
+
_context4.next = 24;
|
|
335
444
|
break;
|
|
336
445
|
case 23:
|
|
337
|
-
|
|
446
|
+
_context4.t2 = null;
|
|
338
447
|
case 24:
|
|
339
|
-
|
|
448
|
+
_context4.t1 = _context4.t2;
|
|
340
449
|
case 25:
|
|
341
|
-
|
|
450
|
+
_context4.t0 = _context4.t1;
|
|
342
451
|
case 26:
|
|
343
|
-
localRecord =
|
|
452
|
+
localRecord = _context4.t0;
|
|
344
453
|
if (!localRecord) {
|
|
345
|
-
|
|
454
|
+
_context4.next = 35;
|
|
346
455
|
break;
|
|
347
456
|
}
|
|
348
|
-
|
|
457
|
+
_context4.next = 30;
|
|
349
458
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
350
459
|
recalcOnHydrate: false
|
|
351
460
|
});
|
|
352
461
|
case 30:
|
|
353
|
-
_sales =
|
|
462
|
+
_sales = _context4.sent;
|
|
354
463
|
this.currentSalesDetail = _sales;
|
|
355
|
-
|
|
464
|
+
_context4.next = 34;
|
|
356
465
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
357
466
|
sales: _sales
|
|
358
467
|
});
|
|
359
468
|
case 34:
|
|
360
|
-
return
|
|
469
|
+
return _context4.abrupt("return", _sales);
|
|
361
470
|
case 35:
|
|
362
471
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
363
|
-
|
|
472
|
+
_context4.next = 37;
|
|
364
473
|
break;
|
|
365
474
|
}
|
|
366
475
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
367
476
|
case 37:
|
|
368
|
-
|
|
477
|
+
_context4.next = 39;
|
|
369
478
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
370
479
|
case 39:
|
|
371
|
-
res =
|
|
480
|
+
res = _context4.sent;
|
|
372
481
|
if (!(!res || res.code !== 200)) {
|
|
373
|
-
|
|
482
|
+
_context4.next = 43;
|
|
374
483
|
break;
|
|
375
484
|
}
|
|
376
485
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
377
486
|
throw new Error(message);
|
|
378
487
|
case 43:
|
|
379
|
-
|
|
488
|
+
_context4.next = 45;
|
|
380
489
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
381
490
|
recalcOnHydrate: false
|
|
382
491
|
});
|
|
383
492
|
case 45:
|
|
384
|
-
sales =
|
|
385
|
-
|
|
493
|
+
sales = _context4.sent;
|
|
494
|
+
_context4.next = 48;
|
|
386
495
|
return this.store.order.saveDraft();
|
|
387
496
|
case 48:
|
|
388
497
|
this.currentSalesDetail = sales;
|
|
389
|
-
|
|
498
|
+
_context4.next = 51;
|
|
390
499
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
391
500
|
sales: sales
|
|
392
501
|
});
|
|
393
502
|
case 51:
|
|
394
|
-
return
|
|
503
|
+
return _context4.abrupt("return", sales);
|
|
395
504
|
case 52:
|
|
396
505
|
case "end":
|
|
397
|
-
return
|
|
506
|
+
return _context4.stop();
|
|
398
507
|
}
|
|
399
|
-
},
|
|
508
|
+
}, _callee4, this);
|
|
400
509
|
}));
|
|
401
|
-
function loadSalesDetail(
|
|
510
|
+
function loadSalesDetail(_x3) {
|
|
402
511
|
return _loadSalesDetail.apply(this, arguments);
|
|
403
512
|
}
|
|
404
513
|
return loadSalesDetail;
|
|
@@ -471,10 +580,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
471
580
|
}, {
|
|
472
581
|
key: "getTempOrder",
|
|
473
582
|
value: function getTempOrder() {
|
|
474
|
-
var _this$store$
|
|
475
|
-
var result = ((_this$store$
|
|
583
|
+
var _this$store$order2;
|
|
584
|
+
var result = ((_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder()) || null;
|
|
476
585
|
return result;
|
|
477
586
|
}
|
|
587
|
+
}, {
|
|
588
|
+
key: "replaceTempOrder",
|
|
589
|
+
value: function () {
|
|
590
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(tempOrder) {
|
|
591
|
+
var nextTempOrder;
|
|
592
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
593
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
594
|
+
case 0:
|
|
595
|
+
if (this.store.order) {
|
|
596
|
+
_context5.next = 2;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
throw new Error('order 模块未初始化');
|
|
600
|
+
case 2:
|
|
601
|
+
_context5.next = 4;
|
|
602
|
+
return this.store.order.replaceTempOrder(tempOrder);
|
|
603
|
+
case 4:
|
|
604
|
+
nextTempOrder = _context5.sent;
|
|
605
|
+
_context5.next = 7;
|
|
606
|
+
return this.effectsEmit('onTempOrderReplaced', {
|
|
607
|
+
tempOrder: nextTempOrder
|
|
608
|
+
});
|
|
609
|
+
case 7:
|
|
610
|
+
return _context5.abrupt("return", nextTempOrder);
|
|
611
|
+
case 8:
|
|
612
|
+
case "end":
|
|
613
|
+
return _context5.stop();
|
|
614
|
+
}
|
|
615
|
+
}, _callee5, this);
|
|
616
|
+
}));
|
|
617
|
+
function replaceTempOrder(_x4) {
|
|
618
|
+
return _replaceTempOrder.apply(this, arguments);
|
|
619
|
+
}
|
|
620
|
+
return replaceTempOrder;
|
|
621
|
+
}()
|
|
478
622
|
}, {
|
|
479
623
|
key: "getOrderIdentity",
|
|
480
624
|
value: function getOrderIdentity() {
|
|
@@ -508,14 +652,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
508
652
|
}, {
|
|
509
653
|
key: "updateTempOrderNote",
|
|
510
654
|
value: function updateTempOrderNote(note) {
|
|
655
|
+
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
511
656
|
try {
|
|
512
657
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
513
|
-
var result = this.store.order.updateTempOrderNote(note);
|
|
658
|
+
var result = this.store.order.updateTempOrderNote(note, sync);
|
|
514
659
|
return result;
|
|
515
660
|
} catch (error) {
|
|
516
661
|
throw error;
|
|
517
662
|
}
|
|
518
663
|
}
|
|
664
|
+
}, {
|
|
665
|
+
key: "updateRemoteOrderNote",
|
|
666
|
+
value: function updateRemoteOrderNote(orderId, note) {
|
|
667
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
668
|
+
this.store.order.syncTempOrderNoteToRemote(orderId, note);
|
|
669
|
+
}
|
|
519
670
|
}, {
|
|
520
671
|
key: "updateTempOrderShopDiscount",
|
|
521
672
|
value: function updateTempOrderShopDiscount(amount) {
|
|
@@ -528,6 +679,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
528
679
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
529
680
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
530
681
|
}
|
|
682
|
+
|
|
683
|
+
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
684
|
+
}, {
|
|
685
|
+
key: "setEnableTempOrderPersist",
|
|
686
|
+
value: function setEnableTempOrderPersist(enabled) {
|
|
687
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
688
|
+
this.store.order.setEnableTempOrderPersist(enabled);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
692
|
+
}, {
|
|
693
|
+
key: "isTempOrderPersistEnabled",
|
|
694
|
+
value: function isTempOrderPersistEnabled() {
|
|
695
|
+
if (!this.store.order) return false;
|
|
696
|
+
return this.store.order.isTempOrderPersistEnabled();
|
|
697
|
+
}
|
|
531
698
|
}, {
|
|
532
699
|
key: "ensureTempOrder",
|
|
533
700
|
value: function ensureTempOrder() {
|
|
@@ -539,32 +706,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
539
706
|
}, {
|
|
540
707
|
key: "addNewOrder",
|
|
541
708
|
value: function () {
|
|
542
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
709
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
543
710
|
var tempOrder;
|
|
544
|
-
return _regeneratorRuntime().wrap(function
|
|
545
|
-
while (1) switch (
|
|
711
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
712
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
546
713
|
case 0:
|
|
547
|
-
|
|
714
|
+
_context6.prev = 0;
|
|
548
715
|
if (this.store.order) {
|
|
549
|
-
|
|
716
|
+
_context6.next = 3;
|
|
550
717
|
break;
|
|
551
718
|
}
|
|
552
719
|
throw new Error('order 模块未初始化');
|
|
553
720
|
case 3:
|
|
554
|
-
|
|
721
|
+
_context6.next = 5;
|
|
555
722
|
return this.store.order.addNewOrder();
|
|
556
723
|
case 5:
|
|
557
|
-
tempOrder =
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
724
|
+
tempOrder = _context6.sent;
|
|
725
|
+
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
726
|
+
_context6.next = 10;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
this.store.order.persistTempOrder();
|
|
730
|
+
_context6.next = 10;
|
|
731
|
+
return this.store.order.saveDraft();
|
|
732
|
+
case 10:
|
|
733
|
+
return _context6.abrupt("return", tempOrder);
|
|
734
|
+
case 13:
|
|
735
|
+
_context6.prev = 13;
|
|
736
|
+
_context6.t0 = _context6["catch"](0);
|
|
737
|
+
throw _context6.t0;
|
|
738
|
+
case 16:
|
|
564
739
|
case "end":
|
|
565
|
-
return
|
|
740
|
+
return _context6.stop();
|
|
566
741
|
}
|
|
567
|
-
},
|
|
742
|
+
}, _callee6, this, [[0, 13]]);
|
|
568
743
|
}));
|
|
569
744
|
function addNewOrder() {
|
|
570
745
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -574,22 +749,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
574
749
|
}, {
|
|
575
750
|
key: "saveDraft",
|
|
576
751
|
value: function () {
|
|
577
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
578
|
-
return _regeneratorRuntime().wrap(function
|
|
579
|
-
while (1) switch (
|
|
752
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
753
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
754
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
580
755
|
case 0:
|
|
581
756
|
if (this.store.order) {
|
|
582
|
-
|
|
757
|
+
_context7.next = 2;
|
|
583
758
|
break;
|
|
584
759
|
}
|
|
585
760
|
throw new Error('order 模块未初始化');
|
|
586
761
|
case 2:
|
|
587
|
-
return
|
|
762
|
+
return _context7.abrupt("return", this.store.order.saveDraft());
|
|
588
763
|
case 3:
|
|
589
764
|
case "end":
|
|
590
|
-
return
|
|
765
|
+
return _context7.stop();
|
|
591
766
|
}
|
|
592
|
-
},
|
|
767
|
+
}, _callee7, this);
|
|
593
768
|
}));
|
|
594
769
|
function saveDraft() {
|
|
595
770
|
return _saveDraft.apply(this, arguments);
|
|
@@ -600,36 +775,113 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
600
775
|
}, {
|
|
601
776
|
key: "restoreOrder",
|
|
602
777
|
value: function () {
|
|
603
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
778
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
604
779
|
var tempOrder;
|
|
605
|
-
return _regeneratorRuntime().wrap(function
|
|
606
|
-
while (1) switch (
|
|
780
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
781
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
607
782
|
case 0:
|
|
608
|
-
|
|
783
|
+
_context8.prev = 0;
|
|
609
784
|
if (this.store.order) {
|
|
610
|
-
|
|
785
|
+
_context8.next = 3;
|
|
611
786
|
break;
|
|
612
787
|
}
|
|
613
788
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
614
789
|
case 3:
|
|
615
790
|
// this.store.resource = null;
|
|
616
791
|
tempOrder = this.store.order.restoreOrder();
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
792
|
+
this.currentSalesDetail = null;
|
|
793
|
+
this.discountConfigCacheKey = null;
|
|
794
|
+
this.hasManualDiscountSelection = false;
|
|
795
|
+
_context8.next = 9;
|
|
796
|
+
return this.effectsEmit('onTempOrderReplaced', {
|
|
797
|
+
tempOrder: tempOrder
|
|
798
|
+
});
|
|
799
|
+
case 9:
|
|
800
|
+
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
801
|
+
_context8.next = 13;
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
this.store.order.persistTempOrder();
|
|
805
|
+
_context8.next = 13;
|
|
806
|
+
return this.store.order.saveDraft();
|
|
807
|
+
case 13:
|
|
808
|
+
return _context8.abrupt("return", tempOrder);
|
|
809
|
+
case 16:
|
|
810
|
+
_context8.prev = 16;
|
|
811
|
+
_context8.t0 = _context8["catch"](0);
|
|
812
|
+
throw _context8.t0;
|
|
813
|
+
case 19:
|
|
623
814
|
case "end":
|
|
624
|
-
return
|
|
815
|
+
return _context8.stop();
|
|
625
816
|
}
|
|
626
|
-
},
|
|
817
|
+
}, _callee8, this, [[0, 16]]);
|
|
627
818
|
}));
|
|
628
819
|
function restoreOrder() {
|
|
629
820
|
return _restoreOrder.apply(this, arguments);
|
|
630
821
|
}
|
|
631
822
|
return restoreOrder;
|
|
632
823
|
}()
|
|
824
|
+
/**
|
|
825
|
+
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
826
|
+
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
827
|
+
*/
|
|
828
|
+
}, {
|
|
829
|
+
key: "clearOrderCartLines",
|
|
830
|
+
value: (function () {
|
|
831
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
832
|
+
var tempOrder;
|
|
833
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
834
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
835
|
+
case 0:
|
|
836
|
+
_context9.prev = 0;
|
|
837
|
+
if (this.store.order) {
|
|
838
|
+
_context9.next = 3;
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
throw new Error('order 模块未初始化');
|
|
842
|
+
case 3:
|
|
843
|
+
_context9.next = 5;
|
|
844
|
+
return this.store.order.clearOrderCartLines();
|
|
845
|
+
case 5:
|
|
846
|
+
tempOrder = _context9.sent;
|
|
847
|
+
if (this.currentSalesDetail) {
|
|
848
|
+
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
849
|
+
products: [],
|
|
850
|
+
bookings: [],
|
|
851
|
+
rootBooking: null,
|
|
852
|
+
bookingsByProductUid: {},
|
|
853
|
+
discount_list: []
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
_context9.next = 9;
|
|
857
|
+
return this.effectsEmit('onTempOrderReplaced', {
|
|
858
|
+
tempOrder: tempOrder
|
|
859
|
+
});
|
|
860
|
+
case 9:
|
|
861
|
+
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
862
|
+
_context9.next = 13;
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
this.store.order.persistTempOrder();
|
|
866
|
+
_context9.next = 13;
|
|
867
|
+
return this.store.order.saveDraft();
|
|
868
|
+
case 13:
|
|
869
|
+
return _context9.abrupt("return", tempOrder);
|
|
870
|
+
case 16:
|
|
871
|
+
_context9.prev = 16;
|
|
872
|
+
_context9.t0 = _context9["catch"](0);
|
|
873
|
+
throw _context9.t0;
|
|
874
|
+
case 19:
|
|
875
|
+
case "end":
|
|
876
|
+
return _context9.stop();
|
|
877
|
+
}
|
|
878
|
+
}, _callee9, this, [[0, 16]]);
|
|
879
|
+
}));
|
|
880
|
+
function clearOrderCartLines() {
|
|
881
|
+
return _clearOrderCartLines.apply(this, arguments);
|
|
882
|
+
}
|
|
883
|
+
return clearOrderCartLines;
|
|
884
|
+
}())
|
|
633
885
|
}, {
|
|
634
886
|
key: "getOrderProducts",
|
|
635
887
|
value: function getOrderProducts() {
|
|
@@ -640,38 +892,385 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
640
892
|
}, {
|
|
641
893
|
key: "getSummary",
|
|
642
894
|
value: function () {
|
|
643
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
895
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
644
896
|
var summary;
|
|
645
|
-
return _regeneratorRuntime().wrap(function
|
|
646
|
-
while (1) switch (
|
|
897
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
898
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
647
899
|
case 0:
|
|
648
|
-
|
|
900
|
+
_context10.prev = 0;
|
|
649
901
|
if (this.store.order) {
|
|
650
|
-
|
|
902
|
+
_context10.next = 3;
|
|
651
903
|
break;
|
|
652
904
|
}
|
|
653
905
|
throw new Error('order 模块未初始化');
|
|
654
906
|
case 3:
|
|
655
|
-
|
|
907
|
+
_context10.next = 5;
|
|
656
908
|
return this.store.order.getOrderSummary();
|
|
657
909
|
case 5:
|
|
658
|
-
summary =
|
|
659
|
-
return
|
|
910
|
+
summary = _context10.sent;
|
|
911
|
+
return _context10.abrupt("return", summary);
|
|
660
912
|
case 9:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
throw
|
|
913
|
+
_context10.prev = 9;
|
|
914
|
+
_context10.t0 = _context10["catch"](0);
|
|
915
|
+
throw _context10.t0;
|
|
664
916
|
case 12:
|
|
665
917
|
case "end":
|
|
666
|
-
return
|
|
918
|
+
return _context10.stop();
|
|
667
919
|
}
|
|
668
|
-
},
|
|
920
|
+
}, _callee10, this, [[0, 9]]);
|
|
669
921
|
}));
|
|
670
922
|
function getSummary() {
|
|
671
923
|
return _getSummary.apply(this, arguments);
|
|
672
924
|
}
|
|
673
925
|
return getSummary;
|
|
674
926
|
}()
|
|
927
|
+
}, {
|
|
928
|
+
key: "getHistoricalProductDiscountList",
|
|
929
|
+
value: function getHistoricalProductDiscountList(products) {
|
|
930
|
+
var _this4 = this;
|
|
931
|
+
var historyDiscountList = [];
|
|
932
|
+
products.forEach(function (item) {
|
|
933
|
+
if (!_this4.isPersistedOrderProduct(item)) return;
|
|
934
|
+
(item.discount_list || []).forEach(function (discount) {
|
|
935
|
+
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
936
|
+
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
937
|
+
if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
|
|
938
|
+
var quantity = item.quantity || item.num || item.product_quantity || 1;
|
|
939
|
+
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);
|
|
940
|
+
var index = historyDiscountList.findIndex(function (n) {
|
|
941
|
+
return n.id === discountId;
|
|
942
|
+
});
|
|
943
|
+
if (index !== -1) {
|
|
944
|
+
historyDiscountList[index] = _objectSpread(_objectSpread({}, historyDiscountList[index]), {}, {
|
|
945
|
+
amount: new Decimal(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
|
|
946
|
+
savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
|
|
947
|
+
});
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
historyDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
951
|
+
id: discountId,
|
|
952
|
+
tag: discount.tag || discount.type,
|
|
953
|
+
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),
|
|
954
|
+
format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
|
|
955
|
+
isEditMode: true,
|
|
956
|
+
limited_relation_product_data: {},
|
|
957
|
+
savedAmount: savedAmount.toNumber(),
|
|
958
|
+
isAvailable: true,
|
|
959
|
+
isDisabled: true,
|
|
960
|
+
isSelected: true,
|
|
961
|
+
product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
|
|
962
|
+
}));
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
return historyDiscountList;
|
|
966
|
+
}
|
|
967
|
+
}, {
|
|
968
|
+
key: "isPersistedOrderProduct",
|
|
969
|
+
value: function isPersistedOrderProduct(product) {
|
|
970
|
+
var _product$order_detail, _product$booking_id;
|
|
971
|
+
var orderDetailId = (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product.orderDetailId;
|
|
972
|
+
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
973
|
+
return true;
|
|
974
|
+
}
|
|
975
|
+
var bookingId = (_product$booking_id = product.booking_id) !== null && _product$booking_id !== void 0 ? _product$booking_id : product.bookingId;
|
|
976
|
+
return bookingId !== undefined && bookingId !== null && bookingId !== '';
|
|
977
|
+
}
|
|
978
|
+
}, {
|
|
979
|
+
key: "mergeHistoricalDiscountList",
|
|
980
|
+
value: function mergeHistoricalDiscountList(discountList, products) {
|
|
981
|
+
var historyDiscountList = this.getHistoricalProductDiscountList(products);
|
|
982
|
+
var historyIds = new Set(historyDiscountList.map(function (discount) {
|
|
983
|
+
return discount.id;
|
|
984
|
+
}));
|
|
985
|
+
return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
|
|
986
|
+
return !historyIds.has(discount.id);
|
|
987
|
+
})));
|
|
988
|
+
}
|
|
989
|
+
}, {
|
|
990
|
+
key: "mergeCurrentDiscountSelectionState",
|
|
991
|
+
value: function mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
|
|
992
|
+
if (!currentDiscountList.length) return discountList;
|
|
993
|
+
var currentDiscountMap = new Map(currentDiscountList.map(function (discount) {
|
|
994
|
+
return [discount.id, discount];
|
|
995
|
+
}));
|
|
996
|
+
return discountList.map(function (discount) {
|
|
997
|
+
var currentDiscount = currentDiscountMap.get(discount.id);
|
|
998
|
+
if (!currentDiscount) return discount;
|
|
999
|
+
if (currentDiscount.isManualSelect) {
|
|
1000
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1001
|
+
isSelected: false,
|
|
1002
|
+
isManualSelect: true
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
if (currentDiscount.isSelected) {
|
|
1006
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1007
|
+
isSelected: true,
|
|
1008
|
+
isManualSelect: false
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
return discount;
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
}, {
|
|
1015
|
+
key: "loadDiscountConfig",
|
|
1016
|
+
value: function () {
|
|
1017
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
1018
|
+
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1019
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata, _tempOrder$_extend3, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1020
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1021
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1022
|
+
case 0:
|
|
1023
|
+
if (this.store.order) {
|
|
1024
|
+
_context11.next = 2;
|
|
1025
|
+
break;
|
|
1026
|
+
}
|
|
1027
|
+
throw new Error('order 模块未初始化');
|
|
1028
|
+
case 2:
|
|
1029
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
1030
|
+
orderStore = this.store.order.store || {};
|
|
1031
|
+
discountModule = orderStore.discount;
|
|
1032
|
+
rulesModule = orderStore.rules;
|
|
1033
|
+
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);
|
|
1034
|
+
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);
|
|
1035
|
+
currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
|
|
1036
|
+
originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
|
|
1037
|
+
hasManualDiscountSelection = this.hasManualDiscountSelection || currentDiscountList.some(function (discount) {
|
|
1038
|
+
return discount.isManualSelect;
|
|
1039
|
+
});
|
|
1040
|
+
discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
|
|
1041
|
+
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
1042
|
+
preparedDiscountList = [];
|
|
1043
|
+
if (!(customerId && customerId !== 1)) {
|
|
1044
|
+
_context11.next = 25;
|
|
1045
|
+
break;
|
|
1046
|
+
}
|
|
1047
|
+
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
1048
|
+
_context11.next = 19;
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
preparedDiscountList = originalDiscountList;
|
|
1052
|
+
_context11.next = 25;
|
|
1053
|
+
break;
|
|
1054
|
+
case 19:
|
|
1055
|
+
_context11.next = 21;
|
|
1056
|
+
return this.store.order.loadDiscountConfig({
|
|
1057
|
+
customerId: customerId,
|
|
1058
|
+
action: discountAction,
|
|
1059
|
+
orderId: Number(orderId) || undefined,
|
|
1060
|
+
apply: false
|
|
1061
|
+
});
|
|
1062
|
+
case 21:
|
|
1063
|
+
preparedDiscountList = _context11.sent;
|
|
1064
|
+
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
1065
|
+
_context11.next = 25;
|
|
1066
|
+
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1067
|
+
case 25:
|
|
1068
|
+
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
1069
|
+
_context11.next = 27;
|
|
1070
|
+
break;
|
|
1071
|
+
}
|
|
1072
|
+
return _context11.abrupt("return", {
|
|
1073
|
+
productList: tempOrder.products || [],
|
|
1074
|
+
discountList: currentDiscountList
|
|
1075
|
+
});
|
|
1076
|
+
case 27:
|
|
1077
|
+
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
1078
|
+
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
1079
|
+
_context11.next = 31;
|
|
1080
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1081
|
+
case 31:
|
|
1082
|
+
if (!rulesModule) {
|
|
1083
|
+
_context11.next = 67;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1087
|
+
form_record_id: tempOrder.holder.form_record_id
|
|
1088
|
+
}] : [];
|
|
1089
|
+
result = rulesModule.calcDiscount({
|
|
1090
|
+
productList: tempOrder.products,
|
|
1091
|
+
discountList: nextDiscountList,
|
|
1092
|
+
holders: holders,
|
|
1093
|
+
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
|
|
1094
|
+
orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
|
|
1095
|
+
}) || {
|
|
1096
|
+
productList: tempOrder.products,
|
|
1097
|
+
discountList: nextDiscountList
|
|
1098
|
+
};
|
|
1099
|
+
if (result.productList) {
|
|
1100
|
+
tempOrder.products = result.productList;
|
|
1101
|
+
}
|
|
1102
|
+
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1103
|
+
_context11.prev = 36;
|
|
1104
|
+
_iterator.s();
|
|
1105
|
+
case 38:
|
|
1106
|
+
if ((_step = _iterator.n()).done) {
|
|
1107
|
+
_context11.next = 53;
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
product = _step.value;
|
|
1111
|
+
productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
1112
|
+
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;
|
|
1113
|
+
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
|
|
1114
|
+
_context11.next = 44;
|
|
1115
|
+
break;
|
|
1116
|
+
}
|
|
1117
|
+
return _context11.abrupt("continue", 51);
|
|
1118
|
+
case 44:
|
|
1119
|
+
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1120
|
+
return sum + Number(pd.amount || 0);
|
|
1121
|
+
}, 0);
|
|
1122
|
+
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
1123
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1124
|
+
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1125
|
+
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1126
|
+
if (product.metadata) {
|
|
1127
|
+
product.metadata.main_product_selling_price = newMainSellingPrice;
|
|
1128
|
+
product.metadata.price_schema_version = 2;
|
|
1129
|
+
}
|
|
1130
|
+
product.selling_price = composeLinePrice({
|
|
1131
|
+
mainPrice: newMainSellingPrice,
|
|
1132
|
+
bundle: product.product_bundle
|
|
1133
|
+
});
|
|
1134
|
+
case 51:
|
|
1135
|
+
_context11.next = 38;
|
|
1136
|
+
break;
|
|
1137
|
+
case 53:
|
|
1138
|
+
_context11.next = 58;
|
|
1139
|
+
break;
|
|
1140
|
+
case 55:
|
|
1141
|
+
_context11.prev = 55;
|
|
1142
|
+
_context11.t0 = _context11["catch"](36);
|
|
1143
|
+
_iterator.e(_context11.t0);
|
|
1144
|
+
case 58:
|
|
1145
|
+
_context11.prev = 58;
|
|
1146
|
+
_iterator.f();
|
|
1147
|
+
return _context11.finish(58);
|
|
1148
|
+
case 61:
|
|
1149
|
+
if (!result.discountList) {
|
|
1150
|
+
_context11.next = 67;
|
|
1151
|
+
break;
|
|
1152
|
+
}
|
|
1153
|
+
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1154
|
+
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1155
|
+
_context11.next = 66;
|
|
1156
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1157
|
+
case 66:
|
|
1158
|
+
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1159
|
+
return discount.isSelected;
|
|
1160
|
+
});
|
|
1161
|
+
case 67:
|
|
1162
|
+
_context11.next = 69;
|
|
1163
|
+
return this.store.order.recalculateSummary({
|
|
1164
|
+
createIfMissing: true
|
|
1165
|
+
});
|
|
1166
|
+
case 69:
|
|
1167
|
+
summary = _context11.sent;
|
|
1168
|
+
this.store.order.persistTempOrder();
|
|
1169
|
+
_context11.next = 73;
|
|
1170
|
+
return this.effectsEmit('onDiscountApplied', {
|
|
1171
|
+
productList: tempOrder.products || [],
|
|
1172
|
+
discountList: nextDiscountList,
|
|
1173
|
+
selectedDiscountList: tempOrder.discount_list || [],
|
|
1174
|
+
tempOrder: tempOrder
|
|
1175
|
+
});
|
|
1176
|
+
case 73:
|
|
1177
|
+
return _context11.abrupt("return", {
|
|
1178
|
+
productList: tempOrder.products || [],
|
|
1179
|
+
discountList: nextDiscountList
|
|
1180
|
+
});
|
|
1181
|
+
case 74:
|
|
1182
|
+
case "end":
|
|
1183
|
+
return _context11.stop();
|
|
1184
|
+
}
|
|
1185
|
+
}, _callee11, this, [[36, 55, 58, 61]]);
|
|
1186
|
+
}));
|
|
1187
|
+
function loadDiscountConfig(_x5) {
|
|
1188
|
+
return _loadDiscountConfig.apply(this, arguments);
|
|
1189
|
+
}
|
|
1190
|
+
return loadDiscountConfig;
|
|
1191
|
+
}()
|
|
1192
|
+
}, {
|
|
1193
|
+
key: "bestDiscount",
|
|
1194
|
+
value: function () {
|
|
1195
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cb) {
|
|
1196
|
+
var _discountModule$getOr2, _discountModule$getDi3;
|
|
1197
|
+
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
|
|
1198
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1199
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1200
|
+
case 0:
|
|
1201
|
+
if (this.store.order) {
|
|
1202
|
+
_context12.next = 2;
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
throw new Error('order 模块未初始化');
|
|
1206
|
+
case 2:
|
|
1207
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
1208
|
+
orderStore = this.store.order.store || {};
|
|
1209
|
+
discountModule = orderStore.discount;
|
|
1210
|
+
rulesModule = orderStore.rules;
|
|
1211
|
+
originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr2 = discountModule.getOriginalDiscountList) === null || _discountModule$getOr2 === void 0 ? void 0 : _discountModule$getOr2.call(discountModule)) || this.getDiscountList();
|
|
1212
|
+
currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi3 = discountModule.getDiscountList) === null || _discountModule$getDi3 === void 0 ? void 0 : _discountModule$getDi3.call(discountModule)) || [];
|
|
1213
|
+
nextDiscountList = this.mergeHistoricalDiscountList(originalDiscountList || [], tempOrder.products || []);
|
|
1214
|
+
result = {
|
|
1215
|
+
productList: tempOrder.products || [],
|
|
1216
|
+
discountList: nextDiscountList
|
|
1217
|
+
};
|
|
1218
|
+
_context12.next = 12;
|
|
1219
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1220
|
+
case 12:
|
|
1221
|
+
if (!rulesModule) {
|
|
1222
|
+
_context12.next = 23;
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
|
|
1226
|
+
form_record_id: tempOrder.holder.form_record_id
|
|
1227
|
+
}] : [];
|
|
1228
|
+
result = rulesModule.calcDiscount({
|
|
1229
|
+
productList: tempOrder.products,
|
|
1230
|
+
discountList: nextDiscountList,
|
|
1231
|
+
holders: holders,
|
|
1232
|
+
isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
|
|
1233
|
+
orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
|
|
1234
|
+
}) || result;
|
|
1235
|
+
if (result.productList) {
|
|
1236
|
+
tempOrder.products = result.productList;
|
|
1237
|
+
}
|
|
1238
|
+
if (!result.discountList) {
|
|
1239
|
+
_context12.next = 23;
|
|
1240
|
+
break;
|
|
1241
|
+
}
|
|
1242
|
+
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1243
|
+
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1244
|
+
_context12.next = 21;
|
|
1245
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1246
|
+
case 21:
|
|
1247
|
+
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1248
|
+
return discount.isSelected;
|
|
1249
|
+
});
|
|
1250
|
+
result = {
|
|
1251
|
+
productList: tempOrder.products,
|
|
1252
|
+
discountList: nextDiscountList
|
|
1253
|
+
};
|
|
1254
|
+
case 23:
|
|
1255
|
+
_context12.next = 25;
|
|
1256
|
+
return this.store.order.recalculateSummary({
|
|
1257
|
+
createIfMissing: true
|
|
1258
|
+
});
|
|
1259
|
+
case 25:
|
|
1260
|
+
this.store.order.persistTempOrder();
|
|
1261
|
+
cb === null || cb === void 0 || cb(result);
|
|
1262
|
+
return _context12.abrupt("return", result);
|
|
1263
|
+
case 28:
|
|
1264
|
+
case "end":
|
|
1265
|
+
return _context12.stop();
|
|
1266
|
+
}
|
|
1267
|
+
}, _callee12, this);
|
|
1268
|
+
}));
|
|
1269
|
+
function bestDiscount(_x6) {
|
|
1270
|
+
return _bestDiscount.apply(this, arguments);
|
|
1271
|
+
}
|
|
1272
|
+
return bestDiscount;
|
|
1273
|
+
}()
|
|
675
1274
|
}, {
|
|
676
1275
|
key: "getDiscountList",
|
|
677
1276
|
value: function getDiscountList() {
|
|
@@ -681,49 +1280,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
681
1280
|
}, {
|
|
682
1281
|
key: "scanPromotionCode",
|
|
683
1282
|
value: function () {
|
|
684
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1283
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(code, customerId) {
|
|
685
1284
|
var raw;
|
|
686
|
-
return _regeneratorRuntime().wrap(function
|
|
687
|
-
while (1) switch (
|
|
1285
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1286
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
688
1287
|
case 0:
|
|
689
|
-
|
|
1288
|
+
_context13.prev = 0;
|
|
690
1289
|
if (this.store.order) {
|
|
691
|
-
|
|
1290
|
+
_context13.next = 3;
|
|
692
1291
|
break;
|
|
693
1292
|
}
|
|
694
1293
|
throw new Error('order 模块未初始化');
|
|
695
1294
|
case 3:
|
|
696
|
-
|
|
1295
|
+
_context13.next = 5;
|
|
697
1296
|
return this.store.order.scanCode(code, customerId);
|
|
698
1297
|
case 5:
|
|
699
|
-
raw =
|
|
1298
|
+
raw = _context13.sent;
|
|
700
1299
|
if (!raw.isAvailable) {
|
|
701
|
-
|
|
1300
|
+
_context13.next = 10;
|
|
702
1301
|
break;
|
|
703
1302
|
}
|
|
704
|
-
|
|
1303
|
+
_context13.next = 9;
|
|
705
1304
|
return this.store.order.recalculateSummary({
|
|
706
1305
|
createIfMissing: true
|
|
707
1306
|
});
|
|
708
1307
|
case 9:
|
|
709
1308
|
this.store.order.persistTempOrder();
|
|
710
1309
|
case 10:
|
|
711
|
-
return
|
|
1310
|
+
return _context13.abrupt("return", {
|
|
712
1311
|
isAvailable: raw.isAvailable,
|
|
713
1312
|
type: raw.type,
|
|
714
1313
|
unavailableReason: raw.unavailableReason
|
|
715
1314
|
});
|
|
716
1315
|
case 13:
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
throw
|
|
1316
|
+
_context13.prev = 13;
|
|
1317
|
+
_context13.t0 = _context13["catch"](0);
|
|
1318
|
+
throw _context13.t0;
|
|
720
1319
|
case 16:
|
|
721
1320
|
case "end":
|
|
722
|
-
return
|
|
1321
|
+
return _context13.stop();
|
|
723
1322
|
}
|
|
724
|
-
},
|
|
1323
|
+
}, _callee13, this, [[0, 13]]);
|
|
725
1324
|
}));
|
|
726
|
-
function scanPromotionCode(
|
|
1325
|
+
function scanPromotionCode(_x7, _x8) {
|
|
727
1326
|
return _scanPromotionCode.apply(this, arguments);
|
|
728
1327
|
}
|
|
729
1328
|
return scanPromotionCode;
|
|
@@ -731,14 +1330,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
731
1330
|
}, {
|
|
732
1331
|
key: "setDiscountSelected",
|
|
733
1332
|
value: function () {
|
|
734
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
735
|
-
var _tempOrder$
|
|
736
|
-
return _regeneratorRuntime().wrap(function
|
|
737
|
-
while (1) switch (
|
|
1333
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1334
|
+
var _tempOrder$holder5, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder6, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, _iterator3, _step3, _product$metadata5, _tempOrder$_extend4, _product$metadata6, _product$metadata$sou2, _product$metadata7, _product$metadata8, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1335
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1336
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
738
1337
|
case 0:
|
|
739
|
-
|
|
1338
|
+
_context14.prev = 0;
|
|
740
1339
|
if (this.store.order) {
|
|
741
|
-
|
|
1340
|
+
_context14.next = 3;
|
|
742
1341
|
break;
|
|
743
1342
|
}
|
|
744
1343
|
throw new Error('order 模块未初始化');
|
|
@@ -750,23 +1349,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
750
1349
|
isManualSelect: !params.isSelected
|
|
751
1350
|
}) : d;
|
|
752
1351
|
});
|
|
1352
|
+
this.hasManualDiscountSelection = true;
|
|
753
1353
|
tempOrder = this.store.order.ensureTempOrder();
|
|
754
1354
|
orderStore = this.store.order.store || {};
|
|
755
1355
|
discountModule = orderStore.discount;
|
|
756
1356
|
rulesModule = orderStore.rules;
|
|
757
|
-
holders = (_tempOrder$
|
|
1357
|
+
holders = (_tempOrder$holder5 = tempOrder.holder) !== null && _tempOrder$holder5 !== void 0 && _tempOrder$holder5.form_record_id ? [{
|
|
758
1358
|
form_record_id: tempOrder.holder.form_record_id
|
|
759
1359
|
}] : [];
|
|
760
1360
|
nextDiscountList = updated;
|
|
761
|
-
|
|
1361
|
+
_context14.next = 14;
|
|
762
1362
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
763
|
-
case
|
|
1363
|
+
case 14:
|
|
764
1364
|
if (rulesModule) {
|
|
765
1365
|
result = rulesModule.calcDiscount({
|
|
766
1366
|
productList: tempOrder.products,
|
|
767
1367
|
discountList: updated,
|
|
768
1368
|
holders: holders,
|
|
769
|
-
isFormSubject: !!((_tempOrder$
|
|
1369
|
+
isFormSubject: !!((_tempOrder$holder6 = tempOrder.holder) !== null && _tempOrder$holder6 !== void 0 && _tempOrder$holder6.type) && tempOrder.holder.type === 'form'
|
|
770
1370
|
}, {
|
|
771
1371
|
discountId: params.discountId,
|
|
772
1372
|
isSelected: params.isSelected
|
|
@@ -785,18 +1385,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
785
1385
|
}).map(function (d) {
|
|
786
1386
|
return d.id;
|
|
787
1387
|
}));
|
|
788
|
-
|
|
1388
|
+
_iterator2 = _createForOfIteratorHelper(nextDiscountList);
|
|
789
1389
|
try {
|
|
790
|
-
for (
|
|
791
|
-
d =
|
|
1390
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1391
|
+
d = _step2.value;
|
|
792
1392
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
793
1393
|
d.isSelected = false;
|
|
1394
|
+
d.isManualSelect = true;
|
|
794
1395
|
}
|
|
795
1396
|
}
|
|
796
1397
|
} catch (err) {
|
|
797
|
-
|
|
1398
|
+
_iterator2.e(err);
|
|
798
1399
|
} finally {
|
|
799
|
-
|
|
1400
|
+
_iterator2.f();
|
|
800
1401
|
}
|
|
801
1402
|
}
|
|
802
1403
|
}
|
|
@@ -806,23 +1407,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
806
1407
|
}).map(function (d) {
|
|
807
1408
|
return d.id;
|
|
808
1409
|
}));
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
case
|
|
813
|
-
if ((
|
|
814
|
-
|
|
1410
|
+
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1411
|
+
_context14.prev = 17;
|
|
1412
|
+
_iterator3.s();
|
|
1413
|
+
case 19:
|
|
1414
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
1415
|
+
_context14.next = 35;
|
|
815
1416
|
break;
|
|
816
1417
|
}
|
|
817
|
-
product =
|
|
818
|
-
productUid = (_product$
|
|
819
|
-
runtimeOrigin = productUid ? (_tempOrder$
|
|
820
|
-
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$
|
|
821
|
-
|
|
1418
|
+
product = _step3.value;
|
|
1419
|
+
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
1420
|
+
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
1421
|
+
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.is_manual_discount)) {
|
|
1422
|
+
_context14.next = 25;
|
|
822
1423
|
break;
|
|
823
1424
|
}
|
|
824
|
-
return
|
|
825
|
-
case
|
|
1425
|
+
return _context14.abrupt("continue", 33);
|
|
1426
|
+
case 25:
|
|
826
1427
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
827
1428
|
var _pd$discount$resource, _pd$discount;
|
|
828
1429
|
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
@@ -835,7 +1436,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
835
1436
|
return sum + (pd.amount || 0);
|
|
836
1437
|
}, 0); // TODO 这块逻辑需要拿掉
|
|
837
1438
|
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
838
|
-
sourcePrice = (_product$metadata$
|
|
1439
|
+
sourcePrice = (_product$metadata$sou2 = (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.source_product_price) !== null && _product$metadata$sou2 !== void 0 ? _product$metadata$sou2 : ((_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri2 = product.original_price) !== null && _product$original_pri2 !== void 0 ? _product$original_pri2 : '0';
|
|
839
1440
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
840
1441
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
841
1442
|
if (product.metadata) {
|
|
@@ -846,66 +1447,134 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
846
1447
|
mainPrice: newMainSellingPrice,
|
|
847
1448
|
bundle: product.product_bundle
|
|
848
1449
|
});
|
|
849
|
-
case
|
|
850
|
-
|
|
1450
|
+
case 33:
|
|
1451
|
+
_context14.next = 19;
|
|
851
1452
|
break;
|
|
852
|
-
case
|
|
853
|
-
|
|
1453
|
+
case 35:
|
|
1454
|
+
_context14.next = 40;
|
|
854
1455
|
break;
|
|
855
|
-
case
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
case
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return
|
|
863
|
-
case
|
|
1456
|
+
case 37:
|
|
1457
|
+
_context14.prev = 37;
|
|
1458
|
+
_context14.t0 = _context14["catch"](17);
|
|
1459
|
+
_iterator3.e(_context14.t0);
|
|
1460
|
+
case 40:
|
|
1461
|
+
_context14.prev = 40;
|
|
1462
|
+
_iterator3.f();
|
|
1463
|
+
return _context14.finish(40);
|
|
1464
|
+
case 43:
|
|
864
1465
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
865
|
-
|
|
1466
|
+
_context14.next = 46;
|
|
866
1467
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
867
|
-
case
|
|
1468
|
+
case 46:
|
|
868
1469
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
869
1470
|
return d.isSelected;
|
|
870
1471
|
});
|
|
871
|
-
|
|
1472
|
+
_context14.next = 49;
|
|
872
1473
|
return this.store.order.recalculateSummary({
|
|
873
1474
|
createIfMissing: true
|
|
874
1475
|
});
|
|
875
|
-
case
|
|
1476
|
+
case 49:
|
|
876
1477
|
this.store.order.persistTempOrder();
|
|
877
|
-
|
|
1478
|
+
this.effectsEmit('onDiscountApplied', {
|
|
1479
|
+
productList: tempOrder.products,
|
|
1480
|
+
discountList: nextDiscountList,
|
|
1481
|
+
selectedDiscountList: tempOrder.discount_list,
|
|
1482
|
+
tempOrder: tempOrder
|
|
1483
|
+
});
|
|
1484
|
+
_context14.next = 56;
|
|
878
1485
|
break;
|
|
879
|
-
case
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
throw
|
|
883
|
-
case
|
|
1486
|
+
case 53:
|
|
1487
|
+
_context14.prev = 53;
|
|
1488
|
+
_context14.t1 = _context14["catch"](0);
|
|
1489
|
+
throw _context14.t1;
|
|
1490
|
+
case 56:
|
|
884
1491
|
case "end":
|
|
885
|
-
return
|
|
1492
|
+
return _context14.stop();
|
|
886
1493
|
}
|
|
887
|
-
},
|
|
1494
|
+
}, _callee14, this, [[0, 53], [17, 37, 40, 43]]);
|
|
888
1495
|
}));
|
|
889
|
-
function setDiscountSelected(
|
|
1496
|
+
function setDiscountSelected(_x9) {
|
|
890
1497
|
return _setDiscountSelected.apply(this, arguments);
|
|
891
1498
|
}
|
|
892
1499
|
return setDiscountSelected;
|
|
893
1500
|
}()
|
|
1501
|
+
}, {
|
|
1502
|
+
key: "applyDiscountCalculationResult",
|
|
1503
|
+
value: function () {
|
|
1504
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(result) {
|
|
1505
|
+
var tempOrder, orderStore, discountModule;
|
|
1506
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1507
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1508
|
+
case 0:
|
|
1509
|
+
_context15.prev = 0;
|
|
1510
|
+
if (this.store.order) {
|
|
1511
|
+
_context15.next = 3;
|
|
1512
|
+
break;
|
|
1513
|
+
}
|
|
1514
|
+
throw new Error('order 模块未初始化');
|
|
1515
|
+
case 3:
|
|
1516
|
+
if (result) {
|
|
1517
|
+
_context15.next = 5;
|
|
1518
|
+
break;
|
|
1519
|
+
}
|
|
1520
|
+
return _context15.abrupt("return");
|
|
1521
|
+
case 5:
|
|
1522
|
+
tempOrder = this.store.order.ensureTempOrder();
|
|
1523
|
+
orderStore = this.store.order.store || {};
|
|
1524
|
+
discountModule = orderStore.discount;
|
|
1525
|
+
if (result.productList) {
|
|
1526
|
+
tempOrder.products = result.productList;
|
|
1527
|
+
}
|
|
1528
|
+
if (!result.discountList) {
|
|
1529
|
+
_context15.next = 14;
|
|
1530
|
+
break;
|
|
1531
|
+
}
|
|
1532
|
+
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
1533
|
+
_context15.next = 13;
|
|
1534
|
+
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
1535
|
+
case 13:
|
|
1536
|
+
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
1537
|
+
return discount.isSelected;
|
|
1538
|
+
});
|
|
1539
|
+
case 14:
|
|
1540
|
+
_context15.next = 16;
|
|
1541
|
+
return this.store.order.recalculateSummary({
|
|
1542
|
+
createIfMissing: true
|
|
1543
|
+
});
|
|
1544
|
+
case 16:
|
|
1545
|
+
this.store.order.persistTempOrder();
|
|
1546
|
+
_context15.next = 22;
|
|
1547
|
+
break;
|
|
1548
|
+
case 19:
|
|
1549
|
+
_context15.prev = 19;
|
|
1550
|
+
_context15.t0 = _context15["catch"](0);
|
|
1551
|
+
throw _context15.t0;
|
|
1552
|
+
case 22:
|
|
1553
|
+
case "end":
|
|
1554
|
+
return _context15.stop();
|
|
1555
|
+
}
|
|
1556
|
+
}, _callee15, this, [[0, 19]]);
|
|
1557
|
+
}));
|
|
1558
|
+
function applyDiscountCalculationResult(_x10) {
|
|
1559
|
+
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
1560
|
+
}
|
|
1561
|
+
return applyDiscountCalculationResult;
|
|
1562
|
+
}()
|
|
894
1563
|
}, {
|
|
895
1564
|
key: "submitScanOrder",
|
|
896
1565
|
value: function () {
|
|
897
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
898
|
-
return _regeneratorRuntime().wrap(function
|
|
899
|
-
while (1) switch (
|
|
1566
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1567
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1568
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
900
1569
|
case 0:
|
|
901
|
-
return
|
|
1570
|
+
return _context16.abrupt("return", this.submitSalesOrder(params));
|
|
902
1571
|
case 1:
|
|
903
1572
|
case "end":
|
|
904
|
-
return
|
|
1573
|
+
return _context16.stop();
|
|
905
1574
|
}
|
|
906
|
-
},
|
|
1575
|
+
}, _callee16, this);
|
|
907
1576
|
}));
|
|
908
|
-
function submitScanOrder(
|
|
1577
|
+
function submitScanOrder(_x11) {
|
|
909
1578
|
return _submitScanOrder.apply(this, arguments);
|
|
910
1579
|
}
|
|
911
1580
|
return submitScanOrder;
|
|
@@ -919,14 +1588,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
919
1588
|
}, {
|
|
920
1589
|
key: "submitSalesOrder",
|
|
921
1590
|
value: (function () {
|
|
922
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
923
|
-
var _this$
|
|
1591
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1592
|
+
var _this$otherParams4, _this$otherParams5, _this$otherParams6;
|
|
924
1593
|
var submitParams;
|
|
925
|
-
return _regeneratorRuntime().wrap(function
|
|
926
|
-
while (1) switch (
|
|
1594
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1595
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
927
1596
|
case 0:
|
|
928
1597
|
if (this.store.order) {
|
|
929
|
-
|
|
1598
|
+
_context17.next = 2;
|
|
930
1599
|
break;
|
|
931
1600
|
}
|
|
932
1601
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -934,10 +1603,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
934
1603
|
this.store.order.persistTempOrder();
|
|
935
1604
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
936
1605
|
cacheId: this.cacheId,
|
|
937
|
-
platform: (_this$
|
|
938
|
-
businessCode: (_this$
|
|
939
|
-
channel:
|
|
940
|
-
type: (_this$
|
|
1606
|
+
platform: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform,
|
|
1607
|
+
businessCode: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode,
|
|
1608
|
+
channel: this.getSubmitOrderSalesChannel(),
|
|
1609
|
+
type: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.type
|
|
941
1610
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
942
1611
|
payments: params.payments
|
|
943
1612
|
} : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
|
|
@@ -947,14 +1616,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
947
1616
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
948
1617
|
enhancePayload: params.enhancePayload
|
|
949
1618
|
} : {});
|
|
950
|
-
|
|
951
|
-
|
|
1619
|
+
console.log(submitParams, 'submitParams123');
|
|
1620
|
+
return _context17.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
1621
|
+
case 6:
|
|
952
1622
|
case "end":
|
|
953
|
-
return
|
|
1623
|
+
return _context17.stop();
|
|
954
1624
|
}
|
|
955
|
-
},
|
|
1625
|
+
}, _callee17, this);
|
|
956
1626
|
}));
|
|
957
|
-
function submitSalesOrder(
|
|
1627
|
+
function submitSalesOrder(_x12) {
|
|
958
1628
|
return _submitSalesOrder.apply(this, arguments);
|
|
959
1629
|
}
|
|
960
1630
|
return submitSalesOrder;
|
|
@@ -962,24 +1632,75 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
962
1632
|
}, {
|
|
963
1633
|
key: "syncPaymentsToOrder",
|
|
964
1634
|
value: function () {
|
|
965
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
966
|
-
|
|
967
|
-
|
|
1635
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
|
|
1636
|
+
var _params$channel;
|
|
1637
|
+
var channel, syncParams, syncState, payments, syncResult;
|
|
1638
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1639
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
968
1640
|
case 0:
|
|
969
1641
|
if (this.store.order) {
|
|
970
|
-
|
|
1642
|
+
_context18.next = 2;
|
|
971
1643
|
break;
|
|
972
1644
|
}
|
|
973
1645
|
throw new Error('order 模块未初始化');
|
|
974
1646
|
case 2:
|
|
975
|
-
|
|
976
|
-
|
|
1647
|
+
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
1648
|
+
syncParams = _objectSpread(_objectSpread({}, params), channel !== undefined ? {
|
|
1649
|
+
channel: channel
|
|
1650
|
+
} : {});
|
|
1651
|
+
syncState = this.store.order.getOrderSyncState();
|
|
1652
|
+
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1653
|
+
_context18.next = 7;
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
return _context18.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1657
|
+
case 7:
|
|
1658
|
+
payments = params.payments || [];
|
|
1659
|
+
_context18.next = 10;
|
|
1660
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1661
|
+
payments: payments,
|
|
1662
|
+
params: syncParams,
|
|
1663
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1664
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1665
|
+
});
|
|
1666
|
+
case 10:
|
|
1667
|
+
_context18.prev = 10;
|
|
1668
|
+
_context18.next = 13;
|
|
1669
|
+
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1670
|
+
case 13:
|
|
1671
|
+
syncResult = _context18.sent;
|
|
1672
|
+
_context18.next = 16;
|
|
1673
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1674
|
+
ok: true,
|
|
1675
|
+
syncResult: syncResult,
|
|
1676
|
+
payments: this.store.order.getOrderPayments(),
|
|
1677
|
+
params: syncParams,
|
|
1678
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1679
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1680
|
+
});
|
|
1681
|
+
case 16:
|
|
1682
|
+
return _context18.abrupt("return", syncResult);
|
|
1683
|
+
case 19:
|
|
1684
|
+
_context18.prev = 19;
|
|
1685
|
+
_context18.t0 = _context18["catch"](10);
|
|
1686
|
+
_context18.next = 23;
|
|
1687
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1688
|
+
ok: false,
|
|
1689
|
+
error: _context18.t0,
|
|
1690
|
+
payments: this.store.order.getOrderPayments(),
|
|
1691
|
+
params: syncParams,
|
|
1692
|
+
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1693
|
+
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1694
|
+
});
|
|
1695
|
+
case 23:
|
|
1696
|
+
throw _context18.t0;
|
|
1697
|
+
case 24:
|
|
977
1698
|
case "end":
|
|
978
|
-
return
|
|
1699
|
+
return _context18.stop();
|
|
979
1700
|
}
|
|
980
|
-
},
|
|
1701
|
+
}, _callee18, this, [[10, 19]]);
|
|
981
1702
|
}));
|
|
982
|
-
function syncPaymentsToOrder(
|
|
1703
|
+
function syncPaymentsToOrder(_x13) {
|
|
983
1704
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
984
1705
|
}
|
|
985
1706
|
return syncPaymentsToOrder;
|
|
@@ -1003,8 +1724,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1003
1724
|
}, {
|
|
1004
1725
|
key: "addOrderPayment",
|
|
1005
1726
|
value: function addOrderPayment(payment) {
|
|
1727
|
+
var _this5 = this;
|
|
1006
1728
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1007
|
-
|
|
1729
|
+
var payments = this.store.order.addOrderPayment(payment);
|
|
1730
|
+
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
1731
|
+
var syncState = this.store.order.getOrderSyncState();
|
|
1732
|
+
if (amountSnapshot && syncState !== 'submitting') {
|
|
1733
|
+
var paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? 'paid' : 'partially_paid';
|
|
1734
|
+
void this.syncPaymentsToOrder({
|
|
1735
|
+
payments: payments,
|
|
1736
|
+
paymentStatus: paymentStatus,
|
|
1737
|
+
submitWhenPaid: true,
|
|
1738
|
+
smallTicketDataFlag: 1
|
|
1739
|
+
}).catch(function (error) {
|
|
1740
|
+
_this5.logError('auto sync payments failed', {
|
|
1741
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1742
|
+
});
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
return payments;
|
|
1008
1746
|
}
|
|
1009
1747
|
|
|
1010
1748
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -1033,8 +1771,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1033
1771
|
}, {
|
|
1034
1772
|
key: "getWalletProductList",
|
|
1035
1773
|
value: function getWalletProductList() {
|
|
1036
|
-
var _this$store$
|
|
1037
|
-
var tempOrder = (_this$store$
|
|
1774
|
+
var _this$store$order3, _tempOrder$products;
|
|
1775
|
+
var tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder();
|
|
1038
1776
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1039
1777
|
return tempOrder.products.map(function (product) {
|
|
1040
1778
|
var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
@@ -1047,6 +1785,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1047
1785
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
1048
1786
|
tax_fee: product.tax_fee,
|
|
1049
1787
|
selling_price: Number(product.selling_price || 0),
|
|
1788
|
+
discount_list: product.discount_list || [],
|
|
1050
1789
|
holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
|
|
1051
1790
|
original_price: product.original_price,
|
|
1052
1791
|
main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
|
|
@@ -1057,11 +1796,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1057
1796
|
surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
|
|
1058
1797
|
},
|
|
1059
1798
|
product_bundle: (product.product_bundle || []).map(function (bundle) {
|
|
1799
|
+
var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
|
|
1060
1800
|
var bundleMetadata = bundle.metadata || {};
|
|
1061
1801
|
return {
|
|
1062
1802
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
1063
|
-
|
|
1064
|
-
|
|
1803
|
+
// 套餐子项在 tempOrder 上常为 id(如 1718),prepare/deduction 协议要求 bundle_id
|
|
1804
|
+
bundle_id: (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id,
|
|
1805
|
+
bundle_product_id: (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id,
|
|
1806
|
+
bundle_group_id: (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id,
|
|
1065
1807
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
1066
1808
|
price_type: bundle.price_type,
|
|
1067
1809
|
price_type_ext: bundle.price_type_ext,
|
|
@@ -1082,20 +1824,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1082
1824
|
}, {
|
|
1083
1825
|
key: "initWalletData",
|
|
1084
1826
|
value: function () {
|
|
1085
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1827
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1086
1828
|
var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
|
|
1087
1829
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
1088
|
-
return _regeneratorRuntime().wrap(function
|
|
1089
|
-
while (1) switch (
|
|
1830
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1831
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1090
1832
|
case 0:
|
|
1091
1833
|
if (this.store.order) {
|
|
1092
|
-
|
|
1834
|
+
_context19.next = 2;
|
|
1093
1835
|
break;
|
|
1094
1836
|
}
|
|
1095
1837
|
throw new Error('order 模块未初始化');
|
|
1096
1838
|
case 2:
|
|
1097
1839
|
if (this.store.payment) {
|
|
1098
|
-
|
|
1840
|
+
_context19.next = 4;
|
|
1099
1841
|
break;
|
|
1100
1842
|
}
|
|
1101
1843
|
throw new Error('payment 模块未初始化');
|
|
@@ -1104,10 +1846,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1104
1846
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
1105
1847
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
1106
1848
|
if (!(!tempOrder || !amount)) {
|
|
1107
|
-
|
|
1849
|
+
_context19.next = 9;
|
|
1108
1850
|
break;
|
|
1109
1851
|
}
|
|
1110
|
-
return
|
|
1852
|
+
return _context19.abrupt("return", {
|
|
1111
1853
|
walletRecommendList: [],
|
|
1112
1854
|
userIdentificationCodes: [],
|
|
1113
1855
|
transformList: [],
|
|
@@ -1130,11 +1872,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1130
1872
|
}, snapshot.identity.orderId ? {
|
|
1131
1873
|
payment_order_id: String(snapshot.identity.orderId)
|
|
1132
1874
|
} : {});
|
|
1133
|
-
|
|
1875
|
+
_context19.next = 12;
|
|
1134
1876
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
1135
1877
|
case 12:
|
|
1136
|
-
result =
|
|
1137
|
-
|
|
1878
|
+
result = _context19.sent;
|
|
1879
|
+
_context19.next = 15;
|
|
1138
1880
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
1139
1881
|
orderId: snapshot.identity.orderId,
|
|
1140
1882
|
customerId: walletBusinessData.customer_id,
|
|
@@ -1146,14 +1888,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1146
1888
|
timestamp: Date.now()
|
|
1147
1889
|
});
|
|
1148
1890
|
case 15:
|
|
1149
|
-
return
|
|
1891
|
+
return _context19.abrupt("return", result);
|
|
1150
1892
|
case 16:
|
|
1151
1893
|
case "end":
|
|
1152
|
-
return
|
|
1894
|
+
return _context19.stop();
|
|
1153
1895
|
}
|
|
1154
|
-
},
|
|
1896
|
+
}, _callee19, this);
|
|
1155
1897
|
}));
|
|
1156
|
-
function initWalletData(
|
|
1898
|
+
function initWalletData(_x14) {
|
|
1157
1899
|
return _initWalletData.apply(this, arguments);
|
|
1158
1900
|
}
|
|
1159
1901
|
return initWalletData;
|
|
@@ -1180,27 +1922,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1180
1922
|
}, {
|
|
1181
1923
|
key: "getPaymentMethodsAsync",
|
|
1182
1924
|
value: (function () {
|
|
1183
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1925
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1184
1926
|
var response;
|
|
1185
|
-
return _regeneratorRuntime().wrap(function
|
|
1186
|
-
while (1) switch (
|
|
1927
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1928
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1187
1929
|
case 0:
|
|
1188
1930
|
if (!this.store.payment) {
|
|
1189
|
-
|
|
1931
|
+
_context20.next = 2;
|
|
1190
1932
|
break;
|
|
1191
1933
|
}
|
|
1192
|
-
return
|
|
1934
|
+
return _context20.abrupt("return", this.store.payment.getPayMethodListAsync());
|
|
1193
1935
|
case 2:
|
|
1194
|
-
|
|
1936
|
+
_context20.next = 4;
|
|
1195
1937
|
return this.request.get('/pay/custom-payment/all');
|
|
1196
1938
|
case 4:
|
|
1197
|
-
response =
|
|
1198
|
-
return
|
|
1939
|
+
response = _context20.sent;
|
|
1940
|
+
return _context20.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
|
|
1199
1941
|
case 6:
|
|
1200
1942
|
case "end":
|
|
1201
|
-
return
|
|
1943
|
+
return _context20.stop();
|
|
1202
1944
|
}
|
|
1203
|
-
},
|
|
1945
|
+
}, _callee20, this);
|
|
1204
1946
|
}));
|
|
1205
1947
|
function getPaymentMethodsAsync() {
|
|
1206
1948
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -1241,49 +1983,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1241
1983
|
}, {
|
|
1242
1984
|
key: "sendCustomerPayLink",
|
|
1243
1985
|
value: (function () {
|
|
1244
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1986
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1245
1987
|
var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
1246
|
-
return _regeneratorRuntime().wrap(function
|
|
1247
|
-
while (1) switch (
|
|
1988
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1989
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1248
1990
|
case 0:
|
|
1249
1991
|
if (this.store.order) {
|
|
1250
|
-
|
|
1992
|
+
_context21.next = 2;
|
|
1251
1993
|
break;
|
|
1252
1994
|
}
|
|
1253
1995
|
throw new Error('order 模块未初始化');
|
|
1254
1996
|
case 2:
|
|
1255
1997
|
orderIds = params.order_ids || params.orderIds || [];
|
|
1256
1998
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
1257
|
-
|
|
1999
|
+
_context21.next = 11;
|
|
1258
2000
|
break;
|
|
1259
2001
|
}
|
|
1260
|
-
|
|
2002
|
+
_context21.next = 6;
|
|
1261
2003
|
return this.submitSalesOrder({
|
|
1262
2004
|
smallTicketDataFlag: 1
|
|
1263
2005
|
});
|
|
1264
2006
|
case 6:
|
|
1265
|
-
submitResult =
|
|
2007
|
+
submitResult = _context21.sent;
|
|
1266
2008
|
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
2009
|
if (orderId) {
|
|
1268
|
-
|
|
2010
|
+
_context21.next = 10;
|
|
1269
2011
|
break;
|
|
1270
2012
|
}
|
|
1271
2013
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
1272
2014
|
case 10:
|
|
1273
2015
|
orderIds = [orderId];
|
|
1274
2016
|
case 11:
|
|
1275
|
-
return
|
|
2017
|
+
return _context21.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
1276
2018
|
emails: params.emails,
|
|
1277
2019
|
notify_action: params.notify_action,
|
|
1278
2020
|
order_ids: orderIds
|
|
1279
2021
|
}));
|
|
1280
2022
|
case 12:
|
|
1281
2023
|
case "end":
|
|
1282
|
-
return
|
|
2024
|
+
return _context21.stop();
|
|
1283
2025
|
}
|
|
1284
|
-
},
|
|
2026
|
+
}, _callee21, this);
|
|
1285
2027
|
}));
|
|
1286
|
-
function sendCustomerPayLink(
|
|
2028
|
+
function sendCustomerPayLink(_x15) {
|
|
1287
2029
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
1288
2030
|
}
|
|
1289
2031
|
return sendCustomerPayLink;
|
|
@@ -1293,76 +2035,155 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
2035
|
value: function transformBaseProductToOrderProduct(params) {
|
|
1294
2036
|
return _transformBaseProductToOrderProduct(params);
|
|
1295
2037
|
}
|
|
2038
|
+
}, {
|
|
2039
|
+
key: "calculateProductBookingPrice",
|
|
2040
|
+
value: function () {
|
|
2041
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2042
|
+
var _params$customer_id;
|
|
2043
|
+
var quotation, customerId;
|
|
2044
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2045
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2046
|
+
case 0:
|
|
2047
|
+
quotation = this.store.quotation;
|
|
2048
|
+
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2049
|
+
_context22.next = 4;
|
|
2050
|
+
return this.loadQuotationForPriceQuery({
|
|
2051
|
+
quotation: quotation,
|
|
2052
|
+
customer_id: customerId,
|
|
2053
|
+
channel: params.channel
|
|
2054
|
+
});
|
|
2055
|
+
case 4:
|
|
2056
|
+
return _context22.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2057
|
+
customer_id: customerId,
|
|
2058
|
+
quotation: quotation
|
|
2059
|
+
})));
|
|
2060
|
+
case 5:
|
|
2061
|
+
case "end":
|
|
2062
|
+
return _context22.stop();
|
|
2063
|
+
}
|
|
2064
|
+
}, _callee22, this);
|
|
2065
|
+
}));
|
|
2066
|
+
function calculateProductBookingPrice(_x16) {
|
|
2067
|
+
return _calculateProductBookingPrice.apply(this, arguments);
|
|
2068
|
+
}
|
|
2069
|
+
return calculateProductBookingPrice;
|
|
2070
|
+
}()
|
|
1296
2071
|
}, {
|
|
1297
2072
|
key: "addProductToOrder",
|
|
1298
2073
|
value: function () {
|
|
1299
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2074
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(product, booking) {
|
|
1300
2075
|
var products;
|
|
1301
|
-
return _regeneratorRuntime().wrap(function
|
|
1302
|
-
while (1) switch (
|
|
2076
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2077
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1303
2078
|
case 0:
|
|
1304
|
-
|
|
2079
|
+
_context23.prev = 0;
|
|
1305
2080
|
if (this.store.order) {
|
|
1306
|
-
|
|
2081
|
+
_context23.next = 3;
|
|
1307
2082
|
break;
|
|
1308
2083
|
}
|
|
1309
2084
|
throw new Error('order 模块未初始化');
|
|
1310
2085
|
case 3:
|
|
1311
|
-
|
|
2086
|
+
_context23.next = 5;
|
|
1312
2087
|
return this.store.order.addProductToOrder(product, booking);
|
|
1313
2088
|
case 5:
|
|
1314
|
-
products =
|
|
1315
|
-
return
|
|
2089
|
+
products = _context23.sent;
|
|
2090
|
+
return _context23.abrupt("return", products);
|
|
1316
2091
|
case 9:
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
throw
|
|
2092
|
+
_context23.prev = 9;
|
|
2093
|
+
_context23.t0 = _context23["catch"](0);
|
|
2094
|
+
throw _context23.t0;
|
|
1320
2095
|
case 12:
|
|
1321
2096
|
case "end":
|
|
1322
|
-
return
|
|
2097
|
+
return _context23.stop();
|
|
1323
2098
|
}
|
|
1324
|
-
},
|
|
2099
|
+
}, _callee23, this, [[0, 9]]);
|
|
1325
2100
|
}));
|
|
1326
|
-
function addProductToOrder(
|
|
2101
|
+
function addProductToOrder(_x17, _x18) {
|
|
1327
2102
|
return _addProductToOrder.apply(this, arguments);
|
|
1328
2103
|
}
|
|
1329
2104
|
return addProductToOrder;
|
|
1330
2105
|
}()
|
|
1331
2106
|
}, {
|
|
1332
|
-
key: "
|
|
2107
|
+
key: "updateOrderProduct",
|
|
1333
2108
|
value: function () {
|
|
1334
|
-
var
|
|
2109
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
1335
2110
|
var products;
|
|
1336
|
-
return _regeneratorRuntime().wrap(function
|
|
1337
|
-
while (1) switch (
|
|
2111
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2112
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1338
2113
|
case 0:
|
|
1339
|
-
|
|
2114
|
+
_context24.prev = 0;
|
|
1340
2115
|
if (this.store.order) {
|
|
1341
|
-
|
|
2116
|
+
_context24.next = 3;
|
|
1342
2117
|
break;
|
|
1343
2118
|
}
|
|
1344
2119
|
throw new Error('order 模块未初始化');
|
|
1345
2120
|
case 3:
|
|
1346
|
-
|
|
1347
|
-
return this.store.order.
|
|
2121
|
+
_context24.next = 5;
|
|
2122
|
+
return this.store.order.updateOrderProduct(params);
|
|
1348
2123
|
case 5:
|
|
1349
|
-
products =
|
|
1350
|
-
return
|
|
2124
|
+
products = _context24.sent;
|
|
2125
|
+
return _context24.abrupt("return", products);
|
|
1351
2126
|
case 9:
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
throw
|
|
2127
|
+
_context24.prev = 9;
|
|
2128
|
+
_context24.t0 = _context24["catch"](0);
|
|
2129
|
+
throw _context24.t0;
|
|
1355
2130
|
case 12:
|
|
1356
2131
|
case "end":
|
|
1357
|
-
return
|
|
2132
|
+
return _context24.stop();
|
|
1358
2133
|
}
|
|
1359
|
-
},
|
|
2134
|
+
}, _callee24, this, [[0, 9]]);
|
|
1360
2135
|
}));
|
|
1361
|
-
function
|
|
1362
|
-
return
|
|
2136
|
+
function updateOrderProduct(_x19) {
|
|
2137
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
1363
2138
|
}
|
|
1364
|
-
return
|
|
2139
|
+
return updateOrderProduct;
|
|
1365
2140
|
}()
|
|
2141
|
+
}, {
|
|
2142
|
+
key: "updateOrderProductQuantity",
|
|
2143
|
+
value: function () {
|
|
2144
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2145
|
+
var products;
|
|
2146
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2147
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2148
|
+
case 0:
|
|
2149
|
+
_context25.prev = 0;
|
|
2150
|
+
if (this.store.order) {
|
|
2151
|
+
_context25.next = 3;
|
|
2152
|
+
break;
|
|
2153
|
+
}
|
|
2154
|
+
throw new Error('order 模块未初始化');
|
|
2155
|
+
case 3:
|
|
2156
|
+
_context25.next = 5;
|
|
2157
|
+
return this.store.order.updateOrderProductQuantity(params);
|
|
2158
|
+
case 5:
|
|
2159
|
+
products = _context25.sent;
|
|
2160
|
+
return _context25.abrupt("return", products);
|
|
2161
|
+
case 9:
|
|
2162
|
+
_context25.prev = 9;
|
|
2163
|
+
_context25.t0 = _context25["catch"](0);
|
|
2164
|
+
throw _context25.t0;
|
|
2165
|
+
case 12:
|
|
2166
|
+
case "end":
|
|
2167
|
+
return _context25.stop();
|
|
2168
|
+
}
|
|
2169
|
+
}, _callee25, this, [[0, 9]]);
|
|
2170
|
+
}));
|
|
2171
|
+
function updateOrderProductQuantity(_x20) {
|
|
2172
|
+
return _updateOrderProductQuantity.apply(this, arguments);
|
|
2173
|
+
}
|
|
2174
|
+
return updateOrderProductQuantity;
|
|
2175
|
+
}()
|
|
2176
|
+
}, {
|
|
2177
|
+
key: "updateOrderBooking",
|
|
2178
|
+
value: function updateOrderBooking(params) {
|
|
2179
|
+
try {
|
|
2180
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2181
|
+
return this.store.order.updateOrderBooking(params);
|
|
2182
|
+
} catch (error) {
|
|
2183
|
+
throw error;
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
|
|
1366
2187
|
/**
|
|
1367
2188
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
1368
2189
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|
|
@@ -1370,12 +2191,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1370
2191
|
}, {
|
|
1371
2192
|
key: "setOrderProductLineNote",
|
|
1372
2193
|
value: (function () {
|
|
1373
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2194
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(identity, note) {
|
|
1374
2195
|
var params, products;
|
|
1375
|
-
return _regeneratorRuntime().wrap(function
|
|
1376
|
-
while (1) switch (
|
|
2196
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2197
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1377
2198
|
case 0:
|
|
1378
|
-
|
|
2199
|
+
_context26.prev = 0;
|
|
1379
2200
|
params = {
|
|
1380
2201
|
product_id: identity.product_id,
|
|
1381
2202
|
product_variant_id: identity.product_variant_id,
|
|
@@ -1390,22 +2211,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1390
2211
|
params.product_option_item = identity.product_option_item;
|
|
1391
2212
|
}
|
|
1392
2213
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1393
|
-
|
|
1394
|
-
return this.
|
|
2214
|
+
_context26.next = 7;
|
|
2215
|
+
return this.updateOrderProduct(params);
|
|
1395
2216
|
case 7:
|
|
1396
|
-
products =
|
|
1397
|
-
return
|
|
2217
|
+
products = _context26.sent;
|
|
2218
|
+
return _context26.abrupt("return", products);
|
|
1398
2219
|
case 11:
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
throw
|
|
2220
|
+
_context26.prev = 11;
|
|
2221
|
+
_context26.t0 = _context26["catch"](0);
|
|
2222
|
+
throw _context26.t0;
|
|
1402
2223
|
case 14:
|
|
1403
2224
|
case "end":
|
|
1404
|
-
return
|
|
2225
|
+
return _context26.stop();
|
|
1405
2226
|
}
|
|
1406
|
-
},
|
|
2227
|
+
}, _callee26, this, [[0, 11]]);
|
|
1407
2228
|
}));
|
|
1408
|
-
function setOrderProductLineNote(
|
|
2229
|
+
function setOrderProductLineNote(_x21, _x22) {
|
|
1409
2230
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
1410
2231
|
}
|
|
1411
2232
|
return setOrderProductLineNote;
|
|
@@ -1413,34 +2234,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1413
2234
|
}, {
|
|
1414
2235
|
key: "removeProductFromOrder",
|
|
1415
2236
|
value: function () {
|
|
1416
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2237
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
|
|
1417
2238
|
var products;
|
|
1418
|
-
return _regeneratorRuntime().wrap(function
|
|
1419
|
-
while (1) switch (
|
|
2239
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2240
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1420
2241
|
case 0:
|
|
1421
|
-
|
|
2242
|
+
_context27.prev = 0;
|
|
1422
2243
|
if (this.store.order) {
|
|
1423
|
-
|
|
2244
|
+
_context27.next = 3;
|
|
1424
2245
|
break;
|
|
1425
2246
|
}
|
|
1426
2247
|
throw new Error('order 模块未初始化');
|
|
1427
2248
|
case 3:
|
|
1428
|
-
|
|
2249
|
+
_context27.next = 5;
|
|
1429
2250
|
return this.store.order.removeProductFromOrder(identity);
|
|
1430
2251
|
case 5:
|
|
1431
|
-
products =
|
|
1432
|
-
return
|
|
2252
|
+
products = _context27.sent;
|
|
2253
|
+
return _context27.abrupt("return", products);
|
|
1433
2254
|
case 9:
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
throw
|
|
2255
|
+
_context27.prev = 9;
|
|
2256
|
+
_context27.t0 = _context27["catch"](0);
|
|
2257
|
+
throw _context27.t0;
|
|
1437
2258
|
case 12:
|
|
1438
2259
|
case "end":
|
|
1439
|
-
return
|
|
2260
|
+
return _context27.stop();
|
|
1440
2261
|
}
|
|
1441
|
-
},
|
|
2262
|
+
}, _callee27, this, [[0, 9]]);
|
|
1442
2263
|
}));
|
|
1443
|
-
function removeProductFromOrder(
|
|
2264
|
+
function removeProductFromOrder(_x23) {
|
|
1444
2265
|
return _removeProductFromOrder.apply(this, arguments);
|
|
1445
2266
|
}
|
|
1446
2267
|
return removeProductFromOrder;
|
|
@@ -1449,18 +2270,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1449
2270
|
}, {
|
|
1450
2271
|
key: "getProductList",
|
|
1451
2272
|
value: function () {
|
|
1452
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1453
|
-
var _this$
|
|
2273
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2274
|
+
var _this$otherParams7;
|
|
1454
2275
|
var menu_list_ids, _this$store$products, res;
|
|
1455
|
-
return _regeneratorRuntime().wrap(function
|
|
1456
|
-
while (1) switch (
|
|
2276
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2277
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1457
2278
|
case 0:
|
|
1458
2279
|
// 可以直接通过配置里的 menu 读取
|
|
1459
|
-
menu_list_ids = ((_this$
|
|
2280
|
+
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
2281
|
return Number(n.value);
|
|
1461
2282
|
})) || [];
|
|
1462
|
-
|
|
1463
|
-
|
|
2283
|
+
_context28.prev = 1;
|
|
2284
|
+
_context28.next = 4;
|
|
1464
2285
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
1465
2286
|
menu_list_ids: menu_list_ids,
|
|
1466
2287
|
cacheId: this.cacheId,
|
|
@@ -1468,17 +2289,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1468
2289
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
1469
2290
|
});
|
|
1470
2291
|
case 4:
|
|
1471
|
-
res =
|
|
1472
|
-
return
|
|
2292
|
+
res = _context28.sent;
|
|
2293
|
+
return _context28.abrupt("return", res);
|
|
1473
2294
|
case 8:
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
throw
|
|
2295
|
+
_context28.prev = 8;
|
|
2296
|
+
_context28.t0 = _context28["catch"](1);
|
|
2297
|
+
throw _context28.t0;
|
|
1477
2298
|
case 11:
|
|
1478
2299
|
case "end":
|
|
1479
|
-
return
|
|
2300
|
+
return _context28.stop();
|
|
1480
2301
|
}
|
|
1481
|
-
},
|
|
2302
|
+
}, _callee28, this, [[1, 8]]);
|
|
1482
2303
|
}));
|
|
1483
2304
|
function getProductList() {
|
|
1484
2305
|
return _getProductList.apply(this, arguments);
|
|
@@ -1493,15 +2314,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1493
2314
|
}, {
|
|
1494
2315
|
key: "setOtherParams",
|
|
1495
2316
|
value: function () {
|
|
1496
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2317
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
1497
2318
|
var _ref4,
|
|
1498
2319
|
_ref4$cover,
|
|
1499
2320
|
cover,
|
|
1500
|
-
|
|
1501
|
-
return _regeneratorRuntime().wrap(function
|
|
1502
|
-
while (1) switch (
|
|
2321
|
+
_args29 = arguments;
|
|
2322
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2323
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
1503
2324
|
case 0:
|
|
1504
|
-
_ref4 =
|
|
2325
|
+
_ref4 = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
1505
2326
|
if (cover) {
|
|
1506
2327
|
this.otherParams = params;
|
|
1507
2328
|
} else {
|
|
@@ -1509,11 +2330,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1509
2330
|
}
|
|
1510
2331
|
case 2:
|
|
1511
2332
|
case "end":
|
|
1512
|
-
return
|
|
2333
|
+
return _context29.stop();
|
|
1513
2334
|
}
|
|
1514
|
-
},
|
|
2335
|
+
}, _callee29, this);
|
|
1515
2336
|
}));
|
|
1516
|
-
function setOtherParams(
|
|
2337
|
+
function setOtherParams(_x24) {
|
|
1517
2338
|
return _setOtherParams.apply(this, arguments);
|
|
1518
2339
|
}
|
|
1519
2340
|
return setOtherParams;
|