@pisell/pisellos 2.2.309 → 2.2.310
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/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/index.js +4 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +21 -12
- package/dist/modules/Order/index.d.ts +32 -4
- package/dist/modules/Order/index.js +733 -373
- package/dist/modules/Order/types.d.ts +17 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +14 -2
- package/dist/modules/Order/utils.js +275 -76
- package/dist/modules/Payment/index.d.ts +0 -5
- package/dist/modules/Payment/index.js +35 -85
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/ProductList/index.js +18 -5
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/index.js +8 -5
- package/dist/server/modules/order/index.js +6 -0
- package/dist/server/modules/order/types.d.ts +12 -0
- package/dist/server/modules/payment/index.d.ts +25 -6
- package/dist/server/modules/payment/index.js +660 -133
- package/dist/server/utils/small-ticket.d.ts +8 -5
- package/dist/server/utils/small-ticket.js +1269 -199
- package/dist/solution/BaseSales/index.d.ts +11 -2
- package/dist/solution/BaseSales/index.js +1463 -1173
- package/dist/solution/BaseSales/types.d.ts +7 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +12 -3
- package/dist/solution/BookingTicket/index.js +663 -542
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.js +5 -5
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/os-private-payload.js +17 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/index.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +11 -2
- package/lib/modules/Order/index.d.ts +32 -4
- package/lib/modules/Order/index.js +341 -71
- package/lib/modules/Order/types.d.ts +17 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +14 -2
- package/lib/modules/Order/utils.js +186 -3
- package/lib/modules/Payment/index.d.ts +0 -5
- package/lib/modules/Payment/index.js +3 -28
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/ProductList/index.js +14 -1
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/index.js +8 -5
- package/lib/server/modules/order/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +12 -0
- package/lib/server/modules/payment/index.d.ts +25 -6
- package/lib/server/modules/payment/index.js +350 -78
- package/lib/server/utils/small-ticket.d.ts +8 -5
- package/lib/server/utils/small-ticket.js +1009 -121
- package/lib/solution/BaseSales/index.d.ts +11 -2
- package/lib/solution/BaseSales/index.js +164 -30
- package/lib/solution/BaseSales/types.d.ts +7 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +12 -3
- package/lib/solution/BookingTicket/index.js +103 -41
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.js +5 -5
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/os-private-payload.js +22 -0
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var _excluded = ["id"],
|
|
2
2
|
_excluded2 = ["product_id"],
|
|
3
3
|
_excluded3 = ["product_id"];
|
|
4
|
-
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
4
|
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
5
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
6
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
8
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
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
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); }); }; }
|
|
@@ -180,7 +180,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
180
180
|
_defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
|
|
181
181
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
182
182
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
183
|
+
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
183
184
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
185
|
+
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
184
186
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
185
187
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
186
188
|
_defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
|
|
@@ -238,8 +240,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
238
240
|
case 6:
|
|
239
241
|
this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
|
|
240
242
|
_context.next = 9;
|
|
241
|
-
return this.
|
|
243
|
+
return this.prepareInvoiceTemplateAtSolutionReady(this.getInjectedOpenDataConfig());
|
|
242
244
|
case 9:
|
|
245
|
+
_context.next = 11;
|
|
246
|
+
return this.configureIdGeneratorFromOpenData();
|
|
247
|
+
case 11:
|
|
243
248
|
case "end":
|
|
244
249
|
return _context.stop();
|
|
245
250
|
}
|
|
@@ -250,11 +255,72 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
250
255
|
}
|
|
251
256
|
return initialize;
|
|
252
257
|
}()
|
|
258
|
+
}, {
|
|
259
|
+
key: "getInjectedOpenDataConfig",
|
|
260
|
+
value: function getInjectedOpenDataConfig() {
|
|
261
|
+
var _this$otherParams2;
|
|
262
|
+
var openData = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.openData;
|
|
263
|
+
return openData && _typeof(openData) === 'object' && !Array.isArray(openData) ? openData : undefined;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* 在解决方案对外 ready 前准备 Invoice Document;失败只降级模板,不阻断销售。
|
|
268
|
+
* 已由页面取得的 OpenData 直接交给模块接管,没有注入数据时再走 target-scoped 加载。
|
|
269
|
+
*/
|
|
270
|
+
}, {
|
|
271
|
+
key: "prepareInvoiceTemplateAtSolutionReady",
|
|
272
|
+
value: (function () {
|
|
273
|
+
var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(injectedOpenData) {
|
|
274
|
+
var businessCode, channel, target;
|
|
275
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
276
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
businessCode = this.getBookingTicketBusinessCode();
|
|
279
|
+
if (!(!businessCode || !this.store.openData)) {
|
|
280
|
+
_context2.next = 3;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
return _context2.abrupt("return");
|
|
284
|
+
case 3:
|
|
285
|
+
channel = this.getSubmitOrderSalesChannel();
|
|
286
|
+
target = "".concat(businessCode, "+").concat(channel);
|
|
287
|
+
_context2.prev = 5;
|
|
288
|
+
if (!(injectedOpenData && typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
|
|
289
|
+
_context2.next = 12;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
this.openDataTarget = target;
|
|
293
|
+
_context2.next = 10;
|
|
294
|
+
return this.store.openData.ensureInvoiceTemplateSettings(target, injectedOpenData);
|
|
295
|
+
case 10:
|
|
296
|
+
this.otherParams.openData = injectedOpenData;
|
|
297
|
+
return _context2.abrupt("return");
|
|
298
|
+
case 12:
|
|
299
|
+
_context2.next = 14;
|
|
300
|
+
return this.loadOpenDataConfig();
|
|
301
|
+
case 14:
|
|
302
|
+
_context2.next = 19;
|
|
303
|
+
break;
|
|
304
|
+
case 16:
|
|
305
|
+
_context2.prev = 16;
|
|
306
|
+
_context2.t0 = _context2["catch"](5);
|
|
307
|
+
console.warn('[BookingTicket] Invoice 模板预加载失败,使用默认配置', _context2.t0);
|
|
308
|
+
case 19:
|
|
309
|
+
case "end":
|
|
310
|
+
return _context2.stop();
|
|
311
|
+
}
|
|
312
|
+
}, _callee2, this, [[5, 16]]);
|
|
313
|
+
}));
|
|
314
|
+
function prepareInvoiceTemplateAtSolutionReady(_x2) {
|
|
315
|
+
return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
|
|
316
|
+
}
|
|
317
|
+
return prepareInvoiceTemplateAtSolutionReady;
|
|
318
|
+
}())
|
|
253
319
|
}, {
|
|
254
320
|
key: "getBookingTicketBusinessCode",
|
|
255
321
|
value: function getBookingTicketBusinessCode() {
|
|
256
|
-
var _this$
|
|
257
|
-
var candidates = [(_this$
|
|
322
|
+
var _this$otherParams3, _this$otherParams4, _this$getOrderHeader, _this$store$order, _this$store$order$get, _this$getSalesOrder;
|
|
323
|
+
var candidates = [(_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode, (_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.business_code, (_this$getOrderHeader = this.getOrderHeader()) === null || _this$getOrderHeader === void 0 ? void 0 : _this$getOrderHeader.business_code, typeof ((_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.getTempOrder) === 'function' ? (_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.business_code : undefined, (_this$getSalesOrder = this.getSalesOrder()) === null || _this$getSalesOrder === void 0 || (_this$getSalesOrder = _this$getSalesOrder.raw) === null || _this$getSalesOrder === void 0 ? void 0 : _this$getSalesOrder.business_code];
|
|
258
324
|
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
259
325
|
var candidate = _candidates[_i];
|
|
260
326
|
if (candidate === undefined || candidate === null) continue;
|
|
@@ -274,60 +340,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
274
340
|
}, {
|
|
275
341
|
key: "loadOpenDataConfig",
|
|
276
342
|
value: function () {
|
|
277
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
343
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
278
344
|
var businessCode, channel, target, lastFetchedAt, cachedData, request, openDataConfig;
|
|
279
|
-
return _regeneratorRuntime().wrap(function
|
|
280
|
-
while (1) switch (
|
|
345
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
346
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
281
347
|
case 0:
|
|
282
348
|
if (this.store.openData) {
|
|
283
|
-
|
|
349
|
+
_context3.next = 2;
|
|
284
350
|
break;
|
|
285
351
|
}
|
|
286
352
|
throw new Error('openData 模块未初始化');
|
|
287
353
|
case 2:
|
|
288
354
|
businessCode = this.getBookingTicketBusinessCode();
|
|
289
355
|
if (businessCode) {
|
|
290
|
-
|
|
356
|
+
_context3.next = 6;
|
|
291
357
|
break;
|
|
292
358
|
}
|
|
293
359
|
console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
|
|
294
|
-
return
|
|
360
|
+
return _context3.abrupt("return", null);
|
|
295
361
|
case 6:
|
|
296
362
|
channel = this.getSubmitOrderSalesChannel();
|
|
297
363
|
target = "".concat(businessCode, "+").concat(channel);
|
|
298
364
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
299
365
|
cachedData = this.store.openData.getOpenData();
|
|
300
366
|
if (!(cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
301
|
-
|
|
367
|
+
_context3.next = 16;
|
|
302
368
|
break;
|
|
303
369
|
}
|
|
304
370
|
if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
|
|
305
|
-
|
|
371
|
+
_context3.next = 14;
|
|
306
372
|
break;
|
|
307
373
|
}
|
|
308
|
-
|
|
374
|
+
_context3.next = 14;
|
|
309
375
|
return this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
310
376
|
case 14:
|
|
311
377
|
this.otherParams.openData = cachedData;
|
|
312
|
-
return
|
|
378
|
+
return _context3.abrupt("return", cachedData);
|
|
313
379
|
case 16:
|
|
314
380
|
if (!this.loadOpenDataInFlight) {
|
|
315
|
-
|
|
381
|
+
_context3.next = 24;
|
|
316
382
|
break;
|
|
317
383
|
}
|
|
318
384
|
if (!(this.loadOpenDataInFlightTarget === target)) {
|
|
319
|
-
|
|
385
|
+
_context3.next = 21;
|
|
320
386
|
break;
|
|
321
387
|
}
|
|
322
|
-
|
|
388
|
+
_context3.next = 20;
|
|
323
389
|
return this.loadOpenDataInFlight;
|
|
324
390
|
case 20:
|
|
325
|
-
return
|
|
391
|
+
return _context3.abrupt("return", _context3.sent);
|
|
326
392
|
case 21:
|
|
327
|
-
|
|
393
|
+
_context3.next = 23;
|
|
328
394
|
return this.loadOpenDataInFlight;
|
|
329
395
|
case 23:
|
|
330
|
-
return
|
|
396
|
+
return _context3.abrupt("return", this.loadOpenDataConfig());
|
|
331
397
|
case 24:
|
|
332
398
|
this.loadOpenDataInFlightTarget = target;
|
|
333
399
|
request = this.store.openData.fetchOpenData({
|
|
@@ -337,29 +403,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
337
403
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
338
404
|
});
|
|
339
405
|
this.loadOpenDataInFlight = request;
|
|
340
|
-
|
|
341
|
-
|
|
406
|
+
_context3.prev = 27;
|
|
407
|
+
_context3.next = 30;
|
|
342
408
|
return request;
|
|
343
409
|
case 30:
|
|
344
|
-
openDataConfig =
|
|
410
|
+
openDataConfig = _context3.sent;
|
|
345
411
|
// clearOpenDataCache() 或新请求已接管时,旧响应只能返回给原调用方,不能复活缓存归属。
|
|
346
412
|
if (this.loadOpenDataInFlight === request) {
|
|
347
413
|
this.openDataTarget = target;
|
|
348
414
|
this.otherParams.openData = openDataConfig;
|
|
349
415
|
}
|
|
350
|
-
return
|
|
416
|
+
return _context3.abrupt("return", openDataConfig);
|
|
351
417
|
case 33:
|
|
352
|
-
|
|
418
|
+
_context3.prev = 33;
|
|
353
419
|
if (this.loadOpenDataInFlight === request) {
|
|
354
420
|
this.loadOpenDataInFlight = null;
|
|
355
421
|
this.loadOpenDataInFlightTarget = null;
|
|
356
422
|
}
|
|
357
|
-
return
|
|
423
|
+
return _context3.finish(33);
|
|
358
424
|
case 36:
|
|
359
425
|
case "end":
|
|
360
|
-
return
|
|
426
|
+
return _context3.stop();
|
|
361
427
|
}
|
|
362
|
-
},
|
|
428
|
+
}, _callee3, this, [[27,, 33, 36]]);
|
|
363
429
|
}));
|
|
364
430
|
function loadOpenDataConfig() {
|
|
365
431
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -369,16 +435,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
369
435
|
}, {
|
|
370
436
|
key: "getOpenData",
|
|
371
437
|
value: function () {
|
|
372
|
-
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
373
|
-
return _regeneratorRuntime().wrap(function
|
|
374
|
-
while (1) switch (
|
|
438
|
+
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
439
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
440
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
375
441
|
case 0:
|
|
376
|
-
return
|
|
442
|
+
return _context4.abrupt("return", this.loadOpenDataConfig());
|
|
377
443
|
case 1:
|
|
378
444
|
case "end":
|
|
379
|
-
return
|
|
445
|
+
return _context4.stop();
|
|
380
446
|
}
|
|
381
|
-
},
|
|
447
|
+
}, _callee4, this);
|
|
382
448
|
}));
|
|
383
449
|
function getOpenData() {
|
|
384
450
|
return _getOpenData.apply(this, arguments);
|
|
@@ -388,27 +454,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
388
454
|
}, {
|
|
389
455
|
key: "getInvoiceLayoutConfig",
|
|
390
456
|
value: function () {
|
|
391
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
457
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
392
458
|
var openData;
|
|
393
|
-
return _regeneratorRuntime().wrap(function
|
|
394
|
-
while (1) switch (
|
|
459
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
460
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
395
461
|
case 0:
|
|
396
|
-
|
|
462
|
+
_context5.next = 2;
|
|
397
463
|
return this.loadOpenDataConfig();
|
|
398
464
|
case 2:
|
|
399
|
-
openData =
|
|
465
|
+
openData = _context5.sent;
|
|
400
466
|
if (openData) {
|
|
401
|
-
|
|
467
|
+
_context5.next = 5;
|
|
402
468
|
break;
|
|
403
469
|
}
|
|
404
|
-
return
|
|
470
|
+
return _context5.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
405
471
|
case 5:
|
|
406
|
-
return
|
|
472
|
+
return _context5.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
407
473
|
case 6:
|
|
408
474
|
case "end":
|
|
409
|
-
return
|
|
475
|
+
return _context5.stop();
|
|
410
476
|
}
|
|
411
|
-
},
|
|
477
|
+
}, _callee5, this);
|
|
412
478
|
}));
|
|
413
479
|
function getInvoiceLayoutConfig() {
|
|
414
480
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -418,27 +484,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
418
484
|
}, {
|
|
419
485
|
key: "getInvoiceTemplateSettings",
|
|
420
486
|
value: function () {
|
|
421
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
487
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
422
488
|
var openData;
|
|
423
|
-
return _regeneratorRuntime().wrap(function
|
|
424
|
-
while (1) switch (
|
|
489
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
490
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
425
491
|
case 0:
|
|
426
|
-
|
|
492
|
+
_context6.next = 2;
|
|
427
493
|
return this.loadOpenDataConfig();
|
|
428
494
|
case 2:
|
|
429
|
-
openData =
|
|
495
|
+
openData = _context6.sent;
|
|
430
496
|
if (openData) {
|
|
431
|
-
|
|
497
|
+
_context6.next = 5;
|
|
432
498
|
break;
|
|
433
499
|
}
|
|
434
|
-
return
|
|
500
|
+
return _context6.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
435
501
|
case 5:
|
|
436
|
-
return
|
|
502
|
+
return _context6.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
437
503
|
case 6:
|
|
438
504
|
case "end":
|
|
439
|
-
return
|
|
505
|
+
return _context6.stop();
|
|
440
506
|
}
|
|
441
|
-
},
|
|
507
|
+
}, _callee6, this);
|
|
442
508
|
}));
|
|
443
509
|
function getInvoiceTemplateSettings() {
|
|
444
510
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -468,32 +534,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
468
534
|
}, {
|
|
469
535
|
key: "getShortNumberOrDeviceId",
|
|
470
536
|
value: function () {
|
|
471
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
537
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
472
538
|
var getAsyncIotDeviceInfo, res;
|
|
473
|
-
return _regeneratorRuntime().wrap(function
|
|
474
|
-
while (1) switch (
|
|
539
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
540
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
475
541
|
case 0:
|
|
476
542
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
477
543
|
if (!getAsyncIotDeviceInfo) {
|
|
478
|
-
|
|
544
|
+
_context7.next = 7;
|
|
479
545
|
break;
|
|
480
546
|
}
|
|
481
|
-
|
|
547
|
+
_context7.next = 4;
|
|
482
548
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
483
549
|
case 4:
|
|
484
|
-
res =
|
|
550
|
+
res = _context7.sent;
|
|
485
551
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
486
|
-
|
|
552
|
+
_context7.next = 7;
|
|
487
553
|
break;
|
|
488
554
|
}
|
|
489
|
-
return
|
|
555
|
+
return _context7.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
490
556
|
case 7:
|
|
491
|
-
return
|
|
557
|
+
return _context7.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
492
558
|
case 8:
|
|
493
559
|
case "end":
|
|
494
|
-
return
|
|
560
|
+
return _context7.stop();
|
|
495
561
|
}
|
|
496
|
-
},
|
|
562
|
+
}, _callee7, this);
|
|
497
563
|
}));
|
|
498
564
|
function getShortNumberOrDeviceId() {
|
|
499
565
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -503,35 +569,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
503
569
|
}, {
|
|
504
570
|
key: "configureIdGeneratorFromOpenData",
|
|
505
571
|
value: function () {
|
|
506
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
572
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
507
573
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
508
574
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
509
|
-
return _regeneratorRuntime().wrap(function
|
|
510
|
-
while (1) switch (
|
|
575
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
576
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
511
577
|
case 0:
|
|
512
578
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
513
579
|
this.setPaymentNumberDevicePrefix(null);
|
|
514
580
|
idGenerator = this.getIdGeneratorPlugin();
|
|
515
581
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
516
|
-
|
|
582
|
+
_context8.next = 5;
|
|
517
583
|
break;
|
|
518
584
|
}
|
|
519
585
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
520
|
-
return
|
|
586
|
+
return _context8.abrupt("return");
|
|
521
587
|
case 5:
|
|
522
588
|
openDataConfig = null;
|
|
523
|
-
|
|
524
|
-
|
|
589
|
+
_context8.prev = 6;
|
|
590
|
+
_context8.next = 9;
|
|
525
591
|
return this.loadOpenDataConfig();
|
|
526
592
|
case 9:
|
|
527
|
-
openDataConfig =
|
|
528
|
-
|
|
593
|
+
openDataConfig = _context8.sent;
|
|
594
|
+
_context8.next = 16;
|
|
529
595
|
break;
|
|
530
596
|
case 12:
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
534
|
-
return
|
|
597
|
+
_context8.prev = 12;
|
|
598
|
+
_context8.t0 = _context8["catch"](6);
|
|
599
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context8.t0);
|
|
600
|
+
return _context8.abrupt("return");
|
|
535
601
|
case 16:
|
|
536
602
|
// if (!openDataConfig) return;
|
|
537
603
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -543,21 +609,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
543
609
|
"type": "start_time",
|
|
544
610
|
"time": "00:00"
|
|
545
611
|
};
|
|
546
|
-
|
|
612
|
+
_context8.next = 24;
|
|
547
613
|
return this.getShortNumberOrDeviceId();
|
|
548
614
|
case 24:
|
|
549
|
-
deviceId =
|
|
615
|
+
deviceId = _context8.sent;
|
|
550
616
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
551
617
|
businessCode = this.getBookingTicketBusinessCode();
|
|
552
618
|
if (businessCode) {
|
|
553
|
-
|
|
619
|
+
_context8.next = 30;
|
|
554
620
|
break;
|
|
555
621
|
}
|
|
556
622
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
557
|
-
return
|
|
623
|
+
return _context8.abrupt("return");
|
|
558
624
|
case 30:
|
|
559
|
-
|
|
560
|
-
|
|
625
|
+
_context8.prev = 30;
|
|
626
|
+
_context8.next = 33;
|
|
561
627
|
return idGenerator.configure({
|
|
562
628
|
biz: businessCode,
|
|
563
629
|
config: {
|
|
@@ -573,17 +639,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
573
639
|
}
|
|
574
640
|
});
|
|
575
641
|
case 33:
|
|
576
|
-
|
|
642
|
+
_context8.next = 38;
|
|
577
643
|
break;
|
|
578
644
|
case 35:
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
645
|
+
_context8.prev = 35;
|
|
646
|
+
_context8.t1 = _context8["catch"](30);
|
|
647
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context8.t1);
|
|
582
648
|
case 38:
|
|
583
649
|
case "end":
|
|
584
|
-
return
|
|
650
|
+
return _context8.stop();
|
|
585
651
|
}
|
|
586
|
-
},
|
|
652
|
+
}, _callee8, this, [[6, 12], [30, 35]]);
|
|
587
653
|
}));
|
|
588
654
|
function configureIdGeneratorFromOpenData() {
|
|
589
655
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -615,16 +681,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
615
681
|
}, {
|
|
616
682
|
key: "loadSalesDetail",
|
|
617
683
|
value: (function () {
|
|
618
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
684
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(orderIdOrParams) {
|
|
619
685
|
var _ref3;
|
|
620
686
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
621
|
-
return _regeneratorRuntime().wrap(function
|
|
622
|
-
while (1) switch (
|
|
687
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
688
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
623
689
|
case 0:
|
|
624
|
-
|
|
690
|
+
_context9.next = 2;
|
|
625
691
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
626
692
|
case 2:
|
|
627
|
-
sales =
|
|
693
|
+
sales = _context9.sent;
|
|
628
694
|
customerModule = this.store.customer;
|
|
629
695
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
630
696
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -656,14 +722,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
656
722
|
});
|
|
657
723
|
// await this.store.order.saveDraft();
|
|
658
724
|
}
|
|
659
|
-
return
|
|
725
|
+
return _context9.abrupt("return", sales);
|
|
660
726
|
case 11:
|
|
661
727
|
case "end":
|
|
662
|
-
return
|
|
728
|
+
return _context9.stop();
|
|
663
729
|
}
|
|
664
|
-
},
|
|
730
|
+
}, _callee9, this);
|
|
665
731
|
}));
|
|
666
|
-
function loadSalesDetail(
|
|
732
|
+
function loadSalesDetail(_x3) {
|
|
667
733
|
return _loadSalesDetail.apply(this, arguments);
|
|
668
734
|
}
|
|
669
735
|
return loadSalesDetail;
|
|
@@ -671,52 +737,64 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
671
737
|
}, {
|
|
672
738
|
key: "scanPromotionCode",
|
|
673
739
|
value: function () {
|
|
674
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
740
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(code, customerId) {
|
|
675
741
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
676
|
-
return _regeneratorRuntime().wrap(function
|
|
677
|
-
while (1) switch (
|
|
742
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
743
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
678
744
|
case 0:
|
|
679
745
|
if (this.store.order) {
|
|
680
|
-
|
|
746
|
+
_context10.next = 2;
|
|
681
747
|
break;
|
|
682
748
|
}
|
|
683
749
|
throw new Error('order 模块未初始化');
|
|
684
750
|
case 2:
|
|
685
|
-
|
|
751
|
+
_context10.next = 4;
|
|
686
752
|
return this.store.order.scanCode(code, customerId);
|
|
687
753
|
case 4:
|
|
688
|
-
raw =
|
|
754
|
+
raw = _context10.sent;
|
|
689
755
|
scannedList = raw.scannedDiscountList || [];
|
|
690
756
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
691
757
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
692
758
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
693
759
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
694
|
-
|
|
760
|
+
_context10.next = 18;
|
|
695
761
|
break;
|
|
696
762
|
}
|
|
697
|
-
|
|
763
|
+
_context10.prev = 10;
|
|
764
|
+
_context10.next = 13;
|
|
698
765
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
699
|
-
case
|
|
766
|
+
case 13:
|
|
767
|
+
_context10.next = 18;
|
|
768
|
+
break;
|
|
769
|
+
case 15:
|
|
770
|
+
_context10.prev = 15;
|
|
771
|
+
_context10.t0 = _context10["catch"](10);
|
|
772
|
+
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
773
|
+
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
774
|
+
customerId: extractedCustomerId,
|
|
775
|
+
error: _context10.t0
|
|
776
|
+
});
|
|
777
|
+
case 18:
|
|
700
778
|
if (!raw.isAvailable) {
|
|
701
|
-
|
|
779
|
+
_context10.next = 25;
|
|
702
780
|
break;
|
|
703
781
|
}
|
|
704
|
-
|
|
782
|
+
_context10.next = 21;
|
|
705
783
|
return this.store.order.recalculateSummary({
|
|
706
784
|
createIfMissing: true
|
|
707
785
|
});
|
|
708
|
-
case
|
|
786
|
+
case 21:
|
|
709
787
|
this.store.order.persistTempOrder();
|
|
710
788
|
tempOrder = this.store.order.ensureTempOrder();
|
|
711
|
-
|
|
789
|
+
_context10.next = 25;
|
|
712
790
|
return this.effectsEmit('onDiscountApplied', {
|
|
713
791
|
productList: tempOrder.products || [],
|
|
714
792
|
discountList: this.store.order.getDiscountList(),
|
|
715
793
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
716
794
|
tempOrder: tempOrder
|
|
717
795
|
});
|
|
718
|
-
case
|
|
719
|
-
return
|
|
796
|
+
case 25:
|
|
797
|
+
return _context10.abrupt("return", _objectSpread(_objectSpread({
|
|
720
798
|
isAvailable: raw.isAvailable
|
|
721
799
|
}, raw.isAccepted !== undefined ? {
|
|
722
800
|
isAccepted: raw.isAccepted
|
|
@@ -725,13 +803,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
725
803
|
unavailableReason: raw.unavailableReason,
|
|
726
804
|
scannedDiscountList: raw.scannedDiscountList
|
|
727
805
|
}));
|
|
728
|
-
case
|
|
806
|
+
case 26:
|
|
729
807
|
case "end":
|
|
730
|
-
return
|
|
808
|
+
return _context10.stop();
|
|
731
809
|
}
|
|
732
|
-
},
|
|
810
|
+
}, _callee10, this, [[10, 15]]);
|
|
733
811
|
}));
|
|
734
|
-
function scanPromotionCode(
|
|
812
|
+
function scanPromotionCode(_x4, _x5) {
|
|
735
813
|
return _scanPromotionCode.apply(this, arguments);
|
|
736
814
|
}
|
|
737
815
|
return scanPromotionCode;
|
|
@@ -739,44 +817,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
739
817
|
}, {
|
|
740
818
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
741
819
|
value: function () {
|
|
742
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
820
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discounts) {
|
|
743
821
|
var currentOrderCustomer, customerId, customer;
|
|
744
|
-
return _regeneratorRuntime().wrap(function
|
|
745
|
-
while (1) switch (
|
|
822
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
823
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
746
824
|
case 0:
|
|
747
825
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
748
826
|
if (!currentOrderCustomer) {
|
|
749
|
-
|
|
827
|
+
_context11.next = 3;
|
|
750
828
|
break;
|
|
751
829
|
}
|
|
752
|
-
return
|
|
830
|
+
return _context11.abrupt("return");
|
|
753
831
|
case 3:
|
|
754
832
|
customerId = this.getDiscountCustomerId(discounts);
|
|
755
833
|
if (customerId) {
|
|
756
|
-
|
|
834
|
+
_context11.next = 6;
|
|
757
835
|
break;
|
|
758
836
|
}
|
|
759
|
-
return
|
|
837
|
+
return _context11.abrupt("return");
|
|
760
838
|
case 6:
|
|
761
|
-
|
|
839
|
+
_context11.next = 8;
|
|
762
840
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
763
841
|
case 8:
|
|
764
|
-
customer =
|
|
842
|
+
customer = _context11.sent;
|
|
765
843
|
if (customer) {
|
|
766
|
-
|
|
844
|
+
_context11.next = 11;
|
|
767
845
|
break;
|
|
768
846
|
}
|
|
769
|
-
return
|
|
847
|
+
return _context11.abrupt("return");
|
|
770
848
|
case 11:
|
|
771
849
|
this.store.customer.setSelectedCustomer(customer);
|
|
772
850
|
this.setOrderCustomer(customer);
|
|
773
851
|
case 13:
|
|
774
852
|
case "end":
|
|
775
|
-
return
|
|
853
|
+
return _context11.stop();
|
|
776
854
|
}
|
|
777
|
-
},
|
|
855
|
+
}, _callee11, this);
|
|
778
856
|
}));
|
|
779
|
-
function hydrateOrderCustomerFromScanDiscounts(
|
|
857
|
+
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
780
858
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
781
859
|
}
|
|
782
860
|
return hydrateOrderCustomerFromScanDiscounts;
|
|
@@ -810,57 +888,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
810
888
|
}, {
|
|
811
889
|
key: "resolveCustomerById",
|
|
812
890
|
value: function () {
|
|
813
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
814
|
-
var
|
|
815
|
-
var
|
|
816
|
-
return _regeneratorRuntime().wrap(function
|
|
817
|
-
while (1) switch (
|
|
891
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
|
|
892
|
+
var _this2 = this;
|
|
893
|
+
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
894
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
895
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
818
896
|
case 0:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
_context11.next = 5;
|
|
897
|
+
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
898
|
+
numericCustomerId = Number(rawCustomerId);
|
|
899
|
+
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
900
|
+
_context12.next = 4;
|
|
824
901
|
break;
|
|
825
902
|
}
|
|
826
|
-
return
|
|
827
|
-
case
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
num: 1
|
|
833
|
-
});
|
|
834
|
-
case 7:
|
|
835
|
-
result = _context11.sent;
|
|
836
|
-
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
837
|
-
if (!remoteCustomer) {
|
|
838
|
-
_context11.next = 11;
|
|
903
|
+
return _context12.abrupt("return", null);
|
|
904
|
+
case 4:
|
|
905
|
+
normalizedCustomerId = String(numericCustomerId);
|
|
906
|
+
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
907
|
+
if (!existingRequest) {
|
|
908
|
+
_context12.next = 8;
|
|
839
909
|
break;
|
|
840
910
|
}
|
|
841
|
-
return
|
|
842
|
-
case
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
911
|
+
return _context12.abrupt("return", existingRequest);
|
|
912
|
+
case 8:
|
|
913
|
+
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
914
|
+
with_franchisor_data: 1,
|
|
915
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord']
|
|
916
|
+
}).then(function (result) {
|
|
917
|
+
var customer = result === null || result === void 0 ? void 0 : result.data;
|
|
918
|
+
var resolvedCustomerId = Number(customer && _typeof(customer) === 'object' && !Array.isArray(customer) ? _this2.getRawCustomerId(customer) : NaN);
|
|
919
|
+
if ((result === null || result === void 0 ? void 0 : result.status) !== true || (result === null || result === void 0 ? void 0 : result.code) !== 200 || !customer || _typeof(customer) !== 'object' || Array.isArray(customer) || !Number.isInteger(resolvedCustomerId) || resolvedCustomerId <= 1) {
|
|
920
|
+
var error = new Error((result === null || result === void 0 ? void 0 : result.message) || 'Customer resolve failed');
|
|
921
|
+
error.code = result === null || result === void 0 ? void 0 : result.code;
|
|
922
|
+
throw error;
|
|
923
|
+
}
|
|
924
|
+
return _this2.normalizeCustomer(customer);
|
|
925
|
+
}).finally(function () {
|
|
926
|
+
if (_this2.customerResolveRequests.get(normalizedCustomerId) === request) {
|
|
927
|
+
_this2.customerResolveRequests.delete(normalizedCustomerId);
|
|
928
|
+
}
|
|
855
929
|
});
|
|
856
|
-
|
|
857
|
-
|
|
930
|
+
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
931
|
+
return _context12.abrupt("return", request);
|
|
932
|
+
case 11:
|
|
858
933
|
case "end":
|
|
859
|
-
return
|
|
934
|
+
return _context12.stop();
|
|
860
935
|
}
|
|
861
|
-
},
|
|
936
|
+
}, _callee12, this);
|
|
862
937
|
}));
|
|
863
|
-
function resolveCustomerById(
|
|
938
|
+
function resolveCustomerById(_x7) {
|
|
864
939
|
return _resolveCustomerById.apply(this, arguments);
|
|
865
940
|
}
|
|
866
941
|
return resolveCustomerById;
|
|
@@ -870,17 +945,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
870
945
|
value: function resolveCustomerByDiscountCustomerId(customerId) {
|
|
871
946
|
return this.resolveCustomerById(customerId);
|
|
872
947
|
}
|
|
873
|
-
}, {
|
|
874
|
-
key: "findCustomerById",
|
|
875
|
-
value: function findCustomerById() {
|
|
876
|
-
var _this2 = this;
|
|
877
|
-
var customers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
878
|
-
var customerId = arguments.length > 1 ? arguments[1] : undefined;
|
|
879
|
-
return customers.find(function (customer) {
|
|
880
|
-
var rawId = _this2.getRawCustomerId(customer);
|
|
881
|
-
return rawId !== null && String(rawId) === String(customerId);
|
|
882
|
-
}) || null;
|
|
883
|
-
}
|
|
884
948
|
}, {
|
|
885
949
|
key: "normalizeCustomer",
|
|
886
950
|
value: function normalizeCustomer(customer) {
|
|
@@ -903,11 +967,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
903
967
|
var raw = customer;
|
|
904
968
|
return (_ref9 = (_ref10 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref10 !== void 0 ? _ref10 : raw.customerId) !== null && _ref9 !== void 0 ? _ref9 : null;
|
|
905
969
|
}
|
|
906
|
-
}, {
|
|
907
|
-
key: "hasUsableCustomerDetails",
|
|
908
|
-
value: function hasUsableCustomerDetails(customer) {
|
|
909
|
-
return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
|
|
910
|
-
}
|
|
911
970
|
|
|
912
971
|
/**
|
|
913
972
|
* 更新当前预约的 appointment_status。
|
|
@@ -926,62 +985,62 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
926
985
|
}, {
|
|
927
986
|
key: "setBookingStatus",
|
|
928
987
|
value: (function () {
|
|
929
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
988
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(status) {
|
|
930
989
|
var _this$store$order2, _this$store$order2$ge;
|
|
931
990
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
932
|
-
return _regeneratorRuntime().wrap(function
|
|
933
|
-
while (1) switch (
|
|
991
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
992
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
934
993
|
case 0:
|
|
935
994
|
tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
|
|
936
995
|
if (tempOrder) {
|
|
937
|
-
|
|
996
|
+
_context13.next = 3;
|
|
938
997
|
break;
|
|
939
998
|
}
|
|
940
999
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
941
1000
|
case 3:
|
|
942
1001
|
orderId = tempOrder.order_id;
|
|
943
1002
|
if (!(orderId === undefined || orderId === null)) {
|
|
944
|
-
|
|
1003
|
+
_context13.next = 6;
|
|
945
1004
|
break;
|
|
946
1005
|
}
|
|
947
1006
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
948
1007
|
case 6:
|
|
949
1008
|
scheduleId = resolveScheduleId(tempOrder);
|
|
950
1009
|
if (!(scheduleId === null)) {
|
|
951
|
-
|
|
1010
|
+
_context13.next = 9;
|
|
952
1011
|
break;
|
|
953
1012
|
}
|
|
954
1013
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
955
1014
|
case 9:
|
|
956
1015
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
957
1016
|
previous = applyBookingsStatus(bookings, status);
|
|
958
|
-
|
|
959
|
-
|
|
1017
|
+
_context13.prev = 11;
|
|
1018
|
+
_context13.next = 14;
|
|
960
1019
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
961
1020
|
appointment_status: status
|
|
962
1021
|
});
|
|
963
1022
|
case 14:
|
|
964
|
-
res =
|
|
965
|
-
|
|
1023
|
+
res = _context13.sent;
|
|
1024
|
+
_context13.next = 17;
|
|
966
1025
|
return this.refreshSalesDetail();
|
|
967
1026
|
case 17:
|
|
968
1027
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
969
1028
|
orderId: orderId,
|
|
970
1029
|
status: status
|
|
971
1030
|
});
|
|
972
|
-
return
|
|
1031
|
+
return _context13.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
973
1032
|
case 21:
|
|
974
|
-
|
|
975
|
-
|
|
1033
|
+
_context13.prev = 21;
|
|
1034
|
+
_context13.t0 = _context13["catch"](11);
|
|
976
1035
|
restoreBookingsStatus(bookings, previous);
|
|
977
|
-
throw
|
|
1036
|
+
throw _context13.t0;
|
|
978
1037
|
case 25:
|
|
979
1038
|
case "end":
|
|
980
|
-
return
|
|
1039
|
+
return _context13.stop();
|
|
981
1040
|
}
|
|
982
|
-
},
|
|
1041
|
+
}, _callee13, this, [[11, 21]]);
|
|
983
1042
|
}));
|
|
984
|
-
function setBookingStatus(
|
|
1043
|
+
function setBookingStatus(_x8) {
|
|
985
1044
|
return _setBookingStatus.apply(this, arguments);
|
|
986
1045
|
}
|
|
987
1046
|
return setBookingStatus;
|
|
@@ -1010,35 +1069,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1010
1069
|
}, {
|
|
1011
1070
|
key: "transitionChildBooking",
|
|
1012
1071
|
value: (function () {
|
|
1013
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1072
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1014
1073
|
var _this$store$order3, _this$store$order3$ge;
|
|
1015
1074
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1016
|
-
return _regeneratorRuntime().wrap(function
|
|
1017
|
-
while (1) switch (
|
|
1075
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1076
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1018
1077
|
case 0:
|
|
1019
1078
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1020
1079
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1021
|
-
|
|
1080
|
+
_context14.next = 3;
|
|
1022
1081
|
break;
|
|
1023
1082
|
}
|
|
1024
1083
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1025
1084
|
case 3:
|
|
1026
1085
|
if (action) {
|
|
1027
|
-
|
|
1086
|
+
_context14.next = 5;
|
|
1028
1087
|
break;
|
|
1029
1088
|
}
|
|
1030
1089
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1031
1090
|
case 5:
|
|
1032
1091
|
tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
1033
1092
|
if (tempOrder) {
|
|
1034
|
-
|
|
1093
|
+
_context14.next = 8;
|
|
1035
1094
|
break;
|
|
1036
1095
|
}
|
|
1037
1096
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1038
1097
|
case 8:
|
|
1039
1098
|
orderId = tempOrder.order_id;
|
|
1040
1099
|
if (!(orderId === undefined || orderId === null)) {
|
|
1041
|
-
|
|
1100
|
+
_context14.next = 11;
|
|
1042
1101
|
break;
|
|
1043
1102
|
}
|
|
1044
1103
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1046,14 +1105,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1046
1105
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1047
1106
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1048
1107
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1049
|
-
|
|
1050
|
-
|
|
1108
|
+
_context14.prev = 14;
|
|
1109
|
+
_context14.next = 17;
|
|
1051
1110
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1052
1111
|
action: action
|
|
1053
1112
|
});
|
|
1054
1113
|
case 17:
|
|
1055
|
-
res =
|
|
1056
|
-
|
|
1114
|
+
res = _context14.sent;
|
|
1115
|
+
_context14.next = 20;
|
|
1057
1116
|
return this.refreshSalesDetail();
|
|
1058
1117
|
case 20:
|
|
1059
1118
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1062,21 +1121,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1062
1121
|
action: action,
|
|
1063
1122
|
status: targetStatus
|
|
1064
1123
|
});
|
|
1065
|
-
return
|
|
1124
|
+
return _context14.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1066
1125
|
case 24:
|
|
1067
|
-
|
|
1068
|
-
|
|
1126
|
+
_context14.prev = 24;
|
|
1127
|
+
_context14.t0 = _context14["catch"](14);
|
|
1069
1128
|
if (previous !== undefined) {
|
|
1070
1129
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1071
1130
|
}
|
|
1072
|
-
throw
|
|
1131
|
+
throw _context14.t0;
|
|
1073
1132
|
case 28:
|
|
1074
1133
|
case "end":
|
|
1075
|
-
return
|
|
1134
|
+
return _context14.stop();
|
|
1076
1135
|
}
|
|
1077
|
-
},
|
|
1136
|
+
}, _callee14, this, [[14, 24]]);
|
|
1078
1137
|
}));
|
|
1079
|
-
function transitionChildBooking(
|
|
1138
|
+
function transitionChildBooking(_x9) {
|
|
1080
1139
|
return _transitionChildBooking.apply(this, arguments);
|
|
1081
1140
|
}
|
|
1082
1141
|
return transitionChildBooking;
|
|
@@ -1095,19 +1154,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1095
1154
|
}, {
|
|
1096
1155
|
key: "refreshSalesDetail",
|
|
1097
1156
|
value: (function () {
|
|
1098
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1157
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1099
1158
|
var _this$store$order4, _this$store$order4$ge;
|
|
1100
1159
|
var params,
|
|
1101
1160
|
tempOrder,
|
|
1102
1161
|
orderId,
|
|
1103
|
-
|
|
1104
|
-
return _regeneratorRuntime().wrap(function
|
|
1105
|
-
while (1) switch (
|
|
1162
|
+
_args15 = arguments;
|
|
1163
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1164
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1106
1165
|
case 0:
|
|
1107
|
-
params =
|
|
1166
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
1108
1167
|
tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
|
|
1109
1168
|
if (tempOrder) {
|
|
1110
|
-
|
|
1169
|
+
_context15.next = 4;
|
|
1111
1170
|
break;
|
|
1112
1171
|
}
|
|
1113
1172
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1115,21 +1174,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1115
1174
|
debugger;
|
|
1116
1175
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1117
1176
|
if (!(orderId === undefined || orderId === null)) {
|
|
1118
|
-
|
|
1177
|
+
_context15.next = 8;
|
|
1119
1178
|
break;
|
|
1120
1179
|
}
|
|
1121
|
-
return
|
|
1180
|
+
return _context15.abrupt("return", {});
|
|
1122
1181
|
case 8:
|
|
1123
|
-
return
|
|
1182
|
+
return _context15.abrupt("return", this.loadSalesDetail({
|
|
1124
1183
|
orderId: orderId,
|
|
1125
1184
|
// merge: true
|
|
1126
1185
|
forceRemote: params.forceRemote
|
|
1127
1186
|
}));
|
|
1128
1187
|
case 9:
|
|
1129
1188
|
case "end":
|
|
1130
|
-
return
|
|
1189
|
+
return _context15.stop();
|
|
1131
1190
|
}
|
|
1132
|
-
},
|
|
1191
|
+
}, _callee15, this);
|
|
1133
1192
|
}));
|
|
1134
1193
|
function refreshSalesDetail() {
|
|
1135
1194
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1145,7 +1204,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1145
1204
|
}, {
|
|
1146
1205
|
key: "loadProducts",
|
|
1147
1206
|
value: (function () {
|
|
1148
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1207
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1149
1208
|
var params,
|
|
1150
1209
|
options,
|
|
1151
1210
|
schedule_date,
|
|
@@ -1154,20 +1213,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1154
1213
|
schedule_datetime,
|
|
1155
1214
|
bookingDate,
|
|
1156
1215
|
_result,
|
|
1157
|
-
|
|
1158
|
-
return _regeneratorRuntime().wrap(function
|
|
1159
|
-
while (1) switch (
|
|
1216
|
+
_args16 = arguments;
|
|
1217
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1218
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1160
1219
|
case 0:
|
|
1161
|
-
params =
|
|
1162
|
-
options =
|
|
1220
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
1221
|
+
options = _args16.length > 1 ? _args16[1] : undefined;
|
|
1163
1222
|
schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
|
|
1164
1223
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1165
1224
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1166
1225
|
if (bookingDate) {
|
|
1167
1226
|
this.setBookingDate(bookingDate);
|
|
1168
1227
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1228
|
+
_context16.prev = 5;
|
|
1229
|
+
_context16.next = 8;
|
|
1171
1230
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1172
1231
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1173
1232
|
with_schedule: 1
|
|
@@ -1175,20 +1234,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1175
1234
|
cacheId: this.cacheId
|
|
1176
1235
|
}), options);
|
|
1177
1236
|
case 8:
|
|
1178
|
-
_result =
|
|
1237
|
+
_result = _context16.sent;
|
|
1179
1238
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1180
1239
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1181
|
-
return
|
|
1240
|
+
return _context16.abrupt("return", _result);
|
|
1182
1241
|
case 14:
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
console.error('Failed to load products:',
|
|
1186
|
-
throw
|
|
1242
|
+
_context16.prev = 14;
|
|
1243
|
+
_context16.t0 = _context16["catch"](5);
|
|
1244
|
+
console.error('Failed to load products:', _context16.t0);
|
|
1245
|
+
throw _context16.t0;
|
|
1187
1246
|
case 18:
|
|
1188
1247
|
case "end":
|
|
1189
|
-
return
|
|
1248
|
+
return _context16.stop();
|
|
1190
1249
|
}
|
|
1191
|
-
},
|
|
1250
|
+
}, _callee16, this, [[5, 14]]);
|
|
1192
1251
|
}));
|
|
1193
1252
|
function loadProducts() {
|
|
1194
1253
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1205,27 +1264,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1205
1264
|
}, {
|
|
1206
1265
|
key: "getAddTimeProducts",
|
|
1207
1266
|
value: (function () {
|
|
1208
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1267
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1209
1268
|
var params,
|
|
1210
1269
|
result,
|
|
1211
|
-
|
|
1212
|
-
return _regeneratorRuntime().wrap(function
|
|
1213
|
-
while (1) switch (
|
|
1270
|
+
_args17 = arguments;
|
|
1271
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1272
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1214
1273
|
case 0:
|
|
1215
|
-
params =
|
|
1216
|
-
|
|
1274
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1275
|
+
_context17.next = 3;
|
|
1217
1276
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1218
1277
|
cacheId: this.cacheId
|
|
1219
1278
|
}));
|
|
1220
1279
|
case 3:
|
|
1221
|
-
result =
|
|
1280
|
+
result = _context17.sent;
|
|
1222
1281
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1223
|
-
return
|
|
1282
|
+
return _context17.abrupt("return", result);
|
|
1224
1283
|
case 6:
|
|
1225
1284
|
case "end":
|
|
1226
|
-
return
|
|
1285
|
+
return _context17.stop();
|
|
1227
1286
|
}
|
|
1228
|
-
},
|
|
1287
|
+
}, _callee17, this);
|
|
1229
1288
|
}));
|
|
1230
1289
|
function getAddTimeProducts() {
|
|
1231
1290
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1250,14 +1309,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1250
1309
|
}, {
|
|
1251
1310
|
key: "queryProductDetail",
|
|
1252
1311
|
value: (function () {
|
|
1253
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1312
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
|
|
1254
1313
|
var product_id, queryParams, _result2, list;
|
|
1255
|
-
return _regeneratorRuntime().wrap(function
|
|
1256
|
-
while (1) switch (
|
|
1314
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1315
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1257
1316
|
case 0:
|
|
1258
1317
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1259
|
-
|
|
1260
|
-
|
|
1318
|
+
_context18.prev = 1;
|
|
1319
|
+
_context18.next = 4;
|
|
1261
1320
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1262
1321
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1263
1322
|
with_schedule: 1
|
|
@@ -1266,23 +1325,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1266
1325
|
cacheId: this.cacheId
|
|
1267
1326
|
}), options);
|
|
1268
1327
|
case 4:
|
|
1269
|
-
_result2 =
|
|
1328
|
+
_result2 = _context18.sent;
|
|
1270
1329
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1271
|
-
return
|
|
1330
|
+
return _context18.abrupt("return", list.find(function (product) {
|
|
1272
1331
|
return Number(product.id) === Number(product_id);
|
|
1273
1332
|
}));
|
|
1274
1333
|
case 9:
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
console.error('Failed to query product detail:',
|
|
1278
|
-
throw
|
|
1334
|
+
_context18.prev = 9;
|
|
1335
|
+
_context18.t0 = _context18["catch"](1);
|
|
1336
|
+
console.error('Failed to query product detail:', _context18.t0);
|
|
1337
|
+
throw _context18.t0;
|
|
1279
1338
|
case 13:
|
|
1280
1339
|
case "end":
|
|
1281
|
-
return
|
|
1340
|
+
return _context18.stop();
|
|
1282
1341
|
}
|
|
1283
|
-
},
|
|
1342
|
+
}, _callee18, this, [[1, 9]]);
|
|
1284
1343
|
}));
|
|
1285
|
-
function queryProductDetail(
|
|
1344
|
+
function queryProductDetail(_x10, _x11) {
|
|
1286
1345
|
return _queryProductDetail.apply(this, arguments);
|
|
1287
1346
|
}
|
|
1288
1347
|
return queryProductDetail;
|
|
@@ -1295,28 +1354,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1295
1354
|
}, {
|
|
1296
1355
|
key: "loadProductDetail",
|
|
1297
1356
|
value: (function () {
|
|
1298
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1357
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
|
|
1299
1358
|
var product_id, queryParams, products;
|
|
1300
|
-
return _regeneratorRuntime().wrap(function
|
|
1301
|
-
while (1) switch (
|
|
1359
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1360
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1302
1361
|
case 0:
|
|
1303
1362
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1304
|
-
|
|
1363
|
+
_context19.next = 3;
|
|
1305
1364
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1306
1365
|
product_ids: [product_id]
|
|
1307
1366
|
}), options);
|
|
1308
1367
|
case 3:
|
|
1309
|
-
products =
|
|
1310
|
-
return
|
|
1368
|
+
products = _context19.sent;
|
|
1369
|
+
return _context19.abrupt("return", products.find(function (product) {
|
|
1311
1370
|
return Number(product.id) === Number(product_id);
|
|
1312
1371
|
}));
|
|
1313
1372
|
case 5:
|
|
1314
1373
|
case "end":
|
|
1315
|
-
return
|
|
1374
|
+
return _context19.stop();
|
|
1316
1375
|
}
|
|
1317
|
-
},
|
|
1376
|
+
}, _callee19, this);
|
|
1318
1377
|
}));
|
|
1319
|
-
function loadProductDetail(
|
|
1378
|
+
function loadProductDetail(_x12, _x13) {
|
|
1320
1379
|
return _loadProductDetail.apply(this, arguments);
|
|
1321
1380
|
}
|
|
1322
1381
|
return loadProductDetail;
|
|
@@ -1349,16 +1408,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1349
1408
|
}, {
|
|
1350
1409
|
key: "getProducts",
|
|
1351
1410
|
value: (function () {
|
|
1352
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1353
|
-
return _regeneratorRuntime().wrap(function
|
|
1354
|
-
while (1) switch (
|
|
1411
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1412
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1413
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1355
1414
|
case 0:
|
|
1356
|
-
return
|
|
1415
|
+
return _context20.abrupt("return", this.store.products.getProducts());
|
|
1357
1416
|
case 1:
|
|
1358
1417
|
case "end":
|
|
1359
|
-
return
|
|
1418
|
+
return _context20.stop();
|
|
1360
1419
|
}
|
|
1361
|
-
},
|
|
1420
|
+
}, _callee20, this);
|
|
1362
1421
|
}));
|
|
1363
1422
|
function getProducts() {
|
|
1364
1423
|
return _getProducts.apply(this, arguments);
|
|
@@ -1388,8 +1447,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1388
1447
|
}, {
|
|
1389
1448
|
key: "getCart",
|
|
1390
1449
|
value: function getCart() {
|
|
1391
|
-
var _this$store$order$
|
|
1392
|
-
var tempOrder = (_this$store$order$
|
|
1450
|
+
var _this$store$order$get2, _this$store$order5, _salesDetail$bookings, _operatingDayBoundary, _operatingDayBoundary2, _tempOrder$_extend;
|
|
1451
|
+
var tempOrder = (_this$store$order$get2 = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
|
|
1393
1452
|
var salesDetail = this.getSalesOrder();
|
|
1394
1453
|
var bookings = (_salesDetail$bookings = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) !== null && _salesDetail$bookings !== void 0 ? _salesDetail$bookings : (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
|
|
1395
1454
|
var operatingDayBoundary;
|
|
@@ -1423,33 +1482,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1423
1482
|
}, {
|
|
1424
1483
|
key: "getProductByIds",
|
|
1425
1484
|
value: (function () {
|
|
1426
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1485
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(ids, options) {
|
|
1427
1486
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1428
1487
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1429
|
-
return _regeneratorRuntime().wrap(function
|
|
1430
|
-
while (1) switch (
|
|
1488
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1489
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1431
1490
|
case 0:
|
|
1432
1491
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1433
1492
|
return Number(id);
|
|
1434
1493
|
}).filter(function (id) {
|
|
1435
1494
|
return Number.isFinite(id);
|
|
1436
1495
|
})));
|
|
1437
|
-
|
|
1496
|
+
_context21.next = 3;
|
|
1438
1497
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1439
1498
|
case 3:
|
|
1440
|
-
|
|
1441
|
-
if (
|
|
1442
|
-
|
|
1499
|
+
_context21.t0 = _context21.sent;
|
|
1500
|
+
if (_context21.t0) {
|
|
1501
|
+
_context21.next = 6;
|
|
1443
1502
|
break;
|
|
1444
1503
|
}
|
|
1445
|
-
|
|
1504
|
+
_context21.t0 = [];
|
|
1446
1505
|
case 6:
|
|
1447
|
-
localProducts =
|
|
1506
|
+
localProducts = _context21.t0;
|
|
1448
1507
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1449
|
-
|
|
1508
|
+
_context21.next = 9;
|
|
1450
1509
|
break;
|
|
1451
1510
|
}
|
|
1452
|
-
return
|
|
1511
|
+
return _context21.abrupt("return", localProducts);
|
|
1453
1512
|
case 9:
|
|
1454
1513
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1455
1514
|
return Number(product.id);
|
|
@@ -1458,15 +1517,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1458
1517
|
return !localProductIds.has(id);
|
|
1459
1518
|
});
|
|
1460
1519
|
if (missingIds.length) {
|
|
1461
|
-
|
|
1520
|
+
_context21.next = 13;
|
|
1462
1521
|
break;
|
|
1463
1522
|
}
|
|
1464
|
-
return
|
|
1523
|
+
return _context21.abrupt("return", localProducts);
|
|
1465
1524
|
case 13:
|
|
1466
1525
|
rawBookingDate = this.getBookingDate();
|
|
1467
1526
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1468
1527
|
customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
|
|
1469
|
-
|
|
1528
|
+
_context21.next = 18;
|
|
1470
1529
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1471
1530
|
product_ids: missingIds,
|
|
1472
1531
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1479,7 +1538,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1479
1538
|
customer_id: customerId
|
|
1480
1539
|
} : {}));
|
|
1481
1540
|
case 18:
|
|
1482
|
-
loadedProducts =
|
|
1541
|
+
loadedProducts = _context21.sent;
|
|
1483
1542
|
productById = new Map();
|
|
1484
1543
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1485
1544
|
var productId = Number(product.id);
|
|
@@ -1487,18 +1546,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1487
1546
|
productById.set(productId, product);
|
|
1488
1547
|
}
|
|
1489
1548
|
});
|
|
1490
|
-
return
|
|
1549
|
+
return _context21.abrupt("return", normalizedIds.map(function (id) {
|
|
1491
1550
|
return productById.get(id);
|
|
1492
1551
|
}).filter(function (product) {
|
|
1493
1552
|
return Boolean(product);
|
|
1494
1553
|
}));
|
|
1495
1554
|
case 22:
|
|
1496
1555
|
case "end":
|
|
1497
|
-
return
|
|
1556
|
+
return _context21.stop();
|
|
1498
1557
|
}
|
|
1499
|
-
},
|
|
1558
|
+
}, _callee21, this);
|
|
1500
1559
|
}));
|
|
1501
|
-
function getProductByIds(
|
|
1560
|
+
function getProductByIds(_x14, _x15) {
|
|
1502
1561
|
return _getProductByIds.apply(this, arguments);
|
|
1503
1562
|
}
|
|
1504
1563
|
return getProductByIds;
|
|
@@ -1512,27 +1571,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1512
1571
|
}, {
|
|
1513
1572
|
key: "getScheduleTimePoints",
|
|
1514
1573
|
value: (function () {
|
|
1515
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1574
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1516
1575
|
var result;
|
|
1517
|
-
return _regeneratorRuntime().wrap(function
|
|
1518
|
-
while (1) switch (
|
|
1576
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1577
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1519
1578
|
case 0:
|
|
1520
|
-
|
|
1579
|
+
_context22.next = 2;
|
|
1521
1580
|
return this.request.post('/menu/schedule-time-points', {
|
|
1522
1581
|
menu_list_ids: params.menu_list_ids
|
|
1523
1582
|
}, {
|
|
1524
1583
|
osServer: true
|
|
1525
1584
|
});
|
|
1526
1585
|
case 2:
|
|
1527
|
-
result =
|
|
1528
|
-
return
|
|
1586
|
+
result = _context22.sent;
|
|
1587
|
+
return _context22.abrupt("return", result.data || []);
|
|
1529
1588
|
case 4:
|
|
1530
1589
|
case "end":
|
|
1531
|
-
return
|
|
1590
|
+
return _context22.stop();
|
|
1532
1591
|
}
|
|
1533
|
-
},
|
|
1592
|
+
}, _callee22, this);
|
|
1534
1593
|
}));
|
|
1535
|
-
function getScheduleTimePoints(
|
|
1594
|
+
function getScheduleTimePoints(_x16) {
|
|
1536
1595
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
1537
1596
|
}
|
|
1538
1597
|
return getScheduleTimePoints;
|
|
@@ -1546,30 +1605,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1546
1605
|
}, {
|
|
1547
1606
|
key: "getCustomerList",
|
|
1548
1607
|
value: (function () {
|
|
1549
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1608
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1550
1609
|
var params,
|
|
1551
1610
|
_result3,
|
|
1552
|
-
|
|
1553
|
-
return _regeneratorRuntime().wrap(function
|
|
1554
|
-
while (1) switch (
|
|
1611
|
+
_args23 = arguments;
|
|
1612
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1613
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1555
1614
|
case 0:
|
|
1556
|
-
params =
|
|
1557
|
-
|
|
1558
|
-
|
|
1615
|
+
params = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
1616
|
+
_context23.prev = 1;
|
|
1617
|
+
_context23.next = 4;
|
|
1559
1618
|
return this.store.customer.getCustomerList(params);
|
|
1560
1619
|
case 4:
|
|
1561
|
-
_result3 =
|
|
1562
|
-
return
|
|
1620
|
+
_result3 = _context23.sent;
|
|
1621
|
+
return _context23.abrupt("return", _result3);
|
|
1563
1622
|
case 8:
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
console.error('Failed to get customer list:',
|
|
1567
|
-
throw
|
|
1623
|
+
_context23.prev = 8;
|
|
1624
|
+
_context23.t0 = _context23["catch"](1);
|
|
1625
|
+
console.error('Failed to get customer list:', _context23.t0);
|
|
1626
|
+
throw _context23.t0;
|
|
1568
1627
|
case 12:
|
|
1569
1628
|
case "end":
|
|
1570
|
-
return
|
|
1629
|
+
return _context23.stop();
|
|
1571
1630
|
}
|
|
1572
|
-
},
|
|
1631
|
+
}, _callee23, this, [[1, 8]]);
|
|
1573
1632
|
}));
|
|
1574
1633
|
function getCustomerList() {
|
|
1575
1634
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1676,13 +1735,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1676
1735
|
}, {
|
|
1677
1736
|
key: "setOrderCustomer",
|
|
1678
1737
|
value: function setOrderCustomer(customer, options) {
|
|
1679
|
-
var _this$store$order$
|
|
1738
|
+
var _this$store$order$get3,
|
|
1680
1739
|
_this3 = this;
|
|
1681
1740
|
if (!customer) {
|
|
1682
1741
|
this.clearOrderCustomer();
|
|
1683
1742
|
return;
|
|
1684
1743
|
}
|
|
1685
|
-
var previousCustomerId = (_this$store$order$
|
|
1744
|
+
var previousCustomerId = (_this$store$order$get3 = this.store.order.getOrderCustomer()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id;
|
|
1686
1745
|
var snapshotBeforeSet = this.store.order.getOrderCustomerSnapshot();
|
|
1687
1746
|
var patch = formatOrderCustomerPatch(customer);
|
|
1688
1747
|
var customerUnchanged = Number(previousCustomerId || 0) === Number(patch.customer_id || 0);
|
|
@@ -1789,24 +1848,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1789
1848
|
}, {
|
|
1790
1849
|
key: "restoreOrder",
|
|
1791
1850
|
value: (function () {
|
|
1792
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1851
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1793
1852
|
var _this$store$customer;
|
|
1794
1853
|
var tempOrder;
|
|
1795
|
-
return _regeneratorRuntime().wrap(function
|
|
1796
|
-
while (1) switch (
|
|
1854
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1855
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1797
1856
|
case 0:
|
|
1798
|
-
|
|
1857
|
+
_context24.next = 2;
|
|
1799
1858
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1800
1859
|
case 2:
|
|
1801
|
-
tempOrder =
|
|
1860
|
+
tempOrder = _context24.sent;
|
|
1802
1861
|
this.clearOrderCustomer();
|
|
1803
1862
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1804
|
-
return
|
|
1863
|
+
return _context24.abrupt("return", tempOrder);
|
|
1805
1864
|
case 6:
|
|
1806
1865
|
case "end":
|
|
1807
|
-
return
|
|
1866
|
+
return _context24.stop();
|
|
1808
1867
|
}
|
|
1809
|
-
},
|
|
1868
|
+
}, _callee24, this);
|
|
1810
1869
|
}));
|
|
1811
1870
|
function restoreOrder() {
|
|
1812
1871
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1826,56 +1885,76 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1826
1885
|
}, {
|
|
1827
1886
|
key: "refreshDiscountConfigAfterOrderCustomerChange",
|
|
1828
1887
|
value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
|
|
1829
|
-
var
|
|
1888
|
+
var _this$store$order$get4,
|
|
1889
|
+
_this$store$order6,
|
|
1890
|
+
_this$getOrderIdentit,
|
|
1891
|
+
_this5 = this;
|
|
1830
1892
|
if (!customerId || customerId === 1) return Promise.resolve();
|
|
1831
|
-
|
|
1893
|
+
var tempOrder = (_this$store$order$get4 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.call(_this$store$order6);
|
|
1894
|
+
var orderIdentity = (_this$getOrderIdentit = this.getOrderIdentity) === null || _this$getOrderIdentit === void 0 ? void 0 : _this$getOrderIdentit.call(this);
|
|
1895
|
+
var orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.orderId);
|
|
1896
|
+
var action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1897
|
+
var orderTarget = orderId ? "order:".concat(String(orderId)) : "external:".concat(String((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.externalSaleNumber) || (orderIdentity === null || orderIdentity === void 0 ? void 0 : orderIdentity.localId) || 'new'));
|
|
1898
|
+
var refreshTarget = "".concat(customerId, ":").concat(action, ":").concat(orderTarget);
|
|
1899
|
+
if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshTarget === refreshTarget) {
|
|
1832
1900
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1833
1901
|
}
|
|
1834
1902
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1835
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1903
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1836
1904
|
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1837
|
-
var currentCustomer,
|
|
1838
|
-
return _regeneratorRuntime().wrap(function
|
|
1839
|
-
while (1) switch (
|
|
1905
|
+
var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
|
|
1906
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1907
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1840
1908
|
case 0:
|
|
1841
1909
|
if (!previousRefresh) {
|
|
1842
|
-
|
|
1910
|
+
_context25.next = 3;
|
|
1843
1911
|
break;
|
|
1844
1912
|
}
|
|
1845
|
-
|
|
1913
|
+
_context25.next = 3;
|
|
1846
1914
|
return previousRefresh.catch(function () {
|
|
1847
1915
|
return undefined;
|
|
1848
1916
|
});
|
|
1849
1917
|
case 3:
|
|
1850
1918
|
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1851
1919
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1852
|
-
|
|
1920
|
+
_context25.next = 6;
|
|
1853
1921
|
break;
|
|
1854
1922
|
}
|
|
1855
|
-
return
|
|
1923
|
+
return _context25.abrupt("return");
|
|
1856
1924
|
case 6:
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1925
|
+
currentTempOrder = (_this5$store$order$ge = (_this5$store$order = _this5.store.order).getTempOrder) === null || _this5$store$order$ge === void 0 ? void 0 : _this5$store$order$ge.call(_this5$store$order);
|
|
1926
|
+
currentOrderIdentity = (_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.call(_this5);
|
|
1927
|
+
currentOrderId = (currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.order_id) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.orderId);
|
|
1928
|
+
currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1929
|
+
currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
|
|
1930
|
+
if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
|
|
1931
|
+
_context25.next = 13;
|
|
1932
|
+
break;
|
|
1933
|
+
}
|
|
1934
|
+
return _context25.abrupt("return");
|
|
1935
|
+
case 13:
|
|
1936
|
+
_context25.next = 15;
|
|
1861
1937
|
return _this5.loadDiscountConfig({
|
|
1862
1938
|
customerId: customerId,
|
|
1863
|
-
action: action
|
|
1939
|
+
action: action,
|
|
1940
|
+
force: true
|
|
1864
1941
|
});
|
|
1865
|
-
case
|
|
1942
|
+
case 15:
|
|
1866
1943
|
case "end":
|
|
1867
|
-
return
|
|
1944
|
+
return _context25.stop();
|
|
1868
1945
|
}
|
|
1869
|
-
},
|
|
1946
|
+
}, _callee25);
|
|
1870
1947
|
}))();
|
|
1871
1948
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1872
1949
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
1950
|
+
this.orderCustomerDiscountRefreshTarget = refreshTarget;
|
|
1873
1951
|
refreshTask.catch(function (error) {
|
|
1874
1952
|
console.error('Failed to load discount config after customer change:', error);
|
|
1875
1953
|
}).finally(function () {
|
|
1876
1954
|
if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
|
|
1877
1955
|
_this5.orderCustomerDiscountRefreshInFlight = null;
|
|
1878
1956
|
_this5.orderCustomerDiscountRefreshCustomerId = null;
|
|
1957
|
+
_this5.orderCustomerDiscountRefreshTarget = null;
|
|
1879
1958
|
});
|
|
1880
1959
|
return refreshTask;
|
|
1881
1960
|
}
|
|
@@ -1887,30 +1966,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1887
1966
|
}, {
|
|
1888
1967
|
key: "prepareProductPriceQueryContext",
|
|
1889
1968
|
value: function () {
|
|
1890
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1969
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(customerId) {
|
|
1891
1970
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1892
|
-
return _regeneratorRuntime().wrap(function
|
|
1893
|
-
while (1) switch (
|
|
1971
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1972
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1894
1973
|
case 0:
|
|
1895
|
-
|
|
1974
|
+
_context26.next = 2;
|
|
1896
1975
|
return Promise.resolve();
|
|
1897
1976
|
case 2:
|
|
1898
1977
|
normalizedCustomerId = Number(customerId || 0);
|
|
1899
1978
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1900
1979
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1901
1980
|
if (!(shouldWait && refreshTask)) {
|
|
1902
|
-
|
|
1981
|
+
_context26.next = 8;
|
|
1903
1982
|
break;
|
|
1904
1983
|
}
|
|
1905
|
-
|
|
1984
|
+
_context26.next = 8;
|
|
1906
1985
|
return refreshTask;
|
|
1907
1986
|
case 8:
|
|
1908
1987
|
case "end":
|
|
1909
|
-
return
|
|
1988
|
+
return _context26.stop();
|
|
1910
1989
|
}
|
|
1911
|
-
},
|
|
1990
|
+
}, _callee26, this);
|
|
1912
1991
|
}));
|
|
1913
|
-
function prepareProductPriceQueryContext(
|
|
1992
|
+
function prepareProductPriceQueryContext(_x17) {
|
|
1914
1993
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
1915
1994
|
}
|
|
1916
1995
|
return prepareProductPriceQueryContext;
|
|
@@ -1963,29 +2042,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1963
2042
|
}, {
|
|
1964
2043
|
key: "changeCustomerPage",
|
|
1965
2044
|
value: (function () {
|
|
1966
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2045
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(page, pageSize) {
|
|
1967
2046
|
var _result4;
|
|
1968
|
-
return _regeneratorRuntime().wrap(function
|
|
1969
|
-
while (1) switch (
|
|
2047
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2048
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1970
2049
|
case 0:
|
|
1971
|
-
|
|
1972
|
-
|
|
2050
|
+
_context27.prev = 0;
|
|
2051
|
+
_context27.next = 3;
|
|
1973
2052
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
1974
2053
|
case 3:
|
|
1975
|
-
_result4 =
|
|
1976
|
-
return
|
|
2054
|
+
_result4 = _context27.sent;
|
|
2055
|
+
return _context27.abrupt("return", _result4);
|
|
1977
2056
|
case 7:
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
console.error('Failed to change customer page:',
|
|
1981
|
-
throw
|
|
2057
|
+
_context27.prev = 7;
|
|
2058
|
+
_context27.t0 = _context27["catch"](0);
|
|
2059
|
+
console.error('Failed to change customer page:', _context27.t0);
|
|
2060
|
+
throw _context27.t0;
|
|
1982
2061
|
case 11:
|
|
1983
2062
|
case "end":
|
|
1984
|
-
return
|
|
2063
|
+
return _context27.stop();
|
|
1985
2064
|
}
|
|
1986
|
-
},
|
|
2065
|
+
}, _callee27, this, [[0, 7]]);
|
|
1987
2066
|
}));
|
|
1988
|
-
function changeCustomerPage(
|
|
2067
|
+
function changeCustomerPage(_x18, _x19) {
|
|
1989
2068
|
return _changeCustomerPage.apply(this, arguments);
|
|
1990
2069
|
}
|
|
1991
2070
|
return changeCustomerPage;
|
|
@@ -1998,28 +2077,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1998
2077
|
}, {
|
|
1999
2078
|
key: "loadMoreCustomers",
|
|
2000
2079
|
value: (function () {
|
|
2001
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2080
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2002
2081
|
var _result5;
|
|
2003
|
-
return _regeneratorRuntime().wrap(function
|
|
2004
|
-
while (1) switch (
|
|
2082
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2083
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2005
2084
|
case 0:
|
|
2006
|
-
|
|
2007
|
-
|
|
2085
|
+
_context28.prev = 0;
|
|
2086
|
+
_context28.next = 3;
|
|
2008
2087
|
return this.store.customer.loadMoreCustomers();
|
|
2009
2088
|
case 3:
|
|
2010
|
-
_result5 =
|
|
2089
|
+
_result5 = _context28.sent;
|
|
2011
2090
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
2012
|
-
return
|
|
2091
|
+
return _context28.abrupt("return", _result5);
|
|
2013
2092
|
case 8:
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
console.error('Failed to load more customers:',
|
|
2017
|
-
throw
|
|
2093
|
+
_context28.prev = 8;
|
|
2094
|
+
_context28.t0 = _context28["catch"](0);
|
|
2095
|
+
console.error('Failed to load more customers:', _context28.t0);
|
|
2096
|
+
throw _context28.t0;
|
|
2018
2097
|
case 12:
|
|
2019
2098
|
case "end":
|
|
2020
|
-
return
|
|
2099
|
+
return _context28.stop();
|
|
2021
2100
|
}
|
|
2022
|
-
},
|
|
2101
|
+
}, _callee28, this, [[0, 8]]);
|
|
2023
2102
|
}));
|
|
2024
2103
|
function loadMoreCustomers() {
|
|
2025
2104
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2035,31 +2114,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2035
2114
|
}, {
|
|
2036
2115
|
key: "resetAndLoadCustomers",
|
|
2037
2116
|
value: (function () {
|
|
2038
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2117
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2039
2118
|
var params,
|
|
2040
2119
|
_result6,
|
|
2041
|
-
|
|
2042
|
-
return _regeneratorRuntime().wrap(function
|
|
2043
|
-
while (1) switch (
|
|
2120
|
+
_args29 = arguments;
|
|
2121
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2122
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2044
2123
|
case 0:
|
|
2045
|
-
params =
|
|
2046
|
-
|
|
2047
|
-
|
|
2124
|
+
params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
|
|
2125
|
+
_context29.prev = 1;
|
|
2126
|
+
_context29.next = 4;
|
|
2048
2127
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2049
2128
|
case 4:
|
|
2050
|
-
_result6 =
|
|
2129
|
+
_result6 = _context29.sent;
|
|
2051
2130
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
2052
|
-
return
|
|
2131
|
+
return _context29.abrupt("return", _result6);
|
|
2053
2132
|
case 9:
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
console.error('Failed to reset and load customers:',
|
|
2057
|
-
throw
|
|
2133
|
+
_context29.prev = 9;
|
|
2134
|
+
_context29.t0 = _context29["catch"](1);
|
|
2135
|
+
console.error('Failed to reset and load customers:', _context29.t0);
|
|
2136
|
+
throw _context29.t0;
|
|
2058
2137
|
case 13:
|
|
2059
2138
|
case "end":
|
|
2060
|
-
return
|
|
2139
|
+
return _context29.stop();
|
|
2061
2140
|
}
|
|
2062
|
-
},
|
|
2141
|
+
}, _callee29, this, [[1, 9]]);
|
|
2063
2142
|
}));
|
|
2064
2143
|
function resetAndLoadCustomers() {
|
|
2065
2144
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2220,16 +2299,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2220
2299
|
}, {
|
|
2221
2300
|
key: "getOtherParams",
|
|
2222
2301
|
value: (function () {
|
|
2223
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2224
|
-
return _regeneratorRuntime().wrap(function
|
|
2225
|
-
while (1) switch (
|
|
2302
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2303
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2304
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2226
2305
|
case 0:
|
|
2227
|
-
return
|
|
2306
|
+
return _context30.abrupt("return", this.otherParams);
|
|
2228
2307
|
case 1:
|
|
2229
2308
|
case "end":
|
|
2230
|
-
return
|
|
2309
|
+
return _context30.stop();
|
|
2231
2310
|
}
|
|
2232
|
-
},
|
|
2311
|
+
}, _callee30, this);
|
|
2233
2312
|
}));
|
|
2234
2313
|
function getOtherParams() {
|
|
2235
2314
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2439,10 +2518,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2439
2518
|
}, {
|
|
2440
2519
|
key: "buildAddProductCtx",
|
|
2441
2520
|
value: function buildAddProductCtx(extra) {
|
|
2442
|
-
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$
|
|
2521
|
+
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
|
|
2443
2522
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2444
2523
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2445
|
-
var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$
|
|
2524
|
+
var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2446
2525
|
return _objectSpread(_objectSpread({
|
|
2447
2526
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2448
2527
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2550,18 +2629,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2550
2629
|
}, {
|
|
2551
2630
|
key: "updateProductInOrder",
|
|
2552
2631
|
value: (function () {
|
|
2553
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2554
|
-
return _regeneratorRuntime().wrap(function
|
|
2555
|
-
while (1) switch (
|
|
2632
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2633
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2634
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2556
2635
|
case 0:
|
|
2557
|
-
return
|
|
2636
|
+
return _context31.abrupt("return", this.updateOrderProduct(params));
|
|
2558
2637
|
case 1:
|
|
2559
2638
|
case "end":
|
|
2560
|
-
return
|
|
2639
|
+
return _context31.stop();
|
|
2561
2640
|
}
|
|
2562
|
-
},
|
|
2641
|
+
}, _callee31, this);
|
|
2563
2642
|
}));
|
|
2564
|
-
function updateProductInOrder(
|
|
2643
|
+
function updateProductInOrder(_x20) {
|
|
2565
2644
|
return _updateProductInOrder.apply(this, arguments);
|
|
2566
2645
|
}
|
|
2567
2646
|
return updateProductInOrder;
|
|
@@ -2583,47 +2662,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2583
2662
|
}, {
|
|
2584
2663
|
key: "handleGlobalScanCode",
|
|
2585
2664
|
value: (function () {
|
|
2586
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2665
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, bridge) {
|
|
2587
2666
|
var _this7 = this;
|
|
2588
2667
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2589
|
-
return _regeneratorRuntime().wrap(function
|
|
2590
|
-
while (1) switch (
|
|
2668
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2669
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2591
2670
|
case 0:
|
|
2592
2671
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2593
2672
|
if (trimmed) {
|
|
2594
|
-
|
|
2673
|
+
_context32.next = 4;
|
|
2595
2674
|
break;
|
|
2596
2675
|
}
|
|
2597
2676
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2598
|
-
return
|
|
2677
|
+
return _context32.abrupt("return", {
|
|
2599
2678
|
status: 'failed',
|
|
2600
2679
|
reason: 'empty_code'
|
|
2601
2680
|
});
|
|
2602
2681
|
case 4:
|
|
2603
|
-
|
|
2682
|
+
_context32.prev = 4;
|
|
2604
2683
|
localSearch = function localSearch(v) {
|
|
2605
2684
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2606
2685
|
};
|
|
2607
2686
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2608
|
-
|
|
2687
|
+
_context32.next = 9;
|
|
2609
2688
|
return scanCallback({
|
|
2610
2689
|
type: 'nativeScanner',
|
|
2611
2690
|
value: trimmed
|
|
2612
2691
|
});
|
|
2613
2692
|
case 9:
|
|
2614
|
-
raw =
|
|
2693
|
+
raw = _context32.sent;
|
|
2615
2694
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2616
2695
|
if (formatted) {
|
|
2617
|
-
|
|
2696
|
+
_context32.next = 14;
|
|
2618
2697
|
break;
|
|
2619
2698
|
}
|
|
2620
2699
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2621
|
-
return
|
|
2700
|
+
return _context32.abrupt("return", {
|
|
2622
2701
|
status: 'failed',
|
|
2623
2702
|
reason: 'not_found'
|
|
2624
2703
|
});
|
|
2625
2704
|
case 14:
|
|
2626
|
-
|
|
2705
|
+
_context32.next = 16;
|
|
2627
2706
|
return applyGlobalScan({
|
|
2628
2707
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2629
2708
|
return _this7.setOrderCustomer(customer);
|
|
@@ -2631,6 +2710,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2631
2710
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2632
2711
|
return _this7.getOrderCustomerSnapshot();
|
|
2633
2712
|
},
|
|
2713
|
+
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
2714
|
+
return _this7.resolveCustomerById(customerId);
|
|
2715
|
+
},
|
|
2634
2716
|
getBusinessCode: function getBusinessCode() {
|
|
2635
2717
|
var _this7$otherParams;
|
|
2636
2718
|
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
@@ -2658,28 +2740,68 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2658
2740
|
}
|
|
2659
2741
|
}, formatted, bridge);
|
|
2660
2742
|
case 16:
|
|
2661
|
-
_result7 =
|
|
2743
|
+
_result7 = _context32.sent;
|
|
2662
2744
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2663
|
-
return
|
|
2745
|
+
return _context32.abrupt("return", _result7);
|
|
2664
2746
|
case 21:
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2747
|
+
_context32.prev = 21;
|
|
2748
|
+
_context32.t0 = _context32["catch"](4);
|
|
2749
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context32.t0);
|
|
2668
2750
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2669
|
-
return
|
|
2751
|
+
return _context32.abrupt("return", {
|
|
2670
2752
|
status: 'failed',
|
|
2671
2753
|
reason: 'not_found'
|
|
2672
2754
|
});
|
|
2673
2755
|
case 26:
|
|
2674
2756
|
case "end":
|
|
2675
|
-
return
|
|
2757
|
+
return _context32.stop();
|
|
2676
2758
|
}
|
|
2677
|
-
},
|
|
2759
|
+
}, _callee32, this, [[4, 21]]);
|
|
2678
2760
|
}));
|
|
2679
|
-
function handleGlobalScanCode(
|
|
2761
|
+
function handleGlobalScanCode(_x21, _x22) {
|
|
2680
2762
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2681
2763
|
}
|
|
2682
2764
|
return handleGlobalScanCode;
|
|
2765
|
+
}() /** 查询码类型;复用原有识别和缓存,不写订单、不打开选择 UI。 */)
|
|
2766
|
+
}, {
|
|
2767
|
+
key: "getGlobalScanCodeType",
|
|
2768
|
+
value: (function () {
|
|
2769
|
+
var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(code) {
|
|
2770
|
+
var _this8 = this,
|
|
2771
|
+
_formatGlobalScanResu,
|
|
2772
|
+
_formatGlobalScanResu2;
|
|
2773
|
+
var trimmed, scan, raw;
|
|
2774
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2775
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2776
|
+
case 0:
|
|
2777
|
+
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2778
|
+
if (trimmed) {
|
|
2779
|
+
_context33.next = 3;
|
|
2780
|
+
break;
|
|
2781
|
+
}
|
|
2782
|
+
return _context33.abrupt("return", null);
|
|
2783
|
+
case 3:
|
|
2784
|
+
scan = handleGlobalScan(this.request, function (value) {
|
|
2785
|
+
return _this8.store.products.findProductsByCodeOrBarcode(value);
|
|
2786
|
+
}, this.getSubmitOrderSalesChannel());
|
|
2787
|
+
_context33.next = 6;
|
|
2788
|
+
return scan({
|
|
2789
|
+
type: 'nativeScanner',
|
|
2790
|
+
value: trimmed
|
|
2791
|
+
});
|
|
2792
|
+
case 6:
|
|
2793
|
+
raw = _context33.sent;
|
|
2794
|
+
return _context33.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
|
|
2795
|
+
case 8:
|
|
2796
|
+
case "end":
|
|
2797
|
+
return _context33.stop();
|
|
2798
|
+
}
|
|
2799
|
+
}, _callee33, this);
|
|
2800
|
+
}));
|
|
2801
|
+
function getGlobalScanCodeType(_x23) {
|
|
2802
|
+
return _getGlobalScanCodeType.apply(this, arguments);
|
|
2803
|
+
}
|
|
2804
|
+
return getGlobalScanCodeType;
|
|
2683
2805
|
}())
|
|
2684
2806
|
}, {
|
|
2685
2807
|
key: "resolveBestAddTimePlan",
|
|
@@ -2758,11 +2880,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2758
2880
|
}, {
|
|
2759
2881
|
key: "addAddTimeProductToBooking",
|
|
2760
2882
|
value: (function () {
|
|
2761
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2762
|
-
return _regeneratorRuntime().wrap(function
|
|
2763
|
-
while (1) switch (
|
|
2883
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
|
|
2884
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2885
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2764
2886
|
case 0:
|
|
2765
|
-
return
|
|
2887
|
+
return _context34.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2766
2888
|
booking: input.booking,
|
|
2767
2889
|
products: [input],
|
|
2768
2890
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2770,11 +2892,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2770
2892
|
}));
|
|
2771
2893
|
case 1:
|
|
2772
2894
|
case "end":
|
|
2773
|
-
return
|
|
2895
|
+
return _context34.stop();
|
|
2774
2896
|
}
|
|
2775
|
-
},
|
|
2897
|
+
}, _callee34, this);
|
|
2776
2898
|
}));
|
|
2777
|
-
function addAddTimeProductToBooking(
|
|
2899
|
+
function addAddTimeProductToBooking(_x24) {
|
|
2778
2900
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2779
2901
|
}
|
|
2780
2902
|
return addAddTimeProductToBooking;
|
|
@@ -2792,27 +2914,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2792
2914
|
}, {
|
|
2793
2915
|
key: "addAddTimeProductsToBooking",
|
|
2794
2916
|
value: (function () {
|
|
2795
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2796
|
-
var
|
|
2917
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(input) {
|
|
2918
|
+
var _this9 = this,
|
|
2797
2919
|
_input$bookingPatch;
|
|
2798
2920
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2799
|
-
return _regeneratorRuntime().wrap(function
|
|
2800
|
-
while (1) switch (
|
|
2921
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2922
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2801
2923
|
case 0:
|
|
2802
2924
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
2803
2925
|
if (bookingUid) {
|
|
2804
|
-
|
|
2926
|
+
_context35.next = 3;
|
|
2805
2927
|
break;
|
|
2806
2928
|
}
|
|
2807
2929
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
2808
2930
|
case 3:
|
|
2809
2931
|
orderLines = (input.products || []).map(function (line) {
|
|
2810
2932
|
return {
|
|
2811
|
-
product:
|
|
2933
|
+
product: _this9.buildAddTimeOrderLine(line, bookingUid)
|
|
2812
2934
|
};
|
|
2813
2935
|
});
|
|
2814
2936
|
if (this.store.order) {
|
|
2815
|
-
|
|
2937
|
+
_context35.next = 6;
|
|
2816
2938
|
break;
|
|
2817
2939
|
}
|
|
2818
2940
|
throw new Error('order 模块未初始化');
|
|
@@ -2826,55 +2948,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2826
2948
|
});
|
|
2827
2949
|
}
|
|
2828
2950
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
2829
|
-
|
|
2951
|
+
_context35.next = 11;
|
|
2830
2952
|
break;
|
|
2831
2953
|
}
|
|
2832
|
-
return
|
|
2954
|
+
return _context35.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2833
2955
|
case 11:
|
|
2834
2956
|
result = [];
|
|
2835
2957
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2836
|
-
|
|
2958
|
+
_context35.prev = 13;
|
|
2837
2959
|
_iterator2.s();
|
|
2838
2960
|
case 15:
|
|
2839
2961
|
if ((_step2 = _iterator2.n()).done) {
|
|
2840
|
-
|
|
2962
|
+
_context35.next = 29;
|
|
2841
2963
|
break;
|
|
2842
2964
|
}
|
|
2843
2965
|
line = _step2.value;
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2966
|
+
_context35.t0 = result.splice;
|
|
2967
|
+
_context35.t1 = result;
|
|
2968
|
+
_context35.t2 = [0, result.length];
|
|
2969
|
+
_context35.t3 = _toConsumableArray;
|
|
2970
|
+
_context35.next = 23;
|
|
2849
2971
|
return this.addProductToOrder(line.product);
|
|
2850
2972
|
case 23:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2973
|
+
_context35.t4 = _context35.sent;
|
|
2974
|
+
_context35.t5 = (0, _context35.t3)(_context35.t4);
|
|
2975
|
+
_context35.t6 = _context35.t2.concat.call(_context35.t2, _context35.t5);
|
|
2976
|
+
_context35.t0.apply.call(_context35.t0, _context35.t1, _context35.t6);
|
|
2855
2977
|
case 27:
|
|
2856
|
-
|
|
2978
|
+
_context35.next = 15;
|
|
2857
2979
|
break;
|
|
2858
2980
|
case 29:
|
|
2859
|
-
|
|
2981
|
+
_context35.next = 34;
|
|
2860
2982
|
break;
|
|
2861
2983
|
case 31:
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
_iterator2.e(
|
|
2984
|
+
_context35.prev = 31;
|
|
2985
|
+
_context35.t7 = _context35["catch"](13);
|
|
2986
|
+
_iterator2.e(_context35.t7);
|
|
2865
2987
|
case 34:
|
|
2866
|
-
|
|
2988
|
+
_context35.prev = 34;
|
|
2867
2989
|
_iterator2.f();
|
|
2868
|
-
return
|
|
2990
|
+
return _context35.finish(34);
|
|
2869
2991
|
case 37:
|
|
2870
|
-
return
|
|
2992
|
+
return _context35.abrupt("return", result);
|
|
2871
2993
|
case 38:
|
|
2872
2994
|
case "end":
|
|
2873
|
-
return
|
|
2995
|
+
return _context35.stop();
|
|
2874
2996
|
}
|
|
2875
|
-
},
|
|
2997
|
+
}, _callee35, this, [[13, 31, 34, 37]]);
|
|
2876
2998
|
}));
|
|
2877
|
-
function addAddTimeProductsToBooking(
|
|
2999
|
+
function addAddTimeProductsToBooking(_x25) {
|
|
2878
3000
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
2879
3001
|
}
|
|
2880
3002
|
return addAddTimeProductsToBooking;
|
|
@@ -2882,43 +3004,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2882
3004
|
}, {
|
|
2883
3005
|
key: "setOtherParams",
|
|
2884
3006
|
value: function () {
|
|
2885
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3007
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
2886
3008
|
var _ref19,
|
|
2887
3009
|
_ref19$cover,
|
|
2888
3010
|
cover,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
3011
|
+
invoiceContextChanged,
|
|
3012
|
+
_args36 = arguments;
|
|
3013
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3014
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2892
3015
|
case 0:
|
|
2893
|
-
_ref19 =
|
|
2894
|
-
|
|
3016
|
+
_ref19 = _args36.length > 1 && _args36[1] !== undefined ? _args36[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
3017
|
+
_context36.next = 3;
|
|
2895
3018
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2896
3019
|
cover: cover
|
|
2897
3020
|
});
|
|
2898
3021
|
case 3:
|
|
2899
|
-
|
|
2900
|
-
|
|
3022
|
+
invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
3023
|
+
if (!invoiceContextChanged) {
|
|
3024
|
+
_context36.next = 7;
|
|
2901
3025
|
break;
|
|
2902
3026
|
}
|
|
2903
|
-
|
|
2904
|
-
return this.
|
|
2905
|
-
case
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
case 8:
|
|
2909
|
-
if (!((params === null || params === void 0 ? void 0 : params.channel) !== undefined)) {
|
|
2910
|
-
_context34.next = 11;
|
|
3027
|
+
_context36.next = 7;
|
|
3028
|
+
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
3029
|
+
case 7:
|
|
3030
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
3031
|
+
_context36.next = 10;
|
|
2911
3032
|
break;
|
|
2912
3033
|
}
|
|
2913
|
-
|
|
2914
|
-
return this.
|
|
2915
|
-
case
|
|
3034
|
+
_context36.next = 10;
|
|
3035
|
+
return this.configureIdGeneratorFromOpenData();
|
|
3036
|
+
case 10:
|
|
2916
3037
|
case "end":
|
|
2917
|
-
return
|
|
3038
|
+
return _context36.stop();
|
|
2918
3039
|
}
|
|
2919
|
-
},
|
|
3040
|
+
}, _callee36, this);
|
|
2920
3041
|
}));
|
|
2921
|
-
function setOtherParams(
|
|
3042
|
+
function setOtherParams(_x26) {
|
|
2922
3043
|
return _setOtherParams.apply(this, arguments);
|
|
2923
3044
|
}
|
|
2924
3045
|
return setOtherParams;
|
|
@@ -2935,15 +3056,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2935
3056
|
}, {
|
|
2936
3057
|
key: "handlePrintWristband",
|
|
2937
3058
|
value: function () {
|
|
2938
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2939
|
-
var _this$
|
|
3059
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3060
|
+
var _this$getOrderIdentit2;
|
|
2940
3061
|
var deviceTask, deviceId, idempotencyKey;
|
|
2941
|
-
return _regeneratorRuntime().wrap(function
|
|
2942
|
-
while (1) switch (
|
|
3062
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3063
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2943
3064
|
case 0:
|
|
2944
3065
|
deviceTask = this.getDeviceTaskPlugin();
|
|
2945
3066
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
2946
|
-
|
|
3067
|
+
_context37.next = 4;
|
|
2947
3068
|
break;
|
|
2948
3069
|
}
|
|
2949
3070
|
this.logger.addLog({
|
|
@@ -2953,7 +3074,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2953
3074
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2954
3075
|
}
|
|
2955
3076
|
});
|
|
2956
|
-
return
|
|
3077
|
+
return _context37.abrupt("return");
|
|
2957
3078
|
case 4:
|
|
2958
3079
|
this.logger.addLog({
|
|
2959
3080
|
type: 'info',
|
|
@@ -2962,10 +3083,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2962
3083
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2963
3084
|
}
|
|
2964
3085
|
});
|
|
2965
|
-
|
|
3086
|
+
_context37.next = 7;
|
|
2966
3087
|
return this.getShortNumberOrDeviceId();
|
|
2967
3088
|
case 7:
|
|
2968
|
-
deviceId =
|
|
3089
|
+
deviceId = _context37.sent;
|
|
2969
3090
|
idempotencyKey = createUuidV4();
|
|
2970
3091
|
deviceTask.dispatch({
|
|
2971
3092
|
action: 'print_all',
|
|
@@ -2973,7 +3094,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2973
3094
|
payload: {
|
|
2974
3095
|
type: 'WRISTBAND',
|
|
2975
3096
|
data: {
|
|
2976
|
-
order_id: (_this$
|
|
3097
|
+
order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId,
|
|
2977
3098
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2978
3099
|
}
|
|
2979
3100
|
},
|
|
@@ -2985,11 +3106,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2985
3106
|
});
|
|
2986
3107
|
case 10:
|
|
2987
3108
|
case "end":
|
|
2988
|
-
return
|
|
3109
|
+
return _context37.stop();
|
|
2989
3110
|
}
|
|
2990
|
-
},
|
|
3111
|
+
}, _callee37, this);
|
|
2991
3112
|
}));
|
|
2992
|
-
function handlePrintWristband(
|
|
3113
|
+
function handlePrintWristband(_x27) {
|
|
2993
3114
|
return _handlePrintWristband.apply(this, arguments);
|
|
2994
3115
|
}
|
|
2995
3116
|
return handlePrintWristband;
|
|
@@ -2997,11 +3118,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2997
3118
|
}, {
|
|
2998
3119
|
key: "handleRedeem",
|
|
2999
3120
|
value: function () {
|
|
3000
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3001
|
-
var _this$store$
|
|
3121
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
|
|
3122
|
+
var _this$store$order7, _this$store$order7$ge, _this$store$order8, _ref20, _tempOrder$order_id2;
|
|
3002
3123
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3003
|
-
return _regeneratorRuntime().wrap(function
|
|
3004
|
-
while (1) switch (
|
|
3124
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3125
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3005
3126
|
case 0:
|
|
3006
3127
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3007
3128
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3014,8 +3135,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3014
3135
|
}
|
|
3015
3136
|
});
|
|
3016
3137
|
voucherIdSet = new Set(voucherIds);
|
|
3017
|
-
tempOrder = (_this$store$
|
|
3018
|
-
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$
|
|
3138
|
+
tempOrder = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getTempOrder) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
3139
|
+
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 ? void 0 : _this$store$order8.getVouchers()) || [];
|
|
3019
3140
|
hasUpdatedVoucher = false;
|
|
3020
3141
|
nextVouchers = vouchers.map(function (voucher) {
|
|
3021
3142
|
if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
|
|
@@ -3025,20 +3146,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3025
3146
|
});
|
|
3026
3147
|
});
|
|
3027
3148
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3028
|
-
|
|
3149
|
+
_context38.next = 11;
|
|
3029
3150
|
break;
|
|
3030
3151
|
}
|
|
3031
|
-
|
|
3152
|
+
_context38.next = 11;
|
|
3032
3153
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3033
3154
|
vouchers: nextVouchers
|
|
3034
3155
|
}));
|
|
3035
3156
|
case 11:
|
|
3036
3157
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3037
3158
|
if (!(voucherIds.length === 0)) {
|
|
3038
|
-
|
|
3159
|
+
_context38.next = 14;
|
|
3039
3160
|
break;
|
|
3040
3161
|
}
|
|
3041
|
-
return
|
|
3162
|
+
return _context38.abrupt("return", {
|
|
3042
3163
|
code: 200,
|
|
3043
3164
|
status: true,
|
|
3044
3165
|
message: '',
|
|
@@ -3049,7 +3170,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3049
3170
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3050
3171
|
orderId = (_ref20 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref20 !== void 0 ? _ref20 : undefined;
|
|
3051
3172
|
orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
|
|
3052
|
-
return
|
|
3173
|
+
return _context38.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3053
3174
|
ids: voucherIds,
|
|
3054
3175
|
status: status,
|
|
3055
3176
|
order_lookup: orderLookup,
|
|
@@ -3060,11 +3181,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3060
3181
|
}));
|
|
3061
3182
|
case 19:
|
|
3062
3183
|
case "end":
|
|
3063
|
-
return
|
|
3184
|
+
return _context38.stop();
|
|
3064
3185
|
}
|
|
3065
|
-
},
|
|
3186
|
+
}, _callee38, this);
|
|
3066
3187
|
}));
|
|
3067
|
-
function handleRedeem(
|
|
3188
|
+
function handleRedeem(_x28) {
|
|
3068
3189
|
return _handleRedeem.apply(this, arguments);
|
|
3069
3190
|
}
|
|
3070
3191
|
return handleRedeem;
|
|
@@ -3076,12 +3197,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3076
3197
|
}, {
|
|
3077
3198
|
key: "destroy",
|
|
3078
3199
|
value: (function () {
|
|
3079
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3200
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3080
3201
|
var _this$scan;
|
|
3081
|
-
return _regeneratorRuntime().wrap(function
|
|
3082
|
-
while (1) switch (
|
|
3202
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3203
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3083
3204
|
case 0:
|
|
3084
|
-
|
|
3205
|
+
_context39.next = 2;
|
|
3085
3206
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3086
3207
|
case 2:
|
|
3087
3208
|
try {
|
|
@@ -3092,9 +3213,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3092
3213
|
scanCache.clear();
|
|
3093
3214
|
case 4:
|
|
3094
3215
|
case "end":
|
|
3095
|
-
return
|
|
3216
|
+
return _context39.stop();
|
|
3096
3217
|
}
|
|
3097
|
-
},
|
|
3218
|
+
}, _callee39, this);
|
|
3098
3219
|
}));
|
|
3099
3220
|
function destroy() {
|
|
3100
3221
|
return _destroy.apply(this, arguments);
|