@pisell/pisellos 2.2.205 → 2.2.207

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.
Files changed (44) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/index.d.ts +1 -0
  3. package/dist/modules/OpenData/index.js +21 -16
  4. package/dist/modules/Order/index.d.ts +9 -0
  5. package/dist/modules/Order/index.js +230 -145
  6. package/dist/modules/Order/types.d.ts +10 -0
  7. package/dist/modules/Order/utils.js +7 -5
  8. package/dist/server/index.d.ts +136 -0
  9. package/dist/server/index.js +2055 -781
  10. package/dist/server/modules/order/index.d.ts +7 -0
  11. package/dist/server/modules/order/index.js +375 -337
  12. package/dist/server/modules/order/types.d.ts +15 -0
  13. package/dist/server/modules/order/types.js +8 -0
  14. package/dist/server/utils/small-ticket.d.ts +69 -0
  15. package/dist/server/utils/small-ticket.js +528 -0
  16. package/dist/solution/BaseSales/index.d.ts +4 -2
  17. package/dist/solution/BaseSales/index.js +248 -188
  18. package/dist/solution/BookingByStep/index.d.ts +1 -1
  19. package/dist/solution/BookingTicket/index.d.ts +8 -1
  20. package/dist/solution/BookingTicket/index.js +443 -263
  21. package/dist/solution/BookingTicket/types.d.ts +2 -1
  22. package/dist/solution/BookingTicket/types.js +3 -1
  23. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  24. package/lib/modules/OpenData/index.d.ts +1 -0
  25. package/lib/modules/OpenData/index.js +6 -4
  26. package/lib/modules/Order/index.d.ts +9 -0
  27. package/lib/modules/Order/index.js +59 -3
  28. package/lib/modules/Order/types.d.ts +10 -0
  29. package/lib/modules/Order/utils.js +4 -3
  30. package/lib/server/index.d.ts +136 -0
  31. package/lib/server/index.js +823 -50
  32. package/lib/server/modules/order/index.d.ts +7 -0
  33. package/lib/server/modules/order/index.js +21 -7
  34. package/lib/server/modules/order/types.d.ts +15 -0
  35. package/lib/server/utils/small-ticket.d.ts +69 -0
  36. package/lib/server/utils/small-ticket.js +555 -0
  37. package/lib/solution/BaseSales/index.d.ts +4 -2
  38. package/lib/solution/BaseSales/index.js +47 -1
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/lib/solution/BookingTicket/index.d.ts +8 -1
  41. package/lib/solution/BookingTicket/index.js +108 -1
  42. package/lib/solution/BookingTicket/types.d.ts +2 -1
  43. package/lib/solution/BookingTicket/types.js +5 -0
  44. package/package.json +1 -1
@@ -1,10 +1,4 @@
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
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; }
10
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); } }
@@ -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);
@@ -657,7 +671,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
657
671
  value: (function () {
658
672
  var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(orderIdOrParams) {
659
673
  var _ref9, _params$orderId;
660
- var params, externalSaleNumber, lookup, res, message, sales;
674
+ var params, externalSaleNumber, lookup, res, message, currentTempOrder, record, sales;
661
675
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
662
676
  while (1) switch (_context5.prev = _context5.next) {
663
677
  case 0:
@@ -692,20 +706,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
692
706
  message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(lookup);
693
707
  throw new Error(message);
694
708
  case 13:
695
- _context5.next = 15;
696
- return this.store.order.hydrateTempOrderFromRecord(res.data, {
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, {
697
713
  recalcOnHydrate: false
698
714
  });
699
- case 15:
715
+ case 17:
700
716
  sales = _context5.sent;
701
717
  this.currentSalesDetail = sales;
702
- _context5.next = 19;
718
+ _context5.next = 21;
703
719
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
704
720
  sales: sales
705
721
  });
706
- case 19:
722
+ case 21:
707
723
  return _context5.abrupt("return", sales);
708
- case 20:
724
+ case 22:
709
725
  case "end":
710
726
  return _context5.stop();
711
727
  }
@@ -1881,12 +1897,56 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1881
1897
  }
1882
1898
  return submitSalesOrder;
1883
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
+ }()
1884
1944
  }, {
1885
1945
  key: "getSubmitPaymentStatus",
1886
1946
  value: function getSubmitPaymentStatus(paymentStatus) {
1887
- var _this$store$order3, _this$store$order3$ge;
1947
+ var _this$store$order4, _this$store$order4$ge;
1888
1948
  if (paymentStatus !== undefined) return paymentStatus;
1889
- var amountSnapshot = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderAmountSnapshot) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
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);
1890
1950
  if (!amountSnapshot) return undefined;
