@pisell/pisellos 2.3.41 → 2.3.43

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 (147) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/Discount/index.d.ts +1 -0
  3. package/dist/modules/Discount/index.js +40 -11
  4. package/dist/modules/Discount/types.d.ts +1 -0
  5. package/dist/modules/Holder/index.d.ts +48 -0
  6. package/dist/modules/Holder/index.js +640 -0
  7. package/dist/modules/Holder/types.d.ts +123 -0
  8. package/dist/modules/Holder/types.js +1 -0
  9. package/dist/modules/Holder/utils.d.ts +13 -0
  10. package/dist/modules/Holder/utils.js +34 -0
  11. package/dist/modules/OpenData/index.js +2 -2
  12. package/dist/modules/Order/index.d.ts +3 -1
  13. package/dist/modules/Order/index.js +55 -26
  14. package/dist/modules/Order/types.d.ts +9 -0
  15. package/dist/modules/Order/utils.d.ts +10 -0
  16. package/dist/modules/Order/utils.js +35 -3
  17. package/dist/modules/Product/types.d.ts +1 -0
  18. package/dist/modules/ProductList/index.js +33 -14
  19. package/dist/modules/Quotation/index.d.ts +1 -1
  20. package/dist/modules/Quotation/index.js +2 -2
  21. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  22. package/dist/modules/ResourcePlanner/index.js +181 -0
  23. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  24. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  25. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  26. package/dist/modules/ResourcePlanner/types.js +1 -0
  27. package/dist/modules/Rules/index.js +47 -13
  28. package/dist/modules/SalesSummary/index.js +12 -13
  29. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  30. package/dist/modules/ScanOrderLogger/index.js +15 -2
  31. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  32. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  33. package/dist/modules/Schedule/index.d.ts +3 -1
  34. package/dist/modules/Schedule/index.js +21 -16
  35. package/dist/modules/Summary/utils.js +38 -13
  36. package/dist/modules/index.d.ts +2 -0
  37. package/dist/modules/index.js +3 -1
  38. package/dist/plugins/window.d.ts +1 -0
  39. package/dist/server/index.d.ts +14 -0
  40. package/dist/server/index.js +772 -657
  41. package/dist/solution/BaseSales/index.d.ts +7 -0
  42. package/dist/solution/BaseSales/index.js +64 -42
  43. package/dist/solution/BookingByStep/index.d.ts +17 -2
  44. package/dist/solution/BookingByStep/index.js +294 -215
  45. package/dist/solution/BookingByStep/types.d.ts +2 -1
  46. package/dist/solution/BookingByStep/types.js +3 -1
  47. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  48. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  49. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  50. package/dist/solution/BookingTicket/index.d.ts +1 -1
  51. package/dist/solution/BookingTicket/index.js +2 -2
  52. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  53. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  54. package/dist/solution/ScanOrder/index.d.ts +26 -14
  55. package/dist/solution/ScanOrder/index.js +1142 -739
  56. package/dist/solution/ScanOrder/types.d.ts +21 -1
  57. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  58. package/dist/solution/ScanOrder/utils.js +66 -25
  59. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  60. package/dist/solution/ShopDiscount/index.js +125 -87
  61. package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
  62. package/dist/solution/UnifiedBookingSales/index.js +1891 -0
  63. package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
  64. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  65. package/dist/solution/VenueBooking/index.d.ts +39 -11
  66. package/dist/solution/VenueBooking/index.js +1167 -841
  67. package/dist/solution/VenueBooking/types.d.ts +3 -0
  68. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  69. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  70. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  71. package/dist/solution/index.d.ts +1 -0
  72. package/dist/solution/index.js +2 -1
  73. package/dist/types/index.d.ts +1 -0
  74. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  75. package/lib/modules/Discount/index.d.ts +1 -0
  76. package/lib/modules/Discount/index.js +9 -0
  77. package/lib/modules/Discount/types.d.ts +1 -0
  78. package/lib/modules/Holder/index.d.ts +48 -0
  79. package/lib/modules/Holder/index.js +402 -0
  80. package/lib/modules/Holder/types.d.ts +123 -0
  81. package/lib/modules/Holder/types.js +17 -0
  82. package/lib/modules/Holder/utils.d.ts +13 -0
  83. package/lib/modules/Holder/utils.js +71 -0
  84. package/lib/modules/OpenData/index.js +1 -1
  85. package/lib/modules/Order/index.d.ts +3 -1
  86. package/lib/modules/Order/index.js +27 -11
  87. package/lib/modules/Order/types.d.ts +9 -0
  88. package/lib/modules/Order/utils.d.ts +10 -0
  89. package/lib/modules/Order/utils.js +36 -5
  90. package/lib/modules/Product/types.d.ts +1 -0
  91. package/lib/modules/ProductList/index.js +40 -31
  92. package/lib/modules/Quotation/index.d.ts +1 -1
  93. package/lib/modules/Quotation/index.js +2 -2
  94. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  95. package/lib/modules/ResourcePlanner/index.js +148 -0
  96. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  97. package/lib/modules/ResourcePlanner/planner.js +933 -0
  98. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  99. package/lib/modules/ResourcePlanner/types.js +17 -0
  100. package/lib/modules/Rules/index.js +33 -16
  101. package/lib/modules/SalesSummary/index.js +6 -7
  102. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  103. package/lib/modules/ScanOrderLogger/index.js +13 -1
  104. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  105. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  106. package/lib/modules/Schedule/index.d.ts +3 -1
  107. package/lib/modules/Schedule/index.js +10 -8
  108. package/lib/modules/Summary/utils.js +21 -1
  109. package/lib/modules/index.d.ts +2 -0
  110. package/lib/modules/index.js +5 -1
  111. package/lib/plugins/window.d.ts +1 -0
  112. package/lib/server/index.d.ts +14 -0
  113. package/lib/server/index.js +65 -5
  114. package/lib/solution/BaseSales/index.d.ts +7 -0
  115. package/lib/solution/BaseSales/index.js +24 -8
  116. package/lib/solution/BookingByStep/index.d.ts +17 -2
  117. package/lib/solution/BookingByStep/index.js +60 -18
  118. package/lib/solution/BookingByStep/types.d.ts +2 -1
  119. package/lib/solution/BookingByStep/types.js +5 -0
  120. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  121. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  122. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  123. package/lib/solution/BookingTicket/index.d.ts +1 -1
  124. package/lib/solution/BookingTicket/index.js +10 -2
  125. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  126. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  127. package/lib/solution/ScanOrder/index.d.ts +26 -14
  128. package/lib/solution/ScanOrder/index.js +449 -182
  129. package/lib/solution/ScanOrder/types.d.ts +21 -1
  130. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  131. package/lib/solution/ScanOrder/utils.js +31 -0
  132. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  133. package/lib/solution/ShopDiscount/index.js +14 -0
  134. package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
  135. package/lib/solution/UnifiedBookingSales/index.js +1084 -0
  136. package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
  137. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  138. package/lib/solution/VenueBooking/index.d.ts +39 -11
  139. package/lib/solution/VenueBooking/index.js +322 -110
  140. package/lib/solution/VenueBooking/types.d.ts +3 -0
  141. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  142. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  143. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  144. package/lib/solution/index.d.ts +1 -0
  145. package/lib/solution/index.js +3 -1
  146. package/lib/types/index.d.ts +1 -0
  147. package/package.json +1 -1
