@pisell/pisellos 0.10.32 → 0.10.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/OpenData/index.d.ts +1 -1
- package/dist/modules/OpenData/index.js +19 -11
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/server/utils/small-ticket.d.ts +5 -1
- package/dist/server/utils/small-ticket.js +146 -81
- package/dist/solution/BookingTicket/index.d.ts +6 -0
- package/dist/solution/BookingTicket/index.js +548 -485
- package/lib/modules/OpenData/index.d.ts +1 -1
- package/lib/modules/OpenData/index.js +9 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/utils/small-ticket.d.ts +5 -1
- package/lib/server/utils/small-ticket.js +78 -18
- package/lib/solution/BookingTicket/index.d.ts +6 -0
- package/lib/solution/BookingTicket/index.js +32 -3
- 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); }); }; }
|
|
@@ -238,8 +238,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
238
238
|
case 6:
|
|
239
239
|
this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
|
|
240
240
|
_context.next = 9;
|
|
241
|
-
return this.
|
|
241
|
+
return this.prepareInvoiceTemplateAtSolutionReady(this.getInjectedOpenDataConfig());
|
|
242
242
|
case 9:
|
|
243
|
+
_context.next = 11;
|
|
244
|
+
return this.configureIdGeneratorFromOpenData();
|
|
245
|
+
case 11:
|
|
243
246
|
case "end":
|
|
244
247
|
return _context.stop();
|
|
245
248
|
}
|
|
@@ -250,11 +253,72 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
250
253
|
}
|
|
251
254
|
return initialize;
|
|
252
255
|
}()
|
|
256
|
+
}, {
|
|
257
|
+
key: "getInjectedOpenDataConfig",
|
|
258
|
+
value: function getInjectedOpenDataConfig() {
|
|
259
|
+
var _this$otherParams2;
|
|
260
|
+
var openData = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.openData;
|
|
261
|
+
return openData && _typeof(openData) === 'object' && !Array.isArray(openData) ? openData : undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 在解决方案对外 ready 前准备 Invoice Document;失败只降级模板,不阻断销售。
|
|
266
|
+
* 已由页面取得的 OpenData 直接交给模块接管,没有注入数据时再走 target-scoped 加载。
|
|
267
|
+
*/
|
|
268
|
+
}, {
|
|
269
|
+
key: "prepareInvoiceTemplateAtSolutionReady",
|
|
270
|
+
value: (function () {
|
|
271
|
+
var _prepareInvoiceTemplateAtSolutionReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(injectedOpenData) {
|
|
272
|
+
var businessCode, channel, target;
|
|
273
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
274
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
275
|
+
case 0:
|
|
276
|
+
businessCode = this.getBookingTicketBusinessCode();
|
|
277
|
+
if (!(!businessCode || !this.store.openData)) {
|
|
278
|
+
_context2.next = 3;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
return _context2.abrupt("return");
|
|
282
|
+
case 3:
|
|
283
|
+
channel = this.getSubmitOrderSalesChannel();
|
|
284
|
+
target = "".concat(businessCode, "+").concat(channel);
|
|
285
|
+
_context2.prev = 5;
|
|
286
|
+
if (!(injectedOpenData && typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
|
|
287
|
+
_context2.next = 12;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
this.openDataTarget = target;
|
|
291
|
+
_context2.next = 10;
|
|
292
|
+
return this.store.openData.ensureInvoiceTemplateSettings(target, injectedOpenData);
|
|
293
|
+
case 10:
|
|
294
|
+
this.otherParams.openData = injectedOpenData;
|
|
295
|
+
return _context2.abrupt("return");
|
|
296
|
+
case 12:
|
|
297
|
+
_context2.next = 14;
|
|
298
|
+
return this.loadOpenDataConfig();
|
|
299
|
+
case 14:
|
|
300
|
+
_context2.next = 19;
|
|
301
|
+
break;
|
|
302
|
+
case 16:
|
|
303
|
+
_context2.prev = 16;
|
|
304
|
+
_context2.t0 = _context2["catch"](5);
|
|
305
|
+
console.warn('[BookingTicket] Invoice 模板预加载失败,使用默认配置', _context2.t0);
|
|
306
|
+
case 19:
|
|
307
|
+
case "end":
|
|
308
|
+
return _context2.stop();
|
|
309
|
+
}
|
|
310
|
+
}, _callee2, this, [[5, 16]]);
|
|
311
|
+
}));
|
|
312
|
+
function prepareInvoiceTemplateAtSolutionReady(_x2) {
|
|
313
|
+
return _prepareInvoiceTemplateAtSolutionReady.apply(this, arguments);
|
|
314
|
+
}
|
|
315
|
+
return prepareInvoiceTemplateAtSolutionReady;
|
|
316
|
+
}())
|
|
253
317
|
}, {
|
|
254
318
|
key: "getBookingTicketBusinessCode",
|
|
255
319
|
value: function getBookingTicketBusinessCode() {
|
|
256
|
-
var _this$
|
|
257
|
-
var candidates = [(_this$
|
|
320
|
+
var _this$otherParams3, _this$otherParams4, _this$getOrderHeader, _this$store$order, _this$store$order$get, _this$getSalesOrder;
|
|
321
|
+
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
322
|
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
259
323
|
var candidate = _candidates[_i];
|
|
260
324
|
if (candidate === undefined || candidate === null) continue;
|
|
@@ -274,60 +338,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
274
338
|
}, {
|
|
275
339
|
key: "loadOpenDataConfig",
|
|
276
340
|
value: function () {
|
|
277
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
341
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
278
342
|
var businessCode, channel, target, lastFetchedAt, cachedData, request, openDataConfig;
|
|
279
|
-
return _regeneratorRuntime().wrap(function
|
|
280
|
-
while (1) switch (
|
|
343
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
344
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
281
345
|
case 0:
|
|
282
346
|
if (this.store.openData) {
|
|
283
|
-
|
|
347
|
+
_context3.next = 2;
|
|
284
348
|
break;
|
|
285
349
|
}
|
|
286
350
|
throw new Error('openData 模块未初始化');
|
|
287
351
|
case 2:
|
|
288
352
|
businessCode = this.getBookingTicketBusinessCode();
|
|
289
353
|
if (businessCode) {
|
|
290
|
-
|
|
354
|
+
_context3.next = 6;
|
|
291
355
|
break;
|
|
292
356
|
}
|
|
293
357
|
console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
|
|
294
|
-
return
|
|
358
|
+
return _context3.abrupt("return", null);
|
|
295
359
|
case 6:
|
|
296
360
|
channel = this.getSubmitOrderSalesChannel();
|
|
297
361
|
target = "".concat(businessCode, "+").concat(channel);
|
|
298
362
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
299
363
|
cachedData = this.store.openData.getOpenData();
|
|
300
364
|
if (!(cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
301
|
-
|
|
365
|
+
_context3.next = 16;
|
|
302
366
|
break;
|
|
303
367
|
}
|
|
304
368
|
if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
|
|
305
|
-
|
|
369
|
+
_context3.next = 14;
|
|
306
370
|
break;
|
|
307
371
|
}
|
|
308
|
-
|
|
372
|
+
_context3.next = 14;
|
|
309
373
|
return this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
310
374
|
case 14:
|
|
311
375
|
this.otherParams.openData = cachedData;
|
|
312
|
-
return
|
|
376
|
+
return _context3.abrupt("return", cachedData);
|
|
313
377
|
case 16:
|
|
314
378
|
if (!this.loadOpenDataInFlight) {
|
|
315
|
-
|
|
379
|
+
_context3.next = 24;
|
|
316
380
|
break;
|
|
317
381
|
}
|
|
318
382
|
if (!(this.loadOpenDataInFlightTarget === target)) {
|
|
319
|
-
|
|
383
|
+
_context3.next = 21;
|
|
320
384
|
break;
|
|
321
385
|
}
|
|
322
|
-
|
|
386
|
+
_context3.next = 20;
|
|
323
387
|
return this.loadOpenDataInFlight;
|
|
324
388
|
case 20:
|
|
325
|
-
return
|
|
389
|
+
return _context3.abrupt("return", _context3.sent);
|
|
326
390
|
case 21:
|
|
327
|
-
|
|
391
|
+
_context3.next = 23;
|
|
328
392
|
return this.loadOpenDataInFlight;
|
|
329
393
|
case 23:
|
|
330
|
-
return
|
|
394
|
+
return _context3.abrupt("return", this.loadOpenDataConfig());
|
|
331
395
|
case 24:
|
|
332
396
|
this.loadOpenDataInFlightTarget = target;
|
|
333
397
|
request = this.store.openData.fetchOpenData({
|
|
@@ -337,29 +401,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
337
401
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
338
402
|
});
|
|
339
403
|
this.loadOpenDataInFlight = request;
|
|
340
|
-
|
|
341
|
-
|
|
404
|
+
_context3.prev = 27;
|
|
405
|
+
_context3.next = 30;
|
|
342
406
|
return request;
|
|
343
407
|
case 30:
|
|
344
|
-
openDataConfig =
|
|
408
|
+
openDataConfig = _context3.sent;
|
|
345
409
|
// clearOpenDataCache() 或新请求已接管时,旧响应只能返回给原调用方,不能复活缓存归属。
|
|
346
410
|
if (this.loadOpenDataInFlight === request) {
|
|
347
411
|
this.openDataTarget = target;
|
|
348
412
|
this.otherParams.openData = openDataConfig;
|
|
349
413
|
}
|
|
350
|
-
return
|
|
414
|
+
return _context3.abrupt("return", openDataConfig);
|
|
351
415
|
case 33:
|
|
352
|
-
|
|
416
|
+
_context3.prev = 33;
|
|
353
417
|
if (this.loadOpenDataInFlight === request) {
|
|
354
418
|
this.loadOpenDataInFlight = null;
|
|
355
419
|
this.loadOpenDataInFlightTarget = null;
|
|
356
420
|
}
|
|
357
|
-
return
|
|
421
|
+
return _context3.finish(33);
|
|
358
422
|
case 36:
|
|
359
423
|
case "end":
|
|
360
|
-
return
|
|
424
|
+
return _context3.stop();
|
|
361
425
|
}
|
|
362
|
-
},
|
|
426
|
+
}, _callee3, this, [[27,, 33, 36]]);
|
|
363
427
|
}));
|
|
364
428
|
function loadOpenDataConfig() {
|
|
365
429
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -369,16 +433,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
369
433
|
}, {
|
|
370
434
|
key: "getOpenData",
|
|
371
435
|
value: function () {
|
|
372
|
-
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
373
|
-
return _regeneratorRuntime().wrap(function
|
|
374
|
-
while (1) switch (
|
|
436
|
+
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
437
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
438
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
375
439
|
case 0:
|
|
376
|
-
return
|
|
440
|
+
return _context4.abrupt("return", this.loadOpenDataConfig());
|
|
377
441
|
case 1:
|
|
378
442
|
case "end":
|
|
379
|
-
return
|
|
443
|
+
return _context4.stop();
|
|
380
444
|
}
|
|
381
|
-
},
|
|
445
|
+
}, _callee4, this);
|
|
382
446
|
}));
|
|
383
447
|
function getOpenData() {
|
|
384
448
|
return _getOpenData.apply(this, arguments);
|
|
@@ -388,27 +452,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
388
452
|
}, {
|
|
389
453
|
key: "getInvoiceLayoutConfig",
|
|
390
454
|
value: function () {
|
|
391
|
-
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
455
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
392
456
|
var openData;
|
|
393
|
-
return _regeneratorRuntime().wrap(function
|
|
394
|
-
while (1) switch (
|
|
457
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
458
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
395
459
|
case 0:
|
|
396
|
-
|
|
460
|
+
_context5.next = 2;
|
|
397
461
|
return this.loadOpenDataConfig();
|
|
398
462
|
case 2:
|
|
399
|
-
openData =
|
|
463
|
+
openData = _context5.sent;
|
|
400
464
|
if (openData) {
|
|
401
|
-
|
|
465
|
+
_context5.next = 5;
|
|
402
466
|
break;
|
|
403
467
|
}
|
|
404
|
-
return
|
|
468
|
+
return _context5.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
405
469
|
case 5:
|
|
406
|
-
return
|
|
470
|
+
return _context5.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
407
471
|
case 6:
|
|
408
472
|
case "end":
|
|
409
|
-
return
|
|
473
|
+
return _context5.stop();
|
|
410
474
|
}
|
|
411
|
-
},
|
|
475
|
+
}, _callee5, this);
|
|
412
476
|
}));
|
|
413
477
|
function getInvoiceLayoutConfig() {
|
|
414
478
|
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
@@ -418,27 +482,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
418
482
|
}, {
|
|
419
483
|
key: "getInvoiceTemplateSettings",
|
|
420
484
|
value: function () {
|
|
421
|
-
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
485
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
422
486
|
var openData;
|
|
423
|
-
return _regeneratorRuntime().wrap(function
|
|
424
|
-
while (1) switch (
|
|
487
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
488
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
425
489
|
case 0:
|
|
426
|
-
|
|
490
|
+
_context6.next = 2;
|
|
427
491
|
return this.loadOpenDataConfig();
|
|
428
492
|
case 2:
|
|
429
|
-
openData =
|
|
493
|
+
openData = _context6.sent;
|
|
430
494
|
if (openData) {
|
|
431
|
-
|
|
495
|
+
_context6.next = 5;
|
|
432
496
|
break;
|
|
433
497
|
}
|
|
434
|
-
return
|
|
498
|
+
return _context6.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
435
499
|
case 5:
|
|
436
|
-
return
|
|
500
|
+
return _context6.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
437
501
|
case 6:
|
|
438
502
|
case "end":
|
|
439
|
-
return
|
|
503
|
+
return _context6.stop();
|
|
440
504
|
}
|
|
441
|
-
},
|
|
505
|
+
}, _callee6, this);
|
|
442
506
|
}));
|
|
443
507
|
function getInvoiceTemplateSettings() {
|
|
444
508
|
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
@@ -468,32 +532,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
468
532
|
}, {
|
|
469
533
|
key: "getShortNumberOrDeviceId",
|
|
470
534
|
value: function () {
|
|
471
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
535
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
472
536
|
var getAsyncIotDeviceInfo, res;
|
|
473
|
-
return _regeneratorRuntime().wrap(function
|
|
474
|
-
while (1) switch (
|
|
537
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
538
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
475
539
|
case 0:
|
|
476
540
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
477
541
|
if (!getAsyncIotDeviceInfo) {
|
|
478
|
-
|
|
542
|
+
_context7.next = 7;
|
|
479
543
|
break;
|
|
480
544
|
}
|
|
481
|
-
|
|
545
|
+
_context7.next = 4;
|
|
482
546
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
483
547
|
case 4:
|
|
484
|
-
res =
|
|
548
|
+
res = _context7.sent;
|
|
485
549
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
486
|
-
|
|
550
|
+
_context7.next = 7;
|
|
487
551
|
break;
|
|
488
552
|
}
|
|
489
|
-
return
|
|
553
|
+
return _context7.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
490
554
|
case 7:
|
|
491
|
-
return
|
|
555
|
+
return _context7.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
492
556
|
case 8:
|
|
493
557
|
case "end":
|
|
494
|
-
return
|
|
558
|
+
return _context7.stop();
|
|
495
559
|
}
|
|
496
|
-
},
|
|
560
|
+
}, _callee7, this);
|
|
497
561
|
}));
|
|
498
562
|
function getShortNumberOrDeviceId() {
|
|
499
563
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -503,35 +567,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
503
567
|
}, {
|
|
504
568
|
key: "configureIdGeneratorFromOpenData",
|
|
505
569
|
value: function () {
|
|
506
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
570
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
507
571
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
508
572
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
509
|
-
return _regeneratorRuntime().wrap(function
|
|
510
|
-
while (1) switch (
|
|
573
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
574
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
511
575
|
case 0:
|
|
512
576
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
513
577
|
this.setPaymentNumberDevicePrefix(null);
|
|
514
578
|
idGenerator = this.getIdGeneratorPlugin();
|
|
515
579
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
516
|
-
|
|
580
|
+
_context8.next = 5;
|
|
517
581
|
break;
|
|
518
582
|
}
|
|
519
583
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
520
|
-
return
|
|
584
|
+
return _context8.abrupt("return");
|
|
521
585
|
case 5:
|
|
522
586
|
openDataConfig = null;
|
|
523
|
-
|
|
524
|
-
|
|
587
|
+
_context8.prev = 6;
|
|
588
|
+
_context8.next = 9;
|
|
525
589
|
return this.loadOpenDataConfig();
|
|
526
590
|
case 9:
|
|
527
|
-
openDataConfig =
|
|
528
|
-
|
|
591
|
+
openDataConfig = _context8.sent;
|
|
592
|
+
_context8.next = 16;
|
|
529
593
|
break;
|
|
530
594
|
case 12:
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
534
|
-
return
|
|
595
|
+
_context8.prev = 12;
|
|
596
|
+
_context8.t0 = _context8["catch"](6);
|
|
597
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context8.t0);
|
|
598
|
+
return _context8.abrupt("return");
|
|
535
599
|
case 16:
|
|
536
600
|
// if (!openDataConfig) return;
|
|
537
601
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -543,21 +607,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
543
607
|
"type": "start_time",
|
|
544
608
|
"time": "00:00"
|
|
545
609
|
};
|
|
546
|
-
|
|
610
|
+
_context8.next = 24;
|
|
547
611
|
return this.getShortNumberOrDeviceId();
|
|
548
612
|
case 24:
|
|
549
|
-
deviceId =
|
|
613
|
+
deviceId = _context8.sent;
|
|
550
614
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
551
615
|
businessCode = this.getBookingTicketBusinessCode();
|
|
552
616
|
if (businessCode) {
|
|
553
|
-
|
|
617
|
+
_context8.next = 30;
|
|
554
618
|
break;
|
|
555
619
|
}
|
|
556
620
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
557
|
-
return
|
|
621
|
+
return _context8.abrupt("return");
|
|
558
622
|
case 30:
|
|
559
|
-
|
|
560
|
-
|
|
623
|
+
_context8.prev = 30;
|
|
624
|
+
_context8.next = 33;
|
|
561
625
|
return idGenerator.configure({
|
|
562
626
|
biz: businessCode,
|
|
563
627
|
config: {
|
|
@@ -573,17 +637,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
573
637
|
}
|
|
574
638
|
});
|
|
575
639
|
case 33:
|
|
576
|
-
|
|
640
|
+
_context8.next = 38;
|
|
577
641
|
break;
|
|
578
642
|
case 35:
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
643
|
+
_context8.prev = 35;
|
|
644
|
+
_context8.t1 = _context8["catch"](30);
|
|
645
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context8.t1);
|
|
582
646
|
case 38:
|
|
583
647
|
case "end":
|
|
584
|
-
return
|
|
648
|
+
return _context8.stop();
|
|
585
649
|
}
|
|
586
|
-
},
|
|
650
|
+
}, _callee8, this, [[6, 12], [30, 35]]);
|
|
587
651
|
}));
|
|
588
652
|
function configureIdGeneratorFromOpenData() {
|
|
589
653
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -615,16 +679,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
615
679
|
}, {
|
|
616
680
|
key: "loadSalesDetail",
|
|
617
681
|
value: (function () {
|
|
618
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
682
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(orderIdOrParams) {
|
|
619
683
|
var _ref3;
|
|
620
684
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
621
|
-
return _regeneratorRuntime().wrap(function
|
|
622
|
-
while (1) switch (
|
|
685
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
686
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
623
687
|
case 0:
|
|
624
|
-
|
|
688
|
+
_context9.next = 2;
|
|
625
689
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
626
690
|
case 2:
|
|
627
|
-
sales =
|
|
691
|
+
sales = _context9.sent;
|
|
628
692
|
customerModule = this.store.customer;
|
|
629
693
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
630
694
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -656,14 +720,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
656
720
|
});
|
|
657
721
|
// await this.store.order.saveDraft();
|
|
658
722
|
}
|
|
659
|
-
return
|
|
723
|
+
return _context9.abrupt("return", sales);
|
|
660
724
|
case 11:
|
|
661
725
|
case "end":
|
|
662
|
-
return
|
|
726
|
+
return _context9.stop();
|
|
663
727
|
}
|
|
664
|
-
},
|
|
728
|
+
}, _callee9, this);
|
|
665
729
|
}));
|
|
666
|
-
function loadSalesDetail(
|
|
730
|
+
function loadSalesDetail(_x3) {
|
|
667
731
|
return _loadSalesDetail.apply(this, arguments);
|
|
668
732
|
}
|
|
669
733
|
return loadSalesDetail;
|
|
@@ -671,44 +735,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
671
735
|
}, {
|
|
672
736
|
key: "scanPromotionCode",
|
|
673
737
|
value: function () {
|
|
674
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
738
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(code, customerId) {
|
|
675
739
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
676
|
-
return _regeneratorRuntime().wrap(function
|
|
677
|
-
while (1) switch (
|
|
740
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
741
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
678
742
|
case 0:
|
|
679
743
|
if (this.store.order) {
|
|
680
|
-
|
|
744
|
+
_context10.next = 2;
|
|
681
745
|
break;
|
|
682
746
|
}
|
|
683
747
|
throw new Error('order 模块未初始化');
|
|
684
748
|
case 2:
|
|
685
|
-
|
|
749
|
+
_context10.next = 4;
|
|
686
750
|
return this.store.order.scanCode(code, customerId);
|
|
687
751
|
case 4:
|
|
688
|
-
raw =
|
|
752
|
+
raw = _context10.sent;
|
|
689
753
|
scannedList = raw.scannedDiscountList || [];
|
|
690
754
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
691
755
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
692
756
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
693
757
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
694
|
-
|
|
758
|
+
_context10.next = 12;
|
|
695
759
|
break;
|
|
696
760
|
}
|
|
697
|
-
|
|
761
|
+
_context10.next = 12;
|
|
698
762
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
699
763
|
case 12:
|
|
700
764
|
if (!raw.isAvailable) {
|
|
701
|
-
|
|
765
|
+
_context10.next = 19;
|
|
702
766
|
break;
|
|
703
767
|
}
|
|
704
|
-
|
|
768
|
+
_context10.next = 15;
|
|
705
769
|
return this.store.order.recalculateSummary({
|
|
706
770
|
createIfMissing: true
|
|
707
771
|
});
|
|
708
772
|
case 15:
|
|
709
773
|
this.store.order.persistTempOrder();
|
|
710
774
|
tempOrder = this.store.order.ensureTempOrder();
|
|
711
|
-
|
|
775
|
+
_context10.next = 19;
|
|
712
776
|
return this.effectsEmit('onDiscountApplied', {
|
|
713
777
|
productList: tempOrder.products || [],
|
|
714
778
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -716,7 +780,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
716
780
|
tempOrder: tempOrder
|
|
717
781
|
});
|
|
718
782
|
case 19:
|
|
719
|
-
return
|
|
783
|
+
return _context10.abrupt("return", _objectSpread(_objectSpread({
|
|
720
784
|
isAvailable: raw.isAvailable
|
|
721
785
|
}, raw.isAccepted !== undefined ? {
|
|
722
786
|
isAccepted: raw.isAccepted
|
|
@@ -727,11 +791,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
727
791
|
}));
|
|
728
792
|
case 20:
|
|
729
793
|
case "end":
|
|
730
|
-
return
|
|
794
|
+
return _context10.stop();
|
|
731
795
|
}
|
|
732
|
-
},
|
|
796
|
+
}, _callee10, this);
|
|
733
797
|
}));
|
|
734
|
-
function scanPromotionCode(
|
|
798
|
+
function scanPromotionCode(_x4, _x5) {
|
|
735
799
|
return _scanPromotionCode.apply(this, arguments);
|
|
736
800
|
}
|
|
737
801
|
return scanPromotionCode;
|
|
@@ -739,44 +803,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
739
803
|
}, {
|
|
740
804
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
741
805
|
value: function () {
|
|
742
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
806
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discounts) {
|
|
743
807
|
var currentOrderCustomer, customerId, customer;
|
|
744
|
-
return _regeneratorRuntime().wrap(function
|
|
745
|
-
while (1) switch (
|
|
808
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
809
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
746
810
|
case 0:
|
|
747
811
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
748
812
|
if (!currentOrderCustomer) {
|
|
749
|
-
|
|
813
|
+
_context11.next = 3;
|
|
750
814
|
break;
|
|
751
815
|
}
|
|
752
|
-
return
|
|
816
|
+
return _context11.abrupt("return");
|
|
753
817
|
case 3:
|
|
754
818
|
customerId = this.getDiscountCustomerId(discounts);
|
|
755
819
|
if (customerId) {
|
|
756
|
-
|
|
820
|
+
_context11.next = 6;
|
|
757
821
|
break;
|
|
758
822
|
}
|
|
759
|
-
return
|
|
823
|
+
return _context11.abrupt("return");
|
|
760
824
|
case 6:
|
|
761
|
-
|
|
825
|
+
_context11.next = 8;
|
|
762
826
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
763
827
|
case 8:
|
|
764
|
-
customer =
|
|
828
|
+
customer = _context11.sent;
|
|
765
829
|
if (customer) {
|
|
766
|
-
|
|
830
|
+
_context11.next = 11;
|
|
767
831
|
break;
|
|
768
832
|
}
|
|
769
|
-
return
|
|
833
|
+
return _context11.abrupt("return");
|
|
770
834
|
case 11:
|
|
771
835
|
this.store.customer.setSelectedCustomer(customer);
|
|
772
836
|
this.setOrderCustomer(customer);
|
|
773
837
|
case 13:
|
|
774
838
|
case "end":
|
|
775
|
-
return
|
|
839
|
+
return _context11.stop();
|
|
776
840
|
}
|
|
777
|
-
},
|
|
841
|
+
}, _callee11, this);
|
|
778
842
|
}));
|
|
779
|
-
function hydrateOrderCustomerFromScanDiscounts(
|
|
843
|
+
function hydrateOrderCustomerFromScanDiscounts(_x6) {
|
|
780
844
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
781
845
|
}
|
|
782
846
|
return hydrateOrderCustomerFromScanDiscounts;
|
|
@@ -810,57 +874,57 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
810
874
|
}, {
|
|
811
875
|
key: "resolveCustomerById",
|
|
812
876
|
value: function () {
|
|
813
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
877
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
|
|
814
878
|
var _result$list;
|
|
815
879
|
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
|
|
816
|
-
return _regeneratorRuntime().wrap(function
|
|
817
|
-
while (1) switch (
|
|
880
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
881
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
818
882
|
case 0:
|
|
819
883
|
localCustomers = this.store.customer.getCustomers();
|
|
820
884
|
localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
821
885
|
normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
|
|
822
886
|
if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
|
|
823
|
-
|
|
887
|
+
_context12.next = 5;
|
|
824
888
|
break;
|
|
825
889
|
}
|
|
826
|
-
return
|
|
890
|
+
return _context12.abrupt("return", normalizedLocalCustomer);
|
|
827
891
|
case 5:
|
|
828
|
-
|
|
892
|
+
_context12.next = 7;
|
|
829
893
|
return this.store.customer.queryCustomerList({
|
|
830
894
|
ids: [customerId],
|
|
831
895
|
skip: 1,
|
|
832
896
|
num: 1
|
|
833
897
|
});
|
|
834
898
|
case 7:
|
|
835
|
-
result =
|
|
899
|
+
result = _context12.sent;
|
|
836
900
|
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
901
|
if (!remoteCustomer) {
|
|
838
|
-
|
|
902
|
+
_context12.next = 11;
|
|
839
903
|
break;
|
|
840
904
|
}
|
|
841
|
-
return
|
|
905
|
+
return _context12.abrupt("return", this.normalizeCustomer(remoteCustomer));
|
|
842
906
|
case 11:
|
|
843
|
-
|
|
844
|
-
|
|
907
|
+
_context12.prev = 11;
|
|
908
|
+
_context12.next = 14;
|
|
845
909
|
return this.store.customer.queryCustomerDetail(customerId);
|
|
846
910
|
case 14:
|
|
847
|
-
detailCustomer =
|
|
848
|
-
return
|
|
911
|
+
detailCustomer = _context12.sent;
|
|
912
|
+
return _context12.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
|
|
849
913
|
case 18:
|
|
850
|
-
|
|
851
|
-
|
|
914
|
+
_context12.prev = 18;
|
|
915
|
+
_context12.t0 = _context12["catch"](11);
|
|
852
916
|
console.warn('[BookingTicket] resolveCustomerById detail request failed', {
|
|
853
917
|
customerId: customerId,
|
|
854
|
-
error:
|
|
918
|
+
error: _context12.t0
|
|
855
919
|
});
|
|
856
|
-
return
|
|
920
|
+
return _context12.abrupt("return", null);
|
|
857
921
|
case 22:
|
|
858
922
|
case "end":
|
|
859
|
-
return
|
|
923
|
+
return _context12.stop();
|
|
860
924
|
}
|
|
861
|
-
},
|
|
925
|
+
}, _callee12, this, [[11, 18]]);
|
|
862
926
|
}));
|
|
863
|
-
function resolveCustomerById(
|
|
927
|
+
function resolveCustomerById(_x7) {
|
|
864
928
|
return _resolveCustomerById.apply(this, arguments);
|
|
865
929
|
}
|
|
866
930
|
return resolveCustomerById;
|
|
@@ -926,62 +990,62 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
926
990
|
}, {
|
|
927
991
|
key: "setBookingStatus",
|
|
928
992
|
value: (function () {
|
|
929
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
993
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(status) {
|
|
930
994
|
var _this$store$order2, _this$store$order2$ge;
|
|
931
995
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
932
|
-
return _regeneratorRuntime().wrap(function
|
|
933
|
-
while (1) switch (
|
|
996
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
997
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
934
998
|
case 0:
|
|
935
999
|
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
1000
|
if (tempOrder) {
|
|
937
|
-
|
|
1001
|
+
_context13.next = 3;
|
|
938
1002
|
break;
|
|
939
1003
|
}
|
|
940
1004
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
941
1005
|
case 3:
|
|
942
1006
|
orderId = tempOrder.order_id;
|
|
943
1007
|
if (!(orderId === undefined || orderId === null)) {
|
|
944
|
-
|
|
1008
|
+
_context13.next = 6;
|
|
945
1009
|
break;
|
|
946
1010
|
}
|
|
947
1011
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
948
1012
|
case 6:
|
|
949
1013
|
scheduleId = resolveScheduleId(tempOrder);
|
|
950
1014
|
if (!(scheduleId === null)) {
|
|
951
|
-
|
|
1015
|
+
_context13.next = 9;
|
|
952
1016
|
break;
|
|
953
1017
|
}
|
|
954
1018
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
955
1019
|
case 9:
|
|
956
1020
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
957
1021
|
previous = applyBookingsStatus(bookings, status);
|
|
958
|
-
|
|
959
|
-
|
|
1022
|
+
_context13.prev = 11;
|
|
1023
|
+
_context13.next = 14;
|
|
960
1024
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
961
1025
|
appointment_status: status
|
|
962
1026
|
});
|
|
963
1027
|
case 14:
|
|
964
|
-
res =
|
|
965
|
-
|
|
1028
|
+
res = _context13.sent;
|
|
1029
|
+
_context13.next = 17;
|
|
966
1030
|
return this.refreshSalesDetail();
|
|
967
1031
|
case 17:
|
|
968
1032
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
969
1033
|
orderId: orderId,
|
|
970
1034
|
status: status
|
|
971
1035
|
});
|
|
972
|
-
return
|
|
1036
|
+
return _context13.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
973
1037
|
case 21:
|
|
974
|
-
|
|
975
|
-
|
|
1038
|
+
_context13.prev = 21;
|
|
1039
|
+
_context13.t0 = _context13["catch"](11);
|
|
976
1040
|
restoreBookingsStatus(bookings, previous);
|
|
977
|
-
throw
|
|
1041
|
+
throw _context13.t0;
|
|
978
1042
|
case 25:
|
|
979
1043
|
case "end":
|
|
980
|
-
return
|
|
1044
|
+
return _context13.stop();
|
|
981
1045
|
}
|
|
982
|
-
},
|
|
1046
|
+
}, _callee13, this, [[11, 21]]);
|
|
983
1047
|
}));
|
|
984
|
-
function setBookingStatus(
|
|
1048
|
+
function setBookingStatus(_x8) {
|
|
985
1049
|
return _setBookingStatus.apply(this, arguments);
|
|
986
1050
|
}
|
|
987
1051
|
return setBookingStatus;
|
|
@@ -1010,35 +1074,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1010
1074
|
}, {
|
|
1011
1075
|
key: "transitionChildBooking",
|
|
1012
1076
|
value: (function () {
|
|
1013
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1077
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
|
|
1014
1078
|
var _this$store$order3, _this$store$order3$ge;
|
|
1015
1079
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
1016
|
-
return _regeneratorRuntime().wrap(function
|
|
1017
|
-
while (1) switch (
|
|
1080
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1081
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1018
1082
|
case 0:
|
|
1019
1083
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
1020
1084
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
1021
|
-
|
|
1085
|
+
_context14.next = 3;
|
|
1022
1086
|
break;
|
|
1023
1087
|
}
|
|
1024
1088
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
1025
1089
|
case 3:
|
|
1026
1090
|
if (action) {
|
|
1027
|
-
|
|
1091
|
+
_context14.next = 5;
|
|
1028
1092
|
break;
|
|
1029
1093
|
}
|
|
1030
1094
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
1031
1095
|
case 5:
|
|
1032
1096
|
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
1097
|
if (tempOrder) {
|
|
1034
|
-
|
|
1098
|
+
_context14.next = 8;
|
|
1035
1099
|
break;
|
|
1036
1100
|
}
|
|
1037
1101
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
1038
1102
|
case 8:
|
|
1039
1103
|
orderId = tempOrder.order_id;
|
|
1040
1104
|
if (!(orderId === undefined || orderId === null)) {
|
|
1041
|
-
|
|
1105
|
+
_context14.next = 11;
|
|
1042
1106
|
break;
|
|
1043
1107
|
}
|
|
1044
1108
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -1046,14 +1110,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1046
1110
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
1047
1111
|
targetStatus = resolveStatusAfterTransition(action);
|
|
1048
1112
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
1049
|
-
|
|
1050
|
-
|
|
1113
|
+
_context14.prev = 14;
|
|
1114
|
+
_context14.next = 17;
|
|
1051
1115
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
1052
1116
|
action: action
|
|
1053
1117
|
});
|
|
1054
1118
|
case 17:
|
|
1055
|
-
res =
|
|
1056
|
-
|
|
1119
|
+
res = _context14.sent;
|
|
1120
|
+
_context14.next = 20;
|
|
1057
1121
|
return this.refreshSalesDetail();
|
|
1058
1122
|
case 20:
|
|
1059
1123
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -1062,21 +1126,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1062
1126
|
action: action,
|
|
1063
1127
|
status: targetStatus
|
|
1064
1128
|
});
|
|
1065
|
-
return
|
|
1129
|
+
return _context14.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
1066
1130
|
case 24:
|
|
1067
|
-
|
|
1068
|
-
|
|
1131
|
+
_context14.prev = 24;
|
|
1132
|
+
_context14.t0 = _context14["catch"](14);
|
|
1069
1133
|
if (previous !== undefined) {
|
|
1070
1134
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
1071
1135
|
}
|
|
1072
|
-
throw
|
|
1136
|
+
throw _context14.t0;
|
|
1073
1137
|
case 28:
|
|
1074
1138
|
case "end":
|
|
1075
|
-
return
|
|
1139
|
+
return _context14.stop();
|
|
1076
1140
|
}
|
|
1077
|
-
},
|
|
1141
|
+
}, _callee14, this, [[14, 24]]);
|
|
1078
1142
|
}));
|
|
1079
|
-
function transitionChildBooking(
|
|
1143
|
+
function transitionChildBooking(_x9) {
|
|
1080
1144
|
return _transitionChildBooking.apply(this, arguments);
|
|
1081
1145
|
}
|
|
1082
1146
|
return transitionChildBooking;
|
|
@@ -1095,19 +1159,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1095
1159
|
}, {
|
|
1096
1160
|
key: "refreshSalesDetail",
|
|
1097
1161
|
value: (function () {
|
|
1098
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1162
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1099
1163
|
var _this$store$order4, _this$store$order4$ge;
|
|
1100
1164
|
var params,
|
|
1101
1165
|
tempOrder,
|
|
1102
1166
|
orderId,
|
|
1103
|
-
|
|
1104
|
-
return _regeneratorRuntime().wrap(function
|
|
1105
|
-
while (1) switch (
|
|
1167
|
+
_args15 = arguments;
|
|
1168
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1169
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1106
1170
|
case 0:
|
|
1107
|
-
params =
|
|
1171
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
1108
1172
|
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
1173
|
if (tempOrder) {
|
|
1110
|
-
|
|
1174
|
+
_context15.next = 4;
|
|
1111
1175
|
break;
|
|
1112
1176
|
}
|
|
1113
1177
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1115,21 +1179,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1115
1179
|
debugger;
|
|
1116
1180
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1117
1181
|
if (!(orderId === undefined || orderId === null)) {
|
|
1118
|
-
|
|
1182
|
+
_context15.next = 8;
|
|
1119
1183
|
break;
|
|
1120
1184
|
}
|
|
1121
|
-
return
|
|
1185
|
+
return _context15.abrupt("return", {});
|
|
1122
1186
|
case 8:
|
|
1123
|
-
return
|
|
1187
|
+
return _context15.abrupt("return", this.loadSalesDetail({
|
|
1124
1188
|
orderId: orderId,
|
|
1125
1189
|
// merge: true
|
|
1126
1190
|
forceRemote: params.forceRemote
|
|
1127
1191
|
}));
|
|
1128
1192
|
case 9:
|
|
1129
1193
|
case "end":
|
|
1130
|
-
return
|
|
1194
|
+
return _context15.stop();
|
|
1131
1195
|
}
|
|
1132
|
-
},
|
|
1196
|
+
}, _callee15, this);
|
|
1133
1197
|
}));
|
|
1134
1198
|
function refreshSalesDetail() {
|
|
1135
1199
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1145,7 +1209,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1145
1209
|
}, {
|
|
1146
1210
|
key: "loadProducts",
|
|
1147
1211
|
value: (function () {
|
|
1148
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1212
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1149
1213
|
var params,
|
|
1150
1214
|
options,
|
|
1151
1215
|
schedule_date,
|
|
@@ -1154,20 +1218,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1154
1218
|
schedule_datetime,
|
|
1155
1219
|
bookingDate,
|
|
1156
1220
|
_result,
|
|
1157
|
-
|
|
1158
|
-
return _regeneratorRuntime().wrap(function
|
|
1159
|
-
while (1) switch (
|
|
1221
|
+
_args16 = arguments;
|
|
1222
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1223
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1160
1224
|
case 0:
|
|
1161
|
-
params =
|
|
1162
|
-
options =
|
|
1225
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
1226
|
+
options = _args16.length > 1 ? _args16[1] : undefined;
|
|
1163
1227
|
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
1228
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1165
1229
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1166
1230
|
if (bookingDate) {
|
|
1167
1231
|
this.setBookingDate(bookingDate);
|
|
1168
1232
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1233
|
+
_context16.prev = 5;
|
|
1234
|
+
_context16.next = 8;
|
|
1171
1235
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1172
1236
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1173
1237
|
with_schedule: 1
|
|
@@ -1175,20 +1239,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1175
1239
|
cacheId: this.cacheId
|
|
1176
1240
|
}), options);
|
|
1177
1241
|
case 8:
|
|
1178
|
-
_result =
|
|
1242
|
+
_result = _context16.sent;
|
|
1179
1243
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1180
1244
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1181
|
-
return
|
|
1245
|
+
return _context16.abrupt("return", _result);
|
|
1182
1246
|
case 14:
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
console.error('Failed to load products:',
|
|
1186
|
-
throw
|
|
1247
|
+
_context16.prev = 14;
|
|
1248
|
+
_context16.t0 = _context16["catch"](5);
|
|
1249
|
+
console.error('Failed to load products:', _context16.t0);
|
|
1250
|
+
throw _context16.t0;
|
|
1187
1251
|
case 18:
|
|
1188
1252
|
case "end":
|
|
1189
|
-
return
|
|
1253
|
+
return _context16.stop();
|
|
1190
1254
|
}
|
|
1191
|
-
},
|
|
1255
|
+
}, _callee16, this, [[5, 14]]);
|
|
1192
1256
|
}));
|
|
1193
1257
|
function loadProducts() {
|
|
1194
1258
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1205,27 +1269,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1205
1269
|
}, {
|
|
1206
1270
|
key: "getAddTimeProducts",
|
|
1207
1271
|
value: (function () {
|
|
1208
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1272
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1209
1273
|
var params,
|
|
1210
1274
|
result,
|
|
1211
|
-
|
|
1212
|
-
return _regeneratorRuntime().wrap(function
|
|
1213
|
-
while (1) switch (
|
|
1275
|
+
_args17 = arguments;
|
|
1276
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1277
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1214
1278
|
case 0:
|
|
1215
|
-
params =
|
|
1216
|
-
|
|
1279
|
+
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1280
|
+
_context17.next = 3;
|
|
1217
1281
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1218
1282
|
cacheId: this.cacheId
|
|
1219
1283
|
}));
|
|
1220
1284
|
case 3:
|
|
1221
|
-
result =
|
|
1285
|
+
result = _context17.sent;
|
|
1222
1286
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1223
|
-
return
|
|
1287
|
+
return _context17.abrupt("return", result);
|
|
1224
1288
|
case 6:
|
|
1225
1289
|
case "end":
|
|
1226
|
-
return
|
|
1290
|
+
return _context17.stop();
|
|
1227
1291
|
}
|
|
1228
|
-
},
|
|
1292
|
+
}, _callee17, this);
|
|
1229
1293
|
}));
|
|
1230
1294
|
function getAddTimeProducts() {
|
|
1231
1295
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1250,14 +1314,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1250
1314
|
}, {
|
|
1251
1315
|
key: "queryProductDetail",
|
|
1252
1316
|
value: (function () {
|
|
1253
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1317
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
|
|
1254
1318
|
var product_id, queryParams, _result2, list;
|
|
1255
|
-
return _regeneratorRuntime().wrap(function
|
|
1256
|
-
while (1) switch (
|
|
1319
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1320
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1257
1321
|
case 0:
|
|
1258
1322
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1259
|
-
|
|
1260
|
-
|
|
1323
|
+
_context18.prev = 1;
|
|
1324
|
+
_context18.next = 4;
|
|
1261
1325
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1262
1326
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1263
1327
|
with_schedule: 1
|
|
@@ -1266,23 +1330,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1266
1330
|
cacheId: this.cacheId
|
|
1267
1331
|
}), options);
|
|
1268
1332
|
case 4:
|
|
1269
|
-
_result2 =
|
|
1333
|
+
_result2 = _context18.sent;
|
|
1270
1334
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1271
|
-
return
|
|
1335
|
+
return _context18.abrupt("return", list.find(function (product) {
|
|
1272
1336
|
return Number(product.id) === Number(product_id);
|
|
1273
1337
|
}));
|
|
1274
1338
|
case 9:
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
console.error('Failed to query product detail:',
|
|
1278
|
-
throw
|
|
1339
|
+
_context18.prev = 9;
|
|
1340
|
+
_context18.t0 = _context18["catch"](1);
|
|
1341
|
+
console.error('Failed to query product detail:', _context18.t0);
|
|
1342
|
+
throw _context18.t0;
|
|
1279
1343
|
case 13:
|
|
1280
1344
|
case "end":
|
|
1281
|
-
return
|
|
1345
|
+
return _context18.stop();
|
|
1282
1346
|
}
|
|
1283
|
-
},
|
|
1347
|
+
}, _callee18, this, [[1, 9]]);
|
|
1284
1348
|
}));
|
|
1285
|
-
function queryProductDetail(
|
|
1349
|
+
function queryProductDetail(_x10, _x11) {
|
|
1286
1350
|
return _queryProductDetail.apply(this, arguments);
|
|
1287
1351
|
}
|
|
1288
1352
|
return queryProductDetail;
|
|
@@ -1295,28 +1359,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1295
1359
|
}, {
|
|
1296
1360
|
key: "loadProductDetail",
|
|
1297
1361
|
value: (function () {
|
|
1298
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1362
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
|
|
1299
1363
|
var product_id, queryParams, products;
|
|
1300
|
-
return _regeneratorRuntime().wrap(function
|
|
1301
|
-
while (1) switch (
|
|
1364
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1365
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1302
1366
|
case 0:
|
|
1303
1367
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1304
|
-
|
|
1368
|
+
_context19.next = 3;
|
|
1305
1369
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1306
1370
|
product_ids: [product_id]
|
|
1307
1371
|
}), options);
|
|
1308
1372
|
case 3:
|
|
1309
|
-
products =
|
|
1310
|
-
return
|
|
1373
|
+
products = _context19.sent;
|
|
1374
|
+
return _context19.abrupt("return", products.find(function (product) {
|
|
1311
1375
|
return Number(product.id) === Number(product_id);
|
|
1312
1376
|
}));
|
|
1313
1377
|
case 5:
|
|
1314
1378
|
case "end":
|
|
1315
|
-
return
|
|
1379
|
+
return _context19.stop();
|
|
1316
1380
|
}
|
|
1317
|
-
},
|
|
1381
|
+
}, _callee19, this);
|
|
1318
1382
|
}));
|
|
1319
|
-
function loadProductDetail(
|
|
1383
|
+
function loadProductDetail(_x12, _x13) {
|
|
1320
1384
|
return _loadProductDetail.apply(this, arguments);
|
|
1321
1385
|
}
|
|
1322
1386
|
return loadProductDetail;
|
|
@@ -1349,16 +1413,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1349
1413
|
}, {
|
|
1350
1414
|
key: "getProducts",
|
|
1351
1415
|
value: (function () {
|
|
1352
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1353
|
-
return _regeneratorRuntime().wrap(function
|
|
1354
|
-
while (1) switch (
|
|
1416
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1417
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1418
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1355
1419
|
case 0:
|
|
1356
|
-
return
|
|
1420
|
+
return _context20.abrupt("return", this.store.products.getProducts());
|
|
1357
1421
|
case 1:
|
|
1358
1422
|
case "end":
|
|
1359
|
-
return
|
|
1423
|
+
return _context20.stop();
|
|
1360
1424
|
}
|
|
1361
|
-
},
|
|
1425
|
+
}, _callee20, this);
|
|
1362
1426
|
}));
|
|
1363
1427
|
function getProducts() {
|
|
1364
1428
|
return _getProducts.apply(this, arguments);
|
|
@@ -1388,8 +1452,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1388
1452
|
}, {
|
|
1389
1453
|
key: "getCart",
|
|
1390
1454
|
value: function getCart() {
|
|
1391
|
-
var _this$store$order$
|
|
1392
|
-
var tempOrder = (_this$store$order$
|
|
1455
|
+
var _this$store$order$get2, _this$store$order5, _salesDetail$bookings, _operatingDayBoundary, _operatingDayBoundary2, _tempOrder$_extend;
|
|
1456
|
+
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
1457
|
var salesDetail = this.getSalesOrder();
|
|
1394
1458
|
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
1459
|
var operatingDayBoundary;
|
|
@@ -1423,33 +1487,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1423
1487
|
}, {
|
|
1424
1488
|
key: "getProductByIds",
|
|
1425
1489
|
value: (function () {
|
|
1426
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1490
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(ids, options) {
|
|
1427
1491
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1428
1492
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1429
|
-
return _regeneratorRuntime().wrap(function
|
|
1430
|
-
while (1) switch (
|
|
1493
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1494
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1431
1495
|
case 0:
|
|
1432
1496
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1433
1497
|
return Number(id);
|
|
1434
1498
|
}).filter(function (id) {
|
|
1435
1499
|
return Number.isFinite(id);
|
|
1436
1500
|
})));
|
|
1437
|
-
|
|
1501
|
+
_context21.next = 3;
|
|
1438
1502
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1439
1503
|
case 3:
|
|
1440
|
-
|
|
1441
|
-
if (
|
|
1442
|
-
|
|
1504
|
+
_context21.t0 = _context21.sent;
|
|
1505
|
+
if (_context21.t0) {
|
|
1506
|
+
_context21.next = 6;
|
|
1443
1507
|
break;
|
|
1444
1508
|
}
|
|
1445
|
-
|
|
1509
|
+
_context21.t0 = [];
|
|
1446
1510
|
case 6:
|
|
1447
|
-
localProducts =
|
|
1511
|
+
localProducts = _context21.t0;
|
|
1448
1512
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1449
|
-
|
|
1513
|
+
_context21.next = 9;
|
|
1450
1514
|
break;
|
|
1451
1515
|
}
|
|
1452
|
-
return
|
|
1516
|
+
return _context21.abrupt("return", localProducts);
|
|
1453
1517
|
case 9:
|
|
1454
1518
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1455
1519
|
return Number(product.id);
|
|
@@ -1458,15 +1522,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1458
1522
|
return !localProductIds.has(id);
|
|
1459
1523
|
});
|
|
1460
1524
|
if (missingIds.length) {
|
|
1461
|
-
|
|
1525
|
+
_context21.next = 13;
|
|
1462
1526
|
break;
|
|
1463
1527
|
}
|
|
1464
|
-
return
|
|
1528
|
+
return _context21.abrupt("return", localProducts);
|
|
1465
1529
|
case 13:
|
|
1466
1530
|
rawBookingDate = this.getBookingDate();
|
|
1467
1531
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1468
1532
|
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
|
-
|
|
1533
|
+
_context21.next = 18;
|
|
1470
1534
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1471
1535
|
product_ids: missingIds,
|
|
1472
1536
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1479,7 +1543,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1479
1543
|
customer_id: customerId
|
|
1480
1544
|
} : {}));
|
|
1481
1545
|
case 18:
|
|
1482
|
-
loadedProducts =
|
|
1546
|
+
loadedProducts = _context21.sent;
|
|
1483
1547
|
productById = new Map();
|
|
1484
1548
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1485
1549
|
var productId = Number(product.id);
|
|
@@ -1487,18 +1551,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1487
1551
|
productById.set(productId, product);
|
|
1488
1552
|
}
|
|
1489
1553
|
});
|
|
1490
|
-
return
|
|
1554
|
+
return _context21.abrupt("return", normalizedIds.map(function (id) {
|
|
1491
1555
|
return productById.get(id);
|
|
1492
1556
|
}).filter(function (product) {
|
|
1493
1557
|
return Boolean(product);
|
|
1494
1558
|
}));
|
|
1495
1559
|
case 22:
|
|
1496
1560
|
case "end":
|
|
1497
|
-
return
|
|
1561
|
+
return _context21.stop();
|
|
1498
1562
|
}
|
|
1499
|
-
},
|
|
1563
|
+
}, _callee21, this);
|
|
1500
1564
|
}));
|
|
1501
|
-
function getProductByIds(
|
|
1565
|
+
function getProductByIds(_x14, _x15) {
|
|
1502
1566
|
return _getProductByIds.apply(this, arguments);
|
|
1503
1567
|
}
|
|
1504
1568
|
return getProductByIds;
|
|
@@ -1512,27 +1576,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1512
1576
|
}, {
|
|
1513
1577
|
key: "getScheduleTimePoints",
|
|
1514
1578
|
value: (function () {
|
|
1515
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1579
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
1516
1580
|
var result;
|
|
1517
|
-
return _regeneratorRuntime().wrap(function
|
|
1518
|
-
while (1) switch (
|
|
1581
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1582
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1519
1583
|
case 0:
|
|
1520
|
-
|
|
1584
|
+
_context22.next = 2;
|
|
1521
1585
|
return this.request.post('/menu/schedule-time-points', {
|
|
1522
1586
|
menu_list_ids: params.menu_list_ids
|
|
1523
1587
|
}, {
|
|
1524
1588
|
osServer: true
|
|
1525
1589
|
});
|
|
1526
1590
|
case 2:
|
|
1527
|
-
result =
|
|
1528
|
-
return
|
|
1591
|
+
result = _context22.sent;
|
|
1592
|
+
return _context22.abrupt("return", result.data || []);
|
|
1529
1593
|
case 4:
|
|
1530
1594
|
case "end":
|
|
1531
|
-
return
|
|
1595
|
+
return _context22.stop();
|
|
1532
1596
|
}
|
|
1533
|
-
},
|
|
1597
|
+
}, _callee22, this);
|
|
1534
1598
|
}));
|
|
1535
|
-
function getScheduleTimePoints(
|
|
1599
|
+
function getScheduleTimePoints(_x16) {
|
|
1536
1600
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
1537
1601
|
}
|
|
1538
1602
|
return getScheduleTimePoints;
|
|
@@ -1546,30 +1610,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1546
1610
|
}, {
|
|
1547
1611
|
key: "getCustomerList",
|
|
1548
1612
|
value: (function () {
|
|
1549
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1613
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1550
1614
|
var params,
|
|
1551
1615
|
_result3,
|
|
1552
|
-
|
|
1553
|
-
return _regeneratorRuntime().wrap(function
|
|
1554
|
-
while (1) switch (
|
|
1616
|
+
_args23 = arguments;
|
|
1617
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1618
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1555
1619
|
case 0:
|
|
1556
|
-
params =
|
|
1557
|
-
|
|
1558
|
-
|
|
1620
|
+
params = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
1621
|
+
_context23.prev = 1;
|
|
1622
|
+
_context23.next = 4;
|
|
1559
1623
|
return this.store.customer.getCustomerList(params);
|
|
1560
1624
|
case 4:
|
|
1561
|
-
_result3 =
|
|
1562
|
-
return
|
|
1625
|
+
_result3 = _context23.sent;
|
|
1626
|
+
return _context23.abrupt("return", _result3);
|
|
1563
1627
|
case 8:
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
console.error('Failed to get customer list:',
|
|
1567
|
-
throw
|
|
1628
|
+
_context23.prev = 8;
|
|
1629
|
+
_context23.t0 = _context23["catch"](1);
|
|
1630
|
+
console.error('Failed to get customer list:', _context23.t0);
|
|
1631
|
+
throw _context23.t0;
|
|
1568
1632
|
case 12:
|
|
1569
1633
|
case "end":
|
|
1570
|
-
return
|
|
1634
|
+
return _context23.stop();
|
|
1571
1635
|
}
|
|
1572
|
-
},
|
|
1636
|
+
}, _callee23, this, [[1, 8]]);
|
|
1573
1637
|
}));
|
|
1574
1638
|
function getCustomerList() {
|
|
1575
1639
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1676,13 +1740,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1676
1740
|
}, {
|
|
1677
1741
|
key: "setOrderCustomer",
|
|
1678
1742
|
value: function setOrderCustomer(customer, options) {
|
|
1679
|
-
var _this$store$order$
|
|
1743
|
+
var _this$store$order$get3,
|
|
1680
1744
|
_this3 = this;
|
|
1681
1745
|
if (!customer) {
|
|
1682
1746
|
this.clearOrderCustomer();
|
|
1683
1747
|
return;
|
|
1684
1748
|
}
|
|
1685
|
-
var previousCustomerId = (_this$store$order$
|
|
1749
|
+
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
1750
|
var snapshotBeforeSet = this.store.order.getOrderCustomerSnapshot();
|
|
1687
1751
|
var patch = formatOrderCustomerPatch(customer);
|
|
1688
1752
|
var customerUnchanged = Number(previousCustomerId || 0) === Number(patch.customer_id || 0);
|
|
@@ -1789,24 +1853,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1789
1853
|
}, {
|
|
1790
1854
|
key: "restoreOrder",
|
|
1791
1855
|
value: (function () {
|
|
1792
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1856
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1793
1857
|
var _this$store$customer;
|
|
1794
1858
|
var tempOrder;
|
|
1795
|
-
return _regeneratorRuntime().wrap(function
|
|
1796
|
-
while (1) switch (
|
|
1859
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1860
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1797
1861
|
case 0:
|
|
1798
|
-
|
|
1862
|
+
_context24.next = 2;
|
|
1799
1863
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1800
1864
|
case 2:
|
|
1801
|
-
tempOrder =
|
|
1865
|
+
tempOrder = _context24.sent;
|
|
1802
1866
|
this.clearOrderCustomer();
|
|
1803
1867
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1804
|
-
return
|
|
1868
|
+
return _context24.abrupt("return", tempOrder);
|
|
1805
1869
|
case 6:
|
|
1806
1870
|
case "end":
|
|
1807
|
-
return
|
|
1871
|
+
return _context24.stop();
|
|
1808
1872
|
}
|
|
1809
|
-
},
|
|
1873
|
+
}, _callee24, this);
|
|
1810
1874
|
}));
|
|
1811
1875
|
function restoreOrder() {
|
|
1812
1876
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1832,41 +1896,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1832
1896
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1833
1897
|
}
|
|
1834
1898
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1835
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1899
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
1836
1900
|
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1837
1901
|
var currentCustomer, tempOrder, orderId, action;
|
|
1838
|
-
return _regeneratorRuntime().wrap(function
|
|
1839
|
-
while (1) switch (
|
|
1902
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1903
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1840
1904
|
case 0:
|
|
1841
1905
|
if (!previousRefresh) {
|
|
1842
|
-
|
|
1906
|
+
_context25.next = 3;
|
|
1843
1907
|
break;
|
|
1844
1908
|
}
|
|
1845
|
-
|
|
1909
|
+
_context25.next = 3;
|
|
1846
1910
|
return previousRefresh.catch(function () {
|
|
1847
1911
|
return undefined;
|
|
1848
1912
|
});
|
|
1849
1913
|
case 3:
|
|
1850
1914
|
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1851
1915
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1852
|
-
|
|
1916
|
+
_context25.next = 6;
|
|
1853
1917
|
break;
|
|
1854
1918
|
}
|
|
1855
|
-
return
|
|
1919
|
+
return _context25.abrupt("return");
|
|
1856
1920
|
case 6:
|
|
1857
1921
|
tempOrder = (_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);
|
|
1858
1922
|
orderId = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this5$getOrderIdenti = _this5.getOrderIdentity) === null || _this5$getOrderIdenti === void 0 || (_this5$getOrderIdenti = _this5$getOrderIdenti.call(_this5)) === null || _this5$getOrderIdenti === void 0 ? void 0 : _this5$getOrderIdenti.orderId);
|
|
1859
1923
|
action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1860
|
-
|
|
1924
|
+
_context25.next = 11;
|
|
1861
1925
|
return _this5.loadDiscountConfig({
|
|
1862
1926
|
customerId: customerId,
|
|
1863
1927
|
action: action
|
|
1864
1928
|
});
|
|
1865
1929
|
case 11:
|
|
1866
1930
|
case "end":
|
|
1867
|
-
return
|
|
1931
|
+
return _context25.stop();
|
|
1868
1932
|
}
|
|
1869
|
-
},
|
|
1933
|
+
}, _callee25);
|
|
1870
1934
|
}))();
|
|
1871
1935
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1872
1936
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1887,30 +1951,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1887
1951
|
}, {
|
|
1888
1952
|
key: "prepareProductPriceQueryContext",
|
|
1889
1953
|
value: function () {
|
|
1890
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1954
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(customerId) {
|
|
1891
1955
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1892
|
-
return _regeneratorRuntime().wrap(function
|
|
1893
|
-
while (1) switch (
|
|
1956
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1957
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1894
1958
|
case 0:
|
|
1895
|
-
|
|
1959
|
+
_context26.next = 2;
|
|
1896
1960
|
return Promise.resolve();
|
|
1897
1961
|
case 2:
|
|
1898
1962
|
normalizedCustomerId = Number(customerId || 0);
|
|
1899
1963
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1900
1964
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1901
1965
|
if (!(shouldWait && refreshTask)) {
|
|
1902
|
-
|
|
1966
|
+
_context26.next = 8;
|
|
1903
1967
|
break;
|
|
1904
1968
|
}
|
|
1905
|
-
|
|
1969
|
+
_context26.next = 8;
|
|
1906
1970
|
return refreshTask;
|
|
1907
1971
|
case 8:
|
|
1908
1972
|
case "end":
|
|
1909
|
-
return
|
|
1973
|
+
return _context26.stop();
|
|
1910
1974
|
}
|
|
1911
|
-
},
|
|
1975
|
+
}, _callee26, this);
|
|
1912
1976
|
}));
|
|
1913
|
-
function prepareProductPriceQueryContext(
|
|
1977
|
+
function prepareProductPriceQueryContext(_x17) {
|
|
1914
1978
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
1915
1979
|
}
|
|
1916
1980
|
return prepareProductPriceQueryContext;
|
|
@@ -1963,29 +2027,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1963
2027
|
}, {
|
|
1964
2028
|
key: "changeCustomerPage",
|
|
1965
2029
|
value: (function () {
|
|
1966
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2030
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(page, pageSize) {
|
|
1967
2031
|
var _result4;
|
|
1968
|
-
return _regeneratorRuntime().wrap(function
|
|
1969
|
-
while (1) switch (
|
|
2032
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2033
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1970
2034
|
case 0:
|
|
1971
|
-
|
|
1972
|
-
|
|
2035
|
+
_context27.prev = 0;
|
|
2036
|
+
_context27.next = 3;
|
|
1973
2037
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
1974
2038
|
case 3:
|
|
1975
|
-
_result4 =
|
|
1976
|
-
return
|
|
2039
|
+
_result4 = _context27.sent;
|
|
2040
|
+
return _context27.abrupt("return", _result4);
|
|
1977
2041
|
case 7:
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
console.error('Failed to change customer page:',
|
|
1981
|
-
throw
|
|
2042
|
+
_context27.prev = 7;
|
|
2043
|
+
_context27.t0 = _context27["catch"](0);
|
|
2044
|
+
console.error('Failed to change customer page:', _context27.t0);
|
|
2045
|
+
throw _context27.t0;
|
|
1982
2046
|
case 11:
|
|
1983
2047
|
case "end":
|
|
1984
|
-
return
|
|
2048
|
+
return _context27.stop();
|
|
1985
2049
|
}
|
|
1986
|
-
},
|
|
2050
|
+
}, _callee27, this, [[0, 7]]);
|
|
1987
2051
|
}));
|
|
1988
|
-
function changeCustomerPage(
|
|
2052
|
+
function changeCustomerPage(_x18, _x19) {
|
|
1989
2053
|
return _changeCustomerPage.apply(this, arguments);
|
|
1990
2054
|
}
|
|
1991
2055
|
return changeCustomerPage;
|
|
@@ -1998,28 +2062,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1998
2062
|
}, {
|
|
1999
2063
|
key: "loadMoreCustomers",
|
|
2000
2064
|
value: (function () {
|
|
2001
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2065
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2002
2066
|
var _result5;
|
|
2003
|
-
return _regeneratorRuntime().wrap(function
|
|
2004
|
-
while (1) switch (
|
|
2067
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2068
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2005
2069
|
case 0:
|
|
2006
|
-
|
|
2007
|
-
|
|
2070
|
+
_context28.prev = 0;
|
|
2071
|
+
_context28.next = 3;
|
|
2008
2072
|
return this.store.customer.loadMoreCustomers();
|
|
2009
2073
|
case 3:
|
|
2010
|
-
_result5 =
|
|
2074
|
+
_result5 = _context28.sent;
|
|
2011
2075
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
2012
|
-
return
|
|
2076
|
+
return _context28.abrupt("return", _result5);
|
|
2013
2077
|
case 8:
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
console.error('Failed to load more customers:',
|
|
2017
|
-
throw
|
|
2078
|
+
_context28.prev = 8;
|
|
2079
|
+
_context28.t0 = _context28["catch"](0);
|
|
2080
|
+
console.error('Failed to load more customers:', _context28.t0);
|
|
2081
|
+
throw _context28.t0;
|
|
2018
2082
|
case 12:
|
|
2019
2083
|
case "end":
|
|
2020
|
-
return
|
|
2084
|
+
return _context28.stop();
|
|
2021
2085
|
}
|
|
2022
|
-
},
|
|
2086
|
+
}, _callee28, this, [[0, 8]]);
|
|
2023
2087
|
}));
|
|
2024
2088
|
function loadMoreCustomers() {
|
|
2025
2089
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -2035,31 +2099,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2035
2099
|
}, {
|
|
2036
2100
|
key: "resetAndLoadCustomers",
|
|
2037
2101
|
value: (function () {
|
|
2038
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2102
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2039
2103
|
var params,
|
|
2040
2104
|
_result6,
|
|
2041
|
-
|
|
2042
|
-
return _regeneratorRuntime().wrap(function
|
|
2043
|
-
while (1) switch (
|
|
2105
|
+
_args29 = arguments;
|
|
2106
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2107
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2044
2108
|
case 0:
|
|
2045
|
-
params =
|
|
2046
|
-
|
|
2047
|
-
|
|
2109
|
+
params = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
|
|
2110
|
+
_context29.prev = 1;
|
|
2111
|
+
_context29.next = 4;
|
|
2048
2112
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
2049
2113
|
case 4:
|
|
2050
|
-
_result6 =
|
|
2114
|
+
_result6 = _context29.sent;
|
|
2051
2115
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
2052
|
-
return
|
|
2116
|
+
return _context29.abrupt("return", _result6);
|
|
2053
2117
|
case 9:
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
console.error('Failed to reset and load customers:',
|
|
2057
|
-
throw
|
|
2118
|
+
_context29.prev = 9;
|
|
2119
|
+
_context29.t0 = _context29["catch"](1);
|
|
2120
|
+
console.error('Failed to reset and load customers:', _context29.t0);
|
|
2121
|
+
throw _context29.t0;
|
|
2058
2122
|
case 13:
|
|
2059
2123
|
case "end":
|
|
2060
|
-
return
|
|
2124
|
+
return _context29.stop();
|
|
2061
2125
|
}
|
|
2062
|
-
},
|
|
2126
|
+
}, _callee29, this, [[1, 9]]);
|
|
2063
2127
|
}));
|
|
2064
2128
|
function resetAndLoadCustomers() {
|
|
2065
2129
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2220,16 +2284,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2220
2284
|
}, {
|
|
2221
2285
|
key: "getOtherParams",
|
|
2222
2286
|
value: (function () {
|
|
2223
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2224
|
-
return _regeneratorRuntime().wrap(function
|
|
2225
|
-
while (1) switch (
|
|
2287
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2288
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2289
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2226
2290
|
case 0:
|
|
2227
|
-
return
|
|
2291
|
+
return _context30.abrupt("return", this.otherParams);
|
|
2228
2292
|
case 1:
|
|
2229
2293
|
case "end":
|
|
2230
|
-
return
|
|
2294
|
+
return _context30.stop();
|
|
2231
2295
|
}
|
|
2232
|
-
},
|
|
2296
|
+
}, _callee30, this);
|
|
2233
2297
|
}));
|
|
2234
2298
|
function getOtherParams() {
|
|
2235
2299
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2439,10 +2503,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2439
2503
|
}, {
|
|
2440
2504
|
key: "buildAddProductCtx",
|
|
2441
2505
|
value: function buildAddProductCtx(extra) {
|
|
2442
|
-
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$
|
|
2506
|
+
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get4, _extra$presetStartTim2;
|
|
2443
2507
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2444
2508
|
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$
|
|
2509
|
+
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$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2446
2510
|
return _objectSpread(_objectSpread({
|
|
2447
2511
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2448
2512
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2550,18 +2614,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2550
2614
|
}, {
|
|
2551
2615
|
key: "updateProductInOrder",
|
|
2552
2616
|
value: (function () {
|
|
2553
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2554
|
-
return _regeneratorRuntime().wrap(function
|
|
2555
|
-
while (1) switch (
|
|
2617
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
|
|
2618
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2619
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2556
2620
|
case 0:
|
|
2557
|
-
return
|
|
2621
|
+
return _context31.abrupt("return", this.updateOrderProduct(params));
|
|
2558
2622
|
case 1:
|
|
2559
2623
|
case "end":
|
|
2560
|
-
return
|
|
2624
|
+
return _context31.stop();
|
|
2561
2625
|
}
|
|
2562
|
-
},
|
|
2626
|
+
}, _callee31, this);
|
|
2563
2627
|
}));
|
|
2564
|
-
function updateProductInOrder(
|
|
2628
|
+
function updateProductInOrder(_x20) {
|
|
2565
2629
|
return _updateProductInOrder.apply(this, arguments);
|
|
2566
2630
|
}
|
|
2567
2631
|
return updateProductInOrder;
|
|
@@ -2583,47 +2647,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2583
2647
|
}, {
|
|
2584
2648
|
key: "handleGlobalScanCode",
|
|
2585
2649
|
value: (function () {
|
|
2586
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2650
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(code, bridge) {
|
|
2587
2651
|
var _this7 = this;
|
|
2588
2652
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2589
|
-
return _regeneratorRuntime().wrap(function
|
|
2590
|
-
while (1) switch (
|
|
2653
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2654
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2591
2655
|
case 0:
|
|
2592
2656
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2593
2657
|
if (trimmed) {
|
|
2594
|
-
|
|
2658
|
+
_context32.next = 4;
|
|
2595
2659
|
break;
|
|
2596
2660
|
}
|
|
2597
2661
|
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
|
|
2662
|
+
return _context32.abrupt("return", {
|
|
2599
2663
|
status: 'failed',
|
|
2600
2664
|
reason: 'empty_code'
|
|
2601
2665
|
});
|
|
2602
2666
|
case 4:
|
|
2603
|
-
|
|
2667
|
+
_context32.prev = 4;
|
|
2604
2668
|
localSearch = function localSearch(v) {
|
|
2605
2669
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2606
2670
|
};
|
|
2607
2671
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2608
|
-
|
|
2672
|
+
_context32.next = 9;
|
|
2609
2673
|
return scanCallback({
|
|
2610
2674
|
type: 'nativeScanner',
|
|
2611
2675
|
value: trimmed
|
|
2612
2676
|
});
|
|
2613
2677
|
case 9:
|
|
2614
|
-
raw =
|
|
2678
|
+
raw = _context32.sent;
|
|
2615
2679
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2616
2680
|
if (formatted) {
|
|
2617
|
-
|
|
2681
|
+
_context32.next = 14;
|
|
2618
2682
|
break;
|
|
2619
2683
|
}
|
|
2620
2684
|
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
|
|
2685
|
+
return _context32.abrupt("return", {
|
|
2622
2686
|
status: 'failed',
|
|
2623
2687
|
reason: 'not_found'
|
|
2624
2688
|
});
|
|
2625
2689
|
case 14:
|
|
2626
|
-
|
|
2690
|
+
_context32.next = 16;
|
|
2627
2691
|
return applyGlobalScan({
|
|
2628
2692
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2629
2693
|
return _this7.setOrderCustomer(customer);
|
|
@@ -2658,25 +2722,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2658
2722
|
}
|
|
2659
2723
|
}, formatted, bridge);
|
|
2660
2724
|
case 16:
|
|
2661
|
-
_result7 =
|
|
2725
|
+
_result7 = _context32.sent;
|
|
2662
2726
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2663
|
-
return
|
|
2727
|
+
return _context32.abrupt("return", _result7);
|
|
2664
2728
|
case 21:
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2729
|
+
_context32.prev = 21;
|
|
2730
|
+
_context32.t0 = _context32["catch"](4);
|
|
2731
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context32.t0);
|
|
2668
2732
|
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
|
|
2733
|
+
return _context32.abrupt("return", {
|
|
2670
2734
|
status: 'failed',
|
|
2671
2735
|
reason: 'not_found'
|
|
2672
2736
|
});
|
|
2673
2737
|
case 26:
|
|
2674
2738
|
case "end":
|
|
2675
|
-
return
|
|
2739
|
+
return _context32.stop();
|
|
2676
2740
|
}
|
|
2677
|
-
},
|
|
2741
|
+
}, _callee32, this, [[4, 21]]);
|
|
2678
2742
|
}));
|
|
2679
|
-
function handleGlobalScanCode(
|
|
2743
|
+
function handleGlobalScanCode(_x21, _x22) {
|
|
2680
2744
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
2681
2745
|
}
|
|
2682
2746
|
return handleGlobalScanCode;
|
|
@@ -2758,11 +2822,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2758
2822
|
}, {
|
|
2759
2823
|
key: "addAddTimeProductToBooking",
|
|
2760
2824
|
value: (function () {
|
|
2761
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2762
|
-
return _regeneratorRuntime().wrap(function
|
|
2763
|
-
while (1) switch (
|
|
2825
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(input) {
|
|
2826
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2827
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2764
2828
|
case 0:
|
|
2765
|
-
return
|
|
2829
|
+
return _context33.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2766
2830
|
booking: input.booking,
|
|
2767
2831
|
products: [input],
|
|
2768
2832
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2770,11 +2834,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2770
2834
|
}));
|
|
2771
2835
|
case 1:
|
|
2772
2836
|
case "end":
|
|
2773
|
-
return
|
|
2837
|
+
return _context33.stop();
|
|
2774
2838
|
}
|
|
2775
|
-
},
|
|
2839
|
+
}, _callee33, this);
|
|
2776
2840
|
}));
|
|
2777
|
-
function addAddTimeProductToBooking(
|
|
2841
|
+
function addAddTimeProductToBooking(_x23) {
|
|
2778
2842
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
2779
2843
|
}
|
|
2780
2844
|
return addAddTimeProductToBooking;
|
|
@@ -2792,16 +2856,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2792
2856
|
}, {
|
|
2793
2857
|
key: "addAddTimeProductsToBooking",
|
|
2794
2858
|
value: (function () {
|
|
2795
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2859
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(input) {
|
|
2796
2860
|
var _this8 = this,
|
|
2797
2861
|
_input$bookingPatch;
|
|
2798
2862
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2799
|
-
return _regeneratorRuntime().wrap(function
|
|
2800
|
-
while (1) switch (
|
|
2863
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2864
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2801
2865
|
case 0:
|
|
2802
2866
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
2803
2867
|
if (bookingUid) {
|
|
2804
|
-
|
|
2868
|
+
_context34.next = 3;
|
|
2805
2869
|
break;
|
|
2806
2870
|
}
|
|
2807
2871
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -2812,7 +2876,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2812
2876
|
};
|
|
2813
2877
|
});
|
|
2814
2878
|
if (this.store.order) {
|
|
2815
|
-
|
|
2879
|
+
_context34.next = 6;
|
|
2816
2880
|
break;
|
|
2817
2881
|
}
|
|
2818
2882
|
throw new Error('order 模块未初始化');
|
|
@@ -2826,55 +2890,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2826
2890
|
});
|
|
2827
2891
|
}
|
|
2828
2892
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
2829
|
-
|
|
2893
|
+
_context34.next = 11;
|
|
2830
2894
|
break;
|
|
2831
2895
|
}
|
|
2832
|
-
return
|
|
2896
|
+
return _context34.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2833
2897
|
case 11:
|
|
2834
2898
|
result = [];
|
|
2835
2899
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2836
|
-
|
|
2900
|
+
_context34.prev = 13;
|
|
2837
2901
|
_iterator2.s();
|
|
2838
2902
|
case 15:
|
|
2839
2903
|
if ((_step2 = _iterator2.n()).done) {
|
|
2840
|
-
|
|
2904
|
+
_context34.next = 29;
|
|
2841
2905
|
break;
|
|
2842
2906
|
}
|
|
2843
2907
|
line = _step2.value;
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2908
|
+
_context34.t0 = result.splice;
|
|
2909
|
+
_context34.t1 = result;
|
|
2910
|
+
_context34.t2 = [0, result.length];
|
|
2911
|
+
_context34.t3 = _toConsumableArray;
|
|
2912
|
+
_context34.next = 23;
|
|
2849
2913
|
return this.addProductToOrder(line.product);
|
|
2850
2914
|
case 23:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2915
|
+
_context34.t4 = _context34.sent;
|
|
2916
|
+
_context34.t5 = (0, _context34.t3)(_context34.t4);
|
|
2917
|
+
_context34.t6 = _context34.t2.concat.call(_context34.t2, _context34.t5);
|
|
2918
|
+
_context34.t0.apply.call(_context34.t0, _context34.t1, _context34.t6);
|
|
2855
2919
|
case 27:
|
|
2856
|
-
|
|
2920
|
+
_context34.next = 15;
|
|
2857
2921
|
break;
|
|
2858
2922
|
case 29:
|
|
2859
|
-
|
|
2923
|
+
_context34.next = 34;
|
|
2860
2924
|
break;
|
|
2861
2925
|
case 31:
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
_iterator2.e(
|
|
2926
|
+
_context34.prev = 31;
|
|
2927
|
+
_context34.t7 = _context34["catch"](13);
|
|
2928
|
+
_iterator2.e(_context34.t7);
|
|
2865
2929
|
case 34:
|
|
2866
|
-
|
|
2930
|
+
_context34.prev = 34;
|
|
2867
2931
|
_iterator2.f();
|
|
2868
|
-
return
|
|
2932
|
+
return _context34.finish(34);
|
|
2869
2933
|
case 37:
|
|
2870
|
-
return
|
|
2934
|
+
return _context34.abrupt("return", result);
|
|
2871
2935
|
case 38:
|
|
2872
2936
|
case "end":
|
|
2873
|
-
return
|
|
2937
|
+
return _context34.stop();
|
|
2874
2938
|
}
|
|
2875
|
-
},
|
|
2939
|
+
}, _callee34, this, [[13, 31, 34, 37]]);
|
|
2876
2940
|
}));
|
|
2877
|
-
function addAddTimeProductsToBooking(
|
|
2941
|
+
function addAddTimeProductsToBooking(_x24) {
|
|
2878
2942
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
2879
2943
|
}
|
|
2880
2944
|
return addAddTimeProductsToBooking;
|
|
@@ -2882,43 +2946,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2882
2946
|
}, {
|
|
2883
2947
|
key: "setOtherParams",
|
|
2884
2948
|
value: function () {
|
|
2885
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2949
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
2886
2950
|
var _ref19,
|
|
2887
2951
|
_ref19$cover,
|
|
2888
2952
|
cover,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2953
|
+
invoiceContextChanged,
|
|
2954
|
+
_args35 = arguments;
|
|
2955
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2956
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2892
2957
|
case 0:
|
|
2893
|
-
_ref19 =
|
|
2894
|
-
|
|
2958
|
+
_ref19 = _args35.length > 1 && _args35[1] !== undefined ? _args35[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
2959
|
+
_context35.next = 3;
|
|
2895
2960
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2896
2961
|
cover: cover
|
|
2897
2962
|
});
|
|
2898
2963
|
case 3:
|
|
2899
|
-
|
|
2900
|
-
|
|
2964
|
+
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');
|
|
2965
|
+
if (!invoiceContextChanged) {
|
|
2966
|
+
_context35.next = 7;
|
|
2901
2967
|
break;
|
|
2902
2968
|
}
|
|
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;
|
|
2969
|
+
_context35.next = 7;
|
|
2970
|
+
return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
|
|
2971
|
+
case 7:
|
|
2972
|
+
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
2973
|
+
_context35.next = 10;
|
|
2911
2974
|
break;
|
|
2912
2975
|
}
|
|
2913
|
-
|
|
2914
|
-
return this.
|
|
2915
|
-
case
|
|
2976
|
+
_context35.next = 10;
|
|
2977
|
+
return this.configureIdGeneratorFromOpenData();
|
|
2978
|
+
case 10:
|
|
2916
2979
|
case "end":
|
|
2917
|
-
return
|
|
2980
|
+
return _context35.stop();
|
|
2918
2981
|
}
|
|
2919
|
-
},
|
|
2982
|
+
}, _callee35, this);
|
|
2920
2983
|
}));
|
|
2921
|
-
function setOtherParams(
|
|
2984
|
+
function setOtherParams(_x25) {
|
|
2922
2985
|
return _setOtherParams.apply(this, arguments);
|
|
2923
2986
|
}
|
|
2924
2987
|
return setOtherParams;
|
|
@@ -2935,15 +2998,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2935
2998
|
}, {
|
|
2936
2999
|
key: "handlePrintWristband",
|
|
2937
3000
|
value: function () {
|
|
2938
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3001
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
2939
3002
|
var _this$getOrderIdentit;
|
|
2940
3003
|
var deviceTask, deviceId, idempotencyKey;
|
|
2941
|
-
return _regeneratorRuntime().wrap(function
|
|
2942
|
-
while (1) switch (
|
|
3004
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3005
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2943
3006
|
case 0:
|
|
2944
3007
|
deviceTask = this.getDeviceTaskPlugin();
|
|
2945
3008
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
2946
|
-
|
|
3009
|
+
_context36.next = 4;
|
|
2947
3010
|
break;
|
|
2948
3011
|
}
|
|
2949
3012
|
this.logger.addLog({
|
|
@@ -2953,7 +3016,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2953
3016
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2954
3017
|
}
|
|
2955
3018
|
});
|
|
2956
|
-
return
|
|
3019
|
+
return _context36.abrupt("return");
|
|
2957
3020
|
case 4:
|
|
2958
3021
|
this.logger.addLog({
|
|
2959
3022
|
type: 'info',
|
|
@@ -2962,10 +3025,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2962
3025
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2963
3026
|
}
|
|
2964
3027
|
});
|
|
2965
|
-
|
|
3028
|
+
_context36.next = 7;
|
|
2966
3029
|
return this.getShortNumberOrDeviceId();
|
|
2967
3030
|
case 7:
|
|
2968
|
-
deviceId =
|
|
3031
|
+
deviceId = _context36.sent;
|
|
2969
3032
|
idempotencyKey = createUuidV4();
|
|
2970
3033
|
deviceTask.dispatch({
|
|
2971
3034
|
action: 'print_all',
|
|
@@ -2985,11 +3048,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2985
3048
|
});
|
|
2986
3049
|
case 10:
|
|
2987
3050
|
case "end":
|
|
2988
|
-
return
|
|
3051
|
+
return _context36.stop();
|
|
2989
3052
|
}
|
|
2990
|
-
},
|
|
3053
|
+
}, _callee36, this);
|
|
2991
3054
|
}));
|
|
2992
|
-
function handlePrintWristband(
|
|
3055
|
+
function handlePrintWristband(_x26) {
|
|
2993
3056
|
return _handlePrintWristband.apply(this, arguments);
|
|
2994
3057
|
}
|
|
2995
3058
|
return handlePrintWristband;
|
|
@@ -2997,11 +3060,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2997
3060
|
}, {
|
|
2998
3061
|
key: "handleRedeem",
|
|
2999
3062
|
value: function () {
|
|
3000
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3063
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
|
|
3001
3064
|
var _this$store$order6, _this$store$order6$ge, _this$store$order7, _ref20, _tempOrder$order_id2;
|
|
3002
3065
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
3003
|
-
return _regeneratorRuntime().wrap(function
|
|
3004
|
-
while (1) switch (
|
|
3066
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3067
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3005
3068
|
case 0:
|
|
3006
3069
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
3007
3070
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -3025,20 +3088,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3025
3088
|
});
|
|
3026
3089
|
});
|
|
3027
3090
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
3028
|
-
|
|
3091
|
+
_context37.next = 11;
|
|
3029
3092
|
break;
|
|
3030
3093
|
}
|
|
3031
|
-
|
|
3094
|
+
_context37.next = 11;
|
|
3032
3095
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
3033
3096
|
vouchers: nextVouchers
|
|
3034
3097
|
}));
|
|
3035
3098
|
case 11:
|
|
3036
3099
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
3037
3100
|
if (!(voucherIds.length === 0)) {
|
|
3038
|
-
|
|
3101
|
+
_context37.next = 14;
|
|
3039
3102
|
break;
|
|
3040
3103
|
}
|
|
3041
|
-
return
|
|
3104
|
+
return _context37.abrupt("return", {
|
|
3042
3105
|
code: 200,
|
|
3043
3106
|
status: true,
|
|
3044
3107
|
message: '',
|
|
@@ -3049,7 +3112,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3049
3112
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
3050
3113
|
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
3114
|
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
|
|
3115
|
+
return _context37.abrupt("return", this.request.post('/machinecode/batch', {
|
|
3053
3116
|
ids: voucherIds,
|
|
3054
3117
|
status: status,
|
|
3055
3118
|
order_lookup: orderLookup,
|
|
@@ -3060,11 +3123,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3060
3123
|
}));
|
|
3061
3124
|
case 19:
|
|
3062
3125
|
case "end":
|
|
3063
|
-
return
|
|
3126
|
+
return _context37.stop();
|
|
3064
3127
|
}
|
|
3065
|
-
},
|
|
3128
|
+
}, _callee37, this);
|
|
3066
3129
|
}));
|
|
3067
|
-
function handleRedeem(
|
|
3130
|
+
function handleRedeem(_x27) {
|
|
3068
3131
|
return _handleRedeem.apply(this, arguments);
|
|
3069
3132
|
}
|
|
3070
3133
|
return handleRedeem;
|
|
@@ -3076,12 +3139,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3076
3139
|
}, {
|
|
3077
3140
|
key: "destroy",
|
|
3078
3141
|
value: (function () {
|
|
3079
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3142
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3080
3143
|
var _this$scan;
|
|
3081
|
-
return _regeneratorRuntime().wrap(function
|
|
3082
|
-
while (1) switch (
|
|
3144
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3145
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3083
3146
|
case 0:
|
|
3084
|
-
|
|
3147
|
+
_context38.next = 2;
|
|
3085
3148
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
3086
3149
|
case 2:
|
|
3087
3150
|
try {
|
|
@@ -3092,9 +3155,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3092
3155
|
scanCache.clear();
|
|
3093
3156
|
case 4:
|
|
3094
3157
|
case "end":
|
|
3095
|
-
return
|
|
3158
|
+
return _context38.stop();
|
|
3096
3159
|
}
|
|
3097
|
-
},
|
|
3160
|
+
}, _callee38, this);
|
|
3098
3161
|
}));
|
|
3099
3162
|
function destroy() {
|
|
3100
3163
|
return _destroy.apply(this, arguments);
|