1891
1951
  try {
1892
1952
  return new Decimal(amountSnapshot.amountGap || 0).lte(0) ? 'paid' : undefined;
@@ -1897,19 +1957,19 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1897
1957
  }, {
1898
1958
  key: "syncPaymentsToOrder",
1899
1959
  value: function () {
1900
- var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1901
- var _ref10, _params$businessCode, _this$otherParams10, _this$otherParams11, _params$channel;
1960
+ var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1961
+ var _ref10, _params$businessCode, _this$otherParams14, _this$otherParams15, _params$channel;
1902
1962
  var businessCode, channel, syncParams, syncState, payments, syncResult;
1903
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1904
- while (1) switch (_context19.prev = _context19.next) {
1963
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1964
+ while (1) switch (_context20.prev = _context20.next) {
1905
1965
  case 0:
1906
1966
  if (this.store.order) {
1907
- _context19.next = 2;
1967
+ _context20.next = 2;
1908
1968
  break;
1909
1969
  }
1910
1970
  throw new Error('order 模块未初始化');
1911
1971
  case 2:
1912
- businessCode = (_ref10 = (_params$businessCode = params.businessCode) !== null && _params$businessCode !== void 0 ? _params$businessCode : (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _ref10 !== void 0 ? _ref10 : (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.business_code;
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;
1913
1973
  channel = (_params$channel = params.channel) !== null && _params$channel !== void 0 ? _params$channel : this.getSubmitOrderSalesChannel();
1914
1974
  syncParams = _objectSpread(_objectSpread(_objectSpread({}, params), businessCode !== undefined ? {
1915
1975
  businessCode: businessCode
@@ -1918,13 +1978,13 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1918
1978
  } : {});
1919
1979
  syncState = this.store.order.getOrderSyncState();
1920
1980
  if (!(params.submitWhenPaid && syncState === 'submitting')) {
1921
- _context19.next = 8;
1981
+ _context20.next = 8;
1922
1982
  break;
1923
1983
  }
1924
- return _context19.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
1984
+ return _context20.abrupt("return", this.store.order.syncPaymentsToOrder(syncParams));
1925
1985
  case 8:
1926
1986
  payments = params.payments || [];
1927
- _context19.next = 11;
1987
+ _context20.next = 11;
1928
1988
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncStart, {
1929
1989
  payments: payments,
1930
1990
  params: syncParams,
@@ -1932,12 +1992,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1932
1992
  orderSnapshot: this.store.order.getOrderSnapshot()
1933
1993
  });
1934
1994
  case 11:
1935
- _context19.prev = 11;
1936
- _context19.next = 14;
1995
+ _context20.prev = 11;
1996
+ _context20.next = 14;
1937
1997
  return this.store.order.syncPaymentsToOrder(syncParams);
1938
1998
  case 14:
1939
- syncResult = _context19.sent;
1940
- _context19.next = 17;
1999
+ syncResult = _context20.sent;
2000
+ _context20.next = 17;
1941
2001
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1942
2002
  ok: true,
1943
2003
  syncResult: syncResult,
@@ -1947,26 +2007,26 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1947
2007
  orderSnapshot: this.store.order.getOrderSnapshot()
1948
2008
  });
1949
2009
  case 17:
1950
- return _context19.abrupt("return", syncResult);
2010
+ return _context20.abrupt("return", syncResult);
1951
2011
  case 20:
1952
- _context19.prev = 20;
1953
- _context19.t0 = _context19["catch"](11);
1954
- _context19.next = 24;
2012
+ _context20.prev = 20;
2013
+ _context20.t0 = _context20["catch"](11);
2014
+ _context20.next = 24;
1955
2015
  return this.effectsEmit(BaseSalesHookNames.onPaymentSyncEnd, {
1956
2016
  ok: false,
1957
- error: _context19.t0,
2017
+ error: _context20.t0,
1958
2018
  payments: this.store.order.getOrderPayments(),
1959
2019
  params: syncParams,
1960
2020
  amountSnapshot: this.store.order.getOrderAmountSnapshot(),
1961
2021
  orderSnapshot: this.store.order.getOrderSnapshot()
1962
2022
  });
1963
2023
  case 24:
1964
- throw _context19.t0;
2024
+ throw _context20.t0;
1965
2025
  case 25:
1966
2026
  case "end":
1967
- return _context19.stop();
2027
+ return _context20.stop();
1968
2028
  }
1969
- }, _callee19, this, [[11, 20]]);
2029
+ }, _callee20, this, [[11, 20]]);
1970
2030
  }));
