@pisell/pisellos 2.2.204 → 2.2.206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +21 -16
- package/dist/modules/Order/index.d.ts +9 -0
- package/dist/modules/Order/index.js +237 -146
- package/dist/modules/Order/types.d.ts +10 -0
- package/dist/modules/Order/utils.js +7 -5
- package/dist/modules/Payment/index.d.ts +0 -13
- package/dist/modules/Payment/index.js +449 -833
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +142 -0
- package/dist/server/index.js +2208 -824
- package/dist/server/modules/index.d.ts +2 -0
- package/dist/server/modules/index.js +2 -0
- package/dist/server/modules/order/index.d.ts +7 -0
- package/dist/server/modules/order/index.js +375 -337
- package/dist/server/modules/order/types.d.ts +15 -0
- package/dist/server/modules/order/types.js +8 -0
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/utils/small-ticket.d.ts +69 -0
- package/dist/server/utils/small-ticket.js +528 -0
- package/dist/solution/BaseSales/index.d.ts +10 -3
- package/dist/solution/BaseSales/index.js +307 -198
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +8 -1
- package/dist/solution/BookingTicket/index.js +444 -264
- package/dist/solution/BookingTicket/types.d.ts +2 -1
- package/dist/solution/BookingTicket/types.js +3 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +51 -52
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +6 -4
- package/lib/modules/Order/index.d.ts +9 -0
- package/lib/modules/Order/index.js +64 -4
- package/lib/modules/Order/types.d.ts +10 -0
- package/lib/modules/Order/utils.js +4 -3
- package/lib/modules/Payment/index.d.ts +0 -13
- package/lib/modules/Payment/index.js +6 -149
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +142 -0
- package/lib/server/index.js +867 -49
- package/lib/server/modules/index.d.ts +2 -0
- package/lib/server/modules/index.js +3 -0
- package/lib/server/modules/order/index.d.ts +7 -0
- package/lib/server/modules/order/index.js +21 -7
- package/lib/server/modules/order/types.d.ts +15 -0
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/utils/small-ticket.d.ts +69 -0
- package/lib/server/utils/small-ticket.js +555 -0
- package/lib/solution/BaseSales/index.d.ts +10 -3
- package/lib/solution/BaseSales/index.js +98 -6
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +8 -1
- package/lib/solution/BookingTicket/index.js +109 -2
- package/lib/solution/BookingTicket/types.d.ts +2 -1
- package/lib/solution/BookingTicket/types.js +5 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +1 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +17 -3
- package/package.json +1 -1
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
2
|
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); }
|
|
9
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
-
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
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
12
4
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
5
|
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); }); }; }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
9
|
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); } }
|
|
16
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -26,10 +20,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
26
20
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
28
|
+
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; }
|
|
29
29
|
import { BaseModule } from "../../modules/BaseModule";
|
|
30
30
|
import { BaseSalesHookNames } from "./types";
|
|
31
31
|
import { OrderModule } from "../../modules/Order";
|
|
32
32
|
import Decimal from 'decimal.js';
|
|
33
|
+
import { cloneDeep, mergeWith } from 'lodash-es';
|
|
33
34
|
import { createModule } from "../BookingByStep/types";
|
|
34
35
|
import { composeLinePrice, createUuidV4, ensureProductSku, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
35
36
|
import dayjs from 'dayjs';
|
|
@@ -62,6 +63,19 @@ function preserveManualProductDiscountProducts(previousProducts, nextProducts) {
|
|
|
62
63
|
return previous && isBaseSalesManualProductDiscountProduct(previous) ? previous : product;
|
|
63
64
|
});
|
|
64
65
|
}
|
|
66
|
+
function mergeSalesDetailRecordWithTempOrder(currentTempOrder, loadedRecord) {
|
|
67
|
+
if (!currentTempOrder) return loadedRecord;
|
|
68
|
+
return mergeWith(cloneDeep(currentTempOrder), cloneDeep(loadedRecord || {}), function (currentValue, loadedValue) {
|
|
69
|
+
if (Array.isArray(currentValue) && Array.isArray(loadedValue)) {
|
|
70
|
+
return [].concat(_toConsumableArray(cloneDeep(currentValue)), _toConsumableArray(cloneDeep(loadedValue)));
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(loadedValue)) return cloneDeep(loadedValue);
|
|
73
|
+
if (Array.isArray(currentValue) && loadedValue === undefined) {
|
|
74
|
+
return cloneDeep(currentValue);
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
65
79
|
export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
66
80
|
_inherits(BaseSalesImpl, _BaseModule);
|
|
67
81
|
var _super = _createSuper(BaseSalesImpl);
|
|
@@ -91,6 +105,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
91
105
|
_defineProperty(_assertThisInitialized(_this), "currentSalesDetail", null);
|
|
92
106
|
_defineProperty(_assertThisInitialized(_this), "discountConfigCacheKey", null);
|
|
93
107
|
_defineProperty(_assertThisInitialized(_this), "hasManualDiscountSelection", false);
|
|
108
|
+
_defineProperty(_assertThisInitialized(_this), "paymentMethodsCache", []);
|
|
94
109
|
return _this;
|
|
95
110
|
}
|
|
96
111
|
|
|
@@ -151,6 +166,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
151
166
|
});
|
|
152
167
|
}
|
|
153
168
|
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "hydrateOrderPaymentNames",
|
|
171
|
+
value: function hydrateOrderPaymentNames(payments) {
|
|
172
|
+
if (!payments.length) return [];
|
|
173
|
+
if (!this.paymentMethodsCache.length) {
|
|
174
|
+
return payments.map(function (payment) {
|
|
175
|
+
return _objectSpread({}, payment);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
var paymentMethodById = new Map();
|
|
179
|
+
var paymentMethodByCode = new Map();
|
|
180
|
+
this.paymentMethodsCache.forEach(function (method) {
|
|
181
|
+
if ((method === null || method === void 0 ? void 0 : method.id) !== undefined && (method === null || method === void 0 ? void 0 : method.id) !== null) {
|
|
182
|
+
paymentMethodById.set(String(method.id), method);
|
|
183
|
+
}
|
|
184
|
+
if (method !== null && method !== void 0 && method.code) {
|
|
185
|
+
paymentMethodByCode.set(String(method.code), method);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return payments.map(function (payment) {
|
|
189
|
+
var nextPayment = _objectSpread({}, payment);
|
|
190
|
+
if (nextPayment.name) return nextPayment;
|
|
191
|
+
var paymentMethod = paymentMethodById.get(String(nextPayment.custom_payment_id)) || paymentMethodByCode.get(String(nextPayment.code));
|
|
192
|
+
if (!(paymentMethod !== null && paymentMethod !== void 0 && paymentMethod.name)) return nextPayment;
|
|
193
|
+
return _objectSpread(_objectSpread({}, nextPayment), {}, {
|
|
194
|
+
name: paymentMethod.name
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
}
|
|
154
198
|
}, {
|
|
155
199
|
key: "payment",
|
|
156
200
|
get: function get() {
|
|
@@ -566,8 +610,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
566
610
|
if (this.store.order && typeof ((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.enableTempOrderPersist) === 'boolean') {
|
|
567
611
|
this.store.order.setEnableTempOrderPersist(this.otherParams.enableTempOrderPersist);
|
|
568
612
|
}
|
|
613
|
+
_context3.next = 21;
|
|
614
|
+
return this.getPaymentMethodsAsync();
|
|
615
|
+
case 21:
|
|
569
616
|
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
570
|
-
case
|
|
617
|
+
case 22:
|
|
571
618
|
case "end":
|
|
572
619
|
return _context3.stop();
|
|
573
620
|
}
|
|
@@ -624,7 +671,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
624
671
|
value: (function () {
|
|
625
672
|
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderIdOrParams) {
|
|
626
673
|
var _ref9, _params$orderId;
|
|
627
|
-
var params, externalSaleNumber, lookup, res, message, sales;
|
|
674
|
+
var params, externalSaleNumber, lookup, res, message, currentTempOrder, record, sales;
|
|
628
675
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
629
676
|
while (1) switch (_context5.prev = _context5.next) {
|
|
630
677
|
case 0:
|
|
@@ -659,20 +706,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
659
706
|
message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
|
|
660
707
|
throw new Error(message);
|
|
661
708
|
case 13:
|
|
662
|
-
|
|
663
|
-
|
|
709
|
+
currentTempOrder = params.merge ? this.store.order.getTempOrder() : null;
|
|
710
|
+
record = params.merge ? mergeSalesDetailRecordWithTempOrder(currentTempOrder, res.data) : res.data;
|
|
711
|
+
_context5.next = 17;
|
|
712
|
+
return this.store.order.hydrateTempOrderFromRecord(record, {
|
|
664
713
|
recalcOnHydrate: false
|
|
665
714
|
});
|
|
666
|
-
case
|
|
715
|
+
case 17:
|
|
667
716
|
sales = _context5.sent;
|
|
668
717
|
this.currentSalesDetail = sales;
|
|
669
|
-
_context5.next =
|
|
718
|
+
_context5.next = 21;
|
|
670
719
|
return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
|
|
671
720
|
sales: sales
|
|
672
721
|
});
|
|
673
|
-
case
|
|
722
|
+
case 21:
|
|
674
723
|
return _context5.abrupt("return", sales);
|
|
675
|
-
case
|
|
724
|
+
case 22:
|
|
676
725
|
case "end":
|
|
677
726
|
return _context5.stop();
|
|
678
727
|
}
|
|
@@ -1848,12 +1897,56 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1848
1897
|
}
|
|
1849
1898
|
return submitSalesOrder;
|
|
1850
1899
|
}())
|
|
1900
|
+
}, {
|
|
1901
|
+
key: "printLocalOrderReceipt",
|
|
1902
|
+
value: function () {
|
|
1903
|
+
var _printLocalOrderReceipt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1904
|
+
var _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$store$order$app, _this$store$order3, _data;
|
|
1905
|
+
var payload, response;
|
|
1906
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1907
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1908
|
+
case 0:
|
|
1909
|
+
if (this.store.order) {
|
|
1910
|
+
_context19.next = 2;
|
|
1911
|
+
break;
|
|
1912
|
+
}
|
|
1913
|
+
throw new Error('BaseSales 解决方案需要 order 模块支持');
|
|
1914
|
+
case 2:
|
|
1915
|
+
payload = this.store.order.buildCurrentSubmitPayloadForLocalPrint({
|
|
1916
|
+
cacheId: this.cacheId,
|
|
1917
|
+
platform: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform,
|
|
1918
|
+
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),
|
|
1919
|
+
channel: this.getSubmitOrderSalesChannel(),
|
|
1920
|
+
type: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.type
|
|
1921
|
+
});
|
|
1922
|
+
_context19.next = 5;
|
|
1923
|
+
return this.request.post('/local/print-order', payload, {
|
|
1924
|
+
osServer: true,
|
|
1925
|
+
customToast: function customToast() {}
|
|
1926
|
+
});
|
|
1927
|
+
case 5:
|
|
1928
|
+
response = _context19.sent;
|
|
1929
|
+
_context19.next = 8;
|
|
1930
|
+
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);
|
|
1931
|
+
case 8:
|
|
1932
|
+
return _context19.abrupt("return", response);
|
|
1933
|
+
case 9:
|
|
1934
|
+
case "end":
|
|
1935
|
+
return _context19.stop();
|
|
1936
|
+
}
|
|
1937
|
+
}, _callee19, this);
|
|
1938
|
+
}));
|
|
1939
|
+
function printLocalOrderReceipt() {
|
|
1940
|
+
return _printLocalOrderReceipt.apply(this, arguments);
|
|
1941
|
+
}
|
|
1942
|
+
return printLocalOrderReceipt;
|
|
1943
|
+
}()
|
|
1851
1944
|
}, {
|
|
1852
1945
|
key: "getSubmitPaymentStatus",
|
|
1853
1946
|
value: function getSubmitPaymentStatus(paymentStatus) {
|
|
1854
|
-
var _this$store$
|
|
1947
|
+
var _this$store$order4, _this$store$order4$ge;
|
|
1855
1948
|
if (paymentStatus !== undefined) return paymentStatus;
|
|
1856
|
-
var amountSnapshot = (_this$store$
|
|
1949
|
+
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);
|
|
1857
1950
|
if (!amountSnapshot) return undefined;
|
|
1858
1951
|
try {
|
|
1859
1952
|
return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
|
|
@@ -1864,19 +1957,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1864
1957
|
}, {
|
|
1865
1958
|
key: "syncPaymentsToOrder",
|
|
1866
1959
|
value: function () {
|
|
1867
|
-
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1868
|
-
var _ref10, _params$businessCode, _this$
|
|
1960
|
+
var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
|
|
1961
|
+
var _ref10, _params$businessCode, _this$otherParams14, _this$otherParams15, _params$channel;
|
|
1869
1962
|
var businessCode, channel, syncParams, syncState, payments, syncResult;
|
|
1870
|
-
return _regeneratorRuntime().wrap(function
|
|
1871
|
-
while (1) switch (
|
|
1963
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1964
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1872
1965
|
case 0:
|
|
1873
1966
|
if (this.store.order) {
|
|
1874
|
-
|
|
1967
|
+
_context20.next = 2;
|
|
1875
1968
|
break;
|
|
1876
1969
|
}
|
|
1877
1970
|
throw new Error('order 模块未初始化');
|
|
1878
1971
|
case 2:
|
|
1879
|
-
businessCode = (_ref10 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$
|
|
1972
|
+
businessCode = (_ref10 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode) !== null && _ref10 !== void 0 ? _ref10 : (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.business_code;
|
|
1880
1973
|
channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
|
|
1881
1974
|
syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
|
|
1882
1975
|
businessCode: businessCode
|
|
@@ -1885,13 +1978,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1885
1978
|
} : {});
|
|
1886
1979
|
syncState = this.store.order.getOrderSyncState();
|
|
1887
1980
|
if (!(params.submitWhenPaid && syncState === 'submitting')) {
|
|
1888
|
-
|
|
1981
|
+
_context20.next = 8;
|
|
1889
1982
|
break;
|
|
1890
1983
|
}
|
|
1891
|
-
return
|
|
1984
|
+
return _context20.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
|
|
1892
1985
|
case 8:
|
|
1893
1986
|
payments = params.payments || [];
|
|
1894
|
-
|
|
1987
|
+
_context20.next = 11;
|
|
1895
1988
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
|
|
1896
1989
|
payments: payments,
|
|
1897
1990
|
params: syncParams,
|
|
@@ -1899,12 +1992,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1899
1992
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1900
1993
|
});
|
|
1901
1994
|
case 11:
|
|
1902
|
-
|
|
1903
|
-
|
|
1995
|
+
_context20.prev = 11;
|
|
1996
|
+
_context20.next = 14;
|
|
1904
1997
|
return this.store.order.syncPaymentsToOrder(syncParams);
|
|
1905
1998
|
case 14:
|
|
1906
|
-
syncResult =
|
|
1907
|
-
|
|
1999
|
+
syncResult = _context20.sent;
|
|
2000
|
+
_context20.next = 17;
|
|
1908
2001
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1909
2002
|
ok: true,
|
|
1910
2003
|
syncResult: syncResult,
|
|
@@ -1914,26 +2007,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1914
2007
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1915
2008
|
});
|
|
1916
2009
|
case 17:
|
|
1917
|
-
return
|
|
2010
|
+
return _context20.abrupt("return", syncResult);
|
|
1918
2011
|
case 20:
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
2012
|
+
_context20.prev = 20;
|
|
2013
|
+
_context20.t0 = _context20["catch"](11);
|
|
2014
|
+
_context20.next = 24;
|
|
1922
2015
|
return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
|
|
1923
2016
|
ok: false,
|
|
1924
|
-
error:
|
|
2017
|
+
error: _context20.t0,
|
|
1925
2018
|
payments: this.store.order.getOrderPayments(),
|
|
1926
2019
|
params: syncParams,
|
|
1927
2020
|
amountSnapshot: this.store.order.getOrderAmountSnapshot(),
|
|
1928
2021
|
orderSnapshot: this.store.order.getOrderSnapshot()
|
|
1929
2022
|
});
|
|
1930
2023
|
case 24:
|
|
1931
|
-
throw
|
|
2024
|
+
throw _context20.t0;
|
|
1932
2025
|
case 25:
|
|
1933
2026
|
case "end":
|
|
1934
|
-
return
|
|
2027
|
+
return _context20.stop();
|
|
1935
2028
|
}
|
|
1936
|
-
},
|
|
2029
|
+
}, _callee20, this, [[11, 20]]);
|
|
1937
2030
|
}));
|
|
1938
2031
|
function syncPaymentsToOrder(_x15) {
|
|
1939
2032
|
return _syncPaymentsToOrder.apply(this, arguments);
|
|
@@ -1944,7 +2037,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1944
2037
|
key: "getOrderPayments",
|
|
1945
2038
|
value: function getOrderPayments() {
|
|
1946
2039
|
if (!this.store.order) return [];
|
|
1947
|
-
|
|
2040
|
+
var payments = this.store.order.getOrderPayments();
|
|
2041
|
+
return this.hydrateOrderPaymentNames(payments);
|
|
1948
2042
|
}
|
|
1949
2043
|
|
|
1950
2044
|
/** 覆盖当前订单支付项,内部由 OrderModule 清洗为 Sales 协议字段。 */
|
|
@@ -1959,7 +2053,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1959
2053
|
}, {
|
|
1960
2054
|
key: "addOrderPayment",
|
|
1961
2055
|
value: function addOrderPayment(payment) {
|
|
1962
|
-
var _this$
|
|
2056
|
+
var _this$otherParams16,
|
|
1963
2057
|
_this7 = this;
|
|
1964
2058
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
1965
2059
|
var paymentRecord = payment;
|
|
@@ -1971,7 +2065,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1971
2065
|
return this.store.order.getOrderPayments();
|
|
1972
2066
|
}
|
|
1973
2067
|
var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
|
|
1974
|
-
var shopWalletPassId = (_this$
|
|
2068
|
+
var shopWalletPassId = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.shop_wallet_pass_id;
|
|
1975
2069
|
if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
|
|
1976
2070
|
metadata.shop_wallet_pass_id = shopWalletPassId;
|
|
1977
2071
|
}
|
|
@@ -1995,7 +2089,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1995
2089
|
error: error instanceof Error ? error.message : String(error)
|
|
1996
2090
|
});
|
|
1997
2091
|
});
|
|
1998
|
-
}
|
|
2092
|
+
} else {}
|
|
1999
2093
|
return payments;
|
|
2000
2094
|
}
|
|
2001
2095
|
|
|
@@ -2025,8 +2119,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2025
2119
|
}, {
|
|
2026
2120
|
key: "getWalletProductList",
|
|
2027
2121
|
value: function getWalletProductList() {
|
|
2028
|
-
var _this$store$
|
|
2029
|
-
var tempOrder = (_this$store$
|
|
2122
|
+
var _this$store$order5, _tempOrder$products, _tempOrder$products2;
|
|
2123
|
+
var tempOrder = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder();
|
|
2030
2124
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
|
|
2031
2125
|
// 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
|
|
2032
2126
|
var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
|
|
@@ -2083,20 +2177,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2083
2177
|
}, {
|
|
2084
2178
|
key: "initWalletData",
|
|
2085
2179
|
value: function () {
|
|
2086
|
-
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2180
|
+
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
2087
2181
|
var _params$order_wait_pa, _ref11, _tempOrder$is_price_i;
|
|
2088
2182
|
var snapshot, tempOrder, amount, walletBusinessData, result;
|
|
2089
|
-
return _regeneratorRuntime().wrap(function
|
|
2090
|
-
while (1) switch (
|
|
2183
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
2184
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
2091
2185
|
case 0:
|
|
2092
2186
|
if (this.store.order) {
|
|
2093
|
-
|
|
2187
|
+
_context21.next = 2;
|
|
2094
2188
|
break;
|
|
2095
2189
|
}
|
|
2096
2190
|
throw new Error('order 模块未初始化');
|
|
2097
2191
|
case 2:
|
|
2098
2192
|
if (this.store.payment) {
|
|
2099
|
-
|
|
2193
|
+
_context21.next = 4;
|
|
2100
2194
|
break;
|
|
2101
2195
|
}
|
|
2102
2196
|
throw new Error('payment 模块未初始化');
|
|
@@ -2105,10 +2199,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2105
2199
|
tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
|
|
2106
2200
|
amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
|
|
2107
2201
|
if (!(!tempOrder || !amount)) {
|
|
2108
|
-
|
|
2202
|
+
_context21.next = 9;
|
|
2109
2203
|
break;
|
|
2110
2204
|
}
|
|
2111
|
-
return
|
|
2205
|
+
return _context21.abrupt("return", {
|
|
2112
2206
|
walletRecommendList: [],
|
|
2113
2207
|
userIdentificationCodes: [],
|
|
2114
2208
|
transformList: [],
|
|
@@ -2131,11 +2225,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2131
2225
|
}, snapshot.identity.orderId ? {
|
|
2132
2226
|
payment_order_id: String(snapshot.identity.orderId)
|
|
2133
2227
|
} : {});
|
|
2134
|
-
|
|
2228
|
+
_context21.next = 12;
|
|
2135
2229
|
return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
|
|
2136
2230
|
case 12:
|
|
2137
|
-
result =
|
|
2138
|
-
|
|
2231
|
+
result = _context21.sent;
|
|
2232
|
+
_context21.next = 15;
|
|
2139
2233
|
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
2140
2234
|
orderId: snapshot.identity.orderId,
|
|
2141
2235
|
customerId: walletBusinessData.customer_id,
|
|
@@ -2147,12 +2241,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2147
2241
|
timestamp: Date.now()
|
|
2148
2242
|
});
|
|
2149
2243
|
case 15:
|
|
2150
|
-
return
|
|
2244
|
+
return _context21.abrupt("return", result);
|
|
2151
2245
|
case 16:
|
|
2152
2246
|
case "end":
|
|
2153
|
-
return
|
|
2247
|
+
return _context21.stop();
|
|
2154
2248
|
}
|
|
2155
|
-
},
|
|
2249
|
+
}, _callee21, this);
|
|
2156
2250
|
}));
|
|
2157
2251
|
function initWalletData(_x16) {
|
|
2158
2252
|
return _initWalletData.apply(this, arguments);
|
|
@@ -2181,33 +2275,48 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2181
2275
|
}, {
|
|
2182
2276
|
key: "getPaymentMethodsAsync",
|
|
2183
2277
|
value: (function () {
|
|
2184
|
-
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2185
|
-
var response;
|
|
2186
|
-
return _regeneratorRuntime().wrap(function
|
|
2187
|
-
while (1) switch (
|
|
2278
|
+
var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2279
|
+
var response, paymentMethods;
|
|
2280
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2281
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
2188
2282
|
case 0:
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2283
|
+
_context22.prev = 0;
|
|
2284
|
+
_context22.next = 3;
|
|
2285
|
+
return this.request.get('/pay/custom-payment/all', {
|
|
2286
|
+
filterPaymentMethods: true
|
|
2287
|
+
}, {
|
|
2288
|
+
osServer: true
|
|
2289
|
+
});
|
|
2290
|
+
case 3:
|
|
2291
|
+
response = _context22.sent;
|
|
2292
|
+
paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
|
|
2293
|
+
this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
|
|
2294
|
+
return _context22.abrupt("return", this.getPaymentMethods());
|
|
2295
|
+
case 9:
|
|
2296
|
+
_context22.prev = 9;
|
|
2297
|
+
_context22.t0 = _context22["catch"](0);
|
|
2298
|
+
this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
|
|
2299
|
+
error: _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0)
|
|
2300
|
+
});
|
|
2301
|
+
return _context22.abrupt("return", this.getPaymentMethods());
|
|
2302
|
+
case 13:
|
|
2201
2303
|
case "end":
|
|
2202
|
-
return
|
|
2304
|
+
return _context22.stop();
|
|
2203
2305
|
}
|
|
2204
|
-
},
|
|
2306
|
+
}, _callee22, this, [[0, 9]]);
|
|
2205
2307
|
}));
|
|
2206
2308
|
function getPaymentMethodsAsync() {
|
|
2207
2309
|
return _getPaymentMethodsAsync.apply(this, arguments);
|
|
2208
2310
|
}
|
|
2209
2311
|
return getPaymentMethodsAsync;
|
|
2210
|
-
}() /**
|
|
2312
|
+
}() /** 同步读取初始化时缓存的支付方式列表。 */)
|
|
2313
|
+
}, {
|
|
2314
|
+
key: "getPaymentMethods",
|
|
2315
|
+
value: function getPaymentMethods() {
|
|
2316
|
+
return _toConsumableArray(this.paymentMethodsCache);
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
/** 轻量舍入能力,供现金支付 UI 计算 rounding_amount。 */
|
|
2211
2320
|
}, {
|
|
2212
2321
|
key: "roundAmount",
|
|
2213
2322
|
value: function roundAmount(params) {
|
|
@@ -2242,47 +2351,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2242
2351
|
}, {
|
|
2243
2352
|
key: "sendCustomerPayLink",
|
|
2244
2353
|
value: (function () {
|
|
2245
|
-
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2354
|
+
var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
|
|
2246
2355
|
var orderIds, _ref12, _ref13, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
|
|
2247
|
-
return _regeneratorRuntime().wrap(function
|
|
2248
|
-
while (1) switch (
|
|
2356
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
2357
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
2249
2358
|
case 0:
|
|
2250
2359
|
if (this.store.order) {
|
|
2251
|
-
|
|
2360
|
+
_context23.next = 2;
|
|
2252
2361
|
break;
|
|
2253
2362
|
}
|
|
2254
2363
|
throw new Error('order 模块未初始化');
|
|
2255
2364
|
case 2:
|
|
2256
2365
|
orderIds = params.order_ids || params.orderIds || [];
|
|
2257
2366
|
if (!(!orderIds.length || params.submitBeforeSend)) {
|
|
2258
|
-
|
|
2367
|
+
_context23.next = 11;
|
|
2259
2368
|
break;
|
|
2260
2369
|
}
|
|
2261
|
-
|
|
2370
|
+
_context23.next = 6;
|
|
2262
2371
|
return this.submitSalesOrder({
|
|
2263
2372
|
smallTicketDataFlag: 1
|
|
2264
2373
|
});
|
|
2265
2374
|
case 6:
|
|
2266
|
-
submitResult =
|
|
2375
|
+
submitResult = _context23.sent;
|
|
2267
2376
|
orderId = (_ref12 = (_ref13 = (_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 && _ref13 !== void 0 ? _ref13 : submitResult === null || submitResult === void 0 || (_submitResult$data2 = submitResult.data) === null || _submitResult$data2 === void 0 ? void 0 : _submitResult$data2.id) !== null && _ref12 !== void 0 ? _ref12 : submitResult === null || submitResult === void 0 ? void 0 : submitResult.id;
|
|
2268
2377
|
if (orderId) {
|
|
2269
|
-
|
|
2378
|
+
_context23.next = 10;
|
|
2270
2379
|
break;
|
|
2271
2380
|
}
|
|
2272
2381
|
throw new Error('本地订单提交云端失败,无法发送支付链接');
|
|
2273
2382
|
case 10:
|
|
2274
2383
|
orderIds = [orderId];
|
|
2275
2384
|
case 11:
|
|
2276
|
-
return
|
|
2385
|
+
return _context23.abrupt("return", this.store.order.sendCustomerPayLink({
|
|
2277
2386
|
emails: params.emails,
|
|
2278
2387
|
notify_action: params.notify_action,
|
|
2279
2388
|
order_ids: orderIds
|
|
2280
2389
|
}));
|
|
2281
2390
|
case 12:
|
|
2282
2391
|
case "end":
|
|
2283
|
-
return
|
|
2392
|
+
return _context23.stop();
|
|
2284
2393
|
}
|
|
2285
|
-
},
|
|
2394
|
+
}, _callee23, this);
|
|
2286
2395
|
}));
|
|
2287
2396
|
function sendCustomerPayLink(_x17) {
|
|
2288
2397
|
return _sendCustomerPayLink.apply(this, arguments);
|
|
@@ -2297,27 +2406,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2297
2406
|
}, {
|
|
2298
2407
|
key: "calculateProductBookingPrice",
|
|
2299
2408
|
value: function () {
|
|
2300
|
-
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2409
|
+
var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
|
|
2301
2410
|
var _params$customer_id;
|
|
2302
2411
|
var quotation, customerId, authoritativeProduct, product;
|
|
2303
|
-
return _regeneratorRuntime().wrap(function
|
|
2304
|
-
while (1) switch (
|
|
2412
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
2413
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
2305
2414
|
case 0:
|
|
2306
2415
|
quotation = this.store.quotation;
|
|
2307
2416
|
customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
|
|
2308
|
-
|
|
2417
|
+
_context24.next = 4;
|
|
2309
2418
|
return this.loadProductForPriceQuery(params, customerId);
|
|
2310
2419
|
case 4:
|
|
2311
|
-
authoritativeProduct =
|
|
2420
|
+
authoritativeProduct = _context24.sent;
|
|
2312
2421
|
product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
|
|
2313
|
-
|
|
2422
|
+
_context24.next = 8;
|
|
2314
2423
|
return this.loadQuotationForPriceQuery({
|
|
2315
2424
|
quotation: quotation,
|
|
2316
2425
|
customer_id: customerId,
|
|
2317
2426
|
channel: params.channel
|
|
2318
2427
|
});
|
|
2319
2428
|
case 8:
|
|
2320
|
-
return
|
|
2429
|
+
return _context24.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
|
|
2321
2430
|
product: product,
|
|
2322
2431
|
fallback_price: authoritativeProduct ? undefined : params.fallback_price,
|
|
2323
2432
|
customer_id: customerId,
|
|
@@ -2325,9 +2434,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2325
2434
|
})));
|
|
2326
2435
|
case 9:
|
|
2327
2436
|
case "end":
|
|
2328
|
-
return
|
|
2437
|
+
return _context24.stop();
|
|
2329
2438
|
}
|
|
2330
|
-
},
|
|
2439
|
+
}, _callee24, this);
|
|
2331
2440
|
}));
|
|
2332
2441
|
function calculateProductBookingPrice(_x18) {
|
|
2333
2442
|
return _calculateProductBookingPrice.apply(this, arguments);
|
|
@@ -2337,32 +2446,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2337
2446
|
}, {
|
|
2338
2447
|
key: "addProductToOrder",
|
|
2339
2448
|
value: function () {
|
|
2340
|
-
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2449
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product, booking) {
|
|
2341
2450
|
var products;
|
|
2342
|
-
return _regeneratorRuntime().wrap(function
|
|
2343
|
-
while (1) switch (
|
|
2451
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2452
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
2344
2453
|
case 0:
|
|
2345
|
-
|
|
2454
|
+
_context25.prev = 0;
|
|
2346
2455
|
if (this.store.order) {
|
|
2347
|
-
|
|
2456
|
+
_context25.next = 3;
|
|
2348
2457
|
break;
|
|
2349
2458
|
}
|
|
2350
2459
|
throw new Error('order 模块未初始化');
|
|
2351
2460
|
case 3:
|
|
2352
|
-
|
|
2461
|
+
_context25.next = 5;
|
|
2353
2462
|
return this.store.order.addProductToOrder(product, booking);
|
|
2354
2463
|
case 5:
|
|
2355
|
-
products =
|
|
2356
|
-
return
|
|
2464
|
+
products = _context25.sent;
|
|
2465
|
+
return _context25.abrupt("return", products);
|
|
2357
2466
|
case 9:
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
throw
|
|
2467
|
+
_context25.prev = 9;
|
|
2468
|
+
_context25.t0 = _context25["catch"](0);
|
|
2469
|
+
throw _context25.t0;
|
|
2361
2470
|
case 12:
|
|
2362
2471
|
case "end":
|
|
2363
|
-
return
|
|
2472
|
+
return _context25.stop();
|
|
2364
2473
|
}
|
|
2365
|
-
},
|
|
2474
|
+
}, _callee25, this, [[0, 9]]);
|
|
2366
2475
|
}));
|
|
2367
2476
|
function addProductToOrder(_x19, _x20) {
|
|
2368
2477
|
return _addProductToOrder.apply(this, arguments);
|
|
@@ -2372,32 +2481,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2372
2481
|
}, {
|
|
2373
2482
|
key: "updateOrderProduct",
|
|
2374
2483
|
value: function () {
|
|
2375
|
-
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2484
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
|
|
2376
2485
|
var products;
|
|
2377
|
-
return _regeneratorRuntime().wrap(function
|
|
2378
|
-
while (1) switch (
|
|
2486
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2487
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2379
2488
|
case 0:
|
|
2380
|
-
|
|
2489
|
+
_context26.prev = 0;
|
|
2381
2490
|
if (this.store.order) {
|
|
2382
|
-
|
|
2491
|
+
_context26.next = 3;
|
|
2383
2492
|
break;
|
|
2384
2493
|
}
|
|
2385
2494
|
throw new Error('order 模块未初始化');
|
|
2386
2495
|
case 3:
|
|
2387
|
-
|
|
2496
|
+
_context26.next = 5;
|
|
2388
2497
|
return this.store.order.updateOrderProduct(params);
|
|
2389
2498
|
case 5:
|
|
2390
|
-
products =
|
|
2391
|
-
return
|
|
2499
|
+
products = _context26.sent;
|
|
2500
|
+
return _context26.abrupt("return", products);
|
|
2392
2501
|
case 9:
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
throw
|
|
2502
|
+
_context26.prev = 9;
|
|
2503
|
+
_context26.t0 = _context26["catch"](0);
|
|
2504
|
+
throw _context26.t0;
|
|
2396
2505
|
case 12:
|
|
2397
2506
|
case "end":
|
|
2398
|
-
return
|
|
2507
|
+
return _context26.stop();
|
|
2399
2508
|
}
|
|
2400
|
-
},
|
|
2509
|
+
}, _callee26, this, [[0, 9]]);
|
|
2401
2510
|
}));
|
|
2402
2511
|
function updateOrderProduct(_x21) {
|
|
2403
2512
|
return _updateOrderProduct.apply(this, arguments);
|
|
@@ -2407,32 +2516,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2407
2516
|
}, {
|
|
2408
2517
|
key: "updateOrderProductQuantity",
|
|
2409
2518
|
value: function () {
|
|
2410
|
-
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2519
|
+
var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
|
|
2411
2520
|
var products;
|
|
2412
|
-
return _regeneratorRuntime().wrap(function
|
|
2413
|
-
while (1) switch (
|
|
2521
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2522
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2414
2523
|
case 0:
|
|
2415
|
-
|
|
2524
|
+
_context27.prev = 0;
|
|
2416
2525
|
if (this.store.order) {
|
|
2417
|
-
|
|
2526
|
+
_context27.next = 3;
|
|
2418
2527
|
break;
|
|
2419
2528
|
}
|
|
2420
2529
|
throw new Error('order 模块未初始化');
|
|
2421
2530
|
case 3:
|
|
2422
|
-
|
|
2531
|
+
_context27.next = 5;
|
|
2423
2532
|
return this.store.order.updateOrderProductQuantity(params);
|
|
2424
2533
|
case 5:
|
|
2425
|
-
products =
|
|
2426
|
-
return
|
|
2534
|
+
products = _context27.sent;
|
|
2535
|
+
return _context27.abrupt("return", products);
|
|
2427
2536
|
case 9:
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
throw
|
|
2537
|
+
_context27.prev = 9;
|
|
2538
|
+
_context27.t0 = _context27["catch"](0);
|
|
2539
|
+
throw _context27.t0;
|
|
2431
2540
|
case 12:
|
|
2432
2541
|
case "end":
|
|
2433
|
-
return
|
|
2542
|
+
return _context27.stop();
|
|
2434
2543
|
}
|
|
2435
|
-
},
|
|
2544
|
+
}, _callee27, this, [[0, 9]]);
|
|
2436
2545
|
}));
|
|
2437
2546
|
function updateOrderProductQuantity(_x22) {
|
|
2438
2547
|
return _updateOrderProductQuantity.apply(this, arguments);
|
|
@@ -2457,12 +2566,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2457
2566
|
}, {
|
|
2458
2567
|
key: "setOrderProductLineNote",
|
|
2459
2568
|
value: (function () {
|
|
2460
|
-
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2569
|
+
var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity, note) {
|
|
2461
2570
|
var params, products;
|
|
2462
|
-
return _regeneratorRuntime().wrap(function
|
|
2463
|
-
while (1) switch (
|
|
2571
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2572
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2464
2573
|
case 0:
|
|
2465
|
-
|
|
2574
|
+
_context28.prev = 0;
|
|
2466
2575
|
params = {
|
|
2467
2576
|
product_id: identity.product_id,
|
|
2468
2577
|
product_variant_id: identity.product_variant_id,
|
|
@@ -2477,20 +2586,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2477
2586
|
params.product_sku = identity.product_sku;
|
|
2478
2587
|
}
|
|
2479
2588
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
2480
|
-
|
|
2589
|
+
_context28.next = 7;
|
|
2481
2590
|
return this.updateOrderProduct(params);
|
|
2482
2591
|
case 7:
|
|
2483
|
-
products =
|
|
2484
|
-
return
|
|
2592
|
+
products = _context28.sent;
|
|
2593
|
+
return _context28.abrupt("return", products);
|
|
2485
2594
|
case 11:
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
throw
|
|
2595
|
+
_context28.prev = 11;
|
|
2596
|
+
_context28.t0 = _context28["catch"](0);
|
|
2597
|
+
throw _context28.t0;
|
|
2489
2598
|
case 14:
|
|
2490
2599
|
case "end":
|
|
2491
|
-
return
|
|
2600
|
+
return _context28.stop();
|
|
2492
2601
|
}
|
|
2493
|
-
},
|
|
2602
|
+
}, _callee28, this, [[0, 11]]);
|
|
2494
2603
|
}));
|
|
2495
2604
|
function setOrderProductLineNote(_x23, _x24) {
|
|
2496
2605
|
return _setOrderProductLineNote.apply(this, arguments);
|
|
@@ -2507,30 +2616,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2507
2616
|
}, {
|
|
2508
2617
|
key: "removeProductsFromOrder",
|
|
2509
2618
|
value: (function () {
|
|
2510
|
-
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2511
|
-
return _regeneratorRuntime().wrap(function
|
|
2512
|
-
while (1) switch (
|
|
2619
|
+
var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identities) {
|
|
2620
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2621
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2513
2622
|
case 0:
|
|
2514
|
-
|
|
2623
|
+
_context29.prev = 0;
|
|
2515
2624
|
if (this.store.order) {
|
|
2516
|
-
|
|
2625
|
+
_context29.next = 3;
|
|
2517
2626
|
break;
|
|
2518
2627
|
}
|
|
2519
2628
|
throw new Error('order 模块未初始化');
|
|
2520
2629
|
case 3:
|
|
2521
|
-
|
|
2630
|
+
_context29.next = 5;
|
|
2522
2631
|
return this.store.order.removeProductsFromOrder(identities);
|
|
2523
2632
|
case 5:
|
|
2524
|
-
return
|
|
2633
|
+
return _context29.abrupt("return", _context29.sent);
|
|
2525
2634
|
case 8:
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
throw
|
|
2635
|
+
_context29.prev = 8;
|
|
2636
|
+
_context29.t0 = _context29["catch"](0);
|
|
2637
|
+
throw _context29.t0;
|
|
2529
2638
|
case 11:
|
|
2530
2639
|
case "end":
|
|
2531
|
-
return
|
|
2640
|
+
return _context29.stop();
|
|
2532
2641
|
}
|
|
2533
|
-
},
|
|
2642
|
+
}, _callee29, this, [[0, 8]]);
|
|
2534
2643
|
}));
|
|
2535
2644
|
function removeProductsFromOrder(_x25) {
|
|
2536
2645
|
return _removeProductsFromOrder.apply(this, arguments);
|
|
@@ -2540,16 +2649,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2540
2649
|
}, {
|
|
2541
2650
|
key: "removeProductFromOrder",
|
|
2542
2651
|
value: function () {
|
|
2543
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2544
|
-
return _regeneratorRuntime().wrap(function
|
|
2545
|
-
while (1) switch (
|
|
2652
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(identity) {
|
|
2653
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2654
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2546
2655
|
case 0:
|
|
2547
|
-
return
|
|
2656
|
+
return _context30.abrupt("return", this.removeProductsFromOrder([identity]));
|
|
2548
2657
|
case 1:
|
|
2549
2658
|
case "end":
|
|
2550
|
-
return
|
|
2659
|
+
return _context30.stop();
|
|
2551
2660
|
}
|
|
2552
|
-
},
|
|
2661
|
+
}, _callee30, this);
|
|
2553
2662
|
}));
|
|
2554
2663
|
function removeProductFromOrder(_x26) {
|
|
2555
2664
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -2601,23 +2710,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2601
2710
|
}, {
|
|
2602
2711
|
key: "applyPromotion",
|
|
2603
2712
|
value: (function () {
|
|
2604
|
-
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2605
|
-
return _regeneratorRuntime().wrap(function
|
|
2606
|
-
while (1) switch (
|
|
2713
|
+
var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2714
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2715
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2607
2716
|
case 0:
|
|
2608
2717
|
if (this.store.order) {
|
|
2609
|
-
|
|
2718
|
+
_context31.next = 2;
|
|
2610
2719
|
break;
|
|
2611
2720
|
}
|
|
2612
2721
|
throw new Error('order 模块未初始化');
|
|
2613
2722
|
case 2:
|
|
2614
|
-
|
|
2723
|
+
_context31.next = 4;
|
|
2615
2724
|
return this.store.order.applyPromotion();
|
|
2616
2725
|
case 4:
|
|
2617
2726
|
case "end":
|
|
2618
|
-
return
|
|
2727
|
+
return _context31.stop();
|
|
2619
2728
|
}
|
|
2620
|
-
},
|
|
2729
|
+
}, _callee31, this);
|
|
2621
2730
|
}));
|
|
2622
2731
|
function applyPromotion() {
|
|
2623
2732
|
return _applyPromotion.apply(this, arguments);
|
|
@@ -2627,16 +2736,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2627
2736
|
}, {
|
|
2628
2737
|
key: "getUnfulfilledPromotions",
|
|
2629
2738
|
value: function getUnfulfilledPromotions() {
|
|
2630
|
-
var _this$store$
|
|
2631
|
-
return ((_this$store$
|
|
2739
|
+
var _this$store$order6;
|
|
2740
|
+
return ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getUnfulfilledPromotions()) || [];
|
|
2632
2741
|
}
|
|
2633
2742
|
|
|
2634
2743
|
/** 最近一次促销计算输出的赠品操作 diff。 */
|
|
2635
2744
|
}, {
|
|
2636
2745
|
key: "getLastGiftActions",
|
|
2637
2746
|
value: function getLastGiftActions() {
|
|
2638
|
-
var _this$store$
|
|
2639
|
-
return ((_this$store$
|
|
2747
|
+
var _this$store$order7;
|
|
2748
|
+
return ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getLastGiftActions()) || null;
|
|
2640
2749
|
}
|
|
2641
2750
|
|
|
2642
2751
|
// 获取商品列表
|
|
@@ -2644,18 +2753,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2644
2753
|
}, {
|
|
2645
2754
|
key: "getProductList",
|
|
2646
2755
|
value: function () {
|
|
2647
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2648
|
-
var _this$
|
|
2756
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2757
|
+
var _this$otherParams17;
|
|
2649
2758
|
var menu_list_ids, _this$store$products, res;
|
|
2650
|
-
return _regeneratorRuntime().wrap(function
|
|
2651
|
-
while (1) switch (
|
|
2759
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2760
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2652
2761
|
case 0:
|
|
2653
2762
|
// 可以直接通过配置里的 menu 读取
|
|
2654
|
-
menu_list_ids = ((_this$
|
|
2763
|
+
menu_list_ids = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 || (_this$otherParams17 = _this$otherParams17.dineInConfig) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17['menu.associated_menus'].map(function (n) {
|
|
2655
2764
|
return Number(n.value);
|
|
2656
2765
|
})) || [];
|
|
2657
|
-
|
|
2658
|
-
|
|
2766
|
+
_context32.prev = 1;
|
|
2767
|
+
_context32.next = 4;
|
|
2659
2768
|
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2660
2769
|
menu_list_ids: menu_list_ids,
|
|
2661
2770
|
cacheId: this.cacheId,
|
|
@@ -2663,17 +2772,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2663
2772
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2664
2773
|
});
|
|
2665
2774
|
case 4:
|
|
2666
|
-
res =
|
|
2667
|
-
return
|
|
2775
|
+
res = _context32.sent;
|
|
2776
|
+
return _context32.abrupt("return", res);
|
|
2668
2777
|
case 8:
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
throw
|
|
2778
|
+
_context32.prev = 8;
|
|
2779
|
+
_context32.t0 = _context32["catch"](1);
|
|
2780
|
+
throw _context32.t0;
|
|
2672
2781
|
case 11:
|
|
2673
2782
|
case "end":
|
|
2674
|
-
return
|
|
2783
|
+
return _context32.stop();
|
|
2675
2784
|
}
|
|
2676
|
-
},
|
|
2785
|
+
}, _callee32, this, [[1, 8]]);
|
|
2677
2786
|
}));
|
|
2678
2787
|
function getProductList() {
|
|
2679
2788
|
return _getProductList.apply(this, arguments);
|
|
@@ -2688,15 +2797,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2688
2797
|
}, {
|
|
2689
2798
|
key: "setOtherParams",
|
|
2690
2799
|
value: function () {
|
|
2691
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2800
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
|
|
2692
2801
|
var _ref14,
|
|
2693
2802
|
_ref14$cover,
|
|
2694
2803
|
cover,
|
|
2695
|
-
|
|
2696
|
-
return _regeneratorRuntime().wrap(function
|
|
2697
|
-
while (1) switch (
|
|
2804
|
+
_args33 = arguments;
|
|
2805
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2806
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2698
2807
|
case 0:
|
|
2699
|
-
_ref14 =
|
|
2808
|
+
_ref14 = _args33.length > 1 && _args33[1] !== undefined ? _args33[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
|
|
2700
2809
|
if (cover) {
|
|
2701
2810
|
this.otherParams = params;
|
|
2702
2811
|
} else {
|
|
@@ -2704,9 +2813,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2704
2813
|
}
|
|
2705
2814
|
case 2:
|
|
2706
2815
|
case "end":
|
|
2707
|
-
return
|
|
2816
|
+
return _context33.stop();
|
|
2708
2817
|
}
|
|
2709
|
-
},
|
|
2818
|
+
}, _callee33, this);
|
|
2710
2819
|
}));
|
|
2711
2820
|
function setOtherParams(_x27) {
|
|
2712
2821
|
return _setOtherParams.apply(this, arguments);
|