@pisell/pisellos 2.3.67 → 2.3.69

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 (61) hide show
  1. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -1
  2. package/dist/model/strategy/adapter/walletPass/utils.js +0 -2
  3. package/dist/modules/BaseModule.d.ts +1 -0
  4. package/dist/modules/BaseModule.js +24 -28
  5. package/dist/modules/Customer/index.d.ts +4 -0
  6. package/dist/modules/Customer/index.js +91 -59
  7. package/dist/modules/Customer/types.d.ts +2 -0
  8. package/dist/modules/Order/index.d.ts +22 -2
  9. package/dist/modules/Order/index.js +313 -142
  10. package/dist/modules/Order/types.d.ts +13 -1
  11. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  12. package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
  13. package/dist/modules/Order/utils.js +0 -1
  14. package/dist/modules/Payment/index.d.ts +4 -0
  15. package/dist/modules/Payment/index.js +14 -4
  16. package/dist/modules/Payment/walletpass.js +52 -18
  17. package/dist/modules/Rules/index.js +46 -31
  18. package/dist/server/index.js +3 -6
  19. package/dist/server/modules/order/index.d.ts +1 -0
  20. package/dist/server/modules/order/index.js +252 -93
  21. package/dist/server/utils/small-ticket.js +2 -1
  22. package/dist/solution/BaseSales/index.d.ts +13 -1
  23. package/dist/solution/BaseSales/index.js +903 -831
  24. package/dist/solution/BaseSales/utils.js +31 -20
  25. package/dist/solution/BookingTicket/index.d.ts +7 -1
  26. package/dist/solution/BookingTicket/index.js +310 -224
  27. package/dist/solution/ScanOrder/utils.js +31 -20
  28. package/dist/solution/UnifiedBookingSales/index.d.ts +25 -0
  29. package/dist/solution/UnifiedBookingSales/index.js +640 -321
  30. package/dist/solution/UnifiedBookingSales/types.d.ts +7 -0
  31. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -1
  32. package/lib/model/strategy/adapter/walletPass/utils.js +0 -1
  33. package/lib/modules/BaseModule.d.ts +1 -0
  34. package/lib/modules/BaseModule.js +24 -37
  35. package/lib/modules/Customer/index.d.ts +4 -0
  36. package/lib/modules/Customer/index.js +11 -0
  37. package/lib/modules/Customer/types.d.ts +2 -0
  38. package/lib/modules/Order/index.d.ts +22 -2
  39. package/lib/modules/Order/index.js +212 -54
  40. package/lib/modules/Order/types.d.ts +13 -1
  41. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  42. package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
  43. package/lib/modules/Order/utils.js +0 -1
  44. package/lib/modules/Payment/index.d.ts +4 -0
  45. package/lib/modules/Payment/index.js +7 -0
  46. package/lib/modules/Payment/walletpass.js +27 -2
  47. package/lib/modules/Rules/index.js +17 -1
  48. package/lib/server/index.js +3 -6
  49. package/lib/server/modules/order/index.d.ts +1 -0
  50. package/lib/server/modules/order/index.js +66 -2
  51. package/lib/server/utils/small-ticket.js +1 -1
  52. package/lib/solution/BaseSales/index.d.ts +13 -1
  53. package/lib/solution/BaseSales/index.js +61 -18
  54. package/lib/solution/BaseSales/utils.js +29 -18
  55. package/lib/solution/BookingTicket/index.d.ts +7 -1
  56. package/lib/solution/BookingTicket/index.js +65 -14
  57. package/lib/solution/ScanOrder/utils.js +29 -18
  58. package/lib/solution/UnifiedBookingSales/index.d.ts +25 -0
  59. package/lib/solution/UnifiedBookingSales/index.js +188 -0
  60. package/lib/solution/UnifiedBookingSales/types.d.ts +7 -0
  61. package/package.json +1 -1
@@ -52,6 +52,7 @@ import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resol
52
52
  import { createUuidV4 } from "../../modules/Order/utils";
53
53
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
54
54
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
55
+ var USER_PLATFORM = ['pc', 'h5'];
55
56
 
