@pisell/pisellos 2.2.205 → 2.2.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/OpenData/index.d.ts +1 -0
  3. package/dist/modules/OpenData/index.js +21 -16
  4. package/dist/modules/Order/index.d.ts +9 -0
  5. package/dist/modules/Order/index.js +230 -145
  6. package/dist/modules/Order/types.d.ts +10 -0
  7. package/dist/modules/Order/utils.js +7 -5
  8. package/dist/server/index.d.ts +136 -0
  9. package/dist/server/index.js +2055 -781
  10. package/dist/server/modules/order/index.d.ts +7 -0
  11. package/dist/server/modules/order/index.js +375 -337
  12. package/dist/server/modules/order/types.d.ts +15 -0
  13. package/dist/server/modules/order/types.js +8 -0
  14. package/dist/server/utils/small-ticket.d.ts +69 -0
  15. package/dist/server/utils/small-ticket.js +528 -0
  16. package/dist/solution/BaseSales/index.d.ts +4 -2
  17. package/dist/solution/BaseSales/index.js +248 -188
  18. package/dist/solution/BookingByStep/index.d.ts +1 -1
  19. package/dist/solution/BookingTicket/index.d.ts +8 -1
  20. package/dist/solution/BookingTicket/index.js +443 -263
  21. package/dist/solution/BookingTicket/types.d.ts +2 -1
  22. package/dist/solution/BookingTicket/types.js +3 -1
  23. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  24. package/lib/modules/OpenData/index.d.ts +1 -0
  25. package/lib/modules/OpenData/index.js +6 -4
  26. package/lib/modules/Order/index.d.ts +9 -0
  27. package/lib/modules/Order/index.js +59 -3
  28. package/lib/modules/Order/types.d.ts +10 -0
  29. package/lib/modules/Order/utils.js +4 -3
  30. package/lib/server/index.d.ts +136 -0
  31. package/lib/server/index.js +823 -50
  32. package/lib/server/modules/order/index.d.ts +7 -0
  33. package/lib/server/modules/order/index.js +21 -7
  34. package/lib/server/modules/order/types.d.ts +15 -0
  35. package/lib/server/utils/small-ticket.d.ts +69 -0
  36. package/lib/server/utils/small-ticket.js +555 -0
  37. package/lib/solution/BaseSales/index.d.ts +4 -2
  38. package/lib/solution/BaseSales/index.js +47 -1
  39. package/lib/solution/BookingByStep/index.d.ts +1 -1
  40. package/lib/solution/BookingTicket/index.d.ts +8 -1
  41. package/lib/solution/BookingTicket/index.js +108 -1
  42. package/lib/solution/BookingTicket/types.d.ts +2 -1
  43. package/lib/solution/BookingTicket/types.js +5 -0
  44. package/package.json +1 -1
@@ -46,6 +46,8 @@ import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils
46
46
  import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
47
47
  import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
48
48
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
49
+ var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
50
+ var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
49
51
  function withProductOptionString(cacheItem) {
50
52
  var _cacheItem$_extend;
51
53
  var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
@@ -79,6 +81,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
79
81
  _defineProperty(_assertThisInitialized(_this), "productCatalog", []);
80
82
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
81
83
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
84
+ _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
82
85
  return _this;
83
86
  }
84
87
  _createClass(BookingTicketImpl, [{
@@ -89,7 +92,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
89
92
  * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
90
93
  */
91
94
  function getRegisteredModuleNames() {
92
- return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext']);
95
+ return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext', 'openData']);
93
96
  }
94
97
  }, {
95
98
  key: "getSubmitOrderSalesChannel",
@@ -130,8 +133,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
130
133
  throw new Error('bookingTicket解决方案需要 request 插件支持');
131
134
  case 6:
132
135
  this.platform = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform;
136
+ _context.next = 9;
137
+ return this.configureIdGeneratorFromOpenData();
138
+ case 9:
133
139
  console.log('[BookingTicket] 初始化完成');
134
- case 8:
140
+ case 10:
135
141
  case "end":
136
142
  return _context.stop();
137
143
  }
@@ -142,6 +148,180 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
142
148
  }
143
149
  return initialize;
144
150
  }()
