@pisell/pisellos 2.2.230 → 2.2.232

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 (34) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Order/index.js +44 -29
  3. package/dist/modules/Order/types.d.ts +14 -2
  4. package/dist/modules/Order/types.js +8 -1
  5. package/dist/modules/ProductList/index.d.ts +9 -12
  6. package/dist/modules/ProductList/index.js +122 -59
  7. package/dist/modules/ProductList/types.d.ts +14 -0
  8. package/dist/server/index.d.ts +21 -0
  9. package/dist/server/index.js +154 -34
  10. package/dist/server/utils/small-ticket.js +113 -29
  11. package/dist/solution/BookingByStep/index.d.ts +1 -1
  12. package/dist/solution/BookingTicket/index.d.ts +9 -1
  13. package/dist/solution/BookingTicket/index.js +198 -158
  14. package/dist/solution/BookingTicket/types.d.ts +4 -0
  15. package/dist/solution/BookingTicket/utils/cartView.js +20 -6
  16. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +189 -0
  17. package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +429 -0
  18. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  19. package/lib/modules/Order/index.js +18 -5
  20. package/lib/modules/Order/types.d.ts +14 -2
  21. package/lib/modules/ProductList/index.d.ts +9 -12
  22. package/lib/modules/ProductList/index.js +32 -4
  23. package/lib/modules/ProductList/types.d.ts +14 -0
  24. package/lib/server/index.d.ts +21 -0
  25. package/lib/server/index.js +107 -9
  26. package/lib/server/utils/small-ticket.js +78 -1
  27. package/lib/solution/BookingByStep/index.d.ts +1 -1
  28. package/lib/solution/BookingTicket/index.d.ts +9 -1
  29. package/lib/solution/BookingTicket/index.js +20 -1
  30. package/lib/solution/BookingTicket/types.d.ts +4 -0
  31. package/lib/solution/BookingTicket/utils/cartView.js +14 -7
  32. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +189 -0
  33. package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +241 -0
  34. package/package.json +1 -1
@@ -46,6 +46,7 @@ import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils
46
46
  import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
47
47
  import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
48
48
  import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
