@pisell/pisellos 2.2.260 → 2.2.261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/index.d.ts +0 -4
- package/dist/model/strategy/adapter/index.js +1 -5
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
- package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/dist/model/strategy/adapter/promotion/examples.js +99 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/dist/model/strategy/adapter/promotion/type.js +45 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +17 -13
- package/dist/modules/Order/index.d.ts +33 -2
- package/dist/modules/Order/index.js +615 -288
- package/dist/modules/Order/types.d.ts +20 -2
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils.d.ts +4 -0
- package/dist/modules/Order/utils.js +116 -29
- package/dist/modules/Product/types.d.ts +0 -22
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -4
- package/dist/modules/ProductList/types.d.ts +0 -2
- package/dist/modules/Rules/index.d.ts +4 -3
- package/dist/modules/Rules/index.js +42 -17
- package/dist/modules/Rules/types.d.ts +2 -1
- package/dist/modules/SalesSummary/index.d.ts +7 -3
- package/dist/modules/SalesSummary/index.js +67 -39
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +2 -1
- package/dist/modules/SurchargeList/index.d.ts +6 -4
- package/dist/modules/SurchargeList/index.js +62 -39
- package/dist/modules/SurchargeList/types.d.ts +6 -2
- package/dist/server/index.d.ts +3 -50
- package/dist/server/index.js +1075 -1040
- package/dist/server/modules/order/index.d.ts +22 -3
- package/dist/server/modules/order/index.js +398 -316
- package/dist/server/modules/products/index.d.ts +7 -26
- package/dist/server/modules/products/index.js +76 -166
- package/dist/server/modules/products/types.d.ts +0 -14
- package/dist/solution/BaseSales/index.d.ts +22 -2
- package/dist/solution/BaseSales/index.js +995 -701
- package/dist/solution/BaseSales/types.d.ts +1 -0
- package/dist/solution/BaseSales/types.js +2 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/dist/solution/BaseSales/utils/cartPromotion.js +74 -29
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +9 -1
- package/dist/solution/BookingTicket/index.js +153 -6
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/ScanOrder/index.js +31 -20
- package/dist/solution/VenueBooking/index.js +30 -19
- package/lib/model/strategy/adapter/index.d.ts +0 -4
- package/lib/model/strategy/adapter/index.js +2 -13
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
- package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
- package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
- package/lib/model/strategy/adapter/promotion/examples.js +91 -0
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +2 -0
- package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
- package/lib/model/strategy/adapter/promotion/type.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +11 -1
- package/lib/modules/Order/index.d.ts +33 -2
- package/lib/modules/Order/index.js +402 -64
- package/lib/modules/Order/types.d.ts +20 -2
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils.d.ts +4 -0
- package/lib/modules/Order/utils.js +90 -3
- package/lib/modules/Product/types.d.ts +0 -22
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -4
- package/lib/modules/ProductList/types.d.ts +0 -2
- package/lib/modules/Rules/index.d.ts +4 -3
- package/lib/modules/Rules/index.js +27 -7
- package/lib/modules/Rules/types.d.ts +2 -1
- package/lib/modules/SalesSummary/index.d.ts +7 -3
- package/lib/modules/SalesSummary/index.js +28 -11
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +2 -0
- package/lib/modules/SurchargeList/index.d.ts +6 -4
- package/lib/modules/SurchargeList/index.js +41 -21
- package/lib/modules/SurchargeList/types.d.ts +6 -2
- package/lib/server/index.d.ts +3 -50
- package/lib/server/index.js +244 -215
- package/lib/server/modules/order/index.d.ts +22 -3
- package/lib/server/modules/order/index.js +103 -53
- package/lib/server/modules/products/index.d.ts +7 -26
- package/lib/server/modules/products/index.js +35 -113
- package/lib/server/modules/products/types.d.ts +0 -14
- package/lib/solution/BaseSales/index.d.ts +22 -2
- package/lib/solution/BaseSales/index.js +246 -60
- package/lib/solution/BaseSales/types.d.ts +1 -0
- package/lib/solution/BaseSales/types.js +2 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
- package/lib/solution/BaseSales/utils/cartPromotion.js +59 -16
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +9 -1
- package/lib/solution/BookingTicket/index.js +101 -0
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/ScanOrder/index.js +8 -0
- package/lib/solution/VenueBooking/index.js +8 -0
- package/package.json +1 -1
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
- package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -152
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -755
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/dist/model/strategy/adapter/dataVariant/examples.js +0 -282
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -146
- package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
- package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -139
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -564
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
- package/lib/model/strategy/adapter/dataVariant/examples.js +0 -295
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
- package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -146
- package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
|
@@ -3,12 +3,11 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
5
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
-
function
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
12
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
14
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -30,18 +29,20 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
30
29
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
31
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
32
31
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
33
33
|
import { BaseModule } from "../../modules/BaseModule";
|
|
34
34
|
import { BaseSalesHookNames } from "./types";
|
|
35
35
|
import { OrderModule } from "../../modules/Order";
|
|
36
36
|
import Decimal from 'decimal.js';
|
|
37
37
|
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
38
38
|
import { createModule } from "../BookingByStep/types";
|
|
39
|
-
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
39
|
+
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, resolveIsFormSubject, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
41
|
export * from "./types";
|
|
42
42
|
import { QuotationModule } from "../../modules/Quotation";
|
|
43
43
|
import { transformBaseProductToOrderProduct as _transformBaseProductToOrderProduct } from "./utils/transformBaseProductToOrderProduct";
|
|
44
44
|
import { calculateBaseSalesProductBookingPrice } from "./utils/quotationPrice";
|
|
45
|
+
var SERVER_ORDER_CHANGED_EVENT = 'order:onOrdersChanged';
|
|
45
46
|
function isBaseSalesManualProductDiscountProduct(product) {
|
|
46
47
|
var _product$metadata, _product$metadata2;
|
|
47
48
|
return (product === null || product === void 0 || (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.is_manual_discount) === true || (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.is_manual_discount) === 1 || ((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (item) {
|
|
@@ -75,6 +76,16 @@ function getBaseSalesUniqueArrayMetadataKey(key) {
|
|
|
75
76
|
if (key === 'payments' || key === 'payment') return 'unique_payment_number';
|
|
76
77
|
return null;
|
|
77
78
|
}
|
|
79
|
+
function isSameBaseSalesOrderRecord(left, right) {
|
|
80
|
+
if (!left || !right || _typeof(left) !== 'object' || _typeof(right) !== 'object') return false;
|
|
81
|
+
var leftIdentities = new Set([left.order_id, left.id, left.external_sale_number, left.order_number].filter(function (value) {
|
|
82
|
+
return value !== undefined && value !== null && value !== '';
|
|
83
|
+
}).map(String));
|
|
84
|
+
if (leftIdentities.size === 0) return false;
|
|
85
|
+
return [right.order_id, right.id, right.external_sale_number, right.order_number].some(function (value) {
|
|
86
|
+
return value !== undefined && value !== null && value !== '' && leftIdentities.has(String(value));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
78
89
|
function getBaseSalesMetadataUid(item, metadataKey) {
|
|
79
90
|
var _item$metadata$metada, _item$metadata;
|
|
80
91
|
var uid = (_item$metadata$metada = item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata[metadataKey]) !== null && _item$metadata$metada !== void 0 ? _item$metadata$metada : item === null || item === void 0 ? void 0 : item[metadataKey];
|
|
@@ -153,6 +164,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
153
164
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
154
165
|
_defineProperty(_assertThisInitialized(_this), "reusedSharedSubModuleNames", new Set());
|
|
155
166
|
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
167
|
+
_defineProperty(_assertThisInitialized(_this), "queuedAutoPaymentSync", false);
|
|
168
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncFlushing", false);
|
|
169
|
+
_defineProperty(_assertThisInitialized(_this), "autoPaymentSyncTimer", null);
|
|
170
|
+
_defineProperty(_assertThisInitialized(_this), "salesDetailLoadInFlight", false);
|
|
171
|
+
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeUnsubscribe", null);
|
|
172
|
+
_defineProperty(_assertThisInitialized(_this), "serverOrderChangeHydrateInFlight", null);
|
|
156
173
|
return _this;
|
|
157
174
|
}
|
|
158
175
|
|
|
@@ -168,9 +185,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
168
185
|
}, {
|
|
169
186
|
key: "getReusableSharedSubModule",
|
|
170
187
|
value: function getReusableSharedSubModule(moduleName) {
|
|
171
|
-
var _this$core;
|
|
188
|
+
var _this$core, _this$core$getModule;
|
|
172
189
|
if (moduleName !== 'schedule' && moduleName !== 'quotation') return null;
|
|
173
|
-
return ((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.
|
|
190
|
+
return ((_this$core = this.core) === null || _this$core === void 0 || (_this$core$getModule = _this$core.getModule) === null || _this$core$getModule === void 0 ? void 0 : _this$core$getModule.call(_this$core, moduleName)) || null;
|
|
174
191
|
}
|
|
175
192
|
}, {
|
|
176
193
|
key: "isScheduleListLoaded",
|
|
@@ -232,6 +249,104 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
232
249
|
});
|
|
233
250
|
}
|
|
234
251
|
}
|
|
252
|
+
}, {
|
|
253
|
+
key: "isCurrentSalesOrderRecord",
|
|
254
|
+
value: function isCurrentSalesOrderRecord(order) {
|
|
255
|
+
var _this$store$order, _this$store$order$get;
|
|
256
|
+
var currentTempOrder = (_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);
|
|
257
|
+
var currentRecords = [currentTempOrder, this.currentSalesDetail].filter(Boolean);
|
|
258
|
+
return currentRecords.some(function (record) {
|
|
259
|
+
return isSameBaseSalesOrderRecord(record, order);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}, {
|
|
263
|
+
key: "syncCurrentSalesDetailFromServerOrderChange",
|
|
264
|
+
value: function () {
|
|
265
|
+
var _syncCurrentSalesDetailFromServerOrderChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload) {
|
|
266
|
+
var _this2 = this;
|
|
267
|
+
var changedOrders, changedOrder;
|
|
268
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
269
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
270
|
+
case 0:
|
|
271
|
+
changedOrders = Array.isArray(payload) ? payload : Array.isArray(payload === null || payload === void 0 ? void 0 : payload.changedOrders) ? payload.changedOrders : payload !== null && payload !== void 0 && payload.data && _typeof(payload.data) === 'object' ? [payload.data] : [];
|
|
272
|
+
if (!(this.salesDetailLoadInFlight || this.serverOrderChangeHydrateInFlight)) {
|
|
273
|
+
_context2.next = 3;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
return _context2.abrupt("return");
|
|
277
|
+
case 3:
|
|
278
|
+
changedOrder = changedOrders.find(function (order) {
|
|
279
|
+
return _this2.isCurrentSalesOrderRecord(order);
|
|
280
|
+
});
|
|
281
|
+
if (changedOrder) {
|
|
282
|
+
_context2.next = 6;
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
return _context2.abrupt("return");
|
|
286
|
+
case 6:
|
|
287
|
+
if (this.store.order) {
|
|
288
|
+
_context2.next = 8;
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
return _context2.abrupt("return");
|
|
292
|
+
case 8:
|
|
293
|
+
this.serverOrderChangeHydrateInFlight = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
294
|
+
var sales;
|
|
295
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
296
|
+
while (1) switch (_context.prev = _context.next) {
|
|
297
|
+
case 0:
|
|
298
|
+
_context.next = 2;
|
|
299
|
+
return _this2.store.order.hydrateTempOrderFromRecord(changedOrder, {
|
|
300
|
+
recalcOnHydrate: false
|
|
301
|
+
});
|
|
302
|
+
case 2:
|
|
303
|
+
sales = _context.sent;
|
|
304
|
+
_this2.currentSalesDetail = sales;
|
|
305
|
+
_context.next = 6;
|
|
306
|
+
return _this2.core.effects.emit("".concat(_this2.name, ":onSalesOrderLoaded"), {
|
|
307
|
+
sales: sales
|
|
308
|
+
});
|
|
309
|
+
case 6:
|
|
310
|
+
case "end":
|
|
311
|
+
return _context.stop();
|
|
312
|
+
}
|
|
313
|
+
}, _callee);
|
|
314
|
+
}))();
|
|
315
|
+
_context2.prev = 9;
|
|
316
|
+
_context2.next = 12;
|
|
317
|
+
return this.serverOrderChangeHydrateInFlight;
|
|
318
|
+
case 12:
|
|
319
|
+
_context2.prev = 12;
|
|
320
|
+
this.serverOrderChangeHydrateInFlight = null;
|
|
321
|
+
return _context2.finish(12);
|
|
322
|
+
case 15:
|
|
323
|
+
case "end":
|
|
324
|
+
return _context2.stop();
|
|
325
|
+
}
|
|
326
|
+
}, _callee2, this, [[9,, 12, 15]]);
|
|
327
|
+
}));
|
|
328
|
+
function syncCurrentSalesDetailFromServerOrderChange(_x) {
|
|
329
|
+
return _syncCurrentSalesDetailFromServerOrderChange.apply(this, arguments);
|
|
330
|
+
}
|
|
331
|
+
return syncCurrentSalesDetailFromServerOrderChange;
|
|
332
|
+
}()
|
|
333
|
+
}, {
|
|
334
|
+
key: "registerServerOrderChangeSync",
|
|
335
|
+
value: function registerServerOrderChangeSync() {
|
|
336
|
+
var _this$serverOrderChan,
|
|
337
|
+
_this$core2,
|
|
338
|
+
_this3 = this;
|
|
339
|
+
(_this$serverOrderChan = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan === void 0 || _this$serverOrderChan.call(this);
|
|
340
|
+
var effects = (_this$core2 = this.core) === null || _this$core2 === void 0 ? void 0 : _this$core2.effects;
|
|
341
|
+
if (!effects || typeof effects.on !== 'function') return;
|
|
342
|
+
this.serverOrderChangeUnsubscribe = effects.on(SERVER_ORDER_CHANGED_EVENT, function (payload) {
|
|
343
|
+
void _this3.syncCurrentSalesDetailFromServerOrderChange(payload).catch(function (error) {
|
|
344
|
+
_this3.logError('sync sales detail from server order change failed', {
|
|
345
|
+
error: error instanceof Error ? error.message : String(error)
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
}
|
|
235
350
|
}, {
|
|
236
351
|
key: "hydrateOrderPaymentNames",
|
|
237
352
|
value: function hydrateOrderPaymentNames(payments) {
|
|
@@ -269,8 +384,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
269
384
|
}, {
|
|
270
385
|
key: "getCurrentOrderCustomerId",
|
|
271
386
|
value: function getCurrentOrderCustomerId() {
|
|
272
|
-
var _this$store$
|
|
273
|
-
var tempOrder = (_this$store$
|
|
387
|
+
var _this$store$order2, _this$store$order2$ge;
|
|
388
|
+
var tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
274
389
|
var customerId = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
275
390
|
if (customerId === null || customerId === undefined) return undefined;
|
|
276
391
|
return customerId;
|
|
@@ -296,10 +411,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
296
411
|
});
|
|
297
412
|
}
|
|
298
413
|
quotation.setScheduleResolver(function (id) {
|
|
299
|
-
var _scheduleModule$getSc, _getScheduleByIds,
|
|
414
|
+
var _scheduleModule$getSc, _getScheduleByIds, _ref2;
|
|
300
415
|
var scheduleId = String(id);
|
|
301
416
|
if (scheduleById.has(scheduleId)) return scheduleById.get(scheduleId);
|
|
302
|
-
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (
|
|
417
|
+
var schedules = ((_scheduleModule$getSc = scheduleModule.getScheduleListByIds) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule, [id])) || ((_getScheduleByIds = (_ref2 = scheduleModule).getScheduleByIds) === null || _getScheduleByIds === void 0 ? void 0 : _getScheduleByIds.call(_ref2, [id])) || [];
|
|
303
418
|
if (schedules[0]) scheduleById.set(scheduleId, schedules[0]);
|
|
304
419
|
return schedules[0];
|
|
305
420
|
});
|
|
@@ -307,30 +422,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
307
422
|
}, {
|
|
308
423
|
key: "loadQuotationForPriceQuery",
|
|
309
424
|
value: function () {
|
|
310
|
-
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
425
|
+
var _loadQuotationForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
311
426
|
var _this$otherParams;
|
|
312
|
-
return _regeneratorRuntime().wrap(function
|
|
313
|
-
while (1) switch (
|
|
427
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
428
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
314
429
|
case 0:
|
|
315
430
|
if (params.quotation) {
|
|
316
|
-
|
|
431
|
+
_context3.next = 2;
|
|
317
432
|
break;
|
|
318
433
|
}
|
|
319
|
-
return
|
|
434
|
+
return _context3.abrupt("return");
|
|
320
435
|
case 2:
|
|
321
436
|
this.applyQuotationScheduleResolver(params.quotation);
|
|
322
|
-
|
|
437
|
+
_context3.next = 5;
|
|
323
438
|
return params.quotation.loadQuotations({
|
|
324
439
|
channel: params.channel || ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel),
|
|
325
440
|
customer_id: params.customer_id
|
|
326
441
|
});
|
|
327
442
|
case 5:
|
|
328
443
|
case "end":
|
|
329
|
-
return
|
|
444
|
+
return _context3.stop();
|
|
330
445
|
}
|
|
331
|
-
},
|
|
446
|
+
}, _callee3, this);
|
|
332
447
|
}));
|
|
333
|
-
function loadQuotationForPriceQuery(
|
|
448
|
+
function loadQuotationForPriceQuery(_x2) {
|
|
334
449
|
return _loadQuotationForPriceQuery.apply(this, arguments);
|
|
335
450
|
}
|
|
336
451
|
return loadQuotationForPriceQuery;
|
|
@@ -374,23 +489,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
374
489
|
}, {
|
|
375
490
|
key: "loadProductsForPriceQuery",
|
|
376
491
|
value: function () {
|
|
377
|
-
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
492
|
+
var _loadProductsForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
378
493
|
var ids, productsById, _this$otherParams2, _response$data, response, list;
|
|
379
|
-
return _regeneratorRuntime().wrap(function
|
|
380
|
-
while (1) switch (
|
|
494
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
495
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
381
496
|
case 0:
|
|
382
497
|
ids = Array.from(new Set(params.ids.filter(function (id) {
|
|
383
498
|
return Number.isFinite(id);
|
|
384
499
|
})));
|
|
385
500
|
productsById = new Map();
|
|
386
501
|
if (!(!ids.length || !this.request)) {
|
|
387
|
-
|
|
502
|
+
_context4.next = 4;
|
|
388
503
|
break;
|
|
389
504
|
}
|
|
390
|
-
return
|
|
505
|
+
return _context4.abrupt("return", productsById);
|
|
391
506
|
case 4:
|
|
392
|
-
|
|
393
|
-
|
|
507
|
+
_context4.prev = 4;
|
|
508
|
+
_context4.next = 7;
|
|
394
509
|
return this.request.post('/product/query', {
|
|
395
510
|
ids: ids,
|
|
396
511
|
open_quotation: 1,
|
|
@@ -407,35 +522,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
407
522
|
customToast: function customToast() {}
|
|
408
523
|
});
|
|
409
524
|
case 7:
|
|
410
|
-
response =
|
|
525
|
+
response = _context4.sent;
|
|
411
526
|
list = (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
|
|
412
527
|
if (Array.isArray(list)) {
|
|
413
|
-
|
|
528
|
+
_context4.next = 11;
|
|
414
529
|
break;
|
|
415
530
|
}
|
|
416
|
-
return
|
|
531
|
+
return _context4.abrupt("return", productsById);
|
|
417
532
|
case 11:
|
|
418
533
|
list.forEach(function (item) {
|
|
419
534
|
var _item$id;
|
|
420
535
|
var productId = Number((_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id);
|
|
421
536
|
if (Number.isFinite(productId)) productsById.set(productId, item);
|
|
422
537
|
});
|
|
423
|
-
return
|
|
538
|
+
return _context4.abrupt("return", productsById);
|
|
424
539
|
case 15:
|
|
425
|
-
|
|
426
|
-
|
|
540
|
+
_context4.prev = 15;
|
|
541
|
+
_context4.t0 = _context4["catch"](4);
|
|
427
542
|
this.logWarning('loadProductsForPriceQuery: 商品批量重查失败,使用入参 fallback', {
|
|
428
543
|
ids: ids,
|
|
429
|
-
error:
|
|
544
|
+
error: _context4.t0 instanceof Error ? _context4.t0.message : String(_context4.t0)
|
|
430
545
|
});
|
|
431
|
-
return
|
|
546
|
+
return _context4.abrupt("return", productsById);
|
|
432
547
|
case 19:
|
|
433
548
|
case "end":
|
|
434
|
-
return
|
|
549
|
+
return _context4.stop();
|
|
435
550
|
}
|
|
436
|
-
},
|
|
551
|
+
}, _callee4, this, [[4, 15]]);
|
|
437
552
|
}));
|
|
438
|
-
function loadProductsForPriceQuery(
|
|
553
|
+
function loadProductsForPriceQuery(_x3) {
|
|
439
554
|
return _loadProductsForPriceQuery.apply(this, arguments);
|
|
440
555
|
}
|
|
441
556
|
return loadProductsForPriceQuery;
|
|
@@ -443,21 +558,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
443
558
|
}, {
|
|
444
559
|
key: "loadProductForPriceQuery",
|
|
445
560
|
value: function () {
|
|
446
|
-
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
561
|
+
var _loadProductForPriceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params, customerId) {
|
|
447
562
|
var product, productId, schedule, productsById;
|
|
448
|
-
return _regeneratorRuntime().wrap(function
|
|
449
|
-
while (1) switch (
|
|
563
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
564
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
450
565
|
case 0:
|
|
451
566
|
product = params.product || {};
|
|
452
567
|
productId = this.getPriceQueryProductId(product);
|
|
453
568
|
if (!(productId === null || !this.request)) {
|
|
454
|
-
|
|
569
|
+
_context5.next = 4;
|
|
455
570
|
break;
|
|
456
571
|
}
|
|
457
|
-
return
|
|
572
|
+
return _context5.abrupt("return", null);
|
|
458
573
|
case 4:
|
|
459
574
|
schedule = this.getPriceQuerySchedule(params);
|
|
460
|
-
|
|
575
|
+
_context5.next = 7;
|
|
461
576
|
return this.loadProductsForPriceQuery({
|
|
462
577
|
ids: [productId],
|
|
463
578
|
schedule: schedule,
|
|
@@ -465,15 +580,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
465
580
|
channel: params.channel
|
|
466
581
|
});
|
|
467
582
|
case 7:
|
|
468
|
-
productsById =
|
|
469
|
-
return
|
|
583
|
+
productsById = _context5.sent;
|
|
584
|
+
return _context5.abrupt("return", productsById.get(productId) || null);
|
|
470
585
|
case 9:
|
|
471
586
|
case "end":
|
|
472
|
-
return
|
|
587
|
+
return _context5.stop();
|
|
473
588
|
}
|
|
474
|
-
},
|
|
589
|
+
}, _callee5, this);
|
|
475
590
|
}));
|
|
476
|
-
function loadProductForPriceQuery(
|
|
591
|
+
function loadProductForPriceQuery(_x4, _x5) {
|
|
477
592
|
return _loadProductForPriceQuery.apply(this, arguments);
|
|
478
593
|
}
|
|
479
594
|
return loadProductForPriceQuery;
|
|
@@ -486,10 +601,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
486
601
|
return groups.flatMap(function (group) {
|
|
487
602
|
var items = Array.isArray(group === null || group === void 0 ? void 0 : group.bundle_item) ? group.bundle_item : Array.isArray(group === null || group === void 0 ? void 0 : group.bundleItem) ? group.bundleItem : [];
|
|
488
603
|
return items.map(function (item) {
|
|
489
|
-
var _item$group_id,
|
|
604
|
+
var _item$group_id, _ref3, _item$bundle_group_id;
|
|
490
605
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
491
606
|
group_id: (_item$group_id = item === null || item === void 0 ? void 0 : item.group_id) !== null && _item$group_id !== void 0 ? _item$group_id : group === null || group === void 0 ? void 0 : group.id,
|
|
492
|
-
bundle_group_id: (
|
|
607
|
+
bundle_group_id: (_ref3 = (_item$bundle_group_id = item === null || item === void 0 ? void 0 : item.bundle_group_id) !== null && _item$bundle_group_id !== void 0 ? _item$bundle_group_id : item === null || item === void 0 ? void 0 : item.group_id) !== null && _ref3 !== void 0 ? _ref3 : group === null || group === void 0 ? void 0 : group.id
|
|
493
608
|
});
|
|
494
609
|
});
|
|
495
610
|
});
|
|
@@ -520,21 +635,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
520
635
|
}, {
|
|
521
636
|
key: "getAuthoritativeBundleUnitPrice",
|
|
522
637
|
value: function getAuthoritativeBundleUnitPrice(bundle) {
|
|
523
|
-
var
|
|
524
|
-
return (
|
|
638
|
+
var _ref4, _ref5, _ref6, _bundle$price;
|
|
639
|
+
return (_ref4 = (_ref5 = (_ref6 = (_bundle$price = bundle.price) !== null && _bundle$price !== void 0 ? _bundle$price : bundle.bundle_selling_price) !== null && _ref6 !== void 0 ? _ref6 : bundle.custom_price) !== null && _ref5 !== void 0 ? _ref5 : bundle.product_price) !== null && _ref4 !== void 0 ? _ref4 : bundle.base_price;
|
|
525
640
|
}
|
|
526
641
|
}, {
|
|
527
642
|
key: "mergeProductForPriceQuery",
|
|
528
643
|
value: function mergeProductForPriceQuery(product, authoritativeProduct) {
|
|
529
|
-
var
|
|
644
|
+
var _this4 = this,
|
|
530
645
|
_product$id,
|
|
531
|
-
_ref6,
|
|
532
|
-
_product$product_id2,
|
|
533
646
|
_ref7,
|
|
534
|
-
_product$
|
|
647
|
+
_product$product_id2,
|
|
535
648
|
_ref8,
|
|
536
|
-
_product$
|
|
649
|
+
_product$product_vari,
|
|
537
650
|
_ref9,
|
|
651
|
+
_product$num,
|
|
652
|
+
_ref10,
|
|
538
653
|
_product$quantity,
|
|
539
654
|
_product$metadata4;
|
|
540
655
|
if (!authoritativeProduct) return product;
|
|
@@ -542,8 +657,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
542
657
|
var authoritativeBundles = this.getAuthoritativeBundleItems(authoritativeProduct);
|
|
543
658
|
var productBundle = selectedBundles.map(function (bundle) {
|
|
544
659
|
var _authoritativeBundle$, _authoritativeBundle$2;
|
|
545
|
-
var authoritativeBundle =
|
|
546
|
-
var unitPrice = authoritativeBundle ?
|
|
660
|
+
var authoritativeBundle = _this4.findAuthoritativeBundleItem(bundle, authoritativeBundles);
|
|
661
|
+
var unitPrice = authoritativeBundle ? _this4.getAuthoritativeBundleUnitPrice(authoritativeBundle) : undefined;
|
|
547
662
|
if (unitPrice === undefined || unitPrice === null || unitPrice === '') return bundle;
|
|
548
663
|
return _objectSpread(_objectSpread({}, bundle), {}, {
|
|
549
664
|
price: unitPrice,
|
|
@@ -554,10 +669,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
554
669
|
});
|
|
555
670
|
return _objectSpread(_objectSpread(_objectSpread({}, product), authoritativeProduct), {}, {
|
|
556
671
|
id: (_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : authoritativeProduct.id,
|
|
557
|
-
product_id: (
|
|
558
|
-
product_variant_id: (
|
|
559
|
-
num: (
|
|
560
|
-
quantity: (
|
|
672
|
+
product_id: (_ref7 = (_product$product_id2 = product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : authoritativeProduct.product_id) !== null && _ref7 !== void 0 ? _ref7 : authoritativeProduct.id,
|
|
673
|
+
product_variant_id: (_ref8 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : authoritativeProduct.product_variant_id) !== null && _ref8 !== void 0 ? _ref8 : 0,
|
|
674
|
+
num: (_ref9 = (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : product.quantity) !== null && _ref9 !== void 0 ? _ref9 : authoritativeProduct.num,
|
|
675
|
+
quantity: (_ref10 = (_product$quantity = product.quantity) !== null && _product$quantity !== void 0 ? _product$quantity : product.num) !== null && _ref10 !== void 0 ? _ref10 : authoritativeProduct.quantity,
|
|
561
676
|
product_sku: function () {
|
|
562
677
|
var authoritativeSku = ensureProductSku(authoritativeProduct);
|
|
563
678
|
var productSku = ensureProductSku(product);
|
|
@@ -631,61 +746,61 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
631
746
|
}, {
|
|
632
747
|
key: "syncOtherParamsToSubModules",
|
|
633
748
|
value: (function () {
|
|
634
|
-
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
635
|
-
var
|
|
636
|
-
var
|
|
637
|
-
|
|
749
|
+
var _syncOtherParamsToSubModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(changedParams) {
|
|
750
|
+
var _this5 = this;
|
|
751
|
+
var _ref11,
|
|
752
|
+
_ref11$cover,
|
|
638
753
|
cover,
|
|
639
754
|
nextSubModuleOtherParams,
|
|
640
|
-
|
|
641
|
-
return _regeneratorRuntime().wrap(function
|
|
642
|
-
while (1) switch (
|
|
755
|
+
_args7 = arguments;
|
|
756
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
757
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
643
758
|
case 0:
|
|
644
|
-
|
|
759
|
+
_ref11 = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {}, _ref11$cover = _ref11.cover, cover = _ref11$cover === void 0 ? false : _ref11$cover;
|
|
645
760
|
nextSubModuleOtherParams = this.buildSubModuleOtherParams();
|
|
646
|
-
|
|
761
|
+
_context7.next = 4;
|
|
647
762
|
return Promise.all(Object.entries(this.store).map( /*#__PURE__*/function () {
|
|
648
|
-
var
|
|
649
|
-
var
|
|
650
|
-
return _regeneratorRuntime().wrap(function
|
|
651
|
-
while (1) switch (
|
|
763
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref12) {
|
|
764
|
+
var _ref14, moduleName, subModule, targetModule;
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
766
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
652
767
|
case 0:
|
|
653
|
-
|
|
654
|
-
if (!
|
|
655
|
-
|
|
768
|
+
_ref14 = _slicedToArray(_ref12, 2), moduleName = _ref14[0], subModule = _ref14[1];
|
|
769
|
+
if (!_this5.reusedSharedSubModuleNames.has(moduleName)) {
|
|
770
|
+
_context6.next = 3;
|
|
656
771
|
break;
|
|
657
772
|
}
|
|
658
|
-
return
|
|
773
|
+
return _context6.abrupt("return");
|
|
659
774
|
case 3:
|
|
660
775
|
targetModule = subModule;
|
|
661
776
|
if (!(!targetModule || typeof targetModule.updateOtherParams !== 'function')) {
|
|
662
|
-
|
|
777
|
+
_context6.next = 6;
|
|
663
778
|
break;
|
|
664
779
|
}
|
|
665
|
-
return
|
|
780
|
+
return _context6.abrupt("return");
|
|
666
781
|
case 6:
|
|
667
|
-
|
|
782
|
+
_context6.next = 8;
|
|
668
783
|
return targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
669
784
|
changedParams: changedParams,
|
|
670
785
|
cover: cover
|
|
671
786
|
});
|
|
672
787
|
case 8:
|
|
673
788
|
case "end":
|
|
674
|
-
return
|
|
789
|
+
return _context6.stop();
|
|
675
790
|
}
|
|
676
|
-
},
|
|
791
|
+
}, _callee6);
|
|
677
792
|
}));
|
|
678
|
-
return function (
|
|
679
|
-
return
|
|
793
|
+
return function (_x7) {
|
|
794
|
+
return _ref13.apply(this, arguments);
|
|
680
795
|
};
|
|
681
796
|
}()));
|
|
682
797
|
case 4:
|
|
683
798
|
case "end":
|
|
684
|
-
return
|
|
799
|
+
return _context7.stop();
|
|
685
800
|
}
|
|
686
|
-
},
|
|
801
|
+
}, _callee7, this);
|
|
687
802
|
}));
|
|
688
|
-
function syncOtherParamsToSubModules(
|
|
803
|
+
function syncOtherParamsToSubModules(_x6) {
|
|
689
804
|
return _syncOtherParamsToSubModules.apply(this, arguments);
|
|
690
805
|
}
|
|
691
806
|
return syncOtherParamsToSubModules;
|
|
@@ -759,19 +874,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
759
874
|
}, {
|
|
760
875
|
key: "initialize",
|
|
761
876
|
value: function () {
|
|
762
|
-
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
877
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(core) {
|
|
763
878
|
var _this$otherParams4,
|
|
764
|
-
|
|
879
|
+
_this6 = this,
|
|
765
880
|
_this$otherParams5;
|
|
766
881
|
var options,
|
|
767
882
|
app,
|
|
768
883
|
targetCacheData,
|
|
769
884
|
moduleNames,
|
|
770
|
-
|
|
771
|
-
return _regeneratorRuntime().wrap(function
|
|
772
|
-
while (1) switch (
|
|
885
|
+
_args8 = arguments;
|
|
886
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
887
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
773
888
|
case 0:
|
|
774
|
-
options =
|
|
889
|
+
options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
|
|
775
890
|
this.core = core;
|
|
776
891
|
this.initializeOptions = options || {};
|
|
777
892
|
// this.store = { ...this.store, ...(options.store as Partial<BaseSalesState>) };
|
|
@@ -784,7 +899,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
784
899
|
// 获取 logger 实例
|
|
785
900
|
this.appPlugin = core.getPlugin('app');
|
|
786
901
|
if (this.appPlugin) {
|
|
787
|
-
|
|
902
|
+
_context8.next = 11;
|
|
788
903
|
break;
|
|
789
904
|
}
|
|
790
905
|
throw new Error('Checkout 解决方案需要 app 插件支持');
|
|
@@ -794,47 +909,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
794
909
|
targetCacheData = this.readSessionCacheData();
|
|
795
910
|
moduleNames = this.getRegisteredModuleNames();
|
|
796
911
|
moduleNames.forEach(function (step) {
|
|
797
|
-
var reusedModule =
|
|
912
|
+
var reusedModule = _this6.getReusableSharedSubModule(step);
|
|
798
913
|
if (reusedModule) {
|
|
799
|
-
|
|
800
|
-
|
|
914
|
+
_this6.store[step] = reusedModule;
|
|
915
|
+
_this6.reusedSharedSubModuleNames.add(step);
|
|
801
916
|
return;
|
|
802
917
|
}
|
|
803
|
-
var targetModule =
|
|
918
|
+
var targetModule = _this6.createSubModule(step);
|
|
804
919
|
if (!targetModule) {
|
|
805
920
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
806
921
|
}
|
|
807
|
-
var hooks =
|
|
808
|
-
|
|
809
|
-
|
|
922
|
+
var hooks = _this6.getSubModuleHooks(step);
|
|
923
|
+
_this6.store[step] = targetModule;
|
|
924
|
+
_this6.core.registerModule(targetModule, _objectSpread(_objectSpread({
|
|
810
925
|
initialState: (targetCacheData === null || targetCacheData === void 0 ? void 0 : targetCacheData[targetModule.name]) || {}
|
|
811
926
|
}, hooks ? {
|
|
812
927
|
hooks: hooks
|
|
813
928
|
} : {}), {}, {
|
|
814
|
-
otherParams:
|
|
929
|
+
otherParams: _this6.buildSubModuleOtherParams()
|
|
815
930
|
}));
|
|
816
931
|
});
|
|
817
932
|
if (!(this.store.schedule && !this.isScheduleListLoaded(this.store.schedule))) {
|
|
818
|
-
|
|
933
|
+
_context8.next = 19;
|
|
819
934
|
break;
|
|
820
935
|
}
|
|
821
|
-
|
|
936
|
+
_context8.next = 19;
|
|
822
937
|
return this.store.schedule.loadAllSchedule();
|
|
823
938
|
case 19:
|
|
824
939
|
if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
|
|
825
940
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
826
941
|
}
|
|
827
|
-
|
|
942
|
+
_context8.next = 22;
|
|
828
943
|
return this.getPaymentMethodsAsync();
|
|
829
944
|
case 22:
|
|
945
|
+
this.registerServerOrderChangeSync();
|
|
830
946
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
831
|
-
case
|
|
947
|
+
case 24:
|
|
832
948
|
case "end":
|
|
833
|
-
return
|
|
949
|
+
return _context8.stop();
|
|
834
950
|
}
|
|
835
|
-
},
|
|
951
|
+
}, _callee8, this);
|
|
836
952
|
}));
|
|
837
|
-
function initialize(
|
|
953
|
+
function initialize(_x8) {
|
|
838
954
|
return _initialize.apply(this, arguments);
|
|
839
955
|
}
|
|
840
956
|
return initialize;
|
|
@@ -842,14 +958,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
842
958
|
}, {
|
|
843
959
|
key: "destroy",
|
|
844
960
|
value: function () {
|
|
845
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
846
|
-
var
|
|
847
|
-
|
|
848
|
-
|
|
961
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
962
|
+
var _this$serverOrderChan2,
|
|
963
|
+
_this7 = this;
|
|
964
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
965
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
849
966
|
case 0:
|
|
967
|
+
(_this$serverOrderChan2 = this.serverOrderChangeUnsubscribe) === null || _this$serverOrderChan2 === void 0 || _this$serverOrderChan2.call(this);
|
|
968
|
+
this.serverOrderChangeUnsubscribe = null;
|
|
850
969
|
Object.keys(this.store).forEach(function (key) {
|
|
851
|
-
if (
|
|
852
|
-
var sub =
|
|
970
|
+
if (_this7.reusedSharedSubModuleNames.has(key)) return;
|
|
971
|
+
var sub = _this7.store[key];
|
|
853
972
|
if (sub && typeof sub.destroy === 'function') {
|
|
854
973
|
try {
|
|
855
974
|
sub.destroy();
|
|
@@ -859,15 +978,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
859
978
|
}
|
|
860
979
|
});
|
|
861
980
|
this.currentSalesDetail = null;
|
|
862
|
-
|
|
981
|
+
_context9.next = 6;
|
|
863
982
|
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
864
|
-
case
|
|
983
|
+
case 6:
|
|
865
984
|
_get(_getPrototypeOf(BaseSalesImpl.prototype), "destroy", this).call(this);
|
|
866
|
-
case
|
|
985
|
+
case 7:
|
|
867
986
|
case "end":
|
|
868
|
-
return
|
|
987
|
+
return _context9.stop();
|
|
869
988
|
}
|
|
870
|
-
},
|
|
989
|
+
}, _callee9, this);
|
|
871
990
|
}));
|
|
872
991
|
function destroy() {
|
|
873
992
|
return _destroy.apply(this, arguments);
|
|
@@ -884,77 +1003,82 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
884
1003
|
}, {
|
|
885
1004
|
key: "loadSalesDetail",
|
|
886
1005
|
value: (function () {
|
|
887
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
888
|
-
var
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
1006
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
|
|
1007
|
+
var _ref15, _ref16, _ref17, _ref18, _params$orderId, params, externalSaleNumber, preloadedSalesDetail, lookup, loadedRecord, message, remoteRecord, currentTempOrder, record, sales;
|
|
1008
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1009
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
892
1010
|
case 0:
|
|
893
1011
|
if (this.store.order) {
|
|
894
|
-
|
|
1012
|
+
_context10.next = 2;
|
|
895
1013
|
break;
|
|
896
1014
|
}
|
|
897
1015
|
throw new Error('order 模块未初始化');
|
|
898
1016
|
case 2:
|
|
1017
|
+
this.salesDetailLoadInFlight = true;
|
|
1018
|
+
_context10.prev = 3;
|
|
899
1019
|
params = _typeof(orderIdOrParams) === 'object' ? orderIdOrParams : {
|
|
900
1020
|
orderId: orderIdOrParams
|
|
901
1021
|
};
|
|
902
1022
|
externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
|
|
903
1023
|
preloadedSalesDetail = params.preloadedSalesDetail;
|
|
904
|
-
lookup = (
|
|
1024
|
+
lookup = (_ref15 = (_ref16 = (_ref17 = (_ref18 = (_params$orderId = params.orderId) !== null && _params$orderId !== void 0 ? _params$orderId : externalSaleNumber) !== null && _ref18 !== void 0 ? _ref18 : params.orderNumber) !== null && _ref17 !== void 0 ? _ref17 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_id) !== null && _ref16 !== void 0 ? _ref16 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.external_sale_number) !== null && _ref15 !== void 0 ? _ref15 : preloadedSalesDetail === null || preloadedSalesDetail === void 0 ? void 0 : preloadedSalesDetail.order_number;
|
|
905
1025
|
if (!(!preloadedSalesDetail && (lookup === undefined || lookup === null || lookup === ''))) {
|
|
906
|
-
|
|
1026
|
+
_context10.next = 10;
|
|
907
1027
|
break;
|
|
908
1028
|
}
|
|
909
1029
|
throw new Error('加载销售详情需要 orderId、externalSaleNumber 或 orderNumber');
|
|
910
|
-
case
|
|
1030
|
+
case 10:
|
|
911
1031
|
if (!(preloadedSalesDetail !== null && preloadedSalesDetail !== void 0)) {
|
|
912
|
-
|
|
1032
|
+
_context10.next = 14;
|
|
913
1033
|
break;
|
|
914
1034
|
}
|
|
915
|
-
|
|
916
|
-
|
|
1035
|
+
_context10.t0 = preloadedSalesDetail;
|
|
1036
|
+
_context10.next = 17;
|
|
917
1037
|
break;
|
|
918
|
-
case
|
|
919
|
-
|
|
1038
|
+
case 14:
|
|
1039
|
+
_context10.next = 16;
|
|
920
1040
|
return this.store.order.getSalesOrderByLookup({
|
|
921
1041
|
lookup: lookup,
|
|
922
1042
|
forceRemote: params.forceRemote
|
|
923
1043
|
});
|
|
924
|
-
case
|
|
925
|
-
|
|
926
|
-
case
|
|
927
|
-
loadedRecord =
|
|
1044
|
+
case 16:
|
|
1045
|
+
_context10.t0 = _context10.sent;
|
|
1046
|
+
case 17:
|
|
1047
|
+
loadedRecord = _context10.t0;
|
|
928
1048
|
if (!(!preloadedSalesDetail && (!loadedRecord || loadedRecord.code !== 200))) {
|
|
929
|
-
|
|
1049
|
+
_context10.next = 21;
|
|
930
1050
|
break;
|
|
931
1051
|
}
|
|
932
1052
|
message = loadedRecord && (loadedRecord.message || loadedRecord.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
933
1053
|
throw new Error(message);
|
|
934
|
-
case
|
|
1054
|
+
case 21:
|
|
935
1055
|
remoteRecord = preloadedSalesDetail !== null && preloadedSalesDetail !== void 0 ? preloadedSalesDetail : loadedRecord.data;
|
|
936
1056
|
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
937
1057
|
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, remoteRecord) : remoteRecord;
|
|
938
|
-
|
|
1058
|
+
_context10.next = 26;
|
|
939
1059
|
return this.store.order.hydrateTempOrderFromRecord(record, {
|
|
940
1060
|
recalcOnHydrate: false
|
|
941
1061
|
});
|
|
942
|
-
case
|
|
943
|
-
sales =
|
|
1062
|
+
case 26:
|
|
1063
|
+
sales = _context10.sent;
|
|
944
1064
|
this.currentSalesDetail = sales;
|
|
945
|
-
|
|
1065
|
+
_context10.next = 30;
|
|
946
1066
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
947
1067
|
sales: sales
|
|
948
1068
|
});
|
|
949
|
-
case
|
|
950
|
-
return
|
|
951
|
-
case
|
|
1069
|
+
case 30:
|
|
1070
|
+
return _context10.abrupt("return", sales);
|
|
1071
|
+
case 31:
|
|
1072
|
+
_context10.prev = 31;
|
|
1073
|
+
this.salesDetailLoadInFlight = false;
|
|
1074
|
+
return _context10.finish(31);
|
|
1075
|
+
case 34:
|
|
952
1076
|
case "end":
|
|
953
|
-
return
|
|
1077
|
+
return _context10.stop();
|
|
954
1078
|
}
|
|
955
|
-
},
|
|
1079
|
+
}, _callee10, this, [[3,, 31, 34]]);
|
|
956
1080
|
}));
|
|
957
|
-
function loadSalesDetail(
|
|
1081
|
+
function loadSalesDetail(_x9) {
|
|
958
1082
|
return _loadSalesDetail.apply(this, arguments);
|
|
959
1083
|
}
|
|
960
1084
|
return loadSalesDetail;
|
|
@@ -1027,41 +1151,41 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1027
1151
|
}, {
|
|
1028
1152
|
key: "getTempOrder",
|
|
1029
1153
|
value: function getTempOrder() {
|
|
1030
|
-
var _this$store$
|
|
1031
|
-
var result = ((_this$store$
|
|
1154
|
+
var _this$store$order3;
|
|
1155
|
+
var result = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder()) || null;
|
|
1032
1156
|
return result;
|
|
1033
1157
|
}
|
|
1034
1158
|
}, {
|
|
1035
1159
|
key: "replaceTempOrder",
|
|
1036
1160
|
value: function () {
|
|
1037
|
-
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1161
|
+
var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(tempOrder) {
|
|
1038
1162
|
var nextTempOrder;
|
|
1039
|
-
return _regeneratorRuntime().wrap(function
|
|
1040
|
-
while (1) switch (
|
|
1163
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1164
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1041
1165
|
case 0:
|
|
1042
1166
|
if (this.store.order) {
|
|
1043
|
-
|
|
1167
|
+
_context11.next = 2;
|
|
1044
1168
|
break;
|
|
1045
1169
|
}
|
|
1046
1170
|
throw new Error('order 模块未初始化');
|
|
1047
1171
|
case 2:
|
|
1048
|
-
|
|
1172
|
+
_context11.next = 4;
|
|
1049
1173
|
return this.store.order.replaceTempOrder(tempOrder);
|
|
1050
1174
|
case 4:
|
|
1051
|
-
nextTempOrder =
|
|
1052
|
-
|
|
1175
|
+
nextTempOrder = _context11.sent;
|
|
1176
|
+
_context11.next = 7;
|
|
1053
1177
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1054
1178
|
tempOrder: nextTempOrder
|
|
1055
1179
|
});
|
|
1056
1180
|
case 7:
|
|
1057
|
-
return
|
|
1181
|
+
return _context11.abrupt("return", nextTempOrder);
|
|
1058
1182
|
case 8:
|
|
1059
1183
|
case "end":
|
|
1060
|
-
return
|
|
1184
|
+
return _context11.stop();
|
|
1061
1185
|
}
|
|
1062
|
-
},
|
|
1186
|
+
}, _callee11, this);
|
|
1063
1187
|
}));
|
|
1064
|
-
function replaceTempOrder(
|
|
1188
|
+
function replaceTempOrder(_x10) {
|
|
1065
1189
|
return _replaceTempOrder.apply(this, arguments);
|
|
1066
1190
|
}
|
|
1067
1191
|
return replaceTempOrder;
|
|
@@ -1159,40 +1283,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1159
1283
|
}, {
|
|
1160
1284
|
key: "addNewOrder",
|
|
1161
1285
|
value: function () {
|
|
1162
|
-
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1286
|
+
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1163
1287
|
var tempOrder;
|
|
1164
|
-
return _regeneratorRuntime().wrap(function
|
|
1165
|
-
while (1) switch (
|
|
1288
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1289
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1166
1290
|
case 0:
|
|
1167
|
-
|
|
1291
|
+
_context12.prev = 0;
|
|
1168
1292
|
if (this.store.order) {
|
|
1169
|
-
|
|
1293
|
+
_context12.next = 3;
|
|
1170
1294
|
break;
|
|
1171
1295
|
}
|
|
1172
1296
|
throw new Error('order 模块未初始化');
|
|
1173
1297
|
case 3:
|
|
1174
|
-
|
|
1298
|
+
_context12.next = 5;
|
|
1175
1299
|
return this.store.order.addNewOrder();
|
|
1176
1300
|
case 5:
|
|
1177
|
-
tempOrder =
|
|
1301
|
+
tempOrder = _context12.sent;
|
|
1178
1302
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1179
|
-
|
|
1303
|
+
_context12.next = 10;
|
|
1180
1304
|
break;
|
|
1181
1305
|
}
|
|
1182
1306
|
this.store.order.persistTempOrder();
|
|
1183
|
-
|
|
1307
|
+
_context12.next = 10;
|
|
1184
1308
|
return this.store.order.saveDraft();
|
|
1185
1309
|
case 10:
|
|
1186
|
-
return
|
|
1310
|
+
return _context12.abrupt("return", tempOrder);
|
|
1187
1311
|
case 13:
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
throw
|
|
1312
|
+
_context12.prev = 13;
|
|
1313
|
+
_context12.t0 = _context12["catch"](0);
|
|
1314
|
+
throw _context12.t0;
|
|
1191
1315
|
case 16:
|
|
1192
1316
|
case "end":
|
|
1193
|
-
return
|
|
1317
|
+
return _context12.stop();
|
|
1194
1318
|
}
|
|
1195
|
-
},
|
|
1319
|
+
}, _callee12, this, [[0, 13]]);
|
|
1196
1320
|
}));
|
|
1197
1321
|
function addNewOrder() {
|
|
1198
1322
|
return _addNewOrder.apply(this, arguments);
|
|
@@ -1202,22 +1326,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1326
|
}, {
|
|
1203
1327
|
key: "saveDraft",
|
|
1204
1328
|
value: function () {
|
|
1205
|
-
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1206
|
-
return _regeneratorRuntime().wrap(function
|
|
1207
|
-
while (1) switch (
|
|
1329
|
+
var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1330
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1331
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1208
1332
|
case 0:
|
|
1209
1333
|
if (this.store.order) {
|
|
1210
|
-
|
|
1334
|
+
_context13.next = 2;
|
|
1211
1335
|
break;
|
|
1212
1336
|
}
|
|
1213
1337
|
throw new Error('order 模块未初始化');
|
|
1214
1338
|
case 2:
|
|
1215
|
-
return
|
|
1339
|
+
return _context13.abrupt("return", this.store.order.saveDraft());
|
|
1216
1340
|
case 3:
|
|
1217
1341
|
case "end":
|
|
1218
|
-
return
|
|
1342
|
+
return _context13.stop();
|
|
1219
1343
|
}
|
|
1220
|
-
},
|
|
1344
|
+
}, _callee13, this);
|
|
1221
1345
|
}));
|
|
1222
1346
|
function saveDraft() {
|
|
1223
1347
|
return _saveDraft.apply(this, arguments);
|
|
@@ -1228,14 +1352,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1228
1352
|
}, {
|
|
1229
1353
|
key: "restoreOrder",
|
|
1230
1354
|
value: function () {
|
|
1231
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1355
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1232
1356
|
var tempOrder;
|
|
1233
|
-
return _regeneratorRuntime().wrap(function
|
|
1234
|
-
while (1) switch (
|
|
1357
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1358
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1235
1359
|
case 0:
|
|
1236
|
-
|
|
1360
|
+
_context14.prev = 0;
|
|
1237
1361
|
if (this.store.order) {
|
|
1238
|
-
|
|
1362
|
+
_context14.next = 3;
|
|
1239
1363
|
break;
|
|
1240
1364
|
}
|
|
1241
1365
|
throw new Error('scanOrder 解决方案需要 order 模块支持');
|
|
@@ -1245,29 +1369,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1245
1369
|
this.currentSalesDetail = null;
|
|
1246
1370
|
this.discountConfigCacheKey = null;
|
|
1247
1371
|
this.hasManualDiscountSelection = false;
|
|
1248
|
-
|
|
1372
|
+
_context14.next = 9;
|
|
1249
1373
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1250
1374
|
tempOrder: tempOrder
|
|
1251
1375
|
});
|
|
1252
1376
|
case 9:
|
|
1253
1377
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1254
|
-
|
|
1378
|
+
_context14.next = 13;
|
|
1255
1379
|
break;
|
|
1256
1380
|
}
|
|
1257
1381
|
this.store.order.persistTempOrder();
|
|
1258
|
-
|
|
1382
|
+
_context14.next = 13;
|
|
1259
1383
|
return this.store.order.saveDraft();
|
|
1260
1384
|
case 13:
|
|
1261
|
-
return
|
|
1385
|
+
return _context14.abrupt("return", tempOrder);
|
|
1262
1386
|
case 16:
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
throw
|
|
1387
|
+
_context14.prev = 16;
|
|
1388
|
+
_context14.t0 = _context14["catch"](0);
|
|
1389
|
+
throw _context14.t0;
|
|
1266
1390
|
case 19:
|
|
1267
1391
|
case "end":
|
|
1268
|
-
return
|
|
1392
|
+
return _context14.stop();
|
|
1269
1393
|
}
|
|
1270
|
-
},
|
|
1394
|
+
}, _callee14, this, [[0, 16]]);
|
|
1271
1395
|
}));
|
|
1272
1396
|
function restoreOrder() {
|
|
1273
1397
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1281,22 +1405,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1281
1405
|
}, {
|
|
1282
1406
|
key: "clearOrderCartLines",
|
|
1283
1407
|
value: (function () {
|
|
1284
|
-
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1408
|
+
var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1285
1409
|
var tempOrder;
|
|
1286
|
-
return _regeneratorRuntime().wrap(function
|
|
1287
|
-
while (1) switch (
|
|
1410
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1411
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1288
1412
|
case 0:
|
|
1289
|
-
|
|
1413
|
+
_context15.prev = 0;
|
|
1290
1414
|
if (this.store.order) {
|
|
1291
|
-
|
|
1415
|
+
_context15.next = 3;
|
|
1292
1416
|
break;
|
|
1293
1417
|
}
|
|
1294
1418
|
throw new Error('order 模块未初始化');
|
|
1295
1419
|
case 3:
|
|
1296
|
-
|
|
1420
|
+
_context15.next = 5;
|
|
1297
1421
|
return this.store.order.clearOrderCartLines();
|
|
1298
1422
|
case 5:
|
|
1299
|
-
tempOrder =
|
|
1423
|
+
tempOrder = _context15.sent;
|
|
1300
1424
|
if (this.currentSalesDetail) {
|
|
1301
1425
|
this.currentSalesDetail = _objectSpread(_objectSpread({}, this.currentSalesDetail), {}, {
|
|
1302
1426
|
products: [],
|
|
@@ -1306,29 +1430,29 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1306
1430
|
discount_list: []
|
|
1307
1431
|
});
|
|
1308
1432
|
}
|
|
1309
|
-
|
|
1433
|
+
_context15.next = 9;
|
|
1310
1434
|
return this.effectsEmit('onTempOrderReplaced', {
|
|
1311
1435
|
tempOrder: tempOrder
|
|
1312
1436
|
});
|
|
1313
1437
|
case 9:
|
|
1314
1438
|
if (!(this.syncAppDataToTempOrder(tempOrder) && this.isTempOrderPersistEnabled())) {
|
|
1315
|
-
|
|
1439
|
+
_context15.next = 13;
|
|
1316
1440
|
break;
|
|
1317
1441
|
}
|
|
1318
1442
|
this.store.order.persistTempOrder();
|
|
1319
|
-
|
|
1443
|
+
_context15.next = 13;
|
|
1320
1444
|
return this.store.order.saveDraft();
|
|
1321
1445
|
case 13:
|
|
1322
|
-
return
|
|
1446
|
+
return _context15.abrupt("return", tempOrder);
|
|
1323
1447
|
case 16:
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
throw
|
|
1448
|
+
_context15.prev = 16;
|
|
1449
|
+
_context15.t0 = _context15["catch"](0);
|
|
1450
|
+
throw _context15.t0;
|
|
1327
1451
|
case 19:
|
|
1328
1452
|
case "end":
|
|
1329
|
-
return
|
|
1453
|
+
return _context15.stop();
|
|
1330
1454
|
}
|
|
1331
|
-
},
|
|
1455
|
+
}, _callee15, this, [[0, 16]]);
|
|
1332
1456
|
}));
|
|
1333
1457
|
function clearOrderCartLines() {
|
|
1334
1458
|
return _clearOrderCartLines.apply(this, arguments);
|
|
@@ -1345,32 +1469,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1345
1469
|
}, {
|
|
1346
1470
|
key: "getSummary",
|
|
1347
1471
|
value: function () {
|
|
1348
|
-
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1472
|
+
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1349
1473
|
var summary;
|
|
1350
|
-
return _regeneratorRuntime().wrap(function
|
|
1351
|
-
while (1) switch (
|
|
1474
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1475
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1352
1476
|
case 0:
|
|
1353
|
-
|
|
1477
|
+
_context16.prev = 0;
|
|
1354
1478
|
if (this.store.order) {
|
|
1355
|
-
|
|
1479
|
+
_context16.next = 3;
|
|
1356
1480
|
break;
|
|
1357
1481
|
}
|
|
1358
1482
|
throw new Error('order 模块未初始化');
|
|
1359
1483
|
case 3:
|
|
1360
|
-
|
|
1484
|
+
_context16.next = 5;
|
|
1361
1485
|
return this.store.order.getOrderSummary();
|
|
1362
1486
|
case 5:
|
|
1363
|
-
summary =
|
|
1364
|
-
return
|
|
1487
|
+
summary = _context16.sent;
|
|
1488
|
+
return _context16.abrupt("return", summary);
|
|
1365
1489
|
case 9:
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
throw
|
|
1490
|
+
_context16.prev = 9;
|
|
1491
|
+
_context16.t0 = _context16["catch"](0);
|
|
1492
|
+
throw _context16.t0;
|
|
1369
1493
|
case 12:
|
|
1370
1494
|
case "end":
|
|
1371
|
-
return
|
|
1495
|
+
return _context16.stop();
|
|
1372
1496
|
}
|
|
1373
|
-
},
|
|
1497
|
+
}, _callee16, this, [[0, 9]]);
|
|
1374
1498
|
}));
|
|
1375
1499
|
function getSummary() {
|
|
1376
1500
|
return _getSummary.apply(this, arguments);
|
|
@@ -1380,10 +1504,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1380
1504
|
}, {
|
|
1381
1505
|
key: "getHistoricalProductDiscountList",
|
|
1382
1506
|
value: function getHistoricalProductDiscountList(products) {
|
|
1383
|
-
var
|
|
1507
|
+
var _this8 = this;
|
|
1384
1508
|
var historyDiscountList = [];
|
|
1385
1509
|
products.forEach(function (item) {
|
|
1386
|
-
if (!
|
|
1510
|
+
if (!_this8.isPersistedOrderProduct(item)) return;
|
|
1387
1511
|
(item.discount_list || []).forEach(function (discount) {
|
|
1388
1512
|
var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
|
|
1389
1513
|
var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
|
|
@@ -1443,11 +1567,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1443
1567
|
}, {
|
|
1444
1568
|
key: "shouldSkipAutoApplyFetchedDiscountsInEditMode",
|
|
1445
1569
|
value: function shouldSkipAutoApplyFetchedDiscountsInEditMode(params) {
|
|
1446
|
-
var
|
|
1570
|
+
var _this9 = this;
|
|
1447
1571
|
if (params.discountAction !== 'edit') return false;
|
|
1448
1572
|
if (!params.products.length) return false;
|
|
1449
1573
|
var hasDraftProduct = params.products.some(function (product) {
|
|
1450
|
-
return !
|
|
1574
|
+
return !_this9.isPersistedOrderProduct(product);
|
|
1451
1575
|
});
|
|
1452
1576
|
if (hasDraftProduct) return false;
|
|
1453
1577
|
var hasSelectedDiscount = params.currentDiscountList.some(function (discount) {
|
|
@@ -1487,14 +1611,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1487
1611
|
}, {
|
|
1488
1612
|
key: "loadDiscountConfig",
|
|
1489
1613
|
value: function () {
|
|
1490
|
-
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1614
|
+
var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
|
|
1491
1615
|
var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
|
|
1492
|
-
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder,
|
|
1493
|
-
return _regeneratorRuntime().wrap(function
|
|
1494
|
-
while (1) switch (
|
|
1616
|
+
var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _tempOrder$holder, _orderStore$summary, holders, orderTotalAmount, result, _iterator, _step, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
|
|
1617
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1618
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1495
1619
|
case 0:
|
|
1496
1620
|
if (this.store.order) {
|
|
1497
|
-
|
|
1621
|
+
_context17.next = 2;
|
|
1498
1622
|
break;
|
|
1499
1623
|
}
|
|
1500
1624
|
throw new Error('order 模块未初始化');
|
|
@@ -1514,18 +1638,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1514
1638
|
discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
|
|
1515
1639
|
preparedDiscountList = [];
|
|
1516
1640
|
if (!(customerId && customerId !== 1)) {
|
|
1517
|
-
|
|
1641
|
+
_context17.next = 25;
|
|
1518
1642
|
break;
|
|
1519
1643
|
}
|
|
1520
1644
|
if (!(this.discountConfigCacheKey === discountConfigCacheKey)) {
|
|
1521
|
-
|
|
1645
|
+
_context17.next = 19;
|
|
1522
1646
|
break;
|
|
1523
1647
|
}
|
|
1524
1648
|
preparedDiscountList = originalDiscountList;
|
|
1525
|
-
|
|
1649
|
+
_context17.next = 25;
|
|
1526
1650
|
break;
|
|
1527
1651
|
case 19:
|
|
1528
|
-
|
|
1652
|
+
_context17.next = 21;
|
|
1529
1653
|
return this.store.order.loadDiscountConfig({
|
|
1530
1654
|
customerId: customerId,
|
|
1531
1655
|
action: discountAction,
|
|
@@ -1533,23 +1657,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1533
1657
|
apply: false
|
|
1534
1658
|
});
|
|
1535
1659
|
case 21:
|
|
1536
|
-
preparedDiscountList =
|
|
1660
|
+
preparedDiscountList = _context17.sent;
|
|
1537
1661
|
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
1538
|
-
|
|
1662
|
+
_context17.next = 25;
|
|
1539
1663
|
return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
|
|
1540
1664
|
case 25:
|
|
1541
1665
|
if (!(hasManualDiscountSelection && currentDiscountList.length)) {
|
|
1542
|
-
|
|
1666
|
+
_context17.next = 27;
|
|
1543
1667
|
break;
|
|
1544
1668
|
}
|
|
1545
|
-
return
|
|
1669
|
+
return _context17.abrupt("return", {
|
|
1546
1670
|
productList: tempOrder.products || [],
|
|
1547
1671
|
discountList: currentDiscountList
|
|
1548
1672
|
});
|
|
1549
1673
|
case 27:
|
|
1550
1674
|
nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
|
|
1551
1675
|
nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
|
|
1552
|
-
|
|
1676
|
+
_context17.next = 31;
|
|
1553
1677
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1554
1678
|
case 31:
|
|
1555
1679
|
shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
|
|
@@ -1559,17 +1683,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1559
1683
|
nextDiscountList: nextDiscountList
|
|
1560
1684
|
});
|
|
1561
1685
|
if (!shouldSkipAutoApplyFetchedDiscounts) {
|
|
1562
|
-
|
|
1686
|
+
_context17.next = 40;
|
|
1563
1687
|
break;
|
|
1564
1688
|
}
|
|
1565
|
-
|
|
1689
|
+
_context17.next = 35;
|
|
1566
1690
|
return this.store.order.recalculateSummary({
|
|
1567
1691
|
createIfMissing: true
|
|
1568
1692
|
});
|
|
1569
1693
|
case 35:
|
|
1570
|
-
_summary =
|
|
1694
|
+
_summary = _context17.sent;
|
|
1571
1695
|
this.store.order.persistTempOrder();
|
|
1572
|
-
|
|
1696
|
+
_context17.next = 39;
|
|
1573
1697
|
return this.effectsEmit('onDiscountApplied', {
|
|
1574
1698
|
productList: tempOrder.products || [],
|
|
1575
1699
|
discountList: nextDiscountList,
|
|
@@ -1577,24 +1701,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1577
1701
|
tempOrder: tempOrder
|
|
1578
1702
|
});
|
|
1579
1703
|
case 39:
|
|
1580
|
-
return
|
|
1704
|
+
return _context17.abrupt("return", {
|
|
1581
1705
|
productList: tempOrder.products || [],
|
|
1582
1706
|
discountList: nextDiscountList
|
|
1583
1707
|
});
|
|
1584
1708
|
case 40:
|
|
1585
1709
|
if (!rulesModule) {
|
|
1586
|
-
|
|
1710
|
+
_context17.next = 78;
|
|
1587
1711
|
break;
|
|
1588
1712
|
}
|
|
1589
|
-
holders = (_tempOrder$holder = tempOrder.holder)
|
|
1590
|
-
|
|
1591
|
-
|
|
1713
|
+
holders = ((_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.form_record) || [];
|
|
1714
|
+
orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
|
|
1715
|
+
console.log('[BaseSales.applyDiscountConfig.calcDiscount]');
|
|
1592
1716
|
result = rulesModule.calcDiscount({
|
|
1593
1717
|
productList: tempOrder.products,
|
|
1594
1718
|
discountList: nextDiscountList,
|
|
1595
1719
|
holders: holders,
|
|
1596
|
-
isFormSubject:
|
|
1597
|
-
|
|
1720
|
+
isFormSubject: function isFormSubject(product) {
|
|
1721
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
1722
|
+
},
|
|
1723
|
+
orderTotalAmount: orderTotalAmount
|
|
1598
1724
|
}) || {
|
|
1599
1725
|
productList: tempOrder.products,
|
|
1600
1726
|
discountList: nextDiscountList
|
|
@@ -1603,22 +1729,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1603
1729
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1604
1730
|
}
|
|
1605
1731
|
_iterator = _createForOfIteratorHelper(tempOrder.products || []);
|
|
1606
|
-
|
|
1732
|
+
_context17.prev = 47;
|
|
1607
1733
|
_iterator.s();
|
|
1608
|
-
case
|
|
1734
|
+
case 49:
|
|
1609
1735
|
if ((_step = _iterator.n()).done) {
|
|
1610
|
-
|
|
1736
|
+
_context17.next = 64;
|
|
1611
1737
|
break;
|
|
1612
1738
|
}
|
|
1613
1739
|
product = _step.value;
|
|
1614
1740
|
productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
|
|
1615
1741
|
runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
|
|
1616
1742
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1617
|
-
|
|
1743
|
+
_context17.next = 55;
|
|
1618
1744
|
break;
|
|
1619
1745
|
}
|
|
1620
|
-
return
|
|
1621
|
-
case
|
|
1746
|
+
return _context17.abrupt("continue", 62);
|
|
1747
|
+
case 55:
|
|
1622
1748
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1623
1749
|
return sum + Number(pd.amount || 0);
|
|
1624
1750
|
}, 0);
|
|
@@ -1634,60 +1760,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1634
1760
|
mainPrice: newMainSellingPrice,
|
|
1635
1761
|
bundle: product.product_bundle
|
|
1636
1762
|
});
|
|
1637
|
-
case 60:
|
|
1638
|
-
_context15.next = 47;
|
|
1639
|
-
break;
|
|
1640
1763
|
case 62:
|
|
1641
|
-
|
|
1764
|
+
_context17.next = 49;
|
|
1642
1765
|
break;
|
|
1643
1766
|
case 64:
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1767
|
+
_context17.next = 69;
|
|
1768
|
+
break;
|
|
1769
|
+
case 66:
|
|
1770
|
+
_context17.prev = 66;
|
|
1771
|
+
_context17.t0 = _context17["catch"](47);
|
|
1772
|
+
_iterator.e(_context17.t0);
|
|
1773
|
+
case 69:
|
|
1774
|
+
_context17.prev = 69;
|
|
1649
1775
|
_iterator.f();
|
|
1650
|
-
return
|
|
1651
|
-
case
|
|
1776
|
+
return _context17.finish(69);
|
|
1777
|
+
case 72:
|
|
1652
1778
|
if (!result.discountList) {
|
|
1653
|
-
|
|
1779
|
+
_context17.next = 78;
|
|
1654
1780
|
break;
|
|
1655
1781
|
}
|
|
1656
1782
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1657
1783
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1658
|
-
|
|
1784
|
+
_context17.next = 77;
|
|
1659
1785
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1660
|
-
case
|
|
1786
|
+
case 77:
|
|
1661
1787
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1662
1788
|
return discount.isSelected;
|
|
1663
1789
|
});
|
|
1664
|
-
case
|
|
1665
|
-
|
|
1790
|
+
case 78:
|
|
1791
|
+
_context17.next = 80;
|
|
1666
1792
|
return this.store.order.recalculateSummary({
|
|
1667
1793
|
createIfMissing: true
|
|
1668
1794
|
});
|
|
1669
|
-
case
|
|
1670
|
-
summary =
|
|
1795
|
+
case 80:
|
|
1796
|
+
summary = _context17.sent;
|
|
1671
1797
|
this.store.order.persistTempOrder();
|
|
1672
|
-
|
|
1798
|
+
_context17.next = 84;
|
|
1673
1799
|
return this.effectsEmit('onDiscountApplied', {
|
|
1674
1800
|
productList: tempOrder.products || [],
|
|
1675
1801
|
discountList: nextDiscountList,
|
|
1676
1802
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
1677
1803
|
tempOrder: tempOrder
|
|
1678
1804
|
});
|
|
1679
|
-
case
|
|
1680
|
-
return
|
|
1805
|
+
case 84:
|
|
1806
|
+
return _context17.abrupt("return", {
|
|
1681
1807
|
productList: tempOrder.products || [],
|
|
1682
1808
|
discountList: nextDiscountList
|
|
1683
1809
|
});
|
|
1684
|
-
case
|
|
1810
|
+
case 85:
|
|
1685
1811
|
case "end":
|
|
1686
|
-
return
|
|
1812
|
+
return _context17.stop();
|
|
1687
1813
|
}
|
|
1688
|
-
},
|
|
1814
|
+
}, _callee17, this, [[47, 66, 69, 72]]);
|
|
1689
1815
|
}));
|
|
1690
|
-
function loadDiscountConfig(
|
|
1816
|
+
function loadDiscountConfig(_x11) {
|
|
1691
1817
|
return _loadDiscountConfig.apply(this, arguments);
|
|
1692
1818
|
}
|
|
1693
1819
|
return loadDiscountConfig;
|
|
@@ -1695,14 +1821,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1695
1821
|
}, {
|
|
1696
1822
|
key: "bestDiscount",
|
|
1697
1823
|
value: function () {
|
|
1698
|
-
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1824
|
+
var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(cb) {
|
|
1699
1825
|
var _discountModule$getOr2, _discountModule$getDi3;
|
|
1700
|
-
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$
|
|
1701
|
-
return _regeneratorRuntime().wrap(function
|
|
1702
|
-
while (1) switch (
|
|
1826
|
+
var tempOrder, orderStore, discountModule, rulesModule, originalDiscountList, currentDiscountList, nextDiscountList, result, _tempOrder$holder2, _orderStore$summary2, holders, orderTotalAmount;
|
|
1827
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1828
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1703
1829
|
case 0:
|
|
1704
1830
|
if (this.store.order) {
|
|
1705
|
-
|
|
1831
|
+
_context18.next = 2;
|
|
1706
1832
|
break;
|
|
1707
1833
|
}
|
|
1708
1834
|
throw new Error('order 模块未初始化');
|
|
@@ -1718,35 +1844,37 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1718
1844
|
productList: tempOrder.products || [],
|
|
1719
1845
|
discountList: nextDiscountList
|
|
1720
1846
|
};
|
|
1721
|
-
|
|
1847
|
+
_context18.next = 12;
|
|
1722
1848
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1723
1849
|
case 12:
|
|
1724
1850
|
if (!rulesModule) {
|
|
1725
|
-
|
|
1851
|
+
_context18.next = 25;
|
|
1726
1852
|
break;
|
|
1727
1853
|
}
|
|
1728
|
-
holders = (_tempOrder$
|
|
1729
|
-
|
|
1730
|
-
|
|
1854
|
+
holders = ((_tempOrder$holder2 = tempOrder.holder) === null || _tempOrder$holder2 === void 0 ? void 0 : _tempOrder$holder2.form_record) || [];
|
|
1855
|
+
orderTotalAmount = Number(((_orderStore$summary2 = orderStore.summary) === null || _orderStore$summary2 === void 0 ? void 0 : _orderStore$summary2.total_amount) || 0);
|
|
1856
|
+
console.log('[BaseSales.bestDiscount.calcDiscount]');
|
|
1731
1857
|
result = rulesModule.calcDiscount({
|
|
1732
1858
|
productList: tempOrder.products,
|
|
1733
1859
|
discountList: nextDiscountList,
|
|
1734
1860
|
holders: holders,
|
|
1735
|
-
isFormSubject:
|
|
1736
|
-
|
|
1861
|
+
isFormSubject: function isFormSubject(product) {
|
|
1862
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
1863
|
+
},
|
|
1864
|
+
orderTotalAmount: orderTotalAmount
|
|
1737
1865
|
}) || result;
|
|
1738
1866
|
if (result.productList) {
|
|
1739
1867
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
1740
1868
|
}
|
|
1741
1869
|
if (!result.discountList) {
|
|
1742
|
-
|
|
1870
|
+
_context18.next = 25;
|
|
1743
1871
|
break;
|
|
1744
1872
|
}
|
|
1745
1873
|
nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
|
|
1746
1874
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1747
|
-
|
|
1875
|
+
_context18.next = 23;
|
|
1748
1876
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1749
|
-
case
|
|
1877
|
+
case 23:
|
|
1750
1878
|
tempOrder.discount_list = nextDiscountList.filter(function (discount) {
|
|
1751
1879
|
return discount.isSelected;
|
|
1752
1880
|
});
|
|
@@ -1754,22 +1882,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1754
1882
|
productList: tempOrder.products,
|
|
1755
1883
|
discountList: nextDiscountList
|
|
1756
1884
|
};
|
|
1757
|
-
case
|
|
1758
|
-
|
|
1885
|
+
case 25:
|
|
1886
|
+
_context18.next = 27;
|
|
1759
1887
|
return this.store.order.recalculateSummary({
|
|
1760
1888
|
createIfMissing: true
|
|
1761
1889
|
});
|
|
1762
|
-
case
|
|
1890
|
+
case 27:
|
|
1763
1891
|
this.store.order.persistTempOrder();
|
|
1764
1892
|
cb === null || cb === void 0 || cb(result);
|
|
1765
|
-
return
|
|
1766
|
-
case
|
|
1893
|
+
return _context18.abrupt("return", result);
|
|
1894
|
+
case 30:
|
|
1767
1895
|
case "end":
|
|
1768
|
-
return
|
|
1896
|
+
return _context18.stop();
|
|
1769
1897
|
}
|
|
1770
|
-
},
|
|
1898
|
+
}, _callee18, this);
|
|
1771
1899
|
}));
|
|
1772
|
-
function bestDiscount(
|
|
1900
|
+
function bestDiscount(_x12) {
|
|
1773
1901
|
return _bestDiscount.apply(this, arguments);
|
|
1774
1902
|
}
|
|
1775
1903
|
return bestDiscount;
|
|
@@ -1783,49 +1911,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1783
1911
|
}, {
|
|
1784
1912
|
key: "scanPromotionCode",
|
|
1785
1913
|
value: function () {
|
|
1786
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1914
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(code, customerId) {
|
|
1787
1915
|
var raw;
|
|
1788
|
-
return _regeneratorRuntime().wrap(function
|
|
1789
|
-
while (1) switch (
|
|
1916
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1917
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1790
1918
|
case 0:
|
|
1791
|
-
|
|
1919
|
+
_context19.prev = 0;
|
|
1792
1920
|
if (this.store.order) {
|
|
1793
|
-
|
|
1921
|
+
_context19.next = 3;
|
|
1794
1922
|
break;
|
|
1795
1923
|
}
|
|
1796
1924
|
throw new Error('order 模块未初始化');
|
|
1797
1925
|
case 3:
|
|
1798
|
-
|
|
1926
|
+
_context19.next = 5;
|
|
1799
1927
|
return this.store.order.scanCode(code, customerId);
|
|
1800
1928
|
case 5:
|
|
1801
|
-
raw =
|
|
1929
|
+
raw = _context19.sent;
|
|
1802
1930
|
if (!raw.isAvailable) {
|
|
1803
|
-
|
|
1931
|
+
_context19.next = 10;
|
|
1804
1932
|
break;
|
|
1805
1933
|
}
|
|
1806
|
-
|
|
1934
|
+
_context19.next = 9;
|
|
1807
1935
|
return this.store.order.recalculateSummary({
|
|
1808
1936
|
createIfMissing: true
|
|
1809
1937
|
});
|
|
1810
1938
|
case 9:
|
|
1811
1939
|
this.store.order.persistTempOrder();
|
|
1812
1940
|
case 10:
|
|
1813
|
-
return
|
|
1941
|
+
return _context19.abrupt("return", {
|
|
1814
1942
|
isAvailable: raw.isAvailable,
|
|
1815
1943
|
type: raw.type,
|
|
1816
1944
|
unavailableReason: raw.unavailableReason
|
|
1817
1945
|
});
|
|
1818
1946
|
case 13:
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
throw
|
|
1947
|
+
_context19.prev = 13;
|
|
1948
|
+
_context19.t0 = _context19["catch"](0);
|
|
1949
|
+
throw _context19.t0;
|
|
1822
1950
|
case 16:
|
|
1823
1951
|
case "end":
|
|
1824
|
-
return
|
|
1952
|
+
return _context19.stop();
|
|
1825
1953
|
}
|
|
1826
|
-
},
|
|
1954
|
+
}, _callee19, this, [[0, 13]]);
|
|
1827
1955
|
}));
|
|
1828
|
-
function scanPromotionCode(
|
|
1956
|
+
function scanPromotionCode(_x13, _x14) {
|
|
1829
1957
|
return _scanPromotionCode.apply(this, arguments);
|
|
1830
1958
|
}
|
|
1831
1959
|
return scanPromotionCode;
|
|
@@ -1833,14 +1961,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1833
1961
|
}, {
|
|
1834
1962
|
key: "setDiscountSelected",
|
|
1835
1963
|
value: function () {
|
|
1836
|
-
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1837
|
-
var _tempOrder$
|
|
1838
|
-
return _regeneratorRuntime().wrap(function
|
|
1839
|
-
while (1) switch (
|
|
1964
|
+
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1965
|
+
var _tempOrder$holder3, list, updated, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _orderStore$summary3, orderTotalAmount, result, beforeSelectedIds, _iterator2, _step2, d, selectedResourceIds, filterSelectedDiscountDetails, _iterator3, _step3, _product$metadata8, _tempOrder$_extend4, _product$metadata$sou2, _product$metadata9, _product$metadata10, _product$original_pri2, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice;
|
|
1966
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1967
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1840
1968
|
case 0:
|
|
1841
|
-
|
|
1969
|
+
_context20.prev = 0;
|
|
1842
1970
|
if (this.store.order) {
|
|
1843
|
-
|
|
1971
|
+
_context20.next = 3;
|
|
1844
1972
|
break;
|
|
1845
1973
|
}
|
|
1846
1974
|
throw new Error('order 模块未初始化');
|
|
@@ -1857,19 +1985,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1857
1985
|
orderStore = this.store.order.store || {};
|
|
1858
1986
|
discountModule = orderStore.discount;
|
|
1859
1987
|
rulesModule = orderStore.rules;
|
|
1860
|
-
holders = (_tempOrder$
|
|
1861
|
-
form_record_id: tempOrder.holder.form_record_id
|
|
1862
|
-
}] : [];
|
|
1988
|
+
holders = ((_tempOrder$holder3 = tempOrder.holder) === null || _tempOrder$holder3 === void 0 ? void 0 : _tempOrder$holder3.form_record) || [];
|
|
1863
1989
|
nextDiscountList = updated;
|
|
1864
|
-
|
|
1990
|
+
_context20.next = 14;
|
|
1865
1991
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(updated);
|
|
1866
1992
|
case 14:
|
|
1867
1993
|
if (rulesModule) {
|
|
1994
|
+
orderTotalAmount = Number(((_orderStore$summary3 = orderStore.summary) === null || _orderStore$summary3 === void 0 ? void 0 : _orderStore$summary3.total_amount) || 0);
|
|
1995
|
+
console.log('[BaseSales.setDiscountSelected.calcDiscount]');
|
|
1868
1996
|
result = rulesModule.calcDiscount({
|
|
1869
1997
|
productList: tempOrder.products,
|
|
1870
1998
|
discountList: updated,
|
|
1871
1999
|
holders: holders,
|
|
1872
|
-
isFormSubject:
|
|
2000
|
+
isFormSubject: function isFormSubject(product) {
|
|
2001
|
+
return resolveIsFormSubject(tempOrder, product);
|
|
2002
|
+
},
|
|
2003
|
+
orderTotalAmount: orderTotalAmount
|
|
1873
2004
|
}, {
|
|
1874
2005
|
discountId: params.discountId,
|
|
1875
2006
|
isSelected: params.isSelected
|
|
@@ -1895,6 +2026,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1895
2026
|
if (d.isSelected && !beforeSelectedIds.has(d.id)) {
|
|
1896
2027
|
d.isSelected = false;
|
|
1897
2028
|
d.isManualSelect = true;
|
|
2029
|
+
d.appliedProductDetails = [];
|
|
1898
2030
|
}
|
|
1899
2031
|
}
|
|
1900
2032
|
} catch (err) {
|
|
@@ -1910,28 +2042,45 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1910
2042
|
}).map(function (d) {
|
|
1911
2043
|
return d.id;
|
|
1912
2044
|
}));
|
|
2045
|
+
filterSelectedDiscountDetails = function filterSelectedDiscountDetails(discountList) {
|
|
2046
|
+
return (discountList || []).filter(function (pd) {
|
|
2047
|
+
var _pd$discount$resource, _pd$discount;
|
|
2048
|
+
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;
|
|
2049
|
+
return rid != null && selectedResourceIds.has(rid);
|
|
2050
|
+
});
|
|
2051
|
+
};
|
|
1913
2052
|
_iterator3 = _createForOfIteratorHelper(tempOrder.products);
|
|
1914
|
-
|
|
2053
|
+
_context20.prev = 18;
|
|
1915
2054
|
_iterator3.s();
|
|
1916
|
-
case
|
|
2055
|
+
case 20:
|
|
1917
2056
|
if ((_step3 = _iterator3.n()).done) {
|
|
1918
|
-
|
|
2057
|
+
_context20.next = 37;
|
|
1919
2058
|
break;
|
|
1920
2059
|
}
|
|
1921
2060
|
product = _step3.value;
|
|
1922
2061
|
productUid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
|
|
1923
2062
|
runtimeOrigin = productUid ? (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[productUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin : undefined;
|
|
1924
2063
|
if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
|
|
1925
|
-
|
|
2064
|
+
_context20.next = 26;
|
|
1926
2065
|
break;
|
|
1927
2066
|
}
|
|
1928
|
-
return
|
|
1929
|
-
case
|
|
1930
|
-
product.discount_list = (product.discount_list
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2067
|
+
return _context20.abrupt("continue", 35);
|
|
2068
|
+
case 26:
|
|
2069
|
+
product.discount_list = filterSelectedDiscountDetails(product.discount_list);
|
|
2070
|
+
if (Array.isArray(product.product_bundle)) {
|
|
2071
|
+
product.product_bundle = product.product_bundle.map(function (bundle) {
|
|
2072
|
+
var _ref19, _bundle$original_pric;
|
|
2073
|
+
var nextBundleDiscountList = filterSelectedDiscountDetails(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list);
|
|
2074
|
+
var shouldRestoreBundlePrice = nextBundleDiscountList.length === 0;
|
|
2075
|
+
var restoredBundlePrice = (_ref19 = (_bundle$original_pric = bundle === null || bundle === void 0 ? void 0 : bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle === null || bundle === void 0 ? void 0 : bundle.product_price) !== null && _ref19 !== void 0 ? _ref19 : bundle === null || bundle === void 0 ? void 0 : bundle.price;
|
|
2076
|
+
return _objectSpread(_objectSpread(_objectSpread({}, bundle), shouldRestoreBundlePrice ? {
|
|
2077
|
+
price: restoredBundlePrice,
|
|
2078
|
+
bundle_selling_price: restoredBundlePrice
|
|
2079
|
+
} : {}), {}, {
|
|
2080
|
+
discount_list: nextBundleDiscountList
|
|
2081
|
+
});
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
1935
2084
|
|
|
1936
2085
|
// 券作用于 source(不含 option、不含 bundle);算出新 source 折后价后补回 options
|
|
1937
2086
|
// 写入含 option 的 main_product_selling_price,再合成 composite 回写 selling_price。
|
|
@@ -1950,33 +2099,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1950
2099
|
mainPrice: newMainSellingPrice,
|
|
1951
2100
|
bundle: product.product_bundle
|
|
1952
2101
|
});
|
|
1953
|
-
case 33:
|
|
1954
|
-
_context18.next = 19;
|
|
1955
|
-
break;
|
|
1956
2102
|
case 35:
|
|
1957
|
-
|
|
2103
|
+
_context20.next = 20;
|
|
1958
2104
|
break;
|
|
1959
2105
|
case 37:
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2106
|
+
_context20.next = 42;
|
|
2107
|
+
break;
|
|
2108
|
+
case 39:
|
|
2109
|
+
_context20.prev = 39;
|
|
2110
|
+
_context20.t0 = _context20["catch"](18);
|
|
2111
|
+
_iterator3.e(_context20.t0);
|
|
2112
|
+
case 42:
|
|
2113
|
+
_context20.prev = 42;
|
|
1965
2114
|
_iterator3.f();
|
|
1966
|
-
return
|
|
1967
|
-
case
|
|
2115
|
+
return _context20.finish(42);
|
|
2116
|
+
case 45:
|
|
1968
2117
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
1969
|
-
|
|
2118
|
+
_context20.next = 48;
|
|
1970
2119
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
1971
|
-
case
|
|
2120
|
+
case 48:
|
|
1972
2121
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
1973
2122
|
return d.isSelected;
|
|
1974
2123
|
});
|
|
1975
|
-
|
|
2124
|
+
_context20.next = 51;
|
|
1976
2125
|
return this.store.order.recalculateSummary({
|
|
1977
2126
|
createIfMissing: true
|
|
1978
2127
|
});
|
|
1979
|
-
case
|
|
2128
|
+
case 51:
|
|
1980
2129
|
this.store.order.persistTempOrder();
|
|
1981
2130
|
this.effectsEmit('onDiscountApplied', {
|
|
1982
2131
|
productList: tempOrder.products,
|
|
@@ -1984,19 +2133,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1984
2133
|
selectedDiscountList: tempOrder.discount_list,
|
|
1985
2134
|
tempOrder: tempOrder
|
|
1986
2135
|
});
|
|
1987
|
-
|
|
2136
|
+
_context20.next = 58;
|
|
1988
2137
|
break;
|
|
1989
|
-
case
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
throw
|
|
1993
|
-
case
|
|
2138
|
+
case 55:
|
|
2139
|
+
_context20.prev = 55;
|
|
2140
|
+
_context20.t1 = _context20["catch"](0);
|
|
2141
|
+
throw _context20.t1;
|
|
2142
|
+
case 58:
|
|
1994
2143
|
case "end":
|
|
1995
|
-
return
|
|
2144
|
+
return _context20.stop();
|
|
1996
2145
|
}
|
|
1997
|
-
},
|
|
2146
|
+
}, _callee20, this, [[0, 55], [18, 39, 42, 45]]);
|
|
1998
2147
|
}));
|
|
1999
|
-
function setDiscountSelected(
|
|
2148
|
+
function setDiscountSelected(_x15) {
|
|
2000
2149
|
return _setDiscountSelected.apply(this, arguments);
|
|
2001
2150
|
}
|
|
2002
2151
|
return setDiscountSelected;
|
|
@@ -2004,23 +2153,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2004
2153
|
}, {
|
|
2005
2154
|
key: "applyDiscountCalculationResult",
|
|
2006
2155
|
value: function () {
|
|
2007
|
-
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2156
|
+
var _applyDiscountCalculationResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(result) {
|
|
2008
2157
|
var tempOrder, orderStore, discountModule;
|
|
2009
|
-
return _regeneratorRuntime().wrap(function
|
|
2010
|
-
while (1) switch (
|
|
2158
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2159
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2011
2160
|
case 0:
|
|
2012
|
-
|
|
2161
|
+
_context21.prev = 0;
|
|
2013
2162
|
if (this.store.order) {
|
|
2014
|
-
|
|
2163
|
+
_context21.next = 3;
|
|
2015
2164
|
break;
|
|
2016
2165
|
}
|
|
2017
2166
|
throw new Error('order 模块未初始化');
|
|
2018
2167
|
case 3:
|
|
2019
2168
|
if (result) {
|
|
2020
|
-
|
|
2169
|
+
_context21.next = 5;
|
|
2021
2170
|
break;
|
|
2022
2171
|
}
|
|
2023
|
-
return
|
|
2172
|
+
return _context21.abrupt("return");
|
|
2024
2173
|
case 5:
|
|
2025
2174
|
tempOrder = this.store.order.ensureTempOrder();
|
|
2026
2175
|
orderStore = this.store.order.store || {};
|
|
@@ -2029,36 +2178,36 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2029
2178
|
tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
|
|
2030
2179
|
}
|
|
2031
2180
|
if (!result.discountList) {
|
|
2032
|
-
|
|
2181
|
+
_context21.next = 14;
|
|
2033
2182
|
break;
|
|
2034
2183
|
}
|
|
2035
2184
|
OrderModule.populateSavedAmounts(tempOrder.products, result.discountList);
|
|
2036
|
-
|
|
2185
|
+
_context21.next = 13;
|
|
2037
2186
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(result.discountList);
|
|
2038
2187
|
case 13:
|
|
2039
2188
|
tempOrder.discount_list = result.discountList.filter(function (discount) {
|
|
2040
2189
|
return discount.isSelected;
|
|
2041
2190
|
});
|
|
2042
2191
|
case 14:
|
|
2043
|
-
|
|
2192
|
+
_context21.next = 16;
|
|
2044
2193
|
return this.store.order.recalculateSummary({
|
|
2045
2194
|
createIfMissing: true
|
|
2046
2195
|
});
|
|
2047
2196
|
case 16:
|
|
2048
2197
|
this.store.order.persistTempOrder();
|
|
2049
|
-
|
|
2198
|
+
_context21.next = 22;
|
|
2050
2199
|
break;
|
|
2051
2200
|
case 19:
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
throw
|
|
2201
|
+
_context21.prev = 19;
|
|
2202
|
+
_context21.t0 = _context21["catch"](0);
|
|
2203
|
+
throw _context21.t0;
|
|
2055
2204
|
case 22:
|
|
2056
2205
|
case "end":
|
|
2057
|
-
return
|
|
2206
|
+
return _context21.stop();
|
|
2058
2207
|
}
|
|
2059
|
-
},
|
|
2208
|
+
}, _callee21, this, [[0, 19]]);
|
|
2060
2209
|
}));
|
|
2061
|
-
function applyDiscountCalculationResult(
|
|
2210
|
+
function applyDiscountCalculationResult(_x16) {
|
|
2062
2211
|
return _applyDiscountCalculationResult.apply(this, arguments);
|
|
2063
2212
|
}
|
|
2064
2213
|
return applyDiscountCalculationResult;
|
|
@@ -2066,18 +2215,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2066
2215
|
}, {
|
|
2067
2216
|
key: "submitScanOrder",
|
|
2068
2217
|
value: function () {
|
|
2069
|
-
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2070
|
-
return _regeneratorRuntime().wrap(function
|
|
2071
|
-
while (1) switch (
|
|
2218
|
+
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2219
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2220
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2072
2221
|
case 0:
|
|
2073
|
-
return
|
|
2222
|
+
return _context22.abrupt("return", this.submitSalesOrder(params));
|
|
2074
2223
|
case 1:
|
|
2075
2224
|
case "end":
|
|
2076
|
-
return
|
|
2225
|
+
return _context22.stop();
|
|
2077
2226
|
}
|
|
2078
|
-
},
|
|
2227
|
+
}, _callee22, this);
|
|
2079
2228
|
}));
|
|
2080
|
-
function submitScanOrder(
|
|
2229
|
+
function submitScanOrder(_x17) {
|
|
2081
2230
|
return _submitScanOrder.apply(this, arguments);
|
|
2082
2231
|
}
|
|
2083
2232
|
return submitScanOrder;
|
|
@@ -2091,21 +2240,21 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2091
2240
|
}, {
|
|
2092
2241
|
key: "submitSalesOrder",
|
|
2093
2242
|
value: (function () {
|
|
2094
|
-
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2243
|
+
var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2095
2244
|
var _this$otherParams6, _this$otherParams7, _this$otherParams8, _this$otherParams9;
|
|
2096
2245
|
var inferredPaymentStatus, submitParams;
|
|
2097
|
-
return _regeneratorRuntime().wrap(function
|
|
2098
|
-
while (1) switch (
|
|
2246
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2247
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2099
2248
|
case 0:
|
|
2100
2249
|
if (this.store.order) {
|
|
2101
|
-
|
|
2250
|
+
_context23.next = 2;
|
|
2102
2251
|
break;
|
|
2103
2252
|
}
|
|
2104
2253
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2105
2254
|
case 2:
|
|
2106
2255
|
// this.store.order.persistTempOrder();
|
|
2107
2256
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2108
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2257
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2109
2258
|
cacheId: this.cacheId,
|
|
2110
2259
|
platform: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.platform,
|
|
2111
2260
|
businessCode: ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.businessCode) || ((_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.business_code),
|
|
@@ -2118,17 +2267,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2118
2267
|
paymentStatus: inferredPaymentStatus
|
|
2119
2268
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2120
2269
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2270
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2271
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2121
2272
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2122
2273
|
enhancePayload: params.enhancePayload
|
|
2123
2274
|
} : {});
|
|
2124
|
-
return
|
|
2275
|
+
return _context23.abrupt("return", this.store.order.submitTempOrder(submitParams));
|
|
2125
2276
|
case 5:
|
|
2126
2277
|
case "end":
|
|
2127
|
-
return
|
|
2278
|
+
return _context23.stop();
|
|
2128
2279
|
}
|
|
2129
|
-
},
|
|
2280
|
+
}, _callee23, this);
|
|
2130
2281
|
}));
|
|
2131
|
-
function submitSalesOrder(
|
|
2282
|
+
function submitSalesOrder(_x18) {
|
|
2132
2283
|
return _submitSalesOrder.apply(this, arguments);
|
|
2133
2284
|
}
|
|
2134
2285
|
return submitSalesOrder;
|
|
@@ -2136,20 +2287,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2136
2287
|
}, {
|
|
2137
2288
|
key: "submitTempOrderAsync",
|
|
2138
2289
|
value: function () {
|
|
2139
|
-
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2290
|
+
var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2140
2291
|
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13;
|
|
2141
2292
|
var inferredPaymentStatus, submitParams;
|
|
2142
|
-
return _regeneratorRuntime().wrap(function
|
|
2143
|
-
while (1) switch (
|
|
2293
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2294
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2144
2295
|
case 0:
|
|
2145
2296
|
if (this.store.order) {
|
|
2146
|
-
|
|
2297
|
+
_context24.next = 2;
|
|
2147
2298
|
break;
|
|
2148
2299
|
}
|
|
2149
2300
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
2150
2301
|
case 2:
|
|
2151
2302
|
inferredPaymentStatus = this.getSubmitPaymentStatus(params === null || params === void 0 ? void 0 : params.paymentStatus);
|
|
2152
|
-
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2303
|
+
submitParams = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
2153
2304
|
cacheId: this.cacheId,
|
|
2154
2305
|
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
2155
2306
|
businessCode: ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.businessCode) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.business_code),
|
|
@@ -2161,17 +2312,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2161
2312
|
paymentStatus: inferredPaymentStatus
|
|
2162
2313
|
} : {}), (params === null || params === void 0 ? void 0 : params.smallTicketDataFlag) !== undefined ? {
|
|
2163
2314
|
smallTicketDataFlag: params.smallTicketDataFlag
|
|
2315
|
+
} : {}), (params === null || params === void 0 ? void 0 : params.confirmPendingVoucherPayments) !== undefined ? {
|
|
2316
|
+
confirmPendingVoucherPayments: params.confirmPendingVoucherPayments
|
|
2164
2317
|
} : {}), (params === null || params === void 0 ? void 0 : params.enhancePayload) !== undefined ? {
|
|
2165
2318
|
enhancePayload: params.enhancePayload
|
|
2166
2319
|
} : {});
|
|
2167
|
-
return
|
|
2320
|
+
return _context24.abrupt("return", this.store.order.submitTempOrderAsync(submitParams));
|
|
2168
2321
|
case 5:
|
|
2169
2322
|
case "end":
|
|
2170
|
-
return
|
|
2323
|
+
return _context24.stop();
|
|
2171
2324
|
}
|
|
2172
|
-
},
|
|
2325
|
+
}, _callee24, this);
|
|
2173
2326
|
}));
|
|
2174
|
-
function submitTempOrderAsync(
|
|
2327
|
+
function submitTempOrderAsync(_x19) {
|
|
2175
2328
|
return _submitTempOrderAsync.apply(this, arguments);
|
|
2176
2329
|
}
|
|
2177
2330
|
return submitTempOrderAsync;
|
|
@@ -2179,14 +2332,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2179
2332
|
}, {
|
|
2180
2333
|
key: "printLocalOrderReceipt",
|
|
2181
2334
|
value: function () {
|
|
2182
|
-
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2335
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(lookup) {
|
|
2183
2336
|
var _this$otherParams14, _this$otherParams15, _this$otherParams16, _this$otherParams17;
|
|
2184
|
-
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$
|
|
2185
|
-
return _regeneratorRuntime().wrap(function
|
|
2186
|
-
while (1) switch (
|
|
2337
|
+
var hasLookup, lookupPayload, context, payload, response, _this$store$order$app, _this$store$order4, _data;
|
|
2338
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2339
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2187
2340
|
case 0:
|
|
2188
2341
|
if (this.store.order) {
|
|
2189
|
-
|
|
2342
|
+
_context25.next = 2;
|
|
2190
2343
|
break;
|
|
2191
2344
|
}
|
|
2192
2345
|
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
@@ -2217,28 +2370,28 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2217
2370
|
channel: context.channel,
|
|
2218
2371
|
type: context.type
|
|
2219
2372
|
});
|
|
2220
|
-
|
|
2373
|
+
_context25.next = 8;
|
|
2221
2374
|
return this.request.post('/local/print-order', payload, {
|
|
2222
2375
|
osServer: true,
|
|
2223
2376
|
customToast: function customToast() {}
|
|
2224
2377
|
});
|
|
2225
2378
|
case 8:
|
|
2226
|
-
response =
|
|
2379
|
+
response = _context25.sent;
|
|
2227
2380
|
if (hasLookup) {
|
|
2228
|
-
|
|
2381
|
+
_context25.next = 12;
|
|
2229
2382
|
break;
|
|
2230
2383
|
}
|
|
2231
|
-
|
|
2232
|
-
return (_this$store$order$app = (_this$store$
|
|
2384
|
+
_context25.next = 12;
|
|
2385
|
+
return (_this$store$order$app = (_this$store$order4 = this.store.order).applyLocalPrintOrderNumbers) === null || _this$store$order$app === void 0 ? void 0 : _this$store$order$app.call(_this$store$order4, response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.order);
|
|
2233
2386
|
case 12:
|
|
2234
|
-
return
|
|
2387
|
+
return _context25.abrupt("return", response);
|
|
2235
2388
|
case 13:
|
|
2236
2389
|
case "end":
|
|
2237
|
-
return
|
|
2390
|
+
return _context25.stop();
|
|
2238
2391
|
}
|
|
2239
|
-
},
|
|
2392
|
+
}, _callee25, this);
|
|
2240
2393
|
}));
|
|
2241
|
-
function printLocalOrderReceipt(
|
|
2394
|
+
function printLocalOrderReceipt(_x20) {
|
|
2242
2395
|
return _printLocalOrderReceipt.apply(this, arguments);
|
|
2243
2396
|
}
|
|
2244
2397
|
return printLocalOrderReceipt;
|
|
@@ -2246,9 +2399,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2246
2399
|
}, {
|
|
2247
2400
|
key: "getSubmitPaymentStatus",
|
|
2248
2401
|
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
2249
|
-
var _this$store$
|
|
2402
|
+
var _this$store$order5, _this$store$order5$ge;
|
|
2250
2403
|
if (paymentStatus !== undefined) return paymentStatus;
|
|
2251
|
-
var amountSnapshot = (_this$store$
|
|
2404
|
+
var amountSnapshot = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getOrderAmountSnapshot) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.call(_this$store$order5);
|
|
2252
2405
|
if (!amountSnapshot) return undefined;
|
|
2253
2406
|
try {
|
|
2254
2407
|
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
@@ -2259,19 +2412,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2259
2412
|
}, {
|
|
2260
2413
|
key: "syncPaymentsToOrder",
|
|
2261
2414
|
value: function () {
|
|
2262
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2263
|
-
var
|
|
2264
|
-
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
2265
|
-
return _regeneratorRuntime().wrap(function
|
|
2266
|
-
while (1) switch (
|
|
2415
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2416
|
+
var _ref20, _params$businessCode, _this$otherParams18, _this$otherParams19, _params$channel;
|
|
2417
|
+
var businessCode, channel, syncParams, syncState, payments, syncResult, latestPayments, amountSnapshot, orderSnapshot, syncPayload;
|
|
2418
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2419
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2267
2420
|
case 0:
|
|
2268
2421
|
if (this.store.order) {
|
|
2269
|
-
|
|
2422
|
+
_context26.next = 2;
|
|
2270
2423
|
break;
|
|
2271
2424
|
}
|
|
2272
2425
|
throw new Error('order 模块未初始化');
|
|
2273
2426
|
case 2:
|
|
2274
|
-
businessCode = (
|
|
2427
|
+
businessCode = (_ref20 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode) !== null && _ref20 !== void 0 ? _ref20 : (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.business_code;
|
|
2275
2428
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
2276
2429
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
2277
2430
|
businessCode: businessCode
|
|
@@ -2280,57 +2433,77 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2280
2433
|
} : {});
|
|
2281
2434
|
syncState = this.store.order.getOrderSyncState();
|
|
2282
2435
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
2283
|
-
|
|
2436
|
+
_context26.next = 9;
|
|
2284
2437
|
break;
|
|
2285
2438
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
2439
|
+
this.queueLatestAutoPaymentSync();
|
|
2440
|
+
return _context26.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
2441
|
+
case 9:
|
|
2288
2442
|
payments = params.payments || [];
|
|
2289
|
-
|
|
2443
|
+
_context26.next = 12;
|
|
2290
2444
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
2291
2445
|
payments: payments,
|
|
2292
2446
|
params: syncParams,
|
|
2293
2447
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2294
2448
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2295
2449
|
});
|
|
2296
|
-
case
|
|
2297
|
-
|
|
2298
|
-
|
|
2450
|
+
case 12:
|
|
2451
|
+
_context26.prev = 12;
|
|
2452
|
+
_context26.next = 15;
|
|
2299
2453
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
2300
|
-
case
|
|
2301
|
-
syncResult =
|
|
2302
|
-
|
|
2303
|
-
|
|
2454
|
+
case 15:
|
|
2455
|
+
syncResult = _context26.sent;
|
|
2456
|
+
latestPayments = this.store.order.getOrderPayments();
|
|
2457
|
+
amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2458
|
+
orderSnapshot = this.store.order.getOrderSnapshot();
|
|
2459
|
+
syncPayload = {
|
|
2304
2460
|
ok: true,
|
|
2305
2461
|
syncResult: syncResult,
|
|
2306
|
-
payments:
|
|
2462
|
+
payments: latestPayments,
|
|
2307
2463
|
params: syncParams,
|
|
2308
|
-
amountSnapshot:
|
|
2309
|
-
orderSnapshot:
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2464
|
+
amountSnapshot: amountSnapshot,
|
|
2465
|
+
orderSnapshot: orderSnapshot,
|
|
2466
|
+
isFullyPaid: syncResult.isFullyPaid,
|
|
2467
|
+
isOrderFullyPaid: syncResult.isOrderFullyPaid,
|
|
2468
|
+
isDepositFullyPaid: syncResult.isDepositFullyPaid,
|
|
2469
|
+
paymentStage: syncResult.paymentStage,
|
|
2470
|
+
depositAmount: syncResult.depositAmount,
|
|
2471
|
+
orderExpectedAmount: syncResult.orderExpectedAmount
|
|
2472
|
+
};
|
|
2473
|
+
_context26.next = 22;
|
|
2474
|
+
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, syncPayload);
|
|
2475
|
+
case 22:
|
|
2476
|
+
if (!(syncResult.isDepositFullyPaid && !syncResult.isOrderFullyPaid)) {
|
|
2477
|
+
_context26.next = 25;
|
|
2478
|
+
break;
|
|
2479
|
+
}
|
|
2480
|
+
_context26.next = 25;
|
|
2481
|
+
return this.effectsEmit(BaseSalesHookNames.onDepositPaymentSyncEnd, syncPayload);
|
|
2482
|
+
case 25:
|
|
2483
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2484
|
+
return _context26.abrupt("return", syncResult);
|
|
2485
|
+
case 29:
|
|
2486
|
+
_context26.prev = 29;
|
|
2487
|
+
_context26.t0 = _context26["catch"](12);
|
|
2488
|
+
_context26.next = 33;
|
|
2317
2489
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
2318
2490
|
ok: false,
|
|
2319
|
-
error:
|
|
2491
|
+
error: _context26.t0,
|
|
2320
2492
|
payments: this.store.order.getOrderPayments(),
|
|
2321
2493
|
params: syncParams,
|
|
2322
2494
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
2323
2495
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
2324
2496
|
});
|
|
2325
|
-
case
|
|
2326
|
-
|
|
2327
|
-
|
|
2497
|
+
case 33:
|
|
2498
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2499
|
+
throw _context26.t0;
|
|
2500
|
+
case 35:
|
|
2328
2501
|
case "end":
|
|
2329
|
-
return
|
|
2502
|
+
return _context26.stop();
|
|
2330
2503
|
}
|
|
2331
|
-
},
|
|
2504
|
+
}, _callee26, this, [[12, 29]]);
|
|
2332
2505
|
}));
|
|
2333
|
-
function syncPaymentsToOrder(
|
|
2506
|
+
function syncPaymentsToOrder(_x21) {
|
|
2334
2507
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
2335
2508
|
}
|
|
2336
2509
|
return syncPaymentsToOrder;
|
|
@@ -2350,17 +2523,120 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2350
2523
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2351
2524
|
return this.store.order.setOrderPayments(payments);
|
|
2352
2525
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2526
|
+
}, {
|
|
2527
|
+
key: "getPaymentStatusForSync",
|
|
2528
|
+
value: function getPaymentStatusForSync(payments) {
|
|
2529
|
+
var order = this.store.order;
|
|
2530
|
+
if (!order) throw new Error('order 模块未初始化');
|
|
2531
|
+
var completion = order.getPaymentCompletion(payments);
|
|
2532
|
+
return completion.isOrderFullyPaid ? 'paid' : 'partially_paid';
|
|
2533
|
+
}
|
|
2534
|
+
}, {
|
|
2535
|
+
key: "queueLatestAutoPaymentSync",
|
|
2536
|
+
value: function queueLatestAutoPaymentSync() {
|
|
2537
|
+
this.queuedAutoPaymentSync = true;
|
|
2538
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2539
|
+
}
|
|
2540
|
+
}, {
|
|
2541
|
+
key: "scheduleQueuedAutoPaymentSyncFlush",
|
|
2542
|
+
value: function scheduleQueuedAutoPaymentSyncFlush() {
|
|
2543
|
+
var _this10 = this;
|
|
2544
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
|
|
2545
|
+
if (!this.queuedAutoPaymentSync) return;
|
|
2546
|
+
if (this.autoPaymentSyncTimer) return;
|
|
2547
|
+
this.autoPaymentSyncTimer = setTimeout(function () {
|
|
2548
|
+
_this10.autoPaymentSyncTimer = null;
|
|
2549
|
+
void _this10.flushQueuedAutoPaymentSync();
|
|
2550
|
+
}, delay);
|
|
2551
|
+
}
|
|
2552
|
+
}, {
|
|
2553
|
+
key: "flushQueuedAutoPaymentSync",
|
|
2554
|
+
value: function () {
|
|
2555
|
+
var _flushQueuedAutoPaymentSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
2556
|
+
var payments;
|
|
2557
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2558
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2559
|
+
case 0:
|
|
2560
|
+
if (this.store.order) {
|
|
2561
|
+
_context27.next = 2;
|
|
2562
|
+
break;
|
|
2563
|
+
}
|
|
2564
|
+
return _context27.abrupt("return");
|
|
2565
|
+
case 2:
|
|
2566
|
+
if (!(!this.queuedAutoPaymentSync || this.autoPaymentSyncFlushing)) {
|
|
2567
|
+
_context27.next = 4;
|
|
2568
|
+
break;
|
|
2569
|
+
}
|
|
2570
|
+
return _context27.abrupt("return");
|
|
2571
|
+
case 4:
|
|
2572
|
+
if (!(this.store.order.getOrderSyncState() === 'submitting')) {
|
|
2573
|
+
_context27.next = 7;
|
|
2574
|
+
break;
|
|
2575
|
+
}
|
|
2576
|
+
this.scheduleQueuedAutoPaymentSyncFlush();
|
|
2577
|
+
return _context27.abrupt("return");
|
|
2578
|
+
case 7:
|
|
2579
|
+
this.autoPaymentSyncFlushing = true;
|
|
2580
|
+
_context27.prev = 8;
|
|
2581
|
+
case 9:
|
|
2582
|
+
if (!this.queuedAutoPaymentSync) {
|
|
2583
|
+
_context27.next = 18;
|
|
2584
|
+
break;
|
|
2585
|
+
}
|
|
2586
|
+
this.queuedAutoPaymentSync = false;
|
|
2587
|
+
payments = this.store.order.getOrderPayments();
|
|
2588
|
+
if (payments.length) {
|
|
2589
|
+
_context27.next = 14;
|
|
2590
|
+
break;
|
|
2591
|
+
}
|
|
2592
|
+
return _context27.abrupt("continue", 9);
|
|
2593
|
+
case 14:
|
|
2594
|
+
_context27.next = 16;
|
|
2595
|
+
return this.syncPaymentsToOrder({
|
|
2596
|
+
payments: payments,
|
|
2597
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2598
|
+
submitWhenPaid: true,
|
|
2599
|
+
smallTicketDataFlag: 1
|
|
2600
|
+
});
|
|
2601
|
+
case 16:
|
|
2602
|
+
_context27.next = 9;
|
|
2603
|
+
break;
|
|
2604
|
+
case 18:
|
|
2605
|
+
_context27.next = 23;
|
|
2606
|
+
break;
|
|
2607
|
+
case 20:
|
|
2608
|
+
_context27.prev = 20;
|
|
2609
|
+
_context27.t0 = _context27["catch"](8);
|
|
2610
|
+
this.logError('queued auto sync payments failed', {
|
|
2611
|
+
error: _context27.t0 instanceof Error ? _context27.t0.message : String(_context27.t0)
|
|
2612
|
+
});
|
|
2613
|
+
case 23:
|
|
2614
|
+
_context27.prev = 23;
|
|
2615
|
+
this.autoPaymentSyncFlushing = false;
|
|
2616
|
+
if (this.queuedAutoPaymentSync) {
|
|
2617
|
+
this.scheduleQueuedAutoPaymentSyncFlush(0);
|
|
2618
|
+
}
|
|
2619
|
+
return _context27.finish(23);
|
|
2620
|
+
case 27:
|
|
2621
|
+
case "end":
|
|
2622
|
+
return _context27.stop();
|
|
2623
|
+
}
|
|
2624
|
+
}, _callee27, this, [[8, 20, 23, 27]]);
|
|
2625
|
+
}));
|
|
2626
|
+
function flushQueuedAutoPaymentSync() {
|
|
2627
|
+
return _flushQueuedAutoPaymentSync.apply(this, arguments);
|
|
2628
|
+
}
|
|
2629
|
+
return flushQueuedAutoPaymentSync;
|
|
2630
|
+
}() /** 追加单个支付项到当前订单。 */
|
|
2355
2631
|
}, {
|
|
2356
2632
|
key: "addOrderPayment",
|
|
2357
2633
|
value: function addOrderPayment(payment) {
|
|
2358
2634
|
var _this$otherParams20,
|
|
2359
2635
|
_paymentRecord$paymen,
|
|
2360
2636
|
_paymentRecord$create,
|
|
2361
|
-
|
|
2637
|
+
_ref21,
|
|
2362
2638
|
_paymentRecord$origin,
|
|
2363
|
-
|
|
2639
|
+
_this11 = this;
|
|
2364
2640
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2365
2641
|
var paymentRecord = payment;
|
|
2366
2642
|
var paymentAmount = new Decimal(paymentRecord.amount || 0);
|
|
@@ -2382,7 +2658,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2382
2658
|
var paymentTime = (_paymentRecord$paymen = paymentRecord.payment_time) !== null && _paymentRecord$paymen !== void 0 ? _paymentRecord$paymen : paymentTimestamp;
|
|
2383
2659
|
var createdAt = (_paymentRecord$create = paymentRecord.created_at) !== null && _paymentRecord$create !== void 0 ? _paymentRecord$create : paymentTimestamp;
|
|
2384
2660
|
var serviceCharge = paymentRecord.service_charge && _typeof(paymentRecord.service_charge) === 'object' ? paymentRecord.service_charge : null;
|
|
2385
|
-
var calculatedServiceFee = serviceCharge ? new Decimal((
|
|
2661
|
+
var calculatedServiceFee = serviceCharge ? new Decimal((_ref21 = (_paymentRecord$origin = paymentRecord.origin_amount) !== null && _paymentRecord$origin !== void 0 ? _paymentRecord$origin : paymentRecord.amount) !== null && _ref21 !== void 0 ? _ref21 : 0).times(serviceCharge.percentage || 0).plus(serviceCharge.amount || 0).toDecimalPlaces(2).toFixed(2) : undefined;
|
|
2386
2662
|
var payments = this.store.order.addOrderPayment(_objectSpread(_objectSpread(_objectSpread({}, paymentRecord), calculatedServiceFee !== undefined ? {
|
|
2387
2663
|
service_fee: calculatedServiceFee
|
|
2388
2664
|
} : {}), {}, {
|
|
@@ -2392,19 +2668,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2668
|
}));
|
|
2393
2669
|
var amountSnapshot = this.store.order.getOrderAmountSnapshot();
|
|
2394
2670
|
var syncState = this.store.order.getOrderSyncState();
|
|
2395
|
-
if (amountSnapshot
|
|
2396
|
-
|
|
2671
|
+
if (amountSnapshot) {
|
|
2672
|
+
if (syncState === 'submitting') {
|
|
2673
|
+
this.queueLatestAutoPaymentSync();
|
|
2674
|
+
return payments;
|
|
2675
|
+
}
|
|
2397
2676
|
void this.syncPaymentsToOrder({
|
|
2398
2677
|
payments: payments,
|
|
2399
|
-
paymentStatus:
|
|
2678
|
+
paymentStatus: this.getPaymentStatusForSync(payments),
|
|
2400
2679
|
submitWhenPaid: true,
|
|
2401
2680
|
smallTicketDataFlag: 1
|
|
2402
2681
|
}).catch(function (error) {
|
|
2403
|
-
|
|
2682
|
+
_this11.logError('auto sync payments failed', {
|
|
2404
2683
|
error: error instanceof Error ? error.message : String(error)
|
|
2405
2684
|
});
|
|
2406
2685
|
});
|
|
2407
|
-
}
|
|
2686
|
+
}
|
|
2408
2687
|
return payments;
|
|
2409
2688
|
}
|
|
2410
2689
|
|
|
@@ -2427,25 +2706,40 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2427
2706
|
/** 覆盖 wallet pass 支付项,同时保留普通支付项。 */
|
|
2428
2707
|
}, {
|
|
2429
2708
|
key: "updateVoucherOrderPayments",
|
|
2430
|
-
value: function updateVoucherOrderPayments(payments) {
|
|
2709
|
+
value: function updateVoucherOrderPayments(payments, options) {
|
|
2431
2710
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2432
|
-
return this.store.order.updateVoucherOrderPayments(payments);
|
|
2711
|
+
return this.store.order.updateVoucherOrderPayments(payments, options);
|
|
2712
|
+
}
|
|
2713
|
+
}, {
|
|
2714
|
+
key: "confirmPendingVoucherPayments",
|
|
2715
|
+
value: function confirmPendingVoucherPayments() {
|
|
2716
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2717
|
+
return this.store.order.confirmPendingVoucherPayments();
|
|
2718
|
+
}
|
|
2719
|
+
}, {
|
|
2720
|
+
key: "discardPendingVoucherPayments",
|
|
2721
|
+
value: function discardPendingVoucherPayments() {
|
|
2722
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2723
|
+
return this.store.order.discardPendingVoucherPayments();
|
|
2433
2724
|
}
|
|
2434
2725
|
}, {
|
|
2435
2726
|
key: "getWalletProductList",
|
|
2436
2727
|
value: function getWalletProductList() {
|
|
2437
|
-
var _this$store$
|
|
2438
|
-
var tempOrder = (_this$store$
|
|
2728
|
+
var _this$store$order6, _tempOrder$products;
|
|
2729
|
+
var tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getTempOrder();
|
|
2439
2730
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
2440
2731
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
var walletProducts = products.map(function (product) {
|
|
2445
|
-
var _product$
|
|
2732
|
+
// debugger
|
|
2733
|
+
// const products = tempOrder?.products?.filter(n => n.product_id)
|
|
2734
|
+
|
|
2735
|
+
var walletProducts = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products.map(function (product) {
|
|
2736
|
+
var _product$holder_id, _product$product_vari2, _product$is_charge_ta, _metadata$main_produc, _metadata$main_produc2;
|
|
2446
2737
|
var metadata = product.metadata || {};
|
|
2738
|
+
var rawHolderId = (_product$holder_id = product.holder_id) !== null && _product$holder_id !== void 0 ? _product$holder_id : metadata.holder_id;
|
|
2739
|
+
var holderIdValue = Array.isArray(rawHolderId) ? rawHolderId[0] : rawHolderId;
|
|
2740
|
+
var holder_id = Number.isInteger(Number(holderIdValue)) ? Number(holderIdValue) : undefined;
|
|
2447
2741
|
return {
|
|
2448
|
-
product_id: product.product_id,
|
|
2742
|
+
product_id: product.product_id || 0,
|
|
2449
2743
|
product_variant_id: String((_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : ''),
|
|
2450
2744
|
quantity: product.num || 1,
|
|
2451
2745
|
is_price_include_tax: tempOrder.is_price_include_tax,
|
|
@@ -2453,7 +2747,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2453
2747
|
tax_fee: product.tax_fee,
|
|
2454
2748
|
selling_price: Number(product.selling_price || 0),
|
|
2455
2749
|
discount_list: product.discount_list || [],
|
|
2456
|
-
holder_id:
|
|
2750
|
+
holder_id: holder_id,
|
|
2457
2751
|
original_price: product.original_price,
|
|
2458
2752
|
main_product_original_price: (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : product.original_price,
|
|
2459
2753
|
main_product_selling_price: (_metadata$main_produc2 = metadata.main_product_selling_price) !== null && _metadata$main_produc2 !== void 0 ? _metadata$main_produc2 : product.selling_price,
|
|
@@ -2492,20 +2786,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2492
2786
|
}, {
|
|
2493
2787
|
key: "initWalletData",
|
|
2494
2788
|
value: function () {
|
|
2495
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2496
|
-
var _params$order_wait_pa,
|
|
2789
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2790
|
+
var _params$order_wait_pa, _ref22, _tempOrder$is_price_i;
|
|
2497
2791
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2498
|
-
return _regeneratorRuntime().wrap(function
|
|
2499
|
-
while (1) switch (
|
|
2792
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2793
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2500
2794
|
case 0:
|
|
2501
2795
|
if (this.store.order) {
|
|
2502
|
-
|
|
2796
|
+
_context28.next = 2;
|
|
2503
2797
|
break;
|
|
2504
2798
|
}
|
|
2505
2799
|
throw new Error('order 模块未初始化');
|
|
2506
2800
|
case 2:
|
|
2507
2801
|
if (this.store.payment) {
|
|
2508
|
-
|
|
2802
|
+
_context28.next = 4;
|
|
2509
2803
|
break;
|
|
2510
2804
|
}
|
|
2511
2805
|
throw new Error('payment 模块未初始化');
|
|
@@ -2514,10 +2808,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2514
2808
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2515
2809
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2516
2810
|
if (!(!tempOrder || !amount)) {
|
|
2517
|
-
|
|
2811
|
+
_context28.next = 9;
|
|
2518
2812
|
break;
|
|
2519
2813
|
}
|
|
2520
|
-
return
|
|
2814
|
+
return _context28.abrupt("return", {
|
|
2521
2815
|
walletRecommendList: [],
|
|
2522
2816
|
userIdentificationCodes: [],
|
|
2523
2817
|
transformList: [],
|
|
@@ -2536,15 +2830,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2536
2830
|
},
|
|
2537
2831
|
products: this.getWalletProductList(),
|
|
2538
2832
|
order_wait_pay_amount: (_params$order_wait_pa = params === null || params === void 0 ? void 0 : params.order_wait_pay_amount) !== null && _params$order_wait_pa !== void 0 ? _params$order_wait_pa : Number(amount.amountGap || 0),
|
|
2539
|
-
is_price_include_tax: (
|
|
2833
|
+
is_price_include_tax: (_ref22 = (_tempOrder$is_price_i = tempOrder.is_price_include_tax) !== null && _tempOrder$is_price_i !== void 0 ? _tempOrder$is_price_i : this.otherParams.is_price_include_tax) !== null && _ref22 !== void 0 ? _ref22 : 1
|
|
2540
2834
|
}, snapshot.identity.orderId ? {
|
|
2541
2835
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2542
2836
|
} : {});
|
|
2543
|
-
|
|
2837
|
+
_context28.next = 12;
|
|
2544
2838
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2545
2839
|
case 12:
|
|
2546
|
-
result =
|
|
2547
|
-
|
|
2840
|
+
result = _context28.sent;
|
|
2841
|
+
_context28.next = 15;
|
|
2548
2842
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2549
2843
|
orderId: snapshot.identity.orderId,
|
|
2550
2844
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2556,14 +2850,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2556
2850
|
timestamp: Date.now()
|
|
2557
2851
|
});
|
|
2558
2852
|
case 15:
|
|
2559
|
-
return
|
|
2853
|
+
return _context28.abrupt("return", result);
|
|
2560
2854
|
case 16:
|
|
2561
2855
|
case "end":
|
|
2562
|
-
return
|
|
2856
|
+
return _context28.stop();
|
|
2563
2857
|
}
|
|
2564
|
-
},
|
|
2858
|
+
}, _callee28, this);
|
|
2565
2859
|
}));
|
|
2566
|
-
function initWalletData(
|
|
2860
|
+
function initWalletData(_x22) {
|
|
2567
2861
|
return _initWalletData.apply(this, arguments);
|
|
2568
2862
|
}
|
|
2569
2863
|
return initWalletData;
|
|
@@ -2590,35 +2884,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2590
2884
|
}, {
|
|
2591
2885
|
key: "getPaymentMethodsAsync",
|
|
2592
2886
|
value: (function () {
|
|
2593
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2887
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2594
2888
|
var response, paymentMethods;
|
|
2595
|
-
return _regeneratorRuntime().wrap(function
|
|
2596
|
-
while (1) switch (
|
|
2889
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2890
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2597
2891
|
case 0:
|
|
2598
|
-
|
|
2599
|
-
|
|
2892
|
+
_context29.prev = 0;
|
|
2893
|
+
_context29.next = 3;
|
|
2600
2894
|
return this.request.get('/pay/custom-payment/all', {
|
|
2601
2895
|
filterPaymentMethods: true
|
|
2602
2896
|
}, {
|
|
2603
2897
|
osServer: true
|
|
2604
2898
|
});
|
|
2605
2899
|
case 3:
|
|
2606
|
-
response =
|
|
2900
|
+
response = _context29.sent;
|
|
2607
2901
|
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2608
2902
|
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2609
|
-
return
|
|
2903
|
+
return _context29.abrupt("return", this.getPaymentMethods());
|
|
2610
2904
|
case 9:
|
|
2611
|
-
|
|
2612
|
-
|
|
2905
|
+
_context29.prev = 9;
|
|
2906
|
+
_context29.t0 = _context29["catch"](0);
|
|
2613
2907
|
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2614
|
-
error:
|
|
2908
|
+
error: _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0)
|
|
2615
2909
|
});
|
|
2616
|
-
return
|
|
2910
|
+
return _context29.abrupt("return", this.getPaymentMethods());
|
|
2617
2911
|
case 13:
|
|
2618
2912
|
case "end":
|
|
2619
|
-
return
|
|
2913
|
+
return _context29.stop();
|
|
2620
2914
|
}
|
|
2621
|
-
},
|
|
2915
|
+
}, _callee29, this, [[0, 9]]);
|
|
2622
2916
|
}));
|
|
2623
2917
|
function getPaymentMethodsAsync() {
|
|
2624
2918
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
@@ -2666,49 +2960,49 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2666
2960
|
}, {
|
|
2667
2961
|
key: "sendCustomerPayLink",
|
|
2668
2962
|
value: (function () {
|
|
2669
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2670
|
-
var orderIds,
|
|
2671
|
-
return _regeneratorRuntime().wrap(function
|
|
2672
|
-
while (1) switch (
|
|
2963
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2964
|
+
var orderIds, _ref23, _ref24, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2965
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2966
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2673
2967
|
case 0:
|
|
2674
2968
|
if (this.store.order) {
|
|
2675
|
-
|
|
2969
|
+
_context30.next = 2;
|
|
2676
2970
|
break;
|
|
2677
2971
|
}
|
|
2678
2972
|
throw new Error('order 模块未初始化');
|
|
2679
2973
|
case 2:
|
|
2680
2974
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2681
2975
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2682
|
-
|
|
2976
|
+
_context30.next = 11;
|
|
2683
2977
|
break;
|
|
2684
2978
|
}
|
|
2685
|
-
|
|
2979
|
+
_context30.next = 6;
|
|
2686
2980
|
return this.submitSalesOrder({
|
|
2687
2981
|
smallTicketDataFlag: 1
|
|
2688
2982
|
});
|
|
2689
2983
|
case 6:
|
|
2690
|
-
submitResult =
|
|
2691
|
-
orderId = (
|
|
2984
|
+
submitResult = _context30.sent;
|
|
2985
|
+
orderId = (_ref23 = (_ref24 = (_submitResult$data$or = submitResult === null || submitResult === void 0 || (_submitResult$data = submitResult.data) === null || _submitResult$data === void 0 ? void 0 : _submitResult$data.order_id) !== null && _submitResult$data$or !== void 0 ? _submitResult$data$or : submitResult === null || submitResult === void 0 ? void 0 : submitResult.order_id) !== null && _ref24 !== void 0 ? _ref24 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref23 !== void 0 ? _ref23 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2692
2986
|
if (orderId) {
|
|
2693
|
-
|
|
2987
|
+
_context30.next = 10;
|
|
2694
2988
|
break;
|
|
2695
2989
|
}
|
|
2696
2990
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2697
2991
|
case 10:
|
|
2698
2992
|
orderIds = [orderId];
|
|
2699
2993
|
case 11:
|
|
2700
|
-
return
|
|
2994
|
+
return _context30.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2701
2995
|
emails: params.emails,
|
|
2702
2996
|
notify_action: params.notify_action,
|
|
2703
2997
|
order_ids: orderIds
|
|
2704
2998
|
}));
|
|
2705
2999
|
case 12:
|
|
2706
3000
|
case "end":
|
|
2707
|
-
return
|
|
3001
|
+
return _context30.stop();
|
|
2708
3002
|
}
|
|
2709
|
-
},
|
|
3003
|
+
}, _callee30, this);
|
|
2710
3004
|
}));
|
|
2711
|
-
function sendCustomerPayLink(
|
|
3005
|
+
function sendCustomerPayLink(_x23) {
|
|
2712
3006
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
2713
3007
|
}
|
|
2714
3008
|
return sendCustomerPayLink;
|
|
@@ -2721,27 +3015,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2721
3015
|
}, {
|
|
2722
3016
|
key: "calculateProductBookingPrice",
|
|
2723
3017
|
value: function () {
|
|
2724
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3018
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2725
3019
|
var _params$customer_id;
|
|
2726
3020
|
var quotation, customerId, authoritativeProduct, product;
|
|
2727
|
-
return _regeneratorRuntime().wrap(function
|
|
2728
|
-
while (1) switch (
|
|
3021
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3022
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2729
3023
|
case 0:
|
|
2730
3024
|
quotation = this.store.quotation;
|
|
2731
3025
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2732
|
-
|
|
3026
|
+
_context31.next = 4;
|
|
2733
3027
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2734
3028
|
case 4:
|
|
2735
|
-
authoritativeProduct =
|
|
3029
|
+
authoritativeProduct = _context31.sent;
|
|
2736
3030
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2737
|
-
|
|
3031
|
+
_context31.next = 8;
|
|
2738
3032
|
return this.loadQuotationForPriceQuery({
|
|
2739
3033
|
quotation: quotation,
|
|
2740
3034
|
customer_id: customerId,
|
|
2741
3035
|
channel: params.channel
|
|
2742
3036
|
});
|
|
2743
3037
|
case 8:
|
|
2744
|
-
return
|
|
3038
|
+
return _context31.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2745
3039
|
product: product,
|
|
2746
3040
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2747
3041
|
customer_id: customerId,
|
|
@@ -2749,11 +3043,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2749
3043
|
})));
|
|
2750
3044
|
case 9:
|
|
2751
3045
|
case "end":
|
|
2752
|
-
return
|
|
3046
|
+
return _context31.stop();
|
|
2753
3047
|
}
|
|
2754
|
-
},
|
|
3048
|
+
}, _callee31, this);
|
|
2755
3049
|
}));
|
|
2756
|
-
function calculateProductBookingPrice(
|
|
3050
|
+
function calculateProductBookingPrice(_x24) {
|
|
2757
3051
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
2758
3052
|
}
|
|
2759
3053
|
return calculateProductBookingPrice;
|
|
@@ -2761,7 +3055,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2761
3055
|
}, {
|
|
2762
3056
|
key: "getQuotationCustomerScopeInfo",
|
|
2763
3057
|
value: function getQuotationCustomerScopeInfo() {
|
|
2764
|
-
var
|
|
3058
|
+
var _this12 = this;
|
|
2765
3059
|
var quotation = this.store.quotation;
|
|
2766
3060
|
if (quotation && typeof quotation.getQuotationCustomerScopeInfo === 'function') {
|
|
2767
3061
|
return quotation.getQuotationCustomerScopeInfo();
|
|
@@ -2773,7 +3067,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2773
3067
|
}).map(function (item) {
|
|
2774
3068
|
var localSeen = new Set();
|
|
2775
3069
|
var customers = item.customer.filter(function (customer) {
|
|
2776
|
-
var customerId =
|
|
3070
|
+
var customerId = _this12.normalizePriceContextCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
|
|
2777
3071
|
if (!customerId || localSeen.has(customerId)) return false;
|
|
2778
3072
|
localSeen.add(customerId);
|
|
2779
3073
|
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
@@ -2823,32 +3117,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2823
3117
|
}, {
|
|
2824
3118
|
key: "calculateProductBookingPrices",
|
|
2825
3119
|
value: function () {
|
|
2826
|
-
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3120
|
+
var _calculateProductBookingPrices = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(paramsList) {
|
|
2827
3121
|
var _paramsList$0$custome,
|
|
2828
3122
|
_paramsList$,
|
|
2829
|
-
|
|
3123
|
+
_this13 = this,
|
|
2830
3124
|
_paramsList$2;
|
|
2831
3125
|
var quotation, customerId, productMapsByGroup, groups;
|
|
2832
|
-
return _regeneratorRuntime().wrap(function
|
|
2833
|
-
while (1) switch (
|
|
3126
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3127
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2834
3128
|
case 0:
|
|
2835
3129
|
if (paramsList.length) {
|
|
2836
|
-
|
|
3130
|
+
_context33.next = 2;
|
|
2837
3131
|
break;
|
|
2838
3132
|
}
|
|
2839
|
-
return
|
|
3133
|
+
return _context33.abrupt("return", []);
|
|
2840
3134
|
case 2:
|
|
2841
3135
|
quotation = this.store.quotation;
|
|
2842
3136
|
customerId = (_paramsList$0$custome = (_paramsList$ = paramsList[0]) === null || _paramsList$ === void 0 ? void 0 : _paramsList$.customer_id) !== null && _paramsList$0$custome !== void 0 ? _paramsList$0$custome : this.getCurrentOrderCustomerId();
|
|
2843
3137
|
productMapsByGroup = new Map();
|
|
2844
3138
|
groups = new Map();
|
|
2845
3139
|
paramsList.forEach(function (params) {
|
|
2846
|
-
var
|
|
3140
|
+
var _this13$otherParams;
|
|
2847
3141
|
var product = params.product || {};
|
|
2848
|
-
var productId =
|
|
3142
|
+
var productId = _this13.getPriceQueryProductId(product);
|
|
2849
3143
|
if (productId === null) return;
|
|
2850
|
-
var schedule =
|
|
2851
|
-
var channel = params.channel || ((
|
|
3144
|
+
var schedule = _this13.getPriceQuerySchedule(params);
|
|
3145
|
+
var channel = params.channel || ((_this13$otherParams = _this13.otherParams) === null || _this13$otherParams === void 0 ? void 0 : _this13$otherParams.channel);
|
|
2852
3146
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2853
3147
|
var group = groups.get(groupKey) || {
|
|
2854
3148
|
ids: new Set(),
|
|
@@ -2858,51 +3152,51 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2858
3152
|
group.ids.add(productId);
|
|
2859
3153
|
groups.set(groupKey, group);
|
|
2860
3154
|
});
|
|
2861
|
-
|
|
3155
|
+
_context33.next = 9;
|
|
2862
3156
|
return Promise.all(Array.from(groups.entries()).map( /*#__PURE__*/function () {
|
|
2863
|
-
var
|
|
2864
|
-
var
|
|
2865
|
-
return _regeneratorRuntime().wrap(function
|
|
2866
|
-
while (1) switch (
|
|
3157
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(_ref25) {
|
|
3158
|
+
var _ref27, groupKey, group, productsById;
|
|
3159
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3160
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2867
3161
|
case 0:
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
return
|
|
3162
|
+
_ref27 = _slicedToArray(_ref25, 2), groupKey = _ref27[0], group = _ref27[1];
|
|
3163
|
+
_context32.next = 3;
|
|
3164
|
+
return _this13.loadProductsForPriceQuery({
|
|
2871
3165
|
ids: Array.from(group.ids),
|
|
2872
3166
|
schedule: group.schedule,
|
|
2873
3167
|
customerId: customerId,
|
|
2874
3168
|
channel: group.channel
|
|
2875
3169
|
});
|
|
2876
3170
|
case 3:
|
|
2877
|
-
productsById =
|
|
3171
|
+
productsById = _context32.sent;
|
|
2878
3172
|
productMapsByGroup.set(groupKey, productsById);
|
|
2879
3173
|
case 5:
|
|
2880
3174
|
case "end":
|
|
2881
|
-
return
|
|
3175
|
+
return _context32.stop();
|
|
2882
3176
|
}
|
|
2883
|
-
},
|
|
3177
|
+
}, _callee32);
|
|
2884
3178
|
}));
|
|
2885
|
-
return function (
|
|
2886
|
-
return
|
|
3179
|
+
return function (_x26) {
|
|
3180
|
+
return _ref26.apply(this, arguments);
|
|
2887
3181
|
};
|
|
2888
3182
|
}()));
|
|
2889
3183
|
case 9:
|
|
2890
|
-
|
|
3184
|
+
_context33.next = 11;
|
|
2891
3185
|
return this.loadQuotationForPriceQuery({
|
|
2892
3186
|
quotation: quotation,
|
|
2893
3187
|
customer_id: customerId,
|
|
2894
3188
|
channel: (_paramsList$2 = paramsList[0]) === null || _paramsList$2 === void 0 ? void 0 : _paramsList$2.channel
|
|
2895
3189
|
});
|
|
2896
3190
|
case 11:
|
|
2897
|
-
return
|
|
2898
|
-
var
|
|
3191
|
+
return _context33.abrupt("return", paramsList.map(function (params) {
|
|
3192
|
+
var _this13$otherParams2, _productMapsByGroup$g;
|
|
2899
3193
|
var productInput = params.product || {};
|
|
2900
|
-
var productId =
|
|
2901
|
-
var schedule =
|
|
2902
|
-
var channel = params.channel || ((
|
|
3194
|
+
var productId = _this13.getPriceQueryProductId(productInput);
|
|
3195
|
+
var schedule = _this13.getPriceQuerySchedule(params);
|
|
3196
|
+
var channel = params.channel || ((_this13$otherParams2 = _this13.otherParams) === null || _this13$otherParams2 === void 0 ? void 0 : _this13$otherParams2.channel);
|
|
2903
3197
|
var groupKey = [schedule.schedule_date, schedule.schedule_datetime, channel || ''].join('|');
|
|
2904
3198
|
var authoritativeProduct = productId === null ? null : ((_productMapsByGroup$g = productMapsByGroup.get(groupKey)) === null || _productMapsByGroup$g === void 0 ? void 0 : _productMapsByGroup$g.get(productId)) || null;
|
|
2905
|
-
var product =
|
|
3199
|
+
var product = _this13.mergeProductForPriceQuery(productInput, authoritativeProduct);
|
|
2906
3200
|
return calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2907
3201
|
product: product,
|
|
2908
3202
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
@@ -2912,11 +3206,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2912
3206
|
}));
|
|
2913
3207
|
case 12:
|
|
2914
3208
|
case "end":
|
|
2915
|
-
return
|
|
3209
|
+
return _context33.stop();
|
|
2916
3210
|
}
|
|
2917
|
-
},
|
|
3211
|
+
}, _callee33, this);
|
|
2918
3212
|
}));
|
|
2919
|
-
function calculateProductBookingPrices(
|
|
3213
|
+
function calculateProductBookingPrices(_x25) {
|
|
2920
3214
|
return _calculateProductBookingPrices.apply(this, arguments);
|
|
2921
3215
|
}
|
|
2922
3216
|
return calculateProductBookingPrices;
|
|
@@ -2924,34 +3218,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2924
3218
|
}, {
|
|
2925
3219
|
key: "addProductToOrder",
|
|
2926
3220
|
value: function () {
|
|
2927
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3221
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(product, booking) {
|
|
2928
3222
|
var products;
|
|
2929
|
-
return _regeneratorRuntime().wrap(function
|
|
2930
|
-
while (1) switch (
|
|
3223
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3224
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2931
3225
|
case 0:
|
|
2932
|
-
|
|
3226
|
+
_context34.prev = 0;
|
|
2933
3227
|
if (this.store.order) {
|
|
2934
|
-
|
|
3228
|
+
_context34.next = 3;
|
|
2935
3229
|
break;
|
|
2936
3230
|
}
|
|
2937
3231
|
throw new Error('order 模块未初始化');
|
|
2938
3232
|
case 3:
|
|
2939
|
-
|
|
3233
|
+
_context34.next = 5;
|
|
2940
3234
|
return this.store.order.addProductToOrder(product, booking);
|
|
2941
3235
|
case 5:
|
|
2942
|
-
products =
|
|
2943
|
-
return
|
|
3236
|
+
products = _context34.sent;
|
|
3237
|
+
return _context34.abrupt("return", products);
|
|
2944
3238
|
case 9:
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
throw
|
|
3239
|
+
_context34.prev = 9;
|
|
3240
|
+
_context34.t0 = _context34["catch"](0);
|
|
3241
|
+
throw _context34.t0;
|
|
2948
3242
|
case 12:
|
|
2949
3243
|
case "end":
|
|
2950
|
-
return
|
|
3244
|
+
return _context34.stop();
|
|
2951
3245
|
}
|
|
2952
|
-
},
|
|
3246
|
+
}, _callee34, this, [[0, 9]]);
|
|
2953
3247
|
}));
|
|
2954
|
-
function addProductToOrder(
|
|
3248
|
+
function addProductToOrder(_x27, _x28) {
|
|
2955
3249
|
return _addProductToOrder.apply(this, arguments);
|
|
2956
3250
|
}
|
|
2957
3251
|
return addProductToOrder;
|
|
@@ -2959,34 +3253,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2959
3253
|
}, {
|
|
2960
3254
|
key: "updateOrderProduct",
|
|
2961
3255
|
value: function () {
|
|
2962
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3256
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
2963
3257
|
var products;
|
|
2964
|
-
return _regeneratorRuntime().wrap(function
|
|
2965
|
-
while (1) switch (
|
|
3258
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3259
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2966
3260
|
case 0:
|
|
2967
|
-
|
|
3261
|
+
_context35.prev = 0;
|
|
2968
3262
|
if (this.store.order) {
|
|
2969
|
-
|
|
3263
|
+
_context35.next = 3;
|
|
2970
3264
|
break;
|
|
2971
3265
|
}
|
|
2972
3266
|
throw new Error('order 模块未初始化');
|
|
2973
3267
|
case 3:
|
|
2974
|
-
|
|
3268
|
+
_context35.next = 5;
|
|
2975
3269
|
return this.store.order.updateOrderProduct(params);
|
|
2976
3270
|
case 5:
|
|
2977
|
-
products =
|
|
2978
|
-
return
|
|
3271
|
+
products = _context35.sent;
|
|
3272
|
+
return _context35.abrupt("return", products);
|
|
2979
3273
|
case 9:
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
throw
|
|
3274
|
+
_context35.prev = 9;
|
|
3275
|
+
_context35.t0 = _context35["catch"](0);
|
|
3276
|
+
throw _context35.t0;
|
|
2983
3277
|
case 12:
|
|
2984
3278
|
case "end":
|
|
2985
|
-
return
|
|
3279
|
+
return _context35.stop();
|
|
2986
3280
|
}
|
|
2987
|
-
},
|
|
3281
|
+
}, _callee35, this, [[0, 9]]);
|
|
2988
3282
|
}));
|
|
2989
|
-
function updateOrderProduct(
|
|
3283
|
+
function updateOrderProduct(_x29) {
|
|
2990
3284
|
return _updateOrderProduct.apply(this, arguments);
|
|
2991
3285
|
}
|
|
2992
3286
|
return updateOrderProduct;
|
|
@@ -2994,34 +3288,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2994
3288
|
}, {
|
|
2995
3289
|
key: "updateOrderProducts",
|
|
2996
3290
|
value: function () {
|
|
2997
|
-
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3291
|
+
var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(paramsList) {
|
|
2998
3292
|
var products;
|
|
2999
|
-
return _regeneratorRuntime().wrap(function
|
|
3000
|
-
while (1) switch (
|
|
3293
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3294
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3001
3295
|
case 0:
|
|
3002
|
-
|
|
3296
|
+
_context36.prev = 0;
|
|
3003
3297
|
if (this.store.order) {
|
|
3004
|
-
|
|
3298
|
+
_context36.next = 3;
|
|
3005
3299
|
break;
|
|
3006
3300
|
}
|
|
3007
3301
|
throw new Error('order 模块未初始化');
|
|
3008
3302
|
case 3:
|
|
3009
|
-
|
|
3303
|
+
_context36.next = 5;
|
|
3010
3304
|
return this.store.order.updateOrderProducts(paramsList);
|
|
3011
3305
|
case 5:
|
|
3012
|
-
products =
|
|
3013
|
-
return
|
|
3306
|
+
products = _context36.sent;
|
|
3307
|
+
return _context36.abrupt("return", products);
|
|
3014
3308
|
case 9:
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
throw
|
|
3309
|
+
_context36.prev = 9;
|
|
3310
|
+
_context36.t0 = _context36["catch"](0);
|
|
3311
|
+
throw _context36.t0;
|
|
3018
3312
|
case 12:
|
|
3019
3313
|
case "end":
|
|
3020
|
-
return
|
|
3314
|
+
return _context36.stop();
|
|
3021
3315
|
}
|
|
3022
|
-
},
|
|
3316
|
+
}, _callee36, this, [[0, 9]]);
|
|
3023
3317
|
}));
|
|
3024
|
-
function updateOrderProducts(
|
|
3318
|
+
function updateOrderProducts(_x30) {
|
|
3025
3319
|
return _updateOrderProducts.apply(this, arguments);
|
|
3026
3320
|
}
|
|
3027
3321
|
return updateOrderProducts;
|
|
@@ -3029,34 +3323,34 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3029
3323
|
}, {
|
|
3030
3324
|
key: "updateOrderProductQuantity",
|
|
3031
3325
|
value: function () {
|
|
3032
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3326
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3033
3327
|
var products;
|
|
3034
|
-
return _regeneratorRuntime().wrap(function
|
|
3035
|
-
while (1) switch (
|
|
3328
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3329
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3036
3330
|
case 0:
|
|
3037
|
-
|
|
3331
|
+
_context37.prev = 0;
|
|
3038
3332
|
if (this.store.order) {
|
|
3039
|
-
|
|
3333
|
+
_context37.next = 3;
|
|
3040
3334
|
break;
|
|
3041
3335
|
}
|
|
3042
3336
|
throw new Error('order 模块未初始化');
|
|
3043
3337
|
case 3:
|
|
3044
|
-
|
|
3338
|
+
_context37.next = 5;
|
|
3045
3339
|
return this.store.order.updateOrderProductQuantity(params);
|
|
3046
3340
|
case 5:
|
|
3047
|
-
products =
|
|
3048
|
-
return
|
|
3341
|
+
products = _context37.sent;
|
|
3342
|
+
return _context37.abrupt("return", products);
|
|
3049
3343
|
case 9:
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
throw
|
|
3344
|
+
_context37.prev = 9;
|
|
3345
|
+
_context37.t0 = _context37["catch"](0);
|
|
3346
|
+
throw _context37.t0;
|
|
3053
3347
|
case 12:
|
|
3054
3348
|
case "end":
|
|
3055
|
-
return
|
|
3349
|
+
return _context37.stop();
|
|
3056
3350
|
}
|
|
3057
|
-
},
|
|
3351
|
+
}, _callee37, this, [[0, 9]]);
|
|
3058
3352
|
}));
|
|
3059
|
-
function updateOrderProductQuantity(
|
|
3353
|
+
function updateOrderProductQuantity(_x31) {
|
|
3060
3354
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
3061
3355
|
}
|
|
3062
3356
|
return updateOrderProductQuantity;
|
|
@@ -3079,12 +3373,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3079
3373
|
}, {
|
|
3080
3374
|
key: "setOrderProductLineNote",
|
|
3081
3375
|
value: (function () {
|
|
3082
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3376
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(identity, note) {
|
|
3083
3377
|
var params, products;
|
|
3084
|
-
return _regeneratorRuntime().wrap(function
|
|
3085
|
-
while (1) switch (
|
|
3378
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3379
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3086
3380
|
case 0:
|
|
3087
|
-
|
|
3381
|
+
_context38.prev = 0;
|
|
3088
3382
|
params = {
|
|
3089
3383
|
product_id: identity.product_id,
|
|
3090
3384
|
product_variant_id: identity.product_variant_id,
|
|
@@ -3099,22 +3393,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3099
3393
|
params.product_sku = identity.product_sku;
|
|
3100
3394
|
}
|
|
3101
3395
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
3102
|
-
|
|
3396
|
+
_context38.next = 7;
|
|
3103
3397
|
return this.updateOrderProduct(params);
|
|
3104
3398
|
case 7:
|
|
3105
|
-
products =
|
|
3106
|
-
return
|
|
3399
|
+
products = _context38.sent;
|
|
3400
|
+
return _context38.abrupt("return", products);
|
|
3107
3401
|
case 11:
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
throw
|
|
3402
|
+
_context38.prev = 11;
|
|
3403
|
+
_context38.t0 = _context38["catch"](0);
|
|
3404
|
+
throw _context38.t0;
|
|
3111
3405
|
case 14:
|
|
3112
3406
|
case "end":
|
|
3113
|
-
return
|
|
3407
|
+
return _context38.stop();
|
|
3114
3408
|
}
|
|
3115
|
-
},
|
|
3409
|
+
}, _callee38, this, [[0, 11]]);
|
|
3116
3410
|
}));
|
|
3117
|
-
function setOrderProductLineNote(
|
|
3411
|
+
function setOrderProductLineNote(_x32, _x33) {
|
|
3118
3412
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
3119
3413
|
}
|
|
3120
3414
|
return setOrderProductLineNote;
|
|
@@ -3129,32 +3423,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3129
3423
|
}, {
|
|
3130
3424
|
key: "removeProductsFromOrder",
|
|
3131
3425
|
value: (function () {
|
|
3132
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3133
|
-
return _regeneratorRuntime().wrap(function
|
|
3134
|
-
while (1) switch (
|
|
3426
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(identities) {
|
|
3427
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3428
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3135
3429
|
case 0:
|
|
3136
|
-
|
|
3430
|
+
_context39.prev = 0;
|
|
3137
3431
|
if (this.store.order) {
|
|
3138
|
-
|
|
3432
|
+
_context39.next = 3;
|
|
3139
3433
|
break;
|
|
3140
3434
|
}
|
|
3141
3435
|
throw new Error('order 模块未初始化');
|
|
3142
3436
|
case 3:
|
|
3143
|
-
|
|
3437
|
+
_context39.next = 5;
|
|
3144
3438
|
return this.store.order.removeProductsFromOrder(identities);
|
|
3145
3439
|
case 5:
|
|
3146
|
-
return
|
|
3440
|
+
return _context39.abrupt("return", _context39.sent);
|
|
3147
3441
|
case 8:
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
throw
|
|
3442
|
+
_context39.prev = 8;
|
|
3443
|
+
_context39.t0 = _context39["catch"](0);
|
|
3444
|
+
throw _context39.t0;
|
|
3151
3445
|
case 11:
|
|
3152
3446
|
case "end":
|
|
3153
|
-
return
|
|
3447
|
+
return _context39.stop();
|
|
3154
3448
|
}
|
|
3155
|
-
},
|
|
3449
|
+
}, _callee39, this, [[0, 8]]);
|
|
3156
3450
|
}));
|
|
3157
|
-
function removeProductsFromOrder(
|
|
3451
|
+
function removeProductsFromOrder(_x34) {
|
|
3158
3452
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
3159
3453
|
}
|
|
3160
3454
|
return removeProductsFromOrder;
|
|
@@ -3162,18 +3456,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3162
3456
|
}, {
|
|
3163
3457
|
key: "removeProductFromOrder",
|
|
3164
3458
|
value: function () {
|
|
3165
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3166
|
-
return _regeneratorRuntime().wrap(function
|
|
3167
|
-
while (1) switch (
|
|
3459
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(identity) {
|
|
3460
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3461
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3168
3462
|
case 0:
|
|
3169
|
-
return
|
|
3463
|
+
return _context40.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
3170
3464
|
case 1:
|
|
3171
3465
|
case "end":
|
|
3172
|
-
return
|
|
3466
|
+
return _context40.stop();
|
|
3173
3467
|
}
|
|
3174
|
-
},
|
|
3468
|
+
}, _callee40, this);
|
|
3175
3469
|
}));
|
|
3176
|
-
function removeProductFromOrder(
|
|
3470
|
+
function removeProductFromOrder(_x35) {
|
|
3177
3471
|
return _removeProductFromOrder.apply(this, arguments);
|
|
3178
3472
|
}
|
|
3179
3473
|
return removeProductFromOrder;
|
|
@@ -3223,23 +3517,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3223
3517
|
}, {
|
|
3224
3518
|
key: "applyPromotion",
|
|
3225
3519
|
value: (function () {
|
|
3226
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3227
|
-
return _regeneratorRuntime().wrap(function
|
|
3228
|
-
while (1) switch (
|
|
3520
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3521
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3522
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3229
3523
|
case 0:
|
|
3230
3524
|
if (this.store.order) {
|
|
3231
|
-
|
|
3525
|
+
_context41.next = 2;
|
|
3232
3526
|
break;
|
|
3233
3527
|
}
|
|
3234
3528
|
throw new Error('order 模块未初始化');
|
|
3235
3529
|
case 2:
|
|
3236
|
-
|
|
3530
|
+
_context41.next = 4;
|
|
3237
3531
|
return this.store.order.applyPromotion();
|
|
3238
3532
|
case 4:
|
|
3239
3533
|
case "end":
|
|
3240
|
-
return
|
|
3534
|
+
return _context41.stop();
|
|
3241
3535
|
}
|
|
3242
|
-
},
|
|
3536
|
+
}, _callee41, this);
|
|
3243
3537
|
}));
|
|
3244
3538
|
function applyPromotion() {
|
|
3245
3539
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -3249,16 +3543,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3249
3543
|
}, {
|
|
3250
3544
|
key: "getUnfulfilledPromotions",
|
|
3251
3545
|
value: function getUnfulfilledPromotions() {
|
|
3252
|
-
var _this$store$
|
|
3253
|
-
return ((_this$store$
|
|
3546
|
+
var _this$store$order7;
|
|
3547
|
+
return ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getUnfulfilledPromotions()) || [];
|
|
3254
3548
|
}
|
|
3255
3549
|
|
|
3256
3550
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
3257
3551
|
}, {
|
|
3258
3552
|
key: "getLastGiftActions",
|
|
3259
3553
|
value: function getLastGiftActions() {
|
|
3260
|
-
var _this$store$
|
|
3261
|
-
return ((_this$store$
|
|
3554
|
+
var _this$store$order8;
|
|
3555
|
+
return ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getLastGiftActions()) || null;
|
|
3262
3556
|
}
|
|
3263
3557
|
|
|
3264
3558
|
// 获取商品列表
|
|
@@ -3266,18 +3560,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3266
3560
|
}, {
|
|
3267
3561
|
key: "getProductList",
|
|
3268
3562
|
value: function () {
|
|
3269
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3563
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3270
3564
|
var _this$otherParams21;
|
|
3271
3565
|
var menu_list_ids, _this$store$products, res;
|
|
3272
|
-
return _regeneratorRuntime().wrap(function
|
|
3273
|
-
while (1) switch (
|
|
3566
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3567
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3274
3568
|
case 0:
|
|
3275
3569
|
// 可以直接通过配置里的 menu 读取
|
|
3276
3570
|
menu_list_ids = ((_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'].map(function (n) {
|
|
3277
3571
|
return Number(n.value);
|
|
3278
3572
|
})) || [];
|
|
3279
|
-
|
|
3280
|
-
|
|
3573
|
+
_context42.prev = 1;
|
|
3574
|
+
_context42.next = 4;
|
|
3281
3575
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
3282
3576
|
menu_list_ids: menu_list_ids,
|
|
3283
3577
|
cacheId: this.cacheId,
|
|
@@ -3285,17 +3579,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3285
3579
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
3286
3580
|
});
|
|
3287
3581
|
case 4:
|
|
3288
|
-
res =
|
|
3289
|
-
return
|
|
3582
|
+
res = _context42.sent;
|
|
3583
|
+
return _context42.abrupt("return", res);
|
|
3290
3584
|
case 8:
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
throw
|
|
3585
|
+
_context42.prev = 8;
|
|
3586
|
+
_context42.t0 = _context42["catch"](1);
|
|
3587
|
+
throw _context42.t0;
|
|
3294
3588
|
case 11:
|
|
3295
3589
|
case "end":
|
|
3296
|
-
return
|
|
3590
|
+
return _context42.stop();
|
|
3297
3591
|
}
|
|
3298
|
-
},
|
|
3592
|
+
}, _callee42, this, [[1, 8]]);
|
|
3299
3593
|
}));
|
|
3300
3594
|
function getProductList() {
|
|
3301
3595
|
return _getProductList.apply(this, arguments);
|
|
@@ -3310,33 +3604,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3310
3604
|
}, {
|
|
3311
3605
|
key: "setOtherParams",
|
|
3312
3606
|
value: function () {
|
|
3313
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3607
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
3314
3608
|
var _this$otherParams22;
|
|
3315
|
-
var
|
|
3316
|
-
|
|
3609
|
+
var _ref28,
|
|
3610
|
+
_ref28$cover,
|
|
3317
3611
|
cover,
|
|
3318
|
-
|
|
3319
|
-
return _regeneratorRuntime().wrap(function
|
|
3320
|
-
while (1) switch (
|
|
3612
|
+
_args43 = arguments;
|
|
3613
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3614
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3321
3615
|
case 0:
|
|
3322
|
-
|
|
3616
|
+
_ref28 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref28$cover = _ref28.cover, cover = _ref28$cover === void 0 ? false : _ref28$cover;
|
|
3323
3617
|
if (cover) {
|
|
3324
3618
|
this.otherParams = _objectSpread({}, params);
|
|
3325
3619
|
} else {
|
|
3326
3620
|
this.otherParams = _objectSpread(_objectSpread({}, this.otherParams), params);
|
|
3327
3621
|
}
|
|
3328
3622
|
this.cacheId = (_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22.cacheId;
|
|
3329
|
-
|
|
3623
|
+
_context43.next = 5;
|
|
3330
3624
|
return this.syncOtherParamsToSubModules(params, {
|
|
3331
3625
|
cover: cover
|
|
3332
3626
|
});
|
|
3333
3627
|
case 5:
|
|
3334
3628
|
case "end":
|
|
3335
|
-
return
|
|
3629
|
+
return _context43.stop();
|
|
3336
3630
|
}
|
|
3337
|
-
},
|
|
3631
|
+
}, _callee43, this);
|
|
3338
3632
|
}));
|
|
3339
|
-
function setOtherParams(
|
|
3633
|
+
function setOtherParams(_x36) {
|
|
3340
3634
|
return _setOtherParams.apply(this, arguments);
|
|
3341
3635
|
}
|
|
3342
3636
|
return setOtherParams;
|