151
+ }, {
152
+ key: "getBookingTicketBusinessCode",
153
+ value: function getBookingTicketBusinessCode() {
154
+ var _this$otherParams$bus, _this$otherParams2, _this$otherParams3;
155
+ var businessCode = (_this$otherParams$bus = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.business_code;
156
+ if (businessCode === undefined || businessCode === null) return null;
157
+ var normalized = String(businessCode).trim();
158
+ return normalized || null;
159
+ }
160
+ }, {
161
+ key: "getIdGeneratorPlugin",
162
+ value: function getIdGeneratorPlugin() {
163
+ var _appPlugin$getApp, _app$getPlugin;
164
+ var appPlugin = this.core.getPlugin('app');
165
+ var app = appPlugin === null || appPlugin === void 0 || (_appPlugin$getApp = appPlugin.getApp) === null || _appPlugin$getApp === void 0 ? void 0 : _appPlugin$getApp.call(appPlugin);
166
+ return (app === null || app === void 0 || (_app$getPlugin = app.getPlugin) === null || _app$getPlugin === void 0 ? void 0 : _app$getPlugin.call(app, 'idGenerator')) || null;
167
+ }
168
+ }, {
169
+ key: "loadOpenDataConfig",
170
+ value: function () {
171
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
172
+ var businessCode, lastFetchedAt, cachedData, openDataConfig;
173
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
174
+ while (1) switch (_context2.prev = _context2.next) {
175
+ case 0:
176
+ if (this.store.openData) {
177
+ _context2.next = 2;
178
+ break;
179
+ }
180
+ throw new Error('openData 模块未初始化');
181
+ case 2:
182
+ businessCode = this.getBookingTicketBusinessCode();
183
+ if (businessCode) {
184
+ _context2.next = 6;
185
+ break;
186
+ }
187
+ console.warn('[BookingTicket] businessCode 缺失,跳过 OpenData 配置加载');
188
+ return _context2.abrupt("return", null);
189
+ case 6:
190
+ lastFetchedAt = this.store.openData.getLastFetchedAt();
191
+ cachedData = this.store.openData.getOpenData();
192
+ if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
193
+ _context2.next = 11;
194
+ break;
195
+ }
196
+ this.otherParams.openData = cachedData;
197
+ return _context2.abrupt("return", cachedData);
198
+ case 11:
199
+ if (!this.loadOpenDataConfigInFlight) {
200
+ _context2.next = 15;
201
+ break;
202
+ }
203
+ _context2.next = 14;
204
+ return this.loadOpenDataConfigInFlight;
205
+ case 14:
206
+ return _context2.abrupt("return", _context2.sent);
207
+ case 15:
208
+ this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
209
+ scope: 'board',
210
+ target: "".concat(businessCode, "+pos"),
211
+ // target: `dine_in+pos`,
212
+ section_code: [].concat(OPEN_DATA_SECTION_CODES)
213
+ });
214
+ _context2.prev = 16;
215
+ _context2.next = 19;
216
+ return this.loadOpenDataConfigInFlight;
217
+ case 19:
218
+ openDataConfig = _context2.sent;
219
+ this.otherParams.openData = openDataConfig;
220
+ return _context2.abrupt("return", openDataConfig);
221
+ case 22:
222
+ _context2.prev = 22;
223
+ this.loadOpenDataConfigInFlight = null;
224
+ return _context2.finish(22);
225
+ case 25:
226
+ case "end":
227
+ return _context2.stop();
228
+ }
229
+ }, _callee2, this, [[16,, 22, 25]]);
230
+ }));
231
+ function loadOpenDataConfig() {
232
+ return _loadOpenDataConfig.apply(this, arguments);
233
+ }
234
+ return loadOpenDataConfig;
235
+ }()
236
+ }, {
237
+ key: "configureIdGeneratorFromOpenData",
238
+ value: function () {
239
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
240
+ var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, resetReceiptSequenceDaily, operatingDayBoundary;
241
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
242
+ while (1) switch (_context3.prev = _context3.next) {
243
+ case 0:
244
+ openDataConfig = null;
245
+ _context3.prev = 1;
246
+ _context3.next = 4;
247
+ return this.loadOpenDataConfig();
248
+ case 4:
249
+ openDataConfig = _context3.sent;
250
+ _context3.next = 11;
251
+ break;
252
+ case 7:
253
+ _context3.prev = 7;
254
+ _context3.t0 = _context3["catch"](1);
255
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context3.t0);
256
+ return _context3.abrupt("return");
257
+ case 11:
258
+ if (openDataConfig) {
259
+ _context3.next = 13;
260
+ break;
261
+ }
262
+ return _context3.abrupt("return");
263
+ case 13:
264
+ idGenerator = this.getIdGeneratorPlugin();
265
+ if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
266
+ _context3.next = 17;
267
+ break;
268
+ }
269
+ console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
270
+ return _context3.abrupt("return");
271
+ case 17:
272
+ receiptSequenceLength = this.normalizePositiveInteger(openDataConfig['sale.short_number_digits'], 5);
273
+ receiptSequenceStart = this.normalizePositiveInteger(openDataConfig['sale.short_number_start_number'], 1);
274
+ prefix = this.normalizeIdPrefix(openDataConfig['sale.short_number_prefix'], 'R');
275
+ resetReceiptSequenceDaily = typeof openDataConfig['sale.short_number_daily_reset'] === 'boolean' ? openDataConfig['sale.short_number_daily_reset'] : true;
276
+ operatingDayBoundary = this.getAppData('operating_day_boundary');
277
+ _context3.prev = 22;
278
+ _context3.next = 25;
279
+ return idGenerator.configure({
280
+ biz: 'ticket',
281
+ config: {
282
+ prefix: prefix,
283
+ deviceCode: this.getAppData('device_id') || 0,
284
+ // TODO 现在 picoding 没这个配置的 key
285
+ padReceiptSequence: true,
286
+ receiptSequenceLength: receiptSequenceLength,
287
+ resetReceiptSequenceDaily: resetReceiptSequenceDaily,
288
+ receiptSequenceResetTime: operatingDayBoundary.time,
289
+ receiptSequenceStart: receiptSequenceStart
290
+ }
291
+ });
292
+ case 25:
293
+ _context3.next = 30;
294
+ break;
295
+ case 27:
296
+ _context3.prev = 27;
297
+ _context3.t1 = _context3["catch"](22);
298
+ console.warn('[BookingTicket] idGenerator 配置失败', _context3.t1);
299
+ case 30:
300
+ case "end":
301
+ return _context3.stop();
302
+ }
303
+ }, _callee3, this, [[1, 7], [22, 27]]);
304
+ }));
305
+ function configureIdGeneratorFromOpenData() {
306
+ return _configureIdGeneratorFromOpenData.apply(this, arguments);
307
+ }
308
+ return configureIdGeneratorFromOpenData;
309
+ }()
310
+ }, {
311
+ key: "normalizePositiveInteger",
312
+ value: function normalizePositiveInteger(value, fallback) {
313
+ var numeric = Number(value);
314
+ if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
315
+ return numeric;
316
+ }
317
+ }, {
318
+ key: "normalizeIdPrefix",
319
+ value: function normalizeIdPrefix(value, fallback) {
320
+ if (value === undefined || value === null) return fallback;
321
+ var normalized = String(value).trim().toUpperCase();
322
+ return normalized || fallback;
323
+ }
324
+
145
325
  /**
146
326
  * 加载销售详情,并在父类基础上把 customer 信息装配到 CustomerModule。
147
327
  *
@@ -152,16 +332,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
152
332
  }, {
153
333
  key: "loadSalesDetail",
154
334
  value: (function () {
155
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(orderIdOrParams) {
335
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderIdOrParams) {
156
336
  var _ref;
157
337
  var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref2, detailCustomerId, detailCustomerRest, rawId, customer;
158
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
159
- while (1) switch (_context2.prev = _context2.next) {
338
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
339
+ while (1) switch (_context4.prev = _context4.next) {
160
340
  case 0:
161
- _context2.next = 2;
341
+ _context4.next = 2;
162
342
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
163
343
  case 2:
164
- sales = _context2.sent;
344
+ sales = _context4.sent;
165
345
  customerModule = this.store.customer;
166
346
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
167
347
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -175,7 +355,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
175
355
  } : null;
176
356
  selectedCustomer = (_ref = detailCustomer !== null && detailCustomer !== void 0 ? detailCustomer : orderCustomerSnapshot) !== null && _ref !== void 0 ? _ref : protocolCustomer;
177
357
  if (!(customerModule && selectedCustomer)) {
178
- _context2.next = 17;
358
+ _context4.next = 17;
179
359
  break;
180
360
  }
181
361
  _ref2 = selectedCustomer !== null && selectedCustomer !== void 0 ? selectedCustomer : {}, detailCustomerId = _ref2.id, detailCustomerRest = _objectWithoutProperties(_ref2, _excluded);
@@ -189,15 +369,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
189
369
  });
190
370
  customerModule.setSelectedCustomer(customer);
191
371
  this.setOrderCustomer(customer);
192
- _context2.next = 17;
372
+ _context4.next = 17;
193
373
  return this.store.order.saveDraft();
194
374
  case 17:
195
- return _context2.abrupt("return", sales);
375
+ return _context4.abrupt("return", sales);
196
376
  case 18:
197
377
  case "end":
198
- return _context2.stop();
378
+ return _context4.stop();
199
379
  }
200
- }, _callee2, this);
380
+ }, _callee4, this);
201
381
  }));
202
382
  function loadSalesDetail(_x2) {
203
383
  return _loadSalesDetail.apply(this, arguments);
@@ -207,45 +387,45 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
207
387
  }, {
208
388
  key: "scanPromotionCode",
209
389
  value: function () {
210
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(code, customerId) {
390
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
211
391
  var raw;
212
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
213
- while (1) switch (_context3.prev = _context3.next) {
392
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
393
+ while (1) switch (_context5.prev = _context5.next) {
214
394
  case 0:
215
395
  if (this.store.order) {
216
- _context3.next = 2;
396
+ _context5.next = 2;
217
397
  break;
218
398
  }
219
399
  throw new Error('order 模块未初始化');
220
400
  case 2:
221
- _context3.next = 4;
401
+ _context5.next = 4;
222
402
  return this.store.order.scanCode(code, customerId);
223
403
  case 4:
224
- raw = _context3.sent;
404
+ raw = _context5.sent;
225
405
  if (!raw.isAvailable) {
226
- _context3.next = 11;
406
+ _context5.next = 11;
227
407
  break;
228
408
  }
229
- _context3.next = 8;
409
+ _context5.next = 8;
230
410
  return this.hydrateOrderCustomerFromScanDiscounts(raw.scannedDiscountList || []);
231
411
  case 8:
232
- _context3.next = 10;
412
+ _context5.next = 10;
233
413
  return this.store.order.recalculateSummary({
234
414
  createIfMissing: true
235
415
  });
236
416
  case 10:
237
417
  this.store.order.persistTempOrder();
238
418
  case 11:
239
- return _context3.abrupt("return", {
419
+ return _context5.abrupt("return", {
240
420
  isAvailable: raw.isAvailable,
241
421
  type: raw.type,
242
422
  unavailableReason: raw.unavailableReason
243
423
  });
244
424
  case 12:
245
425
  case "end":
246
- return _context3.stop();
426
+ return _context5.stop();
247
427
  }
248
- }, _callee3, this);
428
+ }, _callee5, this);
249
429
  }));
250
430
  function scanPromotionCode(_x3, _x4) {
251
431
  return _scanPromotionCode.apply(this, arguments);
@@ -255,42 +435,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
255
435
  }, {
256
436
  key: "hydrateOrderCustomerFromScanDiscounts",
257
437
  value: function () {
258
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(discounts) {
438
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(discounts) {
259
439
  var currentOrderCustomer, customerId, customer;
260
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
261
- while (1) switch (_context4.prev = _context4.next) {
440
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
441
+ while (1) switch (_context6.prev = _context6.next) {
262
442
  case 0:
263
443
  currentOrderCustomer = this.store.order.getOrderCustomer();
264
444
  if (!currentOrderCustomer) {
265
- _context4.next = 3;
445
+ _context6.next = 3;
266
446
  break;
267
447
  }
268
- return _context4.abrupt("return");
448
+ return _context6.abrupt("return");
269
449
  case 3:
270
450
  customerId = this.getDiscountCustomerId(discounts);
271
451
  if (customerId) {
272
- _context4.next = 6;
452
+ _context6.next = 6;
273
453
  break;
274
454
  }
275
- return _context4.abrupt("return");
455
+ return _context6.abrupt("return");
276
456
  case 6:
277
- _context4.next = 8;
457
+ _context6.next = 8;
278
458
  return this.resolveCustomerByDiscountCustomerId(customerId);
279
459
  case 8:
280
- customer = _context4.sent;
460
+ customer = _context6.sent;
281
461
  if (customer) {
282
- _context4.next = 11;
462
+ _context6.next = 11;
283
463
  break;
284
464
  }
285
- return _context4.abrupt("return");
465
+ return _context6.abrupt("return");
286
466
  case 11:
287
467
  this.store.customer.setSelectedCustomer(customer);
288
468
  this.setOrderCustomer(customer);
289
469
  case 13:
290
470
  case "end":
291
- return _context4.stop();
471
+ return _context6.stop();
292
472
  }
293
- }, _callee4, this);
473
+ }, _callee6, this);
294
474
  }));
295
475
  function hydrateOrderCustomerFromScanDiscounts(_x5) {
296
476
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -310,36 +490,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
310
490
  }, {
311
491
  key: "resolveCustomerByDiscountCustomerId",
312
492
  value: function () {
313
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(customerId) {
493
+ var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(customerId) {
314
494
  var _result$list;
315
495
  var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
316
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
317
- while (1) switch (_context5.prev = _context5.next) {
496
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
497
+ while (1) switch (_context7.prev = _context7.next) {
318
498
  case 0:
319
499
  localCustomers = this.store.customer.getCustomers();
320
500
  localCustomer = this.findCustomerById(localCustomers, customerId);
321
501
  normalizedLocalCustomer = localCustomer ? this.normalizeCustomer(localCustomer) : null;
322
502
  if (!(normalizedLocalCustomer && this.hasUsableCustomerDetails(normalizedLocalCustomer))) {
323
- _context5.next = 5;
503
+ _context7.next = 5;
324
504
  break;
325
505
  }
326
- return _context5.abrupt("return", normalizedLocalCustomer);
506
+ return _context7.abrupt("return", normalizedLocalCustomer);
327
507
  case 5:
328
- _context5.next = 7;
508
+ _context7.next = 7;
329
509
  return this.store.customer.queryCustomerList({
330
510
  ids: [customerId],
331
511
  skip: 1,
332
512
  num: 1
333
513
  });
334
514
  case 7:
335
- result = _context5.sent;
515
+ result = _context7.sent;
336
516
  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;
337
- return _context5.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
517
+ return _context7.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
338
518
  case 10:
339
519
  case "end":
340
- return _context5.stop();
520
+ return _context7.stop();
341
521
  }
342
- }, _callee5, this);
522
+ }, _callee7, this);
343
523
  }));
344
524
  function resolveCustomerByDiscountCustomerId(_x6) {
345
525
  return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
@@ -402,60 +582,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
402
582
  }, {
403
583
  key: "setBookingStatus",
404
584
  value: (function () {
405
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(status) {
585
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(status) {
406
586
  var _this$store$order, _this$store$order$get;
407
587
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
408
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
409
- while (1) switch (_context6.prev = _context6.next) {
588
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
589
+ while (1) switch (_context8.prev = _context8.next) {
410
590
  case 0:
411
591
  tempOrder = (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$get = _this$store$order.getTempOrder) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.call(_this$store$order);
412
592
  if (tempOrder) {
413
- _context6.next = 3;
593
+ _context8.next = 3;
414
594
  break;
415
595
  }
416
596
  throw new Error('setBookingStatus: tempOrder 未加载');
417
597
  case 3:
418
598
  orderId = tempOrder.order_id;
419
599
  if (!(orderId === undefined || orderId === null)) {
420
- _context6.next = 6;
600
+ _context8.next = 6;
421
601
  break;
422
602
  }
423
603
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
424
604
  case 6:
425
605
  scheduleId = resolveScheduleId(tempOrder);
426
606
  if (!(scheduleId === null)) {
427
- _context6.next = 9;
607
+ _context8.next = 9;
428
608
  break;
429
609
  }
430
610
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
431
611
  case 9:
432
612
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
433
613
  previous = applyBookingsStatus(bookings, status);
434
- _context6.prev = 11;
435
- _context6.next = 14;
614
+ _context8.prev = 11;
615
+ _context8.next = 14;
436
616
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
437
617
  appointment_status: status
438
618
  });
439
619
  case 14:
440
- res = _context6.sent;
441
- _context6.next = 17;
620
+ res = _context8.sent;
621
+ _context8.next = 17;
442
622
  return this.refreshSalesDetail();
443
623
  case 17:
444
624
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
445
625
  orderId: orderId,
446
626
  status: status
447
627
  });
448
- return _context6.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
628
+ return _context8.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
449
629
  case 21:
450
- _context6.prev = 21;
451
- _context6.t0 = _context6["catch"](11);
630
+ _context8.prev = 21;
631
+ _context8.t0 = _context8["catch"](11);
452
632
  restoreBookingsStatus(bookings, previous);
453
- throw _context6.t0;
633
+ throw _context8.t0;
454
634
  case 25:
455
635
  case "end":
456
- return _context6.stop();
636
+ return _context8.stop();
457
637
  }
458
- }, _callee6, this, [[11, 21]]);
638
+ }, _callee8, this, [[11, 21]]);
459
639
  }));
460
640
  function setBookingStatus(_x7) {
461
641
  return _setBookingStatus.apply(this, arguments);
@@ -486,35 +666,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
486
666
  }, {
487
667
  key: "transitionChildBooking",
488
668
  value: (function () {
489
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
669
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
490
670
  var _this$store$order2, _this$store$order2$ge;
491
671
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
492
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
493
- while (1) switch (_context7.prev = _context7.next) {
672
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
673
+ while (1) switch (_context9.prev = _context9.next) {
494
674
  case 0:
495
675
  schedule_event_id = params.schedule_event_id, action = params.action;
496
676
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
497
- _context7.next = 3;
677
+ _context9.next = 3;
498
678
  break;
499
679
  }
500
680
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
501
681
  case 3:
502
682
  if (action) {
503
- _context7.next = 5;
683
+ _context9.next = 5;
504
684
  break;
505
685
  }
506
686
  throw new Error('transitionChildBooking: action 不能为空');
507
687
  case 5:
508
688
  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);
509
689
  if (tempOrder) {
510
- _context7.next = 8;
690
+ _context9.next = 8;
511
691
  break;
512
692
  }
513
693
  throw new Error('transitionChildBooking: tempOrder 未加载');
514
694
  case 8:
515
695
  orderId = tempOrder.order_id;
516
696
  if (!(orderId === undefined || orderId === null)) {
517
- _context7.next = 11;
697
+ _context9.next = 11;
518
698
  break;
519
699
  }
520
700
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -522,14 +702,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
522
702
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
523
703
  targetStatus = resolveStatusAfterTransition(action);
524
704
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
525
- _context7.prev = 14;
526
- _context7.next = 17;
705
+ _context9.prev = 14;
706
+ _context9.next = 17;
527
707
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
528
708
  action: action
529
709
  });
530
710
  case 17:
531
- res = _context7.sent;
532
- _context7.next = 20;
711
+ res = _context9.sent;
712
+ _context9.next = 20;
533
713
  return this.refreshSalesDetail();
534
714
  case 20:
535
715
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -538,19 +718,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
538
718
  action: action,
539
719
  status: targetStatus
540
720
  });
541
- return _context7.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
721
+ return _context9.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
542
722
  case 24:
543
- _context7.prev = 24;
544
- _context7.t0 = _context7["catch"](14);
723
+ _context9.prev = 24;
724
+ _context9.t0 = _context9["catch"](14);
545
725
  if (previous !== undefined) {
546
726
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
547
727
  }
548
- throw _context7.t0;
728
+ throw _context9.t0;
549
729
  case 28:
550
730
  case "end":
551
- return _context7.stop();
731
+ return _context9.stop();
552
732
  }
553
- }, _callee7, this, [[14, 24]]);
733
+ }, _callee9, this, [[14, 24]]);
554
734
  }));
555
735
  function transitionChildBooking(_x8) {
556
736
  return _transitionChildBooking.apply(this, arguments);
@@ -571,35 +751,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
571
751
  }, {
572
752
  key: "refreshSalesDetail",
573
753
  value: (function () {
574
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
754
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
575
755
  var _this$store$order3, _this$store$order3$ge;
576
756
  var tempOrder, orderId;
577
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
578
- while (1) switch (_context8.prev = _context8.next) {
757
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
758
+ while (1) switch (_context10.prev = _context10.next) {
579
759
  case 0:
580
760
  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);
581
761
  if (tempOrder) {
582
- _context8.next = 3;
762
+ _context10.next = 3;
583
763
  break;
584
764
  }
585
765
  throw new Error('refreshSalesDetail: tempOrder 未加载');
586
766
  case 3:
587
767
  orderId = tempOrder.order_id;
588
768
  if (!(orderId === undefined || orderId === null)) {
589
- _context8.next = 6;
769
+ _context10.next = 6;
590
770
  break;
591
771
  }
592
772
  throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
593
773
  case 6:
594
- return _context8.abrupt("return", this.loadSalesDetail({
774
+ return _context10.abrupt("return", this.loadSalesDetail({
595
775
  orderId: Number(orderId),
596
776
  forceRemote: true
597
777
  }));
598
778
  case 7:
599
779
  case "end":
600
- return _context8.stop();
780
+ return _context10.stop();
601
781
  }
602
- }, _callee8, this);
782
+ }, _callee10, this);
603
783
  }));
604
784
  function refreshSalesDetail() {
605
785
  return _refreshSalesDetail.apply(this, arguments);
@@ -615,7 +795,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
615
795
  }, {
616
796
  key: "loadProducts",
617
797
  value: (function () {
618
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
798
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
619
799
  var params,
620
800
  options,
621
801
  schedule_date,
@@ -624,20 +804,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
624
804
  schedule_datetime,
625
805
  bookingDate,
626
806
  _result,
627
- _args9 = arguments;
628
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
629
- while (1) switch (_context9.prev = _context9.next) {
807
+ _args11 = arguments;
808
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
809
+ while (1) switch (_context11.prev = _context11.next) {
630
810
  case 0:
631
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
632
- options = _args9.length > 1 ? _args9[1] : undefined;
811
+ params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
812
+ options = _args11.length > 1 ? _args11[1] : undefined;
633
813
  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 对齐;
634
814
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
635
815
  bookingDate = schedule_datetime || schedule_date || '';
636
816
  if (bookingDate) {
637
817
  this.setBookingDate(bookingDate);
638
818
  }
639
- _context9.prev = 5;
640
- _context9.next = 8;
819
+ _context11.prev = 5;
820
+ _context11.next = 8;
641
821
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
642
822
  with_count: ['bundleGroup', 'optionGroup'],
643
823
  with_schedule: 1
@@ -645,20 +825,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
645
825
  cacheId: this.cacheId
646
826
  }), options);
647
827
  case 8:
648
- _result = _context9.sent;
828
+ _result = _context11.sent;
649
829
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
650
830
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
651
- return _context9.abrupt("return", _result);
831
+ return _context11.abrupt("return", _result);
652
832
  case 14:
653
- _context9.prev = 14;
654
- _context9.t0 = _context9["catch"](5);
655
- console.error('Failed to load products:', _context9.t0);
656
- throw _context9.t0;
833
+ _context11.prev = 14;
834
+ _context11.t0 = _context11["catch"](5);
835
+ console.error('Failed to load products:', _context11.t0);
836
+ throw _context11.t0;
657
837
  case 18:
658
838
  case "end":
659
- return _context9.stop();
839
+ return _context11.stop();
660
840
  }
661
- }, _callee9, this, [[5, 14]]);
841
+ }, _callee11, this, [[5, 14]]);
662
842
  }));
663
843
  function loadProducts() {
664
844
  return _loadProducts.apply(this, arguments);
@@ -683,14 +863,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
683
863
  }, {
684
864
  key: "queryProductDetail",
685
865
  value: (function () {
686
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params, options) {
866
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params, options) {
687
867
  var product_id, queryParams, _result2, list;
688
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
689
- while (1) switch (_context10.prev = _context10.next) {
868
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
869
+ while (1) switch (_context12.prev = _context12.next) {
690
870
  case 0:
691
871
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
692
- _context10.prev = 1;
693
- _context10.next = 4;
872
+ _context12.prev = 1;
873
+ _context12.next = 4;
694
874
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
695
875
  with_count: ['bundleGroup', 'optionGroup'],
696
876
  with_schedule: 1
@@ -699,21 +879,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
699
879
  cacheId: this.cacheId
700
880
  }), options);
701
881
  case 4:
702
- _result2 = _context10.sent;
882
+ _result2 = _context12.sent;
703
883
  list = Array.isArray(_result2) ? _result2 : [];
704
- return _context10.abrupt("return", list.find(function (product) {
884
+ return _context12.abrupt("return", list.find(function (product) {
705
885
  return Number(product.id) === Number(product_id);
706
886
  }));
707
887
  case 9:
708
- _context10.prev = 9;
709
- _context10.t0 = _context10["catch"](1);
710
- console.error('Failed to query product detail:', _context10.t0);
711
- throw _context10.t0;
888
+ _context12.prev = 9;
889
+ _context12.t0 = _context12["catch"](1);
890
+ console.error('Failed to query product detail:', _context12.t0);
891
+ throw _context12.t0;
712
892
  case 13:
713
893
  case "end":
714
- return _context10.stop();
894
+ return _context12.stop();
715
895
  }
716
- }, _callee10, this, [[1, 9]]);
896
+ }, _callee12, this, [[1, 9]]);
717
897
  }));
718
898
  function queryProductDetail(_x9, _x10) {
719
899
  return _queryProductDetail.apply(this, arguments);
@@ -728,26 +908,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
728
908
  }, {
729
909
  key: "loadProductDetail",
730
910
  value: (function () {
731
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params, options) {
911
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params, options) {
732
912
  var product_id, queryParams, products;
733
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
734
- while (1) switch (_context11.prev = _context11.next) {
913
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
914
+ while (1) switch (_context13.prev = _context13.next) {
735
915
  case 0:
736
916
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
737
- _context11.next = 3;
917
+ _context13.next = 3;
738
918
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
739
919
  product_ids: [product_id]
740
920
  }), options);
741
921
  case 3:
742
- products = _context11.sent;
743
- return _context11.abrupt("return", products.find(function (product) {
922
+ products = _context13.sent;
923
+ return _context13.abrupt("return", products.find(function (product) {
744
924
  return Number(product.id) === Number(product_id);
745
925
  }));
746
926
  case 5:
747
927
  case "end":
748
- return _context11.stop();
928
+ return _context13.stop();
749
929
  }
750
- }, _callee11, this);
930
+ }, _callee13, this);
751
931
  }));
752
932
  function loadProductDetail(_x11, _x12) {
753
933
  return _loadProductDetail.apply(this, arguments);
@@ -782,16 +962,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
782
962
  }, {
783
963
  key: "getProducts",
784
964
  value: (function () {
785
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
786
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
787
- while (1) switch (_context12.prev = _context12.next) {
965
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
966
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
967
+ while (1) switch (_context14.prev = _context14.next) {
788
968
  case 0:
789
- return _context12.abrupt("return", this.store.products.getProducts());
969
+ return _context14.abrupt("return", this.store.products.getProducts());
790
970
  case 1:
791
971
  case "end":
792
- return _context12.stop();
972
+ return _context14.stop();
793
973
  }
794
- }, _callee12, this);
974
+ }, _callee14, this);
795
975
  }));
796
976
  function getProducts() {
797
977
  return _getProducts.apply(this, arguments);
@@ -844,16 +1024,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
844
1024
  }, {
845
1025
  key: "getProductByIds",
846
1026
  value: (function () {
847
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
848
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
849
- while (1) switch (_context13.prev = _context13.next) {
1027
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(ids) {
1028
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1029
+ while (1) switch (_context15.prev = _context15.next) {
850
1030
  case 0:
851
- return _context13.abrupt("return", this.store.products.getProductByIds(ids));
1031
+ return _context15.abrupt("return", this.store.products.getProductByIds(ids));
852
1032
  case 1:
853
1033
  case "end":
854
- return _context13.stop();
1034
+ return _context15.stop();
855
1035
  }
856
- }, _callee13, this);
1036
+ }, _callee15, this);
857
1037
  }));
858
1038
  function getProductByIds(_x13) {
859
1039
  return _getProductByIds.apply(this, arguments);
@@ -869,25 +1049,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
869
1049
  }, {
870
1050
  key: "getScheduleTimePoints",
871
1051
  value: (function () {
872
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1052
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
873
1053
  var result;
874
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
875
- while (1) switch (_context14.prev = _context14.next) {
1054
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1055
+ while (1) switch (_context16.prev = _context16.next) {
876
1056
  case 0:
877
- _context14.next = 2;
1057
+ _context16.next = 2;
878
1058
  return this.request.post('/menu/schedule-time-points', {
879
1059
  menu_list_ids: params.menu_list_ids
880
1060
  }, {
881
1061
  osServer: true
882
1062
  });
883
1063
  case 2:
884
- result = _context14.sent;
885
- return _context14.abrupt("return", result.data || []);
1064
+ result = _context16.sent;
1065
+ return _context16.abrupt("return", result.data || []);
886
1066
  case 4:
887
1067
  case "end":
888
- return _context14.stop();
1068
+ return _context16.stop();
889
1069
  }
890
- }, _callee14, this);
1070
+ }, _callee16, this);
891
1071
  }));
892
1072
  function getScheduleTimePoints(_x14) {
893
1073
  return _getScheduleTimePoints.apply(this, arguments);
@@ -903,30 +1083,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
903
1083
  }, {
904
1084
  key: "getCustomerList",
905
1085
  value: (function () {
906
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1086
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
907
1087
  var params,
908
1088
  _result3,
909
- _args15 = arguments;
910
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
911
- while (1) switch (_context15.prev = _context15.next) {
1089
+ _args17 = arguments;
1090
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1091
+ while (1) switch (_context17.prev = _context17.next) {
912
1092
  case 0:
913
- params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
914
- _context15.prev = 1;
915
- _context15.next = 4;
1093
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1094
+ _context17.prev = 1;
1095
+ _context17.next = 4;
916
1096
  return this.store.customer.getCustomerList(params);
917
1097
  case 4:
918
- _result3 = _context15.sent;
919
- return _context15.abrupt("return", _result3);
1098
+ _result3 = _context17.sent;
1099
+ return _context17.abrupt("return", _result3);
920
1100
  case 8:
921
- _context15.prev = 8;
922
- _context15.t0 = _context15["catch"](1);
923
- console.error('Failed to get customer list:', _context15.t0);
924
- throw _context15.t0;
1101
+ _context17.prev = 8;
1102
+ _context17.t0 = _context17["catch"](1);
1103
+ console.error('Failed to get customer list:', _context17.t0);
1104
+ throw _context17.t0;
925
1105
  case 12:
926
1106
  case "end":
927
- return _context15.stop();
1107
+ return _context17.stop();
928
1108
  }
929
- }, _callee15, this, [[1, 8]]);
1109
+ }, _callee17, this, [[1, 8]]);
930
1110
  }));
931
1111
  function getCustomerList() {
932
1112
  return _getCustomerList.apply(this, arguments);
@@ -1124,24 +1304,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1124
1304
  }, {
1125
1305
  key: "restoreOrder",
1126
1306
  value: (function () {
1127
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1307
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1128
1308
  var _this$store$customer;
1129
1309
  var tempOrder;
1130
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1131
- while (1) switch (_context16.prev = _context16.next) {
1310
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1311
+ while (1) switch (_context18.prev = _context18.next) {
1132
1312
  case 0:
1133
- _context16.next = 2;
1313
+ _context18.next = 2;
1134
1314
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1135
1315
  case 2:
1136
- tempOrder = _context16.sent;
1316
+ tempOrder = _context18.sent;
1137
1317
  this.clearOrderCustomer();
1138
1318
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1139
- return _context16.abrupt("return", tempOrder);
1319
+ return _context18.abrupt("return", tempOrder);
1140
1320
  case 6:
1141
1321
  case "end":
1142
- return _context16.stop();
1322
+ return _context18.stop();
1143
1323
  }
1144
- }, _callee16, this);
1324
+ }, _callee18, this);
1145
1325
  }));
1146
1326
  function restoreOrder() {
1147
1327
  return _restoreOrder.apply(this, arguments);
@@ -1167,36 +1347,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1167
1347
  return;
1168
1348
  }
1169
1349
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1170
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1350
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1171
1351
  var currentCustomer;
1172
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1173
- while (1) switch (_context17.prev = _context17.next) {
1352
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1353
+ while (1) switch (_context19.prev = _context19.next) {
1174
1354
  case 0:
1175
1355
  if (!previousRefresh) {
1176
- _context17.next = 3;
1356
+ _context19.next = 3;
1177
1357
  break;
1178
1358
  }
1179
- _context17.next = 3;
1359
+ _context19.next = 3;
1180
1360
  return previousRefresh.catch(function () {
1181
1361
  return undefined;
1182
1362
  });
1183
1363
  case 3:
1184
1364
  currentCustomer = _this4.store.order.getOrderCustomer();
1185
1365
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1186
- _context17.next = 6;
1366
+ _context19.next = 6;
1187
1367
  break;
1188
1368
  }
1189
- return _context17.abrupt("return");
1369
+ return _context19.abrupt("return");
1190
1370
  case 6:
1191
- _context17.next = 8;
1371
+ _context19.next = 8;
1192
1372
  return _this4.loadDiscountConfig({
1193
1373
  customerId: customerId
1194
1374
  });
1195
1375
  case 8:
1196
1376
  case "end":
1197
- return _context17.stop();
1377
+ return _context19.stop();
1198
1378
  }
1199
- }, _callee17);
1379
+ }, _callee19);
1200
1380
  }))();
1201
1381
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1202
1382
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1249,27 +1429,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1249
1429
  }, {
1250
1430
  key: "changeCustomerPage",
1251
1431
  value: (function () {
1252
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(page, pageSize) {
1432
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(page, pageSize) {
1253
1433
  var _result4;
1254
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1255
- while (1) switch (_context18.prev = _context18.next) {
1434
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1435
+ while (1) switch (_context20.prev = _context20.next) {
1256
1436
  case 0:
1257
- _context18.prev = 0;
1258
- _context18.next = 3;
1437
+ _context20.prev = 0;
1438
+ _context20.next = 3;
1259
1439
  return this.store.customer.changeCustomerPage(page, pageSize);
1260
1440
  case 3:
1261
- _result4 = _context18.sent;
1262
- return _context18.abrupt("return", _result4);
1441
+ _result4 = _context20.sent;
1442
+ return _context20.abrupt("return", _result4);
1263
1443
  case 7:
1264
- _context18.prev = 7;
1265
- _context18.t0 = _context18["catch"](0);
1266
- console.error('Failed to change customer page:', _context18.t0);
1267
- throw _context18.t0;
1444
+ _context20.prev = 7;
1445
+ _context20.t0 = _context20["catch"](0);
1446
+ console.error('Failed to change customer page:', _context20.t0);
1447
+ throw _context20.t0;
1268
1448
  case 11:
1269
1449
  case "end":
1270
- return _context18.stop();
1450
+ return _context20.stop();
1271
1451
  }
1272
- }, _callee18, this, [[0, 7]]);
1452
+ }, _callee20, this, [[0, 7]]);
1273
1453
  }));
1274
1454
  function changeCustomerPage(_x15, _x16) {
1275
1455
  return _changeCustomerPage.apply(this, arguments);
@@ -1284,28 +1464,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1284
1464
  }, {
1285
1465
  key: "loadMoreCustomers",
1286
1466
  value: (function () {
1287
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1467
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1288
1468
  var _result5;
1289
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1290
- while (1) switch (_context19.prev = _context19.next) {
1469
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1470
+ while (1) switch (_context21.prev = _context21.next) {
1291
1471
  case 0:
1292
- _context19.prev = 0;
1293
- _context19.next = 3;
1472
+ _context21.prev = 0;
1473
+ _context21.next = 3;
1294
1474
  return this.store.customer.loadMoreCustomers();
1295
1475
  case 3:
1296
- _result5 = _context19.sent;
1476
+ _result5 = _context21.sent;
1297
1477
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1298
- return _context19.abrupt("return", _result5);
1478
+ return _context21.abrupt("return", _result5);
1299
1479
  case 8:
1300
- _context19.prev = 8;
1301
- _context19.t0 = _context19["catch"](0);
1302
- console.error('Failed to load more customers:', _context19.t0);
1303
- throw _context19.t0;
1480
+ _context21.prev = 8;
1481
+ _context21.t0 = _context21["catch"](0);
1482
+ console.error('Failed to load more customers:', _context21.t0);
1483
+ throw _context21.t0;
1304
1484
  case 12:
1305
1485
  case "end":
1306
- return _context19.stop();
1486
+ return _context21.stop();
1307
1487
  }
1308
- }, _callee19, this, [[0, 8]]);
1488
+ }, _callee21, this, [[0, 8]]);
1309
1489
  }));
1310
1490
  function loadMoreCustomers() {
1311
1491
  return _loadMoreCustomers.apply(this, arguments);
@@ -1321,31 +1501,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1321
1501
  }, {
1322
1502
  key: "resetAndLoadCustomers",
1323
1503
  value: (function () {
1324
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1504
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1325
1505
  var params,
1326
1506
  _result6,
1327
- _args20 = arguments;
1328
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1329
- while (1) switch (_context20.prev = _context20.next) {
1507
+ _args22 = arguments;
1508
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1509
+ while (1) switch (_context22.prev = _context22.next) {
1330
1510
  case 0:
1331
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1332
- _context20.prev = 1;
1333
- _context20.next = 4;
1511
+ params = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
1512
+ _context22.prev = 1;
1513
+ _context22.next = 4;
1334
1514
  return this.store.customer.resetAndLoadCustomers(params);
1335
1515
  case 4:
1336
- _result6 = _context20.sent;
1516
+ _result6 = _context22.sent;
1337
1517
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1338
- return _context20.abrupt("return", _result6);
1518
+ return _context22.abrupt("return", _result6);
1339
1519
  case 9:
1340
- _context20.prev = 9;
1341
- _context20.t0 = _context20["catch"](1);
1342
- console.error('Failed to reset and load customers:', _context20.t0);
1343
- throw _context20.t0;
1520
+ _context22.prev = 9;
1521
+ _context22.t0 = _context22["catch"](1);
1522
+ console.error('Failed to reset and load customers:', _context22.t0);
1523
+ throw _context22.t0;
1344
1524
  case 13:
1345
1525
  case "end":
1346
- return _context20.stop();
1526
+ return _context22.stop();
1347
1527
  }
1348
- }, _callee20, this, [[1, 9]]);
1528
+ }, _callee22, this, [[1, 9]]);
1349
1529
  }));
1350
1530
  function resetAndLoadCustomers() {
1351
1531
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1507,15 +1687,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1507
1687
  }, {
1508
1688
  key: "setOtherParams",
1509
1689
  value: (function () {
1510
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1690
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1511
1691
  var _ref10,
1512
1692
  _ref10$cover,
1513
1693
  cover,
1514
- _args21 = arguments;
1515
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1516
- while (1) switch (_context21.prev = _context21.next) {
1694
+ _args23 = arguments;
1695
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1696
+ while (1) switch (_context23.prev = _context23.next) {
1517
1697
  case 0:
1518
- _ref10 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
1698
+ _ref10 = _args23.length > 1 && _args23[1] !== undefined ? _args23[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
1519
1699
  if (cover) {
1520
1700
  this.otherParams = params;
1521
1701
  } else {
@@ -1523,9 +1703,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1523
1703
  }
1524
1704
  case 2:
1525
1705
  case "end":
1526
- return _context21.stop();
1706
+ return _context23.stop();
1527
1707
  }
1528
- }, _callee21, this);
1708
+ }, _callee23, this);
1529
1709
  }));
1530
1710
  function setOtherParams(_x17) {
1531
1711
  return _setOtherParams.apply(this, arguments);
@@ -1540,16 +1720,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1540
1720
  }, {
1541
1721
  key: "getOtherParams",
1542
1722
  value: (function () {
1543
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1544
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1545
- while (1) switch (_context22.prev = _context22.next) {
1723
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1724
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1725
+ while (1) switch (_context24.prev = _context24.next) {
1546
1726
  case 0:
1547
- return _context22.abrupt("return", this.otherParams);
1727
+ return _context24.abrupt("return", this.otherParams);
1548
1728
  case 1:
1549
1729
  case "end":
1550
- return _context22.stop();
1730
+ return _context24.stop();
1551
1731
  }
1552
- }, _callee22, this);
1732
+ }, _callee24, this);
1553
1733
  }));
1554
1734
  function getOtherParams() {
1555
1735
  return _getOtherParams.apply(this, arguments);
@@ -1867,16 +2047,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1867
2047
  }, {
1868
2048
  key: "updateProductInOrder",
1869
2049
  value: (function () {
1870
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1871
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1872
- while (1) switch (_context23.prev = _context23.next) {
2050
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2051
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2052
+ while (1) switch (_context25.prev = _context25.next) {
1873
2053
  case 0:
1874
- return _context23.abrupt("return", this.updateOrderProduct(params));
2054
+ return _context25.abrupt("return", this.updateOrderProduct(params));
1875
2055
  case 1:
1876
2056
  case "end":
1877
- return _context23.stop();
2057
+ return _context25.stop();
1878
2058
  }
1879
- }, _callee23, this);
2059
+ }, _callee25, this);
1880
2060
  }));
1881
2061
  function updateProductInOrder(_x18) {
1882
2062
  return _updateProductInOrder.apply(this, arguments);
@@ -1900,47 +2080,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1900
2080
  }, {
1901
2081
  key: "handleGlobalScanCode",
1902
2082
  value: (function () {
1903
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(code, bridge) {
2083
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(code, bridge) {
1904
2084
  var _this6 = this;
1905
2085
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
1906
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1907
- while (1) switch (_context24.prev = _context24.next) {
2086
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2087
+ while (1) switch (_context26.prev = _context26.next) {
1908
2088
  case 0:
1909
2089
  trimmed = typeof code === 'string' ? code.trim() : '';
1910
2090
  if (trimmed) {
1911
- _context24.next = 4;
2091
+ _context26.next = 4;
1912
2092
  break;
1913
2093
  }
1914
2094
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1915
- return _context24.abrupt("return", {
2095
+ return _context26.abrupt("return", {
1916
2096
  status: 'failed',
1917
2097
  reason: 'empty_code'
1918
2098
  });
1919
2099
  case 4:
1920
- _context24.prev = 4;
2100
+ _context26.prev = 4;
1921
2101
  localSearch = function localSearch(v) {
1922
2102
  return _this6.store.products.findProductsByCodeOrBarcode(v);
1923
2103
  };
1924
2104
  scanCallback = handleGlobalScan(this.request, localSearch);
1925
- _context24.next = 9;
2105
+ _context26.next = 9;
1926
2106
  return scanCallback({
1927
2107
  type: 'nativeScanner',
1928
2108
  value: trimmed
1929
2109
  });
1930
2110
  case 9:
1931
- raw = _context24.sent;
2111
+ raw = _context26.sent;
1932
2112
  formatted = formatGlobalScanResult(raw, trimmed);
1933
2113
  if (formatted) {
1934
- _context24.next = 14;
2114
+ _context26.next = 14;
1935
2115
  break;
1936
2116
  }
1937
2117
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1938
- return _context24.abrupt("return", {
2118
+ return _context26.abrupt("return", {
1939
2119
  status: 'failed',
1940
2120
  reason: 'not_found'
1941
2121
  });
1942
2122
  case 14:
1943
- _context24.next = 16;
2123
+ _context26.next = 16;
1944
2124
  return applyGlobalScan({
1945
2125
  setOrderCustomer: function setOrderCustomer(customer) {
1946
2126
  return _this6.setOrderCustomer(customer);
@@ -1969,23 +2149,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1969
2149
  }
1970
2150
  }, formatted, bridge);
1971
2151
  case 16:
1972
- _result7 = _context24.sent;
2152
+ _result7 = _context26.sent;
1973
2153
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
1974
- return _context24.abrupt("return", _result7);
2154
+ return _context26.abrupt("return", _result7);
1975
2155
  case 21:
1976
- _context24.prev = 21;
1977
- _context24.t0 = _context24["catch"](4);
1978
- console.error('[BookingTicket] handleGlobalScanCode failed', _context24.t0);
2156
+ _context26.prev = 21;
2157
+ _context26.t0 = _context26["catch"](4);
2158
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context26.t0);
1979
2159
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1980
- return _context24.abrupt("return", {
2160
+ return _context26.abrupt("return", {
1981
2161
  status: 'failed',
1982
2162
  reason: 'not_found'
1983
2163
  });
1984
2164
  case 26:
1985
2165
  case "end":
1986
- return _context24.stop();
2166
+ return _context26.stop();
1987
2167
  }
1988
- }, _callee24, this, [[4, 21]]);
2168
+ }, _callee26, this, [[4, 21]]);
1989
2169
  }));
1990
2170
  function handleGlobalScanCode(_x19, _x20) {
1991
2171
  return _handleGlobalScanCode.apply(this, arguments);
@@ -2000,12 +2180,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2000
2180
  }, {
2001
2181
  key: "destroy",
2002
2182
  value: (function () {
2003
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2183
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2004
2184
  var _this$scan;
2005
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2006
- while (1) switch (_context25.prev = _context25.next) {
2185
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2186
+ while (1) switch (_context27.prev = _context27.next) {
2007
2187
  case 0:
2008
- _context25.next = 2;
2188
+ _context27.next = 2;
2009
2189
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2010
2190
  case 2:
2011
2191
  try {
@@ -2016,9 +2196,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2016
2196
  scanCache.clear();
2017
2197
  case 4:
2018
2198
  case "end":
2019
- return _context25.stop();
2199
+ return _context27.stop();
2020
2200
  }
2021
- }, _callee25, this);
2201
+ }, _callee27, this);
2022
2202
  }));
2023
2203
  function destroy() {
2024
2204
  return _destroy.apply(this, arguments);