1971
2031
  function syncPaymentsToOrder(_x15) {
1972
2032
  return _syncPaymentsToOrder.apply(this, arguments);
@@ -1993,7 +2053,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
1993
2053
  }, {
1994
2054
  key: "addOrderPayment",
1995
2055
  value: function addOrderPayment(payment) {
1996
- var _this$otherParams12,
2056
+ var _this$otherParams16,
1997
2057
  _this7 = this;
1998
2058
  if (!this.store.order) throw new Error('order 模块未初始化');
1999
2059
  var paymentRecord = payment;
@@ -2005,7 +2065,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2005
2065
  return this.store.order.getOrderPayments();
2006
2066
  }
2007
2067
  var metadata = paymentRecord.metadata && _typeof(paymentRecord.metadata) === 'object' ? _objectSpread({}, paymentRecord.metadata) : {};
2008
- var shopWalletPassId = (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.shop_wallet_pass_id;
2068
+ var shopWalletPassId = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.shop_wallet_pass_id;
2009
2069
  if (shopWalletPassId !== undefined && shopWalletPassId !== null) {
2010
2070
  metadata.shop_wallet_pass_id = shopWalletPassId;
2011
2071
  }
@@ -2029,7 +2089,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2029
2089
  error: error instanceof Error ? error.message : String(error)
2030
2090
  });
2031
2091
  });
2032
- }
2092
+ } else {}
2033
2093
  return payments;
2034
2094
  }
2035
2095
 
@@ -2059,8 +2119,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2059
2119
  }, {
2060
2120
  key: "getWalletProductList",
2061
2121
  value: function getWalletProductList() {
2062
- var _this$store$order4, _tempOrder$products, _tempOrder$products2;
2063
- var tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder();
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();
2064
2124
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return [];
2065
2125
  // 过滤出有 product_id的商品来,如果没有代表他是自定义商品,不需要参与 wallet
2066
2126
  var products = tempOrder === null || tempOrder === void 0 || (_tempOrder$products2 = tempOrder.products) === null || _tempOrder$products2 === void 0 ? void 0 : _tempOrder$products2.filter(function (n) {
@@ -2117,20 +2177,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2117
2177
  }, {
2118
2178
  key: "initWalletData",
2119
2179
  value: function () {
2120
- var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
2180
+ var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
2121
2181
  var _params$order_wait_pa, _ref11, _tempOrder$is_price_i;
2122
2182
  var snapshot, tempOrder, amount, walletBusinessData, result;
2123
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2124
- while (1) switch (_context20.prev = _context20.next) {
2183
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2184
+ while (1) switch (_context21.prev = _context21.next) {
2125
2185
  case 0:
2126
2186
  if (this.store.order) {
2127
- _context20.next = 2;
2187
+ _context21.next = 2;
2128
2188
  break;
2129
2189
  }
2130
2190
  throw new Error('order 模块未初始化');
2131
2191
  case 2:
2132
2192
  if (this.store.payment) {
2133
- _context20.next = 4;
2193
+ _context21.next = 4;
2134
2194
  break;
2135
2195
  }
2136
2196
  throw new Error('payment 模块未初始化');
@@ -2139,10 +2199,10 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2139
2199
  tempOrder = snapshot === null || snapshot === void 0 ? void 0 : snapshot.tempOrder;
2140
2200
  amount = snapshot === null || snapshot === void 0 ? void 0 : snapshot.amount;
2141
2201
  if (!(!tempOrder || !amount)) {
2142
- _context20.next = 9;
2202
+ _context21.next = 9;
2143
2203
  break;
2144
2204
  }
2145
- return _context20.abrupt("return", {
2205
+ return _context21.abrupt("return", {
2146
2206
  walletRecommendList: [],
2147
2207
  userIdentificationCodes: [],
2148
2208
  transformList: [],
@@ -2165,11 +2225,11 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2165
2225
  }, snapshot.identity.orderId ? {
2166
2226
  payment_order_id: String(snapshot.identity.orderId)
2167
2227
  } : {});
2168
- _context20.next = 12;
2228
+ _context21.next = 12;
2169
2229
  return this.store.payment.wallet.initializeWalletDataFromBusinessAsync(walletBusinessData);
2170
2230
  case 12:
2171
- result = _context20.sent;
2172
- _context20.next = 15;
2231
+ result = _context21.sent;
2232
+ _context21.next = 15;
2173
2233
  return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
2174
2234
  orderId: snapshot.identity.orderId,
2175
2235
  customerId: walletBusinessData.customer_id,
@@ -2181,12 +2241,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2181
2241
  timestamp: Date.now()
2182
2242
  });
2183
2243
  case 15:
2184
- return _context20.abrupt("return", result);
2244
+ return _context21.abrupt("return", result);
2185
2245
  case 16:
2186
2246
  case "end":
2187
- return _context20.stop();
2247
+ return _context21.stop();
2188
2248
  }
2189
- }, _callee20, this);
2249
+ }, _callee21, this);
2190
2250
  }));