56
57
  /**
57
58
  * 读取已有 booking 的协议唯一值,用于加时商品行绑定原预约。
@@ -178,6 +179,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
178
179
  _defineProperty(_assertThisInitialized(_this), "addTimeProductsCatalog", []);
179
180
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshInFlight", null);
180
181
  _defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
182
+ _defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
181
183
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
182
184
  return _this;
183
185
  }
@@ -400,35 +402,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
400
402
  value: function () {
401
403
  var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
402
404
  var _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
403
- var openDataConfig, idGenerator, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
405
+ var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
404
406
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
405
407
  while (1) switch (_context5.prev = _context5.next) {
406
408
  case 0:
407
409
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
408
410
  this.setPaymentNumberDevicePrefix(null);
409
- openDataConfig = null;
410
- _context5.prev = 2;
411
- _context5.next = 5;
412
- return this.loadOpenDataConfig();
413
- case 5:
414
- openDataConfig = _context5.sent;
415
- _context5.next = 12;
416
- break;
417
- case 8:
418
- _context5.prev = 8;
419
- _context5.t0 = _context5["catch"](2);
420
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
421
- return _context5.abrupt("return");
422
- case 12:
423
- // if (!openDataConfig) return;
424
411
  idGenerator = this.getIdGeneratorPlugin();
425
412
  if (idGenerator !== null && idGenerator !== void 0 && idGenerator.configure) {
426
- _context5.next = 16;
413
+ _context5.next = 5;
427
414
  break;
428
415
  }
429
416
  console.warn('[BookingTicket] idGenerator 插件不可用,跳过配置');
430
417
  return _context5.abrupt("return");
418
+ case 5:
419
+ openDataConfig = null;
420
+ _context5.prev = 6;
421
+ _context5.next = 9;
422
+ return this.loadOpenDataConfig();
423
+ case 9:
424
+ openDataConfig = _context5.sent;
425
+ _context5.next = 16;
426
+ break;
427
+ case 12:
428
+ _context5.prev = 12;
429
+ _context5.t0 = _context5["catch"](6);
430
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context5.t0);
431
+ return _context5.abrupt("return");
431
432
  case 16:
433
+ // if (!openDataConfig) return;
432
434
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
433
435
  receiptSequenceStart = this.normalizePositiveInteger((_openDataConfig2 = openDataConfig) === null || _openDataConfig2 === void 0 ? void 0 : _openDataConfig2['sale.short_number_start_number'], 1);
434
436
  prefix = this.normalizeIdPrefix((_openDataConfig3 = openDataConfig) === null || _openDataConfig3 === void 0 ? void 0 : _openDataConfig3['sale.short_number_prefix'], '');
@@ -475,7 +477,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
475
477
  case "end":
476
478
  return _context5.stop();
477
479
  }
478
- }, _callee5, this, [[2, 8], [30, 35]]);
480
+ }, _callee5, this, [[6, 12], [30, 35]]);
479
481
  }));
480
482
  function configureIdGeneratorFromOpenData() {
481
483
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -559,7 +561,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
559
561
  key: "scanPromotionCode",
560
562
  value: function () {
561
563
  var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(code, customerId) {
562
- var raw, scannedList, extractedCustomerId, hasOrderCustomer, tempOrder;
564
+ var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
563
565
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
564
566
  while (1) switch (_context7.prev = _context7.next) {
565
567
  case 0:
@@ -575,33 +577,34 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
575
577
  raw = _context7.sent;
576
578
  scannedList = raw.scannedDiscountList || [];
577
579
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
578
- hasOrderCustomer = Boolean(this.store.order.getOrderCustomer()); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
579
- if (!(!hasOrderCustomer && extractedCustomerId)) {
580
- _context7.next = 11;
580
+ hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
581
+ isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
582
+ if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
583
+ _context7.next = 12;
581
584
  break;
582
585
  }
583
- _context7.next = 11;
586
+ _context7.next = 12;
584
587
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
585
- case 11:
588
+ case 12:
586
589
  if (!raw.isAvailable) {
587
- _context7.next = 18;
590
+ _context7.next = 19;
588
591
  break;
589
592
  }
590
- _context7.next = 14;
593
+ _context7.next = 15;
591
594
  return this.store.order.recalculateSummary({
592
595
  createIfMissing: true
593
596
  });
594
- case 14:
597
+ case 15:
595
598
  this.store.order.persistTempOrder();
596
599
  tempOrder = this.store.order.ensureTempOrder();
597
- _context7.next = 18;
600
+ _context7.next = 19;
598
601
  return this.effectsEmit('onDiscountApplied', {
599
602
  productList: tempOrder.products || [],
600
603
  discountList: this.store.order.getDiscountList(),
601
604
  selectedDiscountList: tempOrder.discount_list || [],
602
605
  tempOrder: tempOrder
603
606
  });
604
- case 18:
607
+ case 19:
605
608
  return _context7.abrupt("return", _objectSpread(_objectSpread({
606
609
  isAvailable: raw.isAvailable
607
610
  }, raw.isAccepted !== undefined ? {
@@ -611,7 +614,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
611
614
  unavailableReason: raw.unavailableReason,
612
615
  scannedDiscountList: raw.scannedDiscountList
613
616
  }));
614
- case 19:
617
+ case 20:
615
618
  case "end":
616
619
  return _context7.stop();
617
620
  }
@@ -688,11 +691,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
688
691
  return null;
689
692
  }
690
693
  }, {
691
- key: "resolveCustomerByDiscountCustomerId",
694
+ key: "resolveCustomerById",
692
695
  value: function () {
693
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
696
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
694
697
  var _result$list;
695
- var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
698
+ var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
696
699
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
697
700
  while (1) switch (_context9.prev = _context9.next) {
698
701
  case 0:
@@ -714,18 +717,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
714
717
  case 7:
715
718
  result = _context9.sent;
716
719
  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;
717
- return _context9.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
718
- case 10:
720
+ if (!remoteCustomer) {
721
+ _context9.next = 11;
722
+ break;
723
+ }
724
+ return _context9.abrupt("return", this.normalizeCustomer(remoteCustomer));
725
+ case 11:
726
+ _context9.prev = 11;
727
+ _context9.next = 14;
728
+ return this.store.customer.queryCustomerDetail(customerId);
729
+ case 14:
730
+ detailCustomer = _context9.sent;
731
+ return _context9.abrupt("return", detailCustomer ? this.normalizeCustomer(detailCustomer) : null);
732
+ case 18:
733
+ _context9.prev = 18;
734
+ _context9.t0 = _context9["catch"](11);
735
+ console.warn('[BookingTicket] resolveCustomerById detail request failed', {
736
+ customerId: customerId,
737
+ error: _context9.t0
738
+ });
739
+ return _context9.abrupt("return", null);
740
+ case 22:
719
741
  case "end":
720
742
  return _context9.stop();
721
743
  }
722
- }, _callee9, this);
744
+ }, _callee9, this, [[11, 18]]);
723
745
  }));
724
- function resolveCustomerByDiscountCustomerId(_x6) {
725
- return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
746
+ function resolveCustomerById(_x6) {
747
+ return _resolveCustomerById.apply(this, arguments);
726
748
  }
727
- return resolveCustomerByDiscountCustomerId;
728
- }()
749
+ return resolveCustomerById;
750
+ }() /** 兼容既有优惠码扫码逻辑。 */
751
+ }, {
752
+ key: "resolveCustomerByDiscountCustomerId",
753
+ value: function resolveCustomerByDiscountCustomerId(customerId) {
754
+ return this.resolveCustomerById(customerId);
755
+ }
729
756
  }, {
730
757
  key: "findCustomerById",
731
758
  value: function findCustomerById() {
@@ -1532,7 +1559,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1532
1559
  }, {
1533
1560
  key: "setOrderCustomer",
1534
1561
  value: function setOrderCustomer(customer) {
1535
- var _this$store$order$get3;
1562
+ var _this$store$order$get3,
1563
+ _this3 = this;
1536
1564
  if (!customer) {
1537
1565
  this.clearOrderCustomer();
1538
1566
  return;
@@ -1561,8 +1589,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1561
1589
  this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), next);
1562
1590
  this.refreshDiscountConfigAfterOrderCustomerChange(patch.customer_id);
1563
1591
  // 客户切换可能改变可用促销/赠品;触发一次重算(recursion-safe)。
1564
- void this.store.order.applyPromotion().catch(function (error) {
1592
+ var promotionRefreshTask = this.store.order.applyPromotion().then(function () {
1593
+ return undefined;
1594
+ });
1595
+ this.orderCustomerPromotionRefreshInFlight = promotionRefreshTask;
1596
+ void promotionRefreshTask.then(function () {
1597
+ if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
1598
+ _this3.orderCustomerPromotionRefreshInFlight = null;
1599
+ }, function (error) {
1565
1600
  console.error('[BookingTicket] applyPromotion after customer change failed', error);
1601
+ if (_this3.orderCustomerPromotionRefreshInFlight !== promotionRefreshTask) return;
1602
+ _this3.orderCustomerPromotionRefreshInFlight = null;
1566
1603
  });
1567
1604
  }
1568
1605
 
@@ -1592,7 +1629,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1592
1629
  value: function clearOrderCustomer() {
1593
1630
  var _discountModule$setOr,
1594
1631
  _discountModule$setDi,
1595
- _this3 = this;
1632
+ _this4 = this;
1596
1633
  this.store.order.clearOrderCustomer();
1597
1634
  this.discountConfigCacheKey = null;
1598
1635
  this.hasManualDiscountSelection = false;
@@ -1605,9 +1642,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1605
1642
  createIfMissing: true
1606
1643
  }).then(function () {
1607
1644
  var _discountModule$getDi;
1608
- var tempOrder = _this3.store.order.ensureTempOrder();
1609
- _this3.store.order.persistTempOrder();
1610
- return _this3.effectsEmit('onDiscountApplied', {
1645
+ var tempOrder = _this4.store.order.ensureTempOrder();
1646
+ _this4.store.order.persistTempOrder();
1647
+ return _this4.effectsEmit('onDiscountApplied', {
1611
1648
  productList: tempOrder.products || [],
1612
1649
  discountList: (discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [],
1613
1650
  selectedDiscountList: tempOrder.discount_list || [],
@@ -1668,14 +1705,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1668
1705
  }, {
1669
1706
  key: "refreshDiscountConfigAfterOrderCustomerChange",
1670
1707
  value: function refreshDiscountConfigAfterOrderCustomerChange(customerId) {
1671
- var _this4 = this;
1672
- if (!customerId || customerId === 1) return;
1708
+ var _this5 = this;
1709
+ if (!customerId || customerId === 1) return Promise.resolve();
1673
1710
  if (this.orderCustomerDiscountRefreshInFlight && this.orderCustomerDiscountRefreshCustomerId === customerId) {
1674
- return;
1711
+ return this.orderCustomerDiscountRefreshInFlight;
1675
1712
  }
1676
1713
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1677
1714
  var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1678
- var currentCustomer;
1715
+ var _this5$store$order$ge, _this5$store$order, _this5$getOrderIdenti;
1716
+ var currentCustomer, tempOrder, orderId, action;
1679
1717
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1680
1718
  while (1) switch (_context22.prev = _context22.next) {
1681
1719
  case 0:
@@ -1688,18 +1726,22 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1688
1726
  return undefined;
1689
1727
  });
1690
1728
  case 3:
1691
- currentCustomer = _this4.store.order.getOrderCustomer();
1729
+ currentCustomer = _this5.store.order.getOrderCustomer();
1692
1730
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1693
1731
  _context22.next = 6;
1694
1732
  break;
1695
1733
  }
1696
1734
  return _context22.abrupt("return");
1697
1735
  case 6:
1698
- _context22.next = 8;
1699
- return _this4.loadDiscountConfig({
1700
- customerId: customerId
1736
+ 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);
1737
+ 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);
1738
+ action = !orderId || String(orderId).startsWith('local_order') ? 'create' : 'edit';
1739
+ _context22.next = 11;
1740
+ return _this5.loadDiscountConfig({
1741
+ customerId: customerId,
1742
+ action: action
1701
1743
  });
1702
- case 8:
1744
+ case 11:
1703
1745
  case "end":
1704
1746
  return _context22.stop();
1705
1747
  }
@@ -1710,10 +1752,54 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1710
1752
  refreshTask.catch(function (error) {
1711
1753
  console.error('Failed to load discount config after customer change:', error);
1712
1754
  }).finally(function () {
1713
- if (_this4.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1714
- _this4.orderCustomerDiscountRefreshInFlight = null;
1715
- _this4.orderCustomerDiscountRefreshCustomerId = null;
1755
+ if (_this5.orderCustomerDiscountRefreshInFlight !== refreshTask) return;
1756
+ _this5.orderCustomerDiscountRefreshInFlight = null;
1757
+ _this5.orderCustomerDiscountRefreshCustomerId = null;
1716
1758
  });
1759
+ return refreshTask;
1760
+ }
1761
+ }, {
1762
+ key: "waitForOrderCustomerPromotionRefresh",
1763
+ value: function waitForOrderCustomerPromotionRefresh() {
1764
+ return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
1765
+ }
1766
+ }, {
1767
+ key: "prepareProductPriceQueryContext",
1768
+ value: function () {
1769
+ var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(customerId) {
1770
+ var normalizedCustomerId, refreshTask, shouldWait;
1771
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1772
+ while (1) switch (_context23.prev = _context23.next) {
1773
+ case 0:
1774
+ _context23.next = 2;
1775
+ return Promise.resolve();
1776
+ case 2:
1777
+ normalizedCustomerId = Number(customerId || 0);
1778
+ refreshTask = this.orderCustomerDiscountRefreshInFlight;
1779
+ shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
1780
+ if (!(shouldWait && refreshTask)) {
1781
+ _context23.next = 8;
1782
+ break;
1783
+ }
1784
+ _context23.next = 8;
1785
+ return refreshTask;
1786
+ case 8:
1787
+ case "end":
1788
+ return _context23.stop();
1789
+ }
1790
+ }, _callee23, this);
1791
+ }));
1792
+ function prepareProductPriceQueryContext(_x16) {
1793
+ return _prepareProductPriceQueryContext.apply(this, arguments);
1794
+ }
1795
+ return prepareProductPriceQueryContext;
1796
+ }()
1797
+ }, {
1798
+ key: "preferAuthoritativeProductQueryPrice",
1799
+ value: function preferAuthoritativeProductQueryPrice() {
1800
+ // BookingTicket 的 /product/query 已按预约时间、客户及 Wallet 上下文执行
1801
+ // 智能定价;再次应用 legacy quotation 会把最终价覆盖成另一套时段价格。
1802
+ return true;
1717
1803
  }
1718
1804
 
1719
1805
  /**
@@ -1756,29 +1842,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1756
1842
  }, {
1757
1843
  key: "changeCustomerPage",
1758
1844
  value: (function () {
1759
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(page, pageSize) {
1845
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(page, pageSize) {
1760
1846
  var _result4;
1761
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1762
- while (1) switch (_context23.prev = _context23.next) {
1847
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1848
+ while (1) switch (_context24.prev = _context24.next) {
1763
1849
  case 0:
1764
- _context23.prev = 0;
1765
- _context23.next = 3;
1850
+ _context24.prev = 0;
1851
+ _context24.next = 3;
1766
1852
  return this.store.customer.changeCustomerPage(page, pageSize);
1767
1853
  case 3:
1768
- _result4 = _context23.sent;
1769
- return _context23.abrupt("return", _result4);
1854
+ _result4 = _context24.sent;
1855
+ return _context24.abrupt("return", _result4);
1770
1856
  case 7:
1771
- _context23.prev = 7;
1772
- _context23.t0 = _context23["catch"](0);
1773
- console.error('Failed to change customer page:', _context23.t0);
1774
- throw _context23.t0;
1857
+ _context24.prev = 7;
1858
+ _context24.t0 = _context24["catch"](0);
1859
+ console.error('Failed to change customer page:', _context24.t0);
1860
+ throw _context24.t0;
1775
1861
  case 11:
1776
1862
  case "end":
1777
- return _context23.stop();
1863
+ return _context24.stop();
1778
1864
  }
1779
- }, _callee23, this, [[0, 7]]);
1865
+ }, _callee24, this, [[0, 7]]);
1780
1866
  }));
1781
- function changeCustomerPage(_x16, _x17) {
1867
+ function changeCustomerPage(_x17, _x18) {
1782
1868
  return _changeCustomerPage.apply(this, arguments);
1783
1869
  }
1784
1870
  return changeCustomerPage;
@@ -1791,28 +1877,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1791
1877
  }, {
1792
1878
  key: "loadMoreCustomers",
1793
1879
  value: (function () {
1794
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1880
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1795
1881
  var _result5;
1796
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1797
- while (1) switch (_context24.prev = _context24.next) {
1882
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1883
+ while (1) switch (_context25.prev = _context25.next) {
1798
1884
  case 0:
1799
- _context24.prev = 0;
1800
- _context24.next = 3;
1885
+ _context25.prev = 0;
1886
+ _context25.next = 3;
1801
1887
  return this.store.customer.loadMoreCustomers();
1802
1888
  case 3:
1803
- _result5 = _context24.sent;
1889
+ _result5 = _context25.sent;
1804
1890
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1805
- return _context24.abrupt("return", _result5);
1891
+ return _context25.abrupt("return", _result5);
1806
1892
  case 8:
1807
- _context24.prev = 8;
1808
- _context24.t0 = _context24["catch"](0);
1809
- console.error('Failed to load more customers:', _context24.t0);
1810
- throw _context24.t0;
1893
+ _context25.prev = 8;
1894
+ _context25.t0 = _context25["catch"](0);
1895
+ console.error('Failed to load more customers:', _context25.t0);
1896
+ throw _context25.t0;
1811
1897
  case 12:
1812
1898
  case "end":
1813
- return _context24.stop();
1899
+ return _context25.stop();
1814
1900
  }
1815
- }, _callee24, this, [[0, 8]]);
1901
+ }, _callee25, this, [[0, 8]]);
1816
1902
  }));
1817
1903
  function loadMoreCustomers() {
1818
1904
  return _loadMoreCustomers.apply(this, arguments);
@@ -1828,31 +1914,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1828
1914
  }, {
1829
1915
  key: "resetAndLoadCustomers",
1830
1916
  value: (function () {
1831
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1917
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1832
1918
  var params,
1833
1919
  _result6,
1834
- _args25 = arguments;
1835
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1836
- while (1) switch (_context25.prev = _context25.next) {
1920
+ _args26 = arguments;
1921
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1922
+ while (1) switch (_context26.prev = _context26.next) {
1837
1923
  case 0:
1838
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1839
- _context25.prev = 1;
1840
- _context25.next = 4;
1924
+ params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
1925
+ _context26.prev = 1;
1926
+ _context26.next = 4;
1841
1927
  return this.store.customer.resetAndLoadCustomers(params);
1842
1928
  case 4:
1843
- _result6 = _context25.sent;
1929
+ _result6 = _context26.sent;
1844
1930
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1845
- return _context25.abrupt("return", _result6);
1931
+ return _context26.abrupt("return", _result6);
1846
1932
  case 9:
1847
- _context25.prev = 9;
1848
- _context25.t0 = _context25["catch"](1);
1849
- console.error('Failed to reset and load customers:', _context25.t0);
1850
- throw _context25.t0;
1933
+ _context26.prev = 9;
1934
+ _context26.t0 = _context26["catch"](1);
1935
+ console.error('Failed to reset and load customers:', _context26.t0);
1936
+ throw _context26.t0;
1851
1937
  case 13:
1852
1938
  case "end":
1853
- return _context25.stop();
1939
+ return _context26.stop();
1854
1940
  }
1855
- }, _callee25, this, [[1, 9]]);
1941
+ }, _callee26, this, [[1, 9]]);
1856
1942
  }));
1857
1943
  function resetAndLoadCustomers() {
1858
1944
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1897,9 +1983,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1897
1983
  }, {
1898
1984
  key: "scanGlobalListener",
1899
1985
  value: function scanGlobalListener(callback) {
1900
- var _this5 = this;
1986
+ var _this6 = this;
1901
1987
  var localSearch = function localSearch(v) {
1902
- return _this5.store.products.findProductsByCodeOrBarcode(v);
1988
+ return _this6.store.products.findProductsByCodeOrBarcode(v);
1903
1989
  };
1904
1990
  var scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
1905
1991
  var safeCallback = function safeCallback(d) {
@@ -2013,16 +2099,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2013
2099
  }, {
2014
2100
  key: "getOtherParams",
2015
2101
  value: (function () {
2016
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2017
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2018
- while (1) switch (_context26.prev = _context26.next) {
2102
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2103
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2104
+ while (1) switch (_context27.prev = _context27.next) {
2019
2105
  case 0:
2020
- return _context26.abrupt("return", this.otherParams);
2106
+ return _context27.abrupt("return", this.otherParams);
2021
2107
  case 1:
2022
2108
  case "end":
2023
- return _context26.stop();
2109
+ return _context27.stop();
2024
2110
  }
2025
- }, _callee26, this);
2111
+ }, _callee27, this);
2026
2112
  }));
2027
2113
  function getOtherParams() {
2028
2114
  return _getOtherParams.apply(this, arguments);
@@ -2341,18 +2427,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2341
2427
  }, {
2342
2428
  key: "updateProductInOrder",
2343
2429
  value: (function () {
2344
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2345
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2346
- while (1) switch (_context27.prev = _context27.next) {
2430
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
2431
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2432
+ while (1) switch (_context28.prev = _context28.next) {
2347
2433
  case 0:
2348
- return _context27.abrupt("return", this.updateOrderProduct(params));
2434
+ return _context28.abrupt("return", this.updateOrderProduct(params));
2349
2435
  case 1:
2350
2436
  case "end":
2351
- return _context27.stop();
2437
+ return _context28.stop();
2352
2438
  }
2353
- }, _callee27, this);
2439
+ }, _callee28, this);
2354
2440
  }));
2355
- function updateProductInOrder(_x18) {
2441
+ function updateProductInOrder(_x19) {
2356
2442
  return _updateProductInOrder.apply(this, arguments);
2357
2443
  }
2358
2444
  return updateProductInOrder;
@@ -2374,100 +2460,100 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2374
2460
  }, {
2375
2461
  key: "handleGlobalScanCode",
2376
2462
  value: (function () {
2377
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
2378
- var _this6 = this;
2463
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(code, bridge) {
2464
+ var _this7 = this;
2379
2465
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2380
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2381
- while (1) switch (_context28.prev = _context28.next) {
2466
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2467
+ while (1) switch (_context29.prev = _context29.next) {
2382
2468
  case 0:
2383
2469
  trimmed = typeof code === 'string' ? code.trim() : '';
2384
2470
  if (trimmed) {
2385
- _context28.next = 4;
2471
+ _context29.next = 4;
2386
2472
  break;
2387
2473
  }
2388
2474
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2389
- return _context28.abrupt("return", {
2475
+ return _context29.abrupt("return", {
2390
2476
  status: 'failed',
2391
2477
  reason: 'empty_code'
2392
2478
  });
2393
2479
  case 4:
2394
- _context28.prev = 4;
2480
+ _context29.prev = 4;
2395
2481
  localSearch = function localSearch(v) {
2396
- return _this6.store.products.findProductsByCodeOrBarcode(v);
2482
+ return _this7.store.products.findProductsByCodeOrBarcode(v);
2397
2483
  };
2398
2484
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2399
- _context28.next = 9;
2485
+ _context29.next = 9;
2400
2486
  return scanCallback({
2401
2487
  type: 'nativeScanner',
2402
2488
  value: trimmed
2403
2489
  });
2404
2490
  case 9:
2405
- raw = _context28.sent;
2491
+ raw = _context29.sent;
2406
2492
  formatted = formatGlobalScanResult(raw, trimmed);
2407
2493
  if (formatted) {
2408
- _context28.next = 14;
2494
+ _context29.next = 14;
2409
2495
  break;
2410
2496
  }
2411
2497
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2412
- return _context28.abrupt("return", {
2498
+ return _context29.abrupt("return", {
2413
2499
  status: 'failed',
2414
2500
  reason: 'not_found'
2415
2501
  });
2416
2502
  case 14:
2417
- _context28.next = 16;
2503
+ _context29.next = 16;
2418
2504
  return applyGlobalScan({
2419
2505
  setOrderCustomer: function setOrderCustomer(customer) {
2420
- return _this6.setOrderCustomer(customer);
2506
+ return _this7.setOrderCustomer(customer);
2421
2507
  },
2422
2508
  getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
2423
- return _this6.getOrderCustomerSnapshot();
2509
+ return _this7.getOrderCustomerSnapshot();
2424
2510
  },
2425
2511
  getBusinessCode: function getBusinessCode() {
2426
- var _this6$otherParams;
2427
- return (_this6$otherParams = _this6.otherParams) === null || _this6$otherParams === void 0 ? void 0 : _this6$otherParams.businessCode;
2512
+ var _this7$otherParams;
2513
+ return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
2428
2514
  },
2429
2515
  buildAddProductCtx: function buildAddProductCtx(extra) {
2430
- return _this6.buildAddProductCtx(extra);
2516
+ return _this7.buildAddProductCtx(extra);
2431
2517
  },
2432
2518
  decideAddProduct: function decideAddProduct(item, options) {
2433
- return _this6.decideAddProduct(item, options);
2519
+ return _this7.decideAddProduct(item, options);
2434
2520
  },
2435
2521
  decideAfterDetail: function decideAfterDetail(cacheItem, options) {
2436
- return _this6.decideAfterDetail(cacheItem, options);
2522
+ return _this7.decideAfterDetail(cacheItem, options);
2437
2523
  },
2438
2524
  transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
2439
- return _this6.transformDetailToProductAndBooking(input);
2525
+ return _this7.transformDetailToProductAndBooking(input);
2440
2526
  },
2441
2527
  addProductToOrder: function addProductToOrder(product, booking) {
2442
- return _this6.addProductToOrder(product, booking);
2528
+ return _this7.addProductToOrder(product, booking);
2443
2529
  },
2444
2530
  refreshWalletAssets: function refreshWalletAssets(params) {
2445
- return _this6.refreshWalletAssets(params);
2531
+ return _this7.refreshWalletAssets(params);
2446
2532
  },
2447
2533
  scanWalletAsset: function scanWalletAsset(scanCode) {
2448
- return _this6.scanWalletAsset(scanCode);
2534
+ return _this7.scanWalletAsset(scanCode);
2449
2535
  }
2450
2536
  }, formatted, bridge);
2451
2537
  case 16:
2452
- _result7 = _context28.sent;
2538
+ _result7 = _context29.sent;
2453
2539
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2454
- return _context28.abrupt("return", _result7);
2540
+ return _context29.abrupt("return", _result7);
2455
2541
  case 21:
2456
- _context28.prev = 21;
2457
- _context28.t0 = _context28["catch"](4);
2458
- console.error('[BookingTicket] handleGlobalScanCode failed', _context28.t0);
2542
+ _context29.prev = 21;
2543
+ _context29.t0 = _context29["catch"](4);
2544
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context29.t0);
2459
2545
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2460
- return _context28.abrupt("return", {
2546
+ return _context29.abrupt("return", {
2461
2547
  status: 'failed',
2462
2548
  reason: 'not_found'
2463
2549
  });
2464
2550
  case 26:
2465
2551
  case "end":
2466
- return _context28.stop();
2552
+ return _context29.stop();
2467
2553
  }
2468
- }, _callee28, this, [[4, 21]]);
2554
+ }, _callee29, this, [[4, 21]]);
2469
2555
  }));
2470
- function handleGlobalScanCode(_x19, _x20) {
2556
+ function handleGlobalScanCode(_x20, _x21) {
2471
2557
  return _handleGlobalScanCode.apply(this, arguments);
2472
2558
  }
2473
2559
  return handleGlobalScanCode;
@@ -2549,11 +2635,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2549
2635
  }, {
2550
2636
  key: "addAddTimeProductToBooking",
2551
2637
  value: (function () {
2552
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(input) {
2553
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2554
- while (1) switch (_context29.prev = _context29.next) {
2638
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2639
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2640
+ while (1) switch (_context30.prev = _context30.next) {
2555
2641
  case 0:
2556
- return _context29.abrupt("return", this.addAddTimeProductsToBooking({
2642
+ return _context30.abrupt("return", this.addAddTimeProductsToBooking({
2557
2643
  booking: input.booking,
2558
2644
  products: [input],
2559
2645
  coveredMinutes: input.coveredMinutes,
@@ -2561,11 +2647,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2561
2647
  }));
2562
2648
  case 1:
2563
2649
  case "end":
2564
- return _context29.stop();
2650
+ return _context30.stop();
2565
2651
  }
2566
- }, _callee29, this);
2652
+ }, _callee30, this);
2567
2653
  }));
2568
- function addAddTimeProductToBooking(_x21) {
2654
+ function addAddTimeProductToBooking(_x22) {
2569
2655
  return _addAddTimeProductToBooking.apply(this, arguments);
2570
2656
  }
2571
2657
  return addAddTimeProductToBooking;
@@ -2583,27 +2669,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2583
2669
  }, {
2584
2670
  key: "addAddTimeProductsToBooking",
2585
2671
  value: (function () {
2586
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2587
- var _this7 = this,
2672
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(input) {
2673
+ var _this8 = this,
2588
2674
  _input$bookingPatch;
2589
2675
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2590
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2591
- while (1) switch (_context30.prev = _context30.next) {
2676
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2677
+ while (1) switch (_context31.prev = _context31.next) {
2592
2678
  case 0:
2593
2679
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2594
2680
  if (bookingUid) {
2595
- _context30.next = 3;
2681
+ _context31.next = 3;
2596
2682
  break;
2597
2683
  }
2598
2684
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
2599
2685
  case 3:
2600
2686
  orderLines = (input.products || []).map(function (line) {
2601
2687
  return {
2602
- product: _this7.buildAddTimeOrderLine(line, bookingUid)
2688
+ product: _this8.buildAddTimeOrderLine(line, bookingUid)
2603
2689
  };
2604
2690
  });
2605
2691
  if (this.store.order) {
2606
- _context30.next = 6;
2692
+ _context31.next = 6;
2607
2693
  break;
2608
2694
  }
2609
2695
  throw new Error('order 模块未初始化');
@@ -2617,55 +2703,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2617
2703
  });
2618
2704
  }
2619
2705
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2620
- _context30.next = 11;
2706
+ _context31.next = 11;
2621
2707
  break;
2622
2708
  }
2623
- return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2709
+ return _context31.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2624
2710
  case 11:
2625
2711
  result = [];
2626
2712
  _iterator2 = _createForOfIteratorHelper(orderLines);
2627
- _context30.prev = 13;
2713
+ _context31.prev = 13;
2628
2714
  _iterator2.s();
2629
2715
  case 15:
2630
2716
  if ((_step2 = _iterator2.n()).done) {
2631
- _context30.next = 29;
2717
+ _context31.next = 29;
2632
2718
  break;
2633
2719
  }
2634
2720
  line = _step2.value;
2635
- _context30.t0 = result.splice;
2636
- _context30.t1 = result;
2637
- _context30.t2 = [0, result.length];
2638
- _context30.t3 = _toConsumableArray;
2639
- _context30.next = 23;
2721
+ _context31.t0 = result.splice;
2722
+ _context31.t1 = result;
2723
+ _context31.t2 = [0, result.length];
2724
+ _context31.t3 = _toConsumableArray;
2725
+ _context31.next = 23;
2640
2726
  return this.addProductToOrder(line.product);
2641
2727
  case 23:
2642
- _context30.t4 = _context30.sent;
2643
- _context30.t5 = (0, _context30.t3)(_context30.t4);
2644
- _context30.t6 = _context30.t2.concat.call(_context30.t2, _context30.t5);
2645
- _context30.t0.apply.call(_context30.t0, _context30.t1, _context30.t6);
2728
+ _context31.t4 = _context31.sent;
2729
+ _context31.t5 = (0, _context31.t3)(_context31.t4);
2730
+ _context31.t6 = _context31.t2.concat.call(_context31.t2, _context31.t5);
2731
+ _context31.t0.apply.call(_context31.t0, _context31.t1, _context31.t6);
2646
2732
  case 27:
2647
- _context30.next = 15;
2733
+ _context31.next = 15;
2648
2734
  break;
2649
2735
  case 29:
2650
- _context30.next = 34;
2736
+ _context31.next = 34;
2651
2737
  break;
2652
2738
  case 31:
2653
- _context30.prev = 31;
2654
- _context30.t7 = _context30["catch"](13);
2655
- _iterator2.e(_context30.t7);
2739
+ _context31.prev = 31;
2740
+ _context31.t7 = _context31["catch"](13);
2741
+ _iterator2.e(_context31.t7);
2656
2742
  case 34:
2657
- _context30.prev = 34;
2743
+ _context31.prev = 34;
2658
2744
  _iterator2.f();
2659
- return _context30.finish(34);
2745
+ return _context31.finish(34);
2660
2746
  case 37:
2661
- return _context30.abrupt("return", result);
2747
+ return _context31.abrupt("return", result);
2662
2748
  case 38:
2663
2749
  case "end":
2664
- return _context30.stop();
2750
+ return _context31.stop();
2665
2751
  }
2666
- }, _callee30, this, [[13, 31, 34, 37]]);
2752
+ }, _callee31, this, [[13, 31, 34, 37]]);
2667
2753
  }));
2668
- function addAddTimeProductsToBooking(_x22) {
2754
+ function addAddTimeProductsToBooking(_x23) {
2669
2755
  return _addAddTimeProductsToBooking.apply(this, arguments);
2670
2756
  }
2671
2757
  return addAddTimeProductsToBooking;
@@ -2673,33 +2759,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2673
2759
  }, {
2674
2760
  key: "setOtherParams",
2675
2761
  value: function () {
2676
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2762
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2677
2763
  var _ref19,
2678
2764
  _ref19$cover,
2679
2765
  cover,
2680
- _args31 = arguments;
2681
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2682
- while (1) switch (_context31.prev = _context31.next) {
2766
+ _args32 = arguments;
2767
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2768
+ while (1) switch (_context32.prev = _context32.next) {
2683
2769
  case 0:
2684
- _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2685
- _context31.next = 3;
2770
+ _ref19 = _args32.length > 1 && _args32[1] !== undefined ? _args32[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2771
+ _context32.next = 3;
2686
2772
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2687
2773
  cover: cover
2688
2774
  });
2689
2775
  case 3:
2690
2776
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2691
- _context31.next = 6;
2777
+ _context32.next = 6;
2692
2778
  break;
2693
2779
  }
2694
- _context31.next = 6;
2780
+ _context32.next = 6;
2695
2781
  return this.configureIdGeneratorFromOpenData();
2696
2782
  case 6:
2697
2783
  case "end":
2698
- return _context31.stop();
2784
+ return _context32.stop();
2699
2785
  }
2700
- }, _callee31, this);
2786
+ }, _callee32, this);
2701
2787
  }));
2702
- function setOtherParams(_x23) {
2788
+ function setOtherParams(_x24) {
2703
2789
  return _setOtherParams.apply(this, arguments);
2704
2790
  }
2705
2791
  return setOtherParams;
@@ -2716,15 +2802,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2716
2802
  }, {
2717
2803
  key: "handlePrintWristband",
2718
2804
  value: function () {
2719
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2805
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2720
2806
  var _this$getOrderIdentit;
2721
2807
  var deviceTask, deviceId, idempotencyKey;
2722
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2723
- while (1) switch (_context32.prev = _context32.next) {
2808
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2809
+ while (1) switch (_context33.prev = _context33.next) {
2724
2810
  case 0:
2725
2811
  deviceTask = this.getDeviceTaskPlugin();
2726
2812
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
2727
- _context32.next = 4;
2813
+ _context33.next = 4;
2728
2814
  break;
2729
2815
  }
2730
2816
  this.logger.addLog({
@@ -2734,7 +2820,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2734
2820
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2735
2821
  }
2736
2822
  });
2737
- return _context32.abrupt("return");
2823
+ return _context33.abrupt("return");
2738
2824
  case 4:
2739
2825
  this.logger.addLog({
2740
2826
  type: 'info',
@@ -2743,10 +2829,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2743
2829
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2744
2830
  }
2745
2831
  });
2746
- _context32.next = 7;
2832
+ _context33.next = 7;
2747
2833
  return this.getShortNumberOrDeviceId();
2748
2834
  case 7:
2749
- deviceId = _context32.sent;
2835
+ deviceId = _context33.sent;
2750
2836
  idempotencyKey = createUuidV4();
2751
2837
  deviceTask.dispatch({
2752
2838
  action: 'print_all',
@@ -2766,11 +2852,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2766
2852
  });
2767
2853
  case 10:
2768
2854
  case "end":
2769
- return _context32.stop();
2855
+ return _context33.stop();
2770
2856
  }
2771
- }, _callee32, this);
2857
+ }, _callee33, this);
2772
2858
  }));
2773
- function handlePrintWristband(_x24) {
2859
+ function handlePrintWristband(_x25) {
2774
2860
  return _handlePrintWristband.apply(this, arguments);
2775
2861
  }
2776
2862
  return handlePrintWristband;
@@ -2778,11 +2864,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2778
2864
  }, {
2779
2865
  key: "handleRedeem",
2780
2866
  value: function () {
2781
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2867
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
2782
2868
  var _this$store$order5, _this$store$order5$ge, _this$store$order6, _ref20, _tempOrder$order_id2;
2783
2869
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
2784
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2785
- while (1) switch (_context33.prev = _context33.next) {
2870
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2871
+ while (1) switch (_context34.prev = _context34.next) {
2786
2872
  case 0:
2787
2873
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
2788
2874
  status = params.is_checkin ? 'used' : 'unused';
@@ -2806,20 +2892,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2806
2892
  });
2807
2893
  });
2808
2894
  if (!(tempOrder && hasUpdatedVoucher)) {
2809
- _context33.next = 11;
2895
+ _context34.next = 11;
2810
2896
  break;
2811
2897
  }
2812
- _context33.next = 11;
2898
+ _context34.next = 11;
2813
2899
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
2814
2900
  vouchers: nextVouchers
2815
2901
  }));
2816
2902
  case 11:
2817
2903
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
2818
2904
  if (!(voucherIds.length === 0)) {
2819
- _context33.next = 14;
2905
+ _context34.next = 14;
2820
2906
  break;
2821
2907
  }
2822
- return _context33.abrupt("return", {
2908
+ return _context34.abrupt("return", {
2823
2909
  code: 200,
2824
2910
  status: true,
2825
2911
  message: '',
@@ -2830,7 +2916,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2830
2916
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
2831
2917
  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;
2832
2918
  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;
2833
- return _context33.abrupt("return", this.request.post('/machinecode/batch', {
2919
+ return _context34.abrupt("return", this.request.post('/machinecode/batch', {
2834
2920
  ids: voucherIds,
2835
2921
  status: status,
2836
2922
  order_lookup: orderLookup,
@@ -2841,11 +2927,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2841
2927
  }));
2842
2928
  case 19:
2843
2929
  case "end":
2844
- return _context33.stop();
2930
+ return _context34.stop();
2845
2931
  }
2846
- }, _callee33, this);
2932
+ }, _callee34, this);
2847
2933
  }));
2848
- function handleRedeem(_x25) {
2934
+ function handleRedeem(_x26) {
2849
2935
  return _handleRedeem.apply(this, arguments);
2850
2936
  }
2851
2937
  return handleRedeem;
@@ -2857,12 +2943,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2857
2943
  }, {
2858
2944
  key: "destroy",
2859
2945
  value: (function () {
2860
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2946
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2861
2947
  var _this$scan;
2862
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2863
- while (1) switch (_context34.prev = _context34.next) {
2948
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2949
+ while (1) switch (_context35.prev = _context35.next) {
2864
2950
  case 0:
2865
- _context34.next = 2;
2951
+ _context35.next = 2;
2866
2952
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2867
2953
  case 2:
2868
2954
  try {
@@ -2873,9 +2959,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2873
2959
  scanCache.clear();
2874
2960
  case 4:
2875
2961
  case "end":
2876
- return _context34.stop();
2962
+ return _context35.stop();
2877
2963
  }
2878
- }, _callee34, this);
2964
+ }, _callee35, this);
2879
2965
  }));
2880
2966
  function destroy() {
2881
2967
  return _destroy.apply(this, arguments);