49
+ import { resolveBestAddTimePlan as _resolveBestAddTimePlan } from "./utils/resolveBestAddTimePlan";
49
50
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
50
51
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
51
52
  function withProductOptionString(cacheItem) {
@@ -97,7 +98,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
97
98
  }, {
98
99
  key: "getSubmitOrderSalesChannel",
99
100
  value: function getSubmitOrderSalesChannel() {
100
- return 'pos';
101
+ var _this$core, _this$core$getChannel;
102
+ var channel = (_this$core = this.core) === null || _this$core === void 0 || (_this$core = _this$core.context) === null || _this$core === void 0 || (_this$core$getChannel = _this$core.getChannel) === null || _this$core$getChannel === void 0 ? void 0 : _this$core$getChannel.call(_this$core);
103
+ return !channel || channel === 'system' ? 'pos' : channel;
101
104
  }
102
105
 
103
106
  /**
@@ -375,9 +378,10 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
375
378
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
376
379
  while (1) switch (_context5.prev = _context5.next) {
377
380
  case 0:
378
- _context5.next = 2;
381
+ debugger;
382
+ _context5.next = 3;
379
383
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
380
- case 2:
384
+ case 3:
381
385
  sales = _context5.sent;
382
386
  customerModule = this.store.customer;
383
387
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
@@ -406,7 +410,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
406
410
  // await this.store.order.saveDraft();
407
411
  }
408
412
  return _context5.abrupt("return", sales);
409
- case 11:
413
+ case 12:
410
414
  case "end":
411
415
  return _context5.stop();
412
416
  }
@@ -884,6 +888,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
884
888
  }
885
889
  return loadProducts;
886
890
  }()
891
+ /**
892
+ * 获取加时商品列表。
893
+ *
894
+ * @example
895
+ * const products = await bookingTicket.getAddTimeProducts({ schedule_date: '2026-06-16' });
896
+ */
897
+ )
898
+ }, {
899
+ key: "getAddTimeProducts",
900
+ value: (function () {
901
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
902
+ var params,
903
+ _args13 = arguments;
904
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
905
+ while (1) switch (_context13.prev = _context13.next) {
906
+ case 0:
907
+ params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
908
+ return _context13.abrupt("return", this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
909
+ cacheId: this.cacheId
910
+ })));
911
+ case 2:
912
+ case "end":
913
+ return _context13.stop();
914
+ }
915
+ }, _callee13, this);
916
+ }));
917
+ function getAddTimeProducts() {
918
+ return _getAddTimeProducts.apply(this, arguments);
919
+ }
920
+ return getAddTimeProducts;
921
+ }()
887
922
  /**
888
923
  * 只读查询单商品详情:走 ProductList 报价查询,但不写 productCatalog、
889
924
  * 不 emit onProductsLoaded、不修改 BookingDate。
@@ -902,14 +937,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
902
937
  }, {
903
938
  key: "queryProductDetail",
904
939
  value: (function () {
905
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params, options) {
940
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params, options) {
906
941
  var product_id, queryParams, _result2, list;
907
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
908
- while (1) switch (_context13.prev = _context13.next) {
942
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
943
+ while (1) switch (_context14.prev = _context14.next) {
909
944
  case 0:
910
945
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
911
- _context13.prev = 1;
912
- _context13.next = 4;
946
+ _context14.prev = 1;
947
+ _context14.next = 4;
913
948
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
914
949
  with_count: ['bundleGroup', 'optionGroup'],
915
950
  with_schedule: 1
@@ -918,21 +953,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
918
953
  cacheId: this.cacheId
919
954
  }), options);
920
955
  case 4:
921
- _result2 = _context13.sent;
956
+ _result2 = _context14.sent;
922
957
  list = Array.isArray(_result2) ? _result2 : [];
923
- return _context13.abrupt("return", list.find(function (product) {
958
+ return _context14.abrupt("return", list.find(function (product) {
924
959
  return Number(product.id) === Number(product_id);
925
960
  }));
926
961
  case 9:
927
- _context13.prev = 9;
928
- _context13.t0 = _context13["catch"](1);
929
- console.error('Failed to query product detail:', _context13.t0);
930
- throw _context13.t0;
962
+ _context14.prev = 9;
963
+ _context14.t0 = _context14["catch"](1);
964
+ console.error('Failed to query product detail:', _context14.t0);
965
+ throw _context14.t0;
931
966
  case 13:
932
967
  case "end":
933
- return _context13.stop();
968
+ return _context14.stop();
934
969
  }
935
- }, _callee13, this, [[1, 9]]);
970
+ }, _callee14, this, [[1, 9]]);
936
971
  }));
937
972
  function queryProductDetail(_x9, _x10) {
938
973
  return _queryProductDetail.apply(this, arguments);
@@ -947,26 +982,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
947
982
  }, {
948
983
  key: "loadProductDetail",
949
984
  value: (function () {
950
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params, options) {
985
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params, options) {
951
986
  var product_id, queryParams, products;
952
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
953
- while (1) switch (_context14.prev = _context14.next) {
987
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
988
+ while (1) switch (_context15.prev = _context15.next) {
954
989
  case 0:
955
990
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
956
- _context14.next = 3;
991
+ _context15.next = 3;
957
992
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
958
993
  product_ids: [product_id]
959
994
  }), options);
960
995
  case 3:
961
- products = _context14.sent;
962
- return _context14.abrupt("return", products.find(function (product) {
996
+ products = _context15.sent;
997
+ return _context15.abrupt("return", products.find(function (product) {
963
998
  return Number(product.id) === Number(product_id);
964
999
  }));
965
1000
  case 5:
966
1001
  case "end":
967
- return _context14.stop();
1002
+ return _context15.stop();
968
1003
  }
969
- }, _callee14, this);
1004
+ }, _callee15, this);
970
1005
  }));
971
1006
  function loadProductDetail(_x11, _x12) {
972
1007
  return _loadProductDetail.apply(this, arguments);
@@ -1001,16 +1036,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1001
1036
  }, {
1002
1037
  key: "getProducts",
1003
1038
  value: (function () {
1004
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1005
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1006
- while (1) switch (_context15.prev = _context15.next) {
1039
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1040
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1041
+ while (1) switch (_context16.prev = _context16.next) {
1007
1042
  case 0:
1008
- return _context15.abrupt("return", this.store.products.getProducts());
1043
+ return _context16.abrupt("return", this.store.products.getProducts());
1009
1044
  case 1:
1010
1045
  case "end":
1011
- return _context15.stop();
1046
+ return _context16.stop();
1012
1047
  }
1013
- }, _callee15, this);
1048
+ }, _callee16, this);
1014
1049
  }));
1015
1050
  function getProducts() {
1016
1051
  return _getProducts.apply(this, arguments);
@@ -1063,16 +1098,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1063
1098
  }, {
1064
1099
  key: "getProductByIds",
1065
1100
  value: (function () {
1066
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(ids) {
1067
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1068
- while (1) switch (_context16.prev = _context16.next) {
1101
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(ids) {
1102
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1103
+ while (1) switch (_context17.prev = _context17.next) {
1069
1104
  case 0:
1070
- return _context16.abrupt("return", this.store.products.getProductByIds(ids));
1105
+ return _context17.abrupt("return", this.store.products.getProductByIds(ids));
1071
1106
  case 1:
1072
1107
  case "end":
1073
- return _context16.stop();
1108
+ return _context17.stop();
1074
1109
  }
1075
- }, _callee16, this);
1110
+ }, _callee17, this);
1076
1111
  }));
1077
1112
  function getProductByIds(_x13) {
1078
1113
  return _getProductByIds.apply(this, arguments);
@@ -1088,25 +1123,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1088
1123
  }, {
1089
1124
  key: "getScheduleTimePoints",
1090
1125
  value: (function () {
1091
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1126
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(params) {
1092
1127
  var result;
1093
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1094
- while (1) switch (_context17.prev = _context17.next) {
1128
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1129
+ while (1) switch (_context18.prev = _context18.next) {
1095
1130
  case 0:
1096
- _context17.next = 2;
1131
+ _context18.next = 2;
1097
1132
  return this.request.post('/menu/schedule-time-points', {
1098
1133
  menu_list_ids: params.menu_list_ids
1099
1134
  }, {
1100
1135
  osServer: true
1101
1136
  });
1102
1137
  case 2:
1103
- result = _context17.sent;
1104
- return _context17.abrupt("return", result.data || []);
1138
+ result = _context18.sent;
1139
+ return _context18.abrupt("return", result.data || []);
1105
1140
  case 4:
1106
1141
  case "end":
1107
- return _context17.stop();
1142
+ return _context18.stop();
1108
1143
  }
1109
- }, _callee17, this);
1144
+ }, _callee18, this);
1110
1145
  }));
1111
1146
  function getScheduleTimePoints(_x14) {
1112
1147
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1122,30 +1157,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1122
1157
  }, {
1123
1158
  key: "getCustomerList",
1124
1159
  value: (function () {
1125
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1160
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1126
1161
  var params,
1127
1162
  _result3,
1128
- _args18 = arguments;
1129
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1130
- while (1) switch (_context18.prev = _context18.next) {
1163
+ _args19 = arguments;
1164
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1165
+ while (1) switch (_context19.prev = _context19.next) {
1131
1166
  case 0:
1132
- params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1133
- _context18.prev = 1;
1134
- _context18.next = 4;
1167
+ params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1168
+ _context19.prev = 1;
1169
+ _context19.next = 4;
1135
1170
  return this.store.customer.getCustomerList(params);
1136
1171
  case 4:
1137
- _result3 = _context18.sent;
1138
- return _context18.abrupt("return", _result3);
1172
+ _result3 = _context19.sent;
1173
+ return _context19.abrupt("return", _result3);
1139
1174
  case 8:
1140
- _context18.prev = 8;
1141
- _context18.t0 = _context18["catch"](1);
1142
- console.error('Failed to get customer list:', _context18.t0);
1143
- throw _context18.t0;
1175
+ _context19.prev = 8;
1176
+ _context19.t0 = _context19["catch"](1);
1177
+ console.error('Failed to get customer list:', _context19.t0);
1178
+ throw _context19.t0;
1144
1179
  case 12:
1145
1180
  case "end":
1146
- return _context18.stop();
1181
+ return _context19.stop();
1147
1182
  }
1148
- }, _callee18, this, [[1, 8]]);
1183
+ }, _callee19, this, [[1, 8]]);
1149
1184
  }));
1150
1185
  function getCustomerList() {
1151
1186
  return _getCustomerList.apply(this, arguments);
@@ -1343,24 +1378,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1343
1378
  }, {
1344
1379
  key: "restoreOrder",
1345
1380
  value: (function () {
1346
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1381
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1347
1382
  var _this$store$customer;
1348
1383
  var tempOrder;
1349
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1350
- while (1) switch (_context19.prev = _context19.next) {
1384
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1385
+ while (1) switch (_context20.prev = _context20.next) {
1351
1386
  case 0:
1352
- _context19.next = 2;
1387
+ _context20.next = 2;
1353
1388
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1354
1389
  case 2:
1355
- tempOrder = _context19.sent;
1390
+ tempOrder = _context20.sent;
1356
1391
  this.clearOrderCustomer();
1357
1392
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1358
- return _context19.abrupt("return", tempOrder);
1393
+ return _context20.abrupt("return", tempOrder);
1359
1394
  case 6:
1360
1395
  case "end":
1361
- return _context19.stop();
1396
+ return _context20.stop();
1362
1397
  }
1363
- }, _callee19, this);
1398
+ }, _callee20, this);
1364
1399
  }));
1365
1400
  function restoreOrder() {
1366
1401
  return _restoreOrder.apply(this, arguments);
@@ -1386,36 +1421,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1386
1421
  return;
1387
1422
  }
1388
1423
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1389
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1424
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1390
1425
  var currentCustomer;
1391
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1392
- while (1) switch (_context20.prev = _context20.next) {
1426
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1427
+ while (1) switch (_context21.prev = _context21.next) {
1393
1428
  case 0:
1394
1429
  if (!previousRefresh) {
1395
- _context20.next = 3;
1430
+ _context21.next = 3;
1396
1431
  break;
1397
1432
  }
1398
- _context20.next = 3;
1433
+ _context21.next = 3;
1399
1434
  return previousRefresh.catch(function () {
1400
1435
  return undefined;
1401
1436
  });
1402
1437
  case 3:
1403
1438
  currentCustomer = _this4.store.order.getOrderCustomer();
1404
1439
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1405
- _context20.next = 6;
1440
+ _context21.next = 6;
1406
1441
  break;
1407
1442
  }
1408
- return _context20.abrupt("return");
1443
+ return _context21.abrupt("return");
1409
1444
  case 6:
1410
- _context20.next = 8;
1445
+ _context21.next = 8;
1411
1446
  return _this4.loadDiscountConfig({
1412
1447
  customerId: customerId
1413
1448
  });
1414
1449
  case 8:
1415
1450
  case "end":
1416
- return _context20.stop();
1451
+ return _context21.stop();
1417
1452
  }
1418
- }, _callee20);
1453
+ }, _callee21);
1419
1454
  }))();
1420
1455
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1421
1456
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1468,27 +1503,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1468
1503
  }, {
1469
1504
  key: "changeCustomerPage",
1470
1505
  value: (function () {
1471
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(page, pageSize) {
1506
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(page, pageSize) {
1472
1507
  var _result4;
1473
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1474
- while (1) switch (_context21.prev = _context21.next) {
1508
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1509
+ while (1) switch (_context22.prev = _context22.next) {
1475
1510
  case 0:
1476
- _context21.prev = 0;
1477
- _context21.next = 3;
1511
+ _context22.prev = 0;
1512
+ _context22.next = 3;
1478
1513
  return this.store.customer.changeCustomerPage(page, pageSize);
1479
1514
  case 3:
1480
- _result4 = _context21.sent;
1481
- return _context21.abrupt("return", _result4);
1515
+ _result4 = _context22.sent;
1516
+ return _context22.abrupt("return", _result4);
1482
1517
  case 7:
1483
- _context21.prev = 7;
1484
- _context21.t0 = _context21["catch"](0);
1485
- console.error('Failed to change customer page:', _context21.t0);
1486
- throw _context21.t0;
1518
+ _context22.prev = 7;
1519
+ _context22.t0 = _context22["catch"](0);
1520
+ console.error('Failed to change customer page:', _context22.t0);
1521
+ throw _context22.t0;
1487
1522
  case 11:
1488
1523
  case "end":
1489
- return _context21.stop();
1524
+ return _context22.stop();
1490
1525
  }
1491
- }, _callee21, this, [[0, 7]]);
1526
+ }, _callee22, this, [[0, 7]]);
1492
1527
  }));
1493
1528
  function changeCustomerPage(_x15, _x16) {
1494
1529
  return _changeCustomerPage.apply(this, arguments);
@@ -1503,28 +1538,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1503
1538
  }, {
1504
1539
  key: "loadMoreCustomers",
1505
1540
  value: (function () {
1506
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1541
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1507
1542
  var _result5;
1508
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1509
- while (1) switch (_context22.prev = _context22.next) {
1543
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1544
+ while (1) switch (_context23.prev = _context23.next) {
1510
1545
  case 0:
1511
- _context22.prev = 0;
1512
- _context22.next = 3;
1546
+ _context23.prev = 0;
1547
+ _context23.next = 3;
1513
1548
  return this.store.customer.loadMoreCustomers();
1514
1549
  case 3:
1515
- _result5 = _context22.sent;
1550
+ _result5 = _context23.sent;
1516
1551
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1517
- return _context22.abrupt("return", _result5);
1552
+ return _context23.abrupt("return", _result5);
1518
1553
  case 8:
1519
- _context22.prev = 8;
1520
- _context22.t0 = _context22["catch"](0);
1521
- console.error('Failed to load more customers:', _context22.t0);
1522
- throw _context22.t0;
1554
+ _context23.prev = 8;
1555
+ _context23.t0 = _context23["catch"](0);
1556
+ console.error('Failed to load more customers:', _context23.t0);
1557
+ throw _context23.t0;
1523
1558
  case 12:
1524
1559
  case "end":
1525
- return _context22.stop();
1560
+ return _context23.stop();
1526
1561
  }
1527
- }, _callee22, this, [[0, 8]]);
1562
+ }, _callee23, this, [[0, 8]]);
1528
1563
  }));
1529
1564
  function loadMoreCustomers() {
1530
1565
  return _loadMoreCustomers.apply(this, arguments);
@@ -1540,31 +1575,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1540
1575
  }, {
1541
1576
  key: "resetAndLoadCustomers",
1542
1577
  value: (function () {
1543
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
1578
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1544
1579
  var params,
1545
1580
  _result6,
1546
- _args23 = arguments;
1547
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1548
- while (1) switch (_context23.prev = _context23.next) {
1581
+ _args24 = arguments;
1582
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1583
+ while (1) switch (_context24.prev = _context24.next) {
1549
1584
  case 0:
1550
- params = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
1551
- _context23.prev = 1;
1552
- _context23.next = 4;
1585
+ params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
1586
+ _context24.prev = 1;
1587
+ _context24.next = 4;
1553
1588
  return this.store.customer.resetAndLoadCustomers(params);
1554
1589
  case 4:
1555
- _result6 = _context23.sent;
1590
+ _result6 = _context24.sent;
1556
1591
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1557
- return _context23.abrupt("return", _result6);
1592
+ return _context24.abrupt("return", _result6);
1558
1593
  case 9:
1559
- _context23.prev = 9;
1560
- _context23.t0 = _context23["catch"](1);
1561
- console.error('Failed to reset and load customers:', _context23.t0);
1562
- throw _context23.t0;
1594
+ _context24.prev = 9;
1595
+ _context24.t0 = _context24["catch"](1);
1596
+ console.error('Failed to reset and load customers:', _context24.t0);
1597
+ throw _context24.t0;
1563
1598
  case 13:
1564
1599
  case "end":
1565
- return _context23.stop();
1600
+ return _context24.stop();
1566
1601
  }
1567
- }, _callee23, this, [[1, 9]]);
1602
+ }, _callee24, this, [[1, 9]]);
1568
1603
  }));
1569
1604
  function resetAndLoadCustomers() {
1570
1605
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1725,16 +1760,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1725
1760
  }, {
1726
1761
  key: "getOtherParams",
1727
1762
  value: (function () {
1728
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1729
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1730
- while (1) switch (_context24.prev = _context24.next) {
1763
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1764
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1765
+ while (1) switch (_context25.prev = _context25.next) {
1731
1766
  case 0:
1732
- return _context24.abrupt("return", this.otherParams);
1767
+ return _context25.abrupt("return", this.otherParams);
1733
1768
  case 1:
1734
1769
  case "end":
1735
- return _context24.stop();
1770
+ return _context25.stop();
1736
1771
  }
1737
- }, _callee24, this);
1772
+ }, _callee25, this);
1738
1773
  }));
1739
1774
  function getOtherParams() {
1740
1775
  return _getOtherParams.apply(this, arguments);
@@ -2052,16 +2087,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2052
2087
  }, {
2053
2088
  key: "updateProductInOrder",
2054
2089
  value: (function () {
2055
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2056
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2057
- while (1) switch (_context25.prev = _context25.next) {
2090
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2091
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2092
+ while (1) switch (_context26.prev = _context26.next) {
2058
2093
  case 0:
2059
- return _context25.abrupt("return", this.updateOrderProduct(params));
2094
+ return _context26.abrupt("return", this.updateOrderProduct(params));
2060
2095
  case 1:
2061
2096
  case "end":
2062
- return _context25.stop();
2097
+ return _context26.stop();
2063
2098
  }
2064
- }, _callee25, this);
2099
+ }, _callee26, this);
2065
2100
  }));
2066
2101
  function updateProductInOrder(_x17) {
2067
2102
  return _updateProductInOrder.apply(this, arguments);
@@ -2085,47 +2120,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2085
2120
  }, {
2086
2121
  key: "handleGlobalScanCode",
2087
2122
  value: (function () {
2088
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(code, bridge) {
2123
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(code, bridge) {
2089
2124
  var _this6 = this;
2090
2125
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
2091
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2092
- while (1) switch (_context26.prev = _context26.next) {
2126
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2127
+ while (1) switch (_context27.prev = _context27.next) {
2093
2128
  case 0:
2094
2129
  trimmed = typeof code === 'string' ? code.trim() : '';
2095
2130
  if (trimmed) {
2096
- _context26.next = 4;
2131
+ _context27.next = 4;
2097
2132
  break;
2098
2133
  }
2099
2134
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2100
- return _context26.abrupt("return", {
2135
+ return _context27.abrupt("return", {
2101
2136
  status: 'failed',
2102
2137
  reason: 'empty_code'
2103
2138
  });
2104
2139
  case 4:
2105
- _context26.prev = 4;
2140
+ _context27.prev = 4;
2106
2141
  localSearch = function localSearch(v) {
2107
2142
  return _this6.store.products.findProductsByCodeOrBarcode(v);
2108
2143
  };
2109
2144
  scanCallback = handleGlobalScan(this.request, localSearch);
2110
- _context26.next = 9;
2145
+ _context27.next = 9;
2111
2146
  return scanCallback({
2112
2147
  type: 'nativeScanner',
2113
2148
  value: trimmed
2114
2149
  });
2115
2150
  case 9:
2116
- raw = _context26.sent;
2151
+ raw = _context27.sent;
2117
2152
  formatted = formatGlobalScanResult(raw, trimmed);
2118
2153
  if (formatted) {
2119
- _context26.next = 14;
2154
+ _context27.next = 14;
2120
2155
  break;
2121
2156
  }
2122
2157
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2123
- return _context26.abrupt("return", {
2158
+ return _context27.abrupt("return", {
2124
2159
  status: 'failed',
2125
2160
  reason: 'not_found'
2126
2161
  });
2127
2162
  case 14:
2128
- _context26.next = 16;
2163
+ _context27.next = 16;
2129
2164
  return applyGlobalScan({
2130
2165
  setOrderCustomer: function setOrderCustomer(customer) {
2131
2166
  return _this6.setOrderCustomer(customer);
@@ -2154,43 +2189,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2154
2189
  }
2155
2190
  }, formatted, bridge);
2156
2191
  case 16:
2157
- _result7 = _context26.sent;
2192
+ _result7 = _context27.sent;
2158
2193
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
2159
- return _context26.abrupt("return", _result7);
2194
+ return _context27.abrupt("return", _result7);
2160
2195
  case 21:
2161
- _context26.prev = 21;
2162
- _context26.t0 = _context26["catch"](4);
2163
- console.error('[BookingTicket] handleGlobalScanCode failed', _context26.t0);
2196
+ _context27.prev = 21;
2197
+ _context27.t0 = _context27["catch"](4);
2198
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context27.t0);
2164
2199
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2165
- return _context26.abrupt("return", {
2200
+ return _context27.abrupt("return", {
2166
2201
  status: 'failed',
2167
2202
  reason: 'not_found'
2168
2203
  });
2169
2204
  case 26:
2170
2205
  case "end":
2171
- return _context26.stop();
2206
+ return _context27.stop();
2172
2207
  }
2173
- }, _callee26, this, [[4, 21]]);
2208
+ }, _callee27, this, [[4, 21]]);
2174
2209
  }));
2175
2210
  function handleGlobalScanCode(_x18, _x19) {
2176
2211
  return _handleGlobalScanCode.apply(this, arguments);
2177
2212
  }
2178
2213
  return handleGlobalScanCode;
2179
- }()
2214
+ }())
2215
+ }, {
2216
+ key: "resolveBestAddTimePlan",
2217
+ value: function resolveBestAddTimePlan(addTimeProducts, targetMinutes) {
2218
+ return _resolveBestAddTimePlan(addTimeProducts, targetMinutes);
2219
+ }
2220
+
2180
2221
  /**
2181
2222
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
2182
2223
  * 再清理 BookingTicket 自有资源(scan 监听 + scan 内存缓存)。
2183
2224
  */
2184
- )
2185
2225
  }, {
2186
2226
  key: "destroy",
2187
2227
  value: (function () {
2188
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2228
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2189
2229
  var _this$scan;
2190
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2191
- while (1) switch (_context27.prev = _context27.next) {
2230
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2231
+ while (1) switch (_context28.prev = _context28.next) {
2192
2232
  case 0:
2193
- _context27.next = 2;
2233
+ _context28.next = 2;
2194
2234
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
2195
2235
  case 2:
2196
2236
  try {
@@ -2201,9 +2241,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2201
2241
  scanCache.clear();
2202
2242
  case 4:
2203
2243
  case "end":
2204
- return _context27.stop();
2244
+ return _context28.stop();
2205
2245
  }
2206
- }, _callee27, this);
2246
+ }, _callee28, this);
2207
2247
  }));
2208
2248
  function destroy() {
2209
2249
  return _destroy.apply(this, arguments);