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