@pisell/pisellos 2.2.170 → 2.2.171
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/Customer/index.d.ts +0 -6
- package/dist/modules/Customer/index.js +83 -129
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +4 -2
- package/dist/modules/Discount/index.js +93 -8
- package/dist/modules/Discount/types.d.ts +7 -1
- package/dist/modules/Order/index.d.ts +15 -27
- package/dist/modules/Order/index.js +322 -695
- package/dist/modules/Order/types.d.ts +14 -49
- package/dist/modules/Order/types.js +0 -2
- package/dist/modules/Order/utils.d.ts +0 -17
- package/dist/modules/Order/utils.js +26 -97
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +10 -26
- package/dist/modules/SalesSummary/index.js +2 -4
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +1 -2
- package/dist/server/modules/order/utils/filterOrders.js +6 -20
- package/dist/solution/BaseSales/index.d.ts +7 -46
- package/dist/solution/BaseSales/index.js +315 -1009
- package/dist/solution/BaseSales/types.d.ts +1 -53
- package/dist/solution/BaseSales/types.js +1 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +15 -65
- package/dist/solution/BaseSales/utils.js +8 -46
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -133
- package/dist/solution/BookingTicket/index.js +175 -768
- package/dist/solution/BookingTicket/types.d.ts +0 -2
- package/dist/solution/BookingTicket/types.js +0 -3
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +128 -231
- package/dist/solution/ScanOrder/utils.js +8 -46
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +23 -18
- package/dist/solution/VenueBooking/index.d.ts +9 -5
- package/dist/solution/VenueBooking/index.js +55 -103
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/modules/Customer/index.d.ts +0 -6
- package/lib/modules/Customer/index.js +11 -26
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +4 -2
- package/lib/modules/Discount/index.js +63 -8
- package/lib/modules/Discount/types.d.ts +7 -1
- package/lib/modules/Order/index.d.ts +15 -27
- package/lib/modules/Order/index.js +84 -336
- package/lib/modules/Order/types.d.ts +14 -49
- package/lib/modules/Order/utils.d.ts +0 -17
- package/lib/modules/Order/utils.js +18 -105
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +14 -22
- package/lib/modules/SalesSummary/index.js +2 -4
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +1 -3
- package/lib/server/modules/order/utils/filterOrders.js +4 -12
- package/lib/solution/BaseSales/index.d.ts +7 -46
- package/lib/solution/BaseSales/index.js +20 -434
- package/lib/solution/BaseSales/types.d.ts +1 -53
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +11 -70
- package/lib/solution/BaseSales/utils.js +6 -46
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -133
- package/lib/solution/BookingTicket/index.js +8 -341
- package/lib/solution/BookingTicket/types.d.ts +0 -2
- package/lib/solution/BookingTicket/types.js +0 -6
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +66 -147
- package/lib/solution/ScanOrder/utils.js +6 -46
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +4 -2
- package/lib/solution/VenueBooking/index.d.ts +9 -5
- package/lib/solution/VenueBooking/index.js +14 -50
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/package.json +2 -2
- package/dist/modules/BookingContext/index.d.ts +0 -37
- package/dist/modules/BookingContext/index.js +0 -436
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -193
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -137
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -215
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -212
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -159
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/lib/modules/BookingContext/index.d.ts +0 -37
- package/lib/modules/BookingContext/index.js +0 -297
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -207
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -141
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -75
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -198
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -207
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -201
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -113
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
|
@@ -2,15 +2,15 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
2
2
|
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."); }
|
|
3
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
6
|
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; } } }; }
|
|
6
7
|
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); }
|
|
7
8
|
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
9
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
-
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); }); }; }
|
|
11
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
function
|
|
12
|
+
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
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
15
|
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
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -94,50 +94,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
94
94
|
moduleName: 'scanOrder'
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "safeStringify",
|
|
99
|
-
value: function safeStringify(value) {
|
|
100
|
-
try {
|
|
101
|
-
return JSON.stringify(value);
|
|
102
|
-
} catch (_unused) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "pickErrorMessage",
|
|
108
|
-
value: function pickErrorMessage(error) {
|
|
109
|
-
var _error$data, _error$response, _error$error;
|
|
110
|
-
var candidates = [error.message, (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.message, (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message];
|
|
111
|
-
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
112
|
-
var candidate = _candidates[_i];
|
|
113
|
-
if (typeof candidate === 'string' && candidate.trim()) return candidate;
|
|
114
|
-
}
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
97
|
}, {
|
|
118
98
|
key: "serializeError",
|
|
119
99
|
value: function serializeError(error) {
|
|
120
100
|
if (error instanceof Error) {
|
|
121
|
-
return {
|
|
101
|
+
return JSON.stringify({
|
|
122
102
|
name: error.name,
|
|
123
103
|
message: error.message,
|
|
124
104
|
stack: error.stack
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
if (error && _typeof(error) === 'object') {
|
|
128
|
-
var raw = error;
|
|
129
|
-
var message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
|
|
130
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof raw.name === 'string' ? {
|
|
131
|
-
name: raw.name
|
|
132
|
-
} : {}), {}, {
|
|
133
|
-
message: message
|
|
134
|
-
}, 'code' in raw ? {
|
|
135
|
-
code: raw.code
|
|
136
|
-
} : {}), 'status' in raw ? {
|
|
137
|
-
status: raw.status
|
|
138
|
-
} : {}), this.safeStringify(raw) ? {
|
|
139
|
-
raw: this.safeStringify(raw)
|
|
140
|
-
} : {});
|
|
105
|
+
});
|
|
141
106
|
}
|
|
142
107
|
return {
|
|
143
108
|
message: String(error)
|
|
@@ -227,16 +192,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
192
|
})
|
|
228
193
|
});
|
|
229
194
|
}
|
|
230
|
-
}, {
|
|
231
|
-
key: "assertProductListLoaded",
|
|
232
|
-
value: function assertProductListLoaded(method, result) {
|
|
233
|
-
var payload = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
234
|
-
if (Array.isArray(result)) return result;
|
|
235
|
-
var error = result instanceof Error ? result : new Error('商品列表接口返回异常');
|
|
236
|
-
this.logMethodError(method, error, payload);
|
|
237
|
-
error.__scanOrderLogged = true;
|
|
238
|
-
throw error;
|
|
239
|
-
}
|
|
240
195
|
}, {
|
|
241
196
|
key: "addLog",
|
|
242
197
|
value: function () {
|
|
@@ -273,8 +228,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
273
228
|
value: function resolveCustomerIdFromLoginPayload(payload) {
|
|
274
229
|
var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
|
|
275
230
|
var candidates = [payload === null || payload === void 0 ? void 0 : payload.customerId, payload === null || payload === void 0 ? void 0 : payload.customer_id, payload === null || payload === void 0 ? void 0 : payload.id, payload === null || payload === void 0 || (_payload$user = payload.user) === null || _payload$user === void 0 ? void 0 : _payload$user.customerId, payload === null || payload === void 0 || (_payload$user2 = payload.user) === null || _payload$user2 === void 0 ? void 0 : _payload$user2.customer_id, payload === null || payload === void 0 || (_payload$user3 = payload.user) === null || _payload$user3 === void 0 ? void 0 : _payload$user3.id, payload === null || payload === void 0 || (_payload$user4 = payload.user) === null || _payload$user4 === void 0 || (_payload$user4 = _payload$user4._origin) === null || _payload$user4 === void 0 ? void 0 : _payload$user4.customer_id, payload === null || payload === void 0 || (_payload$account = payload.account) === null || _payload$account === void 0 ? void 0 : _payload$account.customerId, payload === null || payload === void 0 || (_payload$account2 = payload.account) === null || _payload$account2 === void 0 ? void 0 : _payload$account2.customer_id, payload === null || payload === void 0 || (_payload$account3 = payload.account) === null || _payload$account3 === void 0 ? void 0 : _payload$account3.id, payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.customer_id];
|
|
276
|
-
for (var
|
|
277
|
-
var candidate =
|
|
231
|
+
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
232
|
+
var candidate = _candidates[_i];
|
|
278
233
|
var customerId = this.normalizeCustomerId(candidate);
|
|
279
234
|
if (customerId) return customerId;
|
|
280
235
|
}
|
|
@@ -444,18 +399,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
444
399
|
key: "destroyRegisteredChildModules",
|
|
445
400
|
value: function () {
|
|
446
401
|
var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
447
|
-
var modules,
|
|
402
|
+
var modules, _i2, _modules, mod;
|
|
448
403
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
449
404
|
while (1) switch (_context6.prev = _context6.next) {
|
|
450
405
|
case 0:
|
|
451
406
|
modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
|
|
452
|
-
|
|
407
|
+
_i2 = 0, _modules = modules;
|
|
453
408
|
case 2:
|
|
454
|
-
if (!(
|
|
409
|
+
if (!(_i2 < _modules.length)) {
|
|
455
410
|
_context6.next = 10;
|
|
456
411
|
break;
|
|
457
412
|
}
|
|
458
|
-
mod = _modules[
|
|
413
|
+
mod = _modules[_i2];
|
|
459
414
|
if (!(mod && typeof mod.destroy === 'function')) {
|
|
460
415
|
_context6.next = 7;
|
|
461
416
|
break;
|
|
@@ -463,7 +418,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
463
418
|
_context6.next = 7;
|
|
464
419
|
return Promise.resolve(mod.destroy());
|
|
465
420
|
case 7:
|
|
466
|
-
|
|
421
|
+
_i2++;
|
|
467
422
|
_context6.next = 2;
|
|
468
423
|
break;
|
|
469
424
|
case 10:
|
|
@@ -537,13 +492,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
537
492
|
var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
|
|
538
493
|
_this4.store[step] = targetModule;
|
|
539
494
|
var initialState = step === 'salesSummary' ? {
|
|
495
|
+
// TODO(Order types): ScanOrder runtime should read OrderState.summary instead of tempOrder.summary.
|
|
540
496
|
summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
|
|
541
497
|
} : {};
|
|
542
498
|
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
|
|
543
499
|
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
|
|
544
500
|
feishu: {
|
|
545
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed'
|
|
546
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
501
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed'
|
|
547
502
|
}
|
|
548
503
|
};
|
|
549
504
|
_this4.core.registerModule(targetModule, {
|
|
@@ -1293,50 +1248,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
1248
|
return _onCustomerLogin.apply(this, arguments);
|
|
1294
1249
|
}
|
|
1295
1250
|
return onCustomerLogin;
|
|
1296
|
-
}()
|
|
1297
|
-
}, {
|
|
1298
|
-
key: "findReservationRuleResource",
|
|
1299
|
-
value: function findReservationRuleResource(formId) {
|
|
1300
|
-
if (formId == null) return undefined;
|
|
1301
|
-
var numericFormId = Number(formId);
|
|
1302
|
-
if (!Number.isFinite(numericFormId) || numericFormId <= 0) return undefined;
|
|
1303
|
-
var _iterator4 = _createForOfIteratorHelper(this.enabledReservationRuleProducts),
|
|
1304
|
-
_step4;
|
|
1305
|
-
try {
|
|
1306
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1307
|
-
var _product$product_reso;
|
|
1308
|
-
var product = _step4.value;
|
|
1309
|
-
var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
|
|
1310
|
-
if (!Array.isArray(resources)) continue;
|
|
1311
|
-
var matched = resources.find(function (resource) {
|
|
1312
|
-
return Number(resource === null || resource === void 0 ? void 0 : resource.id) === numericFormId;
|
|
1313
|
-
});
|
|
1314
|
-
if (matched) return matched;
|
|
1315
|
-
}
|
|
1316
|
-
} catch (err) {
|
|
1317
|
-
_iterator4.e(err);
|
|
1318
|
-
} finally {
|
|
1319
|
-
_iterator4.f();
|
|
1320
|
-
}
|
|
1321
|
-
return undefined;
|
|
1322
|
-
}
|
|
1323
|
-
}, {
|
|
1324
|
-
key: "buildScanOrderResourceMetadata",
|
|
1325
|
-
value: function buildScanOrderResourceMetadata(params) {
|
|
1326
|
-
var _ruleResource$title;
|
|
1327
|
-
var resourceState = params.resourceState,
|
|
1328
|
-
resourceName = params.resourceName;
|
|
1329
|
-
var ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
|
|
1330
|
-
var combined = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.combined_resource;
|
|
1331
|
-
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
1332
|
-
return {
|
|
1333
|
-
form_name: (_ruleResource$title = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.title) !== null && _ruleResource$title !== void 0 ? _ruleResource$title : '',
|
|
1334
|
-
resource_name: resourceName,
|
|
1335
|
-
combined_resource: isCombined ? combined : null
|
|
1336
|
-
};
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
// ScanOrder 提交 payload enhancer:
|
|
1251
|
+
}() // ScanOrder 提交 payload enhancer:
|
|
1340
1252
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
1341
1253
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
1342
1254
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -1349,7 +1261,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1349
1261
|
var resourceState = this.store.resource;
|
|
1350
1262
|
var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
|
|
1351
1263
|
|
|
1352
|
-
//
|
|
1264
|
+
// single 预约独占整张桌台,capacity 取 form_record.capacity;其他情况(multiple / capacity / undefined)占 1 个容量位
|
|
1353
1265
|
var resolveResourceCapacity = function resolveResourceCapacity() {
|
|
1354
1266
|
if (resourceSelectType === 'single') {
|
|
1355
1267
|
var _resourceState$table_;
|
|
@@ -1361,13 +1273,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1361
1273
|
return 1;
|
|
1362
1274
|
};
|
|
1363
1275
|
return function (payload, _ref3) {
|
|
1364
|
-
var _resource_id,
|
|
1276
|
+
var _resource_id, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _tempOrder$metadata, _pickFirstCustomCapac;
|
|
1365
1277
|
var bookingUuid = _ref3.bookingUuid,
|
|
1366
1278
|
tempOrder = _ref3.tempOrder;
|
|
1279
|
+
// TODO(Order types): ScanOrder resource runtime should come from ScanOrder store only.
|
|
1367
1280
|
var resourceId = (_resource_id = tempOrder.resource_id) !== null && _resource_id !== void 0 ? _resource_id : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
|
|
1368
|
-
var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
|
|
1369
|
-
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1370
|
-
var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1371
1281
|
var pickOriginal = function pickOriginal(value) {
|
|
1372
1282
|
if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
|
|
1373
1283
|
var original = value.original;
|
|
@@ -1383,21 +1293,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1383
1293
|
main_field: mainField,
|
|
1384
1294
|
form_id: resourceState.tableFormId,
|
|
1385
1295
|
relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
|
|
1386
|
-
capacity:
|
|
1387
|
-
metadata:
|
|
1388
|
-
resourceState: resourceState,
|
|
1389
|
-
resourceName: mainField
|
|
1390
|
-
})
|
|
1296
|
+
capacity: resolveResourceCapacity(),
|
|
1297
|
+
metadata: {}
|
|
1391
1298
|
} : undefined;
|
|
1392
1299
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
1393
|
-
//
|
|
1394
|
-
var
|
|
1300
|
+
// 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax 时 value 优先用人数
|
|
1301
|
+
var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
|
|
1302
|
+
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1303
|
+
var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1395
1304
|
var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
|
|
1396
1305
|
var nextBookings = (payload.bookings || []).map(function (booking, idx) {
|
|
1306
|
+
var _booking$metadata$hol, _booking$metadata;
|
|
1397
1307
|
return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
|
|
1398
|
-
number: bookingCapacityValue,
|
|
1399
1308
|
appointment_status: 'started',
|
|
1400
|
-
metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}),
|
|
1309
|
+
metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), {}, {
|
|
1310
|
+
holder_id: (_booking$metadata$hol = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : null
|
|
1311
|
+
}, resourceSelectType ? {
|
|
1401
1312
|
resource_select_type: resourceSelectType
|
|
1402
1313
|
} : {}), resourceSelectType ? {
|
|
1403
1314
|
capacity: [{
|
|
@@ -1413,7 +1324,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1413
1324
|
} : {});
|
|
1414
1325
|
});
|
|
1415
1326
|
var nextProducts = _toConsumableArray(payload.products || []);
|
|
1416
|
-
//
|
|
1327
|
+
// 编辑已有订单时,后端会通过 order_id 判断更新;原单已含 booking 规则行,勿再追加虚拟规则商品
|
|
1417
1328
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
1418
1329
|
var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
|
|
1419
1330
|
var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
|
|
@@ -1559,14 +1470,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1559
1470
|
return addProductToOrder;
|
|
1560
1471
|
}()
|
|
1561
1472
|
}, {
|
|
1562
|
-
key: "
|
|
1473
|
+
key: "updateProductInOrder",
|
|
1563
1474
|
value: function () {
|
|
1564
|
-
var
|
|
1475
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1565
1476
|
var products;
|
|
1566
1477
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1567
1478
|
while (1) switch (_context19.prev = _context19.next) {
|
|
1568
1479
|
case 0:
|
|
1569
|
-
this.logMethodStart('
|
|
1480
|
+
this.logMethodStart('updateProductInOrder', {
|
|
1570
1481
|
product_id: params.product_id,
|
|
1571
1482
|
product_variant_id: params.product_variant_id
|
|
1572
1483
|
});
|
|
@@ -1578,7 +1489,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1578
1489
|
throw new Error('order 模块未初始化');
|
|
1579
1490
|
case 4:
|
|
1580
1491
|
_context19.next = 6;
|
|
1581
|
-
return this.store.order.
|
|
1492
|
+
return this.store.order.updateProductInOrder(params);
|
|
1582
1493
|
case 6:
|
|
1583
1494
|
products = _context19.sent;
|
|
1584
1495
|
_context19.next = 9;
|
|
@@ -1587,14 +1498,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1587
1498
|
_context19.next = 11;
|
|
1588
1499
|
return this.refreshCartValidationPassed();
|
|
1589
1500
|
case 11:
|
|
1590
|
-
this.logMethodSuccess('
|
|
1501
|
+
this.logMethodSuccess('updateProductInOrder', {
|
|
1591
1502
|
productCount: products.length
|
|
1592
1503
|
});
|
|
1593
1504
|
return _context19.abrupt("return", products);
|
|
1594
1505
|
case 15:
|
|
1595
1506
|
_context19.prev = 15;
|
|
1596
1507
|
_context19.t0 = _context19["catch"](1);
|
|
1597
|
-
this.logMethodError('
|
|
1508
|
+
this.logMethodError('updateProductInOrder', _context19.t0);
|
|
1598
1509
|
throw _context19.t0;
|
|
1599
1510
|
case 19:
|
|
1600
1511
|
case "end":
|
|
@@ -1602,10 +1513,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1602
1513
|
}
|
|
1603
1514
|
}, _callee19, this, [[1, 15]]);
|
|
1604
1515
|
}));
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
1516
|
+
function updateProductInOrder(_x11) {
|
|
1517
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
1607
1518
|
}
|
|
1608
|
-
return
|
|
1519
|
+
return updateProductInOrder;
|
|
1609
1520
|
}()
|
|
1610
1521
|
/**
|
|
1611
1522
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
@@ -1631,13 +1542,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1631
1542
|
note: String(note || '')
|
|
1632
1543
|
}
|
|
1633
1544
|
};
|
|
1634
|
-
if (identity.identity_key !== undefined)
|
|
1545
|
+
if (identity.identity_key !== undefined) {
|
|
1546
|
+
// TODO(Order types): ScanOrder identity callers should pass unique_identification_number.
|
|
1547
|
+
params.identity_key = identity.identity_key;
|
|
1548
|
+
}
|
|
1635
1549
|
if (identity.product_option_item !== undefined) {
|
|
1636
1550
|
params.product_option_item = identity.product_option_item;
|
|
1637
1551
|
}
|
|
1638
1552
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1639
1553
|
_context20.next = 8;
|
|
1640
|
-
return this.
|
|
1554
|
+
return this.updateProductInOrder(params);
|
|
1641
1555
|
case 8:
|
|
1642
1556
|
products = _context20.sent;
|
|
1643
1557
|
this.logMethodSuccess('setOrderProductLineNote', {
|
|
@@ -1870,17 +1784,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1870
1784
|
if (visited.has(value)) return;
|
|
1871
1785
|
visited.add(value);
|
|
1872
1786
|
if (Array.isArray(value)) {
|
|
1873
|
-
var
|
|
1874
|
-
|
|
1787
|
+
var _iterator4 = _createForOfIteratorHelper(value),
|
|
1788
|
+
_step4;
|
|
1875
1789
|
try {
|
|
1876
|
-
for (
|
|
1877
|
-
var item =
|
|
1790
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1791
|
+
var item = _step4.value;
|
|
1878
1792
|
collectFromValue(item);
|
|
1879
1793
|
}
|
|
1880
1794
|
} catch (err) {
|
|
1881
|
-
|
|
1795
|
+
_iterator4.e(err);
|
|
1882
1796
|
} finally {
|
|
1883
|
-
|
|
1797
|
+
_iterator4.f();
|
|
1884
1798
|
}
|
|
1885
1799
|
return;
|
|
1886
1800
|
}
|
|
@@ -1896,8 +1810,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1896
1810
|
sourceMap.set(key, node);
|
|
1897
1811
|
}
|
|
1898
1812
|
}
|
|
1899
|
-
for (var
|
|
1900
|
-
var childValue = _Object$values[
|
|
1813
|
+
for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
|
|
1814
|
+
var childValue = _Object$values[_i3];
|
|
1901
1815
|
if (childValue && _typeof(childValue) === 'object') {
|
|
1902
1816
|
collectFromValue(childValue);
|
|
1903
1817
|
}
|
|
@@ -2041,7 +1955,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2041
1955
|
key: "applyPrefillByItemRule",
|
|
2042
1956
|
value: function () {
|
|
2043
1957
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2044
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
1958
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator5, _step5, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
2045
1959
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2046
1960
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2047
1961
|
case 0:
|
|
@@ -2086,15 +2000,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2086
2000
|
productSourceMap = _context29.sent;
|
|
2087
2001
|
tempOrder = this.ensureTempOrder();
|
|
2088
2002
|
hasChanges = false;
|
|
2089
|
-
|
|
2003
|
+
_iterator5 = _createForOfIteratorHelper(prefillItems);
|
|
2090
2004
|
_context29.prev = 20;
|
|
2091
|
-
|
|
2005
|
+
_iterator5.s();
|
|
2092
2006
|
case 22:
|
|
2093
|
-
if ((
|
|
2007
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
2094
2008
|
_context29.next = 47;
|
|
2095
2009
|
break;
|
|
2096
2010
|
}
|
|
2097
|
-
prefillItem =
|
|
2011
|
+
prefillItem = _step5.value;
|
|
2098
2012
|
productId = Number(prefillItem.product_id);
|
|
2099
2013
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2100
2014
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2148,6 +2062,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2148
2062
|
item_rule_prefill: true,
|
|
2149
2063
|
item_rule_id: prefillItem.ruleId
|
|
2150
2064
|
}),
|
|
2065
|
+
// TODO(Order types): migrate ScanOrder prefill origin runtime into tempOrder._extend.
|
|
2151
2066
|
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
2152
2067
|
});
|
|
2153
2068
|
hasQuantityChanged = delta > 0;
|
|
@@ -2165,10 +2080,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2165
2080
|
case 49:
|
|
2166
2081
|
_context29.prev = 49;
|
|
2167
2082
|
_context29.t0 = _context29["catch"](20);
|
|
2168
|
-
|
|
2083
|
+
_iterator5.e(_context29.t0);
|
|
2169
2084
|
case 52:
|
|
2170
2085
|
_context29.prev = 52;
|
|
2171
|
-
|
|
2086
|
+
_iterator5.f();
|
|
2172
2087
|
return _context29.finish(52);
|
|
2173
2088
|
case 55:
|
|
2174
2089
|
if (!hasChanges) {
|
|
@@ -2556,7 +2471,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2556
2471
|
key: "checkResourceAvailable",
|
|
2557
2472
|
value: function () {
|
|
2558
2473
|
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
|
|
2559
|
-
var _this$
|
|
2474
|
+
var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
|
|
2560
2475
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2561
2476
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2562
2477
|
case 0:
|
|
@@ -2564,28 +2479,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2564
2479
|
resourceId: resourceId
|
|
2565
2480
|
});
|
|
2566
2481
|
_context36.prev = 1;
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2570
|
-
_context36.next = 7;
|
|
2571
|
-
return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
|
|
2482
|
+
_context36.next = 4;
|
|
2483
|
+
return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
|
|
2572
2484
|
scope: 'board',
|
|
2573
|
-
target:
|
|
2485
|
+
target: 'dine_in+scan_to_order',
|
|
2574
2486
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
2575
2487
|
});
|
|
2576
|
-
case
|
|
2488
|
+
case 4:
|
|
2577
2489
|
openData = _context36.sent;
|
|
2578
2490
|
if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
|
|
2579
|
-
_context36.next =
|
|
2491
|
+
_context36.next = 7;
|
|
2580
2492
|
break;
|
|
2581
2493
|
}
|
|
2582
2494
|
throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
|
|
2583
|
-
case
|
|
2495
|
+
case 7:
|
|
2584
2496
|
dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
|
|
2585
2497
|
this.otherParams.dineInConfig = dineInConfig;
|
|
2586
|
-
_context36.next =
|
|
2498
|
+
_context36.next = 11;
|
|
2587
2499
|
return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
|
|
2588
|
-
case
|
|
2500
|
+
case 11:
|
|
2589
2501
|
closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
|
|
2590
2502
|
closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
|
|
2591
2503
|
basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
|
|
@@ -2602,21 +2514,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2602
2514
|
};
|
|
2603
2515
|
}; // 1. 基础开关 basic.enable 关闭
|
|
2604
2516
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
|
|
2605
|
-
_context36.next =
|
|
2517
|
+
_context36.next = 18;
|
|
2606
2518
|
break;
|
|
2607
2519
|
}
|
|
2608
2520
|
return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
|
|
2609
|
-
case
|
|
2521
|
+
case 18:
|
|
2610
2522
|
if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
|
|
2611
|
-
_context36.next =
|
|
2523
|
+
_context36.next = 21;
|
|
2612
2524
|
break;
|
|
2613
2525
|
}
|
|
2614
2526
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
|
|
2615
|
-
_context36.next =
|
|
2527
|
+
_context36.next = 21;
|
|
2616
2528
|
break;
|
|
2617
2529
|
}
|
|
2618
2530
|
return _context36.abrupt("return", makeShopClosed(pauseMessage));
|
|
2619
|
-
case
|
|
2531
|
+
case 21:
|
|
2620
2532
|
// 3. 营业时间 operating_hours 闸门
|
|
2621
2533
|
operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
|
|
2622
2534
|
return Number(id);
|
|
@@ -2632,27 +2544,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2632
2544
|
}
|
|
2633
2545
|
}
|
|
2634
2546
|
if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
|
|
2635
|
-
_context36.next =
|
|
2547
|
+
_context36.next = 26;
|
|
2636
2548
|
break;
|
|
2637
2549
|
}
|
|
2638
2550
|
return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
|
|
2639
|
-
case
|
|
2551
|
+
case 26:
|
|
2640
2552
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2641
2553
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2642
2554
|
tempOrder = this.ensureTempOrder();
|
|
2643
2555
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2644
2556
|
if (!(reservationLinkIds.length === 0)) {
|
|
2645
|
-
_context36.next =
|
|
2557
|
+
_context36.next = 32;
|
|
2646
2558
|
break;
|
|
2647
2559
|
}
|
|
2648
2560
|
this.enabledReservationRuleProducts = [];
|
|
2649
|
-
_context36.next =
|
|
2561
|
+
_context36.next = 43;
|
|
2650
2562
|
break;
|
|
2651
|
-
case
|
|
2563
|
+
case 32:
|
|
2652
2564
|
tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
|
|
2653
2565
|
delete tempOrder.metadata.table_occupancy_duration;
|
|
2654
2566
|
reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
|
|
2655
|
-
_context36.next =
|
|
2567
|
+
_context36.next = 37;
|
|
2656
2568
|
return reservationProductList.initialize(this.core, {
|
|
2657
2569
|
store: {
|
|
2658
2570
|
list: [],
|
|
@@ -2664,17 +2576,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2664
2576
|
cacheId: this.cacheId
|
|
2665
2577
|
})
|
|
2666
2578
|
});
|
|
2667
|
-
case
|
|
2579
|
+
case 37:
|
|
2668
2580
|
scheduleDate = dayjs().format('YYYY-MM-DD');
|
|
2669
2581
|
scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2670
|
-
_context36.next =
|
|
2582
|
+
_context36.next = 41;
|
|
2671
2583
|
return reservationProductList.loadProducts({
|
|
2672
2584
|
product_ids: reservationLinkIds,
|
|
2673
2585
|
schedule_date: scheduleDate,
|
|
2674
2586
|
schedule_datetime: scheduleDatetime,
|
|
2675
2587
|
cacheId: this.cacheId
|
|
2676
2588
|
});
|
|
2677
|
-
case
|
|
2589
|
+
case 41:
|
|
2678
2590
|
loaded = _context36.sent;
|
|
2679
2591
|
if (Array.isArray(loaded)) {
|
|
2680
2592
|
this.enabledReservationRuleProducts = loaded;
|
|
@@ -2690,19 +2602,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2690
2602
|
}
|
|
2691
2603
|
} else {
|
|
2692
2604
|
this.enabledReservationRuleProducts = [];
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2605
|
+
void this.addScanOrderLog({
|
|
2606
|
+
level: 'error',
|
|
2607
|
+
title: '[ScanOrder] enabled_reservation_rules product query failed',
|
|
2608
|
+
payload: {
|
|
2609
|
+
linkIds: reservationLinkIds,
|
|
2610
|
+
error: this.serializeError(loaded)
|
|
2611
|
+
}
|
|
2700
2612
|
});
|
|
2701
2613
|
}
|
|
2702
|
-
case
|
|
2703
|
-
_context36.next =
|
|
2614
|
+
case 43:
|
|
2615
|
+
_context36.next = 45;
|
|
2704
2616
|
return this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
2705
|
-
case
|
|
2617
|
+
case 45:
|
|
2706
2618
|
occupyDetail = _context36.sent;
|
|
2707
2619
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2708
2620
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2735,31 +2647,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2735
2647
|
requestPaxMin: this.store.resource.requestPaxMin
|
|
2736
2648
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2737
2649
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2738
|
-
} : {});
|
|
2739
|
-
tempOrder.relation_id = resourceId || ((_this$
|
|
2650
|
+
} : {}); // TODO(Order types): keep ScanOrder resource runtime out of OrderTempOrder root.
|
|
2651
|
+
tempOrder.relation_id = resourceId || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.relation_id);
|
|
2740
2652
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
2741
2653
|
tempOrder.resource_id = resourceId;
|
|
2742
2654
|
(_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
|
|
2743
2655
|
|
|
2744
2656
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2745
2657
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2746
|
-
_context36.next =
|
|
2658
|
+
_context36.next = 60;
|
|
2747
2659
|
break;
|
|
2748
2660
|
}
|
|
2749
|
-
_context36.next =
|
|
2661
|
+
_context36.next = 60;
|
|
2750
2662
|
return this.addNewOrder();
|
|
2751
|
-
case
|
|
2752
|
-
// 如果是加单模式,tempOrder
|
|
2663
|
+
case 60:
|
|
2664
|
+
// 如果是加单模式,tempOrder 里需要记录 lastOrderId;提交仍走统一 sales checkout 接口
|
|
2753
2665
|
if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
|
|
2754
2666
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
2755
2667
|
}
|
|
2756
2668
|
if (!tempOrder.order_id) {
|
|
2757
|
-
_context36.next =
|
|
2669
|
+
_context36.next = 69;
|
|
2758
2670
|
break;
|
|
2759
2671
|
}
|
|
2760
|
-
_context36.next =
|
|
2672
|
+
_context36.next = 64;
|
|
2761
2673
|
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
2762
|
-
case
|
|
2674
|
+
case 64:
|
|
2763
2675
|
res = _context36.sent;
|
|
2764
2676
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2765
2677
|
entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
|
|
@@ -2767,12 +2679,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2767
2679
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2768
2680
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2769
2681
|
if (!entryPaxNumber) {
|
|
2770
|
-
_context36.next =
|
|
2682
|
+
_context36.next = 69;
|
|
2771
2683
|
break;
|
|
2772
2684
|
}
|
|
2773
|
-
_context36.next =
|
|
2685
|
+
_context36.next = 69;
|
|
2774
2686
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2775
|
-
case
|
|
2687
|
+
case 69:
|
|
2776
2688
|
lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
2777
2689
|
historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
2778
2690
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
@@ -2784,13 +2696,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2784
2696
|
} : {}));
|
|
2785
2697
|
return acc;
|
|
2786
2698
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2787
|
-
_context36.next =
|
|
2699
|
+
_context36.next = 73;
|
|
2788
2700
|
return this.setItemRuleRuntimeConfig({
|
|
2789
|
-
serviceType: (_this$
|
|
2701
|
+
serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
|
|
2790
2702
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
2791
2703
|
historicalItems: historicalItems
|
|
2792
2704
|
});
|
|
2793
|
-
case
|
|
2705
|
+
case 73:
|
|
2794
2706
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2795
2707
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2796
2708
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2812,18 +2724,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2812
2724
|
isFull: resourceState.isFull
|
|
2813
2725
|
});
|
|
2814
2726
|
return _context36.abrupt("return", availabilityInfo);
|
|
2815
|
-
case
|
|
2816
|
-
_context36.prev =
|
|
2727
|
+
case 78:
|
|
2728
|
+
_context36.prev = 78;
|
|
2817
2729
|
_context36.t0 = _context36["catch"](1);
|
|
2818
2730
|
this.logMethodError('checkResourceAvailable', _context36.t0.message, {
|
|
2819
2731
|
resourceId: resourceId
|
|
2820
2732
|
});
|
|
2821
2733
|
throw _context36.t0;
|
|
2822
|
-
case
|
|
2734
|
+
case 82:
|
|
2823
2735
|
case "end":
|
|
2824
2736
|
return _context36.stop();
|
|
2825
2737
|
}
|
|
2826
|
-
}, _callee36, this, [[1,
|
|
2738
|
+
}, _callee36, this, [[1, 78]]);
|
|
2827
2739
|
}));
|
|
2828
2740
|
function checkResourceAvailable(_x18, _x19) {
|
|
2829
2741
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -2866,56 +2778,41 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2866
2778
|
key: "getProductList",
|
|
2867
2779
|
value: function () {
|
|
2868
2780
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2869
|
-
var _this$
|
|
2870
|
-
var menu_list_ids,
|
|
2781
|
+
var _this$otherParams13;
|
|
2782
|
+
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
2871
2783
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2872
2784
|
while (1) switch (_context38.prev = _context38.next) {
|
|
2873
2785
|
case 0:
|
|
2874
2786
|
this.logMethodStart('getProductList');
|
|
2875
2787
|
// 可以直接通过配置里的 menu 读取
|
|
2876
|
-
menu_list_ids = ((_this$
|
|
2788
|
+
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) {
|
|
2877
2789
|
return Number(n.value);
|
|
2878
2790
|
})) || [];
|
|
2879
2791
|
_context38.prev = 2;
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
break;
|
|
2883
|
-
}
|
|
2884
|
-
throw new Error('products 模块未初始化');
|
|
2885
|
-
case 5:
|
|
2886
|
-
_context38.next = 7;
|
|
2887
|
-
return this.store.products.loadProducts({
|
|
2792
|
+
_context38.next = 5;
|
|
2793
|
+
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2888
2794
|
menu_list_ids: menu_list_ids,
|
|
2889
2795
|
cacheId: this.cacheId,
|
|
2890
2796
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
2891
2797
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2892
2798
|
});
|
|
2893
|
-
case
|
|
2799
|
+
case 5:
|
|
2894
2800
|
res = _context38.sent;
|
|
2895
|
-
|
|
2896
|
-
menu_list_ids: menu_list_ids,
|
|
2897
|
-
cacheId: this.cacheId
|
|
2898
|
-
});
|
|
2899
|
-
formattedRes = attachItemRuleLimitsToTopLevelProducts(productList, this.store.itemRuleQuantityLimits || []);
|
|
2801
|
+
formattedRes = attachItemRuleLimitsToTopLevelProducts(res, this.store.itemRuleQuantityLimits || []);
|
|
2900
2802
|
this.logMethodSuccess('getProductList', {
|
|
2901
2803
|
menuCount: menu_list_ids.length
|
|
2902
2804
|
});
|
|
2903
2805
|
return _context38.abrupt("return", formattedRes);
|
|
2904
|
-
case
|
|
2905
|
-
_context38.prev =
|
|
2806
|
+
case 11:
|
|
2807
|
+
_context38.prev = 11;
|
|
2906
2808
|
_context38.t0 = _context38["catch"](2);
|
|
2907
|
-
|
|
2908
|
-
this.logMethodError('getProductList', _context38.t0, {
|
|
2909
|
-
menu_list_ids: menu_list_ids,
|
|
2910
|
-
cacheId: this.cacheId
|
|
2911
|
-
});
|
|
2912
|
-
}
|
|
2809
|
+
this.logMethodError('getProductList', _context38.t0.message);
|
|
2913
2810
|
throw _context38.t0;
|
|
2914
|
-
case
|
|
2811
|
+
case 15:
|
|
2915
2812
|
case "end":
|
|
2916
2813
|
return _context38.stop();
|
|
2917
2814
|
}
|
|
2918
|
-
}, _callee38, this, [[2,
|
|
2815
|
+
}, _callee38, this, [[2, 11]]);
|
|
2919
2816
|
}));
|
|
2920
2817
|
function getProductList() {
|
|
2921
2818
|
return _getProductList.apply(this, arguments);
|
|
@@ -2982,7 +2879,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2982
2879
|
var raw = this.window.localStorage.getItem(key) || '{}';
|
|
2983
2880
|
var parsed = JSON.parse(raw);
|
|
2984
2881
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
2985
|
-
} catch (
|
|
2882
|
+
} catch (_unused) {
|
|
2986
2883
|
return {};
|
|
2987
2884
|
}
|
|
2988
2885
|
}
|
|
@@ -3091,9 +2988,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3091
2988
|
}, {
|
|
3092
2989
|
key: "getFulfillmentModes",
|
|
3093
2990
|
value: function getFulfillmentModes() {
|
|
3094
|
-
var _this$
|
|
2991
|
+
var _this$otherParams14;
|
|
3095
2992
|
this.logMethodStart('getFulfillmentModes');
|
|
3096
|
-
var dineInConfig = ((_this$
|
|
2993
|
+
var dineInConfig = ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig) || {};
|
|
3097
2994
|
var result = {
|
|
3098
2995
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
3099
2996
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -3107,9 +3004,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3107
3004
|
}, {
|
|
3108
3005
|
key: "checkManualPickupRef",
|
|
3109
3006
|
value: function checkManualPickupRef() {
|
|
3110
|
-
var _this$
|
|
3007
|
+
var _this$otherParams15;
|
|
3111
3008
|
this.logMethodStart('checkManualPickupRef');
|
|
3112
|
-
var dineInConfig = ((_this$
|
|
3009
|
+
var dineInConfig = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.dineInConfig) || {};
|
|
3113
3010
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3114
3011
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3115
3012
|
var enabled = refMode === 'manual_input';
|