@pisell/pisellos 2.2.302 → 2.2.304
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/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
- package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/dist/model/strategy/adapter/itemRule/type.js +19 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +41 -5
- package/dist/modules/Discount/types.d.ts +21 -0
- package/dist/modules/OpenData/index.d.ts +15 -2
- package/dist/modules/OpenData/index.js +307 -19
- package/dist/modules/OpenData/types.d.ts +55 -0
- package/dist/modules/OpenData/types.js +7 -1
- package/dist/modules/OpenData/utils.d.ts +21 -1
- package/dist/modules/OpenData/utils.js +138 -0
- package/dist/modules/Order/index.d.ts +50 -7
- package/dist/modules/Order/index.js +1690 -815
- package/dist/modules/Order/salesNotes.d.ts +31 -0
- package/dist/modules/Order/salesNotes.js +492 -0
- package/dist/modules/Order/types.d.ts +117 -10
- package/dist/modules/Order/types.js +6 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/dist/modules/Order/utils/virtualSettlement.js +284 -0
- package/dist/modules/Order/utils.d.ts +5 -1
- package/dist/modules/Order/utils.js +138 -33
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/dist/modules/Payment/cashRecommendationAlgorithm.js +17 -367
- package/dist/modules/Payment/walletpass.js +20 -21
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +2 -1
- package/dist/modules/ProductList/index.js +100 -20
- package/dist/modules/ProductList/types.d.ts +10 -0
- package/dist/modules/Rules/index.d.ts +5 -0
- package/dist/modules/Rules/index.js +30 -14
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/plugins/request.d.ts +2 -1
- package/dist/plugins/request.js +4 -2
- package/dist/server/index.d.ts +21 -0
- package/dist/server/index.js +1774 -1285
- package/dist/server/modules/order/types.d.ts +50 -0
- package/dist/server/modules/order/types.js +2 -0
- package/dist/server/utils/small-ticket.d.ts +4 -1
- package/dist/server/utils/small-ticket.js +461 -96
- package/dist/solution/BaseSales/index.d.ts +24 -3
- package/dist/solution/BaseSales/index.js +1484 -873
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +72 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +22 -5
- package/dist/solution/BookingTicket/index.js +558 -443
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
- package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
- package/dist/solution/RegisterAndLogin/config.js +95 -40
- package/dist/solution/RegisterAndLogin/index.js +4 -1
- package/dist/solution/Sales/index.d.ts +16 -1
- package/dist/solution/Sales/index.js +338 -63
- package/dist/solution/Sales/types.d.ts +10 -0
- package/dist/solution/ScanOrder/index.d.ts +1 -0
- package/dist/solution/ScanOrder/index.js +31 -27
- package/dist/solution/ScanOrder/utils.d.ts +1 -0
- package/dist/solution/ScanOrder/utils.js +2 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +20 -6
- package/dist/solution/UnifiedBookingSales/index.js +874 -527
- package/dist/solution/UnifiedBookingSales/types.d.ts +21 -2
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +8 -4
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +137 -6
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
- package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
- package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
- package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
- package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
- package/lib/model/strategy/adapter/itemRule/type.js +19 -1
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +34 -2
- package/lib/modules/Discount/types.d.ts +21 -0
- package/lib/modules/OpenData/index.d.ts +15 -2
- package/lib/modules/OpenData/index.js +230 -3
- package/lib/modules/OpenData/types.d.ts +55 -0
- package/lib/modules/OpenData/types.js +9 -1
- package/lib/modules/OpenData/utils.d.ts +21 -1
- package/lib/modules/OpenData/utils.js +126 -0
- package/lib/modules/Order/index.d.ts +50 -7
- package/lib/modules/Order/index.js +704 -64
- package/lib/modules/Order/salesNotes.d.ts +31 -0
- package/lib/modules/Order/salesNotes.js +382 -0
- package/lib/modules/Order/types.d.ts +117 -10
- package/lib/modules/Order/types.js +5 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +63 -0
- package/lib/modules/Order/utils/virtualSettlement.js +262 -0
- package/lib/modules/Order/utils.d.ts +5 -1
- package/lib/modules/Order/utils.js +127 -21
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +4 -5
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +9 -354
- package/lib/modules/Payment/walletpass.js +14 -11
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +2 -1
- package/lib/modules/ProductList/index.js +47 -2
- package/lib/modules/ProductList/types.d.ts +10 -0
- package/lib/modules/Rules/index.d.ts +5 -0
- package/lib/modules/Rules/index.js +22 -12
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +17 -1
- package/lib/plugins/request.d.ts +2 -1
- package/lib/plugins/request.js +3 -2
- package/lib/server/index.d.ts +21 -0
- package/lib/server/index.js +492 -108
- package/lib/server/modules/order/types.d.ts +50 -0
- package/lib/server/modules/order/types.js +1 -0
- package/lib/server/utils/small-ticket.d.ts +4 -1
- package/lib/server/utils/small-ticket.js +427 -72
- package/lib/solution/BaseSales/index.d.ts +24 -3
- package/lib/solution/BaseSales/index.js +433 -30
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +2 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +1 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +38 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +22 -5
- package/lib/solution/BookingTicket/index.js +60 -15
- package/lib/solution/BookingTicket/utils/addProductDecision.js +1 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
- package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
- package/lib/solution/RegisterAndLogin/config.js +49 -8
- package/lib/solution/RegisterAndLogin/index.js +4 -1
- package/lib/solution/Sales/index.d.ts +16 -1
- package/lib/solution/Sales/index.js +168 -1
- package/lib/solution/Sales/types.d.ts +10 -0
- package/lib/solution/ScanOrder/index.d.ts +1 -0
- package/lib/solution/ScanOrder/index.js +5 -1
- package/lib/solution/ScanOrder/utils.d.ts +1 -0
- package/lib/solution/ScanOrder/utils.js +1 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +20 -6
- package/lib/solution/UnifiedBookingSales/index.js +169 -16
- package/lib/solution/UnifiedBookingSales/types.d.ts +21 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +5 -1
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
33
33
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
34
34
|
import dayjs from 'dayjs';
|
|
35
35
|
import { createBookingTicketModule } from "./types";
|
|
36
|
+
import { getDefaultInvoiceLayoutConfig, getDefaultInvoiceTemplateSettings } from "../../modules/OpenData";
|
|
36
37
|
import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
|
|
37
38
|
import { BaseSalesImpl } from "../BaseSales";
|
|
38
39
|
import Scan from "./utils/scan";
|
|
@@ -50,7 +51,7 @@ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingCont
|
|
|
50
51
|
import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
|
|
51
52
|
import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
|
|
52
53
|
import { createUuidV4 } from "../../modules/Order/utils";
|
|
53
|
-
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
54
|
+
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
|
|
54
55
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
55
56
|
var USER_PLATFORM = ['pc', 'h5'];
|
|
56
57
|
|
|
@@ -180,7 +181,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
180
181
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
|
|
181
182
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
182
183
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
183
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
185
|
+
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
186
|
+
_defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
|
|
184
187
|
return _this;
|
|
185
188
|
}
|
|
186
189
|
_createClass(BookingTicketImpl, [{
|
|
@@ -250,11 +253,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
250
253
|
}, {
|
|
251
254
|
key: "getBookingTicketBusinessCode",
|
|
252
255
|
value: function getBookingTicketBusinessCode() {
|
|
253
|
-
var _this$
|
|
254
|
-
var
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
var _this$otherParams2, _this$otherParams3, _this$getOrderHeader, _this$store$order, _this$getSalesOrder;
|
|
257
|
+
var candidates = [(_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode, (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code, (_this$getOrderHeader = this.getOrderHeader()) === null || _this$getOrderHeader === void 0 ? void 0 : _this$getOrderHeader.business_code, (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order = _this$store$order.getTempOrder()) === null || _this$store$order === void 0 ? void 0 : _this$store$order.business_code, (_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
|
+
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
259
|
+
var candidate = _candidates[_i];
|
|
260
|
+
if (candidate === undefined || candidate === null) continue;
|
|
261
|
+
var normalized = String(candidate).trim();
|
|
262
|
+
if (normalized) return normalized;
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
258
265
|
}
|
|
259
266
|
}, {
|
|
260
267
|
key: "getIdGeneratorPlugin",
|
|
@@ -268,7 +275,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
268
275
|
key: "loadOpenDataConfig",
|
|
269
276
|
value: function () {
|
|
270
277
|
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
271
|
-
var businessCode, lastFetchedAt, cachedData,
|
|
278
|
+
var businessCode, channel, target, lastFetchedAt, cachedData, request, openDataConfig;
|
|
272
279
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
273
280
|
while (1) switch (_context2.prev = _context2.next) {
|
|
274
281
|
case 0:
|
|
@@ -286,47 +293,73 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
286
293
|
console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载,当前 module name: ', this.name);
|
|
287
294
|
return _context2.abrupt("return", null);
|
|
288
295
|
case 6:
|
|
296
|
+
channel = this.getSubmitOrderSalesChannel();
|
|
297
|
+
target = "".concat(businessCode, "+").concat(channel);
|
|
289
298
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
290
299
|
cachedData = this.store.openData.getOpenData();
|
|
291
|
-
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
292
|
-
_context2.next =
|
|
300
|
+
if (!(cachedData && this.openDataTarget === target && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
301
|
+
_context2.next = 16;
|
|
293
302
|
break;
|
|
294
303
|
}
|
|
295
|
-
this.
|
|
296
|
-
|
|
297
|
-
case 11:
|
|
298
|
-
if (!this.loadOpenDataConfigInFlight) {
|
|
299
|
-
_context2.next = 15;
|
|
304
|
+
if (!(typeof this.store.openData.ensureInvoiceTemplateSettings === 'function')) {
|
|
305
|
+
_context2.next = 14;
|
|
300
306
|
break;
|
|
301
307
|
}
|
|
302
308
|
_context2.next = 14;
|
|
303
|
-
return this.
|
|
309
|
+
return this.store.openData.ensureInvoiceTemplateSettings(target);
|
|
304
310
|
case 14:
|
|
311
|
+
this.otherParams.openData = cachedData;
|
|
312
|
+
return _context2.abrupt("return", cachedData);
|
|
313
|
+
case 16:
|
|
314
|
+
if (!this.loadOpenDataInFlight) {
|
|
315
|
+
_context2.next = 24;
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
if (!(this.loadOpenDataInFlightTarget === target)) {
|
|
319
|
+
_context2.next = 21;
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
_context2.next = 20;
|
|
323
|
+
return this.loadOpenDataInFlight;
|
|
324
|
+
case 20:
|
|
305
325
|
return _context2.abrupt("return", _context2.sent);
|
|
306
|
-
case
|
|
307
|
-
|
|
308
|
-
|
|
326
|
+
case 21:
|
|
327
|
+
_context2.next = 23;
|
|
328
|
+
return this.loadOpenDataInFlight;
|
|
329
|
+
case 23:
|
|
330
|
+
return _context2.abrupt("return", this.loadOpenDataConfig());
|
|
331
|
+
case 24:
|
|
332
|
+
this.loadOpenDataInFlightTarget = target;
|
|
333
|
+
request = this.store.openData.fetchOpenData({
|
|
309
334
|
scope: 'board',
|
|
310
|
-
target:
|
|
335
|
+
target: target,
|
|
311
336
|
// target: `dine_in+pos`,
|
|
312
337
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
313
338
|
});
|
|
314
|
-
|
|
315
|
-
_context2.
|
|
316
|
-
|
|
317
|
-
|
|
339
|
+
this.loadOpenDataInFlight = request;
|
|
340
|
+
_context2.prev = 27;
|
|
341
|
+
_context2.next = 30;
|
|
342
|
+
return request;
|
|
343
|
+
case 30:
|
|
318
344
|
openDataConfig = _context2.sent;
|
|
319
|
-
|
|
345
|
+
// clearOpenDataCache() 或新请求已接管时,旧响应只能返回给原调用方,不能复活缓存归属。
|
|
346
|
+
if (this.loadOpenDataInFlight === request) {
|
|
347
|
+
this.openDataTarget = target;
|
|
348
|
+
this.otherParams.openData = openDataConfig;
|
|
349
|
+
}
|
|
320
350
|
return _context2.abrupt("return", openDataConfig);
|
|
321
|
-
case
|
|
322
|
-
_context2.prev =
|
|
323
|
-
this.
|
|
324
|
-
|
|
325
|
-
|
|
351
|
+
case 33:
|
|
352
|
+
_context2.prev = 33;
|
|
353
|
+
if (this.loadOpenDataInFlight === request) {
|
|
354
|
+
this.loadOpenDataInFlight = null;
|
|
355
|
+
this.loadOpenDataInFlightTarget = null;
|
|
356
|
+
}
|
|
357
|
+
return _context2.finish(33);
|
|
358
|
+
case 36:
|
|
326
359
|
case "end":
|
|
327
360
|
return _context2.stop();
|
|
328
361
|
}
|
|
329
|
-
}, _callee2, this, [[
|
|
362
|
+
}, _callee2, this, [[27,, 33, 36]]);
|
|
330
363
|
}));
|
|
331
364
|
function loadOpenDataConfig() {
|
|
332
365
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -351,44 +384,116 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
351
384
|
return _getOpenData.apply(this, arguments);
|
|
352
385
|
}
|
|
353
386
|
return getOpenData;
|
|
354
|
-
}()
|
|
387
|
+
}()
|
|
388
|
+
}, {
|
|
389
|
+
key: "getInvoiceLayoutConfig",
|
|
390
|
+
value: function () {
|
|
391
|
+
var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
392
|
+
var openData;
|
|
393
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
394
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
_context4.next = 2;
|
|
397
|
+
return this.loadOpenDataConfig();
|
|
398
|
+
case 2:
|
|
399
|
+
openData = _context4.sent;
|
|
400
|
+
if (openData) {
|
|
401
|
+
_context4.next = 5;
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
return _context4.abrupt("return", getDefaultInvoiceLayoutConfig());
|
|
405
|
+
case 5:
|
|
406
|
+
return _context4.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
|
|
407
|
+
case 6:
|
|
408
|
+
case "end":
|
|
409
|
+
return _context4.stop();
|
|
410
|
+
}
|
|
411
|
+
}, _callee4, this);
|
|
412
|
+
}));
|
|
413
|
+
function getInvoiceLayoutConfig() {
|
|
414
|
+
return _getInvoiceLayoutConfig.apply(this, arguments);
|
|
415
|
+
}
|
|
416
|
+
return getInvoiceLayoutConfig;
|
|
417
|
+
}()
|
|
418
|
+
}, {
|
|
419
|
+
key: "getInvoiceTemplateSettings",
|
|
420
|
+
value: function () {
|
|
421
|
+
var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
422
|
+
var openData;
|
|
423
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
424
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
425
|
+
case 0:
|
|
426
|
+
_context5.next = 2;
|
|
427
|
+
return this.loadOpenDataConfig();
|
|
428
|
+
case 2:
|
|
429
|
+
openData = _context5.sent;
|
|
430
|
+
if (openData) {
|
|
431
|
+
_context5.next = 5;
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
return _context5.abrupt("return", getDefaultInvoiceTemplateSettings());
|
|
435
|
+
case 5:
|
|
436
|
+
return _context5.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
|
|
437
|
+
case 6:
|
|
438
|
+
case "end":
|
|
439
|
+
return _context5.stop();
|
|
440
|
+
}
|
|
441
|
+
}, _callee5, this);
|
|
442
|
+
}));
|
|
443
|
+
function getInvoiceTemplateSettings() {
|
|
444
|
+
return _getInvoiceTemplateSettings.apply(this, arguments);
|
|
445
|
+
}
|
|
446
|
+
return getInvoiceTemplateSettings;
|
|
447
|
+
}()
|
|
448
|
+
}, {
|
|
449
|
+
key: "isInvoiceOpenDataCacheCurrent",
|
|
450
|
+
value: function isInvoiceOpenDataCacheCurrent() {
|
|
451
|
+
var businessCode = this.getBookingTicketBusinessCode();
|
|
452
|
+
var channel = this.getSubmitOrderSalesChannel();
|
|
453
|
+
if (!businessCode || !channel) return false;
|
|
454
|
+
return this.openDataTarget === "".concat(businessCode, "+").concat(channel);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
355
458
|
}, {
|
|
356
459
|
key: "clearOpenDataCache",
|
|
357
460
|
value: function clearOpenDataCache() {
|
|
358
461
|
var _this$store$openData;
|
|
359
|
-
this.
|
|
462
|
+
this.loadOpenDataInFlight = null;
|
|
463
|
+
this.loadOpenDataInFlightTarget = null;
|
|
464
|
+
this.openDataTarget = null;
|
|
360
465
|
this.otherParams.openData = null;
|
|
361
466
|
(_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || _this$store$openData.clearCache();
|
|
362
467
|
}
|
|
363
468
|
}, {
|
|
364
469
|
key: "getShortNumberOrDeviceId",
|
|
365
470
|
value: function () {
|
|
366
|
-
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
471
|
+
var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
367
472
|
var getAsyncIotDeviceInfo, res;
|
|
368
|
-
return _regeneratorRuntime().wrap(function
|
|
369
|
-
while (1) switch (
|
|
473
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
474
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
370
475
|
case 0:
|
|
371
476
|
getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
|
|
372
477
|
if (!getAsyncIotDeviceInfo) {
|
|
373
|
-
|
|
478
|
+
_context6.next = 7;
|
|
374
479
|
break;
|
|
375
480
|
}
|
|
376
|
-
|
|
481
|
+
_context6.next = 4;
|
|
377
482
|
return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
|
|
378
483
|
case 4:
|
|
379
|
-
res =
|
|
484
|
+
res = _context6.sent;
|
|
380
485
|
if (!(res !== null && res !== void 0 && res.short_number)) {
|
|
381
|
-
|
|
486
|
+
_context6.next = 7;
|
|
382
487
|
break;
|
|
383
488
|
}
|
|
384
|
-
return
|
|
489
|
+
return _context6.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
|
|
385
490
|
case 7:
|
|
386
|
-
return
|
|
491
|
+
return _context6.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
|
|
387
492
|
case 8:
|
|
388
493
|
case "end":
|
|
389
|
-
return
|
|
494
|
+
return _context6.stop();
|
|
390
495
|
}
|
|
391
|
-
},
|
|
496
|
+
}, _callee6, this);
|
|
392
497
|
}));
|
|
393
498
|
function getShortNumberOrDeviceId() {
|
|
394
499
|
return _getShortNumberOrDeviceId.apply(this, arguments);
|
|
@@ -398,35 +503,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
398
503
|
}, {
|
|
399
504
|
key: "configureIdGeneratorFromOpenData",
|
|
400
505
|
value: function () {
|
|
401
|
-
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
506
|
+
var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
402
507
|
var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
|
|
403
508
|
var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
|
|
404
|
-
return _regeneratorRuntime().wrap(function
|
|
405
|
-
while (1) switch (
|
|
509
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
510
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
406
511
|
case 0:
|
|
407
512
|
// 业务码切换或配置失败时不能复用上一次初始化的短号。
|
|
408
513
|
this.setPaymentNumberDevicePrefix(null);
|
|
409
514
|
idGenerator = this.getIdGeneratorPlugin();
|
|
410
515
|
if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
|
|
411
|
-
|
|
516
|
+
_context7.next = 5;
|
|
412
517
|
break;
|
|
413
518
|
}
|
|
414
519
|
console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
|
|
415
|
-
return
|
|
520
|
+
return _context7.abrupt("return");
|
|
416
521
|
case 5:
|
|
417
522
|
openDataConfig = null;
|
|
418
|
-
|
|
419
|
-
|
|
523
|
+
_context7.prev = 6;
|
|
524
|
+
_context7.next = 9;
|
|
420
525
|
return this.loadOpenDataConfig();
|
|
421
526
|
case 9:
|
|
422
|
-
openDataConfig =
|
|
423
|
-
|
|
527
|
+
openDataConfig = _context7.sent;
|
|
528
|
+
_context7.next = 16;
|
|
424
529
|
break;
|
|
425
530
|
case 12:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置',
|
|
429
|
-
return
|
|
531
|
+
_context7.prev = 12;
|
|
532
|
+
_context7.t0 = _context7["catch"](6);
|
|
533
|
+
console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context7.t0);
|
|
534
|
+
return _context7.abrupt("return");
|
|
430
535
|
case 16:
|
|
431
536
|
// if (!openDataConfig) return;
|
|
432
537
|
receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
|
|
@@ -438,21 +543,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
438
543
|
"type": "start_time",
|
|
439
544
|
"time": "00:00"
|
|
440
545
|
};
|
|
441
|
-
|
|
546
|
+
_context7.next = 24;
|
|
442
547
|
return this.getShortNumberOrDeviceId();
|
|
443
548
|
case 24:
|
|
444
|
-
deviceId =
|
|
549
|
+
deviceId = _context7.sent;
|
|
445
550
|
this.setPaymentNumberDevicePrefix(deviceId);
|
|
446
551
|
businessCode = this.getBookingTicketBusinessCode();
|
|
447
552
|
if (businessCode) {
|
|
448
|
-
|
|
553
|
+
_context7.next = 30;
|
|
449
554
|
break;
|
|
450
555
|
}
|
|
451
556
|
console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
|
|
452
|
-
return
|
|
557
|
+
return _context7.abrupt("return");
|
|
453
558
|
case 30:
|
|
454
|
-
|
|
455
|
-
|
|
559
|
+
_context7.prev = 30;
|
|
560
|
+
_context7.next = 33;
|
|
456
561
|
return idGenerator.configure({
|
|
457
562
|
biz: businessCode,
|
|
458
563
|
config: {
|
|
@@ -468,17 +573,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
468
573
|
}
|
|
469
574
|
});
|
|
470
575
|
case 33:
|
|
471
|
-
|
|
576
|
+
_context7.next = 38;
|
|
472
577
|
break;
|
|
473
578
|
case 35:
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
console.warn('[BookingTicket] idGenerator 配置失败',
|
|
579
|
+
_context7.prev = 35;
|
|
580
|
+
_context7.t1 = _context7["catch"](30);
|
|
581
|
+
console.warn('[BookingTicket] idGenerator 配置失败', _context7.t1);
|
|
477
582
|
case 38:
|
|
478
583
|
case "end":
|
|
479
|
-
return
|
|
584
|
+
return _context7.stop();
|
|
480
585
|
}
|
|
481
|
-
},
|
|
586
|
+
}, _callee7, this, [[6, 12], [30, 35]]);
|
|
482
587
|
}));
|
|
483
588
|
function configureIdGeneratorFromOpenData() {
|
|
484
589
|
return _configureIdGeneratorFromOpenData.apply(this, arguments);
|
|
@@ -510,16 +615,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
510
615
|
}, {
|
|
511
616
|
key: "loadSalesDetail",
|
|
512
617
|
value: (function () {
|
|
513
|
-
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
618
|
+
var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(orderIdOrParams) {
|
|
514
619
|
var _ref3;
|
|
515
620
|
var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
|
|
516
|
-
return _regeneratorRuntime().wrap(function
|
|
517
|
-
while (1) switch (
|
|
621
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
622
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
518
623
|
case 0:
|
|
519
|
-
|
|
624
|
+
_context8.next = 2;
|
|
520
625
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
|
|
521
626
|
case 2:
|
|
522
|
-
sales =
|
|
627
|
+
sales = _context8.sent;
|
|
523
628
|
customerModule = this.store.customer;
|
|
524
629
|
detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
|
|
525
630
|
orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
|
|
@@ -551,12 +656,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
551
656
|
});
|
|
552
657
|
// await this.store.order.saveDraft();
|
|
553
658
|
}
|
|
554
|
-
return
|
|
659
|
+
return _context8.abrupt("return", sales);
|
|
555
660
|
case 11:
|
|
556
661
|
case "end":
|
|
557
|
-
return
|
|
662
|
+
return _context8.stop();
|
|
558
663
|
}
|
|
559
|
-
},
|
|
664
|
+
}, _callee8, this);
|
|
560
665
|
}));
|
|
561
666
|
function loadSalesDetail(_x2) {
|
|
562
667
|
return _loadSalesDetail.apply(this, arguments);
|
|
@@ -566,44 +671,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
566
671
|
}, {
|
|
567
672
|
key: "scanPromotionCode",
|
|
568
673
|
value: function () {
|
|
569
|
-
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
674
|
+
var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code, customerId) {
|
|
570
675
|
var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
|
|
571
|
-
return _regeneratorRuntime().wrap(function
|
|
572
|
-
while (1) switch (
|
|
676
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
677
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
573
678
|
case 0:
|
|
574
679
|
if (this.store.order) {
|
|
575
|
-
|
|
680
|
+
_context9.next = 2;
|
|
576
681
|
break;
|
|
577
682
|
}
|
|
578
683
|
throw new Error('order 模块未初始化');
|
|
579
684
|
case 2:
|
|
580
|
-
|
|
685
|
+
_context9.next = 4;
|
|
581
686
|
return this.store.order.scanCode(code, customerId);
|
|
582
687
|
case 4:
|
|
583
|
-
raw =
|
|
688
|
+
raw = _context9.sent;
|
|
584
689
|
scannedList = raw.scannedDiscountList || [];
|
|
585
690
|
extractedCustomerId = this.getDiscountCustomerId(scannedList);
|
|
586
691
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
587
692
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
588
693
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
589
|
-
|
|
694
|
+
_context9.next = 12;
|
|
590
695
|
break;
|
|
591
696
|
}
|
|
592
|
-
|
|
697
|
+
_context9.next = 12;
|
|
593
698
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
594
699
|
case 12:
|
|
595
700
|
if (!raw.isAvailable) {
|
|
596
|
-
|
|
701
|
+
_context9.next = 19;
|
|
597
702
|
break;
|
|
598
703
|
}
|
|
599
|
-
|
|
704
|
+
_context9.next = 15;
|
|
600
705
|
return this.store.order.recalculateSummary({
|
|
601
706
|
createIfMissing: true
|
|
602
707
|
});
|
|
603
708
|
case 15:
|
|
604
709
|
this.store.order.persistTempOrder();
|
|
605
710
|
tempOrder = this.store.order.ensureTempOrder();
|
|
606
|
-
|
|
711
|
+
_context9.next = 19;
|
|
607
712
|
return this.effectsEmit('onDiscountApplied', {
|
|
608
713
|
productList: tempOrder.products || [],
|
|
609
714
|
discountList: this.store.order.getDiscountList(),
|
|
@@ -611,7 +716,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
611
716
|
tempOrder: tempOrder
|
|
612
717
|
});
|
|
613
718
|
case 19:
|
|
614
|
-
return
|
|
719
|
+
return _context9.abrupt("return", _objectSpread(_objectSpread({
|
|
615
720
|
isAvailable: raw.isAvailable
|
|
616
721
|
}, raw.isAccepted !== undefined ? {
|
|
617
722
|
isAccepted: raw.isAccepted
|
|
@@ -622,9 +727,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
622
727
|
}));
|
|
623
728
|
case 20:
|
|
624
729
|
case "end":
|
|
625
|
-
return
|
|
730
|
+
return _context9.stop();
|
|
626
731
|
}
|
|
627
|
-
},
|
|
732
|
+
}, _callee9, this);
|
|
628
733
|
}));
|
|
629
734
|
function scanPromotionCode(_x3, _x4) {
|
|
630
735
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -634,42 +739,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
634
739
|
}, {
|
|
635
740
|
key: "hydrateOrderCustomerFromScanDiscounts",
|
|
636
741
|
value: function () {
|
|
637
|
-
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
742
|
+
var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(discounts) {
|
|
638
743
|
var currentOrderCustomer, customerId, customer;
|
|
639
|
-
return _regeneratorRuntime().wrap(function
|
|
640
|
-
while (1) switch (
|
|
744
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
745
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
641
746
|
case 0:
|
|
642
747
|
currentOrderCustomer = this.store.order.getOrderCustomer();
|
|
643
748
|
if (!currentOrderCustomer) {
|
|
644
|
-
|
|
749
|
+
_context10.next = 3;
|
|
645
750
|
break;
|
|
646
751
|
}
|
|
647
|
-
return
|
|
752
|
+
return _context10.abrupt("return");
|
|
648
753
|
case 3:
|
|
649
754
|
customerId = this.getDiscountCustomerId(discounts);
|
|
650
755
|
if (customerId) {
|
|
651
|
-
|
|
756
|
+
_context10.next = 6;
|
|
652
757
|
break;
|
|
653
758
|
}
|
|
654
|
-
return
|
|
759
|
+
return _context10.abrupt("return");
|
|
655
760
|
case 6:
|
|
656
|
-
|
|
761
|
+
_context10.next = 8;
|
|
657
762
|
return this.resolveCustomerByDiscountCustomerId(customerId);
|
|
658
763
|
case 8:
|
|
659
|
-
customer =
|
|
764
|
+
customer = _context10.sent;
|
|
660
765
|
if (customer) {
|
|
661
|
-
|
|
766
|
+
_context10.next = 11;
|
|
662
767
|
break;
|
|
663
768
|
}
|
|
664
|
-
return
|
|
769
|
+
return _context10.abrupt("return");
|
|
665
770
|
case 11:
|
|
666
771
|
this.store.customer.setSelectedCustomer(customer);
|
|
667
772
|
this.setOrderCustomer(customer);
|
|
668
773
|
case 13:
|
|
669
774
|
case "end":
|
|
670
|
-
return
|
|
775
|
+
return _context10.stop();
|
|
671
776
|
}
|
|
672
|
-
},
|
|
777
|
+
}, _callee10, this);
|
|
673
778
|
}));
|
|
674
779
|
function hydrateOrderCustomerFromScanDiscounts(_x5) {
|
|
675
780
|
return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
|
|
@@ -705,55 +810,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
705
810
|
}, {
|
|
706
811
|
key: "resolveCustomerById",
|
|
707
812
|
value: function () {
|
|
708
|
-
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
813
|
+
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(customerId) {
|
|
709
814
|
var _result$list;
|
|
710
815
|
var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
|
|
711
|
-
return _regeneratorRuntime().wrap(function
|
|
712
|
-
while (1) switch (
|
|
816
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
817
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
713
818
|
case 0:
|
|
714
819
|
localCustomers = this.store.customer.getCustomers();
|
|
715
820
|
localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
716
821
|
normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
|
|
717
822
|
if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
|
|
718
|
-
|
|
823
|
+
_context11.next = 5;
|
|
719
824
|
break;
|
|
720
825
|
}
|
|
721
|
-
return
|
|
826
|
+
return _context11.abrupt("return", normalizedLocalCustomer);
|
|
722
827
|
case 5:
|
|
723
|
-
|
|
828
|
+
_context11.next = 7;
|
|
724
829
|
return this.store.customer.queryCustomerList({
|
|
725
830
|
ids: [customerId],
|
|
726
831
|
skip: 1,
|
|
727
832
|
num: 1
|
|
728
833
|
});
|
|
729
834
|
case 7:
|
|
730
|
-
result =
|
|
835
|
+
result = _context11.sent;
|
|
731
836
|
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
732
837
|
if (!remoteCustomer) {
|
|
733
|
-
|
|
838
|
+
_context11.next = 11;
|
|
734
839
|
break;
|
|
735
840
|
}
|
|
736
|
-
return
|
|
841
|
+
return _context11.abrupt("return", this.normalizeCustomer(remoteCustomer));
|
|
737
842
|
case 11:
|
|
738
|
-
|
|
739
|
-
|
|
843
|
+
_context11.prev = 11;
|
|
844
|
+
_context11.next = 14;
|
|
740
845
|
return this.store.customer.queryCustomerDetail(customerId);
|
|
741
846
|
case 14:
|
|
742
|
-
detailCustomer =
|
|
743
|
-
return
|
|
847
|
+
detailCustomer = _context11.sent;
|
|
848
|
+
return _context11.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
|
|
744
849
|
case 18:
|
|
745
|
-
|
|
746
|
-
|
|
850
|
+
_context11.prev = 18;
|
|
851
|
+
_context11.t0 = _context11["catch"](11);
|
|
747
852
|
console.warn('[BookingTicket] resolveCustomerById detail request failed', {
|
|
748
853
|
customerId: customerId,
|
|
749
|
-
error:
|
|
854
|
+
error: _context11.t0
|
|
750
855
|
});
|
|
751
|
-
return
|
|
856
|
+
return _context11.abrupt("return", null);
|
|
752
857
|
case 22:
|
|
753
858
|
case "end":
|
|
754
|
-
return
|
|
859
|
+
return _context11.stop();
|
|
755
860
|
}
|
|
756
|
-
},
|
|
861
|
+
}, _callee11, this, [[11, 18]]);
|
|
757
862
|
}));
|
|
758
863
|
function resolveCustomerById(_x6) {
|
|
759
864
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -821,60 +926,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
821
926
|
}, {
|
|
822
927
|
key: "setBookingStatus",
|
|
823
928
|
value: (function () {
|
|
824
|
-
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
825
|
-
var _this$store$
|
|
929
|
+
var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(status) {
|
|
930
|
+
var _this$store$order2, _this$store$order2$ge;
|
|
826
931
|
var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
|
|
827
|
-
return _regeneratorRuntime().wrap(function
|
|
828
|
-
while (1) switch (
|
|
932
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
933
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
829
934
|
case 0:
|
|
830
|
-
tempOrder = (_this$store$
|
|
935
|
+
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);
|
|
831
936
|
if (tempOrder) {
|
|
832
|
-
|
|
937
|
+
_context12.next = 3;
|
|
833
938
|
break;
|
|
834
939
|
}
|
|
835
940
|
throw new Error('setBookingStatus: tempOrder 未加载');
|
|
836
941
|
case 3:
|
|
837
942
|
orderId = tempOrder.order_id;
|
|
838
943
|
if (!(orderId === undefined || orderId === null)) {
|
|
839
|
-
|
|
944
|
+
_context12.next = 6;
|
|
840
945
|
break;
|
|
841
946
|
}
|
|
842
947
|
throw new Error('setBookingStatus: tempOrder.order_id 缺失');
|
|
843
948
|
case 6:
|
|
844
949
|
scheduleId = resolveScheduleId(tempOrder);
|
|
845
950
|
if (!(scheduleId === null)) {
|
|
846
|
-
|
|
951
|
+
_context12.next = 9;
|
|
847
952
|
break;
|
|
848
953
|
}
|
|
849
954
|
throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
|
|
850
955
|
case 9:
|
|
851
956
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
852
957
|
previous = applyBookingsStatus(bookings, status);
|
|
853
|
-
|
|
854
|
-
|
|
958
|
+
_context12.prev = 11;
|
|
959
|
+
_context12.next = 14;
|
|
855
960
|
return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
|
|
856
961
|
appointment_status: status
|
|
857
962
|
});
|
|
858
963
|
case 14:
|
|
859
|
-
res =
|
|
860
|
-
|
|
964
|
+
res = _context12.sent;
|
|
965
|
+
_context12.next = 17;
|
|
861
966
|
return this.refreshSalesDetail();
|
|
862
967
|
case 17:
|
|
863
968
|
this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
|
|
864
969
|
orderId: orderId,
|
|
865
970
|
status: status
|
|
866
971
|
});
|
|
867
|
-
return
|
|
972
|
+
return _context12.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
|
|
868
973
|
case 21:
|
|
869
|
-
|
|
870
|
-
|
|
974
|
+
_context12.prev = 21;
|
|
975
|
+
_context12.t0 = _context12["catch"](11);
|
|
871
976
|
restoreBookingsStatus(bookings, previous);
|
|
872
|
-
throw
|
|
977
|
+
throw _context12.t0;
|
|
873
978
|
case 25:
|
|
874
979
|
case "end":
|
|
875
|
-
return
|
|
980
|
+
return _context12.stop();
|
|
876
981
|
}
|
|
877
|
-
},
|
|
982
|
+
}, _callee12, this, [[11, 21]]);
|
|
878
983
|
}));
|
|
879
984
|
function setBookingStatus(_x7) {
|
|
880
985
|
return _setBookingStatus.apply(this, arguments);
|
|
@@ -905,35 +1010,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
905
1010
|
}, {
|
|
906
1011
|
key: "transitionChildBooking",
|
|
907
1012
|
value: (function () {
|
|
908
|
-
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
909
|
-
var _this$store$
|
|
1013
|
+
var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
|
|
1014
|
+
var _this$store$order3, _this$store$order3$ge;
|
|
910
1015
|
var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
|
|
911
|
-
return _regeneratorRuntime().wrap(function
|
|
912
|
-
while (1) switch (
|
|
1016
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1017
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
913
1018
|
case 0:
|
|
914
1019
|
schedule_event_id = params.schedule_event_id, action = params.action;
|
|
915
1020
|
if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
|
|
916
|
-
|
|
1021
|
+
_context13.next = 3;
|
|
917
1022
|
break;
|
|
918
1023
|
}
|
|
919
1024
|
throw new Error('transitionChildBooking: schedule_event_id 不能为空');
|
|
920
1025
|
case 3:
|
|
921
1026
|
if (action) {
|
|
922
|
-
|
|
1027
|
+
_context13.next = 5;
|
|
923
1028
|
break;
|
|
924
1029
|
}
|
|
925
1030
|
throw new Error('transitionChildBooking: action 不能为空');
|
|
926
1031
|
case 5:
|
|
927
|
-
tempOrder = (_this$store$
|
|
1032
|
+
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);
|
|
928
1033
|
if (tempOrder) {
|
|
929
|
-
|
|
1034
|
+
_context13.next = 8;
|
|
930
1035
|
break;
|
|
931
1036
|
}
|
|
932
1037
|
throw new Error('transitionChildBooking: tempOrder 未加载');
|
|
933
1038
|
case 8:
|
|
934
1039
|
orderId = tempOrder.order_id;
|
|
935
1040
|
if (!(orderId === undefined || orderId === null)) {
|
|
936
|
-
|
|
1041
|
+
_context13.next = 11;
|
|
937
1042
|
break;
|
|
938
1043
|
}
|
|
939
1044
|
throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
|
|
@@ -941,14 +1046,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
941
1046
|
bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
|
|
942
1047
|
targetStatus = resolveStatusAfterTransition(action);
|
|
943
1048
|
previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
|
|
944
|
-
|
|
945
|
-
|
|
1049
|
+
_context13.prev = 14;
|
|
1050
|
+
_context13.next = 17;
|
|
946
1051
|
return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
|
|
947
1052
|
action: action
|
|
948
1053
|
});
|
|
949
1054
|
case 17:
|
|
950
|
-
res =
|
|
951
|
-
|
|
1055
|
+
res = _context13.sent;
|
|
1056
|
+
_context13.next = 20;
|
|
952
1057
|
return this.refreshSalesDetail();
|
|
953
1058
|
case 20:
|
|
954
1059
|
this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
|
|
@@ -957,19 +1062,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
957
1062
|
action: action,
|
|
958
1063
|
status: targetStatus
|
|
959
1064
|
});
|
|
960
|
-
return
|
|
1065
|
+
return _context13.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
|
|
961
1066
|
case 24:
|
|
962
|
-
|
|
963
|
-
|
|
1067
|
+
_context13.prev = 24;
|
|
1068
|
+
_context13.t0 = _context13["catch"](14);
|
|
964
1069
|
if (previous !== undefined) {
|
|
965
1070
|
restoreChildBookingStatus(bookings, schedule_event_id, previous);
|
|
966
1071
|
}
|
|
967
|
-
throw
|
|
1072
|
+
throw _context13.t0;
|
|
968
1073
|
case 28:
|
|
969
1074
|
case "end":
|
|
970
|
-
return
|
|
1075
|
+
return _context13.stop();
|
|
971
1076
|
}
|
|
972
|
-
},
|
|
1077
|
+
}, _callee13, this, [[14, 24]]);
|
|
973
1078
|
}));
|
|
974
1079
|
function transitionChildBooking(_x8) {
|
|
975
1080
|
return _transitionChildBooking.apply(this, arguments);
|
|
@@ -990,19 +1095,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
990
1095
|
}, {
|
|
991
1096
|
key: "refreshSalesDetail",
|
|
992
1097
|
value: (function () {
|
|
993
|
-
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
994
|
-
var _this$store$
|
|
1098
|
+
var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1099
|
+
var _this$store$order4, _this$store$order4$ge;
|
|
995
1100
|
var params,
|
|
996
1101
|
tempOrder,
|
|
997
1102
|
orderId,
|
|
998
|
-
|
|
999
|
-
return _regeneratorRuntime().wrap(function
|
|
1000
|
-
while (1) switch (
|
|
1103
|
+
_args14 = arguments;
|
|
1104
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1105
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1001
1106
|
case 0:
|
|
1002
|
-
params =
|
|
1003
|
-
tempOrder = (_this$store$
|
|
1107
|
+
params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
1108
|
+
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);
|
|
1004
1109
|
if (tempOrder) {
|
|
1005
|
-
|
|
1110
|
+
_context14.next = 4;
|
|
1006
1111
|
break;
|
|
1007
1112
|
}
|
|
1008
1113
|
throw new Error('refreshSalesDetail: tempOrder 未加载');
|
|
@@ -1010,21 +1115,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1010
1115
|
debugger;
|
|
1011
1116
|
orderId = tempOrder.order_id || tempOrder.external_sale_number;
|
|
1012
1117
|
if (!(orderId === undefined || orderId === null)) {
|
|
1013
|
-
|
|
1118
|
+
_context14.next = 8;
|
|
1014
1119
|
break;
|
|
1015
1120
|
}
|
|
1016
|
-
return
|
|
1121
|
+
return _context14.abrupt("return", {});
|
|
1017
1122
|
case 8:
|
|
1018
|
-
return
|
|
1123
|
+
return _context14.abrupt("return", this.loadSalesDetail({
|
|
1019
1124
|
orderId: orderId,
|
|
1020
1125
|
// merge: true
|
|
1021
1126
|
forceRemote: params.forceRemote
|
|
1022
1127
|
}));
|
|
1023
1128
|
case 9:
|
|
1024
1129
|
case "end":
|
|
1025
|
-
return
|
|
1130
|
+
return _context14.stop();
|
|
1026
1131
|
}
|
|
1027
|
-
},
|
|
1132
|
+
}, _callee14, this);
|
|
1028
1133
|
}));
|
|
1029
1134
|
function refreshSalesDetail() {
|
|
1030
1135
|
return _refreshSalesDetail.apply(this, arguments);
|
|
@@ -1040,7 +1145,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1040
1145
|
}, {
|
|
1041
1146
|
key: "loadProducts",
|
|
1042
1147
|
value: (function () {
|
|
1043
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1148
|
+
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1044
1149
|
var params,
|
|
1045
1150
|
options,
|
|
1046
1151
|
schedule_date,
|
|
@@ -1049,20 +1154,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1049
1154
|
schedule_datetime,
|
|
1050
1155
|
bookingDate,
|
|
1051
1156
|
_result,
|
|
1052
|
-
|
|
1053
|
-
return _regeneratorRuntime().wrap(function
|
|
1054
|
-
while (1) switch (
|
|
1157
|
+
_args15 = arguments;
|
|
1158
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1159
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1055
1160
|
case 0:
|
|
1056
|
-
params =
|
|
1057
|
-
options =
|
|
1161
|
+
params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
1162
|
+
options = _args15.length > 1 ? _args15[1] : undefined;
|
|
1058
1163
|
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 对齐;
|
|
1059
1164
|
// requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
|
|
1060
1165
|
bookingDate = schedule_datetime || schedule_date || '';
|
|
1061
1166
|
if (bookingDate) {
|
|
1062
1167
|
this.setBookingDate(bookingDate);
|
|
1063
1168
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1169
|
+
_context15.prev = 5;
|
|
1170
|
+
_context15.next = 8;
|
|
1066
1171
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1067
1172
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1068
1173
|
with_schedule: 1
|
|
@@ -1070,20 +1175,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1070
1175
|
cacheId: this.cacheId
|
|
1071
1176
|
}), options);
|
|
1072
1177
|
case 8:
|
|
1073
|
-
_result =
|
|
1178
|
+
_result = _context15.sent;
|
|
1074
1179
|
this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
|
|
1075
1180
|
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
|
|
1076
|
-
return
|
|
1181
|
+
return _context15.abrupt("return", _result);
|
|
1077
1182
|
case 14:
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
console.error('Failed to load products:',
|
|
1081
|
-
throw
|
|
1183
|
+
_context15.prev = 14;
|
|
1184
|
+
_context15.t0 = _context15["catch"](5);
|
|
1185
|
+
console.error('Failed to load products:', _context15.t0);
|
|
1186
|
+
throw _context15.t0;
|
|
1082
1187
|
case 18:
|
|
1083
1188
|
case "end":
|
|
1084
|
-
return
|
|
1189
|
+
return _context15.stop();
|
|
1085
1190
|
}
|
|
1086
|
-
},
|
|
1191
|
+
}, _callee15, this, [[5, 14]]);
|
|
1087
1192
|
}));
|
|
1088
1193
|
function loadProducts() {
|
|
1089
1194
|
return _loadProducts.apply(this, arguments);
|
|
@@ -1100,27 +1205,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1100
1205
|
}, {
|
|
1101
1206
|
key: "getAddTimeProducts",
|
|
1102
1207
|
value: (function () {
|
|
1103
|
-
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1208
|
+
var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1104
1209
|
var params,
|
|
1105
1210
|
result,
|
|
1106
|
-
|
|
1107
|
-
return _regeneratorRuntime().wrap(function
|
|
1108
|
-
while (1) switch (
|
|
1211
|
+
_args16 = arguments;
|
|
1212
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1213
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1109
1214
|
case 0:
|
|
1110
|
-
params =
|
|
1111
|
-
|
|
1215
|
+
params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
|
|
1216
|
+
_context16.next = 3;
|
|
1112
1217
|
return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
|
|
1113
1218
|
cacheId: this.cacheId
|
|
1114
1219
|
}));
|
|
1115
1220
|
case 3:
|
|
1116
|
-
result =
|
|
1221
|
+
result = _context16.sent;
|
|
1117
1222
|
this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
1118
|
-
return
|
|
1223
|
+
return _context16.abrupt("return", result);
|
|
1119
1224
|
case 6:
|
|
1120
1225
|
case "end":
|
|
1121
|
-
return
|
|
1226
|
+
return _context16.stop();
|
|
1122
1227
|
}
|
|
1123
|
-
},
|
|
1228
|
+
}, _callee16, this);
|
|
1124
1229
|
}));
|
|
1125
1230
|
function getAddTimeProducts() {
|
|
1126
1231
|
return _getAddTimeProducts.apply(this, arguments);
|
|
@@ -1145,14 +1250,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1145
1250
|
}, {
|
|
1146
1251
|
key: "queryProductDetail",
|
|
1147
1252
|
value: (function () {
|
|
1148
|
-
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1253
|
+
var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params, options) {
|
|
1149
1254
|
var product_id, queryParams, _result2, list;
|
|
1150
|
-
return _regeneratorRuntime().wrap(function
|
|
1151
|
-
while (1) switch (
|
|
1255
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1256
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1152
1257
|
case 0:
|
|
1153
1258
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
|
|
1154
|
-
|
|
1155
|
-
|
|
1259
|
+
_context17.prev = 1;
|
|
1260
|
+
_context17.next = 4;
|
|
1156
1261
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1157
1262
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
1158
1263
|
with_schedule: 1
|
|
@@ -1161,21 +1266,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1161
1266
|
cacheId: this.cacheId
|
|
1162
1267
|
}), options);
|
|
1163
1268
|
case 4:
|
|
1164
|
-
_result2 =
|
|
1269
|
+
_result2 = _context17.sent;
|
|
1165
1270
|
list = Array.isArray(_result2) ? _result2 : [];
|
|
1166
|
-
return
|
|
1271
|
+
return _context17.abrupt("return", list.find(function (product) {
|
|
1167
1272
|
return Number(product.id) === Number(product_id);
|
|
1168
1273
|
}));
|
|
1169
1274
|
case 9:
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
console.error('Failed to query product detail:',
|
|
1173
|
-
throw
|
|
1275
|
+
_context17.prev = 9;
|
|
1276
|
+
_context17.t0 = _context17["catch"](1);
|
|
1277
|
+
console.error('Failed to query product detail:', _context17.t0);
|
|
1278
|
+
throw _context17.t0;
|
|
1174
1279
|
case 13:
|
|
1175
1280
|
case "end":
|
|
1176
|
-
return
|
|
1281
|
+
return _context17.stop();
|
|
1177
1282
|
}
|
|
1178
|
-
},
|
|
1283
|
+
}, _callee17, this, [[1, 9]]);
|
|
1179
1284
|
}));
|
|
1180
1285
|
function queryProductDetail(_x9, _x10) {
|
|
1181
1286
|
return _queryProductDetail.apply(this, arguments);
|
|
@@ -1190,26 +1295,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1190
1295
|
}, {
|
|
1191
1296
|
key: "loadProductDetail",
|
|
1192
1297
|
value: (function () {
|
|
1193
|
-
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1298
|
+
var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params, options) {
|
|
1194
1299
|
var product_id, queryParams, products;
|
|
1195
|
-
return _regeneratorRuntime().wrap(function
|
|
1196
|
-
while (1) switch (
|
|
1300
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1301
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1197
1302
|
case 0:
|
|
1198
1303
|
product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
|
|
1199
|
-
|
|
1304
|
+
_context18.next = 3;
|
|
1200
1305
|
return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
|
|
1201
1306
|
product_ids: [product_id]
|
|
1202
1307
|
}), options);
|
|
1203
1308
|
case 3:
|
|
1204
|
-
products =
|
|
1205
|
-
return
|
|
1309
|
+
products = _context18.sent;
|
|
1310
|
+
return _context18.abrupt("return", products.find(function (product) {
|
|
1206
1311
|
return Number(product.id) === Number(product_id);
|
|
1207
1312
|
}));
|
|
1208
1313
|
case 5:
|
|
1209
1314
|
case "end":
|
|
1210
|
-
return
|
|
1315
|
+
return _context18.stop();
|
|
1211
1316
|
}
|
|
1212
|
-
},
|
|
1317
|
+
}, _callee18, this);
|
|
1213
1318
|
}));
|
|
1214
1319
|
function loadProductDetail(_x11, _x12) {
|
|
1215
1320
|
return _loadProductDetail.apply(this, arguments);
|
|
@@ -1244,16 +1349,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1244
1349
|
}, {
|
|
1245
1350
|
key: "getProducts",
|
|
1246
1351
|
value: (function () {
|
|
1247
|
-
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1248
|
-
return _regeneratorRuntime().wrap(function
|
|
1249
|
-
while (1) switch (
|
|
1352
|
+
var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1353
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1354
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1250
1355
|
case 0:
|
|
1251
|
-
return
|
|
1356
|
+
return _context19.abrupt("return", this.store.products.getProducts());
|
|
1252
1357
|
case 1:
|
|
1253
1358
|
case "end":
|
|
1254
|
-
return
|
|
1359
|
+
return _context19.stop();
|
|
1255
1360
|
}
|
|
1256
|
-
},
|
|
1361
|
+
}, _callee19, this);
|
|
1257
1362
|
}));
|
|
1258
1363
|
function getProducts() {
|
|
1259
1364
|
return _getProducts.apply(this, arguments);
|
|
@@ -1283,8 +1388,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1283
1388
|
}, {
|
|
1284
1389
|
key: "getCart",
|
|
1285
1390
|
value: function getCart() {
|
|
1286
|
-
var _this$store$order$
|
|
1287
|
-
var tempOrder = (_this$store$order$
|
|
1391
|
+
var _this$store$order$get, _this$store$order5, _salesDetail$bookings, _operatingDayBoundary, _operatingDayBoundary2, _tempOrder$_extend;
|
|
1392
|
+
var tempOrder = (_this$store$order$get = (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 ? void 0 : _this$store$order5.getTempOrder()) !== null && _this$store$order$get !== void 0 ? _this$store$order$get : null;
|
|
1288
1393
|
var salesDetail = this.getSalesOrder();
|
|
1289
1394
|
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) || [];
|
|
1290
1395
|
var operatingDayBoundary;
|
|
@@ -1318,33 +1423,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1318
1423
|
}, {
|
|
1319
1424
|
key: "getProductByIds",
|
|
1320
1425
|
value: (function () {
|
|
1321
|
-
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1426
|
+
var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(ids, options) {
|
|
1322
1427
|
var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
|
|
1323
1428
|
var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
|
|
1324
|
-
return _regeneratorRuntime().wrap(function
|
|
1325
|
-
while (1) switch (
|
|
1429
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1430
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1326
1431
|
case 0:
|
|
1327
1432
|
normalizedIds = Array.from(new Set((ids || []).map(function (id) {
|
|
1328
1433
|
return Number(id);
|
|
1329
1434
|
}).filter(function (id) {
|
|
1330
1435
|
return Number.isFinite(id);
|
|
1331
1436
|
})));
|
|
1332
|
-
|
|
1437
|
+
_context20.next = 3;
|
|
1333
1438
|
return this.store.products.getProductByIds(normalizedIds);
|
|
1334
1439
|
case 3:
|
|
1335
|
-
|
|
1336
|
-
if (
|
|
1337
|
-
|
|
1440
|
+
_context20.t0 = _context20.sent;
|
|
1441
|
+
if (_context20.t0) {
|
|
1442
|
+
_context20.next = 6;
|
|
1338
1443
|
break;
|
|
1339
1444
|
}
|
|
1340
|
-
|
|
1445
|
+
_context20.t0 = [];
|
|
1341
1446
|
case 6:
|
|
1342
|
-
localProducts =
|
|
1447
|
+
localProducts = _context20.t0;
|
|
1343
1448
|
if (options !== null && options !== void 0 && options.loadMissing) {
|
|
1344
|
-
|
|
1449
|
+
_context20.next = 9;
|
|
1345
1450
|
break;
|
|
1346
1451
|
}
|
|
1347
|
-
return
|
|
1452
|
+
return _context20.abrupt("return", localProducts);
|
|
1348
1453
|
case 9:
|
|
1349
1454
|
localProductIds = new Set(localProducts.map(function (product) {
|
|
1350
1455
|
return Number(product.id);
|
|
@@ -1353,15 +1458,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1353
1458
|
return !localProductIds.has(id);
|
|
1354
1459
|
});
|
|
1355
1460
|
if (missingIds.length) {
|
|
1356
|
-
|
|
1461
|
+
_context20.next = 13;
|
|
1357
1462
|
break;
|
|
1358
1463
|
}
|
|
1359
|
-
return
|
|
1464
|
+
return _context20.abrupt("return", localProducts);
|
|
1360
1465
|
case 13:
|
|
1361
1466
|
rawBookingDate = this.getBookingDate();
|
|
1362
1467
|
bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
|
|
1363
1468
|
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);
|
|
1364
|
-
|
|
1469
|
+
_context20.next = 18;
|
|
1365
1470
|
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
1366
1471
|
product_ids: missingIds,
|
|
1367
1472
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
@@ -1374,7 +1479,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1374
1479
|
customer_id: customerId
|
|
1375
1480
|
} : {}));
|
|
1376
1481
|
case 18:
|
|
1377
|
-
loadedProducts =
|
|
1482
|
+
loadedProducts = _context20.sent;
|
|
1378
1483
|
productById = new Map();
|
|
1379
1484
|
[].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
|
|
1380
1485
|
var productId = Number(product.id);
|
|
@@ -1382,16 +1487,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1382
1487
|
productById.set(productId, product);
|
|
1383
1488
|
}
|
|
1384
1489
|
});
|
|
1385
|
-
return
|
|
1490
|
+
return _context20.abrupt("return", normalizedIds.map(function (id) {
|
|
1386
1491
|
return productById.get(id);
|
|
1387
1492
|
}).filter(function (product) {
|
|
1388
1493
|
return Boolean(product);
|
|
1389
1494
|
}));
|
|
1390
1495
|
case 22:
|
|
1391
1496
|
case "end":
|
|
1392
|
-
return
|
|
1497
|
+
return _context20.stop();
|
|
1393
1498
|
}
|
|
1394
|
-
},
|
|
1499
|
+
}, _callee20, this);
|
|
1395
1500
|
}));
|
|
1396
1501
|
function getProductByIds(_x13, _x14) {
|
|
1397
1502
|
return _getProductByIds.apply(this, arguments);
|
|
@@ -1407,25 +1512,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1407
1512
|
}, {
|
|
1408
1513
|
key: "getScheduleTimePoints",
|
|
1409
1514
|
value: (function () {
|
|
1410
|
-
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1515
|
+
var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
|
|
1411
1516
|
var result;
|
|
1412
|
-
return _regeneratorRuntime().wrap(function
|
|
1413
|
-
while (1) switch (
|
|
1517
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1518
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1414
1519
|
case 0:
|
|
1415
|
-
|
|
1520
|
+
_context21.next = 2;
|
|
1416
1521
|
return this.request.post('/menu/schedule-time-points', {
|
|
1417
1522
|
menu_list_ids: params.menu_list_ids
|
|
1418
1523
|
}, {
|
|
1419
1524
|
osServer: true
|
|
1420
1525
|
});
|
|
1421
1526
|
case 2:
|
|
1422
|
-
result =
|
|
1423
|
-
return
|
|
1527
|
+
result = _context21.sent;
|
|
1528
|
+
return _context21.abrupt("return", result.data || []);
|
|
1424
1529
|
case 4:
|
|
1425
1530
|
case "end":
|
|
1426
|
-
return
|
|
1531
|
+
return _context21.stop();
|
|
1427
1532
|
}
|
|
1428
|
-
},
|
|
1533
|
+
}, _callee21, this);
|
|
1429
1534
|
}));
|
|
1430
1535
|
function getScheduleTimePoints(_x15) {
|
|
1431
1536
|
return _getScheduleTimePoints.apply(this, arguments);
|
|
@@ -1441,30 +1546,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1441
1546
|
}, {
|
|
1442
1547
|
key: "getCustomerList",
|
|
1443
1548
|
value: (function () {
|
|
1444
|
-
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1549
|
+
var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
1445
1550
|
var params,
|
|
1446
1551
|
_result3,
|
|
1447
|
-
|
|
1448
|
-
return _regeneratorRuntime().wrap(function
|
|
1449
|
-
while (1) switch (
|
|
1552
|
+
_args22 = arguments;
|
|
1553
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
1554
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1450
1555
|
case 0:
|
|
1451
|
-
params =
|
|
1452
|
-
|
|
1453
|
-
|
|
1556
|
+
params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
1557
|
+
_context22.prev = 1;
|
|
1558
|
+
_context22.next = 4;
|
|
1454
1559
|
return this.store.customer.getCustomerList(params);
|
|
1455
1560
|
case 4:
|
|
1456
|
-
_result3 =
|
|
1457
|
-
return
|
|
1561
|
+
_result3 = _context22.sent;
|
|
1562
|
+
return _context22.abrupt("return", _result3);
|
|
1458
1563
|
case 8:
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
console.error('Failed to get customer list:',
|
|
1462
|
-
throw
|
|
1564
|
+
_context22.prev = 8;
|
|
1565
|
+
_context22.t0 = _context22["catch"](1);
|
|
1566
|
+
console.error('Failed to get customer list:', _context22.t0);
|
|
1567
|
+
throw _context22.t0;
|
|
1463
1568
|
case 12:
|
|
1464
1569
|
case "end":
|
|
1465
|
-
return
|
|
1570
|
+
return _context22.stop();
|
|
1466
1571
|
}
|
|
1467
|
-
},
|
|
1572
|
+
}, _callee22, this, [[1, 8]]);
|
|
1468
1573
|
}));
|
|
1469
1574
|
function getCustomerList() {
|
|
1470
1575
|
return _getCustomerList.apply(this, arguments);
|
|
@@ -1571,13 +1676,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1571
1676
|
}, {
|
|
1572
1677
|
key: "setOrderCustomer",
|
|
1573
1678
|
value: function setOrderCustomer(customer, options) {
|
|
1574
|
-
var _this$store$order$
|
|
1679
|
+
var _this$store$order$get2,
|
|
1575
1680
|
_this3 = this;
|
|
1576
1681
|
if (!customer) {
|
|
1577
1682
|
this.clearOrderCustomer();
|
|
1578
1683
|
return;
|
|
1579
1684
|
}
|
|
1580
|
-
var previousCustomerId = (_this$store$order$
|
|
1685
|
+
var previousCustomerId = (_this$store$order$get2 = this.store.order.getOrderCustomer()) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2.customer_id;
|
|
1581
1686
|
var snapshotBeforeSet = this.store.order.getOrderCustomerSnapshot();
|
|
1582
1687
|
var patch = formatOrderCustomerPatch(customer);
|
|
1583
1688
|
var customerUnchanged = Number(previousCustomerId || 0) === Number(patch.customer_id || 0);
|
|
@@ -1684,24 +1789,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1684
1789
|
}, {
|
|
1685
1790
|
key: "restoreOrder",
|
|
1686
1791
|
value: (function () {
|
|
1687
|
-
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1792
|
+
var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
1688
1793
|
var _this$store$customer;
|
|
1689
1794
|
var tempOrder;
|
|
1690
|
-
return _regeneratorRuntime().wrap(function
|
|
1691
|
-
while (1) switch (
|
|
1795
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
1796
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1692
1797
|
case 0:
|
|
1693
|
-
|
|
1798
|
+
_context23.next = 2;
|
|
1694
1799
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
|
|
1695
1800
|
case 2:
|
|
1696
|
-
tempOrder =
|
|
1801
|
+
tempOrder = _context23.sent;
|
|
1697
1802
|
this.clearOrderCustomer();
|
|
1698
1803
|
(_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
|
|
1699
|
-
return
|
|
1804
|
+
return _context23.abrupt("return", tempOrder);
|
|
1700
1805
|
case 6:
|
|
1701
1806
|
case "end":
|
|
1702
|
-
return
|
|
1807
|
+
return _context23.stop();
|
|
1703
1808
|
}
|
|
1704
|
-
},
|
|
1809
|
+
}, _callee23, this);
|
|
1705
1810
|
}));
|
|
1706
1811
|
function restoreOrder() {
|
|
1707
1812
|
return _restoreOrder.apply(this, arguments);
|
|
@@ -1727,41 +1832,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1727
1832
|
return this.orderCustomerDiscountRefreshInFlight;
|
|
1728
1833
|
}
|
|
1729
1834
|
var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
|
|
1730
|
-
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1835
|
+
var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
1731
1836
|
var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
|
|
1732
1837
|
var currentCustomer, tempOrder, orderId, action;
|
|
1733
|
-
return _regeneratorRuntime().wrap(function
|
|
1734
|
-
while (1) switch (
|
|
1838
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
1839
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1735
1840
|
case 0:
|
|
1736
1841
|
if (!previousRefresh) {
|
|
1737
|
-
|
|
1842
|
+
_context24.next = 3;
|
|
1738
1843
|
break;
|
|
1739
1844
|
}
|
|
1740
|
-
|
|
1845
|
+
_context24.next = 3;
|
|
1741
1846
|
return previousRefresh.catch(function () {
|
|
1742
1847
|
return undefined;
|
|
1743
1848
|
});
|
|
1744
1849
|
case 3:
|
|
1745
1850
|
currentCustomer = _this5.store.order.getOrderCustomer();
|
|
1746
1851
|
if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
|
|
1747
|
-
|
|
1852
|
+
_context24.next = 6;
|
|
1748
1853
|
break;
|
|
1749
1854
|
}
|
|
1750
|
-
return
|
|
1855
|
+
return _context24.abrupt("return");
|
|
1751
1856
|
case 6:
|
|
1752
1857
|
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);
|
|
1753
1858
|
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);
|
|
1754
1859
|
action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
|
|
1755
|
-
|
|
1860
|
+
_context24.next = 11;
|
|
1756
1861
|
return _this5.loadDiscountConfig({
|
|
1757
1862
|
customerId: customerId,
|
|
1758
1863
|
action: action
|
|
1759
1864
|
});
|
|
1760
1865
|
case 11:
|
|
1761
1866
|
case "end":
|
|
1762
|
-
return
|
|
1867
|
+
return _context24.stop();
|
|
1763
1868
|
}
|
|
1764
|
-
},
|
|
1869
|
+
}, _callee24);
|
|
1765
1870
|
}))();
|
|
1766
1871
|
this.orderCustomerDiscountRefreshInFlight = refreshTask;
|
|
1767
1872
|
this.orderCustomerDiscountRefreshCustomerId = customerId;
|
|
@@ -1782,28 +1887,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1782
1887
|
}, {
|
|
1783
1888
|
key: "prepareProductPriceQueryContext",
|
|
1784
1889
|
value: function () {
|
|
1785
|
-
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1890
|
+
var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(customerId) {
|
|
1786
1891
|
var normalizedCustomerId, refreshTask, shouldWait;
|
|
1787
|
-
return _regeneratorRuntime().wrap(function
|
|
1788
|
-
while (1) switch (
|
|
1892
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1893
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1789
1894
|
case 0:
|
|
1790
|
-
|
|
1895
|
+
_context25.next = 2;
|
|
1791
1896
|
return Promise.resolve();
|
|
1792
1897
|
case 2:
|
|
1793
1898
|
normalizedCustomerId = Number(customerId || 0);
|
|
1794
1899
|
refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1795
1900
|
shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1796
1901
|
if (!(shouldWait && refreshTask)) {
|
|
1797
|
-
|
|
1902
|
+
_context25.next = 8;
|
|
1798
1903
|
break;
|
|
1799
1904
|
}
|
|
1800
|
-
|
|
1905
|
+
_context25.next = 8;
|
|
1801
1906
|
return refreshTask;
|
|
1802
1907
|
case 8:
|
|
1803
1908
|
case "end":
|
|
1804
|
-
return
|
|
1909
|
+
return _context25.stop();
|
|
1805
1910
|
}
|
|
1806
|
-
},
|
|
1911
|
+
}, _callee25, this);
|
|
1807
1912
|
}));
|
|
1808
1913
|
function prepareProductPriceQueryContext(_x16) {
|
|
1809
1914
|
return _prepareProductPriceQueryContext.apply(this, arguments);
|
|
@@ -1858,27 +1963,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1858
1963
|
}, {
|
|
1859
1964
|
key: "changeCustomerPage",
|
|
1860
1965
|
value: (function () {
|
|
1861
|
-
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1966
|
+
var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(page, pageSize) {
|
|
1862
1967
|
var _result4;
|
|
1863
|
-
return _regeneratorRuntime().wrap(function
|
|
1864
|
-
while (1) switch (
|
|
1968
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
1969
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
1865
1970
|
case 0:
|
|
1866
|
-
|
|
1867
|
-
|
|
1971
|
+
_context26.prev = 0;
|
|
1972
|
+
_context26.next = 3;
|
|
1868
1973
|
return this.store.customer.changeCustomerPage(page, pageSize);
|
|
1869
1974
|
case 3:
|
|
1870
|
-
_result4 =
|
|
1871
|
-
return
|
|
1975
|
+
_result4 = _context26.sent;
|
|
1976
|
+
return _context26.abrupt("return", _result4);
|
|
1872
1977
|
case 7:
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
console.error('Failed to change customer page:',
|
|
1876
|
-
throw
|
|
1978
|
+
_context26.prev = 7;
|
|
1979
|
+
_context26.t0 = _context26["catch"](0);
|
|
1980
|
+
console.error('Failed to change customer page:', _context26.t0);
|
|
1981
|
+
throw _context26.t0;
|
|
1877
1982
|
case 11:
|
|
1878
1983
|
case "end":
|
|
1879
|
-
return
|
|
1984
|
+
return _context26.stop();
|
|
1880
1985
|
}
|
|
1881
|
-
},
|
|
1986
|
+
}, _callee26, this, [[0, 7]]);
|
|
1882
1987
|
}));
|
|
1883
1988
|
function changeCustomerPage(_x17, _x18) {
|
|
1884
1989
|
return _changeCustomerPage.apply(this, arguments);
|
|
@@ -1893,28 +1998,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1893
1998
|
}, {
|
|
1894
1999
|
key: "loadMoreCustomers",
|
|
1895
2000
|
value: (function () {
|
|
1896
|
-
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2001
|
+
var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
1897
2002
|
var _result5;
|
|
1898
|
-
return _regeneratorRuntime().wrap(function
|
|
1899
|
-
while (1) switch (
|
|
2003
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2004
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
1900
2005
|
case 0:
|
|
1901
|
-
|
|
1902
|
-
|
|
2006
|
+
_context27.prev = 0;
|
|
2007
|
+
_context27.next = 3;
|
|
1903
2008
|
return this.store.customer.loadMoreCustomers();
|
|
1904
2009
|
case 3:
|
|
1905
|
-
_result5 =
|
|
2010
|
+
_result5 = _context27.sent;
|
|
1906
2011
|
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
|
|
1907
|
-
return
|
|
2012
|
+
return _context27.abrupt("return", _result5);
|
|
1908
2013
|
case 8:
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
console.error('Failed to load more customers:',
|
|
1912
|
-
throw
|
|
2014
|
+
_context27.prev = 8;
|
|
2015
|
+
_context27.t0 = _context27["catch"](0);
|
|
2016
|
+
console.error('Failed to load more customers:', _context27.t0);
|
|
2017
|
+
throw _context27.t0;
|
|
1913
2018
|
case 12:
|
|
1914
2019
|
case "end":
|
|
1915
|
-
return
|
|
2020
|
+
return _context27.stop();
|
|
1916
2021
|
}
|
|
1917
|
-
},
|
|
2022
|
+
}, _callee27, this, [[0, 8]]);
|
|
1918
2023
|
}));
|
|
1919
2024
|
function loadMoreCustomers() {
|
|
1920
2025
|
return _loadMoreCustomers.apply(this, arguments);
|
|
@@ -1930,31 +2035,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1930
2035
|
}, {
|
|
1931
2036
|
key: "resetAndLoadCustomers",
|
|
1932
2037
|
value: (function () {
|
|
1933
|
-
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2038
|
+
var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
1934
2039
|
var params,
|
|
1935
2040
|
_result6,
|
|
1936
|
-
|
|
1937
|
-
return _regeneratorRuntime().wrap(function
|
|
1938
|
-
while (1) switch (
|
|
2041
|
+
_args28 = arguments;
|
|
2042
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2043
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
1939
2044
|
case 0:
|
|
1940
|
-
params =
|
|
1941
|
-
|
|
1942
|
-
|
|
2045
|
+
params = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
|
|
2046
|
+
_context28.prev = 1;
|
|
2047
|
+
_context28.next = 4;
|
|
1943
2048
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
1944
2049
|
case 4:
|
|
1945
|
-
_result6 =
|
|
2050
|
+
_result6 = _context28.sent;
|
|
1946
2051
|
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
|
|
1947
|
-
return
|
|
2052
|
+
return _context28.abrupt("return", _result6);
|
|
1948
2053
|
case 9:
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
console.error('Failed to reset and load customers:',
|
|
1952
|
-
throw
|
|
2054
|
+
_context28.prev = 9;
|
|
2055
|
+
_context28.t0 = _context28["catch"](1);
|
|
2056
|
+
console.error('Failed to reset and load customers:', _context28.t0);
|
|
2057
|
+
throw _context28.t0;
|
|
1953
2058
|
case 13:
|
|
1954
2059
|
case "end":
|
|
1955
|
-
return
|
|
2060
|
+
return _context28.stop();
|
|
1956
2061
|
}
|
|
1957
|
-
},
|
|
2062
|
+
}, _callee28, this, [[1, 9]]);
|
|
1958
2063
|
}));
|
|
1959
2064
|
function resetAndLoadCustomers() {
|
|
1960
2065
|
return _resetAndLoadCustomers.apply(this, arguments);
|
|
@@ -2115,16 +2220,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2115
2220
|
}, {
|
|
2116
2221
|
key: "getOtherParams",
|
|
2117
2222
|
value: (function () {
|
|
2118
|
-
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2119
|
-
return _regeneratorRuntime().wrap(function
|
|
2120
|
-
while (1) switch (
|
|
2223
|
+
var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2224
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2225
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2121
2226
|
case 0:
|
|
2122
|
-
return
|
|
2227
|
+
return _context29.abrupt("return", this.otherParams);
|
|
2123
2228
|
case 1:
|
|
2124
2229
|
case "end":
|
|
2125
|
-
return
|
|
2230
|
+
return _context29.stop();
|
|
2126
2231
|
}
|
|
2127
|
-
},
|
|
2232
|
+
}, _callee29, this);
|
|
2128
2233
|
}));
|
|
2129
2234
|
function getOtherParams() {
|
|
2130
2235
|
return _getOtherParams.apply(this, arguments);
|
|
@@ -2334,10 +2439,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2334
2439
|
}, {
|
|
2335
2440
|
key: "buildAddProductCtx",
|
|
2336
2441
|
value: function buildAddProductCtx(extra) {
|
|
2337
|
-
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$
|
|
2442
|
+
var _extra$date2, _ref12, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get3, _extra$presetStartTim2;
|
|
2338
2443
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2339
2444
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2340
|
-
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$
|
|
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$get3 = this.store.order.getTempOrder()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2341
2446
|
return _objectSpread(_objectSpread({
|
|
2342
2447
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2343
2448
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
@@ -2445,16 +2550,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2445
2550
|
}, {
|
|
2446
2551
|
key: "updateProductInOrder",
|
|
2447
2552
|
value: (function () {
|
|
2448
|
-
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2449
|
-
return _regeneratorRuntime().wrap(function
|
|
2450
|
-
while (1) switch (
|
|
2553
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
|
|
2554
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2555
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2451
2556
|
case 0:
|
|
2452
|
-
return
|
|
2557
|
+
return _context30.abrupt("return", this.updateOrderProduct(params));
|
|
2453
2558
|
case 1:
|
|
2454
2559
|
case "end":
|
|
2455
|
-
return
|
|
2560
|
+
return _context30.stop();
|
|
2456
2561
|
}
|
|
2457
|
-
},
|
|
2562
|
+
}, _callee30, this);
|
|
2458
2563
|
}));
|
|
2459
2564
|
function updateProductInOrder(_x19) {
|
|
2460
2565
|
return _updateProductInOrder.apply(this, arguments);
|
|
@@ -2478,47 +2583,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2478
2583
|
}, {
|
|
2479
2584
|
key: "handleGlobalScanCode",
|
|
2480
2585
|
value: (function () {
|
|
2481
|
-
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2586
|
+
var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(code, bridge) {
|
|
2482
2587
|
var _this7 = this;
|
|
2483
2588
|
var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
|
|
2484
|
-
return _regeneratorRuntime().wrap(function
|
|
2485
|
-
while (1) switch (
|
|
2589
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2590
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2486
2591
|
case 0:
|
|
2487
2592
|
trimmed = typeof code === 'string' ? code.trim() : '';
|
|
2488
2593
|
if (trimmed) {
|
|
2489
|
-
|
|
2594
|
+
_context31.next = 4;
|
|
2490
2595
|
break;
|
|
2491
2596
|
}
|
|
2492
2597
|
bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2493
|
-
return
|
|
2598
|
+
return _context31.abrupt("return", {
|
|
2494
2599
|
status: 'failed',
|
|
2495
2600
|
reason: 'empty_code'
|
|
2496
2601
|
});
|
|
2497
2602
|
case 4:
|
|
2498
|
-
|
|
2603
|
+
_context31.prev = 4;
|
|
2499
2604
|
localSearch = function localSearch(v) {
|
|
2500
2605
|
return _this7.store.products.findProductsByCodeOrBarcode(v);
|
|
2501
2606
|
};
|
|
2502
2607
|
scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
2503
|
-
|
|
2608
|
+
_context31.next = 9;
|
|
2504
2609
|
return scanCallback({
|
|
2505
2610
|
type: 'nativeScanner',
|
|
2506
2611
|
value: trimmed
|
|
2507
2612
|
});
|
|
2508
2613
|
case 9:
|
|
2509
|
-
raw =
|
|
2614
|
+
raw = _context31.sent;
|
|
2510
2615
|
formatted = formatGlobalScanResult(raw, trimmed);
|
|
2511
2616
|
if (formatted) {
|
|
2512
|
-
|
|
2617
|
+
_context31.next = 14;
|
|
2513
2618
|
break;
|
|
2514
2619
|
}
|
|
2515
2620
|
bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2516
|
-
return
|
|
2621
|
+
return _context31.abrupt("return", {
|
|
2517
2622
|
status: 'failed',
|
|
2518
2623
|
reason: 'not_found'
|
|
2519
2624
|
});
|
|
2520
2625
|
case 14:
|
|
2521
|
-
|
|
2626
|
+
_context31.next = 16;
|
|
2522
2627
|
return applyGlobalScan({
|
|
2523
2628
|
setOrderCustomer: function setOrderCustomer(customer) {
|
|
2524
2629
|
return _this7.setOrderCustomer(customer);
|
|
@@ -2553,23 +2658,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2553
2658
|
}
|
|
2554
2659
|
}, formatted, bridge);
|
|
2555
2660
|
case 16:
|
|
2556
|
-
_result7 =
|
|
2661
|
+
_result7 = _context31.sent;
|
|
2557
2662
|
bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
|
|
2558
|
-
return
|
|
2663
|
+
return _context31.abrupt("return", _result7);
|
|
2559
2664
|
case 21:
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
console.error('[BookingTicket] handleGlobalScanCode failed',
|
|
2665
|
+
_context31.prev = 21;
|
|
2666
|
+
_context31.t0 = _context31["catch"](4);
|
|
2667
|
+
console.error('[BookingTicket] handleGlobalScanCode failed', _context31.t0);
|
|
2563
2668
|
bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
2564
|
-
return
|
|
2669
|
+
return _context31.abrupt("return", {
|
|
2565
2670
|
status: 'failed',
|
|
2566
2671
|
reason: 'not_found'
|
|
2567
2672
|
});
|
|
2568
2673
|
case 26:
|
|
2569
2674
|
case "end":
|
|
2570
|
-
return
|
|
2675
|
+
return _context31.stop();
|
|
2571
2676
|
}
|
|
2572
|
-
},
|
|
2677
|
+
}, _callee31, this, [[4, 21]]);
|
|
2573
2678
|
}));
|
|
2574
2679
|
function handleGlobalScanCode(_x20, _x21) {
|
|
2575
2680
|
return _handleGlobalScanCode.apply(this, arguments);
|
|
@@ -2653,11 +2758,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2653
2758
|
}, {
|
|
2654
2759
|
key: "addAddTimeProductToBooking",
|
|
2655
2760
|
value: (function () {
|
|
2656
|
-
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2657
|
-
return _regeneratorRuntime().wrap(function
|
|
2658
|
-
while (1) switch (
|
|
2761
|
+
var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(input) {
|
|
2762
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2763
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2659
2764
|
case 0:
|
|
2660
|
-
return
|
|
2765
|
+
return _context32.abrupt("return", this.addAddTimeProductsToBooking({
|
|
2661
2766
|
booking: input.booking,
|
|
2662
2767
|
products: [input],
|
|
2663
2768
|
coveredMinutes: input.coveredMinutes,
|
|
@@ -2665,9 +2770,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2665
2770
|
}));
|
|
2666
2771
|
case 1:
|
|
2667
2772
|
case "end":
|
|
2668
|
-
return
|
|
2773
|
+
return _context32.stop();
|
|
2669
2774
|
}
|
|
2670
|
-
},
|
|
2775
|
+
}, _callee32, this);
|
|
2671
2776
|
}));
|
|
2672
2777
|
function addAddTimeProductToBooking(_x22) {
|
|
2673
2778
|
return _addAddTimeProductToBooking.apply(this, arguments);
|
|
@@ -2687,16 +2792,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2687
2792
|
}, {
|
|
2688
2793
|
key: "addAddTimeProductsToBooking",
|
|
2689
2794
|
value: (function () {
|
|
2690
|
-
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2795
|
+
var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(input) {
|
|
2691
2796
|
var _this8 = this,
|
|
2692
2797
|
_input$bookingPatch;
|
|
2693
2798
|
var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
|
|
2694
|
-
return _regeneratorRuntime().wrap(function
|
|
2695
|
-
while (1) switch (
|
|
2799
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2800
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
2696
2801
|
case 0:
|
|
2697
2802
|
bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
|
|
2698
2803
|
if (bookingUid) {
|
|
2699
|
-
|
|
2804
|
+
_context33.next = 3;
|
|
2700
2805
|
break;
|
|
2701
2806
|
}
|
|
2702
2807
|
throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
|
|
@@ -2707,7 +2812,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2707
2812
|
};
|
|
2708
2813
|
});
|
|
2709
2814
|
if (this.store.order) {
|
|
2710
|
-
|
|
2815
|
+
_context33.next = 6;
|
|
2711
2816
|
break;
|
|
2712
2817
|
}
|
|
2713
2818
|
throw new Error('order 模块未初始化');
|
|
@@ -2721,53 +2826,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2721
2826
|
});
|
|
2722
2827
|
}
|
|
2723
2828
|
if (!(typeof this.store.order.addProductsToOrder === 'function')) {
|
|
2724
|
-
|
|
2829
|
+
_context33.next = 11;
|
|
2725
2830
|
break;
|
|
2726
2831
|
}
|
|
2727
|
-
return
|
|
2832
|
+
return _context33.abrupt("return", this.store.order.addProductsToOrder(orderLines));
|
|
2728
2833
|
case 11:
|
|
2729
2834
|
result = [];
|
|
2730
2835
|
_iterator2 = _createForOfIteratorHelper(orderLines);
|
|
2731
|
-
|
|
2836
|
+
_context33.prev = 13;
|
|
2732
2837
|
_iterator2.s();
|
|
2733
2838
|
case 15:
|
|
2734
2839
|
if ((_step2 = _iterator2.n()).done) {
|
|
2735
|
-
|
|
2840
|
+
_context33.next = 29;
|
|
2736
2841
|
break;
|
|
2737
2842
|
}
|
|
2738
2843
|
line = _step2.value;
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2844
|
+
_context33.t0 = result.splice;
|
|
2845
|
+
_context33.t1 = result;
|
|
2846
|
+
_context33.t2 = [0, result.length];
|
|
2847
|
+
_context33.t3 = _toConsumableArray;
|
|
2848
|
+
_context33.next = 23;
|
|
2744
2849
|
return this.addProductToOrder(line.product);
|
|
2745
2850
|
case 23:
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2851
|
+
_context33.t4 = _context33.sent;
|
|
2852
|
+
_context33.t5 = (0, _context33.t3)(_context33.t4);
|
|
2853
|
+
_context33.t6 = _context33.t2.concat.call(_context33.t2, _context33.t5);
|
|
2854
|
+
_context33.t0.apply.call(_context33.t0, _context33.t1, _context33.t6);
|
|
2750
2855
|
case 27:
|
|
2751
|
-
|
|
2856
|
+
_context33.next = 15;
|
|
2752
2857
|
break;
|
|
2753
2858
|
case 29:
|
|
2754
|
-
|
|
2859
|
+
_context33.next = 34;
|
|
2755
2860
|
break;
|
|
2756
2861
|
case 31:
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
_iterator2.e(
|
|
2862
|
+
_context33.prev = 31;
|
|
2863
|
+
_context33.t7 = _context33["catch"](13);
|
|
2864
|
+
_iterator2.e(_context33.t7);
|
|
2760
2865
|
case 34:
|
|
2761
|
-
|
|
2866
|
+
_context33.prev = 34;
|
|
2762
2867
|
_iterator2.f();
|
|
2763
|
-
return
|
|
2868
|
+
return _context33.finish(34);
|
|
2764
2869
|
case 37:
|
|
2765
|
-
return
|
|
2870
|
+
return _context33.abrupt("return", result);
|
|
2766
2871
|
case 38:
|
|
2767
2872
|
case "end":
|
|
2768
|
-
return
|
|
2873
|
+
return _context33.stop();
|
|
2769
2874
|
}
|
|
2770
|
-
},
|
|
2875
|
+
}, _callee33, this, [[13, 31, 34, 37]]);
|
|
2771
2876
|
}));
|
|
2772
2877
|
function addAddTimeProductsToBooking(_x23) {
|
|
2773
2878
|
return _addAddTimeProductsToBooking.apply(this, arguments);
|
|
@@ -2777,31 +2882,41 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2777
2882
|
}, {
|
|
2778
2883
|
key: "setOtherParams",
|
|
2779
2884
|
value: function () {
|
|
2780
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2885
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
|
|
2781
2886
|
var _ref19,
|
|
2782
2887
|
_ref19$cover,
|
|
2783
2888
|
cover,
|
|
2784
|
-
|
|
2785
|
-
return _regeneratorRuntime().wrap(function
|
|
2786
|
-
while (1) switch (
|
|
2889
|
+
_args34 = arguments;
|
|
2890
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2891
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
2787
2892
|
case 0:
|
|
2788
|
-
_ref19 =
|
|
2789
|
-
|
|
2893
|
+
_ref19 = _args34.length > 1 && _args34[1] !== undefined ? _args34[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
|
|
2894
|
+
_context34.next = 3;
|
|
2790
2895
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
|
|
2791
2896
|
cover: cover
|
|
2792
2897
|
});
|
|
2793
2898
|
case 3:
|
|
2794
2899
|
if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
|
|
2795
|
-
|
|
2900
|
+
_context34.next = 8;
|
|
2796
2901
|
break;
|
|
2797
2902
|
}
|
|
2798
|
-
|
|
2903
|
+
_context34.next = 6;
|
|
2799
2904
|
return this.configureIdGeneratorFromOpenData();
|
|
2800
2905
|
case 6:
|
|
2906
|
+
_context34.next = 11;
|
|
2907
|
+
break;
|
|
2908
|
+
case 8:
|
|
2909
|
+
if (!((params === null || params === void 0 ? void 0 : params.channel) !== undefined)) {
|
|
2910
|
+
_context34.next = 11;
|
|
2911
|
+
break;
|
|
2912
|
+
}
|
|
2913
|
+
_context34.next = 11;
|
|
2914
|
+
return this.loadOpenDataConfig();
|
|
2915
|
+
case 11:
|
|
2801
2916
|
case "end":
|
|
2802
|
-
return
|
|
2917
|
+
return _context34.stop();
|
|
2803
2918
|
}
|
|
2804
|
-
},
|
|
2919
|
+
}, _callee34, this);
|
|
2805
2920
|
}));
|
|
2806
2921
|
function setOtherParams(_x24) {
|
|
2807
2922
|
return _setOtherParams.apply(this, arguments);
|
|
@@ -2820,15 +2935,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2820
2935
|
}, {
|
|
2821
2936
|
key: "handlePrintWristband",
|
|
2822
2937
|
value: function () {
|
|
2823
|
-
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2938
|
+
var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
|
|
2824
2939
|
var _this$getOrderIdentit;
|
|
2825
2940
|
var deviceTask, deviceId, idempotencyKey;
|
|
2826
|
-
return _regeneratorRuntime().wrap(function
|
|
2827
|
-
while (1) switch (
|
|
2941
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2942
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
2828
2943
|
case 0:
|
|
2829
2944
|
deviceTask = this.getDeviceTaskPlugin();
|
|
2830
2945
|
if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
|
|
2831
|
-
|
|
2946
|
+
_context35.next = 4;
|
|
2832
2947
|
break;
|
|
2833
2948
|
}
|
|
2834
2949
|
this.logger.addLog({
|
|
@@ -2838,7 +2953,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2838
2953
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2839
2954
|
}
|
|
2840
2955
|
});
|
|
2841
|
-
return
|
|
2956
|
+
return _context35.abrupt("return");
|
|
2842
2957
|
case 4:
|
|
2843
2958
|
this.logger.addLog({
|
|
2844
2959
|
type: 'info',
|
|
@@ -2847,10 +2962,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2847
2962
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2848
2963
|
}
|
|
2849
2964
|
});
|
|
2850
|
-
|
|
2965
|
+
_context35.next = 7;
|
|
2851
2966
|
return this.getShortNumberOrDeviceId();
|
|
2852
2967
|
case 7:
|
|
2853
|
-
deviceId =
|
|
2968
|
+
deviceId = _context35.sent;
|
|
2854
2969
|
idempotencyKey = createUuidV4();
|
|
2855
2970
|
deviceTask.dispatch({
|
|
2856
2971
|
action: 'print_all',
|
|
@@ -2870,9 +2985,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2870
2985
|
});
|
|
2871
2986
|
case 10:
|
|
2872
2987
|
case "end":
|
|
2873
|
-
return
|
|
2988
|
+
return _context35.stop();
|
|
2874
2989
|
}
|
|
2875
|
-
},
|
|
2990
|
+
}, _callee35, this);
|
|
2876
2991
|
}));
|
|
2877
2992
|
function handlePrintWristband(_x25) {
|
|
2878
2993
|
return _handlePrintWristband.apply(this, arguments);
|
|
@@ -2882,11 +2997,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2882
2997
|
}, {
|
|
2883
2998
|
key: "handleRedeem",
|
|
2884
2999
|
value: function () {
|
|
2885
|
-
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2886
|
-
var _this$store$
|
|
3000
|
+
var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
|
|
3001
|
+
var _this$store$order6, _this$store$order6$ge, _this$store$order7, _ref20, _tempOrder$order_id2;
|
|
2887
3002
|
var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
|
|
2888
|
-
return _regeneratorRuntime().wrap(function
|
|
2889
|
-
while (1) switch (
|
|
3003
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3004
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
2890
3005
|
case 0:
|
|
2891
3006
|
voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
|
|
2892
3007
|
status = params.is_checkin ? 'used' : 'unused';
|
|
@@ -2899,8 +3014,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2899
3014
|
}
|
|
2900
3015
|
});
|
|
2901
3016
|
voucherIdSet = new Set(voucherIds);
|
|
2902
|
-
tempOrder = (_this$store$
|
|
2903
|
-
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$
|
|
3017
|
+
tempOrder = (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$ge = _this$store$order6.getTempOrder) === null || _this$store$order6$ge === void 0 ? void 0 : _this$store$order6$ge.call(_this$store$order6);
|
|
3018
|
+
vouchers = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.vouchers) || ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.getVouchers()) || [];
|
|
2904
3019
|
hasUpdatedVoucher = false;
|
|
2905
3020
|
nextVouchers = vouchers.map(function (voucher) {
|
|
2906
3021
|
if (!voucherIdSet.has(voucher.voucher_id)) return voucher;
|
|
@@ -2910,20 +3025,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2910
3025
|
});
|
|
2911
3026
|
});
|
|
2912
3027
|
if (!(tempOrder && hasUpdatedVoucher)) {
|
|
2913
|
-
|
|
3028
|
+
_context36.next = 11;
|
|
2914
3029
|
break;
|
|
2915
3030
|
}
|
|
2916
|
-
|
|
3031
|
+
_context36.next = 11;
|
|
2917
3032
|
return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
|
|
2918
3033
|
vouchers: nextVouchers
|
|
2919
3034
|
}));
|
|
2920
3035
|
case 11:
|
|
2921
3036
|
this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
|
|
2922
3037
|
if (!(voucherIds.length === 0)) {
|
|
2923
|
-
|
|
3038
|
+
_context36.next = 14;
|
|
2924
3039
|
break;
|
|
2925
3040
|
}
|
|
2926
|
-
return
|
|
3041
|
+
return _context36.abrupt("return", {
|
|
2927
3042
|
code: 200,
|
|
2928
3043
|
status: true,
|
|
2929
3044
|
message: '',
|
|
@@ -2934,7 +3049,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2934
3049
|
externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
|
|
2935
3050
|
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;
|
|
2936
3051
|
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;
|
|
2937
|
-
return
|
|
3052
|
+
return _context36.abrupt("return", this.request.post('/machinecode/batch', {
|
|
2938
3053
|
ids: voucherIds,
|
|
2939
3054
|
status: status,
|
|
2940
3055
|
order_lookup: orderLookup,
|
|
@@ -2945,9 +3060,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2945
3060
|
}));
|
|
2946
3061
|
case 19:
|
|
2947
3062
|
case "end":
|
|
2948
|
-
return
|
|
3063
|
+
return _context36.stop();
|
|
2949
3064
|
}
|
|
2950
|
-
},
|
|
3065
|
+
}, _callee36, this);
|
|
2951
3066
|
}));
|
|
2952
3067
|
function handleRedeem(_x26) {
|
|
2953
3068
|
return _handleRedeem.apply(this, arguments);
|
|
@@ -2961,12 +3076,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2961
3076
|
}, {
|
|
2962
3077
|
key: "destroy",
|
|
2963
3078
|
value: (function () {
|
|
2964
|
-
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3079
|
+
var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
2965
3080
|
var _this$scan;
|
|
2966
|
-
return _regeneratorRuntime().wrap(function
|
|
2967
|
-
while (1) switch (
|
|
3081
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3082
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
2968
3083
|
case 0:
|
|
2969
|
-
|
|
3084
|
+
_context37.next = 2;
|
|
2970
3085
|
return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
|
|
2971
3086
|
case 2:
|
|
2972
3087
|
try {
|
|
@@ -2977,9 +3092,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2977
3092
|
scanCache.clear();
|
|
2978
3093
|
case 4:
|
|
2979
3094
|
case "end":
|
|
2980
|
-
return
|
|
3095
|
+
return _context37.stop();
|
|
2981
3096
|
}
|
|
2982
|
-
},
|
|
3097
|
+
}, _callee37, this);
|
|
2983
3098
|
}));
|
|
2984
3099
|
function destroy() {
|
|
2985
3100
|
return _destroy.apply(this, arguments);
|