@pisell/pisellos 2.2.262 → 2.2.264
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/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -16
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +1 -32
- package/dist/modules/Discount/index.d.ts +2 -5
- package/dist/modules/Discount/index.js +7 -30
- package/dist/modules/Discount/types.d.ts +0 -4
- package/dist/modules/Order/index.d.ts +2 -14
- package/dist/modules/Order/index.js +736 -1035
- package/dist/modules/Order/types.d.ts +0 -16
- package/dist/modules/Order/utils.d.ts +3 -4
- package/dist/modules/Order/utils.js +61 -54
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/modules/Rules/index.d.ts +9 -2
- package/dist/modules/Rules/index.js +43 -69
- package/dist/modules/Rules/types.d.ts +1 -10
- package/dist/server/index.d.ts +0 -55
- package/dist/server/index.js +742 -1161
- package/dist/server/modules/order/index.d.ts +4 -10
- package/dist/server/modules/order/index.js +399 -404
- package/dist/server/modules/order/types.d.ts +0 -4
- package/dist/server/modules/products/index.d.ts +8 -31
- package/dist/server/modules/products/index.js +390 -549
- package/dist/server/modules/products/types.d.ts +0 -18
- package/dist/solution/BaseSales/index.d.ts +1 -21
- package/dist/solution/BaseSales/index.js +789 -1136
- package/dist/solution/BaseSales/types.d.ts +1 -6
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +97 -50
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +8 -6
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -14
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +25 -59
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/ShopDiscount/index.js +14 -15
- package/dist/solution/VenueBooking/index.js +30 -19
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +51 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -5
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +2 -23
- package/lib/modules/Discount/index.d.ts +2 -5
- package/lib/modules/Discount/index.js +3 -23
- package/lib/modules/Discount/types.d.ts +0 -4
- package/lib/modules/Order/index.d.ts +2 -14
- package/lib/modules/Order/index.js +60 -326
- package/lib/modules/Order/types.d.ts +0 -16
- package/lib/modules/Order/utils.d.ts +3 -4
- package/lib/modules/Order/utils.js +23 -22
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/modules/Rules/index.d.ts +9 -2
- package/lib/modules/Rules/index.js +29 -61
- package/lib/modules/Rules/types.d.ts +1 -10
- package/lib/server/index.d.ts +0 -55
- package/lib/server/index.js +31 -327
- package/lib/server/modules/order/index.d.ts +4 -10
- package/lib/server/modules/order/index.js +139 -198
- package/lib/server/modules/order/types.d.ts +0 -4
- package/lib/server/modules/products/index.d.ts +8 -31
- package/lib/server/modules/products/index.js +35 -134
- package/lib/server/modules/products/types.d.ts +0 -18
- package/lib/solution/BaseSales/index.d.ts +1 -21
- package/lib/solution/BaseSales/index.js +72 -313
- package/lib/solution/BaseSales/types.d.ts +1 -6
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +64 -25
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +5 -4
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -8
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +8 -33
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/VenueBooking/index.js +8 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
- package/dist/modules/Order/utils/orderCollectionIdentity.js +0 -405
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -415
|
@@ -1,7 +1,10 @@
|
|
|
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; } } }; }
|
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
4
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
5
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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; }
|
|
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; }
|
|
5
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
6
9
|
function 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); } }
|
|
7
10
|
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); }); }; }
|
|
@@ -17,18 +20,15 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
17
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
|
+
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); }
|
|
20
26
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
27
|
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."); }
|
|
28
|
+
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); }
|
|
22
29
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
23
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
-
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; } } }; }
|
|
25
|
-
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); }
|
|
26
31
|
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; }
|
|
27
|
-
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; }
|
|
28
|
-
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; }
|
|
29
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
30
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
31
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
32
32
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
33
33
|
import { BaseModule } from "../../modules/BaseModule";
|
|
34
34
|
import { BaseSalesHookNames } from "./types";
|
|
@@ -37,7 +37,6 @@ import Decimal from 'decimal.js';
|
|
|
37
37
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
39
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
|
-
import { applyOrderCollectionUidRemaps, getOrderCollectionPersistentId, getOrderCollectionReferenceUid, getOrderCollectionUid, isSameOrderCollectionItem, mergeOrderCollectionItems, normalizeOrderCollection, normalizeOrderCollections, setOrderCollectionUid } from "../../modules/Order/utils/orderCollectionIdentity";
|
|
41
40
|
import dayjs from 'dayjs';
|
|
42
41
|
export * from "./types";
|
|
43
42
|
import { QuotationModule } from "../../modules/Quotation";
|
|
@@ -72,15 +71,9 @@ function preserveManualProductDiscountProducts(previousProducts, nextProducts) {
|
|
|
72
71
|
function isBaseSalesHistoricalDiscountEntry(discount) {
|
|
73
72
|
return Boolean((discount === null || discount === void 0 ? void 0 : discount.isEditMode) || (discount === null || discount === void 0 ? void 0 : discount.isDisabled) || (discount === null || discount === void 0 ? void 0 : discount.order_discount_id) != null);
|
|
74
73
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
payment: 'order_payment_id'
|
|
79
|
-
};
|
|
80
|
-
function getBaseSalesOrderCollectionKind(key) {
|
|
81
|
-
if (key === 'products') return 'product';
|
|
82
|
-
if (key === 'bookings') return 'booking';
|
|
83
|
-
if (key === 'payments' || key === 'payment') return 'payment';
|
|
74
|
+
function getBaseSalesUniqueArrayMetadataKey(key) {
|
|
75
|
+
if (key === 'products' || key === 'bookings') return 'unique_identification_number';
|
|
76
|
+
if (key === 'payments' || key === 'payment') return 'unique_payment_number';
|
|
84
77
|
return null;
|
|
85
78
|
}
|
|
86
79
|
function isSameBaseSalesOrderRecord(left, right) {
|
|
@@ -93,119 +86,42 @@ function isSameBaseSalesOrderRecord(left, right) {
|
|
|
93
86
|
return value !== undefined && value !== null && value !== '' && leftIdentities.has(String(value));
|
|
94
87
|
});
|
|
95
88
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var mergedItem = cloneDeep(loadedItem);
|
|
102
|
-
if (isBaseSalesBlankValue(mergedItem.product_cover) && !isBaseSalesBlankValue(currentItem === null || currentItem === void 0 ? void 0 : currentItem.product_cover)) {
|
|
103
|
-
mergedItem.product_cover = currentItem.product_cover;
|
|
104
|
-
}
|
|
105
|
-
var currentHolderConfig = currentItem === null || currentItem === void 0 || (_currentItem$metadata = currentItem.metadata) === null || _currentItem$metadata === void 0 ? void 0 : _currentItem$metadata.holder_config;
|
|
106
|
-
if ((((_mergedItem$metadata = mergedItem.metadata) === null || _mergedItem$metadata === void 0 ? void 0 : _mergedItem$metadata.holder_config) === undefined || ((_mergedItem$metadata2 = mergedItem.metadata) === null || _mergedItem$metadata2 === void 0 ? void 0 : _mergedItem$metadata2.holder_config) === null) && currentHolderConfig !== undefined && currentHolderConfig !== null) {
|
|
107
|
-
mergedItem.metadata = _objectSpread(_objectSpread({}, mergedItem.metadata || {}), {}, {
|
|
108
|
-
holder_config: currentHolderConfig
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return mergedItem;
|
|
89
|
+
function getBaseSalesMetadataUid(item, metadataKey) {
|
|
90
|
+
var _item$metadata$metada, _item$metadata;
|
|
91
|
+
var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
|
|
92
|
+
if (uid === undefined || uid === null || uid === '') return null;
|
|
93
|
+
return String(uid);
|
|
112
94
|
}
|
|
113
|
-
function
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
123
|
-
var from = _step.value;
|
|
124
|
-
if (!from || from === mergedUid) continue;
|
|
125
|
-
uidRemaps.push({
|
|
126
|
-
kind: kind,
|
|
127
|
-
from: from,
|
|
128
|
-
to: mergedUid,
|
|
129
|
-
persistentId: getOrderCollectionPersistentId(kind, incomingItem) || getOrderCollectionPersistentId(kind, currentItem)
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
} catch (err) {
|
|
133
|
-
_iterator.e(err);
|
|
134
|
-
} finally {
|
|
135
|
-
_iterator.f();
|
|
95
|
+
function mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey) {
|
|
96
|
+
var result = [];
|
|
97
|
+
var indexByUid = new Map();
|
|
98
|
+
var appendOrReplaceByUid = function appendOrReplaceByUid(item) {
|
|
99
|
+
var clonedItem = cloneDeep(item);
|
|
100
|
+
var uid = getBaseSalesMetadataUid(clonedItem, metadataKey);
|
|
101
|
+
if (!uid) {
|
|
102
|
+
result.push(clonedItem);
|
|
103
|
+
return;
|
|
136
104
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
|
|
141
|
-
mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
|
|
142
|
-
}
|
|
143
|
-
return kind === 'product' ? mergeBaseSalesProductSnapshotFields(currentItem, mergedItem) : mergedItem;
|
|
144
|
-
}
|
|
145
|
-
function mergeBaseSalesOrderCollection(kind, currentValue, incomingValue, strategy, uidRemaps) {
|
|
146
|
-
var currentItems = normalizeOrderCollection(kind, currentValue, {
|
|
147
|
-
ensureUid: false
|
|
148
|
-
}).items;
|
|
149
|
-
var incomingItems = normalizeOrderCollection(kind, incomingValue, {
|
|
150
|
-
ensureUid: false
|
|
151
|
-
}).items;
|
|
152
|
-
if (strategy === 'authoritative-incoming') {
|
|
153
|
-
var _result = cloneDeep(incomingItems);
|
|
154
|
-
currentItems.forEach(function (currentItem) {
|
|
155
|
-
var incomingIndex = _result.findIndex(function (incomingItem) {
|
|
156
|
-
return isSameOrderCollectionItem(kind, currentItem, incomingItem);
|
|
157
|
-
});
|
|
158
|
-
if (incomingIndex !== -1) {
|
|
159
|
-
_result[incomingIndex] = mergeBaseSalesCollectionItem(kind, currentItem, _result[incomingIndex], uidRemaps);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// 完整服务端快照负责已落库行;仅保留尚未提交的本地新行。
|
|
164
|
-
if (!getOrderCollectionPersistentId(kind, currentItem)) {
|
|
165
|
-
_result.push(cloneDeep(currentItem));
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
return _result;
|
|
169
|
-
}
|
|
170
|
-
var result = cloneDeep(currentItems);
|
|
171
|
-
incomingItems.forEach(function (incomingItem) {
|
|
172
|
-
var currentIndex = result.findIndex(function (currentItem) {
|
|
173
|
-
return isSameOrderCollectionItem(kind, currentItem, incomingItem);
|
|
174
|
-
});
|
|
175
|
-
if (currentIndex !== -1) {
|
|
176
|
-
result[currentIndex] = mergeBaseSalesCollectionItem(kind, result[currentIndex], incomingItem, uidRemaps);
|
|
105
|
+
var existingIndex = indexByUid.get(uid);
|
|
106
|
+
if (existingIndex !== undefined) {
|
|
107
|
+
result[existingIndex] = clonedItem;
|
|
177
108
|
return;
|
|
178
109
|
}
|
|
179
|
-
result.
|
|
180
|
-
|
|
110
|
+
indexByUid.set(uid, result.length);
|
|
111
|
+
result.push(clonedItem);
|
|
112
|
+
};
|
|
113
|
+
currentValue.forEach(appendOrReplaceByUid);
|
|
114
|
+
loadedValue.forEach(appendOrReplaceByUid);
|
|
181
115
|
return result;
|
|
182
116
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
// 兼容旧调用方偶尔使用的单数 payment 字段。
|
|
187
|
-
if (Array.isArray(normalizedRecord.payment)) {
|
|
188
|
-
normalizedRecord.payment = normalizeOrderCollection('payment', normalizedRecord.payment, options).items;
|
|
189
|
-
}
|
|
190
|
-
return normalizedRecord;
|
|
191
|
-
}
|
|
192
|
-
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, strategy) {
|
|
193
|
-
var normalizedLoadedRecord = normalizeBaseSalesRecordCollections(loadedRecord || {}, {
|
|
194
|
-
ensureUid: false
|
|
195
|
-
});
|
|
196
|
-
if (!currentTempOrder) {
|
|
197
|
-
return normalizeBaseSalesRecordCollections(normalizedLoadedRecord);
|
|
198
|
-
}
|
|
199
|
-
var normalizedCurrentTempOrder = normalizeBaseSalesRecordCollections(currentTempOrder, {
|
|
200
|
-
ensureUid: false
|
|
201
|
-
});
|
|
202
|
-
var uidRemaps = [];
|
|
203
|
-
var mergedRecord = mergeWith(normalizedCurrentTempOrder, normalizedLoadedRecord, function (currentValue, loadedValue, key) {
|
|
204
|
-
var collectionKind = getBaseSalesOrderCollectionKind(key);
|
|
205
|
-
if (collectionKind && Array.isArray(loadedValue)) {
|
|
206
|
-
return mergeBaseSalesOrderCollection(collectionKind, Array.isArray(currentValue) ? currentValue : [], loadedValue, strategy, uidRemaps);
|
|
207
|
-
}
|
|
117
|
+
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord) {
|
|
118
|
+
if (!currentTempOrder) return loadedRecord;
|
|
119
|
+
var mergedRecord = mergeWith(cloneDeep(currentTempOrder), cloneDeep(loadedRecord || {}), function (currentValue, loadedValue, key) {
|
|
208
120
|
if (Array.isArray(currentValue) && Array.isArray(loadedValue)) {
|
|
121
|
+
var metadataKey = getBaseSalesUniqueArrayMetadataKey(key);
|
|
122
|
+
if (metadataKey) {
|
|
123
|
+
return mergeBaseSalesUniqueArray(currentValue, loadedValue, metadataKey);
|
|
124
|
+
}
|
|
209
125
|
return [].concat(_toConsumableArray(cloneDeep(currentValue)), _toConsumableArray(cloneDeep(loadedValue)));
|
|
210
126
|
}
|
|
211
127
|
if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
|
|
@@ -215,7 +131,7 @@ function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord, str
|
|
|
215
131
|
return undefined;
|
|
216
132
|
});
|
|
217
133
|
delete mergedRecord.request_unique_idempotency_token;
|
|
218
|
-
return
|
|
134
|
+
return mergedRecord;
|
|
219
135
|
}
|
|
220
136
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
221
137
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
@@ -251,13 +167,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
251
167
|
_defineProperty(_assertThisInitialized(_this), "queuedAutoPaymentSync", false);
|
|
252
168
|
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncFlushing", false);
|
|
253
169
|
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
254
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
255
|
-
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadSequence", 0);
|
|
256
|
-
_defineProperty(_assertThisInitialized(_this), "salesDetailHydrateQueue", Promise.resolve());
|
|
170
|
+
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadInFlight", false);
|
|
257
171
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeUnsubscribe", null);
|
|
258
172
|
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
|
|
259
|
-
_defineProperty(_assertThisInitialized(_this), "queuedServerOrderChanges", []);
|
|
260
|
-
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeSyncEnabled", false);
|
|
261
173
|
return _this;
|
|
262
174
|
}
|
|
263
175
|
|
|
@@ -347,143 +259,71 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
347
259
|
return isSameBaseSalesOrderRecord(record, order);
|
|
348
260
|
});
|
|
349
261
|
}
|
|
350
|
-
}, {
|
|
351
|
-
key: "setServerOrderChangeSyncEnabled",
|
|
352
|
-
value: function setServerOrderChangeSyncEnabled(enabled) {
|
|
353
|
-
this.serverOrderChangeSyncEnabled = enabled;
|
|
354
|
-
if (!enabled) this.queuedServerOrderChanges = [];
|
|
355
|
-
}
|
|
356
|
-
}, {
|
|
357
|
-
key: "queueLatestServerOrderChange",
|
|
358
|
-
value: function queueLatestServerOrderChange(order) {
|
|
359
|
-
var snapshot = cloneDeep(order);
|
|
360
|
-
var existingIndex = this.queuedServerOrderChanges.findIndex(function (queued) {
|
|
361
|
-
return isSameBaseSalesOrderRecord(queued, snapshot);
|
|
362
|
-
});
|
|
363
|
-
if (existingIndex >= 0) {
|
|
364
|
-
this.queuedServerOrderChanges[existingIndex] = snapshot;
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
this.queuedServerOrderChanges.push(snapshot);
|
|
368
|
-
}
|
|
369
|
-
}, {
|
|
370
|
-
key: "drainQueuedServerOrderChanges",
|
|
371
|
-
value: function () {
|
|
372
|
-
var _drainQueuedServerOrderChanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
373
|
-
var changedOrders;
|
|
374
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
375
|
-
while (1) switch (_context.prev = _context.next) {
|
|
376
|
-
case 0:
|
|
377
|
-
if (!(!this.serverOrderChangeSyncEnabled || this.salesDetailLoadInFlightCount > 0 || this.serverOrderChangeHydrateInFlight || this.queuedServerOrderChanges.length === 0)) {
|
|
378
|
-
_context.next = 2;
|
|
379
|
-
break;
|
|
380
|
-
}
|
|
381
|
-
return _context.abrupt("return");
|
|
382
|
-
case 2:
|
|
383
|
-
changedOrders = this.queuedServerOrderChanges;
|
|
384
|
-
this.queuedServerOrderChanges = [];
|
|
385
|
-
_context.next = 6;
|
|
386
|
-
return this.syncCurrentSalesDetailFromServerOrderChange({
|
|
387
|
-
changedOrders: changedOrders
|
|
388
|
-
});
|
|
389
|
-
case 6:
|
|
390
|
-
case "end":
|
|
391
|
-
return _context.stop();
|
|
392
|
-
}
|
|
393
|
-
}, _callee, this);
|
|
394
|
-
}));
|
|
395
|
-
function drainQueuedServerOrderChanges() {
|
|
396
|
-
return _drainQueuedServerOrderChanges.apply(this, arguments);
|
|
397
|
-
}
|
|
398
|
-
return drainQueuedServerOrderChanges;
|
|
399
|
-
}()
|
|
400
262
|
}, {
|
|
401
263
|
key: "syncCurrentSalesDetailFromServerOrderChange",
|
|
402
264
|
value: function () {
|
|
403
|
-
var _syncCurrentSalesDetailFromServerOrderChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
265
|
+
var _syncCurrentSalesDetailFromServerOrderChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload) {
|
|
404
266
|
var _this2 = this;
|
|
405
267
|
var changedOrders, changedOrder;
|
|
406
|
-
return _regeneratorRuntime().wrap(function
|
|
407
|
-
while (1) switch (
|
|
268
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
269
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
408
270
|
case 0:
|
|
409
271
|
changedOrders = Array.isArray(payload) ? payload : Array.isArray(payload === null || payload === void 0 ? void 0 : payload.changedOrders) ? payload.changedOrders : payload !== null && payload !== void 0 && payload.data && _typeof(payload.data) === 'object' ? [payload.data] : [];
|
|
410
|
-
if (this.
|
|
411
|
-
|
|
272
|
+
if (!(this.salesDetailLoadInFlight || this.serverOrderChangeHydrateInFlight)) {
|
|
273
|
+
_context2.next = 3;
|
|
412
274
|
break;
|
|
413
275
|
}
|
|
414
|
-
return
|
|
276
|
+
return _context2.abrupt("return");
|
|
415
277
|
case 3:
|
|
416
|
-
if (!(this.salesDetailLoadInFlightCount > 0)) {
|
|
417
|
-
_context3.next = 6;
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
changedOrders.forEach(function (order) {
|
|
421
|
-
return _this2.queueLatestServerOrderChange(order);
|
|
422
|
-
});
|
|
423
|
-
return _context3.abrupt("return");
|
|
424
|
-
case 6:
|
|
425
278
|
changedOrder = changedOrders.find(function (order) {
|
|
426
279
|
return _this2.isCurrentSalesOrderRecord(order);
|
|
427
280
|
});
|
|
428
281
|
if (changedOrder) {
|
|
429
|
-
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
return _context3.abrupt("return");
|
|
433
|
-
case 9:
|
|
434
|
-
if (!this.serverOrderChangeHydrateInFlight) {
|
|
435
|
-
_context3.next = 12;
|
|
282
|
+
_context2.next = 6;
|
|
436
283
|
break;
|
|
437
284
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
case 12:
|
|
285
|
+
return _context2.abrupt("return");
|
|
286
|
+
case 6:
|
|
441
287
|
if (this.store.order) {
|
|
442
|
-
|
|
288
|
+
_context2.next = 8;
|
|
443
289
|
break;
|
|
444
290
|
}
|
|
445
|
-
return
|
|
446
|
-
case
|
|
447
|
-
this.serverOrderChangeHydrateInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
448
|
-
var
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
291
|
+
return _context2.abrupt("return");
|
|
292
|
+
case 8:
|
|
293
|
+
this.serverOrderChangeHydrateInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
294
|
+
var sales;
|
|
295
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
296
|
+
while (1) switch (_context.prev = _context.next) {
|
|
452
297
|
case 0:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
_context2.next = 4;
|
|
456
|
-
return _this2.store.order.hydrateTempOrderFromRecord(record, {
|
|
298
|
+
_context.next = 2;
|
|
299
|
+
return _this2.store.order.hydrateTempOrderFromRecord(changedOrder, {
|
|
457
300
|
recalcOnHydrate: false
|
|
458
301
|
});
|
|
459
|
-
case
|
|
460
|
-
sales =
|
|
302
|
+
case 2:
|
|
303
|
+
sales = _context.sent;
|
|
461
304
|
_this2.currentSalesDetail = sales;
|
|
462
|
-
|
|
305
|
+
_context.next = 6;
|
|
463
306
|
return _this2.core.effects.emit("".concat(_this2.name, ":onSalesOrderLoaded"), {
|
|
464
307
|
sales: sales
|
|
465
308
|
});
|
|
466
|
-
case
|
|
309
|
+
case 6:
|
|
467
310
|
case "end":
|
|
468
|
-
return
|
|
311
|
+
return _context.stop();
|
|
469
312
|
}
|
|
470
|
-
},
|
|
313
|
+
}, _callee);
|
|
471
314
|
}))();
|
|
472
|
-
|
|
473
|
-
|
|
315
|
+
_context2.prev = 9;
|
|
316
|
+
_context2.next = 12;
|
|
474
317
|
return this.serverOrderChangeHydrateInFlight;
|
|
475
|
-
case
|
|
476
|
-
|
|
318
|
+
case 12:
|
|
319
|
+
_context2.prev = 12;
|
|
477
320
|
this.serverOrderChangeHydrateInFlight = null;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
case 22:
|
|
481
|
-
return _context3.finish(18);
|
|
482
|
-
case 23:
|
|
321
|
+
return _context2.finish(12);
|
|
322
|
+
case 15:
|
|
483
323
|
case "end":
|
|
484
|
-
return
|
|
324
|
+
return _context2.stop();
|
|
485
325
|
}
|
|
486
|
-
},
|
|
326
|
+
}, _callee2, this, [[9,, 12, 15]]);
|
|
487
327
|
}));
|
|
488
328
|
function syncCurrentSalesDetailFromServerOrderChange(_x) {
|
|
489
329
|
return _syncCurrentSalesDetailFromServerOrderChange.apply(this, arguments);
|
|
@@ -500,100 +340,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
500
340
|
var effects = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.effects;
|
|
501
341
|
if (!effects || typeof effects.on !== 'function') return;
|
|
502
342
|
this.serverOrderChangeUnsubscribe = effects.on(SERVER_ORDER_CHANGED_EVENT, function (payload) {
|
|
503
|
-
|
|
343
|
+
void _this3.syncCurrentSalesDetailFromServerOrderChange(payload).catch(function (error) {
|
|
504
344
|
_this3.logError('sync sales detail from server order change failed', {
|
|
505
345
|
error: error instanceof Error ? error.message : String(error)
|
|
506
346
|
});
|
|
507
347
|
});
|
|
508
348
|
});
|
|
509
349
|
}
|
|
510
|
-
}, {
|
|
511
|
-
key: "hydrateLatestLoadedSalesDetail",
|
|
512
|
-
value: function () {
|
|
513
|
-
var _hydrateLatestLoadedSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(record, loadSequence) {
|
|
514
|
-
var _this4 = this;
|
|
515
|
-
var hydratedSales, skippedBeforeHydrate, hydrateTask, queuedTask;
|
|
516
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
517
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
518
|
-
case 0:
|
|
519
|
-
hydratedSales = null;
|
|
520
|
-
skippedBeforeHydrate = false;
|
|
521
|
-
hydrateTask = /*#__PURE__*/function () {
|
|
522
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
523
|
-
var sales;
|
|
524
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
525
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
526
|
-
case 0:
|
|
527
|
-
if (!(loadSequence !== _this4.salesDetailLoadSequence)) {
|
|
528
|
-
_context4.next = 3;
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
skippedBeforeHydrate = true;
|
|
532
|
-
return _context4.abrupt("return");
|
|
533
|
-
case 3:
|
|
534
|
-
if (_this4.store.order) {
|
|
535
|
-
_context4.next = 5;
|
|
536
|
-
break;
|
|
537
|
-
}
|
|
538
|
-
throw new Error('order 模块未初始化');
|
|
539
|
-
case 5:
|
|
540
|
-
_context4.next = 7;
|
|
541
|
-
return _this4.store.order.hydrateTempOrderFromRecord(record, {
|
|
542
|
-
recalcOnHydrate: false
|
|
543
|
-
});
|
|
544
|
-
case 7:
|
|
545
|
-
sales = _context4.sent;
|
|
546
|
-
hydratedSales = sales;
|
|
547
|
-
|
|
548
|
-
// hydrate 期间可能又发起了更新请求;后续任务已串行排队,将负责最终状态。
|
|
549
|
-
if (!(loadSequence !== _this4.salesDetailLoadSequence)) {
|
|
550
|
-
_context4.next = 11;
|
|
551
|
-
break;
|
|
552
|
-
}
|
|
553
|
-
return _context4.abrupt("return");
|
|
554
|
-
case 11:
|
|
555
|
-
_this4.currentSalesDetail = sales;
|
|
556
|
-
_context4.next = 14;
|
|
557
|
-
return _this4.core.effects.emit("".concat(_this4.name, ":onSalesOrderLoaded"), {
|
|
558
|
-
sales: sales
|
|
559
|
-
});
|
|
560
|
-
case 14:
|
|
561
|
-
case "end":
|
|
562
|
-
return _context4.stop();
|
|
563
|
-
}
|
|
564
|
-
}, _callee4);
|
|
565
|
-
}));
|
|
566
|
-
return function hydrateTask() {
|
|
567
|
-
return _ref3.apply(this, arguments);
|
|
568
|
-
};
|
|
569
|
-
}();
|
|
570
|
-
queuedTask = this.salesDetailHydrateQueue.then(hydrateTask, hydrateTask);
|
|
571
|
-
this.salesDetailHydrateQueue = queuedTask.then(function () {
|
|
572
|
-
return undefined;
|
|
573
|
-
}, function () {
|
|
574
|
-
return undefined;
|
|
575
|
-
});
|
|
576
|
-
_context5.next = 7;
|
|
577
|
-
return queuedTask;
|
|
578
|
-
case 7:
|
|
579
|
-
if (!skippedBeforeHydrate) {
|
|
580
|
-
_context5.next = 9;
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
return _context5.abrupt("return", record);
|
|
584
|
-
case 9:
|
|
585
|
-
return _context5.abrupt("return", hydratedSales || this.currentSalesDetail || record);
|
|
586
|
-
case 10:
|
|
587
|
-
case "end":
|
|
588
|
-
return _context5.stop();
|
|
589
|
-
}
|
|
590
|
-
}, _callee5, this);
|
|
591
|
-
}));
|
|
592
|
-
function hydrateLatestLoadedSalesDetail(_x2, _x3) {
|
|
593
|
-
return _hydrateLatestLoadedSalesDetail.apply(this, arguments);
|
|
594
|
-
}
|
|
595
|
-
return hydrateLatestLoadedSalesDetail;
|
|
596
|
-
}()
|
|
597
350
|
}, {
|
|
598
351
|
key: "hydrateOrderPaymentNames",
|
|
599
352
|
value: function hydrateOrderPaymentNames(payments) {
|
|
@@ -658,10 +411,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
658
411
|
});
|
|
659
412
|
}
|
|
660
413
|
quotation.setScheduleResolver(function (id) {
|
|
661
|
-
var _scheduleModule$getSc, _getScheduleByIds,
|
|
414
|
+
var _scheduleModule$getSc, _getScheduleByIds, _ref2;
|
|
662
415
|
var scheduleId = String(id);
|
|
663
416
|
if (scheduleById.has(scheduleId)) return scheduleById.get(scheduleId);
|
|
664
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (
|
|
417
|
+
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (_ref2 = scheduleModule).getScheduleByIds) === null || _getScheduleByIds === void 0 ? void 0 : _getScheduleByIds.call(_ref2, [id])) || [];
|
|
665
418
|
if (schedules[0]) scheduleById.set(scheduleId, schedules[0]);
|
|
666
419
|
return schedules[0];
|
|
667
420
|
});
|
|
@@ -669,30 +422,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
669
422
|
}, {
|
|
670
423
|
key: "loadQuotationForPriceQuery",
|
|
671
424
|
value: function () {
|
|
672
|
-
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
425
|
+
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
673
426
|
var _this$otherParams;
|
|
674
|
-
return _regeneratorRuntime().wrap(function
|
|
675
|
-
while (1) switch (
|
|
427
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
428
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
676
429
|
case 0:
|
|
677
430
|
if (params.quotation) {
|
|
678
|
-
|
|
431
|
+
_context3.next = 2;
|
|
679
432
|
break;
|
|
680
433
|
}
|
|
681
|
-
return
|
|
434
|
+
return _context3.abrupt("return");
|
|
682
435
|
case 2:
|
|
683
436
|
this.applyQuotationScheduleResolver(params.quotation);
|
|
684
|
-
|
|
437
|
+
_context3.next = 5;
|
|
685
438
|
return params.quotation.loadQuotations({
|
|
686
439
|
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
687
440
|
customer_id: params.customer_id
|
|
688
441
|
});
|
|
689
442
|
case 5:
|
|
690
443
|
case "end":
|
|
691
|
-
return
|
|
444
|
+
return _context3.stop();
|
|
692
445
|
}
|
|
693
|
-
},
|
|
446
|
+
}, _callee3, this);
|
|
694
447
|
}));
|
|
695
|
-
function loadQuotationForPriceQuery(
|
|
448
|
+
function loadQuotationForPriceQuery(_x2) {
|
|
696
449
|
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
697
450
|
}
|
|
698
451
|
return loadQuotationForPriceQuery;
|
|
@@ -736,23 +489,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
736
489
|
}, {
|
|
737
490
|
key: "loadProductsForPriceQuery",
|
|
738
491
|
value: function () {
|
|
739
|
-
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
492
|
+
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
740
493
|
var ids, productsById, _this$otherParams2, _response$data, response, list;
|
|
741
|
-
return _regeneratorRuntime().wrap(function
|
|
742
|
-
while (1) switch (
|
|
494
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
495
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
743
496
|
case 0:
|
|
744
497
|
ids = Array.from(new Set(params.ids.filter(function (id) {
|
|
745
498
|
return Number.isFinite(id);
|
|
746
499
|
})));
|
|
747
500
|
productsById = new Map();
|
|
748
501
|
if (!(!ids.length || !this.request)) {
|
|
749
|
-
|
|
502
|
+
_context4.next = 4;
|
|
750
503
|
break;
|
|
751
504
|
}
|
|
752
|
-
return
|
|
505
|
+
return _context4.abrupt("return", productsById);
|
|
753
506
|
case 4:
|
|
754
|
-
|
|
755
|
-
|
|
507
|
+
_context4.prev = 4;
|
|
508
|
+
_context4.next = 7;
|
|
756
509
|
return this.request.post('/product/query', {
|
|
757
510
|
ids: ids,
|
|
758
511
|
open_quotation: 1,
|
|
@@ -769,35 +522,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
769
522
|
customToast: function customToast() {}
|
|
770
523
|
});
|
|
771
524
|
case 7:
|
|
772
|
-
response =
|
|
525
|
+
response = _context4.sent;
|
|
773
526
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
774
527
|
if (Array.isArray(list)) {
|
|
775
|
-
|
|
528
|
+
_context4.next = 11;
|
|
776
529
|
break;
|
|
777
530
|
}
|
|
778
|
-
return
|
|
531
|
+
return _context4.abrupt("return", productsById);
|
|
779
532
|
case 11:
|
|
780
533
|
list.forEach(function (item) {
|
|
781
534
|
var _item$id;
|
|
782
535
|
var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
|
|
783
536
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
784
537
|
});
|
|
785
|
-
return
|
|
538
|
+
return _context4.abrupt("return", productsById);
|
|
786
539
|
case 15:
|
|
787
|
-
|
|
788
|
-
|
|
540
|
+
_context4.prev = 15;
|
|
541
|
+
_context4.t0 = _context4["catch"](4);
|
|
789
542
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
790
543
|
ids: ids,
|
|
791
|
-
error:
|
|
544
|
+
error: _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0)
|
|
792
545
|
});
|
|
793
|
-
return
|
|
546
|
+
return _context4.abrupt("return", productsById);
|
|
794
547
|
case 19:
|
|
795
548
|
case "end":
|
|
796
|
-
return
|
|
549
|
+
return _context4.stop();
|
|
797
550
|
}
|
|
798
|
-
},
|
|
551
|
+
}, _callee4, this, [[4, 15]]);
|
|
799
552
|
}));
|
|
800
|
-
function loadProductsForPriceQuery(
|
|
553
|
+
function loadProductsForPriceQuery(_x3) {
|
|
801
554
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
802
555
|
}
|
|
803
556
|
return loadProductsForPriceQuery;
|
|
@@ -805,21 +558,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
805
558
|
}, {
|
|
806
559
|
key: "loadProductForPriceQuery",
|
|
807
560
|
value: function () {
|
|
808
|
-
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
561
|
+
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params, customerId) {
|
|
809
562
|
var product, productId, schedule, productsById;
|
|
810
|
-
return _regeneratorRuntime().wrap(function
|
|
811
|
-
while (1) switch (
|
|
563
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
564
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
812
565
|
case 0:
|
|
813
566
|
product = params.product || {};
|
|
814
567
|
productId = this.getPriceQueryProductId(product);
|
|
815
568
|
if (!(productId === null || !this.request)) {
|
|
816
|
-
|
|
569
|
+
_context5.next = 4;
|
|
817
570
|
break;
|
|
818
571
|
}
|
|
819
|
-
return
|
|
572
|
+
return _context5.abrupt("return", null);
|
|
820
573
|
case 4:
|
|
821
574
|
schedule = this.getPriceQuerySchedule(params);
|
|
822
|
-
|
|
575
|
+
_context5.next = 7;
|
|
823
576
|
return this.loadProductsForPriceQuery({
|
|
824
577
|
ids: [productId],
|
|
825
578
|
schedule: schedule,
|
|
@@ -827,15 +580,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
827
580
|
channel: params.channel
|
|
828
581
|
});
|
|
829
582
|
case 7:
|
|
830
|
-
productsById =
|
|
831
|
-
return
|
|
583
|
+
productsById = _context5.sent;
|
|
584
|
+
return _context5.abrupt("return", productsById.get(productId) || null);
|
|
832
585
|
case 9:
|
|
833
586
|
case "end":
|
|
834
|
-
return
|
|
587
|
+
return _context5.stop();
|
|
835
588
|
}
|
|
836
|
-
},
|
|
589
|
+
}, _callee5, this);
|
|
837
590
|
}));
|
|
838
|
-
function loadProductForPriceQuery(
|
|
591
|
+
function loadProductForPriceQuery(_x4, _x5) {
|
|
839
592
|
return _loadProductForPriceQuery.apply(this, arguments);
|
|
840
593
|
}
|
|
841
594
|
return loadProductForPriceQuery;
|
|
@@ -848,10 +601,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
848
601
|
return groups.flatMap(function (group) {
|
|
849
602
|
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
850
603
|
return items.map(function (item) {
|
|
851
|
-
var _item$group_id,
|
|
604
|
+
var _item$group_id, _ref3, _item$bundle_group_id;
|
|
852
605
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
853
606
|
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
854
|
-
bundle_group_id: (
|
|
607
|
+
bundle_group_id: (_ref3 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref3 !== void 0 ? _ref3 : group === null || group === void 0 ? void 0 : group.id
|
|
855
608
|
});
|
|
856
609
|
});
|
|
857
610
|
});
|
|
@@ -882,21 +635,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
882
635
|
}, {
|
|
883
636
|
key: "getAuthoritativeBundleUnitPrice",
|
|
884
637
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
885
|
-
var
|
|
886
|
-
return (
|
|
638
|
+
var _ref4, _ref5, _ref6, _bundle$price;
|
|
639
|
+
return (_ref4 = (_ref5 = (_ref6 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref6 !== void 0 ? _ref6 : bundle.custom_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.product_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.base_price;
|
|
887
640
|
}
|
|
888
641
|
}, {
|
|
889
642
|
key: "mergeProductForPriceQuery",
|
|
890
643
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
891
|
-
var
|
|
644
|
+
var _this4 = this,
|
|
892
645
|
_product$id,
|
|
893
|
-
|
|
646
|
+
_ref7,
|
|
894
647
|
_product$product_id2,
|
|
895
|
-
|
|
648
|
+
_ref8,
|
|
896
649
|
_product$product_vari,
|
|
897
|
-
|
|
650
|
+
_ref9,
|
|
898
651
|
_product$num,
|
|
899
|
-
|
|
652
|
+
_ref10,
|
|
900
653
|
_product$quantity,
|
|
901
654
|
_product$metadata4;
|
|
902
655
|
if (!authoritativeProduct) return product;
|
|
@@ -904,8 +657,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
904
657
|
var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
|
|
905
658
|
var productBundle = selectedBundles.map(function (bundle) {
|
|
906
659
|
var _authoritativeBundle$, _authoritativeBundle$2;
|
|
907
|
-
var authoritativeBundle =
|
|
908
|
-
var unitPrice = authoritativeBundle ?
|
|
660
|
+
var authoritativeBundle = _this4.findAuthoritativeBundleItem(bundle, authoritativeBundles);
|
|
661
|
+
var unitPrice = authoritativeBundle ? _this4.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
|
|
909
662
|
if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
|
|
910
663
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
911
664
|
price: unitPrice,
|
|
@@ -916,10 +669,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
916
669
|
});
|
|
917
670
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
918
671
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
919
|
-
product_id: (
|
|
920
|
-
product_variant_id: (
|
|
921
|
-
num: (
|
|
922
|
-
quantity: (
|
|
672
|
+
product_id: (_ref7 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref7 !== void 0 ? _ref7 : authoritativeProduct.id,
|
|
673
|
+
product_variant_id: (_ref8 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref8 !== void 0 ? _ref8 : 0,
|
|
674
|
+
num: (_ref9 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref9 !== void 0 ? _ref9 : authoritativeProduct.num,
|
|
675
|
+
quantity: (_ref10 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref10 !== void 0 ? _ref10 : authoritativeProduct.quantity,
|
|
923
676
|
product_sku: function () {
|
|
924
677
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
925
678
|
var productSku = ensureProductSku(product);
|
|
@@ -993,61 +746,61 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
993
746
|
}, {
|
|
994
747
|
key: "syncOtherParamsToSubModules",
|
|
995
748
|
value: (function () {
|
|
996
|
-
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
997
|
-
var
|
|
998
|
-
var
|
|
999
|
-
|
|
749
|
+
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(changedParams) {
|
|
750
|
+
var _this5 = this;
|
|
751
|
+
var _ref11,
|
|
752
|
+
_ref11$cover,
|
|
1000
753
|
cover,
|
|
1001
754
|
nextSubModuleOtherParams,
|
|
1002
|
-
|
|
1003
|
-
return _regeneratorRuntime().wrap(function
|
|
1004
|
-
while (1) switch (
|
|
755
|
+
_args7 = arguments;
|
|
756
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
757
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1005
758
|
case 0:
|
|
1006
|
-
|
|
759
|
+
_ref11 = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {}, _ref11$cover = _ref11.cover, cover = _ref11$cover === void 0 ? false : _ref11$cover;
|
|
1007
760
|
nextSubModuleOtherParams = this.buildSubModuleOtherParams();
|
|
1008
|
-
|
|
761
|
+
_context7.next = 4;
|
|
1009
762
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
1010
|
-
var
|
|
1011
|
-
var
|
|
1012
|
-
return _regeneratorRuntime().wrap(function
|
|
1013
|
-
while (1) switch (
|
|
763
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref12) {
|
|
764
|
+
var _ref14, moduleName, subModule, targetModule;
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
766
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1014
767
|
case 0:
|
|
1015
|
-
|
|
1016
|
-
if (!
|
|
1017
|
-
|
|
768
|
+
_ref14 = _slicedToArray(_ref12, 2), moduleName = _ref14[0], subModule = _ref14[1];
|
|
769
|
+
if (!_this5.reusedSharedSubModuleNames.has(moduleName)) {
|
|
770
|
+
_context6.next = 3;
|
|
1018
771
|
break;
|
|
1019
772
|
}
|
|
1020
|
-
return
|
|
773
|
+
return _context6.abrupt("return");
|
|
1021
774
|
case 3:
|
|
1022
775
|
targetModule = subModule;
|
|
1023
776
|
if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
|
|
1024
|
-
|
|
777
|
+
_context6.next = 6;
|
|
1025
778
|
break;
|
|
1026
779
|
}
|
|
1027
|
-
return
|
|
780
|
+
return _context6.abrupt("return");
|
|
1028
781
|
case 6:
|
|
1029
|
-
|
|
782
|
+
_context6.next = 8;
|
|
1030
783
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1031
784
|
changedParams: changedParams,
|
|
1032
785
|
cover: cover
|
|
1033
786
|
});
|
|
1034
787
|
case 8:
|
|
1035
788
|
case "end":
|
|
1036
|
-
return
|
|
789
|
+
return _context6.stop();
|
|
1037
790
|
}
|
|
1038
|
-
},
|
|
791
|
+
}, _callee6);
|
|
1039
792
|
}));
|
|
1040
|
-
return function (
|
|
1041
|
-
return
|
|
793
|
+
return function (_x7) {
|
|
794
|
+
return _ref13.apply(this, arguments);
|
|
1042
795
|
};
|
|
1043
796
|
}()));
|
|
1044
797
|
case 4:
|
|
1045
798
|
case "end":
|
|
1046
|
-
return
|
|
799
|
+
return _context7.stop();
|
|
1047
800
|
}
|
|
1048
|
-
},
|
|
801
|
+
}, _callee7, this);
|
|
1049
802
|
}));
|
|
1050
|
-
function syncOtherParamsToSubModules(
|
|
803
|
+
function syncOtherParamsToSubModules(_x6) {
|
|
1051
804
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
1052
805
|
}
|
|
1053
806
|
return syncOtherParamsToSubModules;
|
|
@@ -1121,19 +874,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1121
874
|
}, {
|
|
1122
875
|
key: "initialize",
|
|
1123
876
|
value: function () {
|
|
1124
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
877
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(core) {
|
|
1125
878
|
var _this$otherParams4,
|
|
1126
|
-
|
|
879
|
+
_this6 = this,
|
|
1127
880
|
_this$otherParams5;
|
|
1128
881
|
var options,
|
|
1129
882
|
app,
|
|
1130
883
|
targetCacheData,
|
|
1131
884
|
moduleNames,
|
|
1132
|
-
|
|
1133
|
-
return _regeneratorRuntime().wrap(function
|
|
1134
|
-
while (1) switch (
|
|
885
|
+
_args8 = arguments;
|
|
886
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
887
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1135
888
|
case 0:
|
|
1136
|
-
options =
|
|
889
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
1137
890
|
this.core = core;
|
|
1138
891
|
this.initializeOptions = options || {};
|
|
1139
892
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
@@ -1146,7 +899,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1146
899
|
// 获取 logger 实例
|
|
1147
900
|
this.appPlugin = core.getPlugin('app');
|
|
1148
901
|
if (this.appPlugin) {
|
|
1149
|
-
|
|
902
|
+
_context8.next = 11;
|
|
1150
903
|
break;
|
|
1151
904
|
}
|
|
1152
905
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
@@ -1156,48 +909,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1156
909
|
targetCacheData = this.readSessionCacheData();
|
|
1157
910
|
moduleNames = this.getRegisteredModuleNames();
|
|
1158
911
|
moduleNames.forEach(function (step) {
|
|
1159
|
-
var reusedModule =
|
|
912
|
+
var reusedModule = _this6.getReusableSharedSubModule(step);
|
|
1160
913
|
if (reusedModule) {
|
|
1161
|
-
|
|
1162
|
-
|
|
914
|
+
_this6.store[step] = reusedModule;
|
|
915
|
+
_this6.reusedSharedSubModuleNames.add(step);
|
|
1163
916
|
return;
|
|
1164
917
|
}
|
|
1165
|
-
var targetModule =
|
|
918
|
+
var targetModule = _this6.createSubModule(step);
|
|
1166
919
|
if (!targetModule) {
|
|
1167
920
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
1168
921
|
}
|
|
1169
|
-
var hooks =
|
|
1170
|
-
|
|
1171
|
-
|
|
922
|
+
var hooks = _this6.getSubModuleHooks(step);
|
|
923
|
+
_this6.store[step] = targetModule;
|
|
924
|
+
_this6.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
1172
925
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
1173
926
|
}, hooks ? {
|
|
1174
927
|
hooks: hooks
|
|
1175
928
|
} : {}), {}, {
|
|
1176
|
-
otherParams:
|
|
929
|
+
otherParams: _this6.buildSubModuleOtherParams()
|
|
1177
930
|
}));
|
|
1178
931
|
});
|
|
1179
932
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
1180
|
-
|
|
933
|
+
_context8.next = 19;
|
|
1181
934
|
break;
|
|
1182
935
|
}
|
|
1183
|
-
|
|
936
|
+
_context8.next = 19;
|
|
1184
937
|
return this.store.schedule.loadAllSchedule();
|
|
1185
938
|
case 19:
|
|
1186
939
|
if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
|
|
1187
940
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
1188
941
|
}
|
|
1189
|
-
|
|
942
|
+
_context8.next = 22;
|
|
1190
943
|
return this.getPaymentMethodsAsync();
|
|
1191
944
|
case 22:
|
|
1192
945
|
this.registerServerOrderChangeSync();
|
|
1193
946
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
1194
947
|
case 24:
|
|
1195
948
|
case "end":
|
|
1196
|
-
return
|
|
949
|
+
return _context8.stop();
|
|
1197
950
|
}
|
|
1198
|
-
},
|
|
951
|
+
}, _callee8, this);
|
|
1199
952
|
}));
|
|
1200
|
-
function initialize(
|
|
953
|
+
function initialize(_x8) {
|
|
1201
954
|
return _initialize.apply(this, arguments);
|
|
1202
955
|
}
|
|
1203
956
|
return initialize;
|
|
@@ -1205,17 +958,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1205
958
|
}, {
|
|
1206
959
|
key: "destroy",
|
|
1207
960
|
value: function () {
|
|
1208
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
961
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
1209
962
|
var _this$serverOrderChan2,
|
|
1210
|
-
|
|
1211
|
-
return _regeneratorRuntime().wrap(function
|
|
1212
|
-
while (1) switch (
|
|
963
|
+
_this7 = this;
|
|
964
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
965
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1213
966
|
case 0:
|
|
1214
967
|
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
1215
968
|
this.serverOrderChangeUnsubscribe = null;
|
|
1216
969
|
Object.keys(this.store).forEach(function (key) {
|
|
1217
|
-
if (
|
|
1218
|
-
var sub =
|
|
970
|
+
if (_this7.reusedSharedSubModuleNames.has(key)) return;
|
|
971
|
+
var sub = _this7.store[key];
|
|
1219
972
|
if (sub && typeof sub.destroy === 'function') {
|
|
1220
973
|
try {
|
|
1221
974
|
sub.destroy();
|
|
@@ -1225,17 +978,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1225
978
|
}
|
|
1226
979
|
});
|
|
1227
980
|
this.currentSalesDetail = null;
|
|
1228
|
-
|
|
1229
|
-
this.salesDetailLoadSequence += 1;
|
|
1230
|
-
_context12.next = 8;
|
|
981
|
+
_context9.next = 6;
|
|
1231
982
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
1232
|
-
case
|
|
983
|
+
case 6:
|
|
1233
984
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
1234
|
-
case
|
|
985
|
+
case 7:
|
|
1235
986
|
case "end":
|
|
1236
|
-
return
|
|
987
|
+
return _context9.stop();
|
|
1237
988
|
}
|
|
1238
|
-
},
|
|
989
|
+
}, _callee9, this);
|
|
1239
990
|
}));
|
|
1240
991
|
function destroy() {
|
|
1241
992
|
return _destroy.apply(this, arguments);
|
|
@@ -1252,91 +1003,82 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1252
1003
|
}, {
|
|
1253
1004
|
key: "loadSalesDetail",
|
|
1254
1005
|
value: (function () {
|
|
1255
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1256
|
-
var
|
|
1257
|
-
return _regeneratorRuntime().wrap(function
|
|
1258
|
-
while (1) switch (
|
|
1006
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
|
|
1007
|
+
var _ref15, _ref16, _ref17, _ref18, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record, sales;
|
|
1008
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1009
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1259
1010
|
case 0:
|
|
1260
1011
|
if (this.store.order) {
|
|
1261
|
-
|
|
1012
|
+
_context10.next = 2;
|
|
1262
1013
|
break;
|
|
1263
1014
|
}
|
|
1264
1015
|
throw new Error('order 模块未初始化');
|
|
1265
1016
|
case 2:
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
_context13.prev = 4;
|
|
1017
|
+
this.salesDetailLoadInFlight = true;
|
|
1018
|
+
_context10.prev = 3;
|
|
1269
1019
|
params = _typeof(orderIdOrParams) === 'object' ? orderIdOrParams : {
|
|
1270
1020
|
orderId: orderIdOrParams
|
|
1271
1021
|
};
|
|
1272
1022
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
1273
1023
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
1274
|
-
lookup = (
|
|
1024
|
+
lookup = (_ref15 = (_ref16 = (_ref17 = (_ref18 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref18 !== void 0 ? _ref18 : params.orderNumber) !== null && _ref17 !== void 0 ? _ref17 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref16 !== void 0 ? _ref16 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref15 !== void 0 ? _ref15 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
1275
1025
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
1276
|
-
|
|
1026
|
+
_context10.next = 10;
|
|
1277
1027
|
break;
|
|
1278
1028
|
}
|
|
1279
1029
|
throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
|
|
1280
|
-
case
|
|
1030
|
+
case 10:
|
|
1281
1031
|
if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
|
|
1282
|
-
|
|
1032
|
+
_context10.next = 14;
|
|
1283
1033
|
break;
|
|
1284
1034
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1035
|
+
_context10.t0 = preloadedSalesDetail;
|
|
1036
|
+
_context10.next = 17;
|
|
1287
1037
|
break;
|
|
1288
|
-
case
|
|
1289
|
-
|
|
1038
|
+
case 14:
|
|
1039
|
+
_context10.next = 16;
|
|
1290
1040
|
return this.store.order.getSalesOrderByLookup({
|
|
1291
1041
|
lookup: lookup,
|
|
1292
1042
|
forceRemote: params.forceRemote
|
|
1293
1043
|
});
|
|
1044
|
+
case 16:
|
|
1045
|
+
_context10.t0 = _context10.sent;
|
|
1294
1046
|
case 17:
|
|
1295
|
-
|
|
1296
|
-
case 18:
|
|
1297
|
-
loadedRecord = _context13.t0;
|
|
1047
|
+
loadedRecord = _context10.t0;
|
|
1298
1048
|
if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
|
|
1299
|
-
|
|
1049
|
+
_context10.next = 21;
|
|
1300
1050
|
break;
|
|
1301
1051
|
}
|
|
1302
1052
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
1303
1053
|
throw new Error(message);
|
|
1304
|
-
case
|
|
1054
|
+
case 21:
|
|
1305
1055
|
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
1306
1056
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
1307
|
-
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord
|
|
1308
|
-
|
|
1309
|
-
return this.
|
|
1310
|
-
|
|
1311
|
-
return _context13.abrupt("return", _context13.sent);
|
|
1312
|
-
case 28:
|
|
1313
|
-
_context13.prev = 28;
|
|
1314
|
-
this.salesDetailLoadInFlightCount = Math.max(0, this.salesDetailLoadInFlightCount - 1);
|
|
1315
|
-
if (!(this.salesDetailLoadInFlightCount === 0)) {
|
|
1316
|
-
_context13.next = 39;
|
|
1317
|
-
break;
|
|
1318
|
-
}
|
|
1319
|
-
_context13.prev = 31;
|
|
1320
|
-
_context13.next = 34;
|
|
1321
|
-
return this.drainQueuedServerOrderChanges();
|
|
1322
|
-
case 34:
|
|
1323
|
-
_context13.next = 39;
|
|
1324
|
-
break;
|
|
1325
|
-
case 36:
|
|
1326
|
-
_context13.prev = 36;
|
|
1327
|
-
_context13.t1 = _context13["catch"](31);
|
|
1328
|
-
this.logError('drain queued server order changes failed', {
|
|
1329
|
-
error: _context13.t1 instanceof Error ? _context13.t1.message : String(_context13.t1)
|
|
1057
|
+
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord) : remoteRecord;
|
|
1058
|
+
_context10.next = 26;
|
|
1059
|
+
return this.store.order.hydrateTempOrderFromRecord(record, {
|
|
1060
|
+
recalcOnHydrate: false
|
|
1330
1061
|
});
|
|
1331
|
-
case
|
|
1332
|
-
|
|
1333
|
-
|
|
1062
|
+
case 26:
|
|
1063
|
+
sales = _context10.sent;
|
|
1064
|
+
this.currentSalesDetail = sales;
|
|
1065
|
+
_context10.next = 30;
|
|
1066
|
+
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
1067
|
+
sales: sales
|
|
1068
|
+
});
|
|
1069
|
+
case 30:
|
|
1070
|
+
return _context10.abrupt("return", sales);
|
|
1071
|
+
case 31:
|
|
1072
|
+
_context10.prev = 31;
|
|
1073
|
+
this.salesDetailLoadInFlight = false;
|
|
1074
|
+
return _context10.finish(31);
|
|
1075
|
+
case 34:
|
|
1334
1076
|
case "end":
|
|
1335
|
-
return
|
|
1077
|
+
return _context10.stop();
|
|
1336
1078
|
}
|
|
1337
|
-
},
|
|
1079
|
+
}, _callee10, this, [[3,, 31, 34]]);
|
|
1338
1080
|
}));
|
|
1339
|
-
function loadSalesDetail(
|
|
1081
|
+
function loadSalesDetail(_x9) {
|
|
1340
1082
|
return _loadSalesDetail.apply(this, arguments);
|
|
1341
1083
|
}
|
|
1342
1084
|
return loadSalesDetail;
|
|
@@ -1416,34 +1158,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1416
1158
|
}, {
|
|
1417
1159
|
key: "replaceTempOrder",
|
|
1418
1160
|
value: function () {
|
|
1419
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1161
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(tempOrder) {
|
|
1420
1162
|
var nextTempOrder;
|
|
1421
|
-
return _regeneratorRuntime().wrap(function
|
|
1422
|
-
while (1) switch (
|
|
1163
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1164
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1423
1165
|
case 0:
|
|
1424
1166
|
if (this.store.order) {
|
|
1425
|
-
|
|
1167
|
+
_context11.next = 2;
|
|
1426
1168
|
break;
|
|
1427
1169
|
}
|
|
1428
1170
|
throw new Error('order 模块未初始化');
|
|
1429
1171
|
case 2:
|
|
1430
|
-
|
|
1172
|
+
_context11.next = 4;
|
|
1431
1173
|
return this.store.order.replaceTempOrder(tempOrder);
|
|
1432
1174
|
case 4:
|
|
1433
|
-
nextTempOrder =
|
|
1434
|
-
|
|
1175
|
+
nextTempOrder = _context11.sent;
|
|
1176
|
+
_context11.next = 7;
|
|
1435
1177
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1436
1178
|
tempOrder: nextTempOrder
|
|
1437
1179
|
});
|
|
1438
1180
|
case 7:
|
|
1439
|
-
return
|
|
1181
|
+
return _context11.abrupt("return", nextTempOrder);
|
|
1440
1182
|
case 8:
|
|
1441
1183
|
case "end":
|
|
1442
|
-
return
|
|
1184
|
+
return _context11.stop();
|
|
1443
1185
|
}
|
|
1444
|
-
},
|
|
1186
|
+
}, _callee11, this);
|
|
1445
1187
|
}));
|
|
1446
|
-
function replaceTempOrder(
|
|
1188
|
+
function replaceTempOrder(_x10) {
|
|
1447
1189
|
return _replaceTempOrder.apply(this, arguments);
|
|
1448
1190
|
}
|
|
1449
1191
|
return replaceTempOrder;
|
|
@@ -1541,40 +1283,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1541
1283
|
}, {
|
|
1542
1284
|
key: "addNewOrder",
|
|
1543
1285
|
value: function () {
|
|
1544
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1286
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1545
1287
|
var tempOrder;
|
|
1546
|
-
return _regeneratorRuntime().wrap(function
|
|
1547
|
-
while (1) switch (
|
|
1288
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1289
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1548
1290
|
case 0:
|
|
1549
|
-
|
|
1291
|
+
_context12.prev = 0;
|
|
1550
1292
|
if (this.store.order) {
|
|
1551
|
-
|
|
1293
|
+
_context12.next = 3;
|
|
1552
1294
|
break;
|
|
1553
1295
|
}
|
|
1554
1296
|
throw new Error('order 模块未初始化');
|
|
1555
1297
|
case 3:
|
|
1556
|
-
|
|
1298
|
+
_context12.next = 5;
|
|
1557
1299
|
return this.store.order.addNewOrder();
|
|
1558
1300
|
case 5:
|
|
1559
|
-
tempOrder =
|
|
1301
|
+
tempOrder = _context12.sent;
|
|
1560
1302
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1561
|
-
|
|
1303
|
+
_context12.next = 10;
|
|
1562
1304
|
break;
|
|
1563
1305
|
}
|
|
1564
1306
|
this.store.order.persistTempOrder();
|
|
1565
|
-
|
|
1307
|
+
_context12.next = 10;
|
|
1566
1308
|
return this.store.order.saveDraft();
|
|
1567
1309
|
case 10:
|
|
1568
|
-
return
|
|
1310
|
+
return _context12.abrupt("return", tempOrder);
|
|
1569
1311
|
case 13:
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
throw
|
|
1312
|
+
_context12.prev = 13;
|
|
1313
|
+
_context12.t0 = _context12["catch"](0);
|
|
1314
|
+
throw _context12.t0;
|
|
1573
1315
|
case 16:
|
|
1574
1316
|
case "end":
|
|
1575
|
-
return
|
|
1317
|
+
return _context12.stop();
|
|
1576
1318
|
}
|
|
1577
|
-
},
|
|
1319
|
+
}, _callee12, this, [[0, 13]]);
|
|
1578
1320
|
}));
|
|
1579
1321
|
function addNewOrder() {
|
|
1580
1322
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1584,22 +1326,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1584
1326
|
}, {
|
|
1585
1327
|
key: "saveDraft",
|
|
1586
1328
|
value: function () {
|
|
1587
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1588
|
-
return _regeneratorRuntime().wrap(function
|
|
1589
|
-
while (1) switch (
|
|
1329
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1330
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1331
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1590
1332
|
case 0:
|
|
1591
1333
|
if (this.store.order) {
|
|
1592
|
-
|
|
1334
|
+
_context13.next = 2;
|
|
1593
1335
|
break;
|
|
1594
1336
|
}
|
|
1595
1337
|
throw new Error('order 模块未初始化');
|
|
1596
1338
|
case 2:
|
|
1597
|
-
return
|
|
1339
|
+
return _context13.abrupt("return", this.store.order.saveDraft());
|
|
1598
1340
|
case 3:
|
|
1599
1341
|
case "end":
|
|
1600
|
-
return
|
|
1342
|
+
return _context13.stop();
|
|
1601
1343
|
}
|
|
1602
|
-
},
|
|
1344
|
+
}, _callee13, this);
|
|
1603
1345
|
}));
|
|
1604
1346
|
function saveDraft() {
|
|
1605
1347
|
return _saveDraft.apply(this, arguments);
|
|
@@ -1610,14 +1352,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1610
1352
|
}, {
|
|
1611
1353
|
key: "restoreOrder",
|
|
1612
1354
|
value: function () {
|
|
1613
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1355
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1614
1356
|
var tempOrder;
|
|
1615
|
-
return _regeneratorRuntime().wrap(function
|
|
1616
|
-
while (1) switch (
|
|
1357
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1358
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1617
1359
|
case 0:
|
|
1618
|
-
|
|
1360
|
+
_context14.prev = 0;
|
|
1619
1361
|
if (this.store.order) {
|
|
1620
|
-
|
|
1362
|
+
_context14.next = 3;
|
|
1621
1363
|
break;
|
|
1622
1364
|
}
|
|
1623
1365
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -1627,29 +1369,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1627
1369
|
this.currentSalesDetail = null;
|
|
1628
1370
|
this.discountConfigCacheKey = null;
|
|
1629
1371
|
this.hasManualDiscountSelection = false;
|
|
1630
|
-
|
|
1372
|
+
_context14.next = 9;
|
|
1631
1373
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1632
1374
|
tempOrder: tempOrder
|
|
1633
1375
|
});
|
|
1634
1376
|
case 9:
|
|
1635
1377
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1636
|
-
|
|
1378
|
+
_context14.next = 13;
|
|
1637
1379
|
break;
|
|
1638
1380
|
}
|
|
1639
1381
|
this.store.order.persistTempOrder();
|
|
1640
|
-
|
|
1382
|
+
_context14.next = 13;
|
|
1641
1383
|
return this.store.order.saveDraft();
|
|
1642
1384
|
case 13:
|
|
1643
|
-
return
|
|
1385
|
+
return _context14.abrupt("return", tempOrder);
|
|
1644
1386
|
case 16:
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
throw
|
|
1387
|
+
_context14.prev = 16;
|
|
1388
|
+
_context14.t0 = _context14["catch"](0);
|
|
1389
|
+
throw _context14.t0;
|
|
1648
1390
|
case 19:
|
|
1649
1391
|
case "end":
|
|
1650
|
-
return
|
|
1392
|
+
return _context14.stop();
|
|
1651
1393
|
}
|
|
1652
|
-
},
|
|
1394
|
+
}, _callee14, this, [[0, 16]]);
|
|
1653
1395
|
}));
|
|
1654
1396
|
function restoreOrder() {
|
|
1655
1397
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1663,22 +1405,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1663
1405
|
}, {
|
|
1664
1406
|
key: "clearOrderCartLines",
|
|
1665
1407
|
value: (function () {
|
|
1666
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1408
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1667
1409
|
var tempOrder;
|
|
1668
|
-
return _regeneratorRuntime().wrap(function
|
|
1669
|
-
while (1) switch (
|
|
1410
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1411
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1670
1412
|
case 0:
|
|
1671
|
-
|
|
1413
|
+
_context15.prev = 0;
|
|
1672
1414
|
if (this.store.order) {
|
|
1673
|
-
|
|
1415
|
+
_context15.next = 3;
|
|
1674
1416
|
break;
|
|
1675
1417
|
}
|
|
1676
1418
|
throw new Error('order 模块未初始化');
|
|
1677
1419
|
case 3:
|
|
1678
|
-
|
|
1420
|
+
_context15.next = 5;
|
|
1679
1421
|
return this.store.order.clearOrderCartLines();
|
|
1680
1422
|
case 5:
|
|
1681
|
-
tempOrder =
|
|
1423
|
+
tempOrder = _context15.sent;
|
|
1682
1424
|
if (this.currentSalesDetail) {
|
|
1683
1425
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
1684
1426
|
products: [],
|
|
@@ -1688,29 +1430,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1688
1430
|
discount_list: []
|
|
1689
1431
|
});
|
|
1690
1432
|
}
|
|
1691
|
-
|
|
1433
|
+
_context15.next = 9;
|
|
1692
1434
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1693
1435
|
tempOrder: tempOrder
|
|
1694
1436
|
});
|
|
1695
1437
|
case 9:
|
|
1696
1438
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1697
|
-
|
|
1439
|
+
_context15.next = 13;
|
|
1698
1440
|
break;
|
|
1699
1441
|
}
|
|
1700
1442
|
this.store.order.persistTempOrder();
|
|
1701
|
-
|
|
1443
|
+
_context15.next = 13;
|
|
1702
1444
|
return this.store.order.saveDraft();
|
|
1703
1445
|
case 13:
|
|
1704
|
-
return
|
|
1446
|
+
return _context15.abrupt("return", tempOrder);
|
|
1705
1447
|
case 16:
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
throw
|
|
1448
|
+
_context15.prev = 16;
|
|
1449
|
+
_context15.t0 = _context15["catch"](0);
|
|
1450
|
+
throw _context15.t0;
|
|
1709
1451
|
case 19:
|
|
1710
1452
|
case "end":
|
|
1711
|
-
return
|
|
1453
|
+
return _context15.stop();
|
|
1712
1454
|
}
|
|
1713
|
-
},
|
|
1455
|
+
}, _callee15, this, [[0, 16]]);
|
|
1714
1456
|
}));
|
|
1715
1457
|
function clearOrderCartLines() {
|
|
1716
1458
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -1727,32 +1469,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1727
1469
|
}, {
|
|
1728
1470
|
key: "getSummary",
|
|
1729
1471
|
value: function () {
|
|
1730
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1472
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1731
1473
|
var summary;
|
|
1732
|
-
return _regeneratorRuntime().wrap(function
|
|
1733
|
-
while (1) switch (
|
|
1474
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1475
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1734
1476
|
case 0:
|
|
1735
|
-
|
|
1477
|
+
_context16.prev = 0;
|
|
1736
1478
|
if (this.store.order) {
|
|
1737
|
-
|
|
1479
|
+
_context16.next = 3;
|
|
1738
1480
|
break;
|
|
1739
1481
|
}
|
|
1740
1482
|
throw new Error('order 模块未初始化');
|
|
1741
1483
|
case 3:
|
|
1742
|
-
|
|
1484
|
+
_context16.next = 5;
|
|
1743
1485
|
return this.store.order.getOrderSummary();
|
|
1744
1486
|
case 5:
|
|
1745
|
-
summary =
|
|
1746
|
-
return
|
|
1487
|
+
summary = _context16.sent;
|
|
1488
|
+
return _context16.abrupt("return", summary);
|
|
1747
1489
|
case 9:
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
throw
|
|
1490
|
+
_context16.prev = 9;
|
|
1491
|
+
_context16.t0 = _context16["catch"](0);
|
|
1492
|
+
throw _context16.t0;
|
|
1751
1493
|
case 12:
|
|
1752
1494
|
case "end":
|
|
1753
|
-
return
|
|
1495
|
+
return _context16.stop();
|
|
1754
1496
|
}
|
|
1755
|
-
},
|
|
1497
|
+
}, _callee16, this, [[0, 9]]);
|
|
1756
1498
|
}));
|
|
1757
1499
|
function getSummary() {
|
|
1758
1500
|
return _getSummary.apply(this, arguments);
|
|
@@ -1762,10 +1504,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1762
1504
|
}, {
|
|
1763
1505
|
key: "getHistoricalProductDiscountList",
|
|
1764
1506
|
value: function getHistoricalProductDiscountList(products) {
|
|
1765
|
-
var
|
|
1507
|
+
var _this8 = this;
|
|
1766
1508
|
var historyDiscountList = [];
|
|
1767
1509
|
products.forEach(function (item) {
|
|
1768
|
-
if (!
|
|
1510
|
+
if (!_this8.isPersistedOrderProduct(item)) return;
|
|
1769
1511
|
(item.discount_list || []).forEach(function (discount) {
|
|
1770
1512
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1771
1513
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -1825,11 +1567,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1825
1567
|
}, {
|
|
1826
1568
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1827
1569
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1828
|
-
var
|
|
1570
|
+
var _this9 = this;
|
|
1829
1571
|
if (params.discountAction !== 'edit') return false;
|
|
1830
1572
|
if (!params.products.length) return false;
|
|
1831
1573
|
var hasDraftProduct = params.products.some(function (product) {
|
|
1832
|
-
return !
|
|
1574
|
+
return !_this9.isPersistedOrderProduct(product);
|
|
1833
1575
|
});
|
|
1834
1576
|
if (hasDraftProduct) return false;
|
|
1835
1577
|
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
@@ -1869,14 +1611,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1869
1611
|
}, {
|
|
1870
1612
|
key: "loadDiscountConfig",
|
|
1871
1613
|
value: function () {
|
|
1872
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1614
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1873
1615
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1874
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result,
|
|
1875
|
-
return _regeneratorRuntime().wrap(function
|
|
1876
|
-
while (1) switch (
|
|
1616
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _orderStore$summary, holders, orderTotalAmount, result, _iterator, _step, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1617
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1618
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1877
1619
|
case 0:
|
|
1878
1620
|
if (this.store.order) {
|
|
1879
|
-
|
|
1621
|
+
_context17.next = 2;
|
|
1880
1622
|
break;
|
|
1881
1623
|
}
|
|
1882
1624
|
throw new Error('order 模块未初始化');
|
|
@@ -1896,18 +1638,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1896
1638
|
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
1897
1639
|
preparedDiscountList = [];
|
|
1898
1640
|
if (!(customerId && customerId !== 1)) {
|
|
1899
|
-
|
|
1641
|
+
_context17.next = 25;
|
|
1900
1642
|
break;
|
|
1901
1643
|
}
|
|
1902
1644
|
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
1903
|
-
|
|
1645
|
+
_context17.next = 19;
|
|
1904
1646
|
break;
|
|
1905
1647
|
}
|
|
1906
1648
|
preparedDiscountList = originalDiscountList;
|
|
1907
|
-
|
|
1649
|
+
_context17.next = 25;
|
|
1908
1650
|
break;
|
|
1909
1651
|
case 19:
|
|
1910
|
-
|
|
1652
|
+
_context17.next = 21;
|
|
1911
1653
|
return this.store.order.loadDiscountConfig({
|
|
1912
1654
|
customerId: customerId,
|
|
1913
1655
|
action: discountAction,
|
|
@@ -1915,24 +1657,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1915
1657
|
apply: false
|
|
1916
1658
|
});
|
|
1917
1659
|
case 21:
|
|
1918
|
-
preparedDiscountList =
|
|
1660
|
+
preparedDiscountList = _context17.sent;
|
|
1919
1661
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
1920
|
-
|
|
1662
|
+
_context17.next = 25;
|
|
1921
1663
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1922
1664
|
case 25:
|
|
1923
1665
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
1924
|
-
|
|
1666
|
+
_context17.next = 27;
|
|
1925
1667
|
break;
|
|
1926
1668
|
}
|
|
1927
|
-
return
|
|
1669
|
+
return _context17.abrupt("return", {
|
|
1928
1670
|
productList: tempOrder.products || [],
|
|
1929
|
-
discountList: currentDiscountList
|
|
1930
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
1671
|
+
discountList: currentDiscountList
|
|
1931
1672
|
});
|
|
1932
1673
|
case 27:
|
|
1933
1674
|
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 || []);
|
|
1934
1675
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
1935
|
-
|
|
1676
|
+
_context17.next = 31;
|
|
1936
1677
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1937
1678
|
case 31:
|
|
1938
1679
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
@@ -1942,17 +1683,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1942
1683
|
nextDiscountList: nextDiscountList
|
|
1943
1684
|
});
|
|
1944
1685
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
1945
|
-
|
|
1686
|
+
_context17.next = 40;
|
|
1946
1687
|
break;
|
|
1947
1688
|
}
|
|
1948
|
-
|
|
1689
|
+
_context17.next = 35;
|
|
1949
1690
|
return this.store.order.recalculateSummary({
|
|
1950
1691
|
createIfMissing: true
|
|
1951
1692
|
});
|
|
1952
1693
|
case 35:
|
|
1953
|
-
_summary =
|
|
1694
|
+
_summary = _context17.sent;
|
|
1954
1695
|
this.store.order.persistTempOrder();
|
|
1955
|
-
|
|
1696
|
+
_context17.next = 39;
|
|
1956
1697
|
return this.effectsEmit('onDiscountApplied', {
|
|
1957
1698
|
productList: tempOrder.products || [],
|
|
1958
1699
|
discountList: nextDiscountList,
|
|
@@ -1960,22 +1701,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1960
1701
|
tempOrder: tempOrder
|
|
1961
1702
|
});
|
|
1962
1703
|
case 39:
|
|
1963
|
-
return
|
|
1704
|
+
return _context17.abrupt("return", {
|
|
1964
1705
|
productList: tempOrder.products || [],
|
|
1965
|
-
discountList: nextDiscountList
|
|
1966
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
1706
|
+
discountList: nextDiscountList
|
|
1967
1707
|
});
|
|
1968
1708
|
case 40:
|
|
1969
1709
|
if (!rulesModule) {
|
|
1970
|
-
|
|
1710
|
+
_context17.next = 78;
|
|
1971
1711
|
break;
|
|
1972
1712
|
}
|
|
1713
|
+
holders = ((_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
|
|
1973
1714
|
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
1974
1715
|
console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
|
|
1975
1716
|
result = rulesModule.calcDiscount({
|
|
1976
1717
|
productList: tempOrder.products,
|
|
1977
1718
|
discountList: nextDiscountList,
|
|
1978
|
-
holders:
|
|
1719
|
+
holders: holders,
|
|
1979
1720
|
isFormSubject: function isFormSubject(product) {
|
|
1980
1721
|
return resolveIsFormSubject(tempOrder, product);
|
|
1981
1722
|
},
|
|
@@ -1987,23 +1728,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1987
1728
|
if (result.productList) {
|
|
1988
1729
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1989
1730
|
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
case
|
|
1994
|
-
if ((
|
|
1995
|
-
|
|
1731
|
+
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1732
|
+
_context17.prev = 47;
|
|
1733
|
+
_iterator.s();
|
|
1734
|
+
case 49:
|
|
1735
|
+
if ((_step = _iterator.n()).done) {
|
|
1736
|
+
_context17.next = 64;
|
|
1996
1737
|
break;
|
|
1997
1738
|
}
|
|
1998
|
-
product =
|
|
1739
|
+
product = _step.value;
|
|
1999
1740
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
2000
1741
|
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;
|
|
2001
1742
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2002
|
-
|
|
1743
|
+
_context17.next = 55;
|
|
2003
1744
|
break;
|
|
2004
1745
|
}
|
|
2005
|
-
return
|
|
2006
|
-
case
|
|
1746
|
+
return _context17.abrupt("continue", 62);
|
|
1747
|
+
case 55:
|
|
2007
1748
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2008
1749
|
return sum + Number(pd.amount || 0);
|
|
2009
1750
|
}, 0);
|
|
@@ -2019,83 +1760,75 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2019
1760
|
mainPrice: newMainSellingPrice,
|
|
2020
1761
|
bundle: product.product_bundle
|
|
2021
1762
|
});
|
|
2022
|
-
case
|
|
2023
|
-
|
|
1763
|
+
case 62:
|
|
1764
|
+
_context17.next = 49;
|
|
2024
1765
|
break;
|
|
2025
|
-
case
|
|
2026
|
-
|
|
1766
|
+
case 64:
|
|
1767
|
+
_context17.next = 69;
|
|
2027
1768
|
break;
|
|
2028
|
-
case
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
case
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
return
|
|
2036
|
-
case
|
|
1769
|
+
case 66:
|
|
1770
|
+
_context17.prev = 66;
|
|
1771
|
+
_context17.t0 = _context17["catch"](47);
|
|
1772
|
+
_iterator.e(_context17.t0);
|
|
1773
|
+
case 69:
|
|
1774
|
+
_context17.prev = 69;
|
|
1775
|
+
_iterator.f();
|
|
1776
|
+
return _context17.finish(69);
|
|
1777
|
+
case 72:
|
|
2037
1778
|
if (!result.discountList) {
|
|
2038
|
-
|
|
1779
|
+
_context17.next = 78;
|
|
2039
1780
|
break;
|
|
2040
1781
|
}
|
|
2041
1782
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2042
1783
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2043
|
-
|
|
1784
|
+
_context17.next = 77;
|
|
2044
1785
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2045
|
-
case
|
|
1786
|
+
case 77:
|
|
2046
1787
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2047
1788
|
return discount.isSelected;
|
|
2048
1789
|
});
|
|
2049
|
-
case
|
|
2050
|
-
|
|
1790
|
+
case 78:
|
|
1791
|
+
_context17.next = 80;
|
|
2051
1792
|
return this.store.order.recalculateSummary({
|
|
2052
1793
|
createIfMissing: true
|
|
2053
1794
|
});
|
|
2054
|
-
case
|
|
2055
|
-
summary =
|
|
1795
|
+
case 80:
|
|
1796
|
+
summary = _context17.sent;
|
|
2056
1797
|
this.store.order.persistTempOrder();
|
|
2057
|
-
|
|
1798
|
+
_context17.next = 84;
|
|
2058
1799
|
return this.effectsEmit('onDiscountApplied', {
|
|
2059
1800
|
productList: tempOrder.products || [],
|
|
2060
1801
|
discountList: nextDiscountList,
|
|
2061
1802
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
2062
1803
|
tempOrder: tempOrder
|
|
2063
1804
|
});
|
|
2064
|
-
case
|
|
2065
|
-
return
|
|
1805
|
+
case 84:
|
|
1806
|
+
return _context17.abrupt("return", {
|
|
2066
1807
|
productList: tempOrder.products || [],
|
|
2067
|
-
discountList: nextDiscountList
|
|
2068
|
-
availableWalletIds: this.getAvailableWalletIds()
|
|
1808
|
+
discountList: nextDiscountList
|
|
2069
1809
|
});
|
|
2070
|
-
case
|
|
1810
|
+
case 85:
|
|
2071
1811
|
case "end":
|
|
2072
|
-
return
|
|
1812
|
+
return _context17.stop();
|
|
2073
1813
|
}
|
|
2074
|
-
},
|
|
1814
|
+
}, _callee17, this, [[47, 66, 69, 72]]);
|
|
2075
1815
|
}));
|
|
2076
|
-
function loadDiscountConfig(
|
|
1816
|
+
function loadDiscountConfig(_x11) {
|
|
2077
1817
|
return _loadDiscountConfig.apply(this, arguments);
|
|
2078
1818
|
}
|
|
2079
1819
|
return loadDiscountConfig;
|
|
2080
1820
|
}()
|
|
2081
|
-
}, {
|
|
2082
|
-
key: "getAvailableWalletIds",
|
|
2083
|
-
value: function getAvailableWalletIds() {
|
|
2084
|
-
var _this$store$order4;
|
|
2085
|
-
if (!((_this$store$order4 = this.store.order) !== null && _this$store$order4 !== void 0 && _this$store$order4.getAvailableWalletIds)) return [];
|
|
2086
|
-
return this.store.order.getAvailableWalletIds();
|
|
2087
|
-
}
|
|
2088
1821
|
}, {
|
|
2089
1822
|
key: "bestDiscount",
|
|
2090
1823
|
value: function () {
|
|
2091
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1824
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(cb) {
|
|
2092
1825
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
2093
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _orderStore$summary2, orderTotalAmount;
|
|
2094
|
-
return _regeneratorRuntime().wrap(function
|
|
2095
|
-
while (1) switch (
|
|
1826
|
+
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder2, _orderStore$summary2, holders, orderTotalAmount;
|
|
1827
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1828
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2096
1829
|
case 0:
|
|
2097
1830
|
if (this.store.order) {
|
|
2098
|
-
|
|
1831
|
+
_context18.next = 2;
|
|
2099
1832
|
break;
|
|
2100
1833
|
}
|
|
2101
1834
|
throw new Error('order 模块未初始化');
|
|
@@ -2111,19 +1844,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2111
1844
|
productList: tempOrder.products || [],
|
|
2112
1845
|
discountList: nextDiscountList
|
|
2113
1846
|
};
|
|
2114
|
-
|
|
1847
|
+
_context18.next = 12;
|
|
2115
1848
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2116
1849
|
case 12:
|
|
2117
1850
|
if (!rulesModule) {
|
|
2118
|
-
|
|
1851
|
+
_context18.next = 25;
|
|
2119
1852
|
break;
|
|
2120
1853
|
}
|
|
1854
|
+
holders = ((_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_record) || [];
|
|
2121
1855
|
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
2122
1856
|
console.log('[BaseSales.bestDiscount.calcDiscount]');
|
|
2123
1857
|
result = rulesModule.calcDiscount({
|
|
2124
1858
|
productList: tempOrder.products,
|
|
2125
1859
|
discountList: nextDiscountList,
|
|
2126
|
-
holders:
|
|
1860
|
+
holders: holders,
|
|
2127
1861
|
isFormSubject: function isFormSubject(product) {
|
|
2128
1862
|
return resolveIsFormSubject(tempOrder, product);
|
|
2129
1863
|
},
|
|
@@ -2133,14 +1867,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2133
1867
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2134
1868
|
}
|
|
2135
1869
|
if (!result.discountList) {
|
|
2136
|
-
|
|
1870
|
+
_context18.next = 25;
|
|
2137
1871
|
break;
|
|
2138
1872
|
}
|
|
2139
1873
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
2140
1874
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2141
|
-
|
|
1875
|
+
_context18.next = 23;
|
|
2142
1876
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2143
|
-
case
|
|
1877
|
+
case 23:
|
|
2144
1878
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
2145
1879
|
return discount.isSelected;
|
|
2146
1880
|
});
|
|
@@ -2148,30 +1882,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2148
1882
|
productList: tempOrder.products,
|
|
2149
1883
|
discountList: nextDiscountList
|
|
2150
1884
|
};
|
|
2151
|
-
case
|
|
2152
|
-
|
|
1885
|
+
case 25:
|
|
1886
|
+
_context18.next = 27;
|
|
2153
1887
|
return this.store.order.recalculateSummary({
|
|
2154
1888
|
createIfMissing: true
|
|
2155
1889
|
});
|
|
2156
|
-
case
|
|
1890
|
+
case 27:
|
|
2157
1891
|
this.store.order.persistTempOrder();
|
|
2158
|
-
_context21.next = 29;
|
|
2159
|
-
return this.effectsEmit('onDiscountApplied', {
|
|
2160
|
-
productList: tempOrder.products || [],
|
|
2161
|
-
discountList: nextDiscountList,
|
|
2162
|
-
selectedDiscountList: tempOrder.discount_list || [],
|
|
2163
|
-
tempOrder: tempOrder
|
|
2164
|
-
});
|
|
2165
|
-
case 29:
|
|
2166
1892
|
cb === null || cb === void 0 || cb(result);
|
|
2167
|
-
return
|
|
2168
|
-
case
|
|
1893
|
+
return _context18.abrupt("return", result);
|
|
1894
|
+
case 30:
|
|
2169
1895
|
case "end":
|
|
2170
|
-
return
|
|
1896
|
+
return _context18.stop();
|
|
2171
1897
|
}
|
|
2172
|
-
},
|
|
1898
|
+
}, _callee18, this);
|
|
2173
1899
|
}));
|
|
2174
|
-
function bestDiscount(
|
|
1900
|
+
function bestDiscount(_x12) {
|
|
2175
1901
|
return _bestDiscount.apply(this, arguments);
|
|
2176
1902
|
}
|
|
2177
1903
|
return bestDiscount;
|
|
@@ -2182,118 +1908,52 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2182
1908
|
if (!this.store.order) return [];
|
|
2183
1909
|
return this.store.order.getDiscountList();
|
|
2184
1910
|
}
|
|
2185
|
-
|
|
2186
|
-
/** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
|
|
2187
|
-
}, {
|
|
2188
|
-
key: "getOriginalDiscountList",
|
|
2189
|
-
value: function getOriginalDiscountList() {
|
|
2190
|
-
var _store, _discountModule$getOr3;
|
|
2191
|
-
if (!this.store.order) return [];
|
|
2192
|
-
var discountModule = (_store = this.store.order.store) === null || _store === void 0 ? void 0 : _store.discount;
|
|
2193
|
-
return (discountModule === null || discountModule === void 0 || (_discountModule$getOr3 = discountModule.getOriginalDiscountList) === null || _discountModule$getOr3 === void 0 ? void 0 : _discountModule$getOr3.call(discountModule)) || [];
|
|
2194
|
-
}
|
|
2195
|
-
|
|
2196
|
-
/**
|
|
2197
|
-
* 同步写入 Discount 模块的 discountList / originalDiscountList。
|
|
2198
|
-
* 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
|
|
2199
|
-
*/
|
|
2200
|
-
}, {
|
|
2201
|
-
key: "replaceDiscountStoreLists",
|
|
2202
|
-
value: (function () {
|
|
2203
|
-
var _replaceDiscountStoreLists = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2204
|
-
var _store2;
|
|
2205
|
-
var discountModule;
|
|
2206
|
-
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2207
|
-
while (1) switch (_context22.prev = _context22.next) {
|
|
2208
|
-
case 0:
|
|
2209
|
-
if (this.store.order) {
|
|
2210
|
-
_context22.next = 2;
|
|
2211
|
-
break;
|
|
2212
|
-
}
|
|
2213
|
-
throw new Error('order 模块未初始化');
|
|
2214
|
-
case 2:
|
|
2215
|
-
discountModule = (_store2 = this.store.order.store) === null || _store2 === void 0 ? void 0 : _store2.discount;
|
|
2216
|
-
if (discountModule) {
|
|
2217
|
-
_context22.next = 5;
|
|
2218
|
-
break;
|
|
2219
|
-
}
|
|
2220
|
-
return _context22.abrupt("return");
|
|
2221
|
-
case 5:
|
|
2222
|
-
if (!params.originalDiscountList) {
|
|
2223
|
-
_context22.next = 8;
|
|
2224
|
-
break;
|
|
2225
|
-
}
|
|
2226
|
-
_context22.next = 8;
|
|
2227
|
-
return discountModule.setOriginalDiscountList(params.originalDiscountList);
|
|
2228
|
-
case 8:
|
|
2229
|
-
_context22.next = 10;
|
|
2230
|
-
return discountModule.setDiscountList(params.discountList);
|
|
2231
|
-
case 10:
|
|
2232
|
-
case "end":
|
|
2233
|
-
return _context22.stop();
|
|
2234
|
-
}
|
|
2235
|
-
}, _callee22, this);
|
|
2236
|
-
}));
|
|
2237
|
-
function replaceDiscountStoreLists(_x15) {
|
|
2238
|
-
return _replaceDiscountStoreLists.apply(this, arguments);
|
|
2239
|
-
}
|
|
2240
|
-
return replaceDiscountStoreLists;
|
|
2241
|
-
}())
|
|
2242
1911
|
}, {
|
|
2243
1912
|
key: "scanPromotionCode",
|
|
2244
1913
|
value: function () {
|
|
2245
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2246
|
-
var raw
|
|
2247
|
-
return _regeneratorRuntime().wrap(function
|
|
2248
|
-
while (1) switch (
|
|
1914
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(code, customerId) {
|
|
1915
|
+
var raw;
|
|
1916
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1917
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2249
1918
|
case 0:
|
|
2250
|
-
|
|
1919
|
+
_context19.prev = 0;
|
|
2251
1920
|
if (this.store.order) {
|
|
2252
|
-
|
|
1921
|
+
_context19.next = 3;
|
|
2253
1922
|
break;
|
|
2254
1923
|
}
|
|
2255
1924
|
throw new Error('order 模块未初始化');
|
|
2256
1925
|
case 3:
|
|
2257
|
-
|
|
1926
|
+
_context19.next = 5;
|
|
2258
1927
|
return this.store.order.scanCode(code, customerId);
|
|
2259
1928
|
case 5:
|
|
2260
|
-
raw =
|
|
1929
|
+
raw = _context19.sent;
|
|
2261
1930
|
if (!raw.isAvailable) {
|
|
2262
|
-
|
|
1931
|
+
_context19.next = 10;
|
|
2263
1932
|
break;
|
|
2264
1933
|
}
|
|
2265
|
-
|
|
1934
|
+
_context19.next = 9;
|
|
2266
1935
|
return this.store.order.recalculateSummary({
|
|
2267
1936
|
createIfMissing: true
|
|
2268
1937
|
});
|
|
2269
1938
|
case 9:
|
|
2270
1939
|
this.store.order.persistTempOrder();
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
return this.effectsEmit('onDiscountApplied', {
|
|
2274
|
-
productList: tempOrder.products || [],
|
|
2275
|
-
discountList: this.store.order.getDiscountList(),
|
|
2276
|
-
selectedDiscountList: tempOrder.discount_list || [],
|
|
2277
|
-
tempOrder: tempOrder
|
|
2278
|
-
});
|
|
2279
|
-
case 13:
|
|
2280
|
-
return _context23.abrupt("return", {
|
|
1940
|
+
case 10:
|
|
1941
|
+
return _context19.abrupt("return", {
|
|
2281
1942
|
isAvailable: raw.isAvailable,
|
|
2282
1943
|
type: raw.type,
|
|
2283
|
-
unavailableReason: raw.unavailableReason
|
|
2284
|
-
scannedDiscountList: raw.scannedDiscountList
|
|
1944
|
+
unavailableReason: raw.unavailableReason
|
|
2285
1945
|
});
|
|
1946
|
+
case 13:
|
|
1947
|
+
_context19.prev = 13;
|
|
1948
|
+
_context19.t0 = _context19["catch"](0);
|
|
1949
|
+
throw _context19.t0;
|
|
2286
1950
|
case 16:
|
|
2287
|
-
_context23.prev = 16;
|
|
2288
|
-
_context23.t0 = _context23["catch"](0);
|
|
2289
|
-
throw _context23.t0;
|
|
2290
|
-
case 19:
|
|
2291
1951
|
case "end":
|
|
2292
|
-
return
|
|
1952
|
+
return _context19.stop();
|
|
2293
1953
|
}
|
|
2294
|
-
},
|
|
1954
|
+
}, _callee19, this, [[0, 13]]);
|
|
2295
1955
|
}));
|
|
2296
|
-
function scanPromotionCode(
|
|
1956
|
+
function scanPromotionCode(_x13, _x14) {
|
|
2297
1957
|
return _scanPromotionCode.apply(this, arguments);
|
|
2298
1958
|
}
|
|
2299
1959
|
return scanPromotionCode;
|
|
@@ -2301,14 +1961,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2301
1961
|
}, {
|
|
2302
1962
|
key: "setDiscountSelected",
|
|
2303
1963
|
value: function () {
|
|
2304
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2305
|
-
var list, updated, tempOrder, orderStore, discountModule, rulesModule, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds,
|
|
2306
|
-
return _regeneratorRuntime().wrap(function
|
|
2307
|
-
while (1) switch (
|
|
1964
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1965
|
+
var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1966
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1967
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2308
1968
|
case 0:
|
|
2309
|
-
|
|
1969
|
+
_context20.prev = 0;
|
|
2310
1970
|
if (this.store.order) {
|
|
2311
|
-
|
|
1971
|
+
_context20.next = 3;
|
|
2312
1972
|
break;
|
|
2313
1973
|
}
|
|
2314
1974
|
throw new Error('order 模块未初始化');
|
|
@@ -2325,17 +1985,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2325
1985
|
orderStore = this.store.order.store || {};
|
|
2326
1986
|
discountModule = orderStore.discount;
|
|
2327
1987
|
rulesModule = orderStore.rules;
|
|
1988
|
+
holders = ((_tempOrder$holder3 = tempOrder.holder) === null || _tempOrder$holder3 === void 0 ? void 0 : _tempOrder$holder3.form_record) || [];
|
|
2328
1989
|
nextDiscountList = updated;
|
|
2329
|
-
|
|
1990
|
+
_context20.next = 14;
|
|
2330
1991
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
2331
|
-
case
|
|
1992
|
+
case 14:
|
|
2332
1993
|
if (rulesModule) {
|
|
2333
1994
|
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
2334
1995
|
console.log('[BaseSales.setDiscountSelected.calcDiscount]');
|
|
2335
1996
|
result = rulesModule.calcDiscount({
|
|
2336
1997
|
productList: tempOrder.products,
|
|
2337
1998
|
discountList: updated,
|
|
2338
|
-
holders:
|
|
1999
|
+
holders: holders,
|
|
2339
2000
|
isFormSubject: function isFormSubject(product) {
|
|
2340
2001
|
return resolveIsFormSubject(tempOrder, product);
|
|
2341
2002
|
},
|
|
@@ -2358,10 +2019,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2358
2019
|
}).map(function (d) {
|
|
2359
2020
|
return d.id;
|
|
2360
2021
|
}));
|
|
2361
|
-
|
|
2022
|
+
_iterator2 = _createForOfIteratorHelper(nextDiscountList);
|
|
2362
2023
|
try {
|
|
2363
|
-
for (
|
|
2364
|
-
d =
|
|
2024
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2025
|
+
d = _step2.value;
|
|
2365
2026
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
2366
2027
|
d.isSelected = false;
|
|
2367
2028
|
d.isManualSelect = true;
|
|
@@ -2369,9 +2030,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2369
2030
|
}
|
|
2370
2031
|
}
|
|
2371
2032
|
} catch (err) {
|
|
2372
|
-
|
|
2033
|
+
_iterator2.e(err);
|
|
2373
2034
|
} finally {
|
|
2374
|
-
|
|
2035
|
+
_iterator2.f();
|
|
2375
2036
|
}
|
|
2376
2037
|
}
|
|
2377
2038
|
}
|
|
@@ -2388,30 +2049,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2388
2049
|
return rid != null && selectedResourceIds.has(rid);
|
|
2389
2050
|
});
|
|
2390
2051
|
};
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
case
|
|
2395
|
-
if ((
|
|
2396
|
-
|
|
2052
|
+
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
2053
|
+
_context20.prev = 18;
|
|
2054
|
+
_iterator3.s();
|
|
2055
|
+
case 20:
|
|
2056
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
2057
|
+
_context20.next = 37;
|
|
2397
2058
|
break;
|
|
2398
2059
|
}
|
|
2399
|
-
product =
|
|
2060
|
+
product = _step3.value;
|
|
2400
2061
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
2401
2062
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
2402
2063
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
2403
|
-
|
|
2064
|
+
_context20.next = 26;
|
|
2404
2065
|
break;
|
|
2405
2066
|
}
|
|
2406
|
-
return
|
|
2407
|
-
case
|
|
2067
|
+
return _context20.abrupt("continue", 35);
|
|
2068
|
+
case 26:
|
|
2408
2069
|
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2409
2070
|
if (Array.isArray(product.product_bundle)) {
|
|
2410
2071
|
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2411
|
-
var
|
|
2072
|
+
var _ref19, _bundle$original_pric;
|
|
2412
2073
|
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2413
2074
|
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2414
|
-
var restoredBundlePrice = (
|
|
2075
|
+
var restoredBundlePrice = (_ref19 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref19 !== void 0 ? _ref19 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2415
2076
|
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2416
2077
|
price: restoredBundlePrice,
|
|
2417
2078
|
bundle_selling_price: restoredBundlePrice
|
|
@@ -2438,33 +2099,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2438
2099
|
mainPrice: newMainSellingPrice,
|
|
2439
2100
|
bundle: product.product_bundle
|
|
2440
2101
|
});
|
|
2441
|
-
case
|
|
2442
|
-
|
|
2102
|
+
case 35:
|
|
2103
|
+
_context20.next = 20;
|
|
2443
2104
|
break;
|
|
2444
|
-
case
|
|
2445
|
-
|
|
2105
|
+
case 37:
|
|
2106
|
+
_context20.next = 42;
|
|
2446
2107
|
break;
|
|
2447
|
-
case
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
case
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
return
|
|
2455
|
-
case
|
|
2108
|
+
case 39:
|
|
2109
|
+
_context20.prev = 39;
|
|
2110
|
+
_context20.t0 = _context20["catch"](18);
|
|
2111
|
+
_iterator3.e(_context20.t0);
|
|
2112
|
+
case 42:
|
|
2113
|
+
_context20.prev = 42;
|
|
2114
|
+
_iterator3.f();
|
|
2115
|
+
return _context20.finish(42);
|
|
2116
|
+
case 45:
|
|
2456
2117
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2457
|
-
|
|
2118
|
+
_context20.next = 48;
|
|
2458
2119
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2459
|
-
case
|
|
2120
|
+
case 48:
|
|
2460
2121
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2461
2122
|
return d.isSelected;
|
|
2462
2123
|
});
|
|
2463
|
-
|
|
2124
|
+
_context20.next = 51;
|
|
2464
2125
|
return this.store.order.recalculateSummary({
|
|
2465
2126
|
createIfMissing: true
|
|
2466
2127
|
});
|
|
2467
|
-
case
|
|
2128
|
+
case 51:
|
|
2468
2129
|
this.store.order.persistTempOrder();
|
|
2469
2130
|
this.effectsEmit('onDiscountApplied', {
|
|
2470
2131
|
productList: tempOrder.products,
|
|
@@ -2472,19 +2133,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2472
2133
|
selectedDiscountList: tempOrder.discount_list,
|
|
2473
2134
|
tempOrder: tempOrder
|
|
2474
2135
|
});
|
|
2475
|
-
|
|
2136
|
+
_context20.next = 58;
|
|
2476
2137
|
break;
|
|
2477
|
-
case
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
throw
|
|
2481
|
-
case
|
|
2138
|
+
case 55:
|
|
2139
|
+
_context20.prev = 55;
|
|
2140
|
+
_context20.t1 = _context20["catch"](0);
|
|
2141
|
+
throw _context20.t1;
|
|
2142
|
+
case 58:
|
|
2482
2143
|
case "end":
|
|
2483
|
-
return
|
|
2144
|
+
return _context20.stop();
|
|
2484
2145
|
}
|
|
2485
|
-
},
|
|
2146
|
+
}, _callee20, this, [[0, 55], [18, 39, 42, 45]]);
|
|
2486
2147
|
}));
|
|
2487
|
-
function setDiscountSelected(
|
|
2148
|
+
function setDiscountSelected(_x15) {
|
|
2488
2149
|
return _setDiscountSelected.apply(this, arguments);
|
|
2489
2150
|
}
|
|
2490
2151
|
return setDiscountSelected;
|
|
@@ -2492,23 +2153,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2492
2153
|
}, {
|
|
2493
2154
|
key: "applyDiscountCalculationResult",
|
|
2494
2155
|
value: function () {
|
|
2495
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2156
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(result) {
|
|
2496
2157
|
var tempOrder, orderStore, discountModule;
|
|
2497
|
-
return _regeneratorRuntime().wrap(function
|
|
2498
|
-
while (1) switch (
|
|
2158
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2159
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2499
2160
|
case 0:
|
|
2500
|
-
|
|
2161
|
+
_context21.prev = 0;
|
|
2501
2162
|
if (this.store.order) {
|
|
2502
|
-
|
|
2163
|
+
_context21.next = 3;
|
|
2503
2164
|
break;
|
|
2504
2165
|
}
|
|
2505
2166
|
throw new Error('order 模块未初始化');
|
|
2506
2167
|
case 3:
|
|
2507
2168
|
if (result) {
|
|
2508
|
-
|
|
2169
|
+
_context21.next = 5;
|
|
2509
2170
|
break;
|
|
2510
2171
|
}
|
|
2511
|
-
return
|
|
2172
|
+
return _context21.abrupt("return");
|
|
2512
2173
|
case 5:
|
|
2513
2174
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2514
2175
|
orderStore = this.store.order.store || {};
|
|
@@ -2517,44 +2178,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2517
2178
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2518
2179
|
}
|
|
2519
2180
|
if (!result.discountList) {
|
|
2520
|
-
|
|
2181
|
+
_context21.next = 14;
|
|
2521
2182
|
break;
|
|
2522
2183
|
}
|
|
2523
2184
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
2524
|
-
|
|
2185
|
+
_context21.next = 13;
|
|
2525
2186
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
2526
2187
|
case 13:
|
|
2527
2188
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
2528
2189
|
return discount.isSelected;
|
|
2529
2190
|
});
|
|
2530
2191
|
case 14:
|
|
2531
|
-
|
|
2192
|
+
_context21.next = 16;
|
|
2532
2193
|
return this.store.order.recalculateSummary({
|
|
2533
2194
|
createIfMissing: true
|
|
2534
2195
|
});
|
|
2535
2196
|
case 16:
|
|
2536
2197
|
this.store.order.persistTempOrder();
|
|
2537
|
-
|
|
2538
|
-
return this.effectsEmit('onDiscountApplied', {
|
|
2539
|
-
productList: tempOrder.products || [],
|
|
2540
|
-
discountList: result.discountList || [],
|
|
2541
|
-
selectedDiscountList: tempOrder.discount_list || [],
|
|
2542
|
-
tempOrder: tempOrder
|
|
2543
|
-
});
|
|
2544
|
-
case 19:
|
|
2545
|
-
_context25.next = 24;
|
|
2198
|
+
_context21.next = 22;
|
|
2546
2199
|
break;
|
|
2547
|
-
case
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
throw
|
|
2551
|
-
case
|
|
2200
|
+
case 19:
|
|
2201
|
+
_context21.prev = 19;
|
|
2202
|
+
_context21.t0 = _context21["catch"](0);
|
|
2203
|
+
throw _context21.t0;
|
|
2204
|
+
case 22:
|
|
2552
2205
|
case "end":
|
|
2553
|
-
return
|
|
2206
|
+
return _context21.stop();
|
|
2554
2207
|
}
|
|
2555
|
-
},
|
|
2208
|
+
}, _callee21, this, [[0, 19]]);
|
|
2556
2209
|
}));
|
|
2557
|
-
function applyDiscountCalculationResult(
|
|
2210
|
+
function applyDiscountCalculationResult(_x16) {
|
|
2558
2211
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2559
2212
|
}
|
|
2560
2213
|
return applyDiscountCalculationResult;
|
|
@@ -2562,18 +2215,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2562
2215
|
}, {
|
|
2563
2216
|
key: "submitScanOrder",
|
|
2564
2217
|
value: function () {
|
|
2565
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2566
|
-
return _regeneratorRuntime().wrap(function
|
|
2567
|
-
while (1) switch (
|
|
2218
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2219
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2220
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2568
2221
|
case 0:
|
|
2569
|
-
return
|
|
2222
|
+
return _context22.abrupt("return", this.submitSalesOrder(params));
|
|
2570
2223
|
case 1:
|
|
2571
2224
|
case "end":
|
|
2572
|
-
return
|
|
2225
|
+
return _context22.stop();
|
|
2573
2226
|
}
|
|
2574
|
-
},
|
|
2227
|
+
}, _callee22, this);
|
|
2575
2228
|
}));
|
|
2576
|
-
function submitScanOrder(
|
|
2229
|
+
function submitScanOrder(_x17) {
|
|
2577
2230
|
return _submitScanOrder.apply(this, arguments);
|
|
2578
2231
|
}
|
|
2579
2232
|
return submitScanOrder;
|
|
@@ -2587,14 +2240,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2587
2240
|
}, {
|
|
2588
2241
|
key: "submitSalesOrder",
|
|
2589
2242
|
value: (function () {
|
|
2590
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2243
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2591
2244
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
2592
2245
|
var inferredPaymentStatus, submitParams;
|
|
2593
|
-
return _regeneratorRuntime().wrap(function
|
|
2594
|
-
while (1) switch (
|
|
2246
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2247
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2595
2248
|
case 0:
|
|
2596
2249
|
if (this.store.order) {
|
|
2597
|
-
|
|
2250
|
+
_context23.next = 2;
|
|
2598
2251
|
break;
|
|
2599
2252
|
}
|
|
2600
2253
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2619,14 +2272,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2619
2272
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2620
2273
|
enhancePayload: params.enhancePayload
|
|
2621
2274
|
} : {});
|
|
2622
|
-
return
|
|
2275
|
+
return _context23.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
2623
2276
|
case 5:
|
|
2624
2277
|
case "end":
|
|
2625
|
-
return
|
|
2278
|
+
return _context23.stop();
|
|
2626
2279
|
}
|
|
2627
|
-
},
|
|
2280
|
+
}, _callee23, this);
|
|
2628
2281
|
}));
|
|
2629
|
-
function submitSalesOrder(
|
|
2282
|
+
function submitSalesOrder(_x18) {
|
|
2630
2283
|
return _submitSalesOrder.apply(this, arguments);
|
|
2631
2284
|
}
|
|
2632
2285
|
return submitSalesOrder;
|
|
@@ -2634,14 +2287,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2634
2287
|
}, {
|
|
2635
2288
|
key: "submitTempOrderAsync",
|
|
2636
2289
|
value: function () {
|
|
2637
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2290
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2638
2291
|
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2639
2292
|
var inferredPaymentStatus, submitParams;
|
|
2640
|
-
return _regeneratorRuntime().wrap(function
|
|
2641
|
-
while (1) switch (
|
|
2293
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2294
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2642
2295
|
case 0:
|
|
2643
2296
|
if (this.store.order) {
|
|
2644
|
-
|
|
2297
|
+
_context24.next = 2;
|
|
2645
2298
|
break;
|
|
2646
2299
|
}
|
|
2647
2300
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2664,14 +2317,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2664
2317
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2665
2318
|
enhancePayload: params.enhancePayload
|
|
2666
2319
|
} : {});
|
|
2667
|
-
return
|
|
2320
|
+
return _context24.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2668
2321
|
case 5:
|
|
2669
2322
|
case "end":
|
|
2670
|
-
return
|
|
2323
|
+
return _context24.stop();
|
|
2671
2324
|
}
|
|
2672
|
-
},
|
|
2325
|
+
}, _callee24, this);
|
|
2673
2326
|
}));
|
|
2674
|
-
function submitTempOrderAsync(
|
|
2327
|
+
function submitTempOrderAsync(_x19) {
|
|
2675
2328
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2676
2329
|
}
|
|
2677
2330
|
return submitTempOrderAsync;
|
|
@@ -2679,14 +2332,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2679
2332
|
}, {
|
|
2680
2333
|
key: "printLocalOrderReceipt",
|
|
2681
2334
|
value: function () {
|
|
2682
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2335
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(lookup) {
|
|
2683
2336
|
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2684
|
-
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$
|
|
2685
|
-
return _regeneratorRuntime().wrap(function
|
|
2686
|
-
while (1) switch (
|
|
2337
|
+
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order4, _data;
|
|
2338
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2339
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2687
2340
|
case 0:
|
|
2688
2341
|
if (this.store.order) {
|
|
2689
|
-
|
|
2342
|
+
_context25.next = 2;
|
|
2690
2343
|
break;
|
|
2691
2344
|
}
|
|
2692
2345
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2717,28 +2370,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2717
2370
|
channel: context.channel,
|
|
2718
2371
|
type: context.type
|
|
2719
2372
|
});
|
|
2720
|
-
|
|
2373
|
+
_context25.next = 8;
|
|
2721
2374
|
return this.request.post('/local/print-order', payload, {
|
|
2722
2375
|
osServer: true,
|
|
2723
2376
|
customToast: function customToast() {}
|
|
2724
2377
|
});
|
|
2725
2378
|
case 8:
|
|
2726
|
-
response =
|
|
2379
|
+
response = _context25.sent;
|
|
2727
2380
|
if (hasLookup) {
|
|
2728
|
-
|
|
2381
|
+
_context25.next = 12;
|
|
2729
2382
|
break;
|
|
2730
2383
|
}
|
|
2731
|
-
|
|
2732
|
-
return (_this$store$order$app = (_this$store$
|
|
2384
|
+
_context25.next = 12;
|
|
2385
|
+
return (_this$store$order$app = (_this$store$order4 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order4, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
2733
2386
|
case 12:
|
|
2734
|
-
return
|
|
2387
|
+
return _context25.abrupt("return", response);
|
|
2735
2388
|
case 13:
|
|
2736
2389
|
case "end":
|
|
2737
|
-
return
|
|
2390
|
+
return _context25.stop();
|
|
2738
2391
|
}
|
|
2739
|
-
},
|
|
2392
|
+
}, _callee25, this);
|
|
2740
2393
|
}));
|
|
2741
|
-
function printLocalOrderReceipt(
|
|
2394
|
+
function printLocalOrderReceipt(_x20) {
|
|
2742
2395
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2743
2396
|
}
|
|
2744
2397
|
return printLocalOrderReceipt;
|
|
@@ -2746,9 +2399,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2746
2399
|
}, {
|
|
2747
2400
|
key: "getSubmitPaymentStatus",
|
|
2748
2401
|
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
2749
|
-
var _this$store$
|
|
2402
|
+
var _this$store$order5, _this$store$order5$ge;
|
|
2750
2403
|
if (paymentStatus !== undefined) return paymentStatus;
|
|
2751
|
-
var amountSnapshot = (_this$store$
|
|
2404
|
+
var amountSnapshot = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getOrderAmountSnapshot) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
|
|
2752
2405
|
if (!amountSnapshot) return undefined;
|
|
2753
2406
|
try {
|
|
2754
2407
|
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
@@ -2759,19 +2412,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2759
2412
|
}, {
|
|
2760
2413
|
key: "syncPaymentsToOrder",
|
|
2761
2414
|
value: function () {
|
|
2762
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2763
|
-
var
|
|
2415
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2416
|
+
var _ref20, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2764
2417
|
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2765
|
-
return _regeneratorRuntime().wrap(function
|
|
2766
|
-
while (1) switch (
|
|
2418
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2419
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2767
2420
|
case 0:
|
|
2768
2421
|
if (this.store.order) {
|
|
2769
|
-
|
|
2422
|
+
_context26.next = 2;
|
|
2770
2423
|
break;
|
|
2771
2424
|
}
|
|
2772
2425
|
throw new Error('order 模块未初始化');
|
|
2773
2426
|
case 2:
|
|
2774
|
-
businessCode = (
|
|
2427
|
+
businessCode = (_ref20 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref20 !== void 0 ? _ref20 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2775
2428
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2776
2429
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2777
2430
|
businessCode: businessCode
|
|
@@ -2780,14 +2433,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2780
2433
|
} : {});
|
|
2781
2434
|
syncState = this.store.order.getOrderSyncState();
|
|
2782
2435
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2783
|
-
|
|
2436
|
+
_context26.next = 9;
|
|
2784
2437
|
break;
|
|
2785
2438
|
}
|
|
2786
2439
|
this.queueLatestAutoPaymentSync();
|
|
2787
|
-
return
|
|
2440
|
+
return _context26.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2788
2441
|
case 9:
|
|
2789
2442
|
payments = params.payments || [];
|
|
2790
|
-
|
|
2443
|
+
_context26.next = 12;
|
|
2791
2444
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2792
2445
|
payments: payments,
|
|
2793
2446
|
params: syncParams,
|
|
@@ -2795,11 +2448,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2795
2448
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2796
2449
|
});
|
|
2797
2450
|
case 12:
|
|
2798
|
-
|
|
2799
|
-
|
|
2451
|
+
_context26.prev = 12;
|
|
2452
|
+
_context26.next = 15;
|
|
2800
2453
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2801
2454
|
case 15:
|
|
2802
|
-
syncResult =
|
|
2455
|
+
syncResult = _context26.sent;
|
|
2803
2456
|
latestPayments = this.store.order.getOrderPayments();
|
|
2804
2457
|
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2805
2458
|
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
@@ -2817,25 +2470,25 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2817
2470
|
depositAmount: syncResult.depositAmount,
|
|
2818
2471
|
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2819
2472
|
};
|
|
2820
|
-
|
|
2473
|
+
_context26.next = 22;
|
|
2821
2474
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2822
2475
|
case 22:
|
|
2823
2476
|
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2824
|
-
|
|
2477
|
+
_context26.next = 25;
|
|
2825
2478
|
break;
|
|
2826
2479
|
}
|
|
2827
|
-
|
|
2480
|
+
_context26.next = 25;
|
|
2828
2481
|
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2829
2482
|
case 25:
|
|
2830
2483
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2831
|
-
return
|
|
2484
|
+
return _context26.abrupt("return", syncResult);
|
|
2832
2485
|
case 29:
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2486
|
+
_context26.prev = 29;
|
|
2487
|
+
_context26.t0 = _context26["catch"](12);
|
|
2488
|
+
_context26.next = 33;
|
|
2836
2489
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2837
2490
|
ok: false,
|
|
2838
|
-
error:
|
|
2491
|
+
error: _context26.t0,
|
|
2839
2492
|
payments: this.store.order.getOrderPayments(),
|
|
2840
2493
|
params: syncParams,
|
|
2841
2494
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
@@ -2843,14 +2496,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2843
2496
|
});
|
|
2844
2497
|
case 33:
|
|
2845
2498
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2846
|
-
throw
|
|
2499
|
+
throw _context26.t0;
|
|
2847
2500
|
case 35:
|
|
2848
2501
|
case "end":
|
|
2849
|
-
return
|
|
2502
|
+
return _context26.stop();
|
|
2850
2503
|
}
|
|
2851
|
-
},
|
|
2504
|
+
}, _callee26, this, [[12, 29]]);
|
|
2852
2505
|
}));
|
|
2853
|
-
function syncPaymentsToOrder(
|
|
2506
|
+
function syncPaymentsToOrder(_x21) {
|
|
2854
2507
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2855
2508
|
}
|
|
2856
2509
|
return syncPaymentsToOrder;
|
|
@@ -2887,58 +2540,58 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2887
2540
|
}, {
|
|
2888
2541
|
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
2889
2542
|
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
2890
|
-
var
|
|
2543
|
+
var _this10 = this;
|
|
2891
2544
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
2892
2545
|
if (!this.queuedAutoPaymentSync) return;
|
|
2893
2546
|
if (this.autoPaymentSyncTimer) return;
|
|
2894
2547
|
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
2895
|
-
|
|
2896
|
-
void
|
|
2548
|
+
_this10.autoPaymentSyncTimer = null;
|
|
2549
|
+
void _this10.flushQueuedAutoPaymentSync();
|
|
2897
2550
|
}, delay);
|
|
2898
2551
|
}
|
|
2899
2552
|
}, {
|
|
2900
2553
|
key: "flushQueuedAutoPaymentSync",
|
|
2901
2554
|
value: function () {
|
|
2902
|
-
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2555
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2903
2556
|
var payments;
|
|
2904
|
-
return _regeneratorRuntime().wrap(function
|
|
2905
|
-
while (1) switch (
|
|
2557
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2558
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2906
2559
|
case 0:
|
|
2907
2560
|
if (this.store.order) {
|
|
2908
|
-
|
|
2561
|
+
_context27.next = 2;
|
|
2909
2562
|
break;
|
|
2910
2563
|
}
|
|
2911
|
-
return
|
|
2564
|
+
return _context27.abrupt("return");
|
|
2912
2565
|
case 2:
|
|
2913
2566
|
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2914
|
-
|
|
2567
|
+
_context27.next = 4;
|
|
2915
2568
|
break;
|
|
2916
2569
|
}
|
|
2917
|
-
return
|
|
2570
|
+
return _context27.abrupt("return");
|
|
2918
2571
|
case 4:
|
|
2919
2572
|
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2920
|
-
|
|
2573
|
+
_context27.next = 7;
|
|
2921
2574
|
break;
|
|
2922
2575
|
}
|
|
2923
2576
|
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2924
|
-
return
|
|
2577
|
+
return _context27.abrupt("return");
|
|
2925
2578
|
case 7:
|
|
2926
2579
|
this.autoPaymentSyncFlushing = true;
|
|
2927
|
-
|
|
2580
|
+
_context27.prev = 8;
|
|
2928
2581
|
case 9:
|
|
2929
2582
|
if (!this.queuedAutoPaymentSync) {
|
|
2930
|
-
|
|
2583
|
+
_context27.next = 18;
|
|
2931
2584
|
break;
|
|
2932
2585
|
}
|
|
2933
2586
|
this.queuedAutoPaymentSync = false;
|
|
2934
2587
|
payments = this.store.order.getOrderPayments();
|
|
2935
2588
|
if (payments.length) {
|
|
2936
|
-
|
|
2589
|
+
_context27.next = 14;
|
|
2937
2590
|
break;
|
|
2938
2591
|
}
|
|
2939
|
-
return
|
|
2592
|
+
return _context27.abrupt("continue", 9);
|
|
2940
2593
|
case 14:
|
|
2941
|
-
|
|
2594
|
+
_context27.next = 16;
|
|
2942
2595
|
return this.syncPaymentsToOrder({
|
|
2943
2596
|
payments: payments,
|
|
2944
2597
|
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
@@ -2946,29 +2599,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2946
2599
|
smallTicketDataFlag: 1
|
|
2947
2600
|
});
|
|
2948
2601
|
case 16:
|
|
2949
|
-
|
|
2602
|
+
_context27.next = 9;
|
|
2950
2603
|
break;
|
|
2951
2604
|
case 18:
|
|
2952
|
-
|
|
2605
|
+
_context27.next = 23;
|
|
2953
2606
|
break;
|
|
2954
2607
|
case 20:
|
|
2955
|
-
|
|
2956
|
-
|
|
2608
|
+
_context27.prev = 20;
|
|
2609
|
+
_context27.t0 = _context27["catch"](8);
|
|
2957
2610
|
this.logError('queued auto sync payments failed', {
|
|
2958
|
-
error:
|
|
2611
|
+
error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0)
|
|
2959
2612
|
});
|
|
2960
2613
|
case 23:
|
|
2961
|
-
|
|
2614
|
+
_context27.prev = 23;
|
|
2962
2615
|
this.autoPaymentSyncFlushing = false;
|
|
2963
2616
|
if (this.queuedAutoPaymentSync) {
|
|
2964
2617
|
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2965
2618
|
}
|
|
2966
|
-
return
|
|
2619
|
+
return _context27.finish(23);
|
|
2967
2620
|
case 27:
|
|
2968
2621
|
case "end":
|
|
2969
|
-
return
|
|
2622
|
+
return _context27.stop();
|
|
2970
2623
|
}
|
|
2971
|
-
},
|
|
2624
|
+
}, _callee27, this, [[8, 20, 23, 27]]);
|
|
2972
2625
|
}));
|
|
2973
2626
|
function flushQueuedAutoPaymentSync() {
|
|
2974
2627
|
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
@@ -2981,9 +2634,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2981
2634
|
var _this$otherParams20,
|
|
2982
2635
|
_paymentRecord$paymen,
|
|
2983
2636
|
_paymentRecord$create,
|
|
2984
|
-
|
|
2637
|
+
_ref21,
|
|
2985
2638
|
_paymentRecord$origin,
|
|
2986
|
-
|
|
2639
|
+
_this11 = this;
|
|
2987
2640
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2988
2641
|
var paymentRecord = payment;
|
|
2989
2642
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -3005,7 +2658,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3005
2658
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
3006
2659
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
3007
2660
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
3008
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2661
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref21 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref21 !== void 0 ? _ref21 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
3009
2662
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
3010
2663
|
service_fee: calculatedServiceFee
|
|
3011
2664
|
} : {}), {}, {
|
|
@@ -3026,7 +2679,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3026
2679
|
submitWhenPaid: true,
|
|
3027
2680
|
smallTicketDataFlag: 1
|
|
3028
2681
|
}).catch(function (error) {
|
|
3029
|
-
|
|
2682
|
+
_this11.logError('auto sync payments failed', {
|
|
3030
2683
|
error: error instanceof Error ? error.message : String(error)
|
|
3031
2684
|
});
|
|
3032
2685
|
});
|
|
@@ -3072,8 +2725,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3072
2725
|
}, {
|
|
3073
2726
|
key: "getWalletProductList",
|
|
3074
2727
|
value: function getWalletProductList() {
|
|
3075
|
-
var _this$store$
|
|
3076
|
-
var tempOrder = (_this$store$
|
|
2728
|
+
var _this$store$order6, _tempOrder$products;
|
|
2729
|
+
var tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder();
|
|
3077
2730
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
3078
2731
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
3079
2732
|
// debugger
|
|
@@ -3133,20 +2786,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3133
2786
|
}, {
|
|
3134
2787
|
key: "initWalletData",
|
|
3135
2788
|
value: function () {
|
|
3136
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3137
|
-
var _params$order_wait_pa,
|
|
2789
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2790
|
+
var _params$order_wait_pa, _ref22, _tempOrder$is_price_i;
|
|
3138
2791
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
3139
|
-
return _regeneratorRuntime().wrap(function
|
|
3140
|
-
while (1) switch (
|
|
2792
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2793
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3141
2794
|
case 0:
|
|
3142
2795
|
if (this.store.order) {
|
|
3143
|
-
|
|
2796
|
+
_context28.next = 2;
|
|
3144
2797
|
break;
|
|
3145
2798
|
}
|
|
3146
2799
|
throw new Error('order 模块未初始化');
|
|
3147
2800
|
case 2:
|
|
3148
2801
|
if (this.store.payment) {
|
|
3149
|
-
|
|
2802
|
+
_context28.next = 4;
|
|
3150
2803
|
break;
|
|
3151
2804
|
}
|
|
3152
2805
|
throw new Error('payment 模块未初始化');
|
|
@@ -3155,10 +2808,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3155
2808
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
3156
2809
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
3157
2810
|
if (!(!tempOrder || !amount)) {
|
|
3158
|
-
|
|
2811
|
+
_context28.next = 9;
|
|
3159
2812
|
break;
|
|
3160
2813
|
}
|
|
3161
|
-
return
|
|
2814
|
+
return _context28.abrupt("return", {
|
|
3162
2815
|
walletRecommendList: [],
|
|
3163
2816
|
userIdentificationCodes: [],
|
|
3164
2817
|
transformList: [],
|
|
@@ -3177,15 +2830,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3177
2830
|
},
|
|
3178
2831
|
products: this.getWalletProductList(),
|
|
3179
2832
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
3180
|
-
is_price_include_tax: (
|
|
2833
|
+
is_price_include_tax: (_ref22 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref22 !== void 0 ? _ref22 : 1
|
|
3181
2834
|
}, snapshot.identity.orderId ? {
|
|
3182
2835
|
payment_order_id: String(snapshot.identity.orderId)
|
|
3183
2836
|
} : {});
|
|
3184
|
-
|
|
2837
|
+
_context28.next = 12;
|
|
3185
2838
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
3186
2839
|
case 12:
|
|
3187
|
-
result =
|
|
3188
|
-
|
|
2840
|
+
result = _context28.sent;
|
|
2841
|
+
_context28.next = 15;
|
|
3189
2842
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
3190
2843
|
orderId: snapshot.identity.orderId,
|
|
3191
2844
|
customerId: walletBusinessData.customer_id,
|
|
@@ -3197,14 +2850,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3197
2850
|
timestamp: Date.now()
|
|
3198
2851
|
});
|
|
3199
2852
|
case 15:
|
|
3200
|
-
return
|
|
2853
|
+
return _context28.abrupt("return", result);
|
|
3201
2854
|
case 16:
|
|
3202
2855
|
case "end":
|
|
3203
|
-
return
|
|
2856
|
+
return _context28.stop();
|
|
3204
2857
|
}
|
|
3205
|
-
},
|
|
2858
|
+
}, _callee28, this);
|
|
3206
2859
|
}));
|
|
3207
|
-
function initWalletData(
|
|
2860
|
+
function initWalletData(_x22) {
|
|
3208
2861
|
return _initWalletData.apply(this, arguments);
|
|
3209
2862
|
}
|
|
3210
2863
|
return initWalletData;
|
|
@@ -3231,35 +2884,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3231
2884
|
}, {
|
|
3232
2885
|
key: "getPaymentMethodsAsync",
|
|
3233
2886
|
value: (function () {
|
|
3234
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2887
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
3235
2888
|
var response, paymentMethods;
|
|
3236
|
-
return _regeneratorRuntime().wrap(function
|
|
3237
|
-
while (1) switch (
|
|
2889
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2890
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3238
2891
|
case 0:
|
|
3239
|
-
|
|
3240
|
-
|
|
2892
|
+
_context29.prev = 0;
|
|
2893
|
+
_context29.next = 3;
|
|
3241
2894
|
return this.request.get('/pay/custom-payment/all', {
|
|
3242
2895
|
filterPaymentMethods: true
|
|
3243
2896
|
}, {
|
|
3244
2897
|
osServer: true
|
|
3245
2898
|
});
|
|
3246
2899
|
case 3:
|
|
3247
|
-
response =
|
|
2900
|
+
response = _context29.sent;
|
|
3248
2901
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
3249
2902
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
3250
|
-
return
|
|
2903
|
+
return _context29.abrupt("return", this.getPaymentMethods());
|
|
3251
2904
|
case 9:
|
|
3252
|
-
|
|
3253
|
-
|
|
2905
|
+
_context29.prev = 9;
|
|
2906
|
+
_context29.t0 = _context29["catch"](0);
|
|
3254
2907
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
3255
|
-
error:
|
|
2908
|
+
error: _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0)
|
|
3256
2909
|
});
|
|
3257
|
-
return
|
|
2910
|
+
return _context29.abrupt("return", this.getPaymentMethods());
|
|
3258
2911
|
case 13:
|
|
3259
2912
|
case "end":
|
|
3260
|
-
return
|
|
2913
|
+
return _context29.stop();
|
|
3261
2914
|
}
|
|
3262
|
-
},
|
|
2915
|
+
}, _callee29, this, [[0, 9]]);
|
|
3263
2916
|
}));
|
|
3264
2917
|
function getPaymentMethodsAsync() {
|
|
3265
2918
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -3307,49 +2960,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3307
2960
|
}, {
|
|
3308
2961
|
key: "sendCustomerPayLink",
|
|
3309
2962
|
value: (function () {
|
|
3310
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3311
|
-
var orderIds,
|
|
3312
|
-
return _regeneratorRuntime().wrap(function
|
|
3313
|
-
while (1) switch (
|
|
2963
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2964
|
+
var orderIds, _ref23, _ref24, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2965
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2966
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3314
2967
|
case 0:
|
|
3315
2968
|
if (this.store.order) {
|
|
3316
|
-
|
|
2969
|
+
_context30.next = 2;
|
|
3317
2970
|
break;
|
|
3318
2971
|
}
|
|
3319
2972
|
throw new Error('order 模块未初始化');
|
|
3320
2973
|
case 2:
|
|
3321
2974
|
orderIds = params.order_ids || params.orderIds || [];
|
|
3322
2975
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
3323
|
-
|
|
2976
|
+
_context30.next = 11;
|
|
3324
2977
|
break;
|
|
3325
2978
|
}
|
|
3326
|
-
|
|
2979
|
+
_context30.next = 6;
|
|
3327
2980
|
return this.submitSalesOrder({
|
|
3328
2981
|
smallTicketDataFlag: 1
|
|
3329
2982
|
});
|
|
3330
2983
|
case 6:
|
|
3331
|
-
submitResult =
|
|
3332
|
-
orderId = (
|
|
2984
|
+
submitResult = _context30.sent;
|
|
2985
|
+
orderId = (_ref23 = (_ref24 = (_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 && _ref24 !== void 0 ? _ref24 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
3333
2986
|
if (orderId) {
|
|
3334
|
-
|
|
2987
|
+
_context30.next = 10;
|
|
3335
2988
|
break;
|
|
3336
2989
|
}
|
|
3337
2990
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
3338
2991
|
case 10:
|
|
3339
2992
|
orderIds = [orderId];
|
|
3340
2993
|
case 11:
|
|
3341
|
-
return
|
|
2994
|
+
return _context30.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
3342
2995
|
emails: params.emails,
|
|
3343
2996
|
notify_action: params.notify_action,
|
|
3344
2997
|
order_ids: orderIds
|
|
3345
2998
|
}));
|
|
3346
2999
|
case 12:
|
|
3347
3000
|
case "end":
|
|
3348
|
-
return
|
|
3001
|
+
return _context30.stop();
|
|
3349
3002
|
}
|
|
3350
|
-
},
|
|
3003
|
+
}, _callee30, this);
|
|
3351
3004
|
}));
|
|
3352
|
-
function sendCustomerPayLink(
|
|
3005
|
+
function sendCustomerPayLink(_x23) {
|
|
3353
3006
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
3354
3007
|
}
|
|
3355
3008
|
return sendCustomerPayLink;
|
|
@@ -3362,27 +3015,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3362
3015
|
}, {
|
|
3363
3016
|
key: "calculateProductBookingPrice",
|
|
3364
3017
|
value: function () {
|
|
3365
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3018
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
3366
3019
|
var _params$customer_id;
|
|
3367
3020
|
var quotation, customerId, authoritativeProduct, product;
|
|
3368
|
-
return _regeneratorRuntime().wrap(function
|
|
3369
|
-
while (1) switch (
|
|
3021
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3022
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
3370
3023
|
case 0:
|
|
3371
3024
|
quotation = this.store.quotation;
|
|
3372
3025
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
3373
|
-
|
|
3026
|
+
_context31.next = 4;
|
|
3374
3027
|
return this.loadProductForPriceQuery(params, customerId);
|
|
3375
3028
|
case 4:
|
|
3376
|
-
authoritativeProduct =
|
|
3029
|
+
authoritativeProduct = _context31.sent;
|
|
3377
3030
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
3378
|
-
|
|
3031
|
+
_context31.next = 8;
|
|
3379
3032
|
return this.loadQuotationForPriceQuery({
|
|
3380
3033
|
quotation: quotation,
|
|
3381
3034
|
customer_id: customerId,
|
|
3382
3035
|
channel: params.channel
|
|
3383
3036
|
});
|
|
3384
3037
|
case 8:
|
|
3385
|
-
return
|
|
3038
|
+
return _context31.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3386
3039
|
product: product,
|
|
3387
3040
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
3388
3041
|
customer_id: customerId,
|
|
@@ -3390,11 +3043,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3390
3043
|
})));
|
|
3391
3044
|
case 9:
|
|
3392
3045
|
case "end":
|
|
3393
|
-
return
|
|
3046
|
+
return _context31.stop();
|
|
3394
3047
|
}
|
|
3395
|
-
},
|
|
3048
|
+
}, _callee31, this);
|
|
3396
3049
|
}));
|
|
3397
|
-
function calculateProductBookingPrice(
|
|
3050
|
+
function calculateProductBookingPrice(_x24) {
|
|
3398
3051
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
3399
3052
|
}
|
|
3400
3053
|
return calculateProductBookingPrice;
|
|
@@ -3402,7 +3055,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3402
3055
|
}, {
|
|
3403
3056
|
key: "getQuotationCustomerScopeInfo",
|
|
3404
3057
|
value: function getQuotationCustomerScopeInfo() {
|
|
3405
|
-
var
|
|
3058
|
+
var _this12 = this;
|
|
3406
3059
|
var quotation = this.store.quotation;
|
|
3407
3060
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
3408
3061
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -3414,7 +3067,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3414
3067
|
}).map(function (item) {
|
|
3415
3068
|
var localSeen = new Set();
|
|
3416
3069
|
var customers = item.customer.filter(function (customer) {
|
|
3417
|
-
var customerId =
|
|
3070
|
+
var customerId = _this12.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
3418
3071
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
3419
3072
|
localSeen.add(customerId);
|
|
3420
3073
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -3464,32 +3117,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3464
3117
|
}, {
|
|
3465
3118
|
key: "calculateProductBookingPrices",
|
|
3466
3119
|
value: function () {
|
|
3467
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3120
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(paramsList) {
|
|
3468
3121
|
var _paramsList$0$custome,
|
|
3469
3122
|
_paramsList$,
|
|
3470
|
-
|
|
3123
|
+
_this13 = this,
|
|
3471
3124
|
_paramsList$2;
|
|
3472
3125
|
var quotation, customerId, productMapsByGroup, groups;
|
|
3473
|
-
return _regeneratorRuntime().wrap(function
|
|
3474
|
-
while (1) switch (
|
|
3126
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3127
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3475
3128
|
case 0:
|
|
3476
3129
|
if (paramsList.length) {
|
|
3477
|
-
|
|
3130
|
+
_context33.next = 2;
|
|
3478
3131
|
break;
|
|
3479
3132
|
}
|
|
3480
|
-
return
|
|
3133
|
+
return _context33.abrupt("return", []);
|
|
3481
3134
|
case 2:
|
|
3482
3135
|
quotation = this.store.quotation;
|
|
3483
3136
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
3484
3137
|
productMapsByGroup = new Map();
|
|
3485
3138
|
groups = new Map();
|
|
3486
3139
|
paramsList.forEach(function (params) {
|
|
3487
|
-
var
|
|
3140
|
+
var _this13$otherParams;
|
|
3488
3141
|
var product = params.product || {};
|
|
3489
|
-
var productId =
|
|
3142
|
+
var productId = _this13.getPriceQueryProductId(product);
|
|
3490
3143
|
if (productId === null) return;
|
|
3491
|
-
var schedule =
|
|
3492
|
-
var channel = params.channel || ((
|
|
3144
|
+
var schedule = _this13.getPriceQuerySchedule(params);
|
|
3145
|
+
var channel = params.channel || ((_this13$otherParams = _this13.otherParams) === null || _this13$otherParams === void 0 ? void 0 : _this13$otherParams.channel);
|
|
3493
3146
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
3494
3147
|
var group = groups.get(groupKey) || {
|
|
3495
3148
|
ids: new Set(),
|
|
@@ -3499,51 +3152,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3499
3152
|
group.ids.add(productId);
|
|
3500
3153
|
groups.set(groupKey, group);
|
|
3501
3154
|
});
|
|
3502
|
-
|
|
3155
|
+
_context33.next = 9;
|
|
3503
3156
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
3504
|
-
var
|
|
3505
|
-
var
|
|
3506
|
-
return _regeneratorRuntime().wrap(function
|
|
3507
|
-
while (1) switch (
|
|
3157
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(_ref25) {
|
|
3158
|
+
var _ref27, groupKey, group, productsById;
|
|
3159
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3160
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
3508
3161
|
case 0:
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
return
|
|
3162
|
+
_ref27 = _slicedToArray(_ref25, 2), groupKey = _ref27[0], group = _ref27[1];
|
|
3163
|
+
_context32.next = 3;
|
|
3164
|
+
return _this13.loadProductsForPriceQuery({
|
|
3512
3165
|
ids: Array.from(group.ids),
|
|
3513
3166
|
schedule: group.schedule,
|
|
3514
3167
|
customerId: customerId,
|
|
3515
3168
|
channel: group.channel
|
|
3516
3169
|
});
|
|
3517
3170
|
case 3:
|
|
3518
|
-
productsById =
|
|
3171
|
+
productsById = _context32.sent;
|
|
3519
3172
|
productMapsByGroup.set(groupKey, productsById);
|
|
3520
3173
|
case 5:
|
|
3521
3174
|
case "end":
|
|
3522
|
-
return
|
|
3175
|
+
return _context32.stop();
|
|
3523
3176
|
}
|
|
3524
|
-
},
|
|
3177
|
+
}, _callee32);
|
|
3525
3178
|
}));
|
|
3526
|
-
return function (
|
|
3527
|
-
return
|
|
3179
|
+
return function (_x26) {
|
|
3180
|
+
return _ref26.apply(this, arguments);
|
|
3528
3181
|
};
|
|
3529
3182
|
}()));
|
|
3530
3183
|
case 9:
|
|
3531
|
-
|
|
3184
|
+
_context33.next = 11;
|
|
3532
3185
|
return this.loadQuotationForPriceQuery({
|
|
3533
3186
|
quotation: quotation,
|
|
3534
3187
|
customer_id: customerId,
|
|
3535
3188
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
3536
3189
|
});
|
|
3537
3190
|
case 11:
|
|
3538
|
-
return
|
|
3539
|
-
var
|
|
3191
|
+
return _context33.abrupt("return", paramsList.map(function (params) {
|
|
3192
|
+
var _this13$otherParams2, _productMapsByGroup$g;
|
|
3540
3193
|
var productInput = params.product || {};
|
|
3541
|
-
var productId =
|
|
3542
|
-
var schedule =
|
|
3543
|
-
var channel = params.channel || ((
|
|
3194
|
+
var productId = _this13.getPriceQueryProductId(productInput);
|
|
3195
|
+
var schedule = _this13.getPriceQuerySchedule(params);
|
|
3196
|
+
var channel = params.channel || ((_this13$otherParams2 = _this13.otherParams) === null || _this13$otherParams2 === void 0 ? void 0 : _this13$otherParams2.channel);
|
|
3544
3197
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
3545
3198
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
3546
|
-
var product =
|
|
3199
|
+
var product = _this13.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
3547
3200
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
3548
3201
|
product: product,
|
|
3549
3202
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -3553,11 +3206,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3553
3206
|
}));
|
|
3554
3207
|
case 12:
|
|
3555
3208
|
case "end":
|
|
3556
|
-
return
|
|
3209
|
+
return _context33.stop();
|
|
3557
3210
|
}
|
|
3558
|
-
},
|
|
3211
|
+
}, _callee33, this);
|
|
3559
3212
|
}));
|
|
3560
|
-
function calculateProductBookingPrices(
|
|
3213
|
+
function calculateProductBookingPrices(_x25) {
|
|
3561
3214
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
3562
3215
|
}
|
|
3563
3216
|
return calculateProductBookingPrices;
|
|
@@ -3565,34 +3218,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3565
3218
|
}, {
|
|
3566
3219
|
key: "addProductToOrder",
|
|
3567
3220
|
value: function () {
|
|
3568
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3221
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(product, booking) {
|
|
3569
3222
|
var products;
|
|
3570
|
-
return _regeneratorRuntime().wrap(function
|
|
3571
|
-
while (1) switch (
|
|
3223
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3224
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3572
3225
|
case 0:
|
|
3573
|
-
|
|
3226
|
+
_context34.prev = 0;
|
|
3574
3227
|
if (this.store.order) {
|
|
3575
|
-
|
|
3228
|
+
_context34.next = 3;
|
|
3576
3229
|
break;
|
|
3577
3230
|
}
|
|
3578
3231
|
throw new Error('order 模块未初始化');
|
|
3579
3232
|
case 3:
|
|
3580
|
-
|
|
3233
|
+
_context34.next = 5;
|
|
3581
3234
|
return this.store.order.addProductToOrder(product, booking);
|
|
3582
3235
|
case 5:
|
|
3583
|
-
products =
|
|
3584
|
-
return
|
|
3236
|
+
products = _context34.sent;
|
|
3237
|
+
return _context34.abrupt("return", products);
|
|
3585
3238
|
case 9:
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
throw
|
|
3239
|
+
_context34.prev = 9;
|
|
3240
|
+
_context34.t0 = _context34["catch"](0);
|
|
3241
|
+
throw _context34.t0;
|
|
3589
3242
|
case 12:
|
|
3590
3243
|
case "end":
|
|
3591
|
-
return
|
|
3244
|
+
return _context34.stop();
|
|
3592
3245
|
}
|
|
3593
|
-
},
|
|
3246
|
+
}, _callee34, this, [[0, 9]]);
|
|
3594
3247
|
}));
|
|
3595
|
-
function addProductToOrder(
|
|
3248
|
+
function addProductToOrder(_x27, _x28) {
|
|
3596
3249
|
return _addProductToOrder.apply(this, arguments);
|
|
3597
3250
|
}
|
|
3598
3251
|
return addProductToOrder;
|
|
@@ -3600,34 +3253,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3600
3253
|
}, {
|
|
3601
3254
|
key: "updateOrderProduct",
|
|
3602
3255
|
value: function () {
|
|
3603
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3256
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
3604
3257
|
var products;
|
|
3605
|
-
return _regeneratorRuntime().wrap(function
|
|
3606
|
-
while (1) switch (
|
|
3258
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3259
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3607
3260
|
case 0:
|
|
3608
|
-
|
|
3261
|
+
_context35.prev = 0;
|
|
3609
3262
|
if (this.store.order) {
|
|
3610
|
-
|
|
3263
|
+
_context35.next = 3;
|
|
3611
3264
|
break;
|
|
3612
3265
|
}
|
|
3613
3266
|
throw new Error('order 模块未初始化');
|
|
3614
3267
|
case 3:
|
|
3615
|
-
|
|
3268
|
+
_context35.next = 5;
|
|
3616
3269
|
return this.store.order.updateOrderProduct(params);
|
|
3617
3270
|
case 5:
|
|
3618
|
-
products =
|
|
3619
|
-
return
|
|
3271
|
+
products = _context35.sent;
|
|
3272
|
+
return _context35.abrupt("return", products);
|
|
3620
3273
|
case 9:
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
throw
|
|
3274
|
+
_context35.prev = 9;
|
|
3275
|
+
_context35.t0 = _context35["catch"](0);
|
|
3276
|
+
throw _context35.t0;
|
|
3624
3277
|
case 12:
|
|
3625
3278
|
case "end":
|
|
3626
|
-
return
|
|
3279
|
+
return _context35.stop();
|
|
3627
3280
|
}
|
|
3628
|
-
},
|
|
3281
|
+
}, _callee35, this, [[0, 9]]);
|
|
3629
3282
|
}));
|
|
3630
|
-
function updateOrderProduct(
|
|
3283
|
+
function updateOrderProduct(_x29) {
|
|
3631
3284
|
return _updateOrderProduct.apply(this, arguments);
|
|
3632
3285
|
}
|
|
3633
3286
|
return updateOrderProduct;
|
|
@@ -3635,34 +3288,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3635
3288
|
}, {
|
|
3636
3289
|
key: "updateOrderProducts",
|
|
3637
3290
|
value: function () {
|
|
3638
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3291
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(paramsList) {
|
|
3639
3292
|
var products;
|
|
3640
|
-
return _regeneratorRuntime().wrap(function
|
|
3641
|
-
while (1) switch (
|
|
3293
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3294
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3642
3295
|
case 0:
|
|
3643
|
-
|
|
3296
|
+
_context36.prev = 0;
|
|
3644
3297
|
if (this.store.order) {
|
|
3645
|
-
|
|
3298
|
+
_context36.next = 3;
|
|
3646
3299
|
break;
|
|
3647
3300
|
}
|
|
3648
3301
|
throw new Error('order 模块未初始化');
|
|
3649
3302
|
case 3:
|
|
3650
|
-
|
|
3303
|
+
_context36.next = 5;
|
|
3651
3304
|
return this.store.order.updateOrderProducts(paramsList);
|
|
3652
3305
|
case 5:
|
|
3653
|
-
products =
|
|
3654
|
-
return
|
|
3306
|
+
products = _context36.sent;
|
|
3307
|
+
return _context36.abrupt("return", products);
|
|
3655
3308
|
case 9:
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
throw
|
|
3309
|
+
_context36.prev = 9;
|
|
3310
|
+
_context36.t0 = _context36["catch"](0);
|
|
3311
|
+
throw _context36.t0;
|
|
3659
3312
|
case 12:
|
|
3660
3313
|
case "end":
|
|
3661
|
-
return
|
|
3314
|
+
return _context36.stop();
|
|
3662
3315
|
}
|
|
3663
|
-
},
|
|
3316
|
+
}, _callee36, this, [[0, 9]]);
|
|
3664
3317
|
}));
|
|
3665
|
-
function updateOrderProducts(
|
|
3318
|
+
function updateOrderProducts(_x30) {
|
|
3666
3319
|
return _updateOrderProducts.apply(this, arguments);
|
|
3667
3320
|
}
|
|
3668
3321
|
return updateOrderProducts;
|
|
@@ -3670,34 +3323,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3670
3323
|
}, {
|
|
3671
3324
|
key: "updateOrderProductQuantity",
|
|
3672
3325
|
value: function () {
|
|
3673
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3326
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3674
3327
|
var products;
|
|
3675
|
-
return _regeneratorRuntime().wrap(function
|
|
3676
|
-
while (1) switch (
|
|
3328
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3329
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3677
3330
|
case 0:
|
|
3678
|
-
|
|
3331
|
+
_context37.prev = 0;
|
|
3679
3332
|
if (this.store.order) {
|
|
3680
|
-
|
|
3333
|
+
_context37.next = 3;
|
|
3681
3334
|
break;
|
|
3682
3335
|
}
|
|
3683
3336
|
throw new Error('order 模块未初始化');
|
|
3684
3337
|
case 3:
|
|
3685
|
-
|
|
3338
|
+
_context37.next = 5;
|
|
3686
3339
|
return this.store.order.updateOrderProductQuantity(params);
|
|
3687
3340
|
case 5:
|
|
3688
|
-
products =
|
|
3689
|
-
return
|
|
3341
|
+
products = _context37.sent;
|
|
3342
|
+
return _context37.abrupt("return", products);
|
|
3690
3343
|
case 9:
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
throw
|
|
3344
|
+
_context37.prev = 9;
|
|
3345
|
+
_context37.t0 = _context37["catch"](0);
|
|
3346
|
+
throw _context37.t0;
|
|
3694
3347
|
case 12:
|
|
3695
3348
|
case "end":
|
|
3696
|
-
return
|
|
3349
|
+
return _context37.stop();
|
|
3697
3350
|
}
|
|
3698
|
-
},
|
|
3351
|
+
}, _callee37, this, [[0, 9]]);
|
|
3699
3352
|
}));
|
|
3700
|
-
function updateOrderProductQuantity(
|
|
3353
|
+
function updateOrderProductQuantity(_x31) {
|
|
3701
3354
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3702
3355
|
}
|
|
3703
3356
|
return updateOrderProductQuantity;
|
|
@@ -3720,12 +3373,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3720
3373
|
}, {
|
|
3721
3374
|
key: "setOrderProductLineNote",
|
|
3722
3375
|
value: (function () {
|
|
3723
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3376
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity, note) {
|
|
3724
3377
|
var params, products;
|
|
3725
|
-
return _regeneratorRuntime().wrap(function
|
|
3726
|
-
while (1) switch (
|
|
3378
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3379
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3727
3380
|
case 0:
|
|
3728
|
-
|
|
3381
|
+
_context38.prev = 0;
|
|
3729
3382
|
params = {
|
|
3730
3383
|
product_id: identity.product_id,
|
|
3731
3384
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3740,22 +3393,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3740
3393
|
params.product_sku = identity.product_sku;
|
|
3741
3394
|
}
|
|
3742
3395
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3743
|
-
|
|
3396
|
+
_context38.next = 7;
|
|
3744
3397
|
return this.updateOrderProduct(params);
|
|
3745
3398
|
case 7:
|
|
3746
|
-
products =
|
|
3747
|
-
return
|
|
3399
|
+
products = _context38.sent;
|
|
3400
|
+
return _context38.abrupt("return", products);
|
|
3748
3401
|
case 11:
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
throw
|
|
3402
|
+
_context38.prev = 11;
|
|
3403
|
+
_context38.t0 = _context38["catch"](0);
|
|
3404
|
+
throw _context38.t0;
|
|
3752
3405
|
case 14:
|
|
3753
3406
|
case "end":
|
|
3754
|
-
return
|
|
3407
|
+
return _context38.stop();
|
|
3755
3408
|
}
|
|
3756
|
-
},
|
|
3409
|
+
}, _callee38, this, [[0, 11]]);
|
|
3757
3410
|
}));
|
|
3758
|
-
function setOrderProductLineNote(
|
|
3411
|
+
function setOrderProductLineNote(_x32, _x33) {
|
|
3759
3412
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
3760
3413
|
}
|
|
3761
3414
|
return setOrderProductLineNote;
|
|
@@ -3770,32 +3423,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3770
3423
|
}, {
|
|
3771
3424
|
key: "removeProductsFromOrder",
|
|
3772
3425
|
value: (function () {
|
|
3773
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3774
|
-
return _regeneratorRuntime().wrap(function
|
|
3775
|
-
while (1) switch (
|
|
3426
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(identities) {
|
|
3427
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3428
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3776
3429
|
case 0:
|
|
3777
|
-
|
|
3430
|
+
_context39.prev = 0;
|
|
3778
3431
|
if (this.store.order) {
|
|
3779
|
-
|
|
3432
|
+
_context39.next = 3;
|
|
3780
3433
|
break;
|
|
3781
3434
|
}
|
|
3782
3435
|
throw new Error('order 模块未初始化');
|
|
3783
3436
|
case 3:
|
|
3784
|
-
|
|
3437
|
+
_context39.next = 5;
|
|
3785
3438
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3786
3439
|
case 5:
|
|
3787
|
-
return
|
|
3440
|
+
return _context39.abrupt("return", _context39.sent);
|
|
3788
3441
|
case 8:
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
throw
|
|
3442
|
+
_context39.prev = 8;
|
|
3443
|
+
_context39.t0 = _context39["catch"](0);
|
|
3444
|
+
throw _context39.t0;
|
|
3792
3445
|
case 11:
|
|
3793
3446
|
case "end":
|
|
3794
|
-
return
|
|
3447
|
+
return _context39.stop();
|
|
3795
3448
|
}
|
|
3796
|
-
},
|
|
3449
|
+
}, _callee39, this, [[0, 8]]);
|
|
3797
3450
|
}));
|
|
3798
|
-
function removeProductsFromOrder(
|
|
3451
|
+
function removeProductsFromOrder(_x34) {
|
|
3799
3452
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
3800
3453
|
}
|
|
3801
3454
|
return removeProductsFromOrder;
|
|
@@ -3803,18 +3456,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3803
3456
|
}, {
|
|
3804
3457
|
key: "removeProductFromOrder",
|
|
3805
3458
|
value: function () {
|
|
3806
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3807
|
-
return _regeneratorRuntime().wrap(function
|
|
3808
|
-
while (1) switch (
|
|
3459
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(identity) {
|
|
3460
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3461
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3809
3462
|
case 0:
|
|
3810
|
-
return
|
|
3463
|
+
return _context40.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3811
3464
|
case 1:
|
|
3812
3465
|
case "end":
|
|
3813
|
-
return
|
|
3466
|
+
return _context40.stop();
|
|
3814
3467
|
}
|
|
3815
|
-
},
|
|
3468
|
+
}, _callee40, this);
|
|
3816
3469
|
}));
|
|
3817
|
-
function removeProductFromOrder(
|
|
3470
|
+
function removeProductFromOrder(_x35) {
|
|
3818
3471
|
return _removeProductFromOrder.apply(this, arguments);
|
|
3819
3472
|
}
|
|
3820
3473
|
return removeProductFromOrder;
|
|
@@ -3864,23 +3517,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3864
3517
|
}, {
|
|
3865
3518
|
key: "applyPromotion",
|
|
3866
3519
|
value: (function () {
|
|
3867
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3868
|
-
return _regeneratorRuntime().wrap(function
|
|
3869
|
-
while (1) switch (
|
|
3520
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3521
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3522
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3870
3523
|
case 0:
|
|
3871
3524
|
if (this.store.order) {
|
|
3872
|
-
|
|
3525
|
+
_context41.next = 2;
|
|
3873
3526
|
break;
|
|
3874
3527
|
}
|
|
3875
3528
|
throw new Error('order 模块未初始化');
|
|
3876
3529
|
case 2:
|
|
3877
|
-
|
|
3530
|
+
_context41.next = 4;
|
|
3878
3531
|
return this.store.order.applyPromotion();
|
|
3879
3532
|
case 4:
|
|
3880
3533
|
case "end":
|
|
3881
|
-
return
|
|
3534
|
+
return _context41.stop();
|
|
3882
3535
|
}
|
|
3883
|
-
},
|
|
3536
|
+
}, _callee41, this);
|
|
3884
3537
|
}));
|
|
3885
3538
|
function applyPromotion() {
|
|
3886
3539
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3890,16 +3543,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3890
3543
|
}, {
|
|
3891
3544
|
key: "getUnfulfilledPromotions",
|
|
3892
3545
|
value: function getUnfulfilledPromotions() {
|
|
3893
|
-
var _this$store$
|
|
3894
|
-
return ((_this$store$
|
|
3546
|
+
var _this$store$order7;
|
|
3547
|
+
return ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getUnfulfilledPromotions()) || [];
|
|
3895
3548
|
}
|
|
3896
3549
|
|
|
3897
3550
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
3898
3551
|
}, {
|
|
3899
3552
|
key: "getLastGiftActions",
|
|
3900
3553
|
value: function getLastGiftActions() {
|
|
3901
|
-
var _this$store$
|
|
3902
|
-
return ((_this$store$
|
|
3554
|
+
var _this$store$order8;
|
|
3555
|
+
return ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getLastGiftActions()) || null;
|
|
3903
3556
|
}
|
|
3904
3557
|
|
|
3905
3558
|
// 获取商品列表
|
|
@@ -3907,18 +3560,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3907
3560
|
}, {
|
|
3908
3561
|
key: "getProductList",
|
|
3909
3562
|
value: function () {
|
|
3910
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3563
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3911
3564
|
var _this$otherParams21;
|
|
3912
3565
|
var menu_list_ids, _this$store$products, res;
|
|
3913
|
-
return _regeneratorRuntime().wrap(function
|
|
3914
|
-
while (1) switch (
|
|
3566
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3567
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3915
3568
|
case 0:
|
|
3916
3569
|
// 可以直接通过配置里的 menu 读取
|
|
3917
3570
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3918
3571
|
return Number(n.value);
|
|
3919
3572
|
})) || [];
|
|
3920
|
-
|
|
3921
|
-
|
|
3573
|
+
_context42.prev = 1;
|
|
3574
|
+
_context42.next = 4;
|
|
3922
3575
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3923
3576
|
menu_list_ids: menu_list_ids,
|
|
3924
3577
|
cacheId: this.cacheId,
|
|
@@ -3926,17 +3579,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3926
3579
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3927
3580
|
});
|
|
3928
3581
|
case 4:
|
|
3929
|
-
res =
|
|
3930
|
-
return
|
|
3582
|
+
res = _context42.sent;
|
|
3583
|
+
return _context42.abrupt("return", res);
|
|
3931
3584
|
case 8:
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
throw
|
|
3585
|
+
_context42.prev = 8;
|
|
3586
|
+
_context42.t0 = _context42["catch"](1);
|
|
3587
|
+
throw _context42.t0;
|
|
3935
3588
|
case 11:
|
|
3936
3589
|
case "end":
|
|
3937
|
-
return
|
|
3590
|
+
return _context42.stop();
|
|
3938
3591
|
}
|
|
3939
|
-
},
|
|
3592
|
+
}, _callee42, this, [[1, 8]]);
|
|
3940
3593
|
}));
|
|
3941
3594
|
function getProductList() {
|
|
3942
3595
|
return _getProductList.apply(this, arguments);
|
|
@@ -3951,33 +3604,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3951
3604
|
}, {
|
|
3952
3605
|
key: "setOtherParams",
|
|
3953
3606
|
value: function () {
|
|
3954
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3607
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3955
3608
|
var _this$otherParams22;
|
|
3956
|
-
var
|
|
3957
|
-
|
|
3609
|
+
var _ref28,
|
|
3610
|
+
_ref28$cover,
|
|
3958
3611
|
cover,
|
|
3959
|
-
|
|
3960
|
-
return _regeneratorRuntime().wrap(function
|
|
3961
|
-
while (1) switch (
|
|
3612
|
+
_args43 = arguments;
|
|
3613
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3614
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3962
3615
|
case 0:
|
|
3963
|
-
|
|
3616
|
+
_ref28 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref28$cover = _ref28.cover, cover = _ref28$cover === void 0 ? false : _ref28$cover;
|
|
3964
3617
|
if (cover) {
|
|
3965
3618
|
this.otherParams = _objectSpread({}, params);
|
|
3966
3619
|
} else {
|
|
3967
3620
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3968
3621
|
}
|
|
3969
3622
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3970
|
-
|
|
3623
|
+
_context43.next = 5;
|
|
3971
3624
|
return this.syncOtherParamsToSubModules(params, {
|
|
3972
3625
|
cover: cover
|
|
3973
3626
|
});
|
|
3974
3627
|
case 5:
|
|
3975
3628
|
case "end":
|
|
3976
|
-
return
|
|
3629
|
+
return _context43.stop();
|
|
3977
3630
|
}
|
|
3978
|
-
},
|
|
3631
|
+
}, _callee43, this);
|
|
3979
3632
|
}));
|
|
3980
|
-
function setOtherParams(
|
|
3633
|
+
function setOtherParams(_x36) {
|
|
3981
3634
|
return _setOtherParams.apply(this, arguments);
|
|
3982
3635
|
}
|
|
3983
3636
|
return setOtherParams;
|