@pisell/pisellos 2.2.173 → 2.2.175
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 +0 -9
- package/dist/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +17 -33
- package/dist/modules/Order/index.js +395 -757
- package/dist/modules/Order/types.d.ts +17 -58
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +1 -39
- package/dist/modules/Order/utils.js +31 -219
- package/dist/modules/Quotation/index.js +5 -16
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +6 -10
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.js +94 -113
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -53
- package/dist/solution/BaseSales/index.js +339 -1160
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -65
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -776
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +17 -33
- package/lib/modules/Order/index.js +148 -402
- package/lib/modules/Order/types.d.ts +17 -58
- package/lib/modules/Order/utils.d.ts +1 -39
- package/lib/modules/Order/utils.js +22 -197
- package/lib/modules/Quotation/index.js +6 -17
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +0 -2
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.js +12 -23
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -53
- package/lib/solution/BaseSales/index.js +20 -527
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -70
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -349
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
2
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
3
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -27,16 +23,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
27
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
24
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
25
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
|
-
import { BaseSalesHookNames } from "./types";
|
|
31
26
|
import { OrderModule } from "../../modules/Order";
|
|
32
27
|
import Decimal from 'decimal.js';
|
|
33
28
|
import { createModule } from "../BookingByStep/types";
|
|
34
29
|
import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
35
30
|
import dayjs from 'dayjs';
|
|
36
31
|
export * from "./types";
|
|
37
|
-
import { QuotationModule } from "../../modules/Quotation";
|
|
38
32
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
39
|
-
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
40
33
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
41
34
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
42
35
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -50,7 +43,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
50
43
|
_defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
|
|
51
44
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
52
45
|
// LoggerManager 实例
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
54
46
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
55
47
|
order: undefined
|
|
56
48
|
});
|
|
@@ -64,19 +56,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
56
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
65
57
|
// 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
|
|
66
58
|
_defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
|
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
69
59
|
return _this;
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
/**
|
|
73
63
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
74
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment
|
|
64
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
75
65
|
*/
|
|
76
66
|
_createClass(BaseSalesImpl, [{
|
|
77
67
|
key: "getRegisteredModuleNames",
|
|
78
68
|
value: function getRegisteredModuleNames() {
|
|
79
|
-
return ['products', 'order', 'salesSummary', 'schedule', 'payment'
|
|
69
|
+
return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
/**
|
|
@@ -131,63 +121,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
121
|
get: function get() {
|
|
132
122
|
return this.store.payment;
|
|
133
123
|
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "getCurrentOrderCustomerId",
|
|
136
|
-
value: function getCurrentOrderCustomerId() {
|
|
137
|
-
var _this$store$order, _this$store$order$get;
|
|
138
|
-
var tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
139
|
-
var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
140
|
-
if (customerId === null || customerId === undefined) return undefined;
|
|
141
|
-
return customerId;
|
|
142
|
-
}
|
|
143
|
-
}, {
|
|
144
|
-
key: "applyQuotationScheduleResolver",
|
|
145
|
-
value: function applyQuotationScheduleResolver(quotation) {
|
|
146
|
-
var scheduleModule = this.store.schedule;
|
|
147
|
-
if (!scheduleModule) return;
|
|
148
|
-
quotation.setScheduleResolver(function (id) {
|
|
149
|
-
var _scheduleModule$getSc;
|
|
150
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
|
|
151
|
-
return schedules[0];
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}, {
|
|
155
|
-
key: "loadQuotationForPriceQuery",
|
|
156
|
-
value: function () {
|
|
157
|
-
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
158
|
-
var _this$otherParams;
|
|
159
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
160
|
-
while (1) switch (_context.prev = _context.next) {
|
|
161
|
-
case 0:
|
|
162
|
-
if (params.quotation) {
|
|
163
|
-
_context.next = 2;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
return _context.abrupt("return");
|
|
167
|
-
case 2:
|
|
168
|
-
this.applyQuotationScheduleResolver(params.quotation);
|
|
169
|
-
_context.next = 5;
|
|
170
|
-
return params.quotation.loadQuotations({
|
|
171
|
-
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
172
|
-
customer_id: params.customer_id
|
|
173
|
-
});
|
|
174
|
-
case 5:
|
|
175
|
-
case "end":
|
|
176
|
-
return _context.stop();
|
|
177
|
-
}
|
|
178
|
-
}, _callee, this);
|
|
179
|
-
}));
|
|
180
|
-
function loadQuotationForPriceQuery(_x) {
|
|
181
|
-
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
182
|
-
}
|
|
183
|
-
return loadQuotationForPriceQuery;
|
|
184
|
-
}()
|
|
185
|
-
}, {
|
|
186
|
-
key: "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
|
-
}
|
|
191
124
|
|
|
192
125
|
/**
|
|
193
126
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -197,9 +130,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
197
130
|
}, {
|
|
198
131
|
key: "createSubModule",
|
|
199
132
|
value: function createSubModule(moduleName) {
|
|
200
|
-
if (moduleName === 'quotation') {
|
|
201
|
-
return new QuotationModule("".concat(this.name, "_quotation"));
|
|
202
|
-
}
|
|
203
133
|
return createModule(moduleName, this.name);
|
|
204
134
|
}
|
|
205
135
|
}, {
|
|
@@ -233,78 +163,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
233
163
|
return {};
|
|
234
164
|
}
|
|
235
165
|
}
|
|
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
|
-
}
|
|
276
166
|
}, {
|
|
277
167
|
key: "initialize",
|
|
278
168
|
value: function () {
|
|
279
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
280
|
-
var _this$
|
|
169
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
|
|
170
|
+
var _this$otherParams,
|
|
281
171
|
_this2 = this;
|
|
282
172
|
var options,
|
|
173
|
+
appPlugin,
|
|
283
174
|
app,
|
|
284
175
|
targetCacheData,
|
|
285
176
|
moduleNames,
|
|
286
|
-
|
|
287
|
-
return _regeneratorRuntime().wrap(function
|
|
288
|
-
while (1) switch (
|
|
177
|
+
_args = arguments;
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
179
|
+
while (1) switch (_context.prev = _context.next) {
|
|
289
180
|
case 0:
|
|
290
|
-
options =
|
|
181
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
291
182
|
this.core = core;
|
|
292
183
|
this.initializeOptions = options || {};
|
|
293
184
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
294
185
|
this.otherParams = options.otherParams || {};
|
|
295
|
-
this.cacheId = (_this$
|
|
186
|
+
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
296
187
|
this.window = core.getPlugin('window');
|
|
297
188
|
this.request = core.getPlugin('request');
|
|
298
189
|
|
|
299
190
|
// 获取 logger 实例
|
|
300
|
-
|
|
301
|
-
if (
|
|
302
|
-
|
|
191
|
+
appPlugin = core.getPlugin('app');
|
|
192
|
+
if (appPlugin) {
|
|
193
|
+
_context.next = 10;
|
|
303
194
|
break;
|
|
304
195
|
}
|
|
305
196
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
306
197
|
case 10:
|
|
307
|
-
app =
|
|
198
|
+
app = appPlugin.getApp();
|
|
308
199
|
this.logger = app.logger;
|
|
309
200
|
targetCacheData = this.readSessionCacheData();
|
|
310
201
|
moduleNames = this.getRegisteredModuleNames();
|
|
@@ -329,20 +220,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
329
220
|
}));
|
|
330
221
|
});
|
|
331
222
|
if (!this.store.schedule) {
|
|
332
|
-
|
|
223
|
+
_context.next = 18;
|
|
333
224
|
break;
|
|
334
225
|
}
|
|
335
|
-
|
|
226
|
+
_context.next = 18;
|
|
336
227
|
return this.store.schedule.loadAllSchedule();
|
|
337
228
|
case 18:
|
|
338
229
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
339
230
|
case 19:
|
|
340
231
|
case "end":
|
|
341
|
-
return
|
|
232
|
+
return _context.stop();
|
|
342
233
|
}
|
|
343
|
-
},
|
|
234
|
+
}, _callee, this);
|
|
344
235
|
}));
|
|
345
|
-
function initialize(
|
|
236
|
+
function initialize(_x) {
|
|
346
237
|
return _initialize.apply(this, arguments);
|
|
347
238
|
}
|
|
348
239
|
return initialize;
|
|
@@ -350,10 +241,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
350
241
|
}, {
|
|
351
242
|
key: "destroy",
|
|
352
243
|
value: function () {
|
|
353
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
244
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
354
245
|
var _this3 = this;
|
|
355
|
-
return _regeneratorRuntime().wrap(function
|
|
356
|
-
while (1) switch (
|
|
246
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
247
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
357
248
|
case 0:
|
|
358
249
|
Object.keys(this.store).forEach(function (key) {
|
|
359
250
|
var sub = _this3.store[key];
|
|
@@ -366,15 +257,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
366
257
|
}
|
|
367
258
|
});
|
|
368
259
|
this.currentSalesDetail = null;
|
|
369
|
-
|
|
260
|
+
_context2.next = 4;
|
|
370
261
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
371
262
|
case 4:
|
|
372
263
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
373
264
|
case 5:
|
|
374
265
|
case "end":
|
|
375
|
-
return
|
|
266
|
+
return _context2.stop();
|
|
376
267
|
}
|
|
377
|
-
},
|
|
268
|
+
}, _callee2, this);
|
|
378
269
|
}));
|
|
379
270
|
function destroy() {
|
|
380
271
|
return _destroy.apply(this, arguments);
|
|
@@ -391,13 +282,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
391
282
|
}, {
|
|
392
283
|
key: "loadSalesDetail",
|
|
393
284
|
value: (function () {
|
|
394
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
285
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(orderIdOrParams) {
|
|
395
286
|
var params, externalSaleNumber, localRecord, _sales, res, message, sales;
|
|
396
|
-
return _regeneratorRuntime().wrap(function
|
|
397
|
-
while (1) switch (
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
288
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
398
289
|
case 0:
|
|
399
290
|
if (this.store.order) {
|
|
400
|
-
|
|
291
|
+
_context3.next = 2;
|
|
401
292
|
break;
|
|
402
293
|
}
|
|
403
294
|
throw new Error('order 模块未初始化');
|
|
@@ -407,107 +298,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
407
298
|
};
|
|
408
299
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
409
300
|
if (params.forceRemote) {
|
|
410
|
-
|
|
301
|
+
_context3.next = 35;
|
|
411
302
|
break;
|
|
412
303
|
}
|
|
413
304
|
if (!(params.orderId !== undefined)) {
|
|
414
|
-
|
|
305
|
+
_context3.next = 11;
|
|
415
306
|
break;
|
|
416
307
|
}
|
|
417
|
-
|
|
308
|
+
_context3.next = 8;
|
|
418
309
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
419
310
|
case 8:
|
|
420
|
-
|
|
421
|
-
|
|
311
|
+
_context3.t0 = _context3.sent;
|
|
312
|
+
_context3.next = 26;
|
|
422
313
|
break;
|
|
423
314
|
case 11:
|
|
424
315
|
if (!externalSaleNumber) {
|
|
425
|
-
|
|
316
|
+
_context3.next = 17;
|
|
426
317
|
break;
|
|
427
318
|
}
|
|
428
|
-
|
|
319
|
+
_context3.next = 14;
|
|
429
320
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
430
321
|
case 14:
|
|
431
|
-
|
|
432
|
-
|
|
322
|
+
_context3.t1 = _context3.sent;
|
|
323
|
+
_context3.next = 25;
|
|
433
324
|
break;
|
|
434
325
|
case 17:
|
|
435
326
|
if (!params.orderNumber) {
|
|
436
|
-
|
|
327
|
+
_context3.next = 23;
|
|
437
328
|
break;
|
|
438
329
|
}
|
|
439
|
-
|
|
330
|
+
_context3.next = 20;
|
|
440
331
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
441
332
|
case 20:
|
|
442
|
-
|
|
443
|
-
|
|
333
|
+
_context3.t2 = _context3.sent;
|
|
334
|
+
_context3.next = 24;
|
|
444
335
|
break;
|
|
445
336
|
case 23:
|
|
446
|
-
|
|
337
|
+
_context3.t2 = null;
|
|
447
338
|
case 24:
|
|
448
|
-
|
|
339
|
+
_context3.t1 = _context3.t2;
|
|
449
340
|
case 25:
|
|
450
|
-
|
|
341
|
+
_context3.t0 = _context3.t1;
|
|
451
342
|
case 26:
|
|
452
|
-
localRecord =
|
|
343
|
+
localRecord = _context3.t0;
|
|
453
344
|
if (!localRecord) {
|
|
454
|
-
|
|
345
|
+
_context3.next = 35;
|
|
455
346
|
break;
|
|
456
347
|
}
|
|
457
|
-
|
|
348
|
+
_context3.next = 30;
|
|
458
349
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
459
350
|
recalcOnHydrate: false
|
|
460
351
|
});
|
|
461
352
|
case 30:
|
|
462
|
-
_sales =
|
|
353
|
+
_sales = _context3.sent;
|
|
463
354
|
this.currentSalesDetail = _sales;
|
|
464
|
-
|
|
355
|
+
_context3.next = 34;
|
|
465
356
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
466
357
|
sales: _sales
|
|
467
358
|
});
|
|
468
359
|
case 34:
|
|
469
|
-
return
|
|
360
|
+
return _context3.abrupt("return", _sales);
|
|
470
361
|
case 35:
|
|
471
362
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
472
|
-
|
|
363
|
+
_context3.next = 37;
|
|
473
364
|
break;
|
|
474
365
|
}
|
|
475
366
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
476
367
|
case 37:
|
|
477
|
-
|
|
368
|
+
_context3.next = 39;
|
|
478
369
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
479
370
|
case 39:
|
|
480
|
-
res =
|
|
371
|
+
res = _context3.sent;
|
|
481
372
|
if (!(!res || res.code !== 200)) {
|
|
482
|
-
|
|
373
|
+
_context3.next = 43;
|
|
483
374
|
break;
|
|
484
375
|
}
|
|
485
376
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
486
377
|
throw new Error(message);
|
|
487
378
|
case 43:
|
|
488
|
-
|
|
379
|
+
_context3.next = 45;
|
|
489
380
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
490
381
|
recalcOnHydrate: false
|
|
491
382
|
});
|
|
492
383
|
case 45:
|
|
493
|
-
sales =
|
|
494
|
-
|
|
384
|
+
sales = _context3.sent;
|
|
385
|
+
_context3.next = 48;
|
|
495
386
|
return this.store.order.saveDraft();
|
|
496
387
|
case 48:
|
|
497
388
|
this.currentSalesDetail = sales;
|
|
498
|
-
|
|
389
|
+
_context3.next = 51;
|
|
499
390
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
500
391
|
sales: sales
|
|
501
392
|
});
|
|
502
393
|
case 51:
|
|
503
|
-
return
|
|
394
|
+
return _context3.abrupt("return", sales);
|
|
504
395
|
case 52:
|
|
505
396
|
case "end":
|
|
506
|
-
return
|
|
397
|
+
return _context3.stop();
|
|
507
398
|
}
|
|
508
|
-
},
|
|
399
|
+
}, _callee3, this);
|
|
509
400
|
}));
|
|
510
|
-
function loadSalesDetail(
|
|
401
|
+
function loadSalesDetail(_x2) {
|
|
511
402
|
return _loadSalesDetail.apply(this, arguments);
|
|
512
403
|
}
|
|
513
404
|
return loadSalesDetail;
|
|
@@ -580,45 +471,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
580
471
|
}, {
|
|
581
472
|
key: "getTempOrder",
|
|
582
473
|
value: function getTempOrder() {
|
|
583
|
-
var _this$store$
|
|
584
|
-
var result = ((_this$store$
|
|
474
|
+
var _this$store$order;
|
|
475
|
+
var result = ((_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.getTempOrder()) || null;
|
|
585
476
|
return result;
|
|
586
477
|
}
|
|
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
|
-
}()
|
|
622
478
|
}, {
|
|
623
479
|
key: "getOrderIdentity",
|
|
624
480
|
value: function getOrderIdentity() {
|
|
@@ -652,21 +508,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
652
508
|
}, {
|
|
653
509
|
key: "updateTempOrderNote",
|
|
654
510
|
value: function updateTempOrderNote(note) {
|
|
655
|
-
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
656
511
|
try {
|
|
657
512
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
658
|
-
var result = this.store.order.updateTempOrderNote(note
|
|
513
|
+
var result = this.store.order.updateTempOrderNote(note);
|
|
659
514
|
return result;
|
|
660
515
|
} catch (error) {
|
|
661
516
|
throw error;
|
|
662
517
|
}
|
|
663
518
|
}
|
|
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
|
-
}
|
|
670
519
|
}, {
|
|
671
520
|
key: "updateTempOrderShopDiscount",
|
|
672
521
|
value: function updateTempOrderShopDiscount(amount) {
|
|
@@ -679,22 +528,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
679
528
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
680
529
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
681
530
|
}
|
|
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
|
-
}
|
|
698
531
|
}, {
|
|
699
532
|
key: "ensureTempOrder",
|
|
700
533
|
value: function ensureTempOrder() {
|
|
@@ -706,40 +539,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
706
539
|
}, {
|
|
707
540
|
key: "addNewOrder",
|
|
708
541
|
value: function () {
|
|
709
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
542
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
710
543
|
var tempOrder;
|
|
711
|
-
return _regeneratorRuntime().wrap(function
|
|
712
|
-
while (1) switch (
|
|
544
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
545
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
713
546
|
case 0:
|
|
714
|
-
|
|
547
|
+
_context4.prev = 0;
|
|
715
548
|
if (this.store.order) {
|
|
716
|
-
|
|
549
|
+
_context4.next = 3;
|
|
717
550
|
break;
|
|
718
551
|
}
|
|
719
552
|
throw new Error('order 模块未初始化');
|
|
720
553
|
case 3:
|
|
721
|
-
|
|
554
|
+
_context4.next = 5;
|
|
722
555
|
return this.store.order.addNewOrder();
|
|
723
556
|
case 5:
|
|
724
|
-
tempOrder =
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
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:
|
|
557
|
+
tempOrder = _context4.sent;
|
|
558
|
+
return _context4.abrupt("return", tempOrder);
|
|
559
|
+
case 9:
|
|
560
|
+
_context4.prev = 9;
|
|
561
|
+
_context4.t0 = _context4["catch"](0);
|
|
562
|
+
throw _context4.t0;
|
|
563
|
+
case 12:
|
|
739
564
|
case "end":
|
|
740
|
-
return
|
|
565
|
+
return _context4.stop();
|
|
741
566
|
}
|
|
742
|
-
},
|
|
567
|
+
}, _callee4, this, [[0, 9]]);
|
|
743
568
|
}));
|
|
744
569
|
function addNewOrder() {
|
|
745
570
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -749,22 +574,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
749
574
|
}, {
|
|
750
575
|
key: "saveDraft",
|
|
751
576
|
value: function () {
|
|
752
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
753
|
-
return _regeneratorRuntime().wrap(function
|
|
754
|
-
while (1) switch (
|
|
577
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
578
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
579
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
755
580
|
case 0:
|
|
756
581
|
if (this.store.order) {
|
|
757
|
-
|
|
582
|
+
_context5.next = 2;
|
|
758
583
|
break;
|
|
759
584
|
}
|
|
760
585
|
throw new Error('order 模块未初始化');
|
|
761
586
|
case 2:
|
|
762
|
-
return
|
|
587
|
+
return _context5.abrupt("return", this.store.order.saveDraft());
|
|
763
588
|
case 3:
|
|
764
589
|
case "end":
|
|
765
|
-
return
|
|
590
|
+
return _context5.stop();
|
|
766
591
|
}
|
|
767
|
-
},
|
|
592
|
+
}, _callee5, this);
|
|
768
593
|
}));
|
|
769
594
|
function saveDraft() {
|
|
770
595
|
return _saveDraft.apply(this, arguments);
|
|
@@ -775,113 +600,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
775
600
|
}, {
|
|
776
601
|
key: "restoreOrder",
|
|
777
602
|
value: function () {
|
|
778
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
603
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
779
604
|
var tempOrder;
|
|
780
|
-
return _regeneratorRuntime().wrap(function
|
|
781
|
-
while (1) switch (
|
|
605
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
606
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
782
607
|
case 0:
|
|
783
|
-
|
|
608
|
+
_context6.prev = 0;
|
|
784
609
|
if (this.store.order) {
|
|
785
|
-
|
|
610
|
+
_context6.next = 3;
|
|
786
611
|
break;
|
|
787
612
|
}
|
|
788
613
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
789
614
|
case 3:
|
|
790
615
|
// this.store.resource = null;
|
|
791
616
|
tempOrder = this.store.order.restoreOrder();
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
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:
|
|
617
|
+
return _context6.abrupt("return", tempOrder);
|
|
618
|
+
case 7:
|
|
619
|
+
_context6.prev = 7;
|
|
620
|
+
_context6.t0 = _context6["catch"](0);
|
|
621
|
+
throw _context6.t0;
|
|
622
|
+
case 10:
|
|
814
623
|
case "end":
|
|
815
|
-
return
|
|
624
|
+
return _context6.stop();
|
|
816
625
|
}
|
|
817
|
-
},
|
|
626
|
+
}, _callee6, this, [[0, 7]]);
|
|
818
627
|
}));
|
|
819
628
|
function restoreOrder() {
|
|
820
629
|
return _restoreOrder.apply(this, arguments);
|
|
821
630
|
}
|
|
822
631
|
return restoreOrder;
|
|
823
632
|
}()
|
|
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
|
-
}())
|
|
885
633
|
}, {
|
|
886
634
|
key: "getOrderProducts",
|
|
887
635
|
value: function getOrderProducts() {
|
|
@@ -892,385 +640,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
892
640
|
}, {
|
|
893
641
|
key: "getSummary",
|
|
894
642
|
value: function () {
|
|
895
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
643
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
896
644
|
var summary;
|
|
897
|
-
return _regeneratorRuntime().wrap(function
|
|
898
|
-
while (1) switch (
|
|
645
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
646
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
899
647
|
case 0:
|
|
900
|
-
|
|
648
|
+
_context7.prev = 0;
|
|
901
649
|
if (this.store.order) {
|
|
902
|
-
|
|
650
|
+
_context7.next = 3;
|
|
903
651
|
break;
|
|
904
652
|
}
|
|
905
653
|
throw new Error('order 模块未初始化');
|
|
906
654
|
case 3:
|
|
907
|
-
|
|
655
|
+
_context7.next = 5;
|
|
908
656
|
return this.store.order.getOrderSummary();
|
|
909
657
|
case 5:
|
|
910
|
-
summary =
|
|
911
|
-
return
|
|
658
|
+
summary = _context7.sent;
|
|
659
|
+
return _context7.abrupt("return", summary);
|
|
912
660
|
case 9:
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
throw
|
|
661
|
+
_context7.prev = 9;
|
|
662
|
+
_context7.t0 = _context7["catch"](0);
|
|
663
|
+
throw _context7.t0;
|
|
916
664
|
case 12:
|
|
917
665
|
case "end":
|
|
918
|
-
return
|
|
666
|
+
return _context7.stop();
|
|
919
667
|
}
|
|
920
|
-
},
|
|
668
|
+
}, _callee7, this, [[0, 9]]);
|
|
921
669
|
}));
|
|
922
670
|
function getSummary() {
|
|
923
671
|
return _getSummary.apply(this, arguments);
|
|
924
672
|
}
|
|
925
673
|
return getSummary;
|
|
926
674
|
}()
|
|
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
|
-
}()
|
|
1274
675
|
}, {
|
|
1275
676
|
key: "getDiscountList",
|
|
1276
677
|
value: function getDiscountList() {
|
|
@@ -1280,49 +681,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1280
681
|
}, {
|
|
1281
682
|
key: "scanPromotionCode",
|
|
1282
683
|
value: function () {
|
|
1283
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
684
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(code, customerId) {
|
|
1284
685
|
var raw;
|
|
1285
|
-
return _regeneratorRuntime().wrap(function
|
|
1286
|
-
while (1) switch (
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
687
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1287
688
|
case 0:
|
|
1288
|
-
|
|
689
|
+
_context8.prev = 0;
|
|
1289
690
|
if (this.store.order) {
|
|
1290
|
-
|
|
691
|
+
_context8.next = 3;
|
|
1291
692
|
break;
|
|
1292
693
|
}
|
|
1293
694
|
throw new Error('order 模块未初始化');
|
|
1294
695
|
case 3:
|
|
1295
|
-
|
|
696
|
+
_context8.next = 5;
|
|
1296
697
|
return this.store.order.scanCode(code, customerId);
|
|
1297
698
|
case 5:
|
|
1298
|
-
raw =
|
|
699
|
+
raw = _context8.sent;
|
|
1299
700
|
if (!raw.isAvailable) {
|
|
1300
|
-
|
|
701
|
+
_context8.next = 10;
|
|
1301
702
|
break;
|
|
1302
703
|
}
|
|
1303
|
-
|
|
704
|
+
_context8.next = 9;
|
|
1304
705
|
return this.store.order.recalculateSummary({
|
|
1305
706
|
createIfMissing: true
|
|
1306
707
|
});
|
|
1307
708
|
case 9:
|
|
1308
709
|
this.store.order.persistTempOrder();
|
|
1309
710
|
case 10:
|
|
1310
|
-
return
|
|
711
|
+
return _context8.abrupt("return", {
|
|
1311
712
|
isAvailable: raw.isAvailable,
|
|
1312
713
|
type: raw.type,
|
|
1313
714
|
unavailableReason: raw.unavailableReason
|
|
1314
715
|
});
|
|
1315
716
|
case 13:
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
throw
|
|
717
|
+
_context8.prev = 13;
|
|
718
|
+
_context8.t0 = _context8["catch"](0);
|
|
719
|
+
throw _context8.t0;
|
|
1319
720
|
case 16:
|
|
1320
721
|
case "end":
|
|
1321
|
-
return
|
|
722
|
+
return _context8.stop();
|
|
1322
723
|
}
|
|
1323
|
-
},
|
|
724
|
+
}, _callee8, this, [[0, 13]]);
|
|
1324
725
|
}));
|
|
1325
|
-
function scanPromotionCode(
|
|
726
|
+
function scanPromotionCode(_x3, _x4) {
|
|
1326
727
|
return _scanPromotionCode.apply(this, arguments);
|
|
1327
728
|
}
|
|
1328
729
|
return scanPromotionCode;
|
|
@@ -1330,14 +731,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1330
731
|
}, {
|
|
1331
732
|
key: "setDiscountSelected",
|
|
1332
733
|
value: function () {
|
|
1333
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1334
|
-
var _tempOrder$
|
|
1335
|
-
return _regeneratorRuntime().wrap(function
|
|
1336
|
-
while (1) switch (
|
|
734
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
735
|
+
var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator, _step, d, selectedResourceIds, _iterator2, _step2, _product$metadata, _tempOrder$_extend, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
736
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
737
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1337
738
|
case 0:
|
|
1338
|
-
|
|
739
|
+
_context9.prev = 0;
|
|
1339
740
|
if (this.store.order) {
|
|
1340
|
-
|
|
741
|
+
_context9.next = 3;
|
|
1341
742
|
break;
|
|
1342
743
|
}
|
|
1343
744
|
throw new Error('order 模块未初始化');
|
|
@@ -1349,24 +750,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1349
750
|
isManualSelect: !params.isSelected
|
|
1350
751
|
}) : d;
|
|
1351
752
|
});
|
|
1352
|
-
this.hasManualDiscountSelection = true;
|
|
1353
753
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1354
754
|
orderStore = this.store.order.store || {};
|
|
1355
755
|
discountModule = orderStore.discount;
|
|
1356
756
|
rulesModule = orderStore.rules;
|
|
1357
|
-
holders = (_tempOrder$
|
|
757
|
+
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1358
758
|
form_record_id: tempOrder.holder.form_record_id
|
|
1359
759
|
}] : [];
|
|
1360
760
|
nextDiscountList = updated;
|
|
1361
|
-
|
|
761
|
+
_context9.next = 13;
|
|
1362
762
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1363
|
-
case
|
|
763
|
+
case 13:
|
|
1364
764
|
if (rulesModule) {
|
|
1365
765
|
result = rulesModule.calcDiscount({
|
|
1366
766
|
productList: tempOrder.products,
|
|
1367
767
|
discountList: updated,
|
|
1368
768
|
holders: holders,
|
|
1369
|
-
isFormSubject: !!((_tempOrder$
|
|
769
|
+
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
|
|
1370
770
|
}, {
|
|
1371
771
|
discountId: params.discountId,
|
|
1372
772
|
isSelected: params.isSelected
|
|
@@ -1385,19 +785,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1385
785
|
}).map(function (d) {
|
|
1386
786
|
return d.id;
|
|
1387
787
|
}));
|
|
1388
|
-
|
|
788
|
+
_iterator = _createForOfIteratorHelper(nextDiscountList);
|
|
1389
789
|
try {
|
|
1390
|
-
for (
|
|
1391
|
-
d =
|
|
790
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
791
|
+
d = _step.value;
|
|
1392
792
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1393
793
|
d.isSelected = false;
|
|
1394
|
-
d.isManualSelect = true;
|
|
1395
794
|
}
|
|
1396
795
|
}
|
|
1397
796
|
} catch (err) {
|
|
1398
|
-
|
|
797
|
+
_iterator.e(err);
|
|
1399
798
|
} finally {
|
|
1400
|
-
|
|
799
|
+
_iterator.f();
|
|
1401
800
|
}
|
|
1402
801
|
}
|
|
1403
802
|
}
|
|
@@ -1407,23 +806,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1407
806
|
}).map(function (d) {
|
|
1408
807
|
return d.id;
|
|
1409
808
|
}));
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
case
|
|
1414
|
-
if ((
|
|
1415
|
-
|
|
809
|
+
_iterator2 = _createForOfIteratorHelper(tempOrder.products);
|
|
810
|
+
_context9.prev = 16;
|
|
811
|
+
_iterator2.s();
|
|
812
|
+
case 18:
|
|
813
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
814
|
+
_context9.next = 34;
|
|
1416
815
|
break;
|
|
1417
816
|
}
|
|
1418
|
-
product =
|
|
1419
|
-
productUid = (_product$
|
|
1420
|
-
runtimeOrigin = productUid ? (_tempOrder$
|
|
1421
|
-
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$
|
|
1422
|
-
|
|
817
|
+
product = _step2.value;
|
|
818
|
+
productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
819
|
+
runtimeOrigin = productUid ? (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.productsByUid) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend[productUid]) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.origin : undefined;
|
|
820
|
+
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
|
|
821
|
+
_context9.next = 24;
|
|
1423
822
|
break;
|
|
1424
823
|
}
|
|
1425
|
-
return
|
|
1426
|
-
case
|
|
824
|
+
return _context9.abrupt("continue", 32);
|
|
825
|
+
case 24:
|
|
1427
826
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1428
827
|
var _pd$discount$resource, _pd$discount;
|
|
1429
828
|
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
@@ -1436,7 +835,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1436
835
|
return sum + (pd.amount || 0);
|
|
1437
836
|
}, 0); // TODO 这块逻辑需要拿掉
|
|
1438
837
|
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
1439
|
-
sourcePrice = (_product$metadata$
|
|
838
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1440
839
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1441
840
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1442
841
|
if (product.metadata) {
|
|
@@ -1447,134 +846,66 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1447
846
|
mainPrice: newMainSellingPrice,
|
|
1448
847
|
bundle: product.product_bundle
|
|
1449
848
|
});
|
|
1450
|
-
case
|
|
1451
|
-
|
|
849
|
+
case 32:
|
|
850
|
+
_context9.next = 18;
|
|
1452
851
|
break;
|
|
1453
|
-
case
|
|
1454
|
-
|
|
852
|
+
case 34:
|
|
853
|
+
_context9.next = 39;
|
|
1455
854
|
break;
|
|
1456
|
-
case
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
case
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
return
|
|
1464
|
-
case
|
|
855
|
+
case 36:
|
|
856
|
+
_context9.prev = 36;
|
|
857
|
+
_context9.t0 = _context9["catch"](16);
|
|
858
|
+
_iterator2.e(_context9.t0);
|
|
859
|
+
case 39:
|
|
860
|
+
_context9.prev = 39;
|
|
861
|
+
_iterator2.f();
|
|
862
|
+
return _context9.finish(39);
|
|
863
|
+
case 42:
|
|
1465
864
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1466
|
-
|
|
865
|
+
_context9.next = 45;
|
|
1467
866
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1468
|
-
case
|
|
867
|
+
case 45:
|
|
1469
868
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1470
869
|
return d.isSelected;
|
|
1471
870
|
});
|
|
1472
|
-
|
|
871
|
+
_context9.next = 48;
|
|
1473
872
|
return this.store.order.recalculateSummary({
|
|
1474
873
|
createIfMissing: true
|
|
1475
874
|
});
|
|
1476
|
-
case
|
|
875
|
+
case 48:
|
|
1477
876
|
this.store.order.persistTempOrder();
|
|
1478
|
-
|
|
1479
|
-
productList: tempOrder.products,
|
|
1480
|
-
discountList: nextDiscountList,
|
|
1481
|
-
selectedDiscountList: tempOrder.discount_list,
|
|
1482
|
-
tempOrder: tempOrder
|
|
1483
|
-
});
|
|
1484
|
-
_context14.next = 56;
|
|
877
|
+
_context9.next = 54;
|
|
1485
878
|
break;
|
|
1486
|
-
case
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
throw
|
|
1490
|
-
case
|
|
879
|
+
case 51:
|
|
880
|
+
_context9.prev = 51;
|
|
881
|
+
_context9.t1 = _context9["catch"](0);
|
|
882
|
+
throw _context9.t1;
|
|
883
|
+
case 54:
|
|
1491
884
|
case "end":
|
|
1492
|
-
return
|
|
885
|
+
return _context9.stop();
|
|
1493
886
|
}
|
|
1494
|
-
},
|
|
887
|
+
}, _callee9, this, [[0, 51], [16, 36, 39, 42]]);
|
|
1495
888
|
}));
|
|
1496
|
-
function setDiscountSelected(
|
|
889
|
+
function setDiscountSelected(_x5) {
|
|
1497
890
|
return _setDiscountSelected.apply(this, arguments);
|
|
1498
891
|
}
|
|
1499
892
|
return setDiscountSelected;
|
|
1500
893
|
}()
|
|
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
|
-
}()
|
|
1563
894
|
}, {
|
|
1564
895
|
key: "submitScanOrder",
|
|
1565
896
|
value: function () {
|
|
1566
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1567
|
-
return _regeneratorRuntime().wrap(function
|
|
1568
|
-
while (1) switch (
|
|
897
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
898
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
899
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1569
900
|
case 0:
|
|
1570
|
-
return
|
|
901
|
+
return _context10.abrupt("return", this.submitSalesOrder(params));
|
|
1571
902
|
case 1:
|
|
1572
903
|
case "end":
|
|
1573
|
-
return
|
|
904
|
+
return _context10.stop();
|
|
1574
905
|
}
|
|
1575
|
-
},
|
|
906
|
+
}, _callee10, this);
|
|
1576
907
|
}));
|
|
1577
|
-
function submitScanOrder(
|
|
908
|
+
function submitScanOrder(_x6) {
|
|
1578
909
|
return _submitScanOrder.apply(this, arguments);
|
|
1579
910
|
}
|
|
1580
911
|
return submitScanOrder;
|
|
@@ -1588,14 +919,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1588
919
|
}, {
|
|
1589
920
|
key: "submitSalesOrder",
|
|
1590
921
|
value: (function () {
|
|
1591
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1592
|
-
var _this$
|
|
922
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
923
|
+
var _this$otherParams2, _this$otherParams3, _this$otherParams4, _this$otherParams5;
|
|
1593
924
|
var submitParams;
|
|
1594
|
-
return _regeneratorRuntime().wrap(function
|
|
1595
|
-
while (1) switch (
|
|
925
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
926
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1596
927
|
case 0:
|
|
1597
928
|
if (this.store.order) {
|
|
1598
|
-
|
|
929
|
+
_context11.next = 2;
|
|
1599
930
|
break;
|
|
1600
931
|
}
|
|
1601
932
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -1603,10 +934,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
934
|
this.store.order.persistTempOrder();
|
|
1604
935
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1605
936
|
cacheId: this.cacheId,
|
|
1606
|
-
platform: (_this$
|
|
1607
|
-
businessCode: (_this$
|
|
1608
|
-
channel: this.
|
|
1609
|
-
type: (_this$
|
|
937
|
+
platform: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform,
|
|
938
|
+
businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode,
|
|
939
|
+
channel: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.channel,
|
|
940
|
+
type: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.type
|
|
1610
941
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1611
942
|
payments: params.payments
|
|
1612
943
|
} : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
|
|
@@ -1616,15 +947,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1616
947
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
1617
948
|
enhancePayload: params.enhancePayload
|
|
1618
949
|
} : {});
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
case 6:
|
|
950
|
+
return _context11.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
951
|
+
case 5:
|
|
1622
952
|
case "end":
|
|
1623
|
-
return
|
|
953
|
+
return _context11.stop();
|
|
1624
954
|
}
|
|
1625
|
-
},
|
|
955
|
+
}, _callee11, this);
|
|
1626
956
|
}));
|
|
1627
|
-
function submitSalesOrder(
|
|
957
|
+
function submitSalesOrder(_x7) {
|
|
1628
958
|
return _submitSalesOrder.apply(this, arguments);
|
|
1629
959
|
}
|
|
1630
960
|
return submitSalesOrder;
|
|
@@ -1632,75 +962,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1632
962
|
}, {
|
|
1633
963
|
key: "syncPaymentsToOrder",
|
|
1634
964
|
value: function () {
|
|
1635
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1639
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
965
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
967
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1640
968
|
case 0:
|
|
1641
969
|
if (this.store.order) {
|
|
1642
|
-
|
|
970
|
+
_context12.next = 2;
|
|
1643
971
|
break;
|
|
1644
972
|
}
|
|
1645
973
|
throw new Error('order 模块未初始化');
|
|
1646
974
|
case 2:
|
|
1647
|
-
|
|
1648
|
-
|
|
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:
|
|
975
|
+
return _context12.abrupt("return", this.store.order.syncPaymentsToOrder(params));
|
|
976
|
+
case 3:
|
|
1698
977
|
case "end":
|
|
1699
|
-
return
|
|
978
|
+
return _context12.stop();
|
|
1700
979
|
}
|
|
1701
|
-
},
|
|
980
|
+
}, _callee12, this);
|
|
1702
981
|
}));
|
|
1703
|
-
function syncPaymentsToOrder(
|
|
982
|
+
function syncPaymentsToOrder(_x8) {
|
|
1704
983
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
1705
984
|
}
|
|
1706
985
|
return syncPaymentsToOrder;
|
|
@@ -1724,25 +1003,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1724
1003
|
}, {
|
|
1725
1004
|
key: "addOrderPayment",
|
|
1726
1005
|
value: function addOrderPayment(payment) {
|
|
1727
|
-
var _this5 = this;
|
|
1728
1006
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1729
|
-
|
|
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;
|
|
1007
|
+
return this.store.order.addOrderPayment(payment);
|
|
1746
1008
|
}
|
|
1747
1009
|
|
|
1748
1010
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -1771,8 +1033,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1771
1033
|
}, {
|
|
1772
1034
|
key: "getWalletProductList",
|
|
1773
1035
|
value: function getWalletProductList() {
|
|
1774
|
-
var _this$store$
|
|
1775
|
-
var tempOrder = (_this$store$
|
|
1036
|
+
var _this$store$order2, _tempOrder$products;
|
|
1037
|
+
var tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder();
|
|
1776
1038
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1777
1039
|
return tempOrder.products.map(function (product) {
|
|
1778
1040
|
var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
@@ -1785,7 +1047,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1785
1047
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
1786
1048
|
tax_fee: product.tax_fee,
|
|
1787
1049
|
selling_price: Number(product.selling_price || 0),
|
|
1788
|
-
discount_list: product.discount_list || [],
|
|
1789
1050
|
holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
|
|
1790
1051
|
original_price: product.original_price,
|
|
1791
1052
|
main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
|
|
@@ -1796,14 +1057,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1796
1057
|
surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
|
|
1797
1058
|
},
|
|
1798
1059
|
product_bundle: (product.product_bundle || []).map(function (bundle) {
|
|
1799
|
-
var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
|
|
1800
1060
|
var bundleMetadata = bundle.metadata || {};
|
|
1801
1061
|
return {
|
|
1802
1062
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
1803
|
-
|
|
1804
|
-
|
|
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,
|
|
1063
|
+
bundle_id: bundle.bundle_id,
|
|
1064
|
+
bundle_product_id: bundle.bundle_product_id,
|
|
1807
1065
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
1808
1066
|
price_type: bundle.price_type,
|
|
1809
1067
|
price_type_ext: bundle.price_type_ext,
|
|
@@ -1824,20 +1082,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1824
1082
|
}, {
|
|
1825
1083
|
key: "initWalletData",
|
|
1826
1084
|
value: function () {
|
|
1827
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1085
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
|
|
1828
1086
|
var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
|
|
1829
1087
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
1830
|
-
return _regeneratorRuntime().wrap(function
|
|
1831
|
-
while (1) switch (
|
|
1088
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1089
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1832
1090
|
case 0:
|
|
1833
1091
|
if (this.store.order) {
|
|
1834
|
-
|
|
1092
|
+
_context13.next = 2;
|
|
1835
1093
|
break;
|
|
1836
1094
|
}
|
|
1837
1095
|
throw new Error('order 模块未初始化');
|
|
1838
1096
|
case 2:
|
|
1839
1097
|
if (this.store.payment) {
|
|
1840
|
-
|
|
1098
|
+
_context13.next = 4;
|
|
1841
1099
|
break;
|
|
1842
1100
|
}
|
|
1843
1101
|
throw new Error('payment 模块未初始化');
|
|
@@ -1846,10 +1104,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1846
1104
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
1847
1105
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
1848
1106
|
if (!(!tempOrder || !amount)) {
|
|
1849
|
-
|
|
1107
|
+
_context13.next = 9;
|
|
1850
1108
|
break;
|
|
1851
1109
|
}
|
|
1852
|
-
return
|
|
1110
|
+
return _context13.abrupt("return", {
|
|
1853
1111
|
walletRecommendList: [],
|
|
1854
1112
|
userIdentificationCodes: [],
|
|
1855
1113
|
transformList: [],
|
|
@@ -1872,11 +1130,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1872
1130
|
}, snapshot.identity.orderId ? {
|
|
1873
1131
|
payment_order_id: String(snapshot.identity.orderId)
|
|
1874
1132
|
} : {});
|
|
1875
|
-
|
|
1133
|
+
_context13.next = 12;
|
|
1876
1134
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
1877
1135
|
case 12:
|
|
1878
|
-
result =
|
|
1879
|
-
|
|
1136
|
+
result = _context13.sent;
|
|
1137
|
+
_context13.next = 15;
|
|
1880
1138
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
1881
1139
|
orderId: snapshot.identity.orderId,
|
|
1882
1140
|
customerId: walletBusinessData.customer_id,
|
|
@@ -1888,14 +1146,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1888
1146
|
timestamp: Date.now()
|
|
1889
1147
|
});
|
|
1890
1148
|
case 15:
|
|
1891
|
-
return
|
|
1149
|
+
return _context13.abrupt("return", result);
|
|
1892
1150
|
case 16:
|
|
1893
1151
|
case "end":
|
|
1894
|
-
return
|
|
1152
|
+
return _context13.stop();
|
|
1895
1153
|
}
|
|
1896
|
-
},
|
|
1154
|
+
}, _callee13, this);
|
|
1897
1155
|
}));
|
|
1898
|
-
function initWalletData(
|
|
1156
|
+
function initWalletData(_x9) {
|
|
1899
1157
|
return _initWalletData.apply(this, arguments);
|
|
1900
1158
|
}
|
|
1901
1159
|
return initWalletData;
|
|
@@ -1922,27 +1180,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1922
1180
|
}, {
|
|
1923
1181
|
key: "getPaymentMethodsAsync",
|
|
1924
1182
|
value: (function () {
|
|
1925
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1183
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1926
1184
|
var response;
|
|
1927
|
-
return _regeneratorRuntime().wrap(function
|
|
1928
|
-
while (1) switch (
|
|
1185
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1186
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1929
1187
|
case 0:
|
|
1930
1188
|
if (!this.store.payment) {
|
|
1931
|
-
|
|
1189
|
+
_context14.next = 2;
|
|
1932
1190
|
break;
|
|
1933
1191
|
}
|
|
1934
|
-
return
|
|
1192
|
+
return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
|
|
1935
1193
|
case 2:
|
|
1936
|
-
|
|
1194
|
+
_context14.next = 4;
|
|
1937
1195
|
return this.request.get('/pay/custom-payment/all');
|
|
1938
1196
|
case 4:
|
|
1939
|
-
response =
|
|
1940
|
-
return
|
|
1197
|
+
response = _context14.sent;
|
|
1198
|
+
return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
|
|
1941
1199
|
case 6:
|
|
1942
1200
|
case "end":
|
|
1943
|
-
return
|
|
1201
|
+
return _context14.stop();
|
|
1944
1202
|
}
|
|
1945
|
-
},
|
|
1203
|
+
}, _callee14, this);
|
|
1946
1204
|
}));
|
|
1947
1205
|
function getPaymentMethodsAsync() {
|
|
1948
1206
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -1983,49 +1241,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1983
1241
|
}, {
|
|
1984
1242
|
key: "sendCustomerPayLink",
|
|
1985
1243
|
value: (function () {
|
|
1986
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1244
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1987
1245
|
var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
1988
|
-
return _regeneratorRuntime().wrap(function
|
|
1989
|
-
while (1) switch (
|
|
1246
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1247
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1990
1248
|
case 0:
|
|
1991
1249
|
if (this.store.order) {
|
|
1992
|
-
|
|
1250
|
+
_context15.next = 2;
|
|
1993
1251
|
break;
|
|
1994
1252
|
}
|
|
1995
1253
|
throw new Error('order 模块未初始化');
|
|
1996
1254
|
case 2:
|
|
1997
1255
|
orderIds = params.order_ids || params.orderIds || [];
|
|
1998
1256
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
1999
|
-
|
|
1257
|
+
_context15.next = 11;
|
|
2000
1258
|
break;
|
|
2001
1259
|
}
|
|
2002
|
-
|
|
1260
|
+
_context15.next = 6;
|
|
2003
1261
|
return this.submitSalesOrder({
|
|
2004
1262
|
smallTicketDataFlag: 1
|
|
2005
1263
|
});
|
|
2006
1264
|
case 6:
|
|
2007
|
-
submitResult =
|
|
1265
|
+
submitResult = _context15.sent;
|
|
2008
1266
|
orderId = (_ref2 = (_ref3 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref3 !== void 0 ? _ref3 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref2 !== void 0 ? _ref2 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2009
1267
|
if (orderId) {
|
|
2010
|
-
|
|
1268
|
+
_context15.next = 10;
|
|
2011
1269
|
break;
|
|
2012
1270
|
}
|
|
2013
1271
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2014
1272
|
case 10:
|
|
2015
1273
|
orderIds = [orderId];
|
|
2016
1274
|
case 11:
|
|
2017
|
-
return
|
|
1275
|
+
return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2018
1276
|
emails: params.emails,
|
|
2019
1277
|
notify_action: params.notify_action,
|
|
2020
1278
|
order_ids: orderIds
|
|
2021
1279
|
}));
|
|
2022
1280
|
case 12:
|
|
2023
1281
|
case "end":
|
|
2024
|
-
return
|
|
1282
|
+
return _context15.stop();
|
|
2025
1283
|
}
|
|
2026
|
-
},
|
|
1284
|
+
}, _callee15, this);
|
|
2027
1285
|
}));
|
|
2028
|
-
function sendCustomerPayLink(
|
|
1286
|
+
function sendCustomerPayLink(_x10) {
|
|
2029
1287
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2030
1288
|
}
|
|
2031
1289
|
return sendCustomerPayLink;
|
|
@@ -2035,155 +1293,76 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2035
1293
|
value: function transformBaseProductToOrderProduct(params) {
|
|
2036
1294
|
return _transformBaseProductToOrderProduct(params);
|
|
2037
1295
|
}
|
|
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
|
-
}()
|
|
2071
1296
|
}, {
|
|
2072
1297
|
key: "addProductToOrder",
|
|
2073
1298
|
value: function () {
|
|
2074
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1299
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
|
|
2075
1300
|
var products;
|
|
2076
|
-
return _regeneratorRuntime().wrap(function
|
|
2077
|
-
while (1) switch (
|
|
1301
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1302
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2078
1303
|
case 0:
|
|
2079
|
-
|
|
1304
|
+
_context16.prev = 0;
|
|
2080
1305
|
if (this.store.order) {
|
|
2081
|
-
|
|
1306
|
+
_context16.next = 3;
|
|
2082
1307
|
break;
|
|
2083
1308
|
}
|
|
2084
1309
|
throw new Error('order 模块未初始化');
|
|
2085
1310
|
case 3:
|
|
2086
|
-
|
|
1311
|
+
_context16.next = 5;
|
|
2087
1312
|
return this.store.order.addProductToOrder(product, booking);
|
|
2088
1313
|
case 5:
|
|
2089
|
-
products =
|
|
2090
|
-
return
|
|
1314
|
+
products = _context16.sent;
|
|
1315
|
+
return _context16.abrupt("return", products);
|
|
2091
1316
|
case 9:
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
throw
|
|
1317
|
+
_context16.prev = 9;
|
|
1318
|
+
_context16.t0 = _context16["catch"](0);
|
|
1319
|
+
throw _context16.t0;
|
|
2095
1320
|
case 12:
|
|
2096
1321
|
case "end":
|
|
2097
|
-
return
|
|
1322
|
+
return _context16.stop();
|
|
2098
1323
|
}
|
|
2099
|
-
},
|
|
1324
|
+
}, _callee16, this, [[0, 9]]);
|
|
2100
1325
|
}));
|
|
2101
|
-
function addProductToOrder(
|
|
1326
|
+
function addProductToOrder(_x11, _x12) {
|
|
2102
1327
|
return _addProductToOrder.apply(this, arguments);
|
|
2103
1328
|
}
|
|
2104
1329
|
return addProductToOrder;
|
|
2105
1330
|
}()
|
|
2106
1331
|
}, {
|
|
2107
|
-
key: "
|
|
1332
|
+
key: "updateProductInOrder",
|
|
2108
1333
|
value: function () {
|
|
2109
|
-
var
|
|
1334
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2110
1335
|
var products;
|
|
2111
|
-
return _regeneratorRuntime().wrap(function
|
|
2112
|
-
while (1) switch (
|
|
2113
|
-
case 0:
|
|
2114
|
-
_context24.prev = 0;
|
|
2115
|
-
if (this.store.order) {
|
|
2116
|
-
_context24.next = 3;
|
|
2117
|
-
break;
|
|
2118
|
-
}
|
|
2119
|
-
throw new Error('order 模块未初始化');
|
|
2120
|
-
case 3:
|
|
2121
|
-
_context24.next = 5;
|
|
2122
|
-
return this.store.order.updateOrderProduct(params);
|
|
2123
|
-
case 5:
|
|
2124
|
-
products = _context24.sent;
|
|
2125
|
-
return _context24.abrupt("return", products);
|
|
2126
|
-
case 9:
|
|
2127
|
-
_context24.prev = 9;
|
|
2128
|
-
_context24.t0 = _context24["catch"](0);
|
|
2129
|
-
throw _context24.t0;
|
|
2130
|
-
case 12:
|
|
2131
|
-
case "end":
|
|
2132
|
-
return _context24.stop();
|
|
2133
|
-
}
|
|
2134
|
-
}, _callee24, this, [[0, 9]]);
|
|
2135
|
-
}));
|
|
2136
|
-
function updateOrderProduct(_x19) {
|
|
2137
|
-
return _updateOrderProduct.apply(this, arguments);
|
|
2138
|
-
}
|
|
2139
|
-
return updateOrderProduct;
|
|
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) {
|
|
1336
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1337
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2148
1338
|
case 0:
|
|
2149
|
-
|
|
1339
|
+
_context17.prev = 0;
|
|
2150
1340
|
if (this.store.order) {
|
|
2151
|
-
|
|
1341
|
+
_context17.next = 3;
|
|
2152
1342
|
break;
|
|
2153
1343
|
}
|
|
2154
1344
|
throw new Error('order 模块未初始化');
|
|
2155
1345
|
case 3:
|
|
2156
|
-
|
|
2157
|
-
return this.store.order.
|
|
1346
|
+
_context17.next = 5;
|
|
1347
|
+
return this.store.order.updateProductInOrder(params);
|
|
2158
1348
|
case 5:
|
|
2159
|
-
products =
|
|
2160
|
-
return
|
|
1349
|
+
products = _context17.sent;
|
|
1350
|
+
return _context17.abrupt("return", products);
|
|
2161
1351
|
case 9:
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
throw
|
|
1352
|
+
_context17.prev = 9;
|
|
1353
|
+
_context17.t0 = _context17["catch"](0);
|
|
1354
|
+
throw _context17.t0;
|
|
2165
1355
|
case 12:
|
|
2166
1356
|
case "end":
|
|
2167
|
-
return
|
|
1357
|
+
return _context17.stop();
|
|
2168
1358
|
}
|
|
2169
|
-
},
|
|
1359
|
+
}, _callee17, this, [[0, 9]]);
|
|
2170
1360
|
}));
|
|
2171
|
-
function
|
|
2172
|
-
return
|
|
1361
|
+
function updateProductInOrder(_x13) {
|
|
1362
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
2173
1363
|
}
|
|
2174
|
-
return
|
|
1364
|
+
return updateProductInOrder;
|
|
2175
1365
|
}()
|
|
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
|
-
|
|
2187
1366
|
/**
|
|
2188
1367
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
2189
1368
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|
|
@@ -2191,12 +1370,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2191
1370
|
}, {
|
|
2192
1371
|
key: "setOrderProductLineNote",
|
|
2193
1372
|
value: (function () {
|
|
2194
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1373
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
|
|
2195
1374
|
var params, products;
|
|
2196
|
-
return _regeneratorRuntime().wrap(function
|
|
2197
|
-
while (1) switch (
|
|
1375
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1376
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2198
1377
|
case 0:
|
|
2199
|
-
|
|
1378
|
+
_context18.prev = 0;
|
|
2200
1379
|
params = {
|
|
2201
1380
|
product_id: identity.product_id,
|
|
2202
1381
|
product_variant_id: identity.product_variant_id,
|
|
@@ -2211,22 +1390,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2211
1390
|
params.product_option_item = identity.product_option_item;
|
|
2212
1391
|
}
|
|
2213
1392
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
2214
|
-
|
|
2215
|
-
return this.
|
|
1393
|
+
_context18.next = 7;
|
|
1394
|
+
return this.updateProductInOrder(params);
|
|
2216
1395
|
case 7:
|
|
2217
|
-
products =
|
|
2218
|
-
return
|
|
1396
|
+
products = _context18.sent;
|
|
1397
|
+
return _context18.abrupt("return", products);
|
|
2219
1398
|
case 11:
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
throw
|
|
1399
|
+
_context18.prev = 11;
|
|
1400
|
+
_context18.t0 = _context18["catch"](0);
|
|
1401
|
+
throw _context18.t0;
|
|
2223
1402
|
case 14:
|
|
2224
1403
|
case "end":
|
|
2225
|
-
return
|
|
1404
|
+
return _context18.stop();
|
|
2226
1405
|
}
|
|
2227
|
-
},
|
|
1406
|
+
}, _callee18, this, [[0, 11]]);
|
|
2228
1407
|
}));
|
|
2229
|
-
function setOrderProductLineNote(
|
|
1408
|
+
function setOrderProductLineNote(_x14, _x15) {
|
|
2230
1409
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
2231
1410
|
}
|
|
2232
1411
|
return setOrderProductLineNote;
|
|
@@ -2234,34 +1413,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2234
1413
|
}, {
|
|
2235
1414
|
key: "removeProductFromOrder",
|
|
2236
1415
|
value: function () {
|
|
2237
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1416
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
|
|
2238
1417
|
var products;
|
|
2239
|
-
return _regeneratorRuntime().wrap(function
|
|
2240
|
-
while (1) switch (
|
|
1418
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1419
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2241
1420
|
case 0:
|
|
2242
|
-
|
|
1421
|
+
_context19.prev = 0;
|
|
2243
1422
|
if (this.store.order) {
|
|
2244
|
-
|
|
1423
|
+
_context19.next = 3;
|
|
2245
1424
|
break;
|
|
2246
1425
|
}
|
|
2247
1426
|
throw new Error('order 模块未初始化');
|
|
2248
1427
|
case 3:
|
|
2249
|
-
|
|
1428
|
+
_context19.next = 5;
|
|
2250
1429
|
return this.store.order.removeProductFromOrder(identity);
|
|
2251
1430
|
case 5:
|
|
2252
|
-
products =
|
|
2253
|
-
return
|
|
1431
|
+
products = _context19.sent;
|
|
1432
|
+
return _context19.abrupt("return", products);
|
|
2254
1433
|
case 9:
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
throw
|
|
1434
|
+
_context19.prev = 9;
|
|
1435
|
+
_context19.t0 = _context19["catch"](0);
|
|
1436
|
+
throw _context19.t0;
|
|
2258
1437
|
case 12:
|
|
2259
1438
|
case "end":
|
|
2260
|
-
return
|
|
1439
|
+
return _context19.stop();
|
|
2261
1440
|
}
|
|
2262
|
-
},
|
|
1441
|
+
}, _callee19, this, [[0, 9]]);
|
|
2263
1442
|
}));
|
|
2264
|
-
function removeProductFromOrder(
|
|
1443
|
+
function removeProductFromOrder(_x16) {
|
|
2265
1444
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2266
1445
|
}
|
|
2267
1446
|
return removeProductFromOrder;
|
|
@@ -2270,18 +1449,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2270
1449
|
}, {
|
|
2271
1450
|
key: "getProductList",
|
|
2272
1451
|
value: function () {
|
|
2273
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2274
|
-
var _this$
|
|
1452
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1453
|
+
var _this$otherParams6;
|
|
2275
1454
|
var menu_list_ids, _this$store$products, res;
|
|
2276
|
-
return _regeneratorRuntime().wrap(function
|
|
2277
|
-
while (1) switch (
|
|
1455
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1456
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2278
1457
|
case 0:
|
|
2279
1458
|
// 可以直接通过配置里的 menu 读取
|
|
2280
|
-
menu_list_ids = ((_this$
|
|
1459
|
+
menu_list_ids = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.dineInConfig) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus'].map(function (n) {
|
|
2281
1460
|
return Number(n.value);
|
|
2282
1461
|
})) || [];
|
|
2283
|
-
|
|
2284
|
-
|
|
1462
|
+
_context20.prev = 1;
|
|
1463
|
+
_context20.next = 4;
|
|
2285
1464
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2286
1465
|
menu_list_ids: menu_list_ids,
|
|
2287
1466
|
cacheId: this.cacheId,
|
|
@@ -2289,17 +1468,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2289
1468
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2290
1469
|
});
|
|
2291
1470
|
case 4:
|
|
2292
|
-
res =
|
|
2293
|
-
return
|
|
1471
|
+
res = _context20.sent;
|
|
1472
|
+
return _context20.abrupt("return", res);
|
|
2294
1473
|
case 8:
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
throw
|
|
1474
|
+
_context20.prev = 8;
|
|
1475
|
+
_context20.t0 = _context20["catch"](1);
|
|
1476
|
+
throw _context20.t0;
|
|
2298
1477
|
case 11:
|
|
2299
1478
|
case "end":
|
|
2300
|
-
return
|
|
1479
|
+
return _context20.stop();
|
|
2301
1480
|
}
|
|
2302
|
-
},
|
|
1481
|
+
}, _callee20, this, [[1, 8]]);
|
|
2303
1482
|
}));
|
|
2304
1483
|
function getProductList() {
|
|
2305
1484
|
return _getProductList.apply(this, arguments);
|
|
@@ -2314,15 +1493,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2314
1493
|
}, {
|
|
2315
1494
|
key: "setOtherParams",
|
|
2316
1495
|
value: function () {
|
|
2317
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1496
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2318
1497
|
var _ref4,
|
|
2319
1498
|
_ref4$cover,
|
|
2320
1499
|
cover,
|
|
2321
|
-
|
|
2322
|
-
return _regeneratorRuntime().wrap(function
|
|
2323
|
-
while (1) switch (
|
|
1500
|
+
_args21 = arguments;
|
|
1501
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1502
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2324
1503
|
case 0:
|
|
2325
|
-
_ref4 =
|
|
1504
|
+
_ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
2326
1505
|
if (cover) {
|
|
2327
1506
|
this.otherParams = params;
|
|
2328
1507
|
} else {
|
|
@@ -2330,11 +1509,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2330
1509
|
}
|
|
2331
1510
|
case 2:
|
|
2332
1511
|
case "end":
|
|
2333
|
-
return
|
|
1512
|
+
return _context21.stop();
|
|
2334
1513
|
}
|
|
2335
|
-
},
|
|
1514
|
+
}, _callee21, this);
|
|
2336
1515
|
}));
|
|
2337
|
-
function setOtherParams(
|
|
1516
|
+
function setOtherParams(_x17) {
|
|
2338
1517
|
return _setOtherParams.apply(this, arguments);
|
|
2339
1518
|
}
|
|
2340
1519
|
return setOtherParams;
|