2191
2251
  function initWalletData(_x16) {
2192
2252
  return _initWalletData.apply(this, arguments);
@@ -2215,35 +2275,35 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2215
2275
  }, {
2216
2276
  key: "getPaymentMethodsAsync",
2217
2277
  value: (function () {
2218
- var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2278
+ var _getPaymentMethodsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2219
2279
  var response, paymentMethods;
2220
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2221
- while (1) switch (_context21.prev = _context21.next) {
2280
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2281
+ while (1) switch (_context22.prev = _context22.next) {
2222
2282
  case 0:
2223
- _context21.prev = 0;
2224
- _context21.next = 3;
2283
+ _context22.prev = 0;
2284
+ _context22.next = 3;
2225
2285
  return this.request.get('/pay/custom-payment/all', {
2226
2286
  filterPaymentMethods: true
2227
2287
  }, {
2228
2288
  osServer: true
2229
2289
  });
2230
2290
  case 3:
2231
- response = _context21.sent;
2291
+ response = _context22.sent;
2232
2292
  paymentMethods = (response === null || response === void 0 ? void 0 : response.data) || [];
2233
2293
  this.paymentMethodsCache = Array.isArray(paymentMethods) ? _toConsumableArray(paymentMethods) : [];
2234
- return _context21.abrupt("return", this.getPaymentMethods());
2294
+ return _context22.abrupt("return", this.getPaymentMethods());
2235
2295
  case 9:
2236
- _context21.prev = 9;
2237
- _context21.t0 = _context21["catch"](0);
2296
+ _context22.prev = 9;
2297
+ _context22.t0 = _context22["catch"](0);
2238
2298
  this.logWarning('getPaymentMethodsAsync: 获取支付方式列表失败,使用缓存列表', {
2239
- error: _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0)
2299
+ error: _context22.t0 instanceof Error ? _context22.t0.message : String(_context22.t0)
2240
2300
  });
2241
- return _context21.abrupt("return", this.getPaymentMethods());
2301
+ return _context22.abrupt("return", this.getPaymentMethods());
2242
2302
  case 13:
2243
2303
  case "end":
2244
- return _context21.stop();
2304
+ return _context22.stop();
2245
2305
  }
2246
- }, _callee21, this, [[0, 9]]);
2306
+ }, _callee22, this, [[0, 9]]);
2247
2307
  }));
2248
2308
  function getPaymentMethodsAsync() {
2249
2309
  return _getPaymentMethodsAsync.apply(this, arguments);
@@ -2291,47 +2351,47 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2291
2351
  }, {
2292
2352
  key: "sendCustomerPayLink",
2293
2353
  value: (function () {
2294
- var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2354
+ var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2295
2355
  var orderIds, _ref12, _ref13, _submitResult$data$or, _submitResult$data, _submitResult$data2, submitResult, orderId;
2296
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2297
- while (1) switch (_context22.prev = _context22.next) {
2356
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2357
+ while (1) switch (_context23.prev = _context23.next) {
2298
2358
  case 0:
2299
2359
  if (this.store.order) {
2300
- _context22.next = 2;
2360
+ _context23.next = 2;
2301
2361
  break;
2302
2362
  }
2303
2363
  throw new Error('order 模块未初始化');
2304
2364
  case 2:
2305
2365
  orderIds = params.order_ids || params.orderIds || [];
2306
2366
  if (!(!orderIds.length || params.submitBeforeSend)) {
2307
- _context22.next = 11;
2367
+ _context23.next = 11;
2308
2368
  break;
2309
2369
  }
2310
- _context22.next = 6;
2370
+ _context23.next = 6;
2311
2371
  return this.submitSalesOrder({
2312
2372
  smallTicketDataFlag: 1
2313
2373
  });
2314
2374
  case 6:
2315
- submitResult = _context22.sent;
2375
+ submitResult = _context23.sent;
2316
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;
2317
2377
  if (orderId) {
2318
- _context22.next = 10;
2378
+ _context23.next = 10;
2319
2379
  break;
2320
2380
  }
2321
2381
  throw new Error('本地订单提交云端失败,无法发送支付链接');
2322
2382
  case 10:
2323
2383
  orderIds = [orderId];
2324
2384
  case 11:
2325
- return _context22.abrupt("return", this.store.order.sendCustomerPayLink({
2385
+ return _context23.abrupt("return", this.store.order.sendCustomerPayLink({
2326
2386
  emails: params.emails,
2327
2387
  notify_action: params.notify_action,
2328
2388
  order_ids: orderIds
2329
2389
  }));
2330
2390
  case 12:
2331
2391
  case "end":
2332
- return _context22.stop();
2392
+ return _context23.stop();
2333
2393
  }
2334
- }, _callee22, this);
2394
+ }, _callee23, this);
2335
2395
  }));
