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