@pisell/pisellos 0.10.7 → 0.10.9

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 (124) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  4. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  5. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  6. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  7. package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
  8. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +18 -12
  9. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  10. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  11. package/dist/modules/Customer/index.d.ts +4 -0
  12. package/dist/modules/Customer/index.js +91 -59
  13. package/dist/modules/Customer/types.d.ts +2 -0
  14. package/dist/modules/Discount/index.d.ts +2 -0
  15. package/dist/modules/Discount/index.js +38 -5
  16. package/dist/modules/Discount/types.d.ts +11 -0
  17. package/dist/modules/Order/index.d.ts +32 -6
  18. package/dist/modules/Order/index.js +1165 -819
  19. package/dist/modules/Order/types.d.ts +32 -4
  20. package/dist/modules/Order/types.js +11 -0
  21. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  22. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  23. package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
  24. package/dist/modules/Order/utils/virtualSettlement.js +271 -0
  25. package/dist/modules/Order/utils.js +89 -48
  26. package/dist/modules/Payment/types.d.ts +2 -0
  27. package/dist/modules/Payment/utils.js +4 -1
  28. package/dist/modules/Payment/walletpass.d.ts +11 -0
  29. package/dist/modules/Payment/walletpass.js +235 -60
  30. package/dist/modules/Product/types.d.ts +23 -0
  31. package/dist/modules/ProductList/index.d.ts +15 -2
  32. package/dist/modules/ProductList/index.js +92 -13
  33. package/dist/modules/Rules/index.js +125 -52
  34. package/dist/modules/SalesSummary/index.d.ts +1 -0
  35. package/dist/modules/SalesSummary/index.js +4 -3
  36. package/dist/modules/SalesSummary/types.d.ts +1 -0
  37. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  38. package/dist/modules/SalesSummary/utils.js +28 -2
  39. package/dist/server/index.d.ts +15 -0
  40. package/dist/server/index.js +894 -781
  41. package/dist/server/modules/order/index.d.ts +2 -0
  42. package/dist/server/modules/order/index.js +261 -96
  43. package/dist/server/modules/order/types.d.ts +1 -1
  44. package/dist/server/utils/small-ticket.js +2 -1
  45. package/dist/solution/BaseSales/index.d.ts +41 -7
  46. package/dist/solution/BaseSales/index.js +1405 -974
  47. package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  49. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +79 -13
  50. package/dist/solution/BaseSales/utils.js +31 -20
  51. package/dist/solution/BookingByStep/index.d.ts +3 -3
  52. package/dist/solution/BookingTicket/index.d.ts +5 -1
  53. package/dist/solution/BookingTicket/index.js +221 -162
  54. package/dist/solution/BookingTicket/types.d.ts +3 -0
  55. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  56. package/dist/solution/BookingTicket/utils/cartView.js +44 -32
  57. package/dist/solution/Sales/index.d.ts +1 -0
  58. package/dist/solution/Sales/index.js +16 -2
  59. package/dist/solution/ScanOrder/index.js +25 -64
  60. package/dist/solution/ScanOrder/utils.js +31 -20
  61. package/dist/solution/UnifiedBookingSales/index.d.ts +5 -4
  62. package/dist/solution/UnifiedBookingSales/index.js +51 -39
  63. package/lib/core/index.js +0 -1
  64. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  65. package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
  66. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  67. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  68. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  69. package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
  70. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -1
  71. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  72. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  73. package/lib/modules/Customer/index.d.ts +4 -0
  74. package/lib/modules/Customer/index.js +11 -0
  75. package/lib/modules/Customer/types.d.ts +2 -0
  76. package/lib/modules/Discount/index.d.ts +2 -0
  77. package/lib/modules/Discount/index.js +37 -3
  78. package/lib/modules/Discount/types.d.ts +11 -0
  79. package/lib/modules/Order/index.d.ts +32 -6
  80. package/lib/modules/Order/index.js +518 -148
  81. package/lib/modules/Order/types.d.ts +32 -4
  82. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  83. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  84. package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
  85. package/lib/modules/Order/utils/virtualSettlement.js +300 -0
  86. package/lib/modules/Order/utils.js +65 -21
  87. package/lib/modules/Payment/types.d.ts +2 -0
  88. package/lib/modules/Payment/utils.js +5 -1
  89. package/lib/modules/Payment/walletpass.d.ts +11 -0
  90. package/lib/modules/Payment/walletpass.js +198 -17
  91. package/lib/modules/Product/types.d.ts +23 -0
  92. package/lib/modules/ProductList/index.d.ts +15 -2
  93. package/lib/modules/ProductList/index.js +85 -3
  94. package/lib/modules/Rules/index.js +100 -20
  95. package/lib/modules/SalesSummary/index.d.ts +1 -0
  96. package/lib/modules/SalesSummary/index.js +10 -2
  97. package/lib/modules/SalesSummary/types.d.ts +1 -0
  98. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  99. package/lib/modules/SalesSummary/utils.js +30 -2
  100. package/lib/server/index.d.ts +15 -0
  101. package/lib/server/index.js +105 -14
  102. package/lib/server/modules/order/index.d.ts +2 -0
  103. package/lib/server/modules/order/index.js +75 -5
  104. package/lib/server/modules/order/types.d.ts +1 -1
  105. package/lib/server/utils/small-ticket.js +1 -1
  106. package/lib/solution/BaseSales/index.d.ts +41 -7
  107. package/lib/solution/BaseSales/index.js +325 -39
  108. package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
  109. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  110. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +62 -12
  111. package/lib/solution/BaseSales/utils.js +29 -18
  112. package/lib/solution/BookingByStep/index.d.ts +3 -3
  113. package/lib/solution/BookingTicket/index.d.ts +5 -1
  114. package/lib/solution/BookingTicket/index.js +31 -6
  115. package/lib/solution/BookingTicket/types.d.ts +3 -0
  116. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
  117. package/lib/solution/BookingTicket/utils/cartView.js +43 -30
  118. package/lib/solution/Sales/index.d.ts +1 -0
  119. package/lib/solution/Sales/index.js +15 -3
  120. package/lib/solution/ScanOrder/index.js +17 -54
  121. package/lib/solution/ScanOrder/utils.js +29 -18
  122. package/lib/solution/UnifiedBookingSales/index.d.ts +5 -4
  123. package/lib/solution/UnifiedBookingSales/index.js +35 -26
  124. package/package.json +1 -1