2336
2396
  function sendCustomerPayLink(_x17) {
2337
2397
  return _sendCustomerPayLink.apply(this, arguments);
@@ -2346,27 +2406,27 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2346
2406
  }, {
2347
2407
  key: "calculateProductBookingPrice",
2348
2408
  value: function () {
2349
- var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
2409
+ var _calculateProductBookingPrice = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
2350
2410
  var _params$customer_id;
2351
2411
  var quotation, customerId, authoritativeProduct, product;
2352
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2353
- while (1) switch (_context23.prev = _context23.next) {
2412
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2413
+ while (1) switch (_context24.prev = _context24.next) {
2354
2414
  case 0:
2355
2415
  quotation = this.store.quotation;
2356
2416
  customerId = (_params$customer_id = params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.getCurrentOrderCustomerId();
2357
- _context23.next = 4;
2417
+ _context24.next = 4;
2358
2418
  return this.loadProductForPriceQuery(params, customerId);
2359
2419
  case 4:
2360
- authoritativeProduct = _context23.sent;
2420
+ authoritativeProduct = _context24.sent;
2361
2421
  product = this.mergeProductForPriceQuery(params.product, authoritativeProduct);
2362
- _context23.next = 8;
2422
+ _context24.next = 8;
2363
2423
  return this.loadQuotationForPriceQuery({
2364
2424
  quotation: quotation,
2365
2425
  customer_id: customerId,
2366
2426
  channel: params.channel
2367
2427
  });
2368
2428
  case 8:
2369
- return _context23.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
2429
+ return _context24.abrupt("return", calculateBaseSalesProductBookingPrice(_objectSpread(_objectSpread({}, params), {}, {
2370
2430
  product: product,
2371
2431
  fallback_price: authoritativeProduct ? undefined : params.fallback_price,
2372
2432
  customer_id: customerId,
@@ -2374,9 +2434,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2374
2434
  })));
2375
2435
  case 9:
2376
2436
  case "end":
2377
- return _context23.stop();
2437
+ return _context24.stop();
2378
2438
  }
2379
- }, _callee23, this);
2439
+ }, _callee24, this);
2380
2440
  }));
2381
2441
  function calculateProductBookingPrice(_x18) {
2382
2442
  return _calculateProductBookingPrice.apply(this, arguments);
@@ -2386,32 +2446,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2386
2446
  }, {
2387
2447
  key: "addProductToOrder",
2388
2448
  value: function () {
2389
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(product, booking) {
2449
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product, booking) {
2390
2450
  var products;
2391
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2392
- while (1) switch (_context24.prev = _context24.next) {
2451
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2452
+ while (1) switch (_context25.prev = _context25.next) {
2393
2453
  case 0:
2394
- _context24.prev = 0;
2454
+ _context25.prev = 0;
2395
2455
  if (this.store.order) {
2396
- _context24.next = 3;
2456
+ _context25.next = 3;
2397
2457
  break;
2398
2458
  }
2399
2459
  throw new Error('order 模块未初始化');
2400
2460
  case 3:
2401
- _context24.next = 5;
2461
+ _context25.next = 5;
2402
2462
  return this.store.order.addProductToOrder(product, booking);
2403
2463
  case 5:
2404
- products = _context24.sent;
2405
- return _context24.abrupt("return", products);
2464
+ products = _context25.sent;
2465
+ return _context25.abrupt("return", products);
2406
2466
  case 9:
2407
- _context24.prev = 9;
2408
- _context24.t0 = _context24["catch"](0);
2409
- throw _context24.t0;
2467
+ _context25.prev = 9;
2468
+ _context25.t0 = _context25["catch"](0);
2469
+ throw _context25.t0;
2410
2470
  case 12:
2411
2471
  case "end":
2412
- return _context24.stop();
2472
+ return _context25.stop();
2413
2473
  }
2414
- }, _callee24, this, [[0, 9]]);
2474
+ }, _callee25, this, [[0, 9]]);
2415
2475
  }));
