@pisell/pisellos 2.2.178 → 2.2.179
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/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 +18 -88
- package/dist/modules/Order/index.js +501 -1357
- package/dist/modules/Order/types.d.ts +19 -198
- package/dist/modules/Order/types.js +0 -31
- package/dist/modules/Order/utils.d.ts +1 -50
- package/dist/modules/Order/utils.js +32 -261
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +21 -23
- 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/SalesSummary/utils.js +7 -21
- package/dist/modules/Schedule/index.js +2 -6
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/index.js +29 -87
- package/dist/server/modules/order/index.d.ts +0 -23
- package/dist/server/modules/order/index.js +46 -123
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/server/modules/products/index.d.ts +1 -1
- package/dist/server/modules/products/index.js +113 -130
- package/dist/server/modules/schedule/index.js +6 -13
- package/dist/solution/BaseSales/index.d.ts +7 -89
- package/dist/solution/BaseSales/index.js +375 -1494
- package/dist/solution/BaseSales/types.d.ts +1 -67
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +16 -68
- 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 -780
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/BookingTicket/utils/cartView.js +2 -4
- 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 +18 -88
- package/lib/modules/Order/index.js +149 -677
- package/lib/modules/Order/types.d.ts +19 -198
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +1 -50
- package/lib/modules/Order/utils.js +22 -229
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +15 -18
- 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/SalesSummary/utils.js +7 -21
- package/lib/modules/Schedule/index.js +1 -3
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/index.js +4 -41
- package/lib/server/modules/order/index.d.ts +0 -23
- package/lib/server/modules/order/index.js +14 -46
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/server/modules/products/index.d.ts +1 -1
- package/lib/server/modules/products/index.js +20 -30
- package/lib/server/modules/schedule/index.js +1 -2
- package/lib/solution/BaseSales/index.d.ts +7 -89
- package/lib/solution/BaseSales/index.js +22 -736
- package/lib/solution/BaseSales/types.d.ts +1 -67
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +12 -71
- 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 -352
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/BookingTicket/utils/cartView.js +2 -4
- 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/cartPromotion.d.ts +0 -275
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1258
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -275
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -836
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
2
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
3
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
4
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -27,16 +23,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
27
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
24
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
25
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
|
-
import { BaseSalesHookNames } from "./types";
|
|
31
26
|
import { OrderModule } from "../../modules/Order";
|
|
32
27
|
import Decimal from 'decimal.js';
|
|
33
28
|
import { createModule } from "../BookingByStep/types";
|
|
34
|
-
import { composeLinePrice,
|
|
29
|
+
import { composeLinePrice, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
35
30
|
import dayjs from 'dayjs';
|
|
36
31
|
export * from "./types";
|
|
37
|
-
import { QuotationModule } from "../../modules/Quotation";
|
|
38
32
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
39
|
-
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
40
33
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
41
34
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
42
35
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -50,7 +43,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
50
43
|
_defineProperty(_assertThisInitialized(_this), "initializeOptions", {});
|
|
51
44
|
_defineProperty(_assertThisInitialized(_this), "logger", void 0);
|
|
52
45
|
// LoggerManager 实例
|
|
53
|
-
_defineProperty(_assertThisInitialized(_this), "appPlugin", void 0);
|
|
54
46
|
_defineProperty(_assertThisInitialized(_this), "store", {
|
|
55
47
|
order: undefined
|
|
56
48
|
});
|
|
@@ -64,19 +56,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
64
56
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
65
57
|
// 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
|
|
66
58
|
_defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
|
|
68
|
-
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
69
59
|
return _this;
|
|
70
60
|
}
|
|
71
61
|
|
|
72
62
|
/**
|
|
73
63
|
* 子类可覆盖此方法以追加/收敛要注册的子模块。
|
|
74
|
-
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment
|
|
64
|
+
* 默认包含通用销售模块:products / order / salesSummary / schedule / payment。
|
|
75
65
|
*/
|
|
76
66
|
_createClass(BaseSalesImpl, [{
|
|
77
67
|
key: "getRegisteredModuleNames",
|
|
78
68
|
value: function getRegisteredModuleNames() {
|
|
79
|
-
return ['products', 'order', 'salesSummary', 'schedule', 'payment'
|
|
69
|
+
return ['products', 'order', 'salesSummary', 'schedule', 'payment'];
|
|
80
70
|
}
|
|
81
71
|
|
|
82
72
|
/**
|
|
@@ -131,251 +121,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
121
|
get: function get() {
|
|
132
122
|
return this.store.payment;
|
|
133
123
|
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "getCurrentOrderCustomerId",
|
|
136
|
-
value: function getCurrentOrderCustomerId() {
|
|
137
|
-
var _this$store$order, _this$store$order$get;
|
|
138
|
-
var tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
|
|
139
|
-
var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
140
|
-
if (customerId === null || customerId === undefined) return undefined;
|
|
141
|
-
return customerId;
|
|
142
|
-
}
|
|
143
|
-
}, {
|
|
144
|
-
key: "applyQuotationScheduleResolver",
|
|
145
|
-
value: function applyQuotationScheduleResolver(quotation) {
|
|
146
|
-
var scheduleModule = this.store.schedule;
|
|
147
|
-
if (!scheduleModule) return;
|
|
148
|
-
quotation.setScheduleResolver(function (id) {
|
|
149
|
-
var _scheduleModule$getSc;
|
|
150
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || [];
|
|
151
|
-
return schedules[0];
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}, {
|
|
155
|
-
key: "loadQuotationForPriceQuery",
|
|
156
|
-
value: function () {
|
|
157
|
-
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
158
|
-
var _this$otherParams;
|
|
159
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
160
|
-
while (1) switch (_context.prev = _context.next) {
|
|
161
|
-
case 0:
|
|
162
|
-
if (params.quotation) {
|
|
163
|
-
_context.next = 2;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
return _context.abrupt("return");
|
|
167
|
-
case 2:
|
|
168
|
-
this.applyQuotationScheduleResolver(params.quotation);
|
|
169
|
-
_context.next = 5;
|
|
170
|
-
return params.quotation.loadQuotations({
|
|
171
|
-
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
172
|
-
customer_id: params.customer_id
|
|
173
|
-
});
|
|
174
|
-
case 5:
|
|
175
|
-
case "end":
|
|
176
|
-
return _context.stop();
|
|
177
|
-
}
|
|
178
|
-
}, _callee, this);
|
|
179
|
-
}));
|
|
180
|
-
function loadQuotationForPriceQuery(_x) {
|
|
181
|
-
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
182
|
-
}
|
|
183
|
-
return loadQuotationForPriceQuery;
|
|
184
|
-
}()
|
|
185
|
-
}, {
|
|
186
|
-
key: "getPriceQueryProductId",
|
|
187
|
-
value: function getPriceQueryProductId(product) {
|
|
188
|
-
var _product$product_id;
|
|
189
|
-
var productId = Number((_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id);
|
|
190
|
-
if (!Number.isFinite(productId)) return null;
|
|
191
|
-
return productId;
|
|
192
|
-
}
|
|
193
|
-
}, {
|
|
194
|
-
key: "getPriceQuerySchedule",
|
|
195
|
-
value: function getPriceQuerySchedule(params) {
|
|
196
|
-
var booking = params.booking || {};
|
|
197
|
-
if (typeof booking.start_date === 'string' && booking.start_date.trim()) {
|
|
198
|
-
var scheduleDate = booking.start_date.trim();
|
|
199
|
-
var startTime = typeof booking.start_time === 'string' && booking.start_time.trim() ? booking.start_time.trim() : '00:00:00';
|
|
200
|
-
var datetime = dayjs("".concat(scheduleDate, " ").concat(startTime));
|
|
201
|
-
return {
|
|
202
|
-
schedule_date: scheduleDate,
|
|
203
|
-
schedule_datetime: datetime.isValid() ? datetime.format('YYYY-MM-DD HH:mm:ss') : "".concat(scheduleDate, " ").concat(startTime)
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
if (typeof params.datetime === 'string' && params.datetime.trim()) {
|
|
207
|
-
var _datetime = dayjs(params.datetime.trim());
|
|
208
|
-
if (_datetime.isValid()) {
|
|
209
|
-
return {
|
|
210
|
-
schedule_date: _datetime.format('YYYY-MM-DD'),
|
|
211
|
-
schedule_datetime: _datetime.format('YYYY-MM-DD HH:mm:ss')
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
var now = dayjs();
|
|
216
|
-
return {
|
|
217
|
-
schedule_date: now.format('YYYY-MM-DD'),
|
|
218
|
-
schedule_datetime: now.format('YYYY-MM-DD HH:mm:ss')
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}, {
|
|
222
|
-
key: "loadProductForPriceQuery",
|
|
223
|
-
value: function () {
|
|
224
|
-
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, customerId) {
|
|
225
|
-
var product, productId, schedule, _this$otherParams2, _response$data, response, list;
|
|
226
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
227
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
228
|
-
case 0:
|
|
229
|
-
product = params.product || {};
|
|
230
|
-
productId = this.getPriceQueryProductId(product);
|
|
231
|
-
if (!(productId === null || !this.request)) {
|
|
232
|
-
_context2.next = 4;
|
|
233
|
-
break;
|
|
234
|
-
}
|
|
235
|
-
return _context2.abrupt("return", null);
|
|
236
|
-
case 4:
|
|
237
|
-
schedule = this.getPriceQuerySchedule(params);
|
|
238
|
-
_context2.prev = 5;
|
|
239
|
-
_context2.next = 8;
|
|
240
|
-
return this.request.post('/product/query', {
|
|
241
|
-
ids: [productId],
|
|
242
|
-
open_quotation: 1,
|
|
243
|
-
open_bundle: 1,
|
|
244
|
-
status: 'published',
|
|
245
|
-
num: 1,
|
|
246
|
-
skip: 1,
|
|
247
|
-
customer_id: customerId,
|
|
248
|
-
schedule_date: schedule.schedule_date,
|
|
249
|
-
schedule_datetime: schedule.schedule_datetime,
|
|
250
|
-
application_code: params.channel || ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.channel)
|
|
251
|
-
}, {
|
|
252
|
-
osServer: true,
|
|
253
|
-
customToast: function customToast() {}
|
|
254
|
-
});
|
|
255
|
-
case 8:
|
|
256
|
-
response = _context2.sent;
|
|
257
|
-
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
258
|
-
if (Array.isArray(list)) {
|
|
259
|
-
_context2.next = 12;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
return _context2.abrupt("return", null);
|
|
263
|
-
case 12:
|
|
264
|
-
return _context2.abrupt("return", list.find(function (item) {
|
|
265
|
-
var _item$id;
|
|
266
|
-
return Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id) === productId;
|
|
267
|
-
}) || null);
|
|
268
|
-
case 15:
|
|
269
|
-
_context2.prev = 15;
|
|
270
|
-
_context2.t0 = _context2["catch"](5);
|
|
271
|
-
this.logWarning('loadProductForPriceQuery: 商品重查失败,使用入参 fallback', {
|
|
272
|
-
productId: productId,
|
|
273
|
-
error: _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0)
|
|
274
|
-
});
|
|
275
|
-
return _context2.abrupt("return", null);
|
|
276
|
-
case 19:
|
|
277
|
-
case "end":
|
|
278
|
-
return _context2.stop();
|
|
279
|
-
}
|
|
280
|
-
}, _callee2, this, [[5, 15]]);
|
|
281
|
-
}));
|
|
282
|
-
function loadProductForPriceQuery(_x2, _x3) {
|
|
283
|
-
return _loadProductForPriceQuery.apply(this, arguments);
|
|
284
|
-
}
|
|
285
|
-
return loadProductForPriceQuery;
|
|
286
|
-
}()
|
|
287
|
-
}, {
|
|
288
|
-
key: "getAuthoritativeBundleItems",
|
|
289
|
-
value: function getAuthoritativeBundleItems(product) {
|
|
290
|
-
if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product.product_bundle;
|
|
291
|
-
var groups = Array.isArray(product === null || product === void 0 ? void 0 : product.bundle_group) ? product.bundle_group : Array.isArray(product === null || product === void 0 ? void 0 : product.bundleGroup) ? product.bundleGroup : [];
|
|
292
|
-
return groups.flatMap(function (group) {
|
|
293
|
-
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
294
|
-
return items.map(function (item) {
|
|
295
|
-
var _item$group_id, _ref, _item$bundle_group_id;
|
|
296
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
297
|
-
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
298
|
-
bundle_group_id: (_ref = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref !== void 0 ? _ref : group === null || group === void 0 ? void 0 : group.id
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
}, {
|
|
304
|
-
key: "findAuthoritativeBundleItem",
|
|
305
|
-
value: function findAuthoritativeBundleItem(bundle, candidates) {
|
|
306
|
-
var _bundle$bundle_id, _bundle$bundle_produc, _bundle$bundle_group_;
|
|
307
|
-
var bundleId = (_bundle$bundle_id = bundle.bundle_id) !== null && _bundle$bundle_id !== void 0 ? _bundle$bundle_id : bundle.id;
|
|
308
|
-
if (bundleId != null) {
|
|
309
|
-
var matchedById = candidates.find(function (item) {
|
|
310
|
-
var _item$bundle_id;
|
|
311
|
-
return String((_item$bundle_id = item === null || item === void 0 ? void 0 : item.bundle_id) !== null && _item$bundle_id !== void 0 ? _item$bundle_id : item === null || item === void 0 ? void 0 : item.id) === String(bundleId);
|
|
312
|
-
});
|
|
313
|
-
if (matchedById) return matchedById;
|
|
314
|
-
}
|
|
315
|
-
var productId = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id;
|
|
316
|
-
var groupId = (_bundle$bundle_group_ = bundle.bundle_group_id) !== null && _bundle$bundle_group_ !== void 0 ? _bundle$bundle_group_ : bundle.group_id;
|
|
317
|
-
return candidates.find(function (item) {
|
|
318
|
-
var _item$bundle_product_, _item$bundle_group_id2;
|
|
319
|
-
var itemProductId = (_item$bundle_product_ = item === null || item === void 0 ? void 0 : item.bundle_product_id) !== null && _item$bundle_product_ !== void 0 ? _item$bundle_product_ : item === null || item === void 0 ? void 0 : item._bundle_product_id;
|
|
320
|
-
var itemGroupId = (_item$bundle_group_id2 = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id2 !== void 0 ? _item$bundle_group_id2 : item === null || item === void 0 ? void 0 : item.group_id;
|
|
321
|
-
if (productId == null || String(itemProductId) !== String(productId)) return false;
|
|
322
|
-
if (groupId == null) return true;
|
|
323
|
-
return String(itemGroupId) === String(groupId);
|
|
324
|
-
}) || null;
|
|
325
|
-
}
|
|
326
|
-
}, {
|
|
327
|
-
key: "getAuthoritativeBundleUnitPrice",
|
|
328
|
-
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
329
|
-
var _ref2, _ref3, _ref4, _bundle$price;
|
|
330
|
-
return (_ref2 = (_ref3 = (_ref4 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.custom_price) !== null && _ref3 !== void 0 ? _ref3 : bundle.product_price) !== null && _ref2 !== void 0 ? _ref2 : bundle.base_price;
|
|
331
|
-
}
|
|
332
|
-
}, {
|
|
333
|
-
key: "mergeProductForPriceQuery",
|
|
334
|
-
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
335
|
-
var _this2 = this,
|
|
336
|
-
_product$id,
|
|
337
|
-
_ref5,
|
|
338
|
-
_product$product_id2,
|
|
339
|
-
_ref6,
|
|
340
|
-
_product$product_vari,
|
|
341
|
-
_ref7,
|
|
342
|
-
_product$num,
|
|
343
|
-
_ref8,
|
|
344
|
-
_product$quantity,
|
|
345
|
-
_product$product_opti,
|
|
346
|
-
_product$metadata;
|
|
347
|
-
if (!authoritativeProduct) return product;
|
|
348
|
-
var selectedBundles = Array.isArray(product.product_bundle) ? product.product_bundle : [];
|
|
349
|
-
var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
|
|
350
|
-
var productBundle = selectedBundles.map(function (bundle) {
|
|
351
|
-
var _authoritativeBundle$, _authoritativeBundle$2;
|
|
352
|
-
var authoritativeBundle = _this2.findAuthoritativeBundleItem(bundle, authoritativeBundles);
|
|
353
|
-
var unitPrice = authoritativeBundle ? _this2.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
|
|
354
|
-
if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
|
|
355
|
-
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
356
|
-
price: unitPrice,
|
|
357
|
-
bundle_selling_price: unitPrice,
|
|
358
|
-
base_price: (_authoritativeBundle$ = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.base_price) !== null && _authoritativeBundle$ !== void 0 ? _authoritativeBundle$ : bundle.base_price,
|
|
359
|
-
product_price: (_authoritativeBundle$2 = authoritativeBundle === null || authoritativeBundle === void 0 ? void 0 : authoritativeBundle.product_price) !== null && _authoritativeBundle$2 !== void 0 ? _authoritativeBundle$2 : bundle.product_price
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
363
|
-
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
364
|
-
product_id: (_ref5 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref5 !== void 0 ? _ref5 : authoritativeProduct.id,
|
|
365
|
-
product_variant_id: (_ref6 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref6 !== void 0 ? _ref6 : 0,
|
|
366
|
-
num: (_ref7 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref7 !== void 0 ? _ref7 : authoritativeProduct.num,
|
|
367
|
-
quantity: (_ref8 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref8 !== void 0 ? _ref8 : authoritativeProduct.quantity,
|
|
368
|
-
product_option_item: (_product$product_opti = product.product_option_item) !== null && _product$product_opti !== void 0 ? _product$product_opti : authoritativeProduct.product_option_item,
|
|
369
|
-
product_bundle: productBundle,
|
|
370
|
-
metadata: (_product$metadata = product.metadata) !== null && _product$metadata !== void 0 ? _product$metadata : authoritativeProduct.metadata
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}, {
|
|
374
|
-
key: "getSubmitOrderSalesChannel",
|
|
375
|
-
value: function getSubmitOrderSalesChannel() {
|
|
376
|
-
var _this$otherParams3;
|
|
377
|
-
return (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel;
|
|
378
|
-
}
|
|
379
124
|
|
|
380
125
|
/**
|
|
381
126
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -385,9 +130,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
385
130
|
}, {
|
|
386
131
|
key: "createSubModule",
|
|
387
132
|
value: function createSubModule(moduleName) {
|
|
388
|
-
if (moduleName === 'quotation') {
|
|
389
|
-
return new QuotationModule("".concat(this.name, "_quotation"));
|
|
390
|
-
}
|
|
391
133
|
return createModule(moduleName, this.name);
|
|
392
134
|
}
|
|
393
135
|
}, {
|
|
@@ -421,124 +163,77 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
421
163
|
return {};
|
|
422
164
|
}
|
|
423
165
|
}
|
|
424
|
-
}, {
|
|
425
|
-
key: "getAppData",
|
|
426
|
-
value: function getAppData(key) {
|
|
427
|
-
var _this$appPlugin$getDa, _this$appPlugin, _app$models, _app$models$getStore, _app$models$getStore$, _app$models$getStore$2;
|
|
428
|
-
var getData = (_this$appPlugin$getDa = (_this$appPlugin = this.appPlugin).getData) === null || _this$appPlugin$getDa === void 0 ? void 0 : _this$appPlugin$getDa.call(_this$appPlugin);
|
|
429
|
-
if (typeof getData === 'function') return getData(key);
|
|
430
|
-
var app = this.appPlugin.getApp();
|
|
431
|
-
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');
|
|
432
|
-
return coreData === null || coreData === void 0 ? void 0 : coreData[key];
|
|
433
|
-
}
|
|
434
|
-
}, {
|
|
435
|
-
key: "syncAppDataToTempOrder",
|
|
436
|
-
value: function syncAppDataToTempOrder(tempOrder) {
|
|
437
|
-
var isPriceIncludeTax = this.getAppData('is_price_include_tax');
|
|
438
|
-
var taxCountryCode = this.getAppData('tax_country_code');
|
|
439
|
-
var currencyCode = this.getAppData('shop_currency_code');
|
|
440
|
-
var currencySymbol = this.getAppData('shop_symbol');
|
|
441
|
-
var isChanged = false;
|
|
442
|
-
if (isPriceIncludeTax !== undefined) {
|
|
443
|
-
var nextIsPriceIncludeTax = Number(isPriceIncludeTax);
|
|
444
|
-
if ((nextIsPriceIncludeTax === 0 || nextIsPriceIncludeTax === 1) && tempOrder.is_price_include_tax !== nextIsPriceIncludeTax) {
|
|
445
|
-
tempOrder.is_price_include_tax = nextIsPriceIncludeTax;
|
|
446
|
-
isChanged = true;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (taxCountryCode !== undefined) {
|
|
450
|
-
var nextTaxCountryCode = String(taxCountryCode || '');
|
|
451
|
-
if (tempOrder.tax_country_code !== nextTaxCountryCode) {
|
|
452
|
-
tempOrder.tax_country_code = nextTaxCountryCode;
|
|
453
|
-
isChanged = true;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
if (currencyCode !== undefined) {
|
|
457
|
-
var nextCurrencyCode = String(currencyCode || '');
|
|
458
|
-
if (tempOrder.currency_code !== nextCurrencyCode) {
|
|
459
|
-
tempOrder.currency_code = nextCurrencyCode;
|
|
460
|
-
isChanged = true;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
if (currencySymbol !== undefined) {
|
|
464
|
-
var nextCurrencySymbol = String(currencySymbol || '');
|
|
465
|
-
if (tempOrder.currency_symbol !== nextCurrencySymbol) {
|
|
466
|
-
tempOrder.currency_symbol = nextCurrencySymbol;
|
|
467
|
-
isChanged = true;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
return isChanged;
|
|
471
|
-
}
|
|
472
166
|
}, {
|
|
473
167
|
key: "initialize",
|
|
474
168
|
value: function () {
|
|
475
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
476
|
-
var _this$
|
|
477
|
-
|
|
169
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core) {
|
|
170
|
+
var _this$otherParams,
|
|
171
|
+
_this2 = this;
|
|
478
172
|
var options,
|
|
173
|
+
appPlugin,
|
|
479
174
|
app,
|
|
480
175
|
targetCacheData,
|
|
481
176
|
moduleNames,
|
|
482
|
-
|
|
483
|
-
return _regeneratorRuntime().wrap(function
|
|
484
|
-
while (1) switch (
|
|
177
|
+
_args = arguments;
|
|
178
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
179
|
+
while (1) switch (_context.prev = _context.next) {
|
|
485
180
|
case 0:
|
|
486
|
-
options =
|
|
181
|
+
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
487
182
|
this.core = core;
|
|
488
183
|
this.initializeOptions = options || {};
|
|
489
184
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
490
185
|
this.otherParams = options.otherParams || {};
|
|
491
|
-
this.cacheId = (_this$
|
|
186
|
+
this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
|
|
492
187
|
this.window = core.getPlugin('window');
|
|
493
188
|
this.request = core.getPlugin('request');
|
|
494
189
|
|
|
495
190
|
// 获取 logger 实例
|
|
496
|
-
|
|
497
|
-
if (
|
|
498
|
-
|
|
191
|
+
appPlugin = core.getPlugin('app');
|
|
192
|
+
if (appPlugin) {
|
|
193
|
+
_context.next = 10;
|
|
499
194
|
break;
|
|
500
195
|
}
|
|
501
196
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
502
197
|
case 10:
|
|
503
|
-
app =
|
|
198
|
+
app = appPlugin.getApp();
|
|
504
199
|
this.logger = app.logger;
|
|
505
200
|
targetCacheData = this.readSessionCacheData();
|
|
506
201
|
moduleNames = this.getRegisteredModuleNames();
|
|
507
202
|
moduleNames.forEach(function (step) {
|
|
508
|
-
var targetModule =
|
|
203
|
+
var targetModule = _this2.createSubModule(step);
|
|
509
204
|
if (!targetModule) {
|
|
510
205
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
511
206
|
}
|
|
512
|
-
var hooks =
|
|
513
|
-
|
|
514
|
-
|
|
207
|
+
var hooks = _this2.getSubModuleHooks(step);
|
|
208
|
+
_this2.store[step] = targetModule;
|
|
209
|
+
_this2.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
515
210
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
516
211
|
}, hooks ? {
|
|
517
212
|
hooks: hooks
|
|
518
213
|
} : {}), {}, {
|
|
519
|
-
otherParams: _objectSpread(_objectSpread({},
|
|
520
|
-
salesSummaryModuleName: "".concat(
|
|
521
|
-
fatherModule:
|
|
522
|
-
openCache:
|
|
523
|
-
cacheId:
|
|
214
|
+
otherParams: _objectSpread(_objectSpread({}, _this2.otherParams), {}, {
|
|
215
|
+
salesSummaryModuleName: "".concat(_this2.name, "_salesSummary"),
|
|
216
|
+
fatherModule: _this2.name,
|
|
217
|
+
openCache: _this2.cacheId ? true : false,
|
|
218
|
+
cacheId: _this2.cacheId
|
|
524
219
|
})
|
|
525
220
|
}));
|
|
526
221
|
});
|
|
527
222
|
if (!this.store.schedule) {
|
|
528
|
-
|
|
223
|
+
_context.next = 18;
|
|
529
224
|
break;
|
|
530
225
|
}
|
|
531
|
-
|
|
226
|
+
_context.next = 18;
|
|
532
227
|
return this.store.schedule.loadAllSchedule();
|
|
533
228
|
case 18:
|
|
534
229
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
535
230
|
case 19:
|
|
536
231
|
case "end":
|
|
537
|
-
return
|
|
232
|
+
return _context.stop();
|
|
538
233
|
}
|
|
539
|
-
},
|
|
234
|
+
}, _callee, this);
|
|
540
235
|
}));
|
|
541
|
-
function initialize(
|
|
236
|
+
function initialize(_x) {
|
|
542
237
|
return _initialize.apply(this, arguments);
|
|
543
238
|
}
|
|
544
239
|
return initialize;
|
|
@@ -546,13 +241,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
546
241
|
}, {
|
|
547
242
|
key: "destroy",
|
|
548
243
|
value: function () {
|
|
549
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
550
|
-
var
|
|
551
|
-
return _regeneratorRuntime().wrap(function
|
|
552
|
-
while (1) switch (
|
|
244
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
245
|
+
var _this3 = this;
|
|
246
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
247
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
553
248
|
case 0:
|
|
554
249
|
Object.keys(this.store).forEach(function (key) {
|
|
555
|
-
var sub =
|
|
250
|
+
var sub = _this3.store[key];
|
|
556
251
|
if (sub && typeof sub.destroy === 'function') {
|
|
557
252
|
try {
|
|
558
253
|
sub.destroy();
|
|
@@ -562,15 +257,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
562
257
|
}
|
|
563
258
|
});
|
|
564
259
|
this.currentSalesDetail = null;
|
|
565
|
-
|
|
260
|
+
_context2.next = 4;
|
|
566
261
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
567
262
|
case 4:
|
|
568
263
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
569
264
|
case 5:
|
|
570
265
|
case "end":
|
|
571
|
-
return
|
|
266
|
+
return _context2.stop();
|
|
572
267
|
}
|
|
573
|
-
},
|
|
268
|
+
}, _callee2, this);
|
|
574
269
|
}));
|
|
575
270
|
function destroy() {
|
|
576
271
|
return _destroy.apply(this, arguments);
|
|
@@ -587,13 +282,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
587
282
|
}, {
|
|
588
283
|
key: "loadSalesDetail",
|
|
589
284
|
value: (function () {
|
|
590
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
285
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(orderIdOrParams) {
|
|
591
286
|
var params, externalSaleNumber, localRecord, _sales, res, message, sales;
|
|
592
|
-
return _regeneratorRuntime().wrap(function
|
|
593
|
-
while (1) switch (
|
|
287
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
288
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
594
289
|
case 0:
|
|
595
290
|
if (this.store.order) {
|
|
596
|
-
|
|
291
|
+
_context3.next = 2;
|
|
597
292
|
break;
|
|
598
293
|
}
|
|
599
294
|
throw new Error('order 模块未初始化');
|
|
@@ -603,107 +298,107 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
603
298
|
};
|
|
604
299
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
605
300
|
if (params.forceRemote) {
|
|
606
|
-
|
|
301
|
+
_context3.next = 35;
|
|
607
302
|
break;
|
|
608
303
|
}
|
|
609
304
|
if (!(params.orderId !== undefined)) {
|
|
610
|
-
|
|
305
|
+
_context3.next = 11;
|
|
611
306
|
break;
|
|
612
307
|
}
|
|
613
|
-
|
|
308
|
+
_context3.next = 8;
|
|
614
309
|
return this.store.order.getLocalOrderByOrderId(params.orderId);
|
|
615
310
|
case 8:
|
|
616
|
-
|
|
617
|
-
|
|
311
|
+
_context3.t0 = _context3.sent;
|
|
312
|
+
_context3.next = 26;
|
|
618
313
|
break;
|
|
619
314
|
case 11:
|
|
620
315
|
if (!externalSaleNumber) {
|
|
621
|
-
|
|
316
|
+
_context3.next = 17;
|
|
622
317
|
break;
|
|
623
318
|
}
|
|
624
|
-
|
|
319
|
+
_context3.next = 14;
|
|
625
320
|
return this.store.order.getLocalOrderByExternalSaleNumber(externalSaleNumber);
|
|
626
321
|
case 14:
|
|
627
|
-
|
|
628
|
-
|
|
322
|
+
_context3.t1 = _context3.sent;
|
|
323
|
+
_context3.next = 25;
|
|
629
324
|
break;
|
|
630
325
|
case 17:
|
|
631
326
|
if (!params.orderNumber) {
|
|
632
|
-
|
|
327
|
+
_context3.next = 23;
|
|
633
328
|
break;
|
|
634
329
|
}
|
|
635
|
-
|
|
330
|
+
_context3.next = 20;
|
|
636
331
|
return this.store.order.getLocalOrderByOrderNumber(params.orderNumber);
|
|
637
332
|
case 20:
|
|
638
|
-
|
|
639
|
-
|
|
333
|
+
_context3.t2 = _context3.sent;
|
|
334
|
+
_context3.next = 24;
|
|
640
335
|
break;
|
|
641
336
|
case 23:
|
|
642
|
-
|
|
337
|
+
_context3.t2 = null;
|
|
643
338
|
case 24:
|
|
644
|
-
|
|
339
|
+
_context3.t1 = _context3.t2;
|
|
645
340
|
case 25:
|
|
646
|
-
|
|
341
|
+
_context3.t0 = _context3.t1;
|
|
647
342
|
case 26:
|
|
648
|
-
localRecord =
|
|
343
|
+
localRecord = _context3.t0;
|
|
649
344
|
if (!localRecord) {
|
|
650
|
-
|
|
345
|
+
_context3.next = 35;
|
|
651
346
|
break;
|
|
652
347
|
}
|
|
653
|
-
|
|
348
|
+
_context3.next = 30;
|
|
654
349
|
return this.store.order.hydrateTempOrderFromRecord(localRecord, {
|
|
655
350
|
recalcOnHydrate: false
|
|
656
351
|
});
|
|
657
352
|
case 30:
|
|
658
|
-
_sales =
|
|
353
|
+
_sales = _context3.sent;
|
|
659
354
|
this.currentSalesDetail = _sales;
|
|
660
|
-
|
|
355
|
+
_context3.next = 34;
|
|
661
356
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
662
357
|
sales: _sales
|
|
663
358
|
});
|
|
664
359
|
case 34:
|
|
665
|
-
return
|
|
360
|
+
return _context3.abrupt("return", _sales);
|
|
666
361
|
case 35:
|
|
667
362
|
if (!(params.orderId === undefined || params.orderId === null)) {
|
|
668
|
-
|
|
363
|
+
_context3.next = 37;
|
|
669
364
|
break;
|
|
670
365
|
}
|
|
671
366
|
throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
|
|
672
367
|
case 37:
|
|
673
|
-
|
|
368
|
+
_context3.next = 39;
|
|
674
369
|
return this.store.order.getOrderInfoByRemote(Number(params.orderId));
|
|
675
370
|
case 39:
|
|
676
|
-
res =
|
|
371
|
+
res = _context3.sent;
|
|
677
372
|
if (!(!res || res.code !== 200)) {
|
|
678
|
-
|
|
373
|
+
_context3.next = 43;
|
|
679
374
|
break;
|
|
680
375
|
}
|
|
681
376
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
|
|
682
377
|
throw new Error(message);
|
|
683
378
|
case 43:
|
|
684
|
-
|
|
379
|
+
_context3.next = 45;
|
|
685
380
|
return this.store.order.hydrateTempOrderFromRecord(res.data, {
|
|
686
381
|
recalcOnHydrate: false
|
|
687
382
|
});
|
|
688
383
|
case 45:
|
|
689
|
-
sales =
|
|
690
|
-
|
|
384
|
+
sales = _context3.sent;
|
|
385
|
+
_context3.next = 48;
|
|
691
386
|
return this.store.order.saveDraft();
|
|
692
387
|
case 48:
|
|
693
388
|
this.currentSalesDetail = sales;
|
|
694
|
-
|
|
389
|
+
_context3.next = 51;
|
|
695
390
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
696
391
|
sales: sales
|
|
697
392
|
});
|
|
698
393
|
case 51:
|
|
699
|
-
return
|
|
394
|
+
return _context3.abrupt("return", sales);
|
|
700
395
|
case 52:
|
|
701
396
|
case "end":
|
|
702
|
-
return
|
|
397
|
+
return _context3.stop();
|
|
703
398
|
}
|
|
704
|
-
},
|
|
399
|
+
}, _callee3, this);
|
|
705
400
|
}));
|
|
706
|
-
function loadSalesDetail(
|
|
401
|
+
function loadSalesDetail(_x2) {
|
|
707
402
|
return _loadSalesDetail.apply(this, arguments);
|
|
708
403
|
}
|
|
709
404
|
return loadSalesDetail;
|
|
@@ -776,45 +471,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
776
471
|
}, {
|
|
777
472
|
key: "getTempOrder",
|
|
778
473
|
value: function getTempOrder() {
|
|
779
|
-
var _this$store$
|
|
780
|
-
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;
|
|
781
476
|
return result;
|
|
782
477
|
}
|
|
783
|
-
}, {
|
|
784
|
-
key: "replaceTempOrder",
|
|
785
|
-
value: function () {
|
|
786
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(tempOrder) {
|
|
787
|
-
var nextTempOrder;
|
|
788
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
789
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
790
|
-
case 0:
|
|
791
|
-
if (this.store.order) {
|
|
792
|
-
_context6.next = 2;
|
|
793
|
-
break;
|
|
794
|
-
}
|
|
795
|
-
throw new Error('order 模块未初始化');
|
|
796
|
-
case 2:
|
|
797
|
-
_context6.next = 4;
|
|
798
|
-
return this.store.order.replaceTempOrder(tempOrder);
|
|
799
|
-
case 4:
|
|
800
|
-
nextTempOrder = _context6.sent;
|
|
801
|
-
_context6.next = 7;
|
|
802
|
-
return this.effectsEmit('onTempOrderReplaced', {
|
|
803
|
-
tempOrder: nextTempOrder
|
|
804
|
-
});
|
|
805
|
-
case 7:
|
|
806
|
-
return _context6.abrupt("return", nextTempOrder);
|
|
807
|
-
case 8:
|
|
808
|
-
case "end":
|
|
809
|
-
return _context6.stop();
|
|
810
|
-
}
|
|
811
|
-
}, _callee6, this);
|
|
812
|
-
}));
|
|
813
|
-
function replaceTempOrder(_x6) {
|
|
814
|
-
return _replaceTempOrder.apply(this, arguments);
|
|
815
|
-
}
|
|
816
|
-
return replaceTempOrder;
|
|
817
|
-
}()
|
|
818
478
|
}, {
|
|
819
479
|
key: "getOrderIdentity",
|
|
820
480
|
value: function getOrderIdentity() {
|
|
@@ -848,21 +508,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
848
508
|
}, {
|
|
849
509
|
key: "updateTempOrderNote",
|
|
850
510
|
value: function updateTempOrderNote(note) {
|
|
851
|
-
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
852
511
|
try {
|
|
853
512
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
854
|
-
var result = this.store.order.updateTempOrderNote(note
|
|
513
|
+
var result = this.store.order.updateTempOrderNote(note);
|
|
855
514
|
return result;
|
|
856
515
|
} catch (error) {
|
|
857
516
|
throw error;
|
|
858
517
|
}
|
|
859
518
|
}
|
|
860
|
-
}, {
|
|
861
|
-
key: "updateRemoteOrderNote",
|
|
862
|
-
value: function updateRemoteOrderNote(orderId, note) {
|
|
863
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
864
|
-
this.store.order.syncTempOrderNoteToRemote(orderId, note);
|
|
865
|
-
}
|
|
866
519
|
}, {
|
|
867
520
|
key: "updateTempOrderShopDiscount",
|
|
868
521
|
value: function updateTempOrderShopDiscount(amount) {
|
|
@@ -875,22 +528,6 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
875
528
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
876
529
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
877
530
|
}
|
|
878
|
-
|
|
879
|
-
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
880
|
-
}, {
|
|
881
|
-
key: "setEnableTempOrderPersist",
|
|
882
|
-
value: function setEnableTempOrderPersist(enabled) {
|
|
883
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
884
|
-
this.store.order.setEnableTempOrderPersist(enabled);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
/** @deprecated OrderModule 不再负责 tempOrder localStorage 持久化。 */
|
|
888
|
-
}, {
|
|
889
|
-
key: "isTempOrderPersistEnabled",
|
|
890
|
-
value: function isTempOrderPersistEnabled() {
|
|
891
|
-
if (!this.store.order) return false;
|
|
892
|
-
return this.store.order.isTempOrderPersistEnabled();
|
|
893
|
-
}
|
|
894
531
|
}, {
|
|
895
532
|
key: "ensureTempOrder",
|
|
896
533
|
value: function ensureTempOrder() {
|
|
@@ -902,40 +539,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
902
539
|
}, {
|
|
903
540
|
key: "addNewOrder",
|
|
904
541
|
value: function () {
|
|
905
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
542
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
906
543
|
var tempOrder;
|
|
907
|
-
return _regeneratorRuntime().wrap(function
|
|
908
|
-
while (1) switch (
|
|
544
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
545
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
909
546
|
case 0:
|
|
910
|
-
|
|
547
|
+
_context4.prev = 0;
|
|
911
548
|
if (this.store.order) {
|
|
912
|
-
|
|
549
|
+
_context4.next = 3;
|
|
913
550
|
break;
|
|
914
551
|
}
|
|
915
552
|
throw new Error('order 模块未初始化');
|
|
916
553
|
case 3:
|
|
917
|
-
|
|
554
|
+
_context4.next = 5;
|
|
918
555
|
return this.store.order.addNewOrder();
|
|
919
556
|
case 5:
|
|
920
|
-
tempOrder =
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
return this.store.order.saveDraft();
|
|
928
|
-
case 10:
|
|
929
|
-
return _context7.abrupt("return", tempOrder);
|
|
930
|
-
case 13:
|
|
931
|
-
_context7.prev = 13;
|
|
932
|
-
_context7.t0 = _context7["catch"](0);
|
|
933
|
-
throw _context7.t0;
|
|
934
|
-
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:
|
|
935
564
|
case "end":
|
|
936
|
-
return
|
|
565
|
+
return _context4.stop();
|
|
937
566
|
}
|
|
938
|
-
},
|
|
567
|
+
}, _callee4, this, [[0, 9]]);
|
|
939
568
|
}));
|
|
940
569
|
function addNewOrder() {
|
|
941
570
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -945,22 +574,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
945
574
|
}, {
|
|
946
575
|
key: "saveDraft",
|
|
947
576
|
value: function () {
|
|
948
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
949
|
-
return _regeneratorRuntime().wrap(function
|
|
950
|
-
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) {
|
|
951
580
|
case 0:
|
|
952
581
|
if (this.store.order) {
|
|
953
|
-
|
|
582
|
+
_context5.next = 2;
|
|
954
583
|
break;
|
|
955
584
|
}
|
|
956
585
|
throw new Error('order 模块未初始化');
|
|
957
586
|
case 2:
|
|
958
|
-
return
|
|
587
|
+
return _context5.abrupt("return", this.store.order.saveDraft());
|
|
959
588
|
case 3:
|
|
960
589
|
case "end":
|
|
961
|
-
return
|
|
590
|
+
return _context5.stop();
|
|
962
591
|
}
|
|
963
|
-
},
|
|
592
|
+
}, _callee5, this);
|
|
964
593
|
}));
|
|
965
594
|
function saveDraft() {
|
|
966
595
|
return _saveDraft.apply(this, arguments);
|
|
@@ -971,113 +600,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
971
600
|
}, {
|
|
972
601
|
key: "restoreOrder",
|
|
973
602
|
value: function () {
|
|
974
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
603
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
975
604
|
var tempOrder;
|
|
976
|
-
return _regeneratorRuntime().wrap(function
|
|
977
|
-
while (1) switch (
|
|
605
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
606
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
978
607
|
case 0:
|
|
979
|
-
|
|
608
|
+
_context6.prev = 0;
|
|
980
609
|
if (this.store.order) {
|
|
981
|
-
|
|
610
|
+
_context6.next = 3;
|
|
982
611
|
break;
|
|
983
612
|
}
|
|
984
613
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
985
614
|
case 3:
|
|
986
615
|
// this.store.resource = null;
|
|
987
616
|
tempOrder = this.store.order.restoreOrder();
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
});
|
|
995
|
-
case 9:
|
|
996
|
-
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
997
|
-
_context9.next = 13;
|
|
998
|
-
break;
|
|
999
|
-
}
|
|
1000
|
-
this.store.order.persistTempOrder();
|
|
1001
|
-
_context9.next = 13;
|
|
1002
|
-
return this.store.order.saveDraft();
|
|
1003
|
-
case 13:
|
|
1004
|
-
return _context9.abrupt("return", tempOrder);
|
|
1005
|
-
case 16:
|
|
1006
|
-
_context9.prev = 16;
|
|
1007
|
-
_context9.t0 = _context9["catch"](0);
|
|
1008
|
-
throw _context9.t0;
|
|
1009
|
-
case 19:
|
|
617
|
+
return _context6.abrupt("return", tempOrder);
|
|
618
|
+
case 7:
|
|
619
|
+
_context6.prev = 7;
|
|
620
|
+
_context6.t0 = _context6["catch"](0);
|
|
621
|
+
throw _context6.t0;
|
|
622
|
+
case 10:
|
|
1010
623
|
case "end":
|
|
1011
|
-
return
|
|
624
|
+
return _context6.stop();
|
|
1012
625
|
}
|
|
1013
|
-
},
|
|
626
|
+
}, _callee6, this, [[0, 7]]);
|
|
1014
627
|
}));
|
|
1015
628
|
function restoreOrder() {
|
|
1016
629
|
return _restoreOrder.apply(this, arguments);
|
|
1017
630
|
}
|
|
1018
631
|
return restoreOrder;
|
|
1019
632
|
}()
|
|
1020
|
-
/**
|
|
1021
|
-
* 仅清空 tempOrder 购物车行(products / bookings / discount_list)。
|
|
1022
|
-
* 同步清空内存中的 salesDetail 商品/预约视图,避免编辑态仍读到旧 bookings。
|
|
1023
|
-
*/
|
|
1024
|
-
}, {
|
|
1025
|
-
key: "clearOrderCartLines",
|
|
1026
|
-
value: (function () {
|
|
1027
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1028
|
-
var tempOrder;
|
|
1029
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1030
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
1031
|
-
case 0:
|
|
1032
|
-
_context10.prev = 0;
|
|
1033
|
-
if (this.store.order) {
|
|
1034
|
-
_context10.next = 3;
|
|
1035
|
-
break;
|
|
1036
|
-
}
|
|
1037
|
-
throw new Error('order 模块未初始化');
|
|
1038
|
-
case 3:
|
|
1039
|
-
_context10.next = 5;
|
|
1040
|
-
return this.store.order.clearOrderCartLines();
|
|
1041
|
-
case 5:
|
|
1042
|
-
tempOrder = _context10.sent;
|
|
1043
|
-
if (this.currentSalesDetail) {
|
|
1044
|
-
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
1045
|
-
products: [],
|
|
1046
|
-
bookings: [],
|
|
1047
|
-
rootBooking: null,
|
|
1048
|
-
bookingsByProductUid: {},
|
|
1049
|
-
discount_list: []
|
|
1050
|
-
});
|
|
1051
|
-
}
|
|
1052
|
-
_context10.next = 9;
|
|
1053
|
-
return this.effectsEmit('onTempOrderReplaced', {
|
|
1054
|
-
tempOrder: tempOrder
|
|
1055
|
-
});
|
|
1056
|
-
case 9:
|
|
1057
|
-
if (!this.syncAppDataToTempOrder(tempOrder)) {
|
|
1058
|
-
_context10.next = 13;
|
|
1059
|
-
break;
|
|
1060
|
-
}
|
|
1061
|
-
this.store.order.persistTempOrder();
|
|
1062
|
-
_context10.next = 13;
|
|
1063
|
-
return this.store.order.saveDraft();
|
|
1064
|
-
case 13:
|
|
1065
|
-
return _context10.abrupt("return", tempOrder);
|
|
1066
|
-
case 16:
|
|
1067
|
-
_context10.prev = 16;
|
|
1068
|
-
_context10.t0 = _context10["catch"](0);
|
|
1069
|
-
throw _context10.t0;
|
|
1070
|
-
case 19:
|
|
1071
|
-
case "end":
|
|
1072
|
-
return _context10.stop();
|
|
1073
|
-
}
|
|
1074
|
-
}, _callee10, this, [[0, 16]]);
|
|
1075
|
-
}));
|
|
1076
|
-
function clearOrderCartLines() {
|
|
1077
|
-
return _clearOrderCartLines.apply(this, arguments);
|
|
1078
|
-
}
|
|
1079
|
-
return clearOrderCartLines;
|
|
1080
|
-
}())
|
|
1081
633
|
}, {
|
|
1082
634
|
key: "getOrderProducts",
|
|
1083
635
|
value: function getOrderProducts() {
|
|
@@ -1088,384 +640,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1088
640
|
}, {
|
|
1089
641
|
key: "getSummary",
|
|
1090
642
|
value: function () {
|
|
1091
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
643
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1092
644
|
var summary;
|
|
1093
|
-
return _regeneratorRuntime().wrap(function
|
|
1094
|
-
while (1) switch (
|
|
1095
|
-
case 0:
|
|
1096
|
-
|
|
1097
|
-
if (this.store.order) {
|
|
1098
|
-
|
|
1099
|
-
break;
|
|
1100
|
-
}
|
|
1101
|
-
throw new Error('order 模块未初始化');
|
|
1102
|
-
case 3:
|
|
1103
|
-
|
|
1104
|
-
return this.store.order.getOrderSummary();
|
|
1105
|
-
case 5:
|
|
1106
|
-
summary =
|
|
1107
|
-
return
|
|
1108
|
-
case 9:
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
throw
|
|
1112
|
-
case 12:
|
|
1113
|
-
case "end":
|
|
1114
|
-
return _context11.stop();
|
|
1115
|
-
}
|
|
1116
|
-
}, _callee11, this, [[0, 9]]);
|
|
1117
|
-
}));
|
|
1118
|
-
function getSummary() {
|
|
1119
|
-
return _getSummary.apply(this, arguments);
|
|
1120
|
-
}
|
|
1121
|
-
return getSummary;
|
|
1122
|
-
}()
|
|
1123
|
-
}, {
|
|
1124
|
-
key: "getHistoricalProductDiscountList",
|
|
1125
|
-
value: function getHistoricalProductDiscountList(products) {
|
|
1126
|
-
var _this5 = this;
|
|
1127
|
-
var historyDiscountList = [];
|
|
1128
|
-
products.forEach(function (item) {
|
|
1129
|
-
if (!_this5.isPersistedOrderProduct(item)) return;
|
|
1130
|
-
(item.discount_list || []).forEach(function (discount) {
|
|
1131
|
-
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1132
|
-
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
1133
|
-
if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
|
|
1134
|
-
var quantity = item.quantity || item.num || item.product_quantity || 1;
|
|
1135
|
-
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);
|
|
1136
|
-
var index = historyDiscountList.findIndex(function (n) {
|
|
1137
|
-
return n.id === discountId;
|
|
1138
|
-
});
|
|
1139
|
-
if (index !== -1) {
|
|
1140
|
-
historyDiscountList[index] = _objectSpread(_objectSpread({}, historyDiscountList[index]), {}, {
|
|
1141
|
-
amount: new Decimal(historyDiscountList[index].amount || 0).plus(discount.amount || 0).toNumber(),
|
|
1142
|
-
savedAmount: savedAmount.plus(historyDiscountList[index].savedAmount || 0).toNumber()
|
|
1143
|
-
});
|
|
1144
|
-
return;
|
|
1145
|
-
}
|
|
1146
|
-
historyDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
1147
|
-
id: discountId,
|
|
1148
|
-
tag: discount.tag || discount.type,
|
|
1149
|
-
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),
|
|
1150
|
-
format_title: ((_discount$discount3 = discount.discount) === null || _discount$discount3 === void 0 ? void 0 : _discount$discount3.title) || discount.format_title,
|
|
1151
|
-
isEditMode: true,
|
|
1152
|
-
limited_relation_product_data: {},
|
|
1153
|
-
savedAmount: savedAmount.toNumber(),
|
|
1154
|
-
isAvailable: true,
|
|
1155
|
-
isDisabled: true,
|
|
1156
|
-
isSelected: true,
|
|
1157
|
-
product_id: ((_discount$discount4 = discount.discount) === null || _discount$discount4 === void 0 ? void 0 : _discount$discount4.product_id) || discount.product_id
|
|
1158
|
-
}));
|
|
1159
|
-
});
|
|
1160
|
-
});
|
|
1161
|
-
return historyDiscountList;
|
|
1162
|
-
}
|
|
1163
|
-
}, {
|
|
1164
|
-
key: "isPersistedOrderProduct",
|
|
1165
|
-
value: function isPersistedOrderProduct(product) {
|
|
1166
|
-
var _product$order_detail, _product$booking_id;
|
|
1167
|
-
var orderDetailId = (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product.orderDetailId;
|
|
1168
|
-
if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
|
|
1169
|
-
return true;
|
|
1170
|
-
}
|
|
1171
|
-
var bookingId = (_product$booking_id = product.booking_id) !== null && _product$booking_id !== void 0 ? _product$booking_id : product.bookingId;
|
|
1172
|
-
return bookingId !== undefined && bookingId !== null && bookingId !== '';
|
|
1173
|
-
}
|
|
1174
|
-
}, {
|
|
1175
|
-
key: "mergeHistoricalDiscountList",
|
|
1176
|
-
value: function mergeHistoricalDiscountList(discountList, products) {
|
|
1177
|
-
var historyDiscountList = this.getHistoricalProductDiscountList(products);
|
|
1178
|
-
var historyIds = new Set(historyDiscountList.map(function (discount) {
|
|
1179
|
-
return discount.id;
|
|
1180
|
-
}));
|
|
1181
|
-
return [].concat(_toConsumableArray(historyDiscountList), _toConsumableArray((discountList || []).filter(function (discount) {
|
|
1182
|
-
return !historyIds.has(discount.id);
|
|
1183
|
-
})));
|
|
1184
|
-
}
|
|
1185
|
-
}, {
|
|
1186
|
-
key: "mergeCurrentDiscountSelectionState",
|
|
1187
|
-
value: function mergeCurrentDiscountSelectionState(discountList, currentDiscountList) {
|
|
1188
|
-
if (!currentDiscountList.length) return discountList;
|
|
1189
|
-
var currentDiscountMap = new Map(currentDiscountList.map(function (discount) {
|
|
1190
|
-
return [discount.id, discount];
|
|
1191
|
-
}));
|
|
1192
|
-
return discountList.map(function (discount) {
|
|
1193
|
-
var currentDiscount = currentDiscountMap.get(discount.id);
|
|
1194
|
-
if (!currentDiscount) return discount;
|
|
1195
|
-
if (currentDiscount.isManualSelect) {
|
|
1196
|
-
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1197
|
-
isSelected: false,
|
|
1198
|
-
isManualSelect: true
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
if (currentDiscount.isSelected) {
|
|
1202
|
-
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
1203
|
-
isSelected: true,
|
|
1204
|
-
isManualSelect: false
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
return discount;
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
}, {
|
|
1211
|
-
key: "loadDiscountConfig",
|
|
1212
|
-
value: function () {
|
|
1213
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
1214
|
-
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1215
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, _tempOrder$holder, _tempOrder$holder2, _orderStore$summary, holders, result, _iterator, _step, _product$metadata2, _tempOrder$_extend3, _product$metadata3, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1216
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1217
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
1218
|
-
case 0:
|
|
1219
|
-
if (this.store.order) {
|
|
1220
|
-
_context12.next = 2;
|
|
1221
|
-
break;
|
|
1222
|
-
}
|
|
1223
|
-
throw new Error('order 模块未初始化');
|
|
1224
|
-
case 2:
|
|
1225
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
1226
|
-
orderStore = this.store.order.store || {};
|
|
1227
|
-
discountModule = orderStore.discount;
|
|
1228
|
-
rulesModule = orderStore.rules;
|
|
1229
|
-
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);
|
|
1230
|
-
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);
|
|
1231
|
-
currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
|
|
1232
|
-
originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
|
|
1233
|
-
hasManualDiscountSelection = this.hasManualDiscountSelection || currentDiscountList.some(function (discount) {
|
|
1234
|
-
return discount.isManualSelect;
|
|
1235
|
-
});
|
|
1236
|
-
discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
|
|
1237
|
-
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
1238
|
-
preparedDiscountList = [];
|
|
1239
|
-
if (!(customerId && customerId !== 1)) {
|
|
1240
|
-
_context12.next = 25;
|
|
1241
|
-
break;
|
|
1242
|
-
}
|
|
1243
|
-
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
1244
|
-
_context12.next = 19;
|
|
1245
|
-
break;
|
|
1246
|
-
}
|
|
1247
|
-
preparedDiscountList = originalDiscountList;
|
|
1248
|
-
_context12.next = 25;
|
|
1249
|
-
break;
|
|
1250
|
-
case 19:
|
|
1251
|
-
_context12.next = 21;
|
|
1252
|
-
return this.store.order.loadDiscountConfig({
|
|
1253
|
-
customerId: customerId,
|
|
1254
|
-
action: discountAction,
|
|
1255
|
-
orderId: Number(orderId) || undefined,
|
|
1256
|
-
apply: false
|
|
1257
|
-
});
|
|
1258
|
-
case 21:
|
|
1259
|
-
preparedDiscountList = _context12.sent;
|
|
1260
|
-
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
1261
|
-
_context12.next = 25;
|
|
1262
|
-
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1263
|
-
case 25:
|
|
1264
|
-
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
1265
|
-
_context12.next = 27;
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
return _context12.abrupt("return", {
|
|
1269
|
-
productList: tempOrder.products || [],
|
|
1270
|
-
discountList: currentDiscountList
|
|
1271
|
-
});
|
|
1272
|
-
case 27:
|
|
1273
|
-
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
1274
|
-
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
1275
|
-
_context12.next = 31;
|
|
1276
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1277
|
-
case 31:
|
|
1278
|
-
if (!rulesModule) {
|
|
1279
|
-
_context12.next = 67;
|
|
1280
|
-
break;
|
|
1281
|
-
}
|
|
1282
|
-
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1283
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1284
|
-
}] : [];
|
|
1285
|
-
result = rulesModule.calcDiscount({
|
|
1286
|
-
productList: tempOrder.products,
|
|
1287
|
-
discountList: nextDiscountList,
|
|
1288
|
-
holders: holders,
|
|
1289
|
-
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form',
|
|
1290
|
-
orderTotalAmount: Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0)
|
|
1291
|
-
}) || {
|
|
1292
|
-
productList: tempOrder.products,
|
|
1293
|
-
discountList: nextDiscountList
|
|
1294
|
-
};
|
|
1295
|
-
if (result.productList) {
|
|
1296
|
-
tempOrder.products = result.productList;
|
|
1297
|
-
}
|
|
1298
|
-
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1299
|
-
_context12.prev = 36;
|
|
1300
|
-
_iterator.s();
|
|
1301
|
-
case 38:
|
|
1302
|
-
if ((_step = _iterator.n()).done) {
|
|
1303
|
-
_context12.next = 53;
|
|
1304
|
-
break;
|
|
1305
|
-
}
|
|
1306
|
-
product = _step.value;
|
|
1307
|
-
productUid = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number;
|
|
1308
|
-
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
1309
|
-
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.is_manual_discount)) {
|
|
1310
|
-
_context12.next = 44;
|
|
1311
|
-
break;
|
|
1312
|
-
}
|
|
1313
|
-
return _context12.abrupt("continue", 51);
|
|
1314
|
-
case 44:
|
|
1315
|
-
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1316
|
-
return sum + Number(pd.amount || 0);
|
|
1317
|
-
}, 0);
|
|
1318
|
-
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
1319
|
-
sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1320
|
-
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1321
|
-
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1322
|
-
if (product.metadata) {
|
|
1323
|
-
product.metadata.main_product_selling_price = newMainSellingPrice;
|
|
1324
|
-
product.metadata.price_schema_version = 2;
|
|
1325
|
-
}
|
|
1326
|
-
product.selling_price = composeLinePrice({
|
|
1327
|
-
mainPrice: newMainSellingPrice,
|
|
1328
|
-
bundle: product.product_bundle
|
|
1329
|
-
});
|
|
1330
|
-
case 51:
|
|
1331
|
-
_context12.next = 38;
|
|
1332
|
-
break;
|
|
1333
|
-
case 53:
|
|
1334
|
-
_context12.next = 58;
|
|
1335
|
-
break;
|
|
1336
|
-
case 55:
|
|
1337
|
-
_context12.prev = 55;
|
|
1338
|
-
_context12.t0 = _context12["catch"](36);
|
|
1339
|
-
_iterator.e(_context12.t0);
|
|
1340
|
-
case 58:
|
|
1341
|
-
_context12.prev = 58;
|
|
1342
|
-
_iterator.f();
|
|
1343
|
-
return _context12.finish(58);
|
|
1344
|
-
case 61:
|
|
1345
|
-
if (!result.discountList) {
|
|
1346
|
-
_context12.next = 67;
|
|
1347
|
-
break;
|
|
1348
|
-
}
|
|
1349
|
-
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1350
|
-
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1351
|
-
_context12.next = 66;
|
|
1352
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1353
|
-
case 66:
|
|
1354
|
-
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1355
|
-
return discount.isSelected;
|
|
1356
|
-
});
|
|
1357
|
-
case 67:
|
|
1358
|
-
_context12.next = 69;
|
|
1359
|
-
return this.store.order.recalculateSummary({
|
|
1360
|
-
createIfMissing: true
|
|
1361
|
-
});
|
|
1362
|
-
case 69:
|
|
1363
|
-
summary = _context12.sent;
|
|
1364
|
-
this.store.order.persistTempOrder();
|
|
1365
|
-
_context12.next = 73;
|
|
1366
|
-
return this.effectsEmit('onDiscountApplied', {
|
|
1367
|
-
productList: tempOrder.products || [],
|
|
1368
|
-
discountList: nextDiscountList,
|
|
1369
|
-
selectedDiscountList: tempOrder.discount_list || [],
|
|
1370
|
-
tempOrder: tempOrder
|
|
1371
|
-
});
|
|
1372
|
-
case 73:
|
|
1373
|
-
return _context12.abrupt("return", {
|
|
1374
|
-
productList: tempOrder.products || [],
|
|
1375
|
-
discountList: nextDiscountList
|
|
1376
|
-
});
|
|
1377
|
-
case 74:
|
|
1378
|
-
case "end":
|
|
1379
|
-
return _context12.stop();
|
|
1380
|
-
}
|
|
1381
|
-
}, _callee12, this, [[36, 55, 58, 61]]);
|
|
1382
|
-
}));
|
|
1383
|
-
function loadDiscountConfig(_x7) {
|
|
1384
|
-
return _loadDiscountConfig.apply(this, arguments);
|
|
1385
|
-
}
|
|
1386
|
-
return loadDiscountConfig;
|
|
1387
|
-
}()
|
|
1388
|
-
}, {
|
|
1389
|
-
key: "bestDiscount",
|
|
1390
|
-
value: function () {
|
|
1391
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(cb) {
|
|
1392
|
-
var _discountModule$getOr2, _discountModule$getDi3;
|
|
1393
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder3, _tempOrder$holder4, _orderStore$summary2, holders;
|
|
1394
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1395
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
1396
|
-
case 0:
|
|
1397
|
-
if (this.store.order) {
|
|
1398
|
-
_context13.next = 2;
|
|
1399
|
-
break;
|
|
1400
|
-
}
|
|
1401
|
-
throw new Error('order 模块未初始化');
|
|
1402
|
-
case 2:
|
|
1403
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
1404
|
-
orderStore = this.store.order.store || {};
|
|
1405
|
-
discountModule = orderStore.discount;
|
|
1406
|
-
rulesModule = orderStore.rules;
|
|
1407
|
-
originalDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getOr2 = discountModule.getOriginalDiscountList) === null || _discountModule$getOr2 === void 0 ? void 0 : _discountModule$getOr2.call(discountModule)) || this.getDiscountList();
|
|
1408
|
-
currentDiscountList = (discountModule === null || discountModule === void 0 || (_discountModule$getDi3 = discountModule.getDiscountList) === null || _discountModule$getDi3 === void 0 ? void 0 : _discountModule$getDi3.call(discountModule)) || [];
|
|
1409
|
-
nextDiscountList = this.mergeHistoricalDiscountList(originalDiscountList || [], tempOrder.products || []);
|
|
1410
|
-
result = {
|
|
1411
|
-
productList: tempOrder.products || [],
|
|
1412
|
-
discountList: nextDiscountList
|
|
1413
|
-
};
|
|
1414
|
-
_context13.next = 12;
|
|
1415
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1416
|
-
case 12:
|
|
1417
|
-
if (!rulesModule) {
|
|
1418
|
-
_context13.next = 23;
|
|
1419
|
-
break;
|
|
1420
|
-
}
|
|
1421
|
-
holders = (_tempOrder$holder3 = tempOrder.holder) !== null && _tempOrder$holder3 !== void 0 && _tempOrder$holder3.form_record_id ? [{
|
|
1422
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1423
|
-
}] : [];
|
|
1424
|
-
result = rulesModule.calcDiscount({
|
|
1425
|
-
productList: tempOrder.products,
|
|
1426
|
-
discountList: nextDiscountList,
|
|
1427
|
-
holders: holders,
|
|
1428
|
-
isFormSubject: !!((_tempOrder$holder4 = tempOrder.holder) !== null && _tempOrder$holder4 !== void 0 && _tempOrder$holder4.type) && tempOrder.holder.type === 'form',
|
|
1429
|
-
orderTotalAmount: Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0)
|
|
1430
|
-
}) || result;
|
|
1431
|
-
if (result.productList) {
|
|
1432
|
-
tempOrder.products = result.productList;
|
|
1433
|
-
}
|
|
1434
|
-
if (!result.discountList) {
|
|
1435
|
-
_context13.next = 23;
|
|
1436
|
-
break;
|
|
1437
|
-
}
|
|
1438
|
-
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1439
|
-
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1440
|
-
_context13.next = 21;
|
|
1441
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1442
|
-
case 21:
|
|
1443
|
-
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1444
|
-
return discount.isSelected;
|
|
1445
|
-
});
|
|
1446
|
-
result = {
|
|
1447
|
-
productList: tempOrder.products,
|
|
1448
|
-
discountList: nextDiscountList
|
|
1449
|
-
};
|
|
1450
|
-
case 23:
|
|
1451
|
-
_context13.next = 25;
|
|
1452
|
-
return this.store.order.recalculateSummary({
|
|
1453
|
-
createIfMissing: true
|
|
1454
|
-
});
|
|
1455
|
-
case 25:
|
|
1456
|
-
this.store.order.persistTempOrder();
|
|
1457
|
-
cb === null || cb === void 0 || cb(result);
|
|
1458
|
-
return _context13.abrupt("return", result);
|
|
1459
|
-
case 28:
|
|
645
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
646
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
647
|
+
case 0:
|
|
648
|
+
_context7.prev = 0;
|
|
649
|
+
if (this.store.order) {
|
|
650
|
+
_context7.next = 3;
|
|
651
|
+
break;
|
|
652
|
+
}
|
|
653
|
+
throw new Error('order 模块未初始化');
|
|
654
|
+
case 3:
|
|
655
|
+
_context7.next = 5;
|
|
656
|
+
return this.store.order.getOrderSummary();
|
|
657
|
+
case 5:
|
|
658
|
+
summary = _context7.sent;
|
|
659
|
+
return _context7.abrupt("return", summary);
|
|
660
|
+
case 9:
|
|
661
|
+
_context7.prev = 9;
|
|
662
|
+
_context7.t0 = _context7["catch"](0);
|
|
663
|
+
throw _context7.t0;
|
|
664
|
+
case 12:
|
|
1460
665
|
case "end":
|
|
1461
|
-
return
|
|
666
|
+
return _context7.stop();
|
|
1462
667
|
}
|
|
1463
|
-
},
|
|
668
|
+
}, _callee7, this, [[0, 9]]);
|
|
1464
669
|
}));
|
|
1465
|
-
function
|
|
1466
|
-
return
|
|
670
|
+
function getSummary() {
|
|
671
|
+
return _getSummary.apply(this, arguments);
|
|
1467
672
|
}
|
|
1468
|
-
return
|
|
673
|
+
return getSummary;
|
|
1469
674
|
}()
|
|
1470
675
|
}, {
|
|
1471
676
|
key: "getDiscountList",
|
|
@@ -1476,49 +681,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1476
681
|
}, {
|
|
1477
682
|
key: "scanPromotionCode",
|
|
1478
683
|
value: function () {
|
|
1479
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
684
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(code, customerId) {
|
|
1480
685
|
var raw;
|
|
1481
|
-
return _regeneratorRuntime().wrap(function
|
|
1482
|
-
while (1) switch (
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
687
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
1483
688
|
case 0:
|
|
1484
|
-
|
|
689
|
+
_context8.prev = 0;
|
|
1485
690
|
if (this.store.order) {
|
|
1486
|
-
|
|
691
|
+
_context8.next = 3;
|
|
1487
692
|
break;
|
|
1488
693
|
}
|
|
1489
694
|
throw new Error('order 模块未初始化');
|
|
1490
695
|
case 3:
|
|
1491
|
-
|
|
696
|
+
_context8.next = 5;
|
|
1492
697
|
return this.store.order.scanCode(code, customerId);
|
|
1493
698
|
case 5:
|
|
1494
|
-
raw =
|
|
699
|
+
raw = _context8.sent;
|
|
1495
700
|
if (!raw.isAvailable) {
|
|
1496
|
-
|
|
701
|
+
_context8.next = 10;
|
|
1497
702
|
break;
|
|
1498
703
|
}
|
|
1499
|
-
|
|
704
|
+
_context8.next = 9;
|
|
1500
705
|
return this.store.order.recalculateSummary({
|
|
1501
706
|
createIfMissing: true
|
|
1502
707
|
});
|
|
1503
708
|
case 9:
|
|
1504
709
|
this.store.order.persistTempOrder();
|
|
1505
710
|
case 10:
|
|
1506
|
-
return
|
|
711
|
+
return _context8.abrupt("return", {
|
|
1507
712
|
isAvailable: raw.isAvailable,
|
|
1508
713
|
type: raw.type,
|
|
1509
714
|
unavailableReason: raw.unavailableReason
|
|
1510
715
|
});
|
|
1511
716
|
case 13:
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
throw
|
|
717
|
+
_context8.prev = 13;
|
|
718
|
+
_context8.t0 = _context8["catch"](0);
|
|
719
|
+
throw _context8.t0;
|
|
1515
720
|
case 16:
|
|
1516
721
|
case "end":
|
|
1517
|
-
return
|
|
722
|
+
return _context8.stop();
|
|
1518
723
|
}
|
|
1519
|
-
},
|
|
724
|
+
}, _callee8, this, [[0, 13]]);
|
|
1520
725
|
}));
|
|
1521
|
-
function scanPromotionCode(
|
|
726
|
+
function scanPromotionCode(_x3, _x4) {
|
|
1522
727
|
return _scanPromotionCode.apply(this, arguments);
|
|
1523
728
|
}
|
|
1524
729
|
return scanPromotionCode;
|
|
@@ -1526,14 +731,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1526
731
|
}, {
|
|
1527
732
|
key: "setDiscountSelected",
|
|
1528
733
|
value: function () {
|
|
1529
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1530
|
-
var _tempOrder$
|
|
1531
|
-
return _regeneratorRuntime().wrap(function
|
|
1532
|
-
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) {
|
|
1533
738
|
case 0:
|
|
1534
|
-
|
|
739
|
+
_context9.prev = 0;
|
|
1535
740
|
if (this.store.order) {
|
|
1536
|
-
|
|
741
|
+
_context9.next = 3;
|
|
1537
742
|
break;
|
|
1538
743
|
}
|
|
1539
744
|
throw new Error('order 模块未初始化');
|
|
@@ -1545,24 +750,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1545
750
|
isManualSelect: !params.isSelected
|
|
1546
751
|
}) : d;
|
|
1547
752
|
});
|
|
1548
|
-
this.hasManualDiscountSelection = true;
|
|
1549
753
|
tempOrder = this.store.order.ensureTempOrder();
|
|
1550
754
|
orderStore = this.store.order.store || {};
|
|
1551
755
|
discountModule = orderStore.discount;
|
|
1552
756
|
rulesModule = orderStore.rules;
|
|
1553
|
-
holders = (_tempOrder$
|
|
757
|
+
holders = (_tempOrder$holder = tempOrder.holder) !== null && _tempOrder$holder !== void 0 && _tempOrder$holder.form_record_id ? [{
|
|
1554
758
|
form_record_id: tempOrder.holder.form_record_id
|
|
1555
759
|
}] : [];
|
|
1556
760
|
nextDiscountList = updated;
|
|
1557
|
-
|
|
761
|
+
_context9.next = 13;
|
|
1558
762
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1559
|
-
case
|
|
763
|
+
case 13:
|
|
1560
764
|
if (rulesModule) {
|
|
1561
765
|
result = rulesModule.calcDiscount({
|
|
1562
766
|
productList: tempOrder.products,
|
|
1563
767
|
discountList: updated,
|
|
1564
768
|
holders: holders,
|
|
1565
|
-
isFormSubject: !!((_tempOrder$
|
|
769
|
+
isFormSubject: !!((_tempOrder$holder2 = tempOrder.holder) !== null && _tempOrder$holder2 !== void 0 && _tempOrder$holder2.type) && tempOrder.holder.type === 'form'
|
|
1566
770
|
}, {
|
|
1567
771
|
discountId: params.discountId,
|
|
1568
772
|
isSelected: params.isSelected
|
|
@@ -1581,19 +785,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1581
785
|
}).map(function (d) {
|
|
1582
786
|
return d.id;
|
|
1583
787
|
}));
|
|
1584
|
-
|
|
788
|
+
_iterator = _createForOfIteratorHelper(nextDiscountList);
|
|
1585
789
|
try {
|
|
1586
|
-
for (
|
|
1587
|
-
d =
|
|
790
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
791
|
+
d = _step.value;
|
|
1588
792
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1589
793
|
d.isSelected = false;
|
|
1590
|
-
d.isManualSelect = true;
|
|
1591
794
|
}
|
|
1592
795
|
}
|
|
1593
796
|
} catch (err) {
|
|
1594
|
-
|
|
797
|
+
_iterator.e(err);
|
|
1595
798
|
} finally {
|
|
1596
|
-
|
|
799
|
+
_iterator.f();
|
|
1597
800
|
}
|
|
1598
801
|
}
|
|
1599
802
|
}
|
|
@@ -1603,23 +806,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
806
|
}).map(function (d) {
|
|
1604
807
|
return d.id;
|
|
1605
808
|
}));
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
case
|
|
1610
|
-
if ((
|
|
1611
|
-
|
|
809
|
+
_iterator2 = _createForOfIteratorHelper(tempOrder.products);
|
|
810
|
+
_context9.prev = 16;
|
|
811
|
+
_iterator2.s();
|
|
812
|
+
case 18:
|
|
813
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
814
|
+
_context9.next = 34;
|
|
1612
815
|
break;
|
|
1613
816
|
}
|
|
1614
|
-
product =
|
|
1615
|
-
productUid = (_product$
|
|
1616
|
-
runtimeOrigin = productUid ? (_tempOrder$
|
|
1617
|
-
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$
|
|
1618
|
-
|
|
817
|
+
product = _step2.value;
|
|
818
|
+
productUid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
819
|
+
runtimeOrigin = productUid ? (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.productsByUid) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend[productUid]) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.origin : undefined;
|
|
820
|
+
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || (_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.is_manual_discount)) {
|
|
821
|
+
_context9.next = 24;
|
|
1619
822
|
break;
|
|
1620
823
|
}
|
|
1621
|
-
return
|
|
1622
|
-
case
|
|
824
|
+
return _context9.abrupt("continue", 32);
|
|
825
|
+
case 24:
|
|
1623
826
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
1624
827
|
var _pd$discount$resource, _pd$discount;
|
|
1625
828
|
var rid = (_pd$discount$resource = (_pd$discount = pd.discount) === null || _pd$discount === void 0 ? void 0 : _pd$discount.resource_id) !== null && _pd$discount$resource !== void 0 ? _pd$discount$resource : pd.id;
|
|
@@ -1632,7 +835,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1632
835
|
return sum + (pd.amount || 0);
|
|
1633
836
|
}, 0); // TODO 这块逻辑需要拿掉
|
|
1634
837
|
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
1635
|
-
sourcePrice = (_product$metadata$
|
|
838
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1636
839
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1637
840
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
1638
841
|
if (product.metadata) {
|
|
@@ -1643,134 +846,66 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1643
846
|
mainPrice: newMainSellingPrice,
|
|
1644
847
|
bundle: product.product_bundle
|
|
1645
848
|
});
|
|
1646
|
-
case
|
|
1647
|
-
|
|
849
|
+
case 32:
|
|
850
|
+
_context9.next = 18;
|
|
1648
851
|
break;
|
|
1649
|
-
case
|
|
1650
|
-
|
|
852
|
+
case 34:
|
|
853
|
+
_context9.next = 39;
|
|
1651
854
|
break;
|
|
1652
|
-
case
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
case
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
return
|
|
1660
|
-
case
|
|
855
|
+
case 36:
|
|
856
|
+
_context9.prev = 36;
|
|
857
|
+
_context9.t0 = _context9["catch"](16);
|
|
858
|
+
_iterator2.e(_context9.t0);
|
|
859
|
+
case 39:
|
|
860
|
+
_context9.prev = 39;
|
|
861
|
+
_iterator2.f();
|
|
862
|
+
return _context9.finish(39);
|
|
863
|
+
case 42:
|
|
1661
864
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1662
|
-
|
|
865
|
+
_context9.next = 45;
|
|
1663
866
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1664
|
-
case
|
|
867
|
+
case 45:
|
|
1665
868
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1666
869
|
return d.isSelected;
|
|
1667
870
|
});
|
|
1668
|
-
|
|
871
|
+
_context9.next = 48;
|
|
1669
872
|
return this.store.order.recalculateSummary({
|
|
1670
873
|
createIfMissing: true
|
|
1671
874
|
});
|
|
1672
|
-
case
|
|
875
|
+
case 48:
|
|
1673
876
|
this.store.order.persistTempOrder();
|
|
1674
|
-
|
|
1675
|
-
productList: tempOrder.products,
|
|
1676
|
-
discountList: nextDiscountList,
|
|
1677
|
-
selectedDiscountList: tempOrder.discount_list,
|
|
1678
|
-
tempOrder: tempOrder
|
|
1679
|
-
});
|
|
1680
|
-
_context15.next = 56;
|
|
877
|
+
_context9.next = 54;
|
|
1681
878
|
break;
|
|
1682
|
-
case
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
throw
|
|
1686
|
-
case
|
|
879
|
+
case 51:
|
|
880
|
+
_context9.prev = 51;
|
|
881
|
+
_context9.t1 = _context9["catch"](0);
|
|
882
|
+
throw _context9.t1;
|
|
883
|
+
case 54:
|
|
1687
884
|
case "end":
|
|
1688
|
-
return
|
|
885
|
+
return _context9.stop();
|
|
1689
886
|
}
|
|
1690
|
-
},
|
|
887
|
+
}, _callee9, this, [[0, 51], [16, 36, 39, 42]]);
|
|
1691
888
|
}));
|
|
1692
|
-
function setDiscountSelected(
|
|
889
|
+
function setDiscountSelected(_x5) {
|
|
1693
890
|
return _setDiscountSelected.apply(this, arguments);
|
|
1694
891
|
}
|
|
1695
892
|
return setDiscountSelected;
|
|
1696
893
|
}()
|
|
1697
|
-
}, {
|
|
1698
|
-
key: "applyDiscountCalculationResult",
|
|
1699
|
-
value: function () {
|
|
1700
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(result) {
|
|
1701
|
-
var tempOrder, orderStore, discountModule;
|
|
1702
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1703
|
-
while (1) switch (_context16.prev = _context16.next) {
|
|
1704
|
-
case 0:
|
|
1705
|
-
_context16.prev = 0;
|
|
1706
|
-
if (this.store.order) {
|
|
1707
|
-
_context16.next = 3;
|
|
1708
|
-
break;
|
|
1709
|
-
}
|
|
1710
|
-
throw new Error('order 模块未初始化');
|
|
1711
|
-
case 3:
|
|
1712
|
-
if (result) {
|
|
1713
|
-
_context16.next = 5;
|
|
1714
|
-
break;
|
|
1715
|
-
}
|
|
1716
|
-
return _context16.abrupt("return");
|
|
1717
|
-
case 5:
|
|
1718
|
-
tempOrder = this.store.order.ensureTempOrder();
|
|
1719
|
-
orderStore = this.store.order.store || {};
|
|
1720
|
-
discountModule = orderStore.discount;
|
|
1721
|
-
if (result.productList) {
|
|
1722
|
-
tempOrder.products = result.productList;
|
|
1723
|
-
}
|
|
1724
|
-
if (!result.discountList) {
|
|
1725
|
-
_context16.next = 14;
|
|
1726
|
-
break;
|
|
1727
|
-
}
|
|
1728
|
-
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
1729
|
-
_context16.next = 13;
|
|
1730
|
-
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
1731
|
-
case 13:
|
|
1732
|
-
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
1733
|
-
return discount.isSelected;
|
|
1734
|
-
});
|
|
1735
|
-
case 14:
|
|
1736
|
-
_context16.next = 16;
|
|
1737
|
-
return this.store.order.recalculateSummary({
|
|
1738
|
-
createIfMissing: true
|
|
1739
|
-
});
|
|
1740
|
-
case 16:
|
|
1741
|
-
this.store.order.persistTempOrder();
|
|
1742
|
-
_context16.next = 22;
|
|
1743
|
-
break;
|
|
1744
|
-
case 19:
|
|
1745
|
-
_context16.prev = 19;
|
|
1746
|
-
_context16.t0 = _context16["catch"](0);
|
|
1747
|
-
throw _context16.t0;
|
|
1748
|
-
case 22:
|
|
1749
|
-
case "end":
|
|
1750
|
-
return _context16.stop();
|
|
1751
|
-
}
|
|
1752
|
-
}, _callee16, this, [[0, 19]]);
|
|
1753
|
-
}));
|
|
1754
|
-
function applyDiscountCalculationResult(_x12) {
|
|
1755
|
-
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
1756
|
-
}
|
|
1757
|
-
return applyDiscountCalculationResult;
|
|
1758
|
-
}()
|
|
1759
894
|
}, {
|
|
1760
895
|
key: "submitScanOrder",
|
|
1761
896
|
value: function () {
|
|
1762
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1763
|
-
return _regeneratorRuntime().wrap(function
|
|
1764
|
-
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) {
|
|
1765
900
|
case 0:
|
|
1766
|
-
return
|
|
901
|
+
return _context10.abrupt("return", this.submitSalesOrder(params));
|
|
1767
902
|
case 1:
|
|
1768
903
|
case "end":
|
|
1769
|
-
return
|
|
904
|
+
return _context10.stop();
|
|
1770
905
|
}
|
|
1771
|
-
},
|
|
906
|
+
}, _callee10, this);
|
|
1772
907
|
}));
|
|
1773
|
-
function submitScanOrder(
|
|
908
|
+
function submitScanOrder(_x6) {
|
|
1774
909
|
return _submitScanOrder.apply(this, arguments);
|
|
1775
910
|
}
|
|
1776
911
|
return submitScanOrder;
|
|
@@ -1784,14 +919,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1784
919
|
}, {
|
|
1785
920
|
key: "submitSalesOrder",
|
|
1786
921
|
value: (function () {
|
|
1787
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1788
|
-
var _this$
|
|
922
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
923
|
+
var _this$otherParams2, _this$otherParams3, _this$otherParams4, _this$otherParams5;
|
|
1789
924
|
var submitParams;
|
|
1790
|
-
return _regeneratorRuntime().wrap(function
|
|
1791
|
-
while (1) switch (
|
|
925
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
926
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1792
927
|
case 0:
|
|
1793
928
|
if (this.store.order) {
|
|
1794
|
-
|
|
929
|
+
_context11.next = 2;
|
|
1795
930
|
break;
|
|
1796
931
|
}
|
|
1797
932
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -1799,10 +934,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1799
934
|
this.store.order.persistTempOrder();
|
|
1800
935
|
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
1801
936
|
cacheId: this.cacheId,
|
|
1802
|
-
platform: (_this$
|
|
1803
|
-
businessCode: (_this$
|
|
1804
|
-
channel: this.
|
|
1805
|
-
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
|
|
1806
941
|
}, (params === null || params === void 0 ? void 0 : params.payments) !== undefined ? {
|
|
1807
942
|
payments: params.payments
|
|
1808
943
|
} : {}), (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined ? {
|
|
@@ -1812,15 +947,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1812
947
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
1813
948
|
enhancePayload: params.enhancePayload
|
|
1814
949
|
} : {});
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
case 6:
|
|
950
|
+
return _context11.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
951
|
+
case 5:
|
|
1818
952
|
case "end":
|
|
1819
|
-
return
|
|
953
|
+
return _context11.stop();
|
|
1820
954
|
}
|
|
1821
|
-
},
|
|
955
|
+
}, _callee11, this);
|
|
1822
956
|
}));
|
|
1823
|
-
function submitSalesOrder(
|
|
957
|
+
function submitSalesOrder(_x7) {
|
|
1824
958
|
return _submitSalesOrder.apply(this, arguments);
|
|
1825
959
|
}
|
|
1826
960
|
return submitSalesOrder;
|
|
@@ -1828,75 +962,24 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1828
962
|
}, {
|
|
1829
963
|
key: "syncPaymentsToOrder",
|
|
1830
964
|
value: function () {
|
|
1831
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1835
|
-
while (1) switch (_context19.prev = _context19.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) {
|
|
1836
968
|
case 0:
|
|
1837
969
|
if (this.store.order) {
|
|
1838
|
-
|
|
970
|
+
_context12.next = 2;
|
|
1839
971
|
break;
|
|
1840
972
|
}
|
|
1841
973
|
throw new Error('order 模块未初始化');
|
|
1842
974
|
case 2:
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
channel: channel
|
|
1846
|
-
} : {});
|
|
1847
|
-
syncState = this.store.order.getOrderSyncState();
|
|
1848
|
-
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1849
|
-
_context19.next = 7;
|
|
1850
|
-
break;
|
|
1851
|
-
}
|
|
1852
|
-
return _context19.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1853
|
-
case 7:
|
|
1854
|
-
payments = params.payments || [];
|
|
1855
|
-
_context19.next = 10;
|
|
1856
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1857
|
-
payments: payments,
|
|
1858
|
-
params: syncParams,
|
|
1859
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1860
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1861
|
-
});
|
|
1862
|
-
case 10:
|
|
1863
|
-
_context19.prev = 10;
|
|
1864
|
-
_context19.next = 13;
|
|
1865
|
-
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1866
|
-
case 13:
|
|
1867
|
-
syncResult = _context19.sent;
|
|
1868
|
-
_context19.next = 16;
|
|
1869
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1870
|
-
ok: true,
|
|
1871
|
-
syncResult: syncResult,
|
|
1872
|
-
payments: this.store.order.getOrderPayments(),
|
|
1873
|
-
params: syncParams,
|
|
1874
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1875
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1876
|
-
});
|
|
1877
|
-
case 16:
|
|
1878
|
-
return _context19.abrupt("return", syncResult);
|
|
1879
|
-
case 19:
|
|
1880
|
-
_context19.prev = 19;
|
|
1881
|
-
_context19.t0 = _context19["catch"](10);
|
|
1882
|
-
_context19.next = 23;
|
|
1883
|
-
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1884
|
-
ok: false,
|
|
1885
|
-
error: _context19.t0,
|
|
1886
|
-
payments: this.store.order.getOrderPayments(),
|
|
1887
|
-
params: syncParams,
|
|
1888
|
-
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1889
|
-
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1890
|
-
});
|
|
1891
|
-
case 23:
|
|
1892
|
-
throw _context19.t0;
|
|
1893
|
-
case 24:
|
|
975
|
+
return _context12.abrupt("return", this.store.order.syncPaymentsToOrder(params));
|
|
976
|
+
case 3:
|
|
1894
977
|
case "end":
|
|
1895
|
-
return
|
|
978
|
+
return _context12.stop();
|
|
1896
979
|
}
|
|
1897
|
-
},
|
|
980
|
+
}, _callee12, this);
|
|
1898
981
|
}));
|
|
1899
|
-
function syncPaymentsToOrder(
|
|
982
|
+
function syncPaymentsToOrder(_x8) {
|
|
1900
983
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
1901
984
|
}
|
|
1902
985
|
return syncPaymentsToOrder;
|
|
@@ -1920,32 +1003,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1920
1003
|
}, {
|
|
1921
1004
|
key: "addOrderPayment",
|
|
1922
1005
|
value: function addOrderPayment(payment) {
|
|
1923
|
-
var _this6 = this;
|
|
1924
1006
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1925
|
-
|
|
1926
|
-
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1927
|
-
if (!metadata.unique_identification_number) {
|
|
1928
|
-
metadata.unique_identification_number = createUuidV4();
|
|
1929
|
-
}
|
|
1930
|
-
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread({}, paymentRecord), {}, {
|
|
1931
|
-
metadata: metadata
|
|
1932
|
-
}));
|
|
1933
|
-
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
1934
|
-
var syncState = this.store.order.getOrderSyncState();
|
|
1935
|
-
if (amountSnapshot && syncState !== 'submitting') {
|
|
1936
|
-
var paymentStatus = Number(amountSnapshot.amountGap || 0) <= 0 ? 'paid' : 'partially_paid';
|
|
1937
|
-
void this.syncPaymentsToOrder({
|
|
1938
|
-
payments: payments,
|
|
1939
|
-
paymentStatus: paymentStatus,
|
|
1940
|
-
submitWhenPaid: true,
|
|
1941
|
-
smallTicketDataFlag: 1
|
|
1942
|
-
}).catch(function (error) {
|
|
1943
|
-
_this6.logError('auto sync payments failed', {
|
|
1944
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1945
|
-
});
|
|
1946
|
-
});
|
|
1947
|
-
}
|
|
1948
|
-
return payments;
|
|
1007
|
+
return this.store.order.addOrderPayment(payment);
|
|
1949
1008
|
}
|
|
1950
1009
|
|
|
1951
1010
|
/** 更新当前订单中的指定支付项。 */
|
|
@@ -1974,25 +1033,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1974
1033
|
}, {
|
|
1975
1034
|
key: "getWalletProductList",
|
|
1976
1035
|
value: function getWalletProductList() {
|
|
1977
|
-
var _this$store$
|
|
1978
|
-
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();
|
|
1979
1038
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
return n.product_id;
|
|
1983
|
-
});
|
|
1984
|
-
return products.map(function (product) {
|
|
1985
|
-
var _product$product_vari2, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
1039
|
+
return tempOrder.products.map(function (product) {
|
|
1040
|
+
var _product$product_vari, _product$is_charge_ta, _product$holder_id, _metadata$main_produc, _metadata$main_produc2;
|
|
1986
1041
|
var metadata = product.metadata || {};
|
|
1987
1042
|
return {
|
|
1988
1043
|
product_id: product.product_id,
|
|
1989
|
-
product_variant_id: String((_product$
|
|
1044
|
+
product_variant_id: String((_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : ''),
|
|
1990
1045
|
quantity: product.num || 1,
|
|
1991
1046
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
1992
1047
|
is_charge_tax: (_product$is_charge_ta = product.is_charge_tax) !== null && _product$is_charge_ta !== void 0 ? _product$is_charge_ta : 0,
|
|
1993
1048
|
tax_fee: product.tax_fee,
|
|
1994
1049
|
selling_price: Number(product.selling_price || 0),
|
|
1995
|
-
discount_list: product.discount_list || [],
|
|
1996
1050
|
holder_id: (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id,
|
|
1997
1051
|
original_price: product.original_price,
|
|
1998
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,
|
|
@@ -2003,14 +1057,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2003
1057
|
surcharge_rounding_remainder: metadata.surcharge_rounding_remainder
|
|
2004
1058
|
},
|
|
2005
1059
|
product_bundle: (product.product_bundle || []).map(function (bundle) {
|
|
2006
|
-
var _bundle$bundle_id2, _bundle$bundle_produc2, _bundle$bundle_group_2;
|
|
2007
1060
|
var bundleMetadata = bundle.metadata || {};
|
|
2008
1061
|
return {
|
|
2009
1062
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
bundle_product_id: (_bundle$bundle_produc2 = bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle._bundle_product_id,
|
|
2013
|
-
bundle_group_id: (_bundle$bundle_group_2 = bundle.bundle_group_id) !== null && _bundle$bundle_group_2 !== void 0 ? _bundle$bundle_group_2 : bundle.group_id,
|
|
1063
|
+
bundle_id: bundle.bundle_id,
|
|
1064
|
+
bundle_product_id: bundle.bundle_product_id,
|
|
2014
1065
|
bundle_variant_id: bundle.bundle_variant_id,
|
|
2015
1066
|
price_type: bundle.price_type,
|
|
2016
1067
|
price_type_ext: bundle.price_type_ext,
|
|
@@ -2031,20 +1082,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2031
1082
|
}, {
|
|
2032
1083
|
key: "initWalletData",
|
|
2033
1084
|
value: function () {
|
|
2034
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2035
|
-
var _params$order_wait_pa,
|
|
1085
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
|
|
1086
|
+
var _params$order_wait_pa, _ref, _tempOrder$is_price_i;
|
|
2036
1087
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2037
|
-
return _regeneratorRuntime().wrap(function
|
|
2038
|
-
while (1) switch (
|
|
1088
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1089
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
2039
1090
|
case 0:
|
|
2040
1091
|
if (this.store.order) {
|
|
2041
|
-
|
|
1092
|
+
_context13.next = 2;
|
|
2042
1093
|
break;
|
|
2043
1094
|
}
|
|
2044
1095
|
throw new Error('order 模块未初始化');
|
|
2045
1096
|
case 2:
|
|
2046
1097
|
if (this.store.payment) {
|
|
2047
|
-
|
|
1098
|
+
_context13.next = 4;
|
|
2048
1099
|
break;
|
|
2049
1100
|
}
|
|
2050
1101
|
throw new Error('payment 模块未初始化');
|
|
@@ -2053,10 +1104,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2053
1104
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2054
1105
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2055
1106
|
if (!(!tempOrder || !amount)) {
|
|
2056
|
-
|
|
1107
|
+
_context13.next = 9;
|
|
2057
1108
|
break;
|
|
2058
1109
|
}
|
|
2059
|
-
return
|
|
1110
|
+
return _context13.abrupt("return", {
|
|
2060
1111
|
walletRecommendList: [],
|
|
2061
1112
|
userIdentificationCodes: [],
|
|
2062
1113
|
transformList: [],
|
|
@@ -2075,15 +1126,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2075
1126
|
},
|
|
2076
1127
|
products: this.getWalletProductList(),
|
|
2077
1128
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
2078
|
-
is_price_include_tax: (
|
|
1129
|
+
is_price_include_tax: (_ref = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref !== void 0 ? _ref : 1
|
|
2079
1130
|
}, snapshot.identity.orderId ? {
|
|
2080
1131
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2081
1132
|
} : {});
|
|
2082
|
-
|
|
1133
|
+
_context13.next = 12;
|
|
2083
1134
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2084
1135
|
case 12:
|
|
2085
|
-
result =
|
|
2086
|
-
|
|
1136
|
+
result = _context13.sent;
|
|
1137
|
+
_context13.next = 15;
|
|
2087
1138
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2088
1139
|
orderId: snapshot.identity.orderId,
|
|
2089
1140
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2095,14 +1146,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2095
1146
|
timestamp: Date.now()
|
|
2096
1147
|
});
|
|
2097
1148
|
case 15:
|
|
2098
|
-
return
|
|
1149
|
+
return _context13.abrupt("return", result);
|
|
2099
1150
|
case 16:
|
|
2100
1151
|
case "end":
|
|
2101
|
-
return
|
|
1152
|
+
return _context13.stop();
|
|
2102
1153
|
}
|
|
2103
|
-
},
|
|
1154
|
+
}, _callee13, this);
|
|
2104
1155
|
}));
|
|
2105
|
-
function initWalletData(
|
|
1156
|
+
function initWalletData(_x9) {
|
|
2106
1157
|
return _initWalletData.apply(this, arguments);
|
|
2107
1158
|
}
|
|
2108
1159
|
return initWalletData;
|
|
@@ -2129,27 +1180,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2129
1180
|
}, {
|
|
2130
1181
|
key: "getPaymentMethodsAsync",
|
|
2131
1182
|
value: (function () {
|
|
2132
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1183
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
2133
1184
|
var response;
|
|
2134
|
-
return _regeneratorRuntime().wrap(function
|
|
2135
|
-
while (1) switch (
|
|
1185
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1186
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
2136
1187
|
case 0:
|
|
2137
1188
|
if (!this.store.payment) {
|
|
2138
|
-
|
|
1189
|
+
_context14.next = 2;
|
|
2139
1190
|
break;
|
|
2140
1191
|
}
|
|
2141
|
-
return
|
|
1192
|
+
return _context14.abrupt("return", this.store.payment.getPayMethodListAsync());
|
|
2142
1193
|
case 2:
|
|
2143
|
-
|
|
1194
|
+
_context14.next = 4;
|
|
2144
1195
|
return this.request.get('/pay/custom-payment/all');
|
|
2145
1196
|
case 4:
|
|
2146
|
-
response =
|
|
2147
|
-
return
|
|
1197
|
+
response = _context14.sent;
|
|
1198
|
+
return _context14.abrupt("return", (response === null || response === void 0 ? void 0 : response.data) || []);
|
|
2148
1199
|
case 6:
|
|
2149
1200
|
case "end":
|
|
2150
|
-
return
|
|
1201
|
+
return _context14.stop();
|
|
2151
1202
|
}
|
|
2152
|
-
},
|
|
1203
|
+
}, _callee14, this);
|
|
2153
1204
|
}));
|
|
2154
1205
|
function getPaymentMethodsAsync() {
|
|
2155
1206
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2190,49 +1241,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2190
1241
|
}, {
|
|
2191
1242
|
key: "sendCustomerPayLink",
|
|
2192
1243
|
value: (function () {
|
|
2193
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2194
|
-
var orderIds,
|
|
2195
|
-
return _regeneratorRuntime().wrap(function
|
|
2196
|
-
while (1) switch (
|
|
1244
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1245
|
+
var orderIds, _ref2, _ref3, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
1246
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1247
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
2197
1248
|
case 0:
|
|
2198
1249
|
if (this.store.order) {
|
|
2199
|
-
|
|
1250
|
+
_context15.next = 2;
|
|
2200
1251
|
break;
|
|
2201
1252
|
}
|
|
2202
1253
|
throw new Error('order 模块未初始化');
|
|
2203
1254
|
case 2:
|
|
2204
1255
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2205
1256
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2206
|
-
|
|
1257
|
+
_context15.next = 11;
|
|
2207
1258
|
break;
|
|
2208
1259
|
}
|
|
2209
|
-
|
|
1260
|
+
_context15.next = 6;
|
|
2210
1261
|
return this.submitSalesOrder({
|
|
2211
1262
|
smallTicketDataFlag: 1
|
|
2212
1263
|
});
|
|
2213
1264
|
case 6:
|
|
2214
|
-
submitResult =
|
|
2215
|
-
orderId = (
|
|
1265
|
+
submitResult = _context15.sent;
|
|
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;
|
|
2216
1267
|
if (orderId) {
|
|
2217
|
-
|
|
1268
|
+
_context15.next = 10;
|
|
2218
1269
|
break;
|
|
2219
1270
|
}
|
|
2220
1271
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2221
1272
|
case 10:
|
|
2222
1273
|
orderIds = [orderId];
|
|
2223
1274
|
case 11:
|
|
2224
|
-
return
|
|
1275
|
+
return _context15.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2225
1276
|
emails: params.emails,
|
|
2226
1277
|
notify_action: params.notify_action,
|
|
2227
1278
|
order_ids: orderIds
|
|
2228
1279
|
}));
|
|
2229
1280
|
case 12:
|
|
2230
1281
|
case "end":
|
|
2231
|
-
return
|
|
1282
|
+
return _context15.stop();
|
|
2232
1283
|
}
|
|
2233
|
-
},
|
|
1284
|
+
}, _callee15, this);
|
|
2234
1285
|
}));
|
|
2235
|
-
function sendCustomerPayLink(
|
|
1286
|
+
function sendCustomerPayLink(_x10) {
|
|
2236
1287
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2237
1288
|
}
|
|
2238
1289
|
return sendCustomerPayLink;
|
|
@@ -2242,162 +1293,76 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2242
1293
|
value: function transformBaseProductToOrderProduct(params) {
|
|
2243
1294
|
return _transformBaseProductToOrderProduct(params);
|
|
2244
1295
|
}
|
|
2245
|
-
}, {
|
|
2246
|
-
key: "calculateProductBookingPrice",
|
|
2247
|
-
value: function () {
|
|
2248
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2249
|
-
var _params$customer_id;
|
|
2250
|
-
var quotation, customerId, authoritativeProduct, product;
|
|
2251
|
-
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2252
|
-
while (1) switch (_context23.prev = _context23.next) {
|
|
2253
|
-
case 0:
|
|
2254
|
-
quotation = this.store.quotation;
|
|
2255
|
-
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2256
|
-
_context23.next = 4;
|
|
2257
|
-
return this.loadProductForPriceQuery(params, customerId);
|
|
2258
|
-
case 4:
|
|
2259
|
-
authoritativeProduct = _context23.sent;
|
|
2260
|
-
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2261
|
-
_context23.next = 8;
|
|
2262
|
-
return this.loadQuotationForPriceQuery({
|
|
2263
|
-
quotation: quotation,
|
|
2264
|
-
customer_id: customerId,
|
|
2265
|
-
channel: params.channel
|
|
2266
|
-
});
|
|
2267
|
-
case 8:
|
|
2268
|
-
return _context23.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2269
|
-
product: product,
|
|
2270
|
-
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2271
|
-
customer_id: customerId,
|
|
2272
|
-
quotation: quotation
|
|
2273
|
-
})));
|
|
2274
|
-
case 9:
|
|
2275
|
-
case "end":
|
|
2276
|
-
return _context23.stop();
|
|
2277
|
-
}
|
|
2278
|
-
}, _callee23, this);
|
|
2279
|
-
}));
|
|
2280
|
-
function calculateProductBookingPrice(_x18) {
|
|
2281
|
-
return _calculateProductBookingPrice.apply(this, arguments);
|
|
2282
|
-
}
|
|
2283
|
-
return calculateProductBookingPrice;
|
|
2284
|
-
}()
|
|
2285
1296
|
}, {
|
|
2286
1297
|
key: "addProductToOrder",
|
|
2287
1298
|
value: function () {
|
|
2288
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1299
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(product, booking) {
|
|
2289
1300
|
var products;
|
|
2290
|
-
return _regeneratorRuntime().wrap(function
|
|
2291
|
-
while (1) switch (
|
|
1301
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1302
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
2292
1303
|
case 0:
|
|
2293
|
-
|
|
1304
|
+
_context16.prev = 0;
|
|
2294
1305
|
if (this.store.order) {
|
|
2295
|
-
|
|
1306
|
+
_context16.next = 3;
|
|
2296
1307
|
break;
|
|
2297
1308
|
}
|
|
2298
1309
|
throw new Error('order 模块未初始化');
|
|
2299
1310
|
case 3:
|
|
2300
|
-
|
|
1311
|
+
_context16.next = 5;
|
|
2301
1312
|
return this.store.order.addProductToOrder(product, booking);
|
|
2302
1313
|
case 5:
|
|
2303
|
-
products =
|
|
2304
|
-
return
|
|
1314
|
+
products = _context16.sent;
|
|
1315
|
+
return _context16.abrupt("return", products);
|
|
2305
1316
|
case 9:
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
throw
|
|
1317
|
+
_context16.prev = 9;
|
|
1318
|
+
_context16.t0 = _context16["catch"](0);
|
|
1319
|
+
throw _context16.t0;
|
|
2309
1320
|
case 12:
|
|
2310
1321
|
case "end":
|
|
2311
|
-
return
|
|
1322
|
+
return _context16.stop();
|
|
2312
1323
|
}
|
|
2313
|
-
},
|
|
1324
|
+
}, _callee16, this, [[0, 9]]);
|
|
2314
1325
|
}));
|
|
2315
|
-
function addProductToOrder(
|
|
1326
|
+
function addProductToOrder(_x11, _x12) {
|
|
2316
1327
|
return _addProductToOrder.apply(this, arguments);
|
|
2317
1328
|
}
|
|
2318
1329
|
return addProductToOrder;
|
|
2319
1330
|
}()
|
|
2320
1331
|
}, {
|
|
2321
|
-
key: "
|
|
2322
|
-
value: function () {
|
|
2323
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
|
|
2324
|
-
var products;
|
|
2325
|
-
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2326
|
-
while (1) switch (_context25.prev = _context25.next) {
|
|
2327
|
-
case 0:
|
|
2328
|
-
_context25.prev = 0;
|
|
2329
|
-
if (this.store.order) {
|
|
2330
|
-
_context25.next = 3;
|
|
2331
|
-
break;
|
|
2332
|
-
}
|
|
2333
|
-
throw new Error('order 模块未初始化');
|
|
2334
|
-
case 3:
|
|
2335
|
-
_context25.next = 5;
|
|
2336
|
-
return this.store.order.updateOrderProduct(params);
|
|
2337
|
-
case 5:
|
|
2338
|
-
products = _context25.sent;
|
|
2339
|
-
return _context25.abrupt("return", products);
|
|
2340
|
-
case 9:
|
|
2341
|
-
_context25.prev = 9;
|
|
2342
|
-
_context25.t0 = _context25["catch"](0);
|
|
2343
|
-
throw _context25.t0;
|
|
2344
|
-
case 12:
|
|
2345
|
-
case "end":
|
|
2346
|
-
return _context25.stop();
|
|
2347
|
-
}
|
|
2348
|
-
}, _callee25, this, [[0, 9]]);
|
|
2349
|
-
}));
|
|
2350
|
-
function updateOrderProduct(_x21) {
|
|
2351
|
-
return _updateOrderProduct.apply(this, arguments);
|
|
2352
|
-
}
|
|
2353
|
-
return updateOrderProduct;
|
|
2354
|
-
}()
|
|
2355
|
-
}, {
|
|
2356
|
-
key: "updateOrderProductQuantity",
|
|
1332
|
+
key: "updateProductInOrder",
|
|
2357
1333
|
value: function () {
|
|
2358
|
-
var
|
|
1334
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
2359
1335
|
var products;
|
|
2360
|
-
return _regeneratorRuntime().wrap(function
|
|
2361
|
-
while (1) switch (
|
|
1336
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1337
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
2362
1338
|
case 0:
|
|
2363
|
-
|
|
1339
|
+
_context17.prev = 0;
|
|
2364
1340
|
if (this.store.order) {
|
|
2365
|
-
|
|
1341
|
+
_context17.next = 3;
|
|
2366
1342
|
break;
|
|
2367
1343
|
}
|
|
2368
1344
|
throw new Error('order 模块未初始化');
|
|
2369
1345
|
case 3:
|
|
2370
|
-
|
|
2371
|
-
return this.store.order.
|
|
1346
|
+
_context17.next = 5;
|
|
1347
|
+
return this.store.order.updateProductInOrder(params);
|
|
2372
1348
|
case 5:
|
|
2373
|
-
products =
|
|
2374
|
-
return
|
|
1349
|
+
products = _context17.sent;
|
|
1350
|
+
return _context17.abrupt("return", products);
|
|
2375
1351
|
case 9:
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
throw
|
|
1352
|
+
_context17.prev = 9;
|
|
1353
|
+
_context17.t0 = _context17["catch"](0);
|
|
1354
|
+
throw _context17.t0;
|
|
2379
1355
|
case 12:
|
|
2380
1356
|
case "end":
|
|
2381
|
-
return
|
|
1357
|
+
return _context17.stop();
|
|
2382
1358
|
}
|
|
2383
|
-
},
|
|
1359
|
+
}, _callee17, this, [[0, 9]]);
|
|
2384
1360
|
}));
|
|
2385
|
-
function
|
|
2386
|
-
return
|
|
1361
|
+
function updateProductInOrder(_x13) {
|
|
1362
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
2387
1363
|
}
|
|
2388
|
-
return
|
|
1364
|
+
return updateProductInOrder;
|
|
2389
1365
|
}()
|
|
2390
|
-
}, {
|
|
2391
|
-
key: "updateOrderBooking",
|
|
2392
|
-
value: function updateOrderBooking(params) {
|
|
2393
|
-
try {
|
|
2394
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2395
|
-
return this.store.order.updateOrderBooking(params);
|
|
2396
|
-
} catch (error) {
|
|
2397
|
-
throw error;
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
|
|
2401
1366
|
/**
|
|
2402
1367
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
2403
1368
|
* 多行同 SKU 时必须传入与删除/更新一致的 unique_identification_number。
|
|
@@ -2405,12 +1370,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2405
1370
|
}, {
|
|
2406
1371
|
key: "setOrderProductLineNote",
|
|
2407
1372
|
value: (function () {
|
|
2408
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1373
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(identity, note) {
|
|
2409
1374
|
var params, products;
|
|
2410
|
-
return _regeneratorRuntime().wrap(function
|
|
2411
|
-
while (1) switch (
|
|
1375
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1376
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
2412
1377
|
case 0:
|
|
2413
|
-
|
|
1378
|
+
_context18.prev = 0;
|
|
2414
1379
|
params = {
|
|
2415
1380
|
product_id: identity.product_id,
|
|
2416
1381
|
product_variant_id: identity.product_variant_id,
|
|
@@ -2425,22 +1390,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2425
1390
|
params.product_option_item = identity.product_option_item;
|
|
2426
1391
|
}
|
|
2427
1392
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
2428
|
-
|
|
2429
|
-
return this.
|
|
1393
|
+
_context18.next = 7;
|
|
1394
|
+
return this.updateProductInOrder(params);
|
|
2430
1395
|
case 7:
|
|
2431
|
-
products =
|
|
2432
|
-
return
|
|
1396
|
+
products = _context18.sent;
|
|
1397
|
+
return _context18.abrupt("return", products);
|
|
2433
1398
|
case 11:
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
throw
|
|
1399
|
+
_context18.prev = 11;
|
|
1400
|
+
_context18.t0 = _context18["catch"](0);
|
|
1401
|
+
throw _context18.t0;
|
|
2437
1402
|
case 14:
|
|
2438
1403
|
case "end":
|
|
2439
|
-
return
|
|
1404
|
+
return _context18.stop();
|
|
2440
1405
|
}
|
|
2441
|
-
},
|
|
1406
|
+
}, _callee18, this, [[0, 11]]);
|
|
2442
1407
|
}));
|
|
2443
|
-
function setOrderProductLineNote(
|
|
1408
|
+
function setOrderProductLineNote(_x14, _x15) {
|
|
2444
1409
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
2445
1410
|
}
|
|
2446
1411
|
return setOrderProductLineNote;
|
|
@@ -2448,138 +1413,54 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2448
1413
|
}, {
|
|
2449
1414
|
key: "removeProductFromOrder",
|
|
2450
1415
|
value: function () {
|
|
2451
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1416
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(identity) {
|
|
2452
1417
|
var products;
|
|
2453
|
-
return _regeneratorRuntime().wrap(function
|
|
2454
|
-
while (1) switch (
|
|
1418
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1419
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
2455
1420
|
case 0:
|
|
2456
|
-
|
|
1421
|
+
_context19.prev = 0;
|
|
2457
1422
|
if (this.store.order) {
|
|
2458
|
-
|
|
1423
|
+
_context19.next = 3;
|
|
2459
1424
|
break;
|
|
2460
1425
|
}
|
|
2461
1426
|
throw new Error('order 模块未初始化');
|
|
2462
1427
|
case 3:
|
|
2463
|
-
|
|
1428
|
+
_context19.next = 5;
|
|
2464
1429
|
return this.store.order.removeProductFromOrder(identity);
|
|
2465
1430
|
case 5:
|
|
2466
|
-
products =
|
|
2467
|
-
return
|
|
1431
|
+
products = _context19.sent;
|
|
1432
|
+
return _context19.abrupt("return", products);
|
|
2468
1433
|
case 9:
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
throw
|
|
1434
|
+
_context19.prev = 9;
|
|
1435
|
+
_context19.t0 = _context19["catch"](0);
|
|
1436
|
+
throw _context19.t0;
|
|
2472
1437
|
case 12:
|
|
2473
1438
|
case "end":
|
|
2474
|
-
return
|
|
1439
|
+
return _context19.stop();
|
|
2475
1440
|
}
|
|
2476
|
-
},
|
|
1441
|
+
}, _callee19, this, [[0, 9]]);
|
|
2477
1442
|
}));
|
|
2478
|
-
function removeProductFromOrder(
|
|
1443
|
+
function removeProductFromOrder(_x16) {
|
|
2479
1444
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2480
1445
|
}
|
|
2481
1446
|
return removeProductFromOrder;
|
|
2482
|
-
}() //
|
|
2483
|
-
/**
|
|
2484
|
-
* 注入促销评估器到底层 OrderModule。
|
|
2485
|
-
*
|
|
2486
|
-
* @example
|
|
2487
|
-
* solution.setPromotionEvaluator(appHelper.utils.promotionEvaluator);
|
|
2488
|
-
*/
|
|
2489
|
-
}, {
|
|
2490
|
-
key: "setPromotionEvaluator",
|
|
2491
|
-
value: function setPromotionEvaluator(evaluator) {
|
|
2492
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2493
|
-
this.store.order.setPromotionEvaluator(evaluator);
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
/**
|
|
2497
|
-
* 注入赠品选择 resolver。UI 层(SalesSdk)通过 bridge 提供。
|
|
2498
|
-
*
|
|
2499
|
-
* @example
|
|
2500
|
-
* solution.setGiftSelectResolver(async (ctx) => bridge.request(ctx));
|
|
2501
|
-
*/
|
|
2502
|
-
}, {
|
|
2503
|
-
key: "setGiftSelectResolver",
|
|
2504
|
-
value: function setGiftSelectResolver(resolver) {
|
|
2505
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2506
|
-
this.store.order.setGiftSelectResolver(resolver);
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
/**
|
|
2510
|
-
* 为商品目录追加促销标签,供 SalesSdkProductProvider 等商品列表入口复用。
|
|
2511
|
-
*
|
|
2512
|
-
* @example
|
|
2513
|
-
* const products = solution.appendPromotionTags(catalogProducts);
|
|
2514
|
-
*/
|
|
2515
|
-
}, {
|
|
2516
|
-
key: "appendPromotionTags",
|
|
2517
|
-
value: function appendPromotionTags(products) {
|
|
2518
|
-
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2519
|
-
return this.store.order.appendPromotionTags(products);
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
/**
|
|
2523
|
-
* 主动触发一次促销应用(一般写路径会自动触发,少数场景如客户切换后可手动调)。
|
|
2524
|
-
*/
|
|
2525
|
-
}, {
|
|
2526
|
-
key: "applyPromotion",
|
|
2527
|
-
value: (function () {
|
|
2528
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2529
|
-
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2530
|
-
while (1) switch (_context29.prev = _context29.next) {
|
|
2531
|
-
case 0:
|
|
2532
|
-
if (this.store.order) {
|
|
2533
|
-
_context29.next = 2;
|
|
2534
|
-
break;
|
|
2535
|
-
}
|
|
2536
|
-
throw new Error('order 模块未初始化');
|
|
2537
|
-
case 2:
|
|
2538
|
-
_context29.next = 4;
|
|
2539
|
-
return this.store.order.applyPromotion();
|
|
2540
|
-
case 4:
|
|
2541
|
-
case "end":
|
|
2542
|
-
return _context29.stop();
|
|
2543
|
-
}
|
|
2544
|
-
}, _callee29, this);
|
|
2545
|
-
}));
|
|
2546
|
-
function applyPromotion() {
|
|
2547
|
-
return _applyPromotion.apply(this, arguments);
|
|
2548
|
-
}
|
|
2549
|
-
return applyPromotion;
|
|
2550
|
-
}() /** 最近一次促销计算输出的未满足提示。 */)
|
|
2551
|
-
}, {
|
|
2552
|
-
key: "getUnfulfilledPromotions",
|
|
2553
|
-
value: function getUnfulfilledPromotions() {
|
|
2554
|
-
var _this$store$order4;
|
|
2555
|
-
return ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getUnfulfilledPromotions()) || [];
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
2559
|
-
}, {
|
|
2560
|
-
key: "getLastGiftActions",
|
|
2561
|
-
value: function getLastGiftActions() {
|
|
2562
|
-
var _this$store$order5;
|
|
2563
|
-
return ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getLastGiftActions()) || null;
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
// 获取商品列表
|
|
1447
|
+
}() // 获取商品列表
|
|
2567
1448
|
// TODO 需要跟 webpos 内的对齐一下
|
|
2568
1449
|
}, {
|
|
2569
1450
|
key: "getProductList",
|
|
2570
1451
|
value: function () {
|
|
2571
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2572
|
-
var _this$
|
|
1452
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1453
|
+
var _this$otherParams6;
|
|
2573
1454
|
var menu_list_ids, _this$store$products, res;
|
|
2574
|
-
return _regeneratorRuntime().wrap(function
|
|
2575
|
-
while (1) switch (
|
|
1455
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1456
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
2576
1457
|
case 0:
|
|
2577
1458
|
// 可以直接通过配置里的 menu 读取
|
|
2578
|
-
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) {
|
|
2579
1460
|
return Number(n.value);
|
|
2580
1461
|
})) || [];
|
|
2581
|
-
|
|
2582
|
-
|
|
1462
|
+
_context20.prev = 1;
|
|
1463
|
+
_context20.next = 4;
|
|
2583
1464
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2584
1465
|
menu_list_ids: menu_list_ids,
|
|
2585
1466
|
cacheId: this.cacheId,
|
|
@@ -2587,17 +1468,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2587
1468
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2588
1469
|
});
|
|
2589
1470
|
case 4:
|
|
2590
|
-
res =
|
|
2591
|
-
return
|
|
1471
|
+
res = _context20.sent;
|
|
1472
|
+
return _context20.abrupt("return", res);
|
|
2592
1473
|
case 8:
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
throw
|
|
1474
|
+
_context20.prev = 8;
|
|
1475
|
+
_context20.t0 = _context20["catch"](1);
|
|
1476
|
+
throw _context20.t0;
|
|
2596
1477
|
case 11:
|
|
2597
1478
|
case "end":
|
|
2598
|
-
return
|
|
1479
|
+
return _context20.stop();
|
|
2599
1480
|
}
|
|
2600
|
-
},
|
|
1481
|
+
}, _callee20, this, [[1, 8]]);
|
|
2601
1482
|
}));
|
|
2602
1483
|
function getProductList() {
|
|
2603
1484
|
return _getProductList.apply(this, arguments);
|
|
@@ -2612,15 +1493,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2612
1493
|
}, {
|
|
2613
1494
|
key: "setOtherParams",
|
|
2614
1495
|
value: function () {
|
|
2615
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2616
|
-
var
|
|
2617
|
-
|
|
1496
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1497
|
+
var _ref4,
|
|
1498
|
+
_ref4$cover,
|
|
2618
1499
|
cover,
|
|
2619
|
-
|
|
2620
|
-
return _regeneratorRuntime().wrap(function
|
|
2621
|
-
while (1) switch (
|
|
1500
|
+
_args21 = arguments;
|
|
1501
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1502
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2622
1503
|
case 0:
|
|
2623
|
-
|
|
1504
|
+
_ref4 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref4$cover = _ref4.cover, cover = _ref4$cover === void 0 ? false : _ref4$cover;
|
|
2624
1505
|
if (cover) {
|
|
2625
1506
|
this.otherParams = params;
|
|
2626
1507
|
} else {
|
|
@@ -2628,11 +1509,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2628
1509
|
}
|
|
2629
1510
|
case 2:
|
|
2630
1511
|
case "end":
|
|
2631
|
-
return
|
|
1512
|
+
return _context21.stop();
|
|
2632
1513
|
}
|
|
2633
|
-
},
|
|
1514
|
+
}, _callee21, this);
|
|
2634
1515
|
}));
|
|
2635
|
-
function setOtherParams(
|
|
1516
|
+
function setOtherParams(_x17) {
|
|
2636
1517
|
return _setOtherParams.apply(this, arguments);
|
|
2637
1518
|
}
|
|
2638
1519
|
return setOtherParams;
|