@pisell/pisellos 2.2.170 → 2.2.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +15 -27
- package/dist/modules/Order/index.js +322 -695
- package/dist/modules/Order/types.d.ts +14 -49
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -17
- package/dist/modules/Order/utils.js +26 -97
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/solution/BaseSales/index.d.ts +7 -46
- package/dist/solution/BaseSales/index.js +315 -1009
- package/dist/solution/BaseSales/types.d.ts +1 -53
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -65
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -768
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +15 -27
- package/lib/modules/Order/index.js +84 -336
- package/lib/modules/Order/types.d.ts +14 -49
- package/lib/modules/Order/utils.d.ts +0 -17
- package/lib/modules/Order/utils.js +18 -105
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/solution/BaseSales/index.d.ts +7 -46
- package/lib/solution/BaseSales/index.js +20 -434
- package/lib/solution/BaseSales/types.d.ts +1 -53
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -70
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -341
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -159
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -201
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
2
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
3
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -27,16 +23,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
27
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
24
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
25
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
|
-
import { BaseSalesHookNames } from "./types";
|
|
31
26
|
import { OrderModule } from "../../modules/Order";
|
|
32
27
|
import Decimal from 'decimal.js';
|
|
33
28
|
import { createModule } from "../BookingByStep/types";
|
|
34
29
|
import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
35
30
|
import dayjs from 'dayjs';
|
|
36
31
|
export * from "./types";
|
|
37
|
-
import { QuotationModule } from "../../modules/Quotation";
|
|
38
32
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
39
|
-
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
40
33
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
41
34
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
42
35
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -50,7 +43,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
50
43
|
_defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
|
|
51
44
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
52
45
|
// LoggerManager 实例
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
54
46
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
55
47
|
order: undefined
|
|
56
48
|
});
|
|
@@ -69,12 +61,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
69
61
|
|
|
70
62
|
/**
|
|
71
63
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
72
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment
|
|
64
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
73
65
|
*/
|
|
74
66
|
_createClass(BaseSalesImpl, [{
|
|
75
67
|
key: "getRegisteredModuleNames",
|
|
76
68
|
value: function getRegisteredModuleNames() {
|
|
77
|
-
return ['products', 'order', 'salesSummary', 'schedule', 'payment'
|
|
69
|
+
return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
/**
|
|
@@ -129,63 +121,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
129
121
|
get: function get() {
|
|
130
122
|
return this.store.payment;
|
|
131
123
|
}
|
|
132
|
-
}, {
|
|
133
|
-
key: "getCurrentOrderCustomerId",
|
|
134
|
-
value: function getCurrentOrderCustomerId() {
|
|
135
|
-
var _this$store$order, _this$store$order$get;
|
|
136
|
-
var tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
137
|
-
var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
138
|
-
if (customerId === null || customerId === undefined) return undefined;
|
|
139
|
-
return customerId;
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "applyQuotationScheduleResolver",
|
|
143
|
-
value: function applyQuotationScheduleResolver(quotation) {
|
|
144
|
-
var scheduleModule = this.store.schedule;
|
|
145
|
-
if (!scheduleModule) return;
|
|
146
|
-
quotation.setScheduleResolver(function (id) {
|
|
147
|
-
var _scheduleModule$getSc;
|
|
148
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
|
|
149
|
-
return schedules[0];
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
}, {
|
|
153
|
-
key: "loadQuotationForPriceQuery",
|
|
154
|
-
value: function () {
|
|
155
|
-
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
156
|
-
var _this$otherParams;
|
|
157
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
158
|
-
while (1) switch (_context.prev = _context.next) {
|
|
159
|
-
case 0:
|
|
160
|
-
if (params.quotation) {
|
|
161
|
-
_context.next = 2;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
return _context.abrupt("return");
|
|
165
|
-
case 2:
|
|
166
|
-
this.applyQuotationScheduleResolver(params.quotation);
|
|
167
|
-
_context.next = 5;
|
|
168
|
-
return params.quotation.loadQuotations({
|
|
169
|
-
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
170
|
-
customer_id: params.customer_id
|
|
171
|
-
});
|
|
172
|
-
case 5:
|
|
173
|
-
case "end":
|
|
174
|
-
return _context.stop();
|
|
175
|
-
}
|
|
176
|
-
}, _callee, this);
|
|
177
|
-
}));
|
|
178
|
-
function loadQuotationForPriceQuery(_x) {
|
|
179
|
-
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
180
|
-
}
|
|
181
|
-
return loadQuotationForPriceQuery;
|
|
182
|
-
}()
|
|
183
|
-
}, {
|
|
184
|
-
key: "getSubmitOrderSalesChannel",
|
|
185
|
-
value: function getSubmitOrderSalesChannel() {
|
|
186
|
-
var _this$otherParams2;
|
|
187
|
-
return (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel;
|
|
188
|
-
}
|
|
189
124
|
|
|
190
125
|
/**
|
|
191
126
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -195,9 +130,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
195
130
|
}, {
|
|
196
131
|
key: "createSubModule",
|
|
197
132
|
value: function createSubModule(moduleName) {
|
|
198
|
-
if (moduleName === 'quotation') {
|
|
199
|
-
return new QuotationModule("".concat(this.name, "_quotation"));
|
|
200
|
-
}
|
|
201
133
|
return createModule(moduleName, this.name);
|
|
202
134
|
}
|
|
203
135
|
}, {
|
|
@@ -231,78 +163,39 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
231
163
|
return {};
|
|
232
164
|
}
|
|
233
165
|
}
|
|
234
|
-
}, {
|
|
235
|
-
key: "getAppData",
|
|
236
|
-
value: function getAppData(key) {
|
|
237
|
-
var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
238
|
-
var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
239
|
-
if (typeof getData === 'function') return getData(key);
|
|
240
|
-
var app = this.appPlugin.getApp();
|
|
241
|
-
var coreData = app === null || app === void 0 || (_app$models = app.models) === null || _app$models === void 0 || (_app$models$getStore = _app$models.getStore) === null || _app$models$getStore === void 0 || (_app$models$getStore$ = (_app$models$getStore$2 = _app$models$getStore.call(_app$models)).getDataByModel) === null || _app$models$getStore$ === void 0 ? void 0 : _app$models$getStore$.call(_app$models$getStore$2, 'core', 'core');
|
|
242
|
-
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "syncAppDataToTempOrder",
|
|
246
|
-
value: function syncAppDataToTempOrder(tempOrder) {
|
|
247
|
-
var taxCountryCode = this.getAppData('tax_country_code');
|
|
248
|
-
var currencyCode = this.getAppData('shop_currency_code');
|
|
249
|
-
var currencySymbol = this.getAppData('shop_symbol');
|
|
250
|
-
var isChanged = false;
|
|
251
|
-
if (taxCountryCode !== undefined) {
|
|
252
|
-
var nextTaxCountryCode = String(taxCountryCode || '');
|
|
253
|
-
if (tempOrder.tax_country_code !== nextTaxCountryCode) {
|
|
254
|
-
tempOrder.tax_country_code = nextTaxCountryCode;
|
|
255
|
-
isChanged = true;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (currencyCode !== undefined) {
|
|
259
|
-
var nextCurrencyCode = String(currencyCode || '');
|
|
260
|
-
if (tempOrder.currency_code !== nextCurrencyCode) {
|
|
261
|
-
tempOrder.currency_code = nextCurrencyCode;
|
|
262
|
-
isChanged = true;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
if (currencySymbol !== undefined) {
|
|
266
|
-
var nextCurrencySymbol = String(currencySymbol || '');
|
|
267
|
-
if (tempOrder.currency_symbol !== nextCurrencySymbol) {
|
|
268
|
-
tempOrder.currency_symbol = nextCurrencySymbol;
|
|
269
|
-
isChanged = true;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return isChanged;
|
|
273
|
-
}
|
|
274
166
|
}, {
|
|
275
167
|
key: "initialize",
|
|
276
168
|
value: function () {
|
|
277
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
278
|
-
var _this$
|
|
169
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
|
|
170
|
+
var _this$otherParams,
|
|
279
171
|
_this2 = this;
|
|
280
172
|
var options,
|
|
173
|
+
appPlugin,
|
|
281
174
|
app,
|
|
282
175
|
targetCacheData,
|
|
283
176
|
moduleNames,
|
|
284
|
-
|
|
285
|
-
return _regeneratorRuntime().wrap(function
|
|
286
|
-
while (1) switch (
|
|
177
|
+
_args = arguments;
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
179
|
+
while (1) switch (_context.prev = _context.next) {
|
|
287
180
|
case 0:
|
|
288
|
-
options =
|
|
181
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
289
182
|
this.core = core;
|
|
290
183
|
this.initializeOptions = options || {};
|
|
291
184
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
292
185
|
this.otherParams = options.otherParams || {};
|
|
293
|
-
this.cacheId = (_this$
|
|
186
|
+
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
294
187
|
this.window = core.getPlugin('window');
|
|
295
188
|
this.request = core.getPlugin('request');
|
|
296
189
|
|
|
297
190
|
// 获取 logger 实例
|
|
298
|
-
|
|
299
|
-
if (
|
|
300
|
-
|
|
191
|
+
appPlugin = core.getPlugin('app');
|
|
192
|
+
if (appPlugin) {
|
|
193
|
+
_context.next = 10;
|
|
301
194
|
break;
|
|
302
195
|
}
|
|
303
196
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
304
197
|
case 10:
|
|
305
|
-
app =
|
|
198
|
+
app = appPlugin.getApp();
|
|
306
199
|
this.logger = app.logger;
|
|
307
200
|
targetCacheData = this.readSessionCacheData();
|
|
308
201
|
moduleNames = this.getRegisteredModuleNames();
|
|
@@ -327,20 +220,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
327
220
|
}));
|
|
328
221
|
});
|
|
329
222
|
if (!this.store.schedule) {
|
|
330
|
-
|
|
223
|
+
_context.next = 18;
|
|
331
224
|
break;
|
|
332
225
|
}
|
|
333
|
-
|
|
226
|
+
_context.next = 18;
|
|
334
227
|
return this.store.schedule.loadAllSchedule();
|
|
335
228
|
case 18:
|
|
336
229
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
337
230
|
case 19:
|
|
338
231
|
case "end":
|
|
339
|
-
return
|
|
232
|
+
return _context.stop();
|
|
340
233
|
}
|
|
341
|
-
},
|
|
234
|
+
}, _callee, this);
|
|
342
235
|
}));
|
|
343
|
-
function initialize(
|
|
236
|
+
function initialize(_x) {
|
|
344
237
|
return _initialize.apply(this, arguments);
|
|
345
238
|
}
|
|
346
239
|
return initialize;
|
|
@@ -348,10 +241,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
348
241
|
}, {
|
|
349
242
|
key: "destroy",
|
|
350
243
|
value: function () {
|
|
351
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
244
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
352
245
|
var _this3 = this;
|
|
353
|
-
return _regeneratorRuntime().wrap(function
|
|
354
|
-
while (1) switch (
|
|
246
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
247
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
355
248
|
case 0:
|
|
356
249
|
Object.keys(this.store).forEach(function (key) {
|
|
357
250
|
var sub = _this3.store[key];
|
|
@@ -364,15 +257,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
364
257
|
}
|
|
365
258
|
});
|
|
366
259
|
this.currentSalesDetail = null;
|
|
367
|
-
|
|
260
|
+
_context2.next = 4;
|
|
368
261
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
369
262
|
case 4:
|
|
370
263
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
371
264
|
case 5:
|
|
372
265
|
case "end":
|
|
373
|
-
return
|
|
266
|
+
return _context2.stop();
|
|
374
267
|
}
|
|
375
|
-
},
|
|
268
|
+
}, _callee2, this);
|
|
376
269
|
}));
|
|
377
270
|
function destroy() {
|
|
378
271
|
return _destroy.apply(this, arguments);
|
|
@@ -389,13 +282,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
389
282
|
}, {
|
|
390
283
|
key: "loadSalesDetail",
|
|
391
284
|
value: (function () {
|
|
392
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
285
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(orderIdOrParams) {
|
|
393
286
|
var params, externalSaleNumber, localRecord, _sales, res, message, sales;
|
|
394
|
-
return _regeneratorRuntime().wrap(function
|
|
395
|
-
while (1) switch (
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
288
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
396
289
|
case 0:
|
|
397
290
|
if (this.store.order) {
|
|
398
|
-
|
|
291
|
+
_context3.next = 2;
|
|
399
292
|
break;
|
|
400
293
|
}
|
|
401
294
|
throw new Error('order 模块未初始化');
|
|
@@ -405,107 +298,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
405
298
|
};
|
|
406
299
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
407
300
|
if (params.forceRemote) {
|
|
408
|
-
|
|
301
|
+
_context3.next = 35;
|
|
409
302
|
break;
|
|
410
303
|
}
|
|
411
304
|
if (!(params.orderId !== undefined)) {
|
|
412
|
-
|
|
305
|
+
_context3.next = 11;
|
|
413
306
|
break;
|
|
414
307
|
}
|
|
415
|
-
|
|
308
|
+
_context3.next = 8;
|
|
416
309
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
417
310
|
case 8:
|
|
418
|
-
|
|
419
|
-
|
|
311
|
+
_context3.t0 = _context3.sent;
|
|
312
|
+
_context3.next = 26;
|
|
420
313
|
break;
|
|
421
314
|
case 11:
|
|
422
315
|
if (!externalSaleNumber) {
|
|
423
|
-
|
|
316
|
+
_context3.next = 17;
|
|
424
317
|
break;
|
|
425
318
|
}
|
|
426
|
-
|
|
319
|
+
_context3.next = 14;
|
|
427
320
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
428
321
|
case 14:
|
|
429
|
-
|
|
430
|
-
|
|
322
|
+
_context3.t1 = _context3.sent;
|
|
323
|
+
_context3.next = 25;
|
|
431
324
|
break;
|
|
432
325
|
case 17:
|
|
433
326
|
if (!params.orderNumber) {
|
|
434
|
-
|
|
327
|
+
_context3.next = 23;
|
|
435
328
|
break;
|
|
436
329
|
}
|
|
437
|
-
|
|
330
|
+
_context3.next = 20;
|
|
438
331
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
439
332
|
case 20:
|
|
440
|
-
|
|
441
|
-
|
|
333
|
+
_context3.t2 = _context3.sent;
|
|
334
|
+
_context3.next = 24;
|
|
442
335
|
break;
|
|
443
336
|
case 23:
|
|
444
|
-
|
|
337
|
+
_context3.t2 = null;
|
|
445
338
|
case 24:
|
|
446
|
-
|
|
339
|
+
_context3.t1 = _context3.t2;
|
|
447
340
|
case 25:
|
|
448
|
-
|
|
341
|
+
_context3.t0 = _context3.t1;
|
|
449
342
|
case 26:
|
|
450
|
-
localRecord =
|
|
343
|
+
localRecord = _context3.t0;
|
|
451
344
|
if (!localRecord) {
|
|
452
|
-
|
|
345
|
+
_context3.next = 35;
|
|
453
346
|
break;
|
|
454
347
|
}
|
|
455
|
-
|
|
348
|
+
_context3.next = 30;
|
|
456
349
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
457
350
|
recalcOnHydrate: false
|
|
458
351
|
});
|
|
459
352
|
case 30:
|
|
460
|
-
_sales =
|
|
353
|
+
_sales = _context3.sent;
|
|
461
354
|
this.currentSalesDetail = _sales;
|
|
462
|
-
|
|
355
|
+
_context3.next = 34;
|
|
463
356
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
464
357
|
sales: _sales
|
|
465
358
|
});
|
|
466
359
|
case 34:
|
|
467
|
-
return
|
|
360
|
+
return _context3.abrupt("return", _sales);
|
|
468
361
|
case 35:
|
|
469
362
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
470
|
-
|
|
363
|
+
_context3.next = 37;
|
|
471
364
|
break;
|
|
472
365
|
}
|
|
473
366
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
474
367
|
case 37:
|
|
475
|
-
|
|
368
|
+
_context3.next = 39;
|
|
476
369
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
477
370
|
case 39:
|
|
478
|
-
res =
|
|
371
|
+
res = _context3.sent;
|
|
479
372
|
if (!(!res || res.code !== 200)) {
|
|
480
|
-
|
|
373
|
+
_context3.next = 43;
|
|
481
374
|
break;
|
|
482
375
|
}
|
|
483
376
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
484
377
|
throw new Error(message);
|
|
485
378
|
case 43:
|
|
486
|
-
|
|
379
|
+
_context3.next = 45;
|
|
487
380
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
488
381
|
recalcOnHydrate: false
|
|
489
382
|
});
|
|
490
383
|
case 45:
|
|
491
|
-
sales =
|
|
492
|
-
|
|
384
|
+
sales = _context3.sent;
|
|
385
|
+
_context3.next = 48;
|
|
493
386
|
return this.store.order.saveDraft();
|
|
494
387
|
case 48:
|
|
495
388
|
this.currentSalesDetail = sales;
|
|
496
|
-
|
|
389
|
+
_context3.next = 51;
|
|
497
390
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
498
391
|
sales: sales
|
|
499
392
|
});
|
|
500
393
|
case 51:
|
|
501
|
-
return
|
|
394
|
+
return _context3.abrupt("return", sales);
|
|
502
395
|
case 52:
|
|
503
396
|
case "end":
|
|
504
|
-
return
|
|
397
|
+
return _context3.stop();
|
|
505
398
|
}
|
|
506
|
-
},
|
|
399
|
+
}, _callee3, this);
|
|
507
400
|
}));
|
|
508
|
-
function loadSalesDetail(
|
|
401
|
+
function loadSalesDetail(_x2) {
|
|
509
402
|
return _loadSalesDetail.apply(this, arguments);
|
|
510
403
|
}
|
|
511
404
|
return loadSalesDetail;
|
|
@@ -578,45 +471,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
578
471
|
}, {
|
|
579
472
|
key: "getTempOrder",
|
|
580
473
|
value: function getTempOrder() {
|
|
581
|
-
var _this$store$
|
|
582
|
-
var result = ((_this$store$
|
|
474
|
+
var _this$store$order;
|
|
475
|
+
var result = ((_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.getTempOrder()) || null;
|
|
583
476
|
return result;
|
|
584
477
|
}
|
|
585
|
-
}, {
|
|
586
|
-
key: "replaceTempOrder",
|
|
587
|
-
value: function () {
|
|
588
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(tempOrder) {
|
|
589
|
-
var nextTempOrder;
|
|
590
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
591
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
592
|
-
case 0:
|
|
593
|
-
if (this.store.order) {
|
|
594
|
-
_context5.next = 2;
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
throw new Error('order 模块未初始化');
|
|
598
|
-
case 2:
|
|
599
|
-
_context5.next = 4;
|
|
600
|
-
return this.store.order.replaceTempOrder(tempOrder);
|
|
601
|
-
case 4:
|
|
602
|
-
nextTempOrder = _context5.sent;
|
|
603
|
-
_context5.next = 7;
|
|
604
|
-
return this.effectsEmit('onTempOrderReplaced', {
|
|
605
|
-
tempOrder: nextTempOrder
|
|
606
|
-
});
|
|
607
|
-
case 7:
|
|
608
|
-
return _context5.abrupt("return", nextTempOrder);
|
|
609
|
-
case 8:
|
|
610
|
-
case "end":
|
|
611
|
-
return _context5.stop();
|
|
612
|
-
}
|
|
613
|
-
}, _callee5, this);
|
|
614
|
-
}));
|
|
615
|
-
function replaceTempOrder(_x4) {
|
|
616
|
-
return _replaceTempOrder.apply(this, arguments);
|
|
617
|
-
}
|
|
618
|
-
return replaceTempOrder;
|
|
619
|
-
}()
|
|
620
478
|
}, {
|
|
621
479
|
key: "getOrderIdentity",
|
|
622
480
|
value: function getOrderIdentity() {
|
|
@@ -650,21 +508,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
650
508
|
}, {
|
|
651
509
|
key: "updateTempOrderNote",
|
|
652
510
|
value: function updateTempOrderNote(note) {
|
|
653
|
-
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
654
511
|
try {
|
|
655
512
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
656
|
-
var result = this.store.order.updateTempOrderNote(note
|
|
513
|
+
var result = this.store.order.updateTempOrderNote(note);
|
|
657
514
|
return result;
|
|
658
515
|
} catch (error) {
|
|
659
516
|
throw error;
|
|
660
517
|
}
|
|
661
518
|
}
|
|
662
|
-
}, {
|
|
663
|
-
key: "updateRemoteOrderNote",
|
|
664
|
-
value: function updateRemoteOrderNote(orderId, note) {
|
|
665
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
666
|
-
this.store.order.syncTempOrderNoteToRemote(orderId, note);
|
|
667
|
-
}
|
|
668
519
|
}, {
|
|
669
520
|
key: "updateTempOrderShopDiscount",
|
|
670
521
|
value: function updateTempOrderShopDiscount(amount) {
|
|
@@ -688,40 +539,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
688
539
|
}, {
|
|
689
540
|
key: "addNewOrder",
|
|
690
541
|
value: function () {
|
|
691
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
542
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
692
543
|
var tempOrder;
|
|
693
|
-
return _regeneratorRuntime().wrap(function
|
|
694
|
-
while (1) switch (
|
|
544
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
545
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
695
546
|
case 0:
|
|
696
|
-
|
|
547
|
+
_context4.prev = 0;
|
|
697
548
|
if (this.store.order) {
|
|
698
|
-
|
|
549
|
+
_context4.next = 3;
|
|
699
550
|
break;
|
|
700
551
|
}
|
|
701
552
|
throw new Error('order 模块未初始化');
|
|
702
553
|
case 3:
|
|
703
|
-
|
|
554
|
+
_context4.next = 5;
|
|
704
555
|
return this.store.order.addNewOrder();
|
|
705
556
|
case 5:
|
|
706
|
-
tempOrder =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
return this.store.order.saveDraft();
|
|
714
|
-
case 10:
|
|
715
|
-
return _context6.abrupt("return", tempOrder);
|
|
716
|
-
case 13:
|
|
717
|
-
_context6.prev = 13;
|
|
718
|
-
_context6.t0 = _context6["catch"](0);
|
|
719
|
-
throw _context6.t0;
|
|
720
|
-
case 16:
|
|
557
|
+
tempOrder = _context4.sent;
|
|
558
|
+
return _context4.abrupt("return", tempOrder);
|
|
559
|
+
case 9:
|
|
560
|
+
_context4.prev = 9;
|
|
561
|
+
_context4.t0 = _context4["catch"](0);
|
|
562
|
+
throw _context4.t0;
|
|
563
|
+
case 12:
|
|
721
564
|
case "end":
|
|
722
|
-
return
|
|
565
|
+
return _context4.stop();
|
|
723
566
|
}
|
|
724
|
-
},
|
|
567
|
+
}, _callee4, this, [[0, 9]]);
|
|
725
568
|
}));
|
|
726
569
|
function addNewOrder() {
|
|
727
570
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -731,22 +574,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
731
574
|
}, {
|
|
732
575
|
key: "saveDraft",
|
|
733
576
|
value: function () {
|
|
734
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
735
|
-
return _regeneratorRuntime().wrap(function
|
|
736
|
-
while (1) switch (
|
|
577
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
578
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
579
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
737
580
|
case 0:
|
|
738
581
|
if (this.store.order) {
|
|
739
|
-
|
|
582
|
+
_context5.next = 2;
|
|
740
583
|
break;
|
|
741
584
|
}
|
|
742
585
|
throw new Error('order 模块未初始化');
|
|
743
586
|
case 2:
|
|
744
|
-
return
|
|
587
|
+
return _context5.abrupt("return", this.store.order.saveDraft());
|
|
745
588
|
case 3:
|
|
746
589
|
case "end":
|
|
747
|
-
return
|
|
590
|
+
return _context5.stop();
|
|
748
591
|
}
|
|
749
|
-
},
|
|
592
|
+
}, _callee5, this);
|
|
750
593
|
}));
|
|
751
594
|
function saveDraft() {
|
|
752
595
|
return _saveDraft.apply(this, arguments);
|
|
@@ -757,111 +600,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
757
600
|
}, {
|
|
758
601
|
key: "restoreOrder",
|
|
759
602
|
value: function () {
|
|
760
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
603
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
761
604
|
var tempOrder;
|
|
762
|
-
return _regeneratorRuntime().wrap(function
|
|
763
|
-
while (1) switch (
|
|
605
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
606
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
764
607
|
case 0:
|
|
765
|
-
|
|
608
|
+
_context6.prev = 0;
|
|
766
609
|
if (this.store.order) {
|
|
767
|
-
|
|
610
|
+
_context6.next = 3;
|
|
768
611
|
break;
|
|
769
612
|
}
|
|
770
613
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
771
614
|
case 3:
|
|
772
615
|
// this.store.resource = null;
|
|
773
616
|
tempOrder = this.store.order.restoreOrder();
|
|
774
|
-
|
|
775
|
-
_context8.next = 7;
|
|
776
|
-
return this.effectsEmit('onTempOrderReplaced', {
|
|
777
|
-
tempOrder: tempOrder
|
|
778
|
-
});
|
|
617
|
+
return _context6.abrupt("return", tempOrder);
|
|
779
618
|
case 7:
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
this.store.order.persistTempOrder();
|
|
785
|
-
_context8.next = 11;
|
|
786
|
-
return this.store.order.saveDraft();
|
|
787
|
-
case 11:
|
|
788
|
-
return _context8.abrupt("return", tempOrder);
|
|
789
|
-
case 14:
|
|
790
|
-
_context8.prev = 14;
|
|
791
|
-
_context8.t0 = _context8["catch"](0);
|
|
792
|
-
throw _context8.t0;
|
|
793
|
-
case 17:
|
|
619
|
+
_context6.prev = 7;
|
|
620
|
+
_context6.t0 = _context6["catch"](0);
|
|
621
|
+
throw _context6.t0;
|
|
622
|
+
case 10:
|
|
794
623
|
case "end":
|
|
795
|
-
return
|
|
624
|
+
return _context6.stop();
|
|
796
625
|
}
|
|
797
|
-
},
|
|
626
|
+
}, _callee6, this, [[0, 7]]);
|
|
798
627
|
}));
|
|
799
628
|
function restoreOrder() {
|
|
800
629
|
return _restoreOrder.apply(this, arguments);
|
|
801
630
|
}
|
|
802
631
|
return restoreOrder;
|
|
803
632
|
}()
|
|
804
|
-
/**
|
|
805
|
-
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
806
|
-
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
807
|
-
*/
|
|
808
|
-
}, {
|
|
809
|
-
key: "clearOrderCartLines",
|
|
810
|
-
value: (function () {
|
|
811
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
812
|
-
var tempOrder;
|
|
813
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
814
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
815
|
-
case 0:
|
|
816
|
-
_context9.prev = 0;
|
|
817
|
-
if (this.store.order) {
|
|
818
|
-
_context9.next = 3;
|
|
819
|
-
break;
|
|
820
|
-
}
|
|
821
|
-
throw new Error('order 模块未初始化');
|
|
822
|
-
case 3:
|
|
823
|
-
_context9.next = 5;
|
|
824
|
-
return this.store.order.clearOrderCartLines();
|
|
825
|
-
case 5:
|
|
826
|
-
tempOrder = _context9.sent;
|
|
827
|
-
if (this.currentSalesDetail) {
|
|
828
|
-
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
829
|
-
products: [],
|
|
830
|
-
bookings: [],
|
|
831
|
-
rootBooking: null,
|
|
832
|
-
bookingsByProductUid: {},
|
|
833
|
-
discount_list: []
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
_context9.next = 9;
|
|
837
|
-
return this.effectsEmit('onTempOrderReplaced', {
|
|
838
|
-
tempOrder: tempOrder
|
|
839
|
-
});
|
|
840
|
-
case 9:
|
|
841
|
-
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
842
|
-
_context9.next = 13;
|
|
843
|
-
break;
|
|
844
|
-
}
|
|
845
|
-
this.store.order.persistTempOrder();
|
|
846
|
-
_context9.next = 13;
|
|
847
|
-
return this.store.order.saveDraft();
|
|
848
|
-
case 13:
|
|
849
|
-
return _context9.abrupt("return", tempOrder);
|
|
850
|
-
case 16:
|
|
851
|
-
_context9.prev = 16;
|
|
852
|
-
_context9.t0 = _context9["catch"](0);
|
|
853
|
-
throw _context9.t0;
|
|
854
|
-
case 19:
|
|
855
|
-
case "end":
|
|
856
|
-
return _context9.stop();
|
|
857
|
-
}
|
|
858
|
-
}, _callee9, this, [[0, 16]]);
|
|
859
|
-
}));
|
|
860
|
-
function clearOrderCartLines() {
|
|
861
|
-
return _clearOrderCartLines.apply(this, arguments);
|
|
862
|
-
}
|
|
863
|
-
return clearOrderCartLines;
|
|
864
|
-
}())
|
|
865
633
|
}, {
|
|
866
634
|
key: "getOrderProducts",
|
|
867
635
|
value: function getOrderProducts() {
|
|
@@ -872,280 +640,38 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
872
640
|
}, {
|
|
873
641
|
key: "getSummary",
|
|
874
642
|
value: function () {
|
|
875
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
643
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
876
644
|
var summary;
|
|
877
|
-
return _regeneratorRuntime().wrap(function
|
|
878
|
-
while (1) switch (
|
|
645
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
646
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
879
647
|
case 0:
|
|
880
|
-
|
|
648
|
+
_context7.prev = 0;
|
|
881
649
|
if (this.store.order) {
|
|
882
|
-
|
|
650
|
+
_context7.next = 3;
|
|
883
651
|
break;
|
|
884
652
|
}
|
|
885
653
|
throw new Error('order 模块未初始化');
|
|
886
654
|
case 3:
|
|
887
|
-
|
|
655
|
+
_context7.next = 5;
|
|
888
656
|
return this.store.order.getOrderSummary();
|
|
889
657
|
case 5:
|
|
890
|
-
summary =
|
|
891
|
-
return
|
|
658
|
+
summary = _context7.sent;
|
|
659
|
+
return _context7.abrupt("return", summary);
|
|
892
660
|
case 9:
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
throw
|
|
661
|
+
_context7.prev = 9;
|
|
662
|
+
_context7.t0 = _context7["catch"](0);
|
|
663
|
+
throw _context7.t0;
|
|
896
664
|
case 12:
|
|
897
665
|
case "end":
|
|
898
|
-
return
|
|
666
|
+
return _context7.stop();
|
|
899
667
|
}
|
|
900
|
-
},
|
|
668
|
+
}, _callee7, this, [[0, 9]]);
|
|
901
669
|
}));
|
|
902
670
|
function getSummary() {
|
|
903
671
|
return _getSummary.apply(this, arguments);
|
|
904
672
|
}
|
|
905
673
|
return getSummary;
|
|
906
674
|
}()
|
|
907
|
-
}, {
|
|
908
|
-
key: "getHistoricalProductDiscountList",
|
|
909
|
-
value: function getHistoricalProductDiscountList(products) {
|
|
910
|
-
var _this4 = this;
|
|
911
|
-
var historyDiscountList = [];
|
|
912
|
-
products.forEach(function (item) {
|
|
913
|
-
if (!_this4.isPersistedOrderProduct(item)) return;
|
|
914
|
-
(item.discount_list || []).forEach(function (discount) {
|
|
915
|
-
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
916
|
-
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
917
|
-
if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
|
|
918
|
-
var quantity = item.quantity || item.num || item.product_quantity || 1;
|
|
919
|
-
var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
|
|
920
|
-
var index = historyDiscountList.findIndex(function (n) {
|
|
921
|
-
return n.id === discountId;
|
|
922
|
-
});
|
|
923
|
-
if (index !== -1) {
|
|
924
|
-
historyDiscountList[index] = _objectSpread(_objectSpread({}, historyDiscountList[index]), {}, {
|
|
925
|
-
amount: new Decimal(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
|
|
926
|
-
savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
|
|
927
|
-
});
|
|
928
|
-
return;
|
|
929
|
-
}
|
|
930
|
-
historyDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
931
|
-
id: discountId,
|
|
932
|
-
tag: discount.tag || discount.type,
|
|
933
|
-
name: discount.name || ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 || (_discount$discount2 = _discount$discount2.title) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.auto),
|
|
934
|
-
format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
|
|
935
|
-
isEditMode: true,
|
|
936
|
-
limited_relation_product_data: {},
|
|
937
|
-
savedAmount: savedAmount.toNumber(),
|
|
938
|
-
isAvailable: true,
|
|
939
|
-
isDisabled: true,
|
|
940
|
-
isSelected: true,
|
|
941
|
-
product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
|
|
942
|
-
}));
|
|
943
|
-
});
|
|
944
|
-
});
|
|
945
|
-
return historyDiscountList;
|
|
946
|
-
}
|
|
947
|
-
}, {
|
|
948
|
-
key: "isPersistedOrderProduct",
|
|
949
|
-
value: function isPersistedOrderProduct(product) {
|
|
950
|
-
var _product$order_detail, _product$booking_id;
|
|
951
|
-
var orderDetailId = (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product.orderDetailId;
|
|
952
|
-
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
953
|
-
return true;
|
|
954
|
-
}
|
|
955
|
-
var bookingId = (_product$booking_id = product.booking_id) !== null && _product$booking_id !== void 0 ? _product$booking_id : product.bookingId;
|
|
956
|
-
return bookingId !== undefined && bookingId !== null && bookingId !== '';
|
|
957
|
-
}
|
|
958
|
-
}, {
|
|
959
|
-
key: "mergeHistoricalDiscountList",
|
|
960
|
-
value: function mergeHistoricalDiscountList(discountList, products) {
|
|
961
|
-
var historyDiscountList = this.getHistoricalProductDiscountList(products);
|
|
962
|
-
var historyIds = new Set(historyDiscountList.map(function (discount) {
|
|
963
|
-
return discount.id;
|
|
964
|
-
}));
|
|
965
|
-
return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
|
|
966
|
-
return !historyIds.has(discount.id);
|
|
967
|
-
})));
|
|
968
|
-
}
|
|
969
|
-
}, {
|
|
970
|
-
key: "loadDiscountConfig",
|
|
971
|
-
value: function () {
|
|
972
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
973
|
-
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi;
|
|
974
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result;
|
|
975
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
976
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
977
|
-
case 0:
|
|
978
|
-
if (this.store.order) {
|
|
979
|
-
_context11.next = 2;
|
|
980
|
-
break;
|
|
981
|
-
}
|
|
982
|
-
throw new Error('order 模块未初始化');
|
|
983
|
-
case 2:
|
|
984
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
985
|
-
orderStore = this.store.order.store || {};
|
|
986
|
-
discountModule = orderStore.discount;
|
|
987
|
-
rulesModule = orderStore.rules;
|
|
988
|
-
orderId = tempOrder.order_id || ((_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 || (_this$getOrderIdentit = _this$getOrderIdentit.call(this)) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.orderId);
|
|
989
|
-
customerId = Number((params === null || params === void 0 ? void 0 : params.customerId) || tempOrder.customer_id || ((_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id) || ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.customerSnapshot) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.id) || ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.customerSnapshot) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2.customer_id) || 0);
|
|
990
|
-
preparedDiscountList = [];
|
|
991
|
-
if (!(customerId && customerId !== 1)) {
|
|
992
|
-
_context11.next = 15;
|
|
993
|
-
break;
|
|
994
|
-
}
|
|
995
|
-
_context11.next = 12;
|
|
996
|
-
return this.store.order.loadDiscountConfig({
|
|
997
|
-
customerId: customerId,
|
|
998
|
-
action: (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create'),
|
|
999
|
-
orderId: Number(orderId) || undefined,
|
|
1000
|
-
apply: false
|
|
1001
|
-
});
|
|
1002
|
-
case 12:
|
|
1003
|
-
preparedDiscountList = _context11.sent;
|
|
1004
|
-
_context11.next = 15;
|
|
1005
|
-
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1006
|
-
case 15:
|
|
1007
|
-
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [], tempOrder.products || []);
|
|
1008
|
-
_context11.next = 18;
|
|
1009
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1010
|
-
case 18:
|
|
1011
|
-
if (!rulesModule) {
|
|
1012
|
-
_context11.next = 28;
|
|
1013
|
-
break;
|
|
1014
|
-
}
|
|
1015
|
-
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1016
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1017
|
-
}] : [];
|
|
1018
|
-
result = rulesModule.calcDiscount({
|
|
1019
|
-
productList: tempOrder.products,
|
|
1020
|
-
discountList: nextDiscountList,
|
|
1021
|
-
holders: holders,
|
|
1022
|
-
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
|
|
1023
|
-
orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
|
|
1024
|
-
}) || {
|
|
1025
|
-
productList: tempOrder.products,
|
|
1026
|
-
discountList: nextDiscountList
|
|
1027
|
-
};
|
|
1028
|
-
if (result.productList) {
|
|
1029
|
-
tempOrder.products = result.productList;
|
|
1030
|
-
}
|
|
1031
|
-
if (!result.discountList) {
|
|
1032
|
-
_context11.next = 28;
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1036
|
-
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1037
|
-
_context11.next = 27;
|
|
1038
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1039
|
-
case 27:
|
|
1040
|
-
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1041
|
-
return discount.isSelected;
|
|
1042
|
-
});
|
|
1043
|
-
case 28:
|
|
1044
|
-
this.store.order.persistTempOrder();
|
|
1045
|
-
_context11.next = 31;
|
|
1046
|
-
return this.effectsEmit('onDiscountApplied', {
|
|
1047
|
-
productList: tempOrder.products || [],
|
|
1048
|
-
discountList: nextDiscountList,
|
|
1049
|
-
selectedDiscountList: tempOrder.discount_list || [],
|
|
1050
|
-
tempOrder: tempOrder
|
|
1051
|
-
});
|
|
1052
|
-
case 31:
|
|
1053
|
-
return _context11.abrupt("return", {
|
|
1054
|
-
productList: tempOrder.products || [],
|
|
1055
|
-
discountList: nextDiscountList
|
|
1056
|
-
});
|
|
1057
|
-
case 32:
|
|
1058
|
-
case "end":
|
|
1059
|
-
return _context11.stop();
|
|
1060
|
-
}
|
|
1061
|
-
}, _callee11, this);
|
|
1062
|
-
}));
|
|
1063
|
-
function loadDiscountConfig(_x5) {
|
|
1064
|
-
return _loadDiscountConfig.apply(this, arguments);
|
|
1065
|
-
}
|
|
1066
|
-
return loadDiscountConfig;
|
|
1067
|
-
}()
|
|
1068
|
-
}, {
|
|
1069
|
-
key: "bestDiscount",
|
|
1070
|
-
value: function () {
|
|
1071
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(cb) {
|
|
1072
|
-
var _discountModule$getOr;
|
|
1073
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
|
|
1074
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1075
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
1076
|
-
case 0:
|
|
1077
|
-
if (this.store.order) {
|
|
1078
|
-
_context12.next = 2;
|
|
1079
|
-
break;
|
|
1080
|
-
}
|
|
1081
|
-
throw new Error('order 模块未初始化');
|
|
1082
|
-
case 2:
|
|
1083
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
1084
|
-
orderStore = this.store.order.store || {};
|
|
1085
|
-
discountModule = orderStore.discount;
|
|
1086
|
-
rulesModule = orderStore.rules;
|
|
1087
|
-
originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || this.getDiscountList();
|
|
1088
|
-
nextDiscountList = this.mergeHistoricalDiscountList(originalDiscountList || [], tempOrder.products || []);
|
|
1089
|
-
result = {
|
|
1090
|
-
productList: tempOrder.products || [],
|
|
1091
|
-
discountList: nextDiscountList
|
|
1092
|
-
};
|
|
1093
|
-
_context12.next = 11;
|
|
1094
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1095
|
-
case 11:
|
|
1096
|
-
if (!rulesModule) {
|
|
1097
|
-
_context12.next = 22;
|
|
1098
|
-
break;
|
|
1099
|
-
}
|
|
1100
|
-
holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
|
|
1101
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1102
|
-
}] : [];
|
|
1103
|
-
result = rulesModule.calcDiscount({
|
|
1104
|
-
productList: tempOrder.products,
|
|
1105
|
-
discountList: nextDiscountList,
|
|
1106
|
-
holders: holders,
|
|
1107
|
-
isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
|
|
1108
|
-
orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
|
|
1109
|
-
}) || result;
|
|
1110
|
-
if (result.productList) {
|
|
1111
|
-
tempOrder.products = result.productList;
|
|
1112
|
-
}
|
|
1113
|
-
if (!result.discountList) {
|
|
1114
|
-
_context12.next = 22;
|
|
1115
|
-
break;
|
|
1116
|
-
}
|
|
1117
|
-
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1118
|
-
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1119
|
-
_context12.next = 20;
|
|
1120
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1121
|
-
case 20:
|
|
1122
|
-
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1123
|
-
return discount.isSelected;
|
|
1124
|
-
});
|
|
1125
|
-
result = {
|
|
1126
|
-
productList: tempOrder.products,
|
|
1127
|
-
discountList: nextDiscountList
|
|
1128
|
-
};
|
|
1129
|
-
case 22:
|
|
1130
|
-
_context12.next = 24;
|
|
1131
|
-
return this.store.order.recalculateSummary({
|
|
1132
|
-
createIfMissing: true
|
|
1133
|
-
});
|
|
1134
|
-
case 24:
|
|
1135
|
-
this.store.order.persistTempOrder();
|
|
1136
|
-
cb === null || cb === void 0 || cb(result);
|
|
1137
|
-
return _context12.abrupt("return", result);
|
|
1138
|
-
case 27:
|
|
1139
|
-
case "end":
|
|
1140
|
-
return _context12.stop();
|
|
1141
|
-
}
|
|
1142
|
-
}, _callee12, this);
|
|
1143
|
-
}));
|
|
1144
|
-
function bestDiscount(_x6) {
|
|
1145
|
-
return _bestDiscount.apply(this, arguments);
|
|
1146
|
-
}
|
|
1147
|
-
return bestDiscount;
|
|
1148
|
-
}()
|
|
1149
675
|
}, {
|
|
1150
676
|
key: "getDiscountList",
|
|
1151
677
|
value: function getDiscountList() {
|
|
@@ -1155,49 +681,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1155
681
|
}, {
|
|
1156
682
|
key: "scanPromotionCode",
|
|
1157
683
|
value: function () {
|
|
1158
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
684
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(code, customerId) {
|
|
1159
685
|
var raw;
|
|
1160
|
-
return _regeneratorRuntime().wrap(function
|
|
1161
|
-
while (1) switch (
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
687
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1162
688
|
case 0:
|
|
1163
|
-
|
|
689
|
+
_context8.prev = 0;
|
|
1164
690
|
if (this.store.order) {
|
|
1165
|
-
|
|
691
|
+
_context8.next = 3;
|
|
1166
692
|
break;
|
|
1167
693
|
}
|
|
1168
694
|
throw new Error('order 模块未初始化');
|
|
1169
695
|
case 3:
|
|
1170
|
-
|
|
696
|
+
_context8.next = 5;
|
|
1171
697
|
return this.store.order.scanCode(code, customerId);
|
|
1172
698
|
case 5:
|
|
1173
|
-
raw =
|
|
699
|
+
raw = _context8.sent;
|
|
1174
700
|
if (!raw.isAvailable) {
|
|
1175
|
-
|
|
701
|
+
_context8.next = 10;
|
|
1176
702
|
break;
|
|
1177
703
|
}
|
|
1178
|
-
|
|
704
|
+
_context8.next = 9;
|
|
1179
705
|
return this.store.order.recalculateSummary({
|
|
1180
706
|
createIfMissing: true
|
|
1181
707
|
});
|
|
1182
708
|
case 9:
|
|
1183
709
|
this.store.order.persistTempOrder();
|
|
1184
710
|
case 10:
|
|
1185
|
-
return
|
|
711
|
+
return _context8.abrupt("return", {
|
|
1186
712
|
isAvailable: raw.isAvailable,
|
|
1187
713
|
type: raw.type,
|
|
1188
714
|
unavailableReason: raw.unavailableReason
|
|
1189
715
|
});
|
|
1190
716
|
case 13:
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
throw
|
|
717
|
+
_context8.prev = 13;
|
|
718
|
+
_context8.t0 = _context8["catch"](0);
|
|
719
|
+
throw _context8.t0;
|
|
1194
720
|
case 16:
|
|
1195
721
|
case "end":
|
|
1196
|
-
return
|
|
722
|
+
return _context8.stop();
|
|
1197
723
|
}
|
|
1198
|
-
},
|
|
724
|
+
}, _callee8, this, [[0, 13]]);
|
|
1199
725
|
}));
|
|
1200
|
-
function scanPromotionCode(
|
|
726
|
+
function scanPromotionCode(_x3, _x4) {
|
|
1201
727
|
return _scanPromotionCode.apply(this, arguments);
|
|
1202
728
|
}
|
|
1203
729
|
return scanPromotionCode;
|
|
@@ -1205,14 +731,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1205
731
|
}, {
|
|
1206
732
|
key: "setDiscountSelected",
|
|
1207
733
|
value: function () {
|
|
1208
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1209
|
-
var _tempOrder$
|
|
1210
|
-
return _regeneratorRuntime().wrap(function
|
|
1211
|
-
while (1) switch (
|
|
734
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
735
|
+
var _tempOrder$holder, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator, _step, d, selectedResourceIds, _iterator2, _step2, _product$metadata, _tempOrder$_extend, _product$metadata2, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
736
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
737
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
1212
738
|
case 0:
|
|
1213
|
-
|
|
739
|
+
_context9.prev = 0;
|
|
1214
740
|
if (this.store.order) {
|
|
1215
|
-
|
|
741
|
+
_context9.next = 3;
|
|
1216
742
|
break;
|
|
1217
743
|
}
|
|
1218
744
|
throw new Error('order 模块未初始化');
|
|
@@ -1228,11 +754,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1228
754
|
orderStore = this.store.order.store || {};
|
|
1229
755
|
discountModule = orderStore.discount;
|
|
1230
756
|
rulesModule = orderStore.rules;
|
|
1231
|
-
holders = (_tempOrder$
|
|
757
|
+
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1232
758
|
form_record_id: tempOrder.holder.form_record_id
|
|
1233
759
|
}] : [];
|
|
1234
760
|
nextDiscountList = updated;
|
|
1235
|
-
|
|
761
|
+
_context9.next = 13;
|
|
1236
762
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1237
763
|
case 13:
|
|
1238
764
|
if (rulesModule) {
|
|
@@ -1240,7 +766,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1240
766
|
productList: tempOrder.products,
|
|
1241
767
|
discountList: updated,
|
|
1242
768
|
holders: holders,
|
|
1243
|
-
isFormSubject: !!((_tempOrder$
|
|
769
|
+
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
|
|
1244
770
|
}, {
|
|
1245
771
|
discountId: params.discountId,
|
|
1246
772
|
isSelected: params.isSelected
|
|
@@ -1281,21 +807,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1281
807
|
return d.id;
|
|
1282
808
|
}));
|
|
1283
809
|
_iterator2 = _createForOfIteratorHelper(tempOrder.products);
|
|
1284
|
-
|
|
810
|
+
_context9.prev = 16;
|
|
1285
811
|
_iterator2.s();
|
|
1286
812
|
case 18:
|
|
1287
813
|
if ((_step2 = _iterator2.n()).done) {
|
|
1288
|
-
|
|
814
|
+
_context9.next = 34;
|
|
1289
815
|
break;
|
|
1290
816
|
}
|
|
1291
817
|
product = _step2.value;
|
|
1292
818
|
productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
1293
|
-
runtimeOrigin = productUid ? (_tempOrder$
|
|
819
|
+
runtimeOrigin = productUid ? (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.productsByUid) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend[productUid]) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.origin : undefined;
|
|
1294
820
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
|
|
1295
|
-
|
|
821
|
+
_context9.next = 24;
|
|
1296
822
|
break;
|
|
1297
823
|
}
|
|
1298
|
-
return
|
|
824
|
+
return _context9.abrupt("continue", 32);
|
|
1299
825
|
case 24:
|
|
1300
826
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1301
827
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -1321,133 +847,65 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1321
847
|
bundle: product.product_bundle
|
|
1322
848
|
});
|
|
1323
849
|
case 32:
|
|
1324
|
-
|
|
850
|
+
_context9.next = 18;
|
|
1325
851
|
break;
|
|
1326
852
|
case 34:
|
|
1327
|
-
|
|
853
|
+
_context9.next = 39;
|
|
1328
854
|
break;
|
|
1329
855
|
case 36:
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
_iterator2.e(
|
|
856
|
+
_context9.prev = 36;
|
|
857
|
+
_context9.t0 = _context9["catch"](16);
|
|
858
|
+
_iterator2.e(_context9.t0);
|
|
1333
859
|
case 39:
|
|
1334
|
-
|
|
860
|
+
_context9.prev = 39;
|
|
1335
861
|
_iterator2.f();
|
|
1336
|
-
return
|
|
862
|
+
return _context9.finish(39);
|
|
1337
863
|
case 42:
|
|
1338
864
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1339
|
-
|
|
865
|
+
_context9.next = 45;
|
|
1340
866
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1341
867
|
case 45:
|
|
1342
868
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1343
869
|
return d.isSelected;
|
|
1344
870
|
});
|
|
1345
|
-
|
|
871
|
+
_context9.next = 48;
|
|
1346
872
|
return this.store.order.recalculateSummary({
|
|
1347
873
|
createIfMissing: true
|
|
1348
874
|
});
|
|
1349
875
|
case 48:
|
|
1350
876
|
this.store.order.persistTempOrder();
|
|
1351
|
-
|
|
1352
|
-
productList: tempOrder.products,
|
|
1353
|
-
discountList: nextDiscountList,
|
|
1354
|
-
selectedDiscountList: tempOrder.discount_list,
|
|
1355
|
-
tempOrder: tempOrder
|
|
1356
|
-
});
|
|
1357
|
-
_context14.next = 55;
|
|
877
|
+
_context9.next = 54;
|
|
1358
878
|
break;
|
|
1359
|
-
case
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
throw
|
|
1363
|
-
case
|
|
879
|
+
case 51:
|
|
880
|
+
_context9.prev = 51;
|
|
881
|
+
_context9.t1 = _context9["catch"](0);
|
|
882
|
+
throw _context9.t1;
|
|
883
|
+
case 54:
|
|
1364
884
|
case "end":
|
|
1365
|
-
return
|
|
885
|
+
return _context9.stop();
|
|
1366
886
|
}
|
|
1367
|
-
},
|
|
887
|
+
}, _callee9, this, [[0, 51], [16, 36, 39, 42]]);
|
|
1368
888
|
}));
|
|
1369
|
-
function setDiscountSelected(
|
|
889
|
+
function setDiscountSelected(_x5) {
|
|
1370
890
|
return _setDiscountSelected.apply(this, arguments);
|
|
1371
891
|
}
|
|
1372
892
|
return setDiscountSelected;
|
|
1373
893
|
}()
|
|
1374
|
-
}, {
|
|
1375
|
-
key: "applyDiscountCalculationResult",
|
|
1376
|
-
value: function () {
|
|
1377
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(result) {
|
|
1378
|
-
var tempOrder, orderStore, discountModule;
|
|
1379
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1380
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
1381
|
-
case 0:
|
|
1382
|
-
_context15.prev = 0;
|
|
1383
|
-
if (this.store.order) {
|
|
1384
|
-
_context15.next = 3;
|
|
1385
|
-
break;
|
|
1386
|
-
}
|
|
1387
|
-
throw new Error('order 模块未初始化');
|
|
1388
|
-
case 3:
|
|
1389
|
-
if (result) {
|
|
1390
|
-
_context15.next = 5;
|
|
1391
|
-
break;
|
|
1392
|
-
}
|
|
1393
|
-
return _context15.abrupt("return");
|
|
1394
|
-
case 5:
|
|
1395
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
1396
|
-
orderStore = this.store.order.store || {};
|
|
1397
|
-
discountModule = orderStore.discount;
|
|
1398
|
-
if (result.productList) {
|
|
1399
|
-
tempOrder.products = result.productList;
|
|
1400
|
-
}
|
|
1401
|
-
if (!result.discountList) {
|
|
1402
|
-
_context15.next = 14;
|
|
1403
|
-
break;
|
|
1404
|
-
}
|
|
1405
|
-
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
1406
|
-
_context15.next = 13;
|
|
1407
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
1408
|
-
case 13:
|
|
1409
|
-
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
1410
|
-
return discount.isSelected;
|
|
1411
|
-
});
|
|
1412
|
-
case 14:
|
|
1413
|
-
_context15.next = 16;
|
|
1414
|
-
return this.store.order.recalculateSummary({
|
|
1415
|
-
createIfMissing: true
|
|
1416
|
-
});
|
|
1417
|
-
case 16:
|
|
1418
|
-
this.store.order.persistTempOrder();
|
|
1419
|
-
_context15.next = 22;
|
|
1420
|
-
break;
|
|
1421
|
-
case 19:
|
|
1422
|
-
_context15.prev = 19;
|
|
1423
|
-
_context15.t0 = _context15["catch"](0);
|
|
1424
|
-
throw _context15.t0;
|
|
1425
|
-
case 22:
|
|
1426
|
-
case "end":
|
|
1427
|
-
return _context15.stop();
|
|
1428
|
-
}
|
|
1429
|
-
}, _callee15, this, [[0, 19]]);
|
|
1430
|
-
}));
|
|
1431
|
-
function applyDiscountCalculationResult(_x10) {
|
|
1432
|
-
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
1433
|
-
}
|
|
1434
|
-
return applyDiscountCalculationResult;
|
|
1435
|
-
}()
|
|
1436
894
|
}, {
|
|
1437
895
|
key: "submitScanOrder",
|
|
1438
896
|
value: function () {
|
|
1439
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1440
|
-
return _regeneratorRuntime().wrap(function
|
|
1441
|
-
while (1) switch (
|
|
897
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
898
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
899
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1442
900
|
case 0:
|
|
1443
|
-
return
|
|
901
|
+
return _context10.abrupt("return", this.submitSalesOrder(params));
|
|
1444
902
|
case 1:
|
|
1445
903
|
case "end":
|
|
1446
|
-
return
|
|
904
|
+
return _context10.stop();
|
|
1447
905
|
}
|
|
1448
|
-
},
|
|
906
|
+
}, _callee10, this);
|
|
1449
907
|
}));
|
|
1450
|
-
function submitScanOrder(
|
|
908
|
+
function submitScanOrder(_x6) {
|
|
1451
909
|
return _submitScanOrder.apply(this, arguments);
|
|
1452
910
|
}
|
|
1453
911
|
return submitScanOrder;
|
|
@@ -1461,14 +919,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1461
919
|
}, {
|
|
1462
920
|
key: "submitSalesOrder",
|
|
1463
921
|
value: (function () {
|
|
1464
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1465
|
-
var _this$
|
|
922
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
923
|
+
var _this$otherParams2, _this$otherParams3, _this$otherParams4, _this$otherParams5;
|
|
1466
924
|
var submitParams;
|
|
1467
|
-
return _regeneratorRuntime().wrap(function
|
|
1468
|
-
while (1) switch (
|
|
925
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
926
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1469
927
|
case 0:
|
|
1470
928
|
if (this.store.order) {
|
|
1471
|
-
|
|
929
|
+
_context11.next = 2;
|
|
1472
930
|
break;
|
|
1473
931
|
}
|
|
1474
932
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -1476,10 +934,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1476
934
|
this.store.order.persistTempOrder();
|
|
1477
935
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1478
936
|
cacheId: this.cacheId,
|
|
1479
|
-
platform: (_this$
|
|
1480
|
-
businessCode: (_this$
|
|
1481
|
-
channel: this.
|
|
1482
|
-
type: (_this$
|
|
937
|
+
platform: (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform,
|
|
938
|
+
businessCode: (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode,
|
|
939
|
+
channel: (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.channel,
|
|
940
|
+
type: (_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.type
|
|
1483
941
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1484
942
|
payments: params.payments
|
|
1485
943
|
} : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
|
|
@@ -1489,15 +947,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1489
947
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
1490
948
|
enhancePayload: params.enhancePayload
|
|
1491
949
|
} : {});
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
case 6:
|
|
950
|
+
return _context11.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
951
|
+
case 5:
|
|
1495
952
|
case "end":
|
|
1496
|
-
return
|
|
953
|
+
return _context11.stop();
|
|
1497
954
|
}
|
|
1498
|
-
},
|
|
955
|
+
}, _callee11, this);
|
|
1499
956
|
}));
|
|
1500
|
-
function submitSalesOrder(
|
|
957
|
+
function submitSalesOrder(_x7) {
|
|
1501
958
|
return _submitSalesOrder.apply(this, arguments);
|
|
1502
959
|
}
|
|
1503
960
|
return submitSalesOrder;
|
|
@@ -1505,75 +962,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1505
962
|
}, {
|
|
1506
963
|
key: "syncPaymentsToOrder",
|
|
1507
964
|
value: function () {
|
|
1508
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1512
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
965
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
966
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
967
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1513
968
|
case 0:
|
|
1514
969
|
if (this.store.order) {
|
|
1515
|
-
|
|
970
|
+
_context12.next = 2;
|
|
1516
971
|
break;
|
|
1517
972
|
}
|
|
1518
973
|
throw new Error('order 模块未初始化');
|
|
1519
974
|
case 2:
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
channel: channel
|
|
1523
|
-
} : {});
|
|
1524
|
-
syncState = this.store.order.getOrderSyncState();
|
|
1525
|
-
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1526
|
-
_context18.next = 7;
|
|
1527
|
-
break;
|
|
1528
|
-
}
|
|
1529
|
-
return _context18.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1530
|
-
case 7:
|
|
1531
|
-
payments = params.payments || [];
|
|
1532
|
-
_context18.next = 10;
|
|
1533
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1534
|
-
payments: payments,
|
|
1535
|
-
params: syncParams,
|
|
1536
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1537
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1538
|
-
});
|
|
1539
|
-
case 10:
|
|
1540
|
-
_context18.prev = 10;
|
|
1541
|
-
_context18.next = 13;
|
|
1542
|
-
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1543
|
-
case 13:
|
|
1544
|
-
syncResult = _context18.sent;
|
|
1545
|
-
_context18.next = 16;
|
|
1546
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1547
|
-
ok: true,
|
|
1548
|
-
syncResult: syncResult,
|
|
1549
|
-
payments: this.store.order.getOrderPayments(),
|
|
1550
|
-
params: syncParams,
|
|
1551
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1552
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1553
|
-
});
|
|
1554
|
-
case 16:
|
|
1555
|
-
return _context18.abrupt("return", syncResult);
|
|
1556
|
-
case 19:
|
|
1557
|
-
_context18.prev = 19;
|
|
1558
|
-
_context18.t0 = _context18["catch"](10);
|
|
1559
|
-
_context18.next = 23;
|
|
1560
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1561
|
-
ok: false,
|
|
1562
|
-
error: _context18.t0,
|
|
1563
|
-
payments: this.store.order.getOrderPayments(),
|
|
1564
|
-
params: syncParams,
|
|
1565
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1566
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1567
|
-
});
|
|
1568
|
-
case 23:
|
|
1569
|
-
throw _context18.t0;
|
|
1570
|
-
case 24:
|
|
975
|
+
return _context12.abrupt("return", this.store.order.syncPaymentsToOrder(params));
|
|
976
|
+
case 3:
|
|
1571
977
|
case "end":
|
|
1572
|
-
return
|
|
978
|
+
return _context12.stop();
|
|
1573
979
|
}
|
|
1574
|
-
},
|
|
980
|
+
}, _callee12, this);
|
|
1575
981
|
}));
|
|
1576
|
-
function syncPaymentsToOrder(
|
|
982
|
+
function syncPaymentsToOrder(_x8) {
|
|
1577
983
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
1578
984
|
}
|
|
1579
985
|
return syncPaymentsToOrder;
|
|
@@ -1597,25 +1003,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1597
1003
|
}, {
|
|
1598
1004
|
key: "addOrderPayment",
|
|
1599
1005
|
value: function addOrderPayment(payment) {
|
|
1600
|
-
var _this5 = this;
|
|
1601
1006
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1602
|
-
|
|
1603
|
-
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
1604
|
-
var syncState = this.store.order.getOrderSyncState();
|
|
1605
|
-
if (amountSnapshot && syncState !== 'submitting') {
|
|
1606
|
-
var paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? 'paid' : 'partially_paid';
|
|
1607
|
-
void this.syncPaymentsToOrder({
|
|
1608
|
-
payments: payments,
|
|
1609
|
-
paymentStatus: paymentStatus,
|
|
1610
|
-
submitWhenPaid: true,
|
|
1611
|
-
smallTicketDataFlag: 1
|
|
1612
|
-
}).catch(function (error) {
|
|
1613
|
-
_this5.logError('auto sync payments failed', {
|
|
1614
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1615
|
-
});
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
return payments;
|
|
1007
|
+
return this.store.order.addOrderPayment(payment);
|
|
1619
1008
|
}
|
|
1620
1009
|
|
|
1621
1010
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -1644,8 +1033,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1644
1033
|
}, {
|
|
1645
1034
|
key: "getWalletProductList",
|
|
1646
1035
|
value: function getWalletProductList() {
|
|
1647
|
-
var _this$store$
|
|
1648
|
-
var tempOrder = (_this$store$
|
|
1036
|
+
var _this$store$order2, _tempOrder$products;
|
|
1037
|
+
var tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 ? void 0 : _this$store$order2.getTempOrder();
|
|
1649
1038
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1650
1039
|
return tempOrder.products.map(function (product) {
|
|
1651
1040
|
var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
@@ -1658,7 +1047,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1658
1047
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
1659
1048
|
tax_fee: product.tax_fee,
|
|
1660
1049
|
selling_price: Number(product.selling_price || 0),
|
|
1661
|
-
discount_list: product.discount_list || [],
|
|
1662
1050
|
holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
|
|
1663
1051
|
original_price: product.original_price,
|
|
1664
1052
|
main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
|
|
@@ -1669,14 +1057,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1669
1057
|
surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
|
|
1670
1058
|
},
|
|
1671
1059
|
product_bundle: (product.product_bundle || []).map(function (bundle) {
|
|
1672
|
-
var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
|
|
1673
1060
|
var bundleMetadata = bundle.metadata || {};
|
|
1674
1061
|
return {
|
|
1675
1062
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
bundle_product_id: (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id,
|
|
1679
|
-
bundle_group_id: (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id,
|
|
1063
|
+
bundle_id: bundle.bundle_id,
|
|
1064
|
+
bundle_product_id: bundle.bundle_product_id,
|
|
1680
1065
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
1681
1066
|
price_type: bundle.price_type,
|
|
1682
1067
|
price_type_ext: bundle.price_type_ext,
|
|
@@ -1697,20 +1082,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1697
1082
|
}, {
|
|
1698
1083
|
key: "initWalletData",
|
|
1699
1084
|
value: function () {
|
|
1700
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1085
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
|
|
1701
1086
|
var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
|
|
1702
1087
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
1703
|
-
return _regeneratorRuntime().wrap(function
|
|
1704
|
-
while (1) switch (
|
|
1088
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1089
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1705
1090
|
case 0:
|
|
1706
1091
|
if (this.store.order) {
|
|
1707
|
-
|
|
1092
|
+
_context13.next = 2;
|
|
1708
1093
|
break;
|
|
1709
1094
|
}
|
|
1710
1095
|
throw new Error('order 模块未初始化');
|
|
1711
1096
|
case 2:
|
|
1712
1097
|
if (this.store.payment) {
|
|
1713
|
-
|
|
1098
|
+
_context13.next = 4;
|
|
1714
1099
|
break;
|
|
1715
1100
|
}
|
|
1716
1101
|
throw new Error('payment 模块未初始化');
|
|
@@ -1719,10 +1104,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1719
1104
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
1720
1105
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
1721
1106
|
if (!(!tempOrder || !amount)) {
|
|
1722
|
-
|
|
1107
|
+
_context13.next = 9;
|
|
1723
1108
|
break;
|
|
1724
1109
|
}
|
|
1725
|
-
return
|
|
1110
|
+
return _context13.abrupt("return", {
|
|
1726
1111
|
walletRecommendList: [],
|
|
1727
1112
|
userIdentificationCodes: [],
|
|
1728
1113
|
transformList: [],
|
|
@@ -1745,11 +1130,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1745
1130
|
}, snapshot.identity.orderId ? {
|
|
1746
1131
|
payment_order_id: String(snapshot.identity.orderId)
|
|
1747
1132
|
} : {});
|
|
1748
|
-
|
|
1133
|
+
_context13.next = 12;
|
|
1749
1134
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
1750
1135
|
case 12:
|
|
1751
|
-
result =
|
|
1752
|
-
|
|
1136
|
+
result = _context13.sent;
|
|
1137
|
+
_context13.next = 15;
|
|
1753
1138
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
1754
1139
|
orderId: snapshot.identity.orderId,
|
|
1755
1140
|
customerId: walletBusinessData.customer_id,
|
|
@@ -1761,14 +1146,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1761
1146
|
timestamp: Date.now()
|
|
1762
1147
|
});
|
|
1763
1148
|
case 15:
|
|
1764
|
-
return
|
|
1149
|
+
return _context13.abrupt("return", result);
|
|
1765
1150
|
case 16:
|
|
1766
1151
|
case "end":
|
|
1767
|
-
return
|
|
1152
|
+
return _context13.stop();
|
|
1768
1153
|
}
|
|
1769
|
-
},
|
|
1154
|
+
}, _callee13, this);
|
|
1770
1155
|
}));
|
|
1771
|
-
function initWalletData(
|
|
1156
|
+
function initWalletData(_x9) {
|
|
1772
1157
|
return _initWalletData.apply(this, arguments);
|
|
1773
1158
|
}
|
|
1774
1159
|
return initWalletData;
|
|
@@ -1795,27 +1180,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1795
1180
|
}, {
|
|
1796
1181
|
key: "getPaymentMethodsAsync",
|
|
1797
1182
|
value: (function () {
|
|
1798
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1183
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1799
1184
|
var response;
|
|
1800
|
-
return _regeneratorRuntime().wrap(function
|
|
1801
|
-
while (1) switch (
|
|
1185
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1186
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1802
1187
|
case 0:
|
|
1803
1188
|
if (!this.store.payment) {
|
|
1804
|
-
|
|
1189
|
+
_context14.next = 2;
|
|
1805
1190
|
break;
|
|
1806
1191
|
}
|
|
1807
|
-
return
|
|
1192
|
+
return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
|
|
1808
1193
|
case 2:
|
|
1809
|
-
|
|
1194
|
+
_context14.next = 4;
|
|
1810
1195
|
return this.request.get('/pay/custom-payment/all');
|
|
1811
1196
|
case 4:
|
|
1812
|
-
response =
|
|
1813
|
-
return
|
|
1197
|
+
response = _context14.sent;
|
|
1198
|
+
return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
|
|
1814
1199
|
case 6:
|
|
1815
1200
|
case "end":
|
|
1816
|
-
return
|
|
1201
|
+
return _context14.stop();
|
|
1817
1202
|
}
|
|
1818
|
-
},
|
|
1203
|
+
}, _callee14, this);
|
|
1819
1204
|
}));
|
|
1820
1205
|
function getPaymentMethodsAsync() {
|
|
1821
1206
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -1856,49 +1241,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1856
1241
|
}, {
|
|
1857
1242
|
key: "sendCustomerPayLink",
|
|
1858
1243
|
value: (function () {
|
|
1859
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1244
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1860
1245
|
var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
1861
|
-
return _regeneratorRuntime().wrap(function
|
|
1862
|
-
while (1) switch (
|
|
1246
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1247
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1863
1248
|
case 0:
|
|
1864
1249
|
if (this.store.order) {
|
|
1865
|
-
|
|
1250
|
+
_context15.next = 2;
|
|
1866
1251
|
break;
|
|
1867
1252
|
}
|
|
1868
1253
|
throw new Error('order 模块未初始化');
|
|
1869
1254
|
case 2:
|
|
1870
1255
|
orderIds = params.order_ids || params.orderIds || [];
|
|
1871
1256
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
1872
|
-
|
|
1257
|
+
_context15.next = 11;
|
|
1873
1258
|
break;
|
|
1874
1259
|
}
|
|
1875
|
-
|
|
1260
|
+
_context15.next = 6;
|
|
1876
1261
|
return this.submitSalesOrder({
|
|
1877
1262
|
smallTicketDataFlag: 1
|
|
1878
1263
|
});
|
|
1879
1264
|
case 6:
|
|
1880
|
-
submitResult =
|
|
1265
|
+
submitResult = _context15.sent;
|
|
1881
1266
|
orderId = (_ref2 = (_ref3 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref3 !== void 0 ? _ref3 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref2 !== void 0 ? _ref2 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
1882
1267
|
if (orderId) {
|
|
1883
|
-
|
|
1268
|
+
_context15.next = 10;
|
|
1884
1269
|
break;
|
|
1885
1270
|
}
|
|
1886
1271
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
1887
1272
|
case 10:
|
|
1888
1273
|
orderIds = [orderId];
|
|
1889
1274
|
case 11:
|
|
1890
|
-
return
|
|
1275
|
+
return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
1891
1276
|
emails: params.emails,
|
|
1892
1277
|
notify_action: params.notify_action,
|
|
1893
1278
|
order_ids: orderIds
|
|
1894
1279
|
}));
|
|
1895
1280
|
case 12:
|
|
1896
1281
|
case "end":
|
|
1897
|
-
return
|
|
1282
|
+
return _context15.stop();
|
|
1898
1283
|
}
|
|
1899
|
-
},
|
|
1284
|
+
}, _callee15, this);
|
|
1900
1285
|
}));
|
|
1901
|
-
function sendCustomerPayLink(
|
|
1286
|
+
function sendCustomerPayLink(_x10) {
|
|
1902
1287
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
1903
1288
|
}
|
|
1904
1289
|
return sendCustomerPayLink;
|
|
@@ -1908,155 +1293,76 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1908
1293
|
value: function transformBaseProductToOrderProduct(params) {
|
|
1909
1294
|
return _transformBaseProductToOrderProduct(params);
|
|
1910
1295
|
}
|
|
1911
|
-
}, {
|
|
1912
|
-
key: "calculateProductBookingPrice",
|
|
1913
|
-
value: function () {
|
|
1914
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1915
|
-
var _params$customer_id;
|
|
1916
|
-
var quotation, customerId;
|
|
1917
|
-
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1918
|
-
while (1) switch (_context22.prev = _context22.next) {
|
|
1919
|
-
case 0:
|
|
1920
|
-
quotation = this.store.quotation;
|
|
1921
|
-
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
1922
|
-
_context22.next = 4;
|
|
1923
|
-
return this.loadQuotationForPriceQuery({
|
|
1924
|
-
quotation: quotation,
|
|
1925
|
-
customer_id: customerId,
|
|
1926
|
-
channel: params.channel
|
|
1927
|
-
});
|
|
1928
|
-
case 4:
|
|
1929
|
-
return _context22.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
1930
|
-
customer_id: customerId,
|
|
1931
|
-
quotation: quotation
|
|
1932
|
-
})));
|
|
1933
|
-
case 5:
|
|
1934
|
-
case "end":
|
|
1935
|
-
return _context22.stop();
|
|
1936
|
-
}
|
|
1937
|
-
}, _callee22, this);
|
|
1938
|
-
}));
|
|
1939
|
-
function calculateProductBookingPrice(_x16) {
|
|
1940
|
-
return _calculateProductBookingPrice.apply(this, arguments);
|
|
1941
|
-
}
|
|
1942
|
-
return calculateProductBookingPrice;
|
|
1943
|
-
}()
|
|
1944
1296
|
}, {
|
|
1945
1297
|
key: "addProductToOrder",
|
|
1946
1298
|
value: function () {
|
|
1947
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1299
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
|
|
1948
1300
|
var products;
|
|
1949
|
-
return _regeneratorRuntime().wrap(function
|
|
1950
|
-
while (1) switch (
|
|
1301
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1302
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1951
1303
|
case 0:
|
|
1952
|
-
|
|
1304
|
+
_context16.prev = 0;
|
|
1953
1305
|
if (this.store.order) {
|
|
1954
|
-
|
|
1306
|
+
_context16.next = 3;
|
|
1955
1307
|
break;
|
|
1956
1308
|
}
|
|
1957
1309
|
throw new Error('order 模块未初始化');
|
|
1958
1310
|
case 3:
|
|
1959
|
-
|
|
1311
|
+
_context16.next = 5;
|
|
1960
1312
|
return this.store.order.addProductToOrder(product, booking);
|
|
1961
1313
|
case 5:
|
|
1962
|
-
products =
|
|
1963
|
-
return
|
|
1314
|
+
products = _context16.sent;
|
|
1315
|
+
return _context16.abrupt("return", products);
|
|
1964
1316
|
case 9:
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
throw
|
|
1317
|
+
_context16.prev = 9;
|
|
1318
|
+
_context16.t0 = _context16["catch"](0);
|
|
1319
|
+
throw _context16.t0;
|
|
1968
1320
|
case 12:
|
|
1969
1321
|
case "end":
|
|
1970
|
-
return
|
|
1322
|
+
return _context16.stop();
|
|
1971
1323
|
}
|
|
1972
|
-
},
|
|
1324
|
+
}, _callee16, this, [[0, 9]]);
|
|
1973
1325
|
}));
|
|
1974
|
-
function addProductToOrder(
|
|
1326
|
+
function addProductToOrder(_x11, _x12) {
|
|
1975
1327
|
return _addProductToOrder.apply(this, arguments);
|
|
1976
1328
|
}
|
|
1977
1329
|
return addProductToOrder;
|
|
1978
1330
|
}()
|
|
1979
1331
|
}, {
|
|
1980
|
-
key: "
|
|
1981
|
-
value: function () {
|
|
1982
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
1983
|
-
var products;
|
|
1984
|
-
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1985
|
-
while (1) switch (_context24.prev = _context24.next) {
|
|
1986
|
-
case 0:
|
|
1987
|
-
_context24.prev = 0;
|
|
1988
|
-
if (this.store.order) {
|
|
1989
|
-
_context24.next = 3;
|
|
1990
|
-
break;
|
|
1991
|
-
}
|
|
1992
|
-
throw new Error('order 模块未初始化');
|
|
1993
|
-
case 3:
|
|
1994
|
-
_context24.next = 5;
|
|
1995
|
-
return this.store.order.updateOrderProduct(params);
|
|
1996
|
-
case 5:
|
|
1997
|
-
products = _context24.sent;
|
|
1998
|
-
return _context24.abrupt("return", products);
|
|
1999
|
-
case 9:
|
|
2000
|
-
_context24.prev = 9;
|
|
2001
|
-
_context24.t0 = _context24["catch"](0);
|
|
2002
|
-
throw _context24.t0;
|
|
2003
|
-
case 12:
|
|
2004
|
-
case "end":
|
|
2005
|
-
return _context24.stop();
|
|
2006
|
-
}
|
|
2007
|
-
}, _callee24, this, [[0, 9]]);
|
|
2008
|
-
}));
|
|
2009
|
-
function updateOrderProduct(_x19) {
|
|
2010
|
-
return _updateOrderProduct.apply(this, arguments);
|
|
2011
|
-
}
|
|
2012
|
-
return updateOrderProduct;
|
|
2013
|
-
}()
|
|
2014
|
-
}, {
|
|
2015
|
-
key: "updateOrderProductQuantity",
|
|
1332
|
+
key: "updateProductInOrder",
|
|
2016
1333
|
value: function () {
|
|
2017
|
-
var
|
|
1334
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2018
1335
|
var products;
|
|
2019
|
-
return _regeneratorRuntime().wrap(function
|
|
2020
|
-
while (1) switch (
|
|
1336
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1337
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2021
1338
|
case 0:
|
|
2022
|
-
|
|
1339
|
+
_context17.prev = 0;
|
|
2023
1340
|
if (this.store.order) {
|
|
2024
|
-
|
|
1341
|
+
_context17.next = 3;
|
|
2025
1342
|
break;
|
|
2026
1343
|
}
|
|
2027
1344
|
throw new Error('order 模块未初始化');
|
|
2028
1345
|
case 3:
|
|
2029
|
-
|
|
2030
|
-
return this.store.order.
|
|
1346
|
+
_context17.next = 5;
|
|
1347
|
+
return this.store.order.updateProductInOrder(params);
|
|
2031
1348
|
case 5:
|
|
2032
|
-
products =
|
|
2033
|
-
return
|
|
1349
|
+
products = _context17.sent;
|
|
1350
|
+
return _context17.abrupt("return", products);
|
|
2034
1351
|
case 9:
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
throw
|
|
1352
|
+
_context17.prev = 9;
|
|
1353
|
+
_context17.t0 = _context17["catch"](0);
|
|
1354
|
+
throw _context17.t0;
|
|
2038
1355
|
case 12:
|
|
2039
1356
|
case "end":
|
|
2040
|
-
return
|
|
1357
|
+
return _context17.stop();
|
|
2041
1358
|
}
|
|
2042
|
-
},
|
|
1359
|
+
}, _callee17, this, [[0, 9]]);
|
|
2043
1360
|
}));
|
|
2044
|
-
function
|
|
2045
|
-
return
|
|
1361
|
+
function updateProductInOrder(_x13) {
|
|
1362
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
2046
1363
|
}
|
|
2047
|
-
return
|
|
1364
|
+
return updateProductInOrder;
|
|
2048
1365
|
}()
|
|
2049
|
-
}, {
|
|
2050
|
-
key: "updateOrderBooking",
|
|
2051
|
-
value: function updateOrderBooking(params) {
|
|
2052
|
-
try {
|
|
2053
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2054
|
-
return this.store.order.updateOrderBooking(params);
|
|
2055
|
-
} catch (error) {
|
|
2056
|
-
throw error;
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
1366
|
/**
|
|
2061
1367
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
2062
1368
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|
|
@@ -2064,12 +1370,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2064
1370
|
}, {
|
|
2065
1371
|
key: "setOrderProductLineNote",
|
|
2066
1372
|
value: (function () {
|
|
2067
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1373
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
|
|
2068
1374
|
var params, products;
|
|
2069
|
-
return _regeneratorRuntime().wrap(function
|
|
2070
|
-
while (1) switch (
|
|
1375
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1376
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2071
1377
|
case 0:
|
|
2072
|
-
|
|
1378
|
+
_context18.prev = 0;
|
|
2073
1379
|
params = {
|
|
2074
1380
|
product_id: identity.product_id,
|
|
2075
1381
|
product_variant_id: identity.product_variant_id,
|
|
@@ -2084,22 +1390,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2084
1390
|
params.product_option_item = identity.product_option_item;
|
|
2085
1391
|
}
|
|
2086
1392
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
2087
|
-
|
|
2088
|
-
return this.
|
|
1393
|
+
_context18.next = 7;
|
|
1394
|
+
return this.updateProductInOrder(params);
|
|
2089
1395
|
case 7:
|
|
2090
|
-
products =
|
|
2091
|
-
return
|
|
1396
|
+
products = _context18.sent;
|
|
1397
|
+
return _context18.abrupt("return", products);
|
|
2092
1398
|
case 11:
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
throw
|
|
1399
|
+
_context18.prev = 11;
|
|
1400
|
+
_context18.t0 = _context18["catch"](0);
|
|
1401
|
+
throw _context18.t0;
|
|
2096
1402
|
case 14:
|
|
2097
1403
|
case "end":
|
|
2098
|
-
return
|
|
1404
|
+
return _context18.stop();
|
|
2099
1405
|
}
|
|
2100
|
-
},
|
|
1406
|
+
}, _callee18, this, [[0, 11]]);
|
|
2101
1407
|
}));
|
|
2102
|
-
function setOrderProductLineNote(
|
|
1408
|
+
function setOrderProductLineNote(_x14, _x15) {
|
|
2103
1409
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
2104
1410
|
}
|
|
2105
1411
|
return setOrderProductLineNote;
|
|
@@ -2107,34 +1413,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2107
1413
|
}, {
|
|
2108
1414
|
key: "removeProductFromOrder",
|
|
2109
1415
|
value: function () {
|
|
2110
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1416
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
|
|
2111
1417
|
var products;
|
|
2112
|
-
return _regeneratorRuntime().wrap(function
|
|
2113
|
-
while (1) switch (
|
|
1418
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1419
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2114
1420
|
case 0:
|
|
2115
|
-
|
|
1421
|
+
_context19.prev = 0;
|
|
2116
1422
|
if (this.store.order) {
|
|
2117
|
-
|
|
1423
|
+
_context19.next = 3;
|
|
2118
1424
|
break;
|
|
2119
1425
|
}
|
|
2120
1426
|
throw new Error('order 模块未初始化');
|
|
2121
1427
|
case 3:
|
|
2122
|
-
|
|
1428
|
+
_context19.next = 5;
|
|
2123
1429
|
return this.store.order.removeProductFromOrder(identity);
|
|
2124
1430
|
case 5:
|
|
2125
|
-
products =
|
|
2126
|
-
return
|
|
1431
|
+
products = _context19.sent;
|
|
1432
|
+
return _context19.abrupt("return", products);
|
|
2127
1433
|
case 9:
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
throw
|
|
1434
|
+
_context19.prev = 9;
|
|
1435
|
+
_context19.t0 = _context19["catch"](0);
|
|
1436
|
+
throw _context19.t0;
|
|
2131
1437
|
case 12:
|
|
2132
1438
|
case "end":
|
|
2133
|
-
return
|
|
1439
|
+
return _context19.stop();
|
|
2134
1440
|
}
|
|
2135
|
-
},
|
|
1441
|
+
}, _callee19, this, [[0, 9]]);
|
|
2136
1442
|
}));
|
|
2137
|
-
function removeProductFromOrder(
|
|
1443
|
+
function removeProductFromOrder(_x16) {
|
|
2138
1444
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2139
1445
|
}
|
|
2140
1446
|
return removeProductFromOrder;
|
|
@@ -2143,18 +1449,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2143
1449
|
}, {
|
|
2144
1450
|
key: "getProductList",
|
|
2145
1451
|
value: function () {
|
|
2146
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2147
|
-
var _this$
|
|
1452
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1453
|
+
var _this$otherParams6;
|
|
2148
1454
|
var menu_list_ids, _this$store$products, res;
|
|
2149
|
-
return _regeneratorRuntime().wrap(function
|
|
2150
|
-
while (1) switch (
|
|
1455
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1456
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2151
1457
|
case 0:
|
|
2152
1458
|
// 可以直接通过配置里的 menu 读取
|
|
2153
|
-
menu_list_ids = ((_this$
|
|
1459
|
+
menu_list_ids = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.dineInConfig) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus'].map(function (n) {
|
|
2154
1460
|
return Number(n.value);
|
|
2155
1461
|
})) || [];
|
|
2156
|
-
|
|
2157
|
-
|
|
1462
|
+
_context20.prev = 1;
|
|
1463
|
+
_context20.next = 4;
|
|
2158
1464
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2159
1465
|
menu_list_ids: menu_list_ids,
|
|
2160
1466
|
cacheId: this.cacheId,
|
|
@@ -2162,17 +1468,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2162
1468
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2163
1469
|
});
|
|
2164
1470
|
case 4:
|
|
2165
|
-
res =
|
|
2166
|
-
return
|
|
1471
|
+
res = _context20.sent;
|
|
1472
|
+
return _context20.abrupt("return", res);
|
|
2167
1473
|
case 8:
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
throw
|
|
1474
|
+
_context20.prev = 8;
|
|
1475
|
+
_context20.t0 = _context20["catch"](1);
|
|
1476
|
+
throw _context20.t0;
|
|
2171
1477
|
case 11:
|
|
2172
1478
|
case "end":
|
|
2173
|
-
return
|
|
1479
|
+
return _context20.stop();
|
|
2174
1480
|
}
|
|
2175
|
-
},
|
|
1481
|
+
}, _callee20, this, [[1, 8]]);
|
|
2176
1482
|
}));
|
|
2177
1483
|
function getProductList() {
|
|
2178
1484
|
return _getProductList.apply(this, arguments);
|
|
@@ -2187,15 +1493,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2187
1493
|
}, {
|
|
2188
1494
|
key: "setOtherParams",
|
|
2189
1495
|
value: function () {
|
|
2190
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1496
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2191
1497
|
var _ref4,
|
|
2192
1498
|
_ref4$cover,
|
|
2193
1499
|
cover,
|
|
2194
|
-
|
|
2195
|
-
return _regeneratorRuntime().wrap(function
|
|
2196
|
-
while (1) switch (
|
|
1500
|
+
_args21 = arguments;
|
|
1501
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1502
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2197
1503
|
case 0:
|
|
2198
|
-
_ref4 =
|
|
1504
|
+
_ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
2199
1505
|
if (cover) {
|
|
2200
1506
|
this.otherParams = params;
|
|
2201
1507
|
} else {
|
|
@@ -2203,11 +1509,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2203
1509
|
}
|
|
2204
1510
|
case 2:
|
|
2205
1511
|
case "end":
|
|
2206
|
-
return
|
|
1512
|
+
return _context21.stop();
|
|
2207
1513
|
}
|
|
2208
|
-
},
|
|
1514
|
+
}, _callee21, this);
|
|
2209
1515
|
}));
|
|
2210
|
-
function setOtherParams(
|
|
1516
|
+
function setOtherParams(_x17) {
|
|
2211
1517
|
return _setOtherParams.apply(this, arguments);
|
|
2212
1518
|
}
|
|
2213
1519
|
return setOtherParams;
|