2416
2476
  function addProductToOrder(_x19, _x20) {
2417
2477
  return _addProductToOrder.apply(this, arguments);
@@ -2421,32 +2481,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2421
2481
  }, {
2422
2482
  key: "updateOrderProduct",
2423
2483
  value: function () {
2424
- var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2484
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2425
2485
  var products;
2426
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2427
- while (1) switch (_context25.prev = _context25.next) {
2486
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2487
+ while (1) switch (_context26.prev = _context26.next) {
2428
2488
  case 0:
2429
- _context25.prev = 0;
2489
+ _context26.prev = 0;
2430
2490
  if (this.store.order) {
2431
- _context25.next = 3;
2491
+ _context26.next = 3;
2432
2492
  break;
2433
2493
  }
2434
2494
  throw new Error('order 模块未初始化');
2435
2495
  case 3:
2436
- _context25.next = 5;
2496
+ _context26.next = 5;
2437
2497
  return this.store.order.updateOrderProduct(params);
2438
2498
  case 5:
2439
- products = _context25.sent;
2440
- return _context25.abrupt("return", products);
2499
+ products = _context26.sent;
2500
+ return _context26.abrupt("return", products);
2441
2501
  case 9:
2442
- _context25.prev = 9;
2443
- _context25.t0 = _context25["catch"](0);
2444
- throw _context25.t0;
2502
+ _context26.prev = 9;
2503
+ _context26.t0 = _context26["catch"](0);
2504
+ throw _context26.t0;
2445
2505
  case 12:
2446
2506
  case "end":
2447
- return _context25.stop();
2507
+ return _context26.stop();
2448
2508
  }
2449
- }, _callee25, this, [[0, 9]]);
2509
+ }, _callee26, this, [[0, 9]]);
2450
2510
  }));
2451
2511
  function updateOrderProduct(_x21) {
2452
2512
  return _updateOrderProduct.apply(this, arguments);
@@ -2456,32 +2516,32 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2456
2516
  }, {
2457
2517
  key: "updateOrderProductQuantity",
2458
2518
  value: function () {
2459
- var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2519
+ var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2460
2520
  var products;
2461
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2462
- while (1) switch (_context26.prev = _context26.next) {
2521
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2522
+ while (1) switch (_context27.prev = _context27.next) {
2463
2523
  case 0:
2464
- _context26.prev = 0;
2524
+ _context27.prev = 0;
2465
2525
  if (this.store.order) {
2466
- _context26.next = 3;
2526
+ _context27.next = 3;
2467
2527
  break;
2468
2528
  }
2469
2529
  throw new Error('order 模块未初始化');
2470
2530
  case 3:
2471
- _context26.next = 5;
2531
+ _context27.next = 5;
2472
2532
  return this.store.order.updateOrderProductQuantity(params);
2473
2533
  case 5:
2474
- products = _context26.sent;
2475
- return _context26.abrupt("return", products);
2534
+ products = _context27.sent;
2535
+ return _context27.abrupt("return", products);
2476
2536
  case 9:
2477
- _context26.prev = 9;
2478
- _context26.t0 = _context26["catch"](0);
2479
- throw _context26.t0;
2537
+ _context27.prev = 9;
2538
+ _context27.t0 = _context27["catch"](0);
2539
+ throw _context27.t0;
2480
2540
  case 12:
2481
2541
  case "end":
2482
- return _context26.stop();
2542
+ return _context27.stop();
2483
2543
  }
2484
- }, _callee26, this, [[0, 9]]);
2544
+ }, _callee27, this, [[0, 9]]);
2485
2545
  }));