@@ -400,41 +400,79 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
400
400
  value: function setProductList(productList) {
401
401
  this.store.productList = productList;
402
402
  }
403
-
404
- // 扫码输入code
405
403
  }, {
406
- key: "scanCode",
404
+ key: "batchSearchByProductIds",
407
405
  value: function () {
408
- var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, customerId) {
409
- var _this$store$discount3, _this$store$bookingSu2, resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, unavailableReason, _this$options$otherPa6;
406
+ var _batchSearchByProductIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(productIds) {
407
+ var _this$store$discount3;
408
+ var resultDiscountList, currentDiscountList, newDiscountList;
410
409
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
411
410
  while (1) switch (_context5.prev = _context5.next) {
412
411
  case 0:
413
- _context5.prev = 0;
414
- _context5.next = 3;
415
- return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.batchSearch(code, {
412
+ _context5.next = 2;
413
+ return (_this$store$discount3 = this.store.discount) === null || _this$store$discount3 === void 0 ? void 0 : _this$store$discount3.batchSearchByProductIds(productIds);
414
+ case 2:
415
+ _context5.t0 = _context5.sent;
416
+ if (_context5.t0) {
417
+ _context5.next = 5;
418
+ break;
419
+ }
420
+ _context5.t0 = [];
421
+ case 5:
422
+ resultDiscountList = _context5.t0;
423
+ resultDiscountList = resultDiscountList.map(function (item) {
424
+ return _objectSpread(_objectSpread({}, item), {}, {
425
+ discount_rule_uncheck_flag: true
426
+ });
427
+ });
428
+ currentDiscountList = this.getDiscountList() || [];
429
+ newDiscountList = [].concat(_toConsumableArray(currentDiscountList), _toConsumableArray(resultDiscountList));
430
+ this.setDiscountList(newDiscountList);
431
+ return _context5.abrupt("return", newDiscountList);
432
+ case 11:
433
+ case "end":
434
+ return _context5.stop();
435
+ }
436
+ }, _callee5, this);
437
+ }));
438
+ function batchSearchByProductIds(_x4) {
439
+ return _batchSearchByProductIds.apply(this, arguments);
440
+ }
441
+ return batchSearchByProductIds;
442
+ }() // 扫码输入code
443
+ }, {
444
+ key: "scanCode",
445
+ value: function () {
446
+ var _scanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(code, customerId) {
447
+ var _this$store$discount4, _this$store$bookingSu2, resultDiscountWithReason, resultDiscountList, unavailableReasonKey, rulesModule, withScanList, currentSelectedDiscountList, _ref2, newProductList, newDiscountList, isAvailable, unavailableReason, _this$options$otherPa6;
448
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
449
+ while (1) switch (_context6.prev = _context6.next) {
450
+ case 0:
451
+ _context6.prev = 0;
452
+ _context6.next = 3;
453
+ return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.batchSearch(code, {
416
454
  customerId: customerId,
417
455
  orderId: this.store.orderId
418
456
  });
419
457
  case 3:
420
- _context5.t0 = _context5.sent;
421
- if (_context5.t0) {
422
- _context5.next = 6;
458
+ _context6.t0 = _context6.sent;
459
+ if (_context6.t0) {
460
+ _context6.next = 6;
423
461
  break;
424
462
  }
425
- _context5.t0 = {
463
+ _context6.t0 = {
426
464
  discountList: [],
427
465
  unavailableReasonKey: null
428
466
  };
429
467
  case 6:
430
- resultDiscountWithReason = _context5.t0;
468
+ resultDiscountWithReason = _context6.t0;
431
469
  resultDiscountList = resultDiscountWithReason.discountList, unavailableReasonKey = resultDiscountWithReason.unavailableReasonKey;
432
470
  rulesModule = this.store.rules;
433
471
  if (rulesModule) {
434
- _context5.next = 11;
472
+ _context6.next = 11;
435
473
  break;
436
474
  }
437
- return _context5.abrupt("return", {
475
+ return _context6.abrupt("return", {
438
476
  type: "clientCalc",
439
477
  isAvailable: false,
440
478
  productList: this.store.productList || [],
@@ -443,10 +481,10 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
443
481
  });
444
482
  case 11:
445
483
  if (resultDiscountList.length) {
446
- _context5.next = 13;
484
+ _context6.next = 13;
447
485
  break;
448
486
  }
449
- return _context5.abrupt("return", {
487
+ return _context6.abrupt("return", {
450
488
  type: "server",
451
489
  isAvailable: false,
452
490
  productList: this.store.productList || [],
@@ -467,10 +505,10 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
467
505
  return m.id === n.id;
468
506
  });
469
507
  }))) {
470
- _context5.next = 17;
508
+ _context6.next = 17;
471
509
  break;
472
510
  }
473
- return _context5.abrupt("return", {
511
+ return _context6.abrupt("return", {
474
512
  type: "clientCalc",
475
513
  isAvailable: true,
476
514
  productList: this.store.productList || [],
@@ -490,20 +528,20 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
490
528
  discountList: this.getDiscountList()
491
529
  }, newProductList = _ref2.productList, newDiscountList = _ref2.discountList, isAvailable = _ref2.isAvailable, unavailableReason = _ref2.unavailableReason;
492
530
  if (!isAvailable) {
493
- _context5.next = 25;
531
+ _context6.next = 25;
494
532
  break;
495
533
  }
496
534
  this.setDiscountList(newDiscountList || []);
497
535
  this.store.originalDiscountList = newDiscountList || [];
498
536
  this.setProductList(newProductList || []);
499
537
  if (!(this.isWalkIn() && resultDiscountList.length && ((_this$options$otherPa6 = this.options.otherParams) === null || _this$options$otherPa6 === void 0 ? void 0 : _this$options$otherPa6.platform) === 'shop' && !((resultDiscountList[0].customer_id || 1) === 1))) {
500
- _context5.next = 25;
538
+ _context6.next = 25;
501
539
  break;
502
540
  }
503
- _context5.next = 25;
541
+ _context6.next = 25;
504
542
  return this.getCustomerWallet(resultDiscountList[0].customer_id);
505
543
  case 25:
506
- return _context5.abrupt("return", {
544
+ return _context6.abrupt("return", {
507
545
  type: "clientCalc",
508
546
  isAvailable: isAvailable || false,
509
547
  productList: newProductList || this.store.productList || [],
@@ -511,10 +549,10 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
511
549
  unavailableReason: unavailableReason
512
550
  });
513
551
  case 28:
514
- _context5.prev = 28;
515
- _context5.t1 = _context5["catch"](0);
516
- console.error('[ShopDiscount] 扫码出错:', _context5.t1);
517
- return _context5.abrupt("return", {
552
+ _context6.prev = 28;
553
+ _context6.t1 = _context6["catch"](0);
554
+ console.error('[ShopDiscount] 扫码出错:', _context6.t1);
555
+ return _context6.abrupt("return", {
518
556
  type: "clientCalc",
519
557
  isAvailable: false,
520
558
  productList: this.store.productList || [],
@@ -523,11 +561,11 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
523
561
  });
524
562
  case 32:
525
563
  case "end":
526
- return _context5.stop();
564
+ return _context6.stop();
527
565
  }
528
- }, _callee5, this, [[0, 28]]);
566
+ }, _callee6, this, [[0, 28]]);
529
567
  }));
530
- function scanCode(_x4, _x5) {
568
+ function scanCode(_x5, _x6) {
531
569
  return _scanCode.apply(this, arguments);
532
570
  }
533
571
  return scanCode;
@@ -535,8 +573,8 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
535
573
  }, {
536
574
  key: "calcDiscountApplicableProductTotalPrice",
537
575
  value: function calcDiscountApplicableProductTotalPrice(discount) {
538
- var _this$store$discount4;
539
- return (_this$store$discount4 = this.store.discount) === null || _this$store$discount4 === void 0 ? void 0 : _this$store$discount4.calcDiscountApplicableProductTotalPrice(discount);
576
+ var _this$store$discount5;
577
+ return (_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 ? void 0 : _this$store$discount5.calcDiscountApplicableProductTotalPrice(discount);
540
578
  }
541
579
 
542
580
  // =========== 私有辅助方法 ===========
@@ -560,19 +598,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
560
598
  }, {
561
599
  key: "emitDiscountListChange",
562
600
  value: function () {
563
- var _emitDiscountListChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(discountList) {
564
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
565
- while (1) switch (_context6.prev = _context6.next) {
601
+ var _emitDiscountListChange = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(discountList) {
602
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
603
+ while (1) switch (_context7.prev = _context7.next) {
566
604
  case 0:
567
- _context6.next = 2;
605
+ _context7.next = 2;
568
606
  return this.core.effects.emit("".concat(this.name, ":onDiscountListChange"), discountList);
569
607
  case 2:
570
608
  case "end":
571
- return _context6.stop();
609
+ return _context7.stop();
572
610
  }
573
- }, _callee6, this);
611
+ }, _callee7, this);
574
612
  }));
575
- function emitDiscountListChange(_x6) {
613
+ function emitDiscountListChange(_x7) {
576
614
  return _emitDiscountListChange.apply(this, arguments);
577
615
  }
578
616
  return emitDiscountListChange;
@@ -581,7 +619,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
581
619
  key: "setDiscountList",
582
620
  value: function setDiscountList(discountList) {
583
621
  var _this3 = this,
584
- _this$store$discount5;
622
+ _this$store$discount6;
585
623
  var productList = this.store.productList || [];
586
624
  var editModeDiscountList = [];
587
625
  productList.forEach(function (item) {
@@ -664,7 +702,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
664
702
  item.isDisabledForProductUsed = false;
665
703
  }
666
704
  });
667
- (_this$store$discount5 = this.store.discount) === null || _this$store$discount5 === void 0 || _this$store$discount5.setDiscountList(newDiscountList);
705
+ (_this$store$discount6 = this.store.discount) === null || _this$store$discount6 === void 0 || _this$store$discount6.setDiscountList(newDiscountList);
668
706
  this.emitDiscountListChange(newDiscountList);
669
707
  return newDiscountList;
670
708
  }
@@ -673,48 +711,48 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
673
711
  }, {
674
712
  key: "getDiscountList",
675
713
  value: function getDiscountList() {
676
- var _this$store$discount6;
677
- return ((_this$store$discount6 = this.store.discount) === null || _this$store$discount6 === void 0 ? void 0 : _this$store$discount6.getDiscountList()) || [];
714
+ var _this$store$discount7;
715
+ return ((_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 ? void 0 : _this$store$discount7.getDiscountList()) || [];
678
716
  }
679
717
 
680
718
  // 获取客户钱包信息
681
719
  }, {
682
720
  key: "getCustomerWallet",
683
721
  value: function () {
684
- var _getCustomerWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(id) {
722
+ var _getCustomerWallet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
685
723
  var _result, customer;
686
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
687
- while (1) switch (_context7.prev = _context7.next) {
724
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
725
+ while (1) switch (_context8.prev = _context8.next) {
688
726
  case 0:
689
- _context7.prev = 0;
690
- _context7.next = 3;
727
+ _context8.prev = 0;
728
+ _context8.next = 3;
691
729
  return this.request.get("/customer/info/".concat(id), {
692
730
  with_trashed: 1
693
731
  });
694
732
  case 3:
695
- _result = _context7.sent;
733
+ _result = _context8.sent;
696
734
  if (!(_result !== null && _result !== void 0 && _result.data)) {
697
- _context7.next = 9;
735
+ _context8.next = 9;
698
736
  break;
699
737
  }
700
738
  customer = Object.assign({}, (_objectDestructuringEmpty(_result.data), _result.data));
701
739
  this.setCustomer(customer);
702
- _context7.next = 9;
740
+ _context8.next = 9;
703
741
  return this.core.effects.emit("".concat(this.name, ":onScanCustomerChange"), customer);
704
742
  case 9:
705
- _context7.next = 14;
743
+ _context8.next = 14;
706
744
  break;
707
745
  case 11:
708
- _context7.prev = 11;
709
- _context7.t0 = _context7["catch"](0);
710
- console.error('[ShopDiscount] 获取客户钱包信息出错:', _context7.t0);
746
+ _context8.prev = 11;
747
+ _context8.t0 = _context8["catch"](0);
748
+ console.error('[ShopDiscount] 获取客户钱包信息出错:', _context8.t0);
711
749
  case 14:
712
750
  case "end":
713
- return _context7.stop();
751
+ return _context8.stop();
714
752
  }
715
- }, _callee7, this, [[0, 11]]);
753
+ }, _callee8, this, [[0, 11]]);
716
754
  }));
717
- function getCustomerWallet(_x7) {
755
+ function getCustomerWallet(_x8) {
718
756
  return _getCustomerWallet.apply(this, arguments);
719
757
  }
720
758
  return getCustomerWallet;
@@ -722,32 +760,32 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
722
760
  }, {
723
761
  key: "bestDiscount",
724
762
  value: function () {
725
- var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(cb) {
763
+ var _bestDiscount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(cb) {
726
764
  var _this$store$productLi;
727
765
  var newDiscountList, _result2;
728
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
729
- while (1) switch (_context8.prev = _context8.next) {
766
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
767
+ while (1) switch (_context9.prev = _context9.next) {
730
768
  case 0:
731
769
  newDiscountList = this.store.originalDiscountList;
732
770
  this.setDiscountList(newDiscountList);
733
771
  if (!((_this$store$productLi = this.store.productList) !== null && _this$store$productLi !== void 0 && _this$store$productLi.length)) {
734
- _context8.next = 7;
772
+ _context9.next = 7;
735
773
  break;
736
774
  }
737
775
  _result2 = this.calcDiscount(this.store.productList);
738
776
  cb === null || cb === void 0 || cb(_result2);
739
- _context8.next = 7;
777
+ _context9.next = 7;
740
778
  return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result2);
741
779
  case 7:
742
- _context8.next = 9;
780
+ _context9.next = 9;
743
781
  return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), newDiscountList);
744
782
  case 9:
745
783
  case "end":
746
- return _context8.stop();
784
+ return _context9.stop();
747
785
  }
748
- }, _callee8, this);
786
+ }, _callee9, this);
749
787
  }));