@@ -691,11 +691,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
691
691
  return null;
692
692
  }
693
693
  }, {
694
- key: "resolveCustomerByDiscountCustomerId",
694
+ key: "resolveCustomerById",
695
695
  value: function () {
696
- var _resolveCustomerByDiscountCustomerId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
696
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(customerId) {
697
697
  var _result$list;
698
- var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer;
698
+ var localCustomers, localCustomer, normalizedLocalCustomer, result, remoteCustomer, detailCustomer;
699
699
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
700
700
  while (1) switch (_context9.prev = _context9.next) {
701
701
  case 0:
@@ -717,18 +717,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
717
717
  case 7:
718
718
  result = _context9.sent;
719
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;
720
- return _context9.abrupt("return", remoteCustomer ? this.normalizeCustomer(remoteCustomer) : null);
721
- 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:
722
741
  case "end":
723
742
  return _context9.stop();
724
743
  }
725
- }, _callee9, this);
744
+ }, _callee9, this, [[11, 18]]);
726
745
  }));
727
- function resolveCustomerByDiscountCustomerId(_x6) {
728
- return _resolveCustomerByDiscountCustomerId.apply(this, arguments);
746
+ function resolveCustomerById(_x6) {
747
+ return _resolveCustomerById.apply(this, arguments);
729
748
  }
730
- return resolveCustomerByDiscountCustomerId;
731
- }()
749
+ return resolveCustomerById;
750
+ }() /** 兼容既有优惠码扫码逻辑。 */
751
+ }, {
752
+ key: "resolveCustomerByDiscountCustomerId",
753
+ value: function resolveCustomerByDiscountCustomerId(customerId) {
754
+ return this.resolveCustomerById(customerId);
755
+ }
732
756
  }, {
733
757
  key: "findCustomerById",
734
758
  value: function findCustomerById() {
@@ -1739,6 +1763,44 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1739
1763
  value: function waitForOrderCustomerPromotionRefresh() {
1740
1764
  return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
1741
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;
1803
+ }
1742
1804
 
1743
1805
  /**
1744
1806
  * 获取客户分页信息
@@ -1780,29 +1842,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1780
1842
  }, {
1781
1843
  key: "changeCustomerPage",
1782
1844
  value: (function () {
1783
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(page, pageSize) {
1845
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(page, pageSize) {
1784
1846
  var _result4;
1785
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1786
- while (1) switch (_context23.prev = _context23.next) {
1847
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1848
+ while (1) switch (_context24.prev = _context24.next) {
1787
1849
  case 0:
1788
- _context23.prev = 0;
1789
- _context23.next = 3;
1850
+ _context24.prev = 0;
1851
+ _context24.next = 3;
1790
1852
  return this.store.customer.changeCustomerPage(page, pageSize);
1791
1853
  case 3:
1792
- _result4 = _context23.sent;
1793
- return _context23.abrupt("return", _result4);
1854
+ _result4 = _context24.sent;
1855
+ return _context24.abrupt("return", _result4);
1794
1856
  case 7:
1795
- _context23.prev = 7;
1796
- _context23.t0 = _context23["catch"](0);
1797
- console.error('Failed to change customer page:', _context23.t0);
1798
- 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;
1799
1861
  case 11:
1800
1862
  case "end":
1801
- return _context23.stop();
1863
+ return _context24.stop();
1802
1864
  }
1803
- }, _callee23, this, [[0, 7]]);
1865
+ }, _callee24, this, [[0, 7]]);
1804
1866
  }));
1805
- function changeCustomerPage(_x16, _x17) {
1867
+ function changeCustomerPage(_x17, _x18) {
1806
1868
  return _changeCustomerPage.apply(this, arguments);
1807
1869
  }
1808
1870
  return changeCustomerPage;
@@ -1815,28 +1877,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1815
1877
  }, {
1816
1878
  key: "loadMoreCustomers",
1817
1879
  value: (function () {
1818
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1880
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1819
1881
  var _result5;
1820
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1821
- while (1) switch (_context24.prev = _context24.next) {
1882
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1883
+ while (1) switch (_context25.prev = _context25.next) {
1822
1884
  case 0:
1823
- _context24.prev = 0;
1824
- _context24.next = 3;
1885
+ _context25.prev = 0;
1886
+ _context25.next = 3;
1825
1887
  return this.store.customer.loadMoreCustomers();
1826
1888
  case 3:
1827
- _result5 = _context24.sent;
1889
+ _result5 = _context25.sent;
1828
1890
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1829
- return _context24.abrupt("return", _result5);
1891
+ return _context25.abrupt("return", _result5);
1830
1892
  case 8:
1831
- _context24.prev = 8;
1832
- _context24.t0 = _context24["catch"](0);
1833
- console.error('Failed to load more customers:', _context24.t0);
1834
- 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;
1835
1897
  case 12:
1836
1898
  case "end":
1837
- return _context24.stop();
1899
+ return _context25.stop();
1838
1900
  }
1839
- }, _callee24, this, [[0, 8]]);
1901
+ }, _callee25, this, [[0, 8]]);
1840
1902
  }));
1841
1903
  function loadMoreCustomers() {
1842
1904
  return _loadMoreCustomers.apply(this, arguments);
@@ -1852,31 +1914,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1852
1914
  }, {
1853
1915
  key: "resetAndLoadCustomers",
1854
1916
  value: (function () {
1855
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1917
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1856
1918
  var params,
1857
1919
  _result6,
1858
- _args25 = arguments;
1859
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1860
- 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) {
1861
1923
  case 0:
1862
- params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1863
- _context25.prev = 1;
1864
- _context25.next = 4;
1924
+ params = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
1925
+ _context26.prev = 1;
1926
+ _context26.next = 4;
1865
1927
  return this.store.customer.resetAndLoadCustomers(params);
1866
1928
  case 4:
1867
- _result6 = _context25.sent;
1929
+ _result6 = _context26.sent;
1868
1930
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1869
- return _context25.abrupt("return", _result6);
1931
+ return _context26.abrupt("return", _result6);
1870
1932
  case 9:
1871
- _context25.prev = 9;
1872
- _context25.t0 = _context25["catch"](1);
1873
- console.error('Failed to reset and load customers:', _context25.t0);
1874
- 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;
1875
1937
  case 13:
1876
1938
  case "end":
1877
- return _context25.stop();
1939
+ return _context26.stop();
1878
1940
  }
1879
- }, _callee25, this, [[1, 9]]);
1941
+ }, _callee26, this, [[1, 9]]);
1880
1942
  }));
1881
1943
  function resetAndLoadCustomers() {
1882
1944
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -2037,16 +2099,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2037
2099
  }, {
2038
2100
  key: "getOtherParams",
2039
2101
  value: (function () {
2040
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
2041
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2042
- 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) {
2043
2105
  case 0:
2044
- return _context26.abrupt("return", this.otherParams);
2106
+ return _context27.abrupt("return", this.otherParams);
2045
2107
  case 1:
2046
2108
  case "end":
2047
- return _context26.stop();
2109
+ return _context27.stop();
2048
2110
  }
2049
- }, _callee26, this);
2111
+ }, _callee27, this);
2050
2112
  }));
2051
2113
  function getOtherParams() {
2052
2114
  return _getOtherParams.apply(this, arguments);
@@ -2365,18 +2427,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2365
2427
  }, {
2366
2428
  key: "updateProductInOrder",
2367
2429
  value: (function () {
2368
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2369
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2370
- 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) {
2371
2433
  case 0:
2372
- return _context27.abrupt("return", this.updateOrderProduct(params));
2434
+ return _context28.abrupt("return", this.updateOrderProduct(params));
2373
2435
  case 1:
2374
2436
  case "end":
2375
- return _context27.stop();
2437
+ return _context28.stop();
2376
2438
  }
2377
- }, _callee27, this);
2439
+ }, _callee28, this);
2378
2440
  }));
2379
- function updateProductInOrder(_x18) {
2441
+ function updateProductInOrder(_x19) {
2380
2442
  return _updateProductInOrder.apply(this, arguments);
2381
2443
  }
2382
2444
  return updateProductInOrder;
@@ -2398,47 +2460,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2398
2460
  }, {
2399
2461
  key: "handleGlobalScanCode",
2400
2462
  value: (function () {
2401
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(code, bridge) {
2463
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(code, bridge) {
2402
2464
  var _this7 = this;
2403
2465
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2404
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2405
- while (1) switch (_context28.prev = _context28.next) {
2466
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2467
+ while (1) switch (_context29.prev = _context29.next) {
2406
2468
  case 0:
2407
2469
  trimmed = typeof code === 'string' ? code.trim() : '';
2408
2470
  if (trimmed) {
2409
- _context28.next = 4;
2471
+ _context29.next = 4;
2410
2472
  break;
2411
2473
  }
2412
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');
2413
- return _context28.abrupt("return", {
2475
+ return _context29.abrupt("return", {
2414
2476
  status: 'failed',
2415
2477
  reason: 'empty_code'
2416
2478
  });
2417
2479
  case 4:
2418
- _context28.prev = 4;
2480
+ _context29.prev = 4;
2419
2481
  localSearch = function localSearch(v) {
2420
2482
  return _this7.store.products.findProductsByCodeOrBarcode(v);
2421
2483
  };
2422
2484
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
2423
- _context28.next = 9;
2485
+ _context29.next = 9;
2424
2486
  return scanCallback({
2425
2487
  type: 'nativeScanner',
2426
2488
  value: trimmed
2427
2489
  });
2428
2490
  case 9:
2429
- raw = _context28.sent;
2491
+ raw = _context29.sent;
2430
2492
  formatted = formatGlobalScanResult(raw, trimmed);
2431
2493
  if (formatted) {
2432
- _context28.next = 14;
2494
+ _context29.next = 14;
2433
2495
  break;
2434
2496
  }
2435
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');
2436
- return _context28.abrupt("return", {
2498
+ return _context29.abrupt("return", {
2437
2499
  status: 'failed',
2438
2500
  reason: 'not_found'
2439
2501
  });
2440
2502
  case 14:
2441
- _context28.next = 16;
2503
+ _context29.next = 16;
2442
2504
  return applyGlobalScan({
2443
2505
  setOrderCustomer: function setOrderCustomer(customer) {
2444
2506
  return _this7.setOrderCustomer(customer);
@@ -2473,25 +2535,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2473
2535
  }
2474
2536
  }, formatted, bridge);
2475
2537
  case 16:
2476
- _result7 = _context28.sent;
2538
+ _result7 = _context29.sent;
2477
2539
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2478
- return _context28.abrupt("return", _result7);
2540
+ return _context29.abrupt("return", _result7);
2479
2541
  case 21:
2480
- _context28.prev = 21;
2481
- _context28.t0 = _context28["catch"](4);
2482
- 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);
2483
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');
2484
- return _context28.abrupt("return", {
2546
+ return _context29.abrupt("return", {
2485
2547
  status: 'failed',
2486
2548
  reason: 'not_found'
2487
2549
  });
2488
2550
  case 26:
2489
2551
  case "end":
2490
- return _context28.stop();
2552
+ return _context29.stop();
2491
2553
  }
2492
- }, _callee28, this, [[4, 21]]);
2554
+ }, _callee29, this, [[4, 21]]);
2493
2555
  }));
2494
- function handleGlobalScanCode(_x19, _x20) {
2556
+ function handleGlobalScanCode(_x20, _x21) {
2495
2557
  return _handleGlobalScanCode.apply(this, arguments);
2496
2558
  }
2497
2559
  return handleGlobalScanCode;
@@ -2573,11 +2635,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2573
2635
  }, {
2574
2636
  key: "addAddTimeProductToBooking",
2575
2637
  value: (function () {
2576
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(input) {
2577
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2578
- 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) {
2579
2641
  case 0:
2580
- return _context29.abrupt("return", this.addAddTimeProductsToBooking({
2642
+ return _context30.abrupt("return", this.addAddTimeProductsToBooking({
2581
2643
  booking: input.booking,
2582
2644
  products: [input],
2583
2645
  coveredMinutes: input.coveredMinutes,
@@ -2585,11 +2647,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2585
2647
  }));
2586
2648
  case 1:
2587
2649
  case "end":
2588
- return _context29.stop();
2650
+ return _context30.stop();
2589
2651
  }
2590
- }, _callee29, this);
2652
+ }, _callee30, this);
2591
2653
  }));
2592
- function addAddTimeProductToBooking(_x21) {
2654
+ function addAddTimeProductToBooking(_x22) {
2593
2655
  return _addAddTimeProductToBooking.apply(this, arguments);
2594
2656
  }
2595
2657
  return addAddTimeProductToBooking;
@@ -2607,16 +2669,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2607
2669
  }, {
2608
2670
  key: "addAddTimeProductsToBooking",
2609
2671
  value: (function () {
2610
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(input) {
2672
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(input) {
2611
2673
  var _this8 = this,
2612
2674
  _input$bookingPatch;
2613
2675
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
2614
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2615
- while (1) switch (_context30.prev = _context30.next) {
2676
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2677
+ while (1) switch (_context31.prev = _context31.next) {
2616
2678
  case 0:
2617
2679
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
2618
2680
  if (bookingUid) {
2619
- _context30.next = 3;
2681
+ _context31.next = 3;
2620
2682
  break;
2621
2683
  }
2622
2684
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
@@ -2627,7 +2689,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2627
2689
  };
2628
2690
  });
2629
2691
  if (this.store.order) {
2630
- _context30.next = 6;
2692
+ _context31.next = 6;
2631
2693
  break;
2632
2694
  }
2633
2695
  throw new Error('order 模块未初始化');
@@ -2641,58 +2703,55 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2641
2703
  });
2642
2704
  }
2643
2705
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
2644
- _context30.next = 11;
2706
+ _context31.next = 11;
2645
2707
  break;
2646
2708
  }
2647
- return _context30.abrupt("return", this.store.order.addProductsToOrder(orderLines, {
2648
- skipEditDiscountConfigRefresh: true,
2649
- skipDiscountRecalculation: true
2650
- }));
2709
+ return _context31.abrupt("return", this.store.order.addProductsToOrder(orderLines));
2651
2710
  case 11:
2652
2711
  result = [];
2653
2712
  _iterator2 = _createForOfIteratorHelper(orderLines);
2654
- _context30.prev = 13;
2713
+ _context31.prev = 13;
2655
2714
  _iterator2.s();
2656
2715
  case 15:
2657
2716
  if ((_step2 = _iterator2.n()).done) {
2658
- _context30.next = 29;
2717
+ _context31.next = 29;
2659
2718
  break;
2660
2719
  }
2661
2720
  line = _step2.value;
2662
- _context30.t0 = result.splice;
2663
- _context30.t1 = result;
2664
- _context30.t2 = [0, result.length];
2665
- _context30.t3 = _toConsumableArray;
2666
- _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;
2667
2726
  return this.addProductToOrder(line.product);
2668
2727
  case 23:
2669
- _context30.t4 = _context30.sent;
2670
- _context30.t5 = (0, _context30.t3)(_context30.t4);
2671
- _context30.t6 = _context30.t2.concat.call(_context30.t2, _context30.t5);
2672
- _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);
2673
2732
  case 27:
2674
- _context30.next = 15;
2733
+ _context31.next = 15;
2675
2734
  break;
2676
2735
  case 29:
2677
- _context30.next = 34;
2736
+ _context31.next = 34;
2678
2737
  break;
2679
2738
  case 31:
2680
- _context30.prev = 31;
2681
- _context30.t7 = _context30["catch"](13);
2682
- _iterator2.e(_context30.t7);
2739
+ _context31.prev = 31;
2740
+ _context31.t7 = _context31["catch"](13);
2741
+ _iterator2.e(_context31.t7);
2683
2742
  case 34:
2684
- _context30.prev = 34;
2743
+ _context31.prev = 34;
2685
2744
  _iterator2.f();
2686
- return _context30.finish(34);
2745
+ return _context31.finish(34);
2687
2746
  case 37:
2688
- return _context30.abrupt("return", result);
2747
+ return _context31.abrupt("return", result);
2689
2748
  case 38:
2690
2749
  case "end":
2691
- return _context30.stop();
2750
+ return _context31.stop();
2692
2751
  }
2693
- }, _callee30, this, [[13, 31, 34, 37]]);
2752
+ }, _callee31, this, [[13, 31, 34, 37]]);
2694
2753
  }));
2695
- function addAddTimeProductsToBooking(_x22) {
2754
+ function addAddTimeProductsToBooking(_x23) {
2696
2755
  return _addAddTimeProductsToBooking.apply(this, arguments);
2697
2756
  }
2698
2757
  return addAddTimeProductsToBooking;
@@ -2700,33 +2759,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2700
2759
  }, {
2701
2760
  key: "setOtherParams",
2702
2761
  value: function () {
2703
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(params) {
2762
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2704
2763
  var _ref19,
2705
2764
  _ref19$cover,
2706
2765
  cover,
2707
- _args31 = arguments;
2708
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2709
- 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) {
2710
2769
  case 0:
2711
- _ref19 = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {}, _ref19$cover = _ref19.cover, cover = _ref19$cover === void 0 ? false : _ref19$cover;
2712
- _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;
2713
2772
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
2714
2773
  cover: cover
2715
2774
  });
2716
2775
  case 3:
2717
2776
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
2718
- _context31.next = 6;
2777
+ _context32.next = 6;
2719
2778
  break;
2720
2779
  }
2721
- _context31.next = 6;
2780
+ _context32.next = 6;
2722
2781
  return this.configureIdGeneratorFromOpenData();
2723
2782
  case 6:
2724
2783
  case "end":
2725
- return _context31.stop();
2784
+ return _context32.stop();
2726
2785
  }
2727
- }, _callee31, this);
2786
+ }, _callee32, this);
2728
2787
  }));
2729
- function setOtherParams(_x23) {
2788
+ function setOtherParams(_x24) {
2730
2789
  return _setOtherParams.apply(this, arguments);
2731
2790
  }
2732
2791
  return setOtherParams;
@@ -2743,15 +2802,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2743
2802
  }, {
2744
2803
  key: "handlePrintWristband",
2745
2804
  value: function () {
2746
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
2805
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2747
2806
  var _this$getOrderIdentit;
2748
2807
  var deviceTask, deviceId, idempotencyKey;
2749
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2750
- while (1) switch (_context32.prev = _context32.next) {
2808
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2809
+ while (1) switch (_context33.prev = _context33.next) {
2751
2810
  case 0:
2752
2811
  deviceTask = this.getDeviceTaskPlugin();
2753
2812
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
2754
- _context32.next = 4;
2813
+ _context33.next = 4;
2755
2814
  break;
2756
2815
  }
2757
2816
  this.logger.addLog({
@@ -2761,7 +2820,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2761
2820
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2762
2821
  }
2763
2822
  });
2764
- return _context32.abrupt("return");
2823
+ return _context33.abrupt("return");
2765
2824
  case 4:
2766
2825
  this.logger.addLog({
2767
2826
  type: 'info',
@@ -2770,10 +2829,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2770
2829
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
2771
2830
  }
2772
2831
  });
2773
- _context32.next = 7;
2832
+ _context33.next = 7;
2774
2833
  return this.getShortNumberOrDeviceId();
2775
2834
  case 7:
2776
- deviceId = _context32.sent;
2835
+ deviceId = _context33.sent;
2777
2836
  idempotencyKey = createUuidV4();
2778
2837
  deviceTask.dispatch({
2779
2838
  action: 'print_all',
@@ -2793,11 +2852,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2793
2852
  });
2794
2853
  case 10:
2795
2854
  case "end":
2796
- return _context32.stop();
2855
+ return _context33.stop();
2797
2856
  }
2798
- }, _callee32, this);
2857
+ }, _callee33, this);
2799
2858
  }));
2800
- function handlePrintWristband(_x24) {
2859
+ function handlePrintWristband(_x25) {
2801
2860
  return _handlePrintWristband.apply(this, arguments);
2802
2861
  }
2803
2862
  return handlePrintWristband;
@@ -2805,11 +2864,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2805
2864
  }, {
2806
2865
  key: "handleRedeem",
2807
2866
  value: function () {
2808
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(params) {
2867
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
2809
2868
  var _this$store$order5, _this$store$order5$ge, _this$store$order6, _ref20, _tempOrder$order_id2;
2810
2869
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, identity, externalSaleNumber, orderId, orderLookup;
2811
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2812
- while (1) switch (_context33.prev = _context33.next) {
2870
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2871
+ while (1) switch (_context34.prev = _context34.next) {
2813
2872
  case 0:
2814
2873
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
2815
2874
  status = params.is_checkin ? 'used' : 'unused';
@@ -2833,20 +2892,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2833
2892
  });
2834
2893
  });
2835
2894
  if (!(tempOrder && hasUpdatedVoucher)) {
2836
- _context33.next = 11;
2895
+ _context34.next = 11;
2837
2896
  break;
2838
2897
  }
2839
- _context33.next = 11;
2898
+ _context34.next = 11;
2840
2899
  return this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
2841
2900
  vouchers: nextVouchers
2842
2901
  }));
2843
2902
  case 11:
2844
2903
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
2845
2904
  if (!(voucherIds.length === 0)) {
2846
- _context33.next = 14;
2905
+ _context34.next = 14;
2847
2906
  break;
2848
2907
  }
2849
- return _context33.abrupt("return", {
2908
+ return _context34.abrupt("return", {
2850
2909
  code: 200,
2851
2910
  status: true,
2852
2911
  message: '',
@@ -2857,7 +2916,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2857
2916
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
2858
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;
2859
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;
2860
- return _context33.abrupt("return", this.request.post('/machinecode/batch', {
2919
+ return _context34.abrupt("return", this.request.post('/machinecode/batch', {
2861
2920
  ids: voucherIds,
2862
2921
  status: status,
2863
2922
  order_lookup: orderLookup,
@@ -2868,11 +2927,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2868
2927
  }));
2869
2928
  case 19:
2870
2929
  case "end":
2871
- return _context33.stop();
2930
+ return _context34.stop();
2872
2931
  }
2873
- }, _callee33, this);
2932
+ }, _callee34, this);
2874
2933
  }));
2875
- function handleRedeem(_x25) {
2934
+ function handleRedeem(_x26) {
2876
2935
  return _handleRedeem.apply(this, arguments);
2877
2936
  }
2878
2937
  return handleRedeem;
@@ -2884,12 +2943,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2884
2943
  }, {
2885
2944
  key: "destroy",
2886
2945
  value: (function () {
2887
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2946
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2888
2947
  var _this$scan;
2889
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2890
- while (1) switch (_context34.prev = _context34.next) {
2948
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2949
+ while (1) switch (_context35.prev = _context35.next) {
2891
2950
  case 0:
2892
- _context34.next = 2;
2951
+ _context35.next = 2;
2893
2952
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2894
2953
  case 2:
2895
2954
  try {
@@ -2900,9 +2959,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2900
2959
  scanCache.clear();
2901
2960
  case 4:
2902
2961
  case "end":
2903
- return _context34.stop();
2962
+ return _context35.stop();
2904
2963
  }
2905
- }, _callee34, this);
2964
+ }, _callee35, this);
2906
2965
  }));
2907
2966
  function destroy() {
2908
2967
  return _destroy.apply(this, arguments);