2486
2546
  function updateOrderProductQuantity(_x22) {
2487
2547
  return _updateOrderProductQuantity.apply(this, arguments);
@@ -2506,12 +2566,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2506
2566
  }, {
2507
2567
  key: "setOrderProductLineNote",
2508
2568
  value: (function () {
2509
- var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity, note) {
2569
+ var _setOrderProductLineNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity, note) {
2510
2570
  var params, products;
2511
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2512
- while (1) switch (_context27.prev = _context27.next) {
2571
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2572
+ while (1) switch (_context28.prev = _context28.next) {
2513
2573
  case 0:
2514
- _context27.prev = 0;
2574
+ _context28.prev = 0;
2515
2575
  params = {
2516
2576
  product_id: identity.product_id,
2517
2577
  product_variant_id: identity.product_variant_id,
@@ -2526,20 +2586,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2526
2586
  params.product_sku = identity.product_sku;
2527
2587
  }
2528
2588
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
2529
- _context27.next = 7;
2589
+ _context28.next = 7;
2530
2590
  return this.updateOrderProduct(params);
2531
2591
  case 7:
2532
- products = _context27.sent;
2533
- return _context27.abrupt("return", products);
2592
+ products = _context28.sent;
2593
+ return _context28.abrupt("return", products);
2534
2594
  case 11:
2535
- _context27.prev = 11;
2536
- _context27.t0 = _context27["catch"](0);
2537
- throw _context27.t0;
2595
+ _context28.prev = 11;
2596
+ _context28.t0 = _context28["catch"](0);
2597
+ throw _context28.t0;
2538
2598
  case 14:
2539
2599
  case "end":
2540
- return _context27.stop();
2600
+ return _context28.stop();
2541
2601
  }
2542
- }, _callee27, this, [[0, 11]]);
2602
+ }, _callee28, this, [[0, 11]]);
2543
2603
  }));
2544
2604
  function setOrderProductLineNote(_x23, _x24) {
2545
2605
  return _setOrderProductLineNote.apply(this, arguments);
@@ -2556,30 +2616,30 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2556
2616
  }, {
2557
2617
  key: "removeProductsFromOrder",
2558
2618
  value: (function () {
2559
- var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identities) {
2560
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2561
- while (1) switch (_context28.prev = _context28.next) {
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) {
2562
2622
  case 0:
2563
- _context28.prev = 0;
2623
+ _context29.prev = 0;
2564
2624
  if (this.store.order) {
2565
- _context28.next = 3;
2625
+ _context29.next = 3;
2566
2626
  break;
2567
2627
  }
2568
2628
  throw new Error('order 模块未初始化');
2569
2629
  case 3:
2570
- _context28.next = 5;
2630
+ _context29.next = 5;
2571
2631
  return this.store.order.removeProductsFromOrder(identities);
2572
2632
  case 5:
2573
- return _context28.abrupt("return", _context28.sent);
2633
+ return _context29.abrupt("return", _context29.sent);
2574
2634
  case 8:
2575
- _context28.prev = 8;
2576
- _context28.t0 = _context28["catch"](0);
2577
- throw _context28.t0;
2635
+ _context29.prev = 8;
2636
+ _context29.t0 = _context29["catch"](0);
2637
+ throw _context29.t0;
2578
2638
  case 11:
2579
2639
  case "end":
2580
- return _context28.stop();
2640
+ return _context29.stop();
2581
2641
  }
2582
- }, _callee28, this, [[0, 8]]);
2642
+ }, _callee29, this, [[0, 8]]);
2583
2643
  }));
2584
2644
  function removeProductsFromOrder(_x25) {
2585
2645
  return _removeProductsFromOrder.apply(this, arguments);
@@ -2589,16 +2649,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2589
2649
  }, {
2590
2650
  key: "removeProductFromOrder",
2591
2651
  value: function () {
2592
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
2593
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2594
- while (1) switch (_context29.prev = _context29.next) {
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) {
2595
2655
  case 0:
2596
- return _context29.abrupt("return", this.removeProductsFromOrder([identity]));
2656
+ return _context30.abrupt("return", this.removeProductsFromOrder([identity]));
2597
2657
  case 1:
2598
2658
  case "end":
2599
- return _context29.stop();
2659
+ return _context30.stop();
2600
2660
  }
2601
- }, _callee29, this);
2661
+ }, _callee30, this);
2602
2662
  }));
2603
2663
  function removeProductFromOrder(_x26) {
2604
2664
  return _removeProductFromOrder.apply(this, arguments);
@@ -2650,23 +2710,23 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2650
2710
  }, {
2651
2711
  key: "applyPromotion",
2652
2712
  value: (function () {
2653
- var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2654
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2655
- while (1) switch (_context30.prev = _context30.next) {
2713
+ var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2714
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2715
+ while (1) switch (_context31.prev = _context31.next) {
2656
2716
  case 0:
2657
2717
  if (this.store.order) {
2658
- _context30.next = 2;
2718
+ _context31.next = 2;
2659
2719
  break;
2660
2720
  }
2661
2721
  throw new Error('order 模块未初始化');
2662
2722
  case 2:
2663
- _context30.next = 4;
2723
+ _context31.next = 4;
2664
2724
  return this.store.order.applyPromotion();
2665
2725
  case 4:
2666
2726
  case "end":
2667
- return _context30.stop();
2727
+ return _context31.stop();
2668
2728
  }
2669
- }, _callee30, this);
2729
+ }, _callee31, this);
2670
2730
  }));