750
- function bestDiscount(_x8) {
788
+ function bestDiscount(_x9) {
751
789
  return _bestDiscount.apply(this, arguments);
752
790
  }
753
791
  return bestDiscount;
@@ -755,18 +793,18 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
755
793
  }, {
756
794
  key: "loadPrepareConfig",
757
795
  value: function () {
758
- var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
759
- var _this$getCustomer2, _this$store$discount7, _this$getDiscountList, _this$store$discount8, _this$store$productLi2, orderId, customerId, prepareConfigResult, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, _result3;
760
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
761
- while (1) switch (_context9.prev = _context9.next) {
796
+ var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
797
+ var _this$getCustomer2, _this$store$discount8, _this$getDiscountList, _this$store$discount9, _this$store$productLi2, orderId, customerId, prepareConfigResult, goodPassList, scanDiscount, scanDiscountIds, newGoodPassList, newDiscountList, filteredDiscountList, _result3;
798
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
799
+ while (1) switch (_context10.prev = _context10.next) {
762
800
  case 0:
763
- _context9.prev = 0;
801
+ _context10.prev = 0;
764
802
  orderId = this.store.orderId;
765
803
  customerId = params.customerId || ((_this$getCustomer2 = this.getCustomer()) === null || _this$getCustomer2 === void 0 ? void 0 : _this$getCustomer2.id); // if (customerId === 1 || !customerId) {
766
804
  // return
767
805
  // }
768
- _context9.next = 5;
769
- return (_this$store$discount7 = this.store.discount) === null || _this$store$discount7 === void 0 ? void 0 : _this$store$discount7.loadPrepareConfig(_objectSpread({
806
+ _context10.next = 5;
807
+ return (_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 ? void 0 : _this$store$discount8.loadPrepareConfig(_objectSpread({
770
808
  customer_id: customerId,
771
809
  action: orderId ? 'edit' : 'create',
772
810
  with_good_pass: 1,
@@ -777,7 +815,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
777
815
  order_id: orderId
778
816
  } : {}));
779
817
  case 5:
780
- prepareConfigResult = _context9.sent;
818
+ prepareConfigResult = _context10.sent;
781
819
  goodPassList = (prepareConfigResult === null || prepareConfigResult === void 0 ? void 0 : prepareConfigResult.discountList) || [];
782
820
  scanDiscount = (_this$getDiscountList = this.getDiscountList()) === null || _this$getDiscountList === void 0 ? void 0 : _this$getDiscountList.filter(function (item) {
783
821
  return item.isScan;
@@ -790,37 +828,37 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
790
828
  });
791
829
  newDiscountList = [].concat(_toConsumableArray(scanDiscount), _toConsumableArray(newGoodPassList || [])); // 存储原始优惠券列表
792
830
  this.store.originalDiscountList = newDiscountList;
793
- _context9.next = 14;
794
- return (_this$store$discount8 = this.store.discount) === null || _this$store$discount8 === void 0 ? void 0 : _this$store$discount8.setOriginalDiscountList(newDiscountList);
831
+ _context10.next = 14;
832
+ return (_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.setOriginalDiscountList(newDiscountList);
795
833
  case 14:
796
834
  // 根据当前预约时间过滤优惠券列表
797
835
  filteredDiscountList = this.filterDiscountListByBookingTime(newDiscountList, this.store.currentBookingTime);
798
836
  this.store.filteredDiscountList = filteredDiscountList;
799
837
  this.setDiscountList(filteredDiscountList || []);
800
838
  if (!((_this$store$productLi2 = this.store.productList) !== null && _this$store$productLi2 !== void 0 && _this$store$productLi2.length)) {
801
- _context9.next = 21;
839
+ _context10.next = 21;
802
840
  break;
803
841
  }
804
842
  _result3 = this.calcDiscount(this.store.productList);
805
- _context9.next = 21;
843
+ _context10.next = 21;
806
844
  return this.core.effects.emit("".concat(this.name, ":onLoadPrepareCalcResult"), _result3);
807
845
  case 21:
808
- _context9.next = 23;
846
+ _context10.next = 23;
809
847
  return this.core.effects.emit("".concat(this.name, ":onLoadDiscountList"), filteredDiscountList);
810
848
  case 23:
811
- _context9.next = 28;
849
+ _context10.next = 28;
812
850
  break;
813
851
  case 25:
814
- _context9.prev = 25;
815
- _context9.t0 = _context9["catch"](0);
816
- console.error('[ShopDiscount] 加载准备配置出错:', _context9.t0);
852
+ _context10.prev = 25;
853
+ _context10.t0 = _context10["catch"](0);
854
+ console.error('[ShopDiscount] 加载准备配置出错:', _context10.t0);
817
855
  case 28:
818
856
  case "end":
819
- return _context9.stop();
857
+ return _context10.stop();
820
858
  }
821
- }, _callee9, this, [[0, 25]]);
859
+ }, _callee10, this, [[0, 25]]);
822
860
  }));
823
- function loadPrepareConfig(_x9) {
861
+ function loadPrepareConfig(_x10) {
824
862
  return _loadPrepareConfig.apply(this, arguments);
825
863
  }
826
864
  return loadPrepareConfig;
@@ -0,0 +1,183 @@
1
+ import type { Module } from '../../types';
2
+ import type { ProductData } from '../../modules';
3
+ import type { OpenDataConfig } from '../../modules/OpenData';
4
+ import type { LoadScheduleAvailableDateParams, ScheduleItem } from '../../modules/Schedule/types';
5
+ import type { ProductListLoadProductsParams } from '../../modules/ProductList';
6
+ import type { ResourcePlannerAssignment, ResourcePlannerAssignableSlotResult, ResourcePlannerEvent, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from '../../modules/ResourcePlanner';
7
+ import type { UnifiedBookingSalesCommitPlannerSelectionParams, UnifiedBookingSalesCommitResult, UnifiedBookingSalesAddRetailProductParams, UnifiedBookingSalesApplyPlannerDiscountsParams, UnifiedBookingSalesDiscountResult, UnifiedBookingSalesLoadProductsByScheduleDateParams, UnifiedBookingSalesLoadPlannerContextParams, UnifiedBookingSalesLoadOpenDataParams, UnifiedBookingSalesStagePlannerProductsParams, UnifiedBookingSalesStageRetailProductsParams, UnifiedBookingSalesState } from './types';
8
+ import { BookingTicket } from '../BookingTicket';
9
+ export * from './types';
10
+ /**
11
+ * Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
12
+ * candidate-card state separate from line-level applications: a selected card is not proof that
13
+ * it actually discounted a planner product.
14
+ */
15
+ export declare function buildPlannerDiscountResult(params: {
16
+ customerId: number | null;
17
+ discountList: Record<string, any>[];
18
+ products: Record<string, any>[];
19
+ summaryBefore?: unknown;
20
+ summaryAfter?: unknown;
21
+ status: UnifiedBookingSalesDiscountResult['status'];
22
+ preferredDiscountId?: number | string;
23
+ preferredDiscountFound?: boolean;
24
+ }): UnifiedBookingSalesDiscountResult;
25
+ /** Converts a ProductList record into the pure input shape consumed by ResourcePlanner. */
26
+ export declare function normalizeProductForPlanner(product: ProductData | Record<string, any>): ResourcePlannerProduct;
27
+ /**
28
+ * Materializes resource work windows locally from v2's schedule ids, then keeps its flat
29
+ * event_list as planner events. This deliberately avoids the older API's times -> event_list
30
+ * response nesting and lets one resource response serve any requested date range.
31
+ */
32
+ export declare function buildPlannerResourcesFromV2(params: {
33
+ rawResources: Record<string, any>[];
34
+ scheduleList: ScheduleItem[];
35
+ dateRange?: ResourcePlannerQuery['dateRange'];
36
+ }): {
37
+ resources: ResourcePlannerResource[];
38
+ externalEvents: ResourcePlannerEvent[];
39
+ };
40
+ /** Combines URL-locked resources with every resource referenced by the selected products. */
41
+ export declare function collectPlannerResourceIds(products: ResourcePlannerProduct[], explicitResourceIds?: Array<number | string>): Array<number | string>;
42
+ /** Convenience wrapper for the usual one-resource booking case. */
43
+ export declare function buildBookingFromAssignment(params: {
44
+ assignment: ResourcePlannerAssignment;
45
+ product: ResourcePlannerProduct;
46
+ }): Record<string, any>;
47
+ /**
48
+ * Converts all resources needed by one product/time interval into the one booking expected by
49
+ * OrderModule. Callers must group assignments before this function so a multi-form booking does
50
+ * not become several competing bookings.
51
+ */
52
+ export declare function buildBookingFromAssignments(params: {
53
+ assignments: ResourcePlannerAssignment[];
54
+ product: ResourcePlannerProduct;
55
+ }): Record<string, any>;
56
+ /** Builds the exact identity BaseSales needs to remove only this solution's order lines. */
57
+ export declare function buildPlannerLineIdentity(product: Record<string, any>): Record<string, any>;
58
+ export declare class UnifiedBookingSalesImpl extends BookingTicket {
59
+ protected defaultName: string;
60
+ protected defaultVersion: string;
61
+ protected store: UnifiedBookingSalesState;
62
+ private unifiedProductCatalog;
63
+ private openDataTarget;
64
+ private loadOpenDataInFlight;
65
+ private loadOpenDataInFlightTarget;
66
+ /**
67
+ * Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
68
+ * 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
69
+ */
70
+ protected shouldUseCheckoutSyncTask(): boolean;
71
+ /** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
72
+ protected getDefaultCheckoutSmallTicketDataFlag(): number;
73
+ protected getRegisteredModuleNames(): readonly string[];
74
+ protected createSubModule(moduleName: string): Module | null;
75
+ /**
76
+ * Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
77
+ * business/channel target so a reused solution instance cannot leak another entry's menus.
78
+ */
79
+ loadOpenData(params: UnifiedBookingSalesLoadOpenDataParams): Promise<OpenDataConfig>;
80
+ getOpenData(): Promise<OpenDataConfig | null>;
81
+ /**
82
+ * Loads the product catalog used by both UI and Planner. Schedule data is requested with each
83
+ * product because session products carry their fixed intervals there.
84
+ */
85
+ loadProducts(params?: ProductListLoadProductsParams, options?: {
86
+ callback?: (result: any) => void;
87
+ subscriberId?: string;
88
+ }): Promise<ProductData[]>;
89
+ /** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */
90
+ loadScheduleAvailableDate(params: LoadScheduleAvailableDateParams): Promise<import("../../modules/Date/types").ITime[]>;
91
+ /**
92
+ * Implements the date-first product pool: the chosen date's product ids plus globally sellable
93
+ * other_product_ids. If a batch product query is unexpectedly empty, retry one id at a time so
94
+ * a partial backend incompatibility does not hide the entire date's catalog.
95
+ */
96
+ loadProductsByScheduleDate(params: UnifiedBookingSalesLoadProductsByScheduleDateParams): Promise<ProductData[]>;
97
+ /** Returns a copy so UI consumers cannot accidentally mutate the solution's product cache. */
98
+ getProductCatalog(): {
99
+ products: ProductData[];
100
+ };
101
+ /**
102
+ * Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
103
+ * must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
104
+ */
105
+ getCart(): {
106
+ items: any[];
107
+ bookings: any[];
108
+ };
109
+ /**
110
+ * Loads the current customer's product coupons and discount cards after planner lines exist,
111
+ * then optionally lets the existing Rules engine select the best valid combination. This is a
112
+ * diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
113
+ */
114
+ applyPlannerDiscounts(params?: UnifiedBookingSalesApplyPlannerDiscountsParams): Promise<UnifiedBookingSalesDiscountResult>;
115
+ /** ResourcePlanner is a required child module; fail early instead of producing partial availability. */
116
+ private getPlanner;
117
+ private buildUnifiedOrderProduct;
118
+ /** Replacing a staged selection is idempotent and never removes unrelated cart lines. */
119
+ private removeExistingStagedLines;
120
+ private stageProducts;
121
+ /**
122
+ * Adds the current product choice to an otherwise clean planner cart without creating bookings.
123
+ * This separates "what the customer wants" from the later time/resource confirmation step.
124
+ */
125
+ stagePlannerProducts(params: UnifiedBookingSalesStagePlannerProductsParams): Promise<Record<string, any> | null>;
126
+ /**
127
+ * Adds ordinary retail products without asking ResourcePlanner for booking facts.
128
+ * Its staged lines have separate ownership so planner and retail skins can coexist safely.
129
+ */
130
+ stageRetailProducts(params: UnifiedBookingSalesStageRetailProductsParams): Promise<Record<string, any> | null>;
131
+ /**
132
+ * Adds one retail line without replacing the cart's existing retail selection.
133
+ * This is intentionally separate from stageRetailProducts(), whose contract is
134
+ * "replace the staged selection" for demo and wizard-like callers.
135
+ */
136
+ addRetailProduct(params: UnifiedBookingSalesAddRetailProductParams): Promise<Record<string, any>[]>;
137
+ /** Normalizes caller-provided products or loads the catalog before any resource request is made. */
138
+ private loadPlannerProducts;
139
+ /** Loads the reusable store-level schedule catalog on demand. */
140
+ private ensurePlannerSchedulesLoaded;
141
+ /**
142
+ * v2 resources reference schedule ids rather than expanded work times. Refresh once when the
143
+ * cached schedule catalog cannot materialize all referenced ids.
144
+ */
145
+ private ensurePlannerSchedulesForResources;
146
+ /**
147
+ * Fetches resource metadata plus flat occupied events. Work windows are intentionally derived
148
+ * locally in buildPlannerResourcesFromV2 from /schedule, rather than requested from the legacy
149
+ * resource dates endpoint.
150
+ */
151
+ private fetchPlannerResourcesV2;
152
+ /**
153
+ * Resolves the Planner context in precedence order: explicit normalized context, test raw data,
154
+ * then the v2 resource API inferred from selected product requirements and any URL lock.
155
+ */
156
+ private loadPlannerResources;
157
+ /**
158
+ * Boundary between IO and pure planning. Once this returns, all later availability/slot calls
159
+ * operate on the ResourcePlanner snapshot and do not issue resource requests themselves.
160
+ */
161
+ loadPlannerContext(params?: UnifiedBookingSalesLoadPlannerContextParams): Promise<ResourcePlannerSnapshot>;
162
+ /** Returns cells, date summaries and a derived grid; cells are continuous ranges, not UI slots. */
163
+ queryPlannerAvailability(query?: ResourcePlannerQuery): Promise<ResourcePlannerProjection>;
164
+ /** Turns compatible availability ranges into user-selectable intervals and ready-to-commit assignments. */
165
+ resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
166
+ /** Stores a UI choice only. It is deliberately side-effect free with respect to tempOrder. */
167
+ setPlannerSelection(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
168
+ /**
169
+ * Legacy-friendly automatic assignment for already fixed intervals. Duration products without a
170
+ * start time intentionally remain unresolved; callers offering a picker should use slots.
171
+ */
172
+ autoAssignPlanner(query?: ResourcePlannerQuery): Promise<ResourcePlannerSnapshot>;
173
+ /** Rechecks remote events, capacity and conflicts among the current selection before committing. */
174
+ validatePlannerSelection(): ResourcePlannerValidationResult;
175
+ /** Read-only snapshot for UI diagnostics and progressive flow steps. */
176
+ getPlannerSnapshot(): ResourcePlannerSnapshot;
177
+ /**
178
+ * Validates then writes assignments to tempOrder. Real order submission is opt-in so UI callers
179
+ * can safely preview the cart; pass submitAfterCommit only after an explicit confirmation.
180
+ */
181
+ commitPlannerSelection(params?: UnifiedBookingSalesCommitPlannerSelectionParams): Promise<UnifiedBookingSalesCommitResult>;
182
+ }
183
+ export declare const UnifiedBookingSales: typeof UnifiedBookingSalesImpl;