2671
2731
  function applyPromotion() {
2672
2732
  return _applyPromotion.apply(this, arguments);
@@ -2676,16 +2736,16 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2676
2736
  }, {
2677
2737
  key: "getUnfulfilledPromotions",
2678
2738
  value: function getUnfulfilledPromotions() {
2679
- var _this$store$order5;
2680
- return ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getUnfulfilledPromotions()) || [];
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()) || [];
2681
2741
  }
2682
2742
 
2683
2743
  /** 最近一次促销计算输出的赠品操作 diff。 */
2684
2744
  }, {
2685
2745
  key: "getLastGiftActions",
2686
2746
  value: function getLastGiftActions() {
2687
- var _this$store$order6;
2688
- return ((_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getLastGiftActions()) || null;
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;
2689
2749
  }
2690
2750
 
2691
2751
  // 获取商品列表
@@ -2693,18 +2753,18 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2693
2753
  }, {
2694
2754
  key: "getProductList",
2695
2755
  value: function () {
2696
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2697
- var _this$otherParams13;
2756
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2757
+ var _this$otherParams17;
2698
2758
  var menu_list_ids, _this$store$products, res;
2699
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2700
- while (1) switch (_context31.prev = _context31.next) {
2759
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2760
+ while (1) switch (_context32.prev = _context32.next) {
2701
2761
  case 0:
2702
2762
  // 可以直接通过配置里的 menu 读取
2703
- menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
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) {
2704
2764
  return Number(n.value);
2705
2765
  })) || [];
2706
- _context31.prev = 1;
2707
- _context31.next = 4;
2766
+ _context32.prev = 1;
2767
+ _context32.next = 4;
2708
2768
  return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
2709
2769
  menu_list_ids: menu_list_ids,
2710
2770
  cacheId: this.cacheId,
@@ -2712,17 +2772,17 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2712
2772
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2713
2773
  });
2714
2774
  case 4:
2715
- res = _context31.sent;
2716
- return _context31.abrupt("return", res);
2775
+ res = _context32.sent;
2776
+ return _context32.abrupt("return", res);
2717
2777
  case 8:
2718
- _context31.prev = 8;
2719
- _context31.t0 = _context31["catch"](1);
2720
- throw _context31.t0;
2778
+ _context32.prev = 8;
2779
+ _context32.t0 = _context32["catch"](1);
2780
+ throw _context32.t0;
2721
2781
  case 11:
2722
2782
  case "end":
2723
- return _context31.stop();
2783
+ return _context32.stop();
2724
2784
  }
2725
- }, _callee31, this, [[1, 8]]);
2785
+ }, _callee32, this, [[1, 8]]);
2726
2786
  }));
2727
2787
  function getProductList() {
2728
2788
  return _getProductList.apply(this, arguments);
@@ -2737,15 +2797,15 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2737
2797
  }, {
2738
2798
  key: "setOtherParams",
2739
2799
  value: function () {
2740
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2800
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2741
2801
  var _ref14,
2742
2802
  _ref14$cover,
2743
2803
  cover,
2744
- _args32 = arguments;
2745
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2746
- while (1) switch (_context32.prev = _context32.next) {
2804
+ _args33 = arguments;
2805
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2806
+ while (1) switch (_context33.prev = _context33.next) {
2747
2807
  case 0:
2748
- _ref14 = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
2808
+ _ref14 = _args33.length > 1 && _args33[1] !== undefined ? _args33[1] : {}, _ref14$cover = _ref14.cover, cover = _ref14$cover === void 0 ? false : _ref14$cover;
2749
2809
  if (cover) {
2750
2810
  this.otherParams = params;
2751
2811
  } else {
@@ -2753,9 +2813,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2753
2813
  }
2754
2814
  case 2:
2755
2815
  case "end":
2756
- return _context32.stop();
2816
+ return _context33.stop();
2757
2817
  }
2758
- }, _callee32, this);
2818
+ }, _callee33, this);
2759
2819
  }));
2760
2820
  function setOtherParams(_x27) {
2761
2821
  return _setOtherParams.apply(this, arguments);