@pisell/pisellos 2.3.128 → 2.3.129

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 (88) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  3. package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
  4. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
  5. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
  6. package/dist/modules/Customer/index.js +6 -3
  7. package/dist/modules/Customer/types.d.ts +2 -0
  8. package/dist/modules/Discount/availability.d.ts +7 -0
  9. package/dist/modules/Discount/availability.js +49 -0
  10. package/dist/modules/Discount/entitlementPass.d.ts +34 -0
  11. package/dist/modules/Discount/entitlementPass.js +147 -0
  12. package/dist/modules/Discount/index.d.ts +2 -2
  13. package/dist/modules/Discount/index.js +37 -151
  14. package/dist/modules/Discount/types.d.ts +36 -5
  15. package/dist/modules/Order/index.d.ts +6 -0
  16. package/dist/modules/Order/index.js +443 -235
  17. package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
  18. package/dist/modules/Order/utils.d.ts +1 -1
  19. package/dist/modules/Order/utils.js +101 -60
  20. package/dist/modules/Payment/types.d.ts +21 -1
  21. package/dist/modules/Payment/types.js +2 -0
  22. package/dist/modules/Payment/walletpass.d.ts +1 -1
  23. package/dist/modules/Payment/walletpass.js +80 -47
  24. package/dist/modules/Rules/index.d.ts +2 -2
  25. package/dist/modules/Rules/index.js +480 -186
  26. package/dist/modules/Rules/types.d.ts +4 -0
  27. package/dist/server/modules/order/types.d.ts +2 -0
  28. package/dist/solution/BaseSales/index.d.ts +1 -0
  29. package/dist/solution/BaseSales/index.js +5 -2
  30. package/dist/solution/BaseSales/types.d.ts +2 -2
  31. package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
  32. package/dist/solution/BookingTicket/index.d.ts +1 -2
  33. package/dist/solution/BookingTicket/index.js +60 -63
  34. package/dist/solution/BookingTicket/types.d.ts +5 -1
  35. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
  36. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
  37. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
  38. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
  39. package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
  40. package/dist/solution/ShopDiscount/index.d.ts +2 -0
  41. package/dist/solution/ShopDiscount/index.js +99 -42
  42. package/dist/solution/ShopDiscount/utils.d.ts +4 -2
  43. package/dist/solution/ShopDiscount/utils.js +43 -23
  44. package/dist/solution/UnifiedBookingSales/index.js +2 -2
  45. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
  46. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
  47. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
  48. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
  49. package/lib/modules/Customer/index.js +5 -1
  50. package/lib/modules/Customer/types.d.ts +2 -0
  51. package/lib/modules/Discount/availability.d.ts +7 -0
  52. package/lib/modules/Discount/availability.js +43 -0
  53. package/lib/modules/Discount/entitlementPass.d.ts +34 -0
  54. package/lib/modules/Discount/entitlementPass.js +141 -0
  55. package/lib/modules/Discount/index.d.ts +2 -2
  56. package/lib/modules/Discount/index.js +23 -129
  57. package/lib/modules/Discount/types.d.ts +36 -5
  58. package/lib/modules/Order/index.d.ts +6 -0
  59. package/lib/modules/Order/index.js +213 -40
  60. package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
  61. package/lib/modules/Order/utils.d.ts +1 -1
  62. package/lib/modules/Order/utils.js +39 -3
  63. package/lib/modules/Payment/types.d.ts +21 -1
  64. package/lib/modules/Payment/types.js +1 -0
  65. package/lib/modules/Payment/walletpass.d.ts +1 -1
  66. package/lib/modules/Payment/walletpass.js +29 -9
  67. package/lib/modules/Rules/index.d.ts +2 -2
  68. package/lib/modules/Rules/index.js +357 -110
  69. package/lib/modules/Rules/types.d.ts +4 -0
  70. package/lib/server/modules/order/types.d.ts +2 -0
  71. package/lib/solution/BaseSales/index.d.ts +1 -0
  72. package/lib/solution/BaseSales/index.js +5 -2
  73. package/lib/solution/BaseSales/types.d.ts +2 -2
  74. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
  75. package/lib/solution/BookingTicket/index.d.ts +1 -2
  76. package/lib/solution/BookingTicket/index.js +36 -33
  77. package/lib/solution/BookingTicket/types.d.ts +5 -1
  78. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
  79. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
  80. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
  81. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
  82. package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
  83. package/lib/solution/ShopDiscount/index.d.ts +2 -0
  84. package/lib/solution/ShopDiscount/index.js +55 -9
  85. package/lib/solution/ShopDiscount/utils.d.ts +4 -2
  86. package/lib/solution/ShopDiscount/utils.js +42 -25
  87. package/lib/solution/UnifiedBookingSales/index.js +2 -2
  88. package/package.json +1 -1
@@ -29,6 +29,10 @@ export interface RulesCalcDiscountOptions {
29
29
  discountId?: number;
30
30
  selectedList?: SetDiscountSelectedParams[];
31
31
  scan?: boolean;
32
+ /** 本次扫码优先使用的次卡实例;普通重算不传,继续保留商品行当前选择。 */
33
+ preferredEntitlementPassIds?: number[];
34
+ /** 普通重算保留商品行已应用的次卡;最优选择传 false 恢复自动排序。 */
35
+ preserveEntitlementSelection?: boolean;
32
36
  /** Change time 重报价目标行:允许已选编辑态折扣卡重新应用到这些 booking 商品。 */
33
37
  reapplyBookingDiscountProductUids?: string[];
34
38
  /** Reweighed order lines only: reapply selected wallet discounts against their new amount. */
@@ -36,6 +36,8 @@ export type OrderSurchargeType = string;
36
36
  export interface OrderProductDiscountMetadata {
37
37
  /** 设备端本地唯一标识,用于与服务端记录对齐 */
38
38
  unique_identification_number?: string;
39
+ /** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
40
+ balance?: number | null;
39
41
  [key: string]: unknown;
40
42
  }
41
43
  /**
@@ -415,6 +415,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
415
415
  refreshWalletAssets(params?: {
416
416
  order_wait_pay_amount?: number;
417
417
  preserveSelection?: boolean;
418
+ retainSearchResultCodes?: string[];
418
419
  }): Promise<WalletAssetsState>;
419
420
  /** 选择或取消单张钱包资产,并立即同步 pending wallet payments。 */
420
421
  selectWalletAsset(params: {
@@ -2815,7 +2815,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2815
2815
  (item.discount_list || []).forEach(function (discount) {
2816
2816
  var _discount$discount, _discount$metadata, _discount$discount2, _discount$discount3, _discount$discount4;
2817
2817
  var discountId = ((_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) || discount.id;
2818
- if (!discountId || !['good_pass', 'discount_card'].includes(discount.type)) return;
2818
+ if (!discountId || !['entitlement_pass', 'good_pass', 'discount_card'].includes(discount.type)) return;
2819
2819
  var quantity = item.quantity || item.num || item.product_quantity || 1;
2820
2820
  var savedAmount = new Decimal(discount.amount || 0).times(quantity).plus((discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata.product_discount_difference) || 0);
2821
2821
  var index = historyDiscountList.findIndex(function (n) {
@@ -3380,6 +3380,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3380
3380
  return resolveIsFormSubject(tempOrder, product);
3381
3381
  },
3382
3382
  orderTotalAmount: orderTotalAmount
3383
+ }, {
3384
+ preserveEntitlementSelection: false
3383
3385
  }) || result;
3384
3386
  if (result.productList) {
3385
3387
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
@@ -5213,7 +5215,8 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5213
5215
  return this.publishWalletAssetsState(clearedState);
5214
5216
  case 21:
5215
5217
  refreshTask = wallet.refreshWalletAssetsFromBusinessAsync(businessData, {
5216
- preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged
5218
+ preserveSelection: (params === null || params === void 0 ? void 0 : params.preserveSelection) !== false && !customerChanged,
5219
+ retainSearchResultCodes: params === null || params === void 0 ? void 0 : params.retainSearchResultCodes
5217
5220
  });
5218
5221
  _context47.next = 24;
5219
5222
  return this.publishWalletAssetsState(wallet.getWalletAssetsState());
@@ -445,10 +445,10 @@ export interface BaseSalesAddLogParams extends BaseSalesLogInput {
445
445
  /** BaseSales.scanPromotionCode 对外的轻量结果(UI 可用 getDiscountList 或 scannedDiscountList 补 Holder) */
446
446
  export interface BaseSalesScanCodeResult {
447
447
  isAvailable: boolean;
448
- /** 卡券已加入 Promotion;false 时可能是无效、过期或已使用。 */
448
+ /** 卡券已加入 Promotion;可能因次数、时间或当前订单条件而暂时无法应用。 */
449
449
  isAccepted?: boolean;
450
450
  type?: 'server' | string;
451
451
  unavailableReason?: 'time_limit' | string;
452
- /** batchSearch 原始结果;Holder 补全等流程可从这里读取原始卡券。 */
452
+ /** 扫码卡券资料及最新可用状态,供 Holder 补全等流程使用。 */
453
453
  scannedDiscountList?: Discount[];
454
454
  }
@@ -20,6 +20,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
20
20
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
21
  import Decimal from 'decimal.js';
22
22
  import { cloneDeep } from 'lodash-es';
23
+ import { isFullCoveragePass } from "../../../modules/Discount/entitlementPass";
23
24
  import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
24
25
  import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
25
26
 
@@ -472,7 +473,7 @@ function getProductLineNoteSignature(product) {
472
473
  var uid = getOrderProductUid(product);
473
474
  return uid ? "note:".concat(uid) : "note:".concat(normalizedNote);
474
475
  }
475
- function hasGoodPassDiscount(product) {
476
+ function getFullCoveragePassDiscountType(product) {
476
477
  var _product$_extend;
477
478
  var productBundle = Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle) ? product.product_bundle : [];
478
479
  var extendedBundle = Array.isArray(product === null || product === void 0 || (_product$_extend = product._extend) === null || _product$_extend === void 0 || (_product$_extend = _product$_extend.other) === null || _product$_extend === void 0 ? void 0 : _product$_extend.bundle) ? product._extend.other.bundle : [];
@@ -481,11 +482,23 @@ function hasGoodPassDiscount(product) {
481
482
  })), _toConsumableArray(extendedBundle.map(function (item) {
482
483
  return item === null || item === void 0 ? void 0 : item.discount_list;
483
484
  })));
484
- return discountLists.some(function (discountList) {
485
- return Array.isArray(discountList) && discountList.some(function (item) {
486
- return (item === null || item === void 0 ? void 0 : item.type) === 'good_pass' || (item === null || item === void 0 ? void 0 : item.tag) === 'good_pass';
487
- });
488
- });
485
+ var _iterator5 = _createForOfIteratorHelper(discountLists),
486
+ _step5;
487
+ try {
488
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
489
+ var discountList = _step5.value;
490
+ if (!Array.isArray(discountList)) continue;
491
+ var pass = discountList.find(function (item) {
492
+ return isFullCoveragePass(item);
493
+ });
494
+ if (pass) return String(pass.type || pass.tag);
495
+ }
496
+ } catch (err) {
497
+ _iterator5.e(err);
498
+ } finally {
499
+ _iterator5.f();
500
+ }
501
+ return null;
489
502
  }
490
503
 
491
504
  /**
@@ -499,8 +512,10 @@ function getPromotionLineMergeBoundary(product) {
499
512
  if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
500
513
  return "custom:".concat(getOrderProductUid(product));
501
514
  }
502
- if (hasGoodPassDiscount(product)) {
503
- return "good-pass:".concat(getOrderProductUid(product));
515
+ var fullCoveragePassType = getFullCoveragePassDiscountType(product);
516
+ if (fullCoveragePassType) {
517
+ var boundary = fullCoveragePassType === 'good_pass' ? 'good-pass' : 'entitlement-pass';
518
+ return "".concat(boundary, ":").concat(getOrderProductUid(product));
504
519
  }
505
520
  if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
506
521
  return "weighing:".concat(getOrderProductUid(product));
@@ -566,13 +581,13 @@ function consolidateMainProductsForPromotion(entries) {
566
581
  return _toConsumableArray(entries || []);
567
582
  }
568
583
  var groups = new Map();
569
- var _iterator5 = _createForOfIteratorHelper(entries),
570
- _step5;
584
+ var _iterator6 = _createForOfIteratorHelper(entries),
585
+ _step6;
571
586
  try {
572
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
573
- var _step5$value = _step5.value,
574
- item = _step5$value.item,
575
- originalListIndex = _step5$value.originalListIndex;
587
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
588
+ var _step6$value = _step6.value,
589
+ item = _step6$value.item,
590
+ originalListIndex = _step6$value.originalListIndex;
576
591
  var key = buildConsolidateKeyForPromotion(item);
577
592
  var wasInPromotion = wasInPromotionBeforeEvaluation(item);
578
593
  var existing = groups.get(key);
@@ -582,17 +597,17 @@ function consolidateMainProductsForPromotion(entries) {
582
597
  delete metadata._promotion;
583
598
  mergedItem.metadata = metadata;
584
599
  if (Array.isArray(mergedItem.product_bundle)) {
585
- var _iterator6 = _createForOfIteratorHelper(mergedItem.product_bundle),
586
- _step6;
600
+ var _iterator7 = _createForOfIteratorHelper(mergedItem.product_bundle),
601
+ _step7;
587
602
  try {
588
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
589
- var bundle = _step6.value;
603
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
604
+ var bundle = _step7.value;
590
605
  if (bundle && _typeof(bundle) === 'object') delete bundle._promotion;
591
606
  }
592
607
  } catch (err) {
593
- _iterator6.e(err);
608
+ _iterator7.e(err);
594
609
  } finally {
595
- _iterator6.f();
610
+ _iterator7.f();
596
611
  }
597
612
  }
598
613
  if (wasInPromotion) {
@@ -610,9 +625,9 @@ function consolidateMainProductsForPromotion(entries) {
610
625
  }
611
626
  }
612
627
  } catch (err) {
613
- _iterator5.e(err);
628
+ _iterator6.e(err);
614
629
  } finally {
615
- _iterator5.f();
630
+ _iterator6.f();
616
631
  }
617
632
  return Array.from(groups.values());
618
633
  }
@@ -625,12 +640,12 @@ function consolidateMainProductsForPromotion(entries) {
625
640
  */
626
641
  function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
627
642
  var result = [];
628
- var _iterator7 = _createForOfIteratorHelper(lines),
629
- _step7;
643
+ var _iterator8 = _createForOfIteratorHelper(lines),
644
+ _step8;
630
645
  try {
631
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
646
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
632
647
  var _line$metadata13, _actionMeta$actionDet;
633
- var line = _step7.value;
648
+ var line = _step8.value;
634
649
  var promo = line === null || line === void 0 || (_line$metadata13 = line.metadata) === null || _line$metadata13 === void 0 ? void 0 : _line$metadata13._promotion;
635
650
  if (!(promo !== null && promo !== void 0 && promo.inPromotion) || !promo.strategyId) {
636
651
  result.push(line);
@@ -660,9 +675,9 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
660
675
  }
661
676
  }
662
677
  } catch (err) {
663
- _iterator7.e(err);
678
+ _iterator8.e(err);
664
679
  } finally {
665
- _iterator7.f();
680
+ _iterator8.f();
666
681
  }
667
682
  return result;
668
683
  }
@@ -717,12 +732,12 @@ function calculateGiftActions(gifts, existingGifts) {
717
732
 
718
733
  // 按 strategyId 分组现有赠品
719
734
  var existingByStrategy = new Map();
720
- var _iterator8 = _createForOfIteratorHelper(existingGifts),
721
- _step8;
735
+ var _iterator9 = _createForOfIteratorHelper(existingGifts),
736
+ _step9;
722
737
  try {
723
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
738
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
724
739
  var _getGiftInfo, _gift$num;
725
- var gift = _step8.value;
740
+ var gift = _step9.value;
726
741
  var strategyId = (_getGiftInfo = getGiftInfo(gift)) === null || _getGiftInfo === void 0 ? void 0 : _getGiftInfo.strategyId;
727
742
  if (!strategyId) continue;
728
743
  var existing = existingByStrategy.get(strategyId);
@@ -738,17 +753,17 @@ function calculateGiftActions(gifts, existingGifts) {
738
753
  }
739
754
  }
740
755
  } catch (err) {
741
- _iterator8.e(err);
756
+ _iterator9.e(err);
742
757
  } finally {
743
- _iterator8.f();
758
+ _iterator9.f();
744
759
  }
745
760
  var processedStrategyIds = new Set();
746
- var _iterator9 = _createForOfIteratorHelper(gifts),
747
- _step9;
761
+ var _iterator10 = _createForOfIteratorHelper(gifts),
762
+ _step10;
748
763
  try {
749
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
764
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
750
765
  var _existing$totalQuanti;
751
- var giftInfo = _step9.value;
766
+ var giftInfo = _step10.value;
752
767
  var _strategyId = giftInfo.strategyId,
753
768
  strategyName = giftInfo.strategyName,
754
769
  giftCount = giftInfo.giftCount,
@@ -778,12 +793,12 @@ function calculateGiftActions(gifts, existingGifts) {
778
793
  var reduceItems = [];
779
794
  var removeIds = [];
780
795
  var reversed = _toConsumableArray((_existing === null || _existing === void 0 ? void 0 : _existing.items) || []).reverse();
781
- var _iterator11 = _createForOfIteratorHelper(reversed),
782
- _step11;
796
+ var _iterator12 = _createForOfIteratorHelper(reversed),
797
+ _step12;
783
798
  try {
784
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
799
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
785
800
  var _giftItem$num;
786
- var giftItem = _step11.value;
801
+ var giftItem = _step12.value;
787
802
  if (remaining <= 0) break;
788
803
  var uid = getOrderProductUid(giftItem);
789
804
  var _qty = Number((_giftItem$num = giftItem === null || giftItem === void 0 ? void 0 : giftItem.num) !== null && _giftItem$num !== void 0 ? _giftItem$num : 1) || 1;
@@ -800,9 +815,9 @@ function calculateGiftActions(gifts, existingGifts) {
800
815
  }
801
816
  }
802
817
  } catch (err) {
803
- _iterator11.e(err);
818
+ _iterator12.e(err);
804
819
  } finally {
805
- _iterator11.f();
820
+ _iterator12.f();
806
821
  }
807
822
  if (reduceItems.length > 0) toReduce.push({
808
823
  strategyId: _strategyId,
@@ -814,35 +829,35 @@ function calculateGiftActions(gifts, existingGifts) {
814
829
 
815
830
  // 失效策略的赠品:全部 remove
816
831
  } catch (err) {
817
- _iterator9.e(err);
832
+ _iterator10.e(err);
818
833
  } finally {
819
- _iterator9.f();
834
+ _iterator10.f();
820
835
  }
821
- var _iterator10 = _createForOfIteratorHelper(existingByStrategy),
822
- _step10;
836
+ var _iterator11 = _createForOfIteratorHelper(existingByStrategy),
837
+ _step11;
823
838
  try {
824
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
825
- var _step10$value = _slicedToArray(_step10.value, 2),
826
- _strategyId2 = _step10$value[0],
827
- _existing2 = _step10$value[1];
839
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
840
+ var _step11$value = _slicedToArray(_step11.value, 2),
841
+ _strategyId2 = _step11$value[0],
842
+ _existing2 = _step11$value[1];
828
843
  if (processedStrategyIds.has(_strategyId2)) continue;
829
- var _iterator12 = _createForOfIteratorHelper(_existing2.items),
830
- _step12;
844
+ var _iterator13 = _createForOfIteratorHelper(_existing2.items),
845
+ _step13;
831
846
  try {
832
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
833
- var _giftItem = _step12.value;
847
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
848
+ var _giftItem = _step13.value;
834
849
  toRemove.push(getOrderProductUid(_giftItem));
835
850
  }
836
851
  } catch (err) {
837
- _iterator12.e(err);
852
+ _iterator13.e(err);
838
853
  } finally {
839
- _iterator12.f();
854
+ _iterator13.f();
840
855
  }
841
856
  }
842
857
  } catch (err) {
843
- _iterator10.e(err);
858
+ _iterator11.e(err);
844
859
  } finally {
845
- _iterator10.f();
860
+ _iterator11.f();
846
861
  }
847
862
  return {
848
863
  toAdd: toAdd,
@@ -862,11 +877,11 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
862
877
  var _strategyConfig$condi;
863
878
  var rules = strategyConfig === null || strategyConfig === void 0 || (_strategyConfig$condi = strategyConfig.conditions) === null || _strategyConfig$condi === void 0 ? void 0 : _strategyConfig$condi.rules;
864
879
  if (!Array.isArray(rules)) return [];
865
- var _iterator13 = _createForOfIteratorHelper(rules),
866
- _step13;
880
+ var _iterator14 = _createForOfIteratorHelper(rules),
881
+ _step14;
867
882
  try {
868
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
869
- var rule = _step13.value;
883
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
884
+ var rule = _step14.value;
870
885
  if ((rule === null || rule === void 0 ? void 0 : rule.field) === 'productIdAndVariantId' && ((rule === null || rule === void 0 ? void 0 : rule.operator) === 'product_match' || (rule === null || rule === void 0 ? void 0 : rule.operator) === 'object_in') && Array.isArray(rule === null || rule === void 0 ? void 0 : rule.value)) {
871
886
  return rule.value.map(function (item) {
872
887
  return {
@@ -879,9 +894,9 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
879
894
  }
880
895
  }
881
896
  } catch (err) {
882
- _iterator13.e(err);
897
+ _iterator14.e(err);
883
898
  } finally {
884
- _iterator13.f();
899
+ _iterator14.f();
885
900
  }
886
901
  return [];
887
902
  }
@@ -970,11 +985,11 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
970
985
  if (_ret === 0) continue;
971
986
  }
972
987
  var result = [];
973
- var _iterator14 = _createForOfIteratorHelper(unfulfilledMap.values()),
974
- _step14;
988
+ var _iterator15 = _createForOfIteratorHelper(unfulfilledMap.values()),
989
+ _step15;
975
990
  try {
976
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
977
- var data = _step14.value;
991
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
992
+ var data = _step15.value;
978
993
  var needQuantity = data.requiredQuantity - data.currentQuantity;
979
994
  if (needQuantity > 0) {
980
995
  result.push(_objectSpread(_objectSpread({}, data), {}, {
@@ -983,9 +998,9 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
983
998
  }
984
999
  }
985
1000
  } catch (err) {
986
- _iterator14.e(err);
1001
+ _iterator15.e(err);
987
1002
  } finally {
988
- _iterator14.f();
1003
+ _iterator15.f();
989
1004
  }
990
1005
  return result;
991
1006
  }
@@ -1025,11 +1040,11 @@ export function appendPromotionTags(products, evaluator) {
1025
1040
  var data = strategies[index];
1026
1041
  var tags = [];
1027
1042
  if (data !== null && data !== void 0 && data.hasApplicableStrategy) {
1028
- var _iterator15 = _createForOfIteratorHelper(data.applicableStrategies),
1029
- _step15;
1043
+ var _iterator16 = _createForOfIteratorHelper(data.applicableStrategies),
1044
+ _step16;
1030
1045
  try {
1031
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1032
- var strategy = _step15.value;
1046
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1047
+ var strategy = _step16.value;
1033
1048
  if (strategy.display) {
1034
1049
  tags.push({
1035
1050
  text: strategy.display.text,
@@ -1039,9 +1054,9 @@ export function appendPromotionTags(products, evaluator) {
1039
1054
  }
1040
1055
  }
1041
1056
  } catch (err) {
1042
- _iterator15.e(err);
1057
+ _iterator16.e(err);
1043
1058
  } finally {
1044
- _iterator15.f();
1059
+ _iterator16.f();
1045
1060
  }
1046
1061
  }
1047
1062
  // 商品卡兼容两种位置:顶层 `_promotionTags` 与 `metadata._promotionTags`
@@ -1144,18 +1159,18 @@ export function processCartPromotion(list, evaluator, options) {
1144
1159
  });
1145
1160
  if (existingGifts.length > 0) {
1146
1161
  var toRemove = [];
1147
- var _iterator16 = _createForOfIteratorHelper(existingGifts),
1148
- _step16;
1162
+ var _iterator17 = _createForOfIteratorHelper(existingGifts),
1163
+ _step17;
1149
1164
  try {
1150
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1151
- var gift = _step16.value;
1165
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1166
+ var gift = _step17.value;
1152
1167
  var uid = getOrderProductUid(gift);
1153
1168
  if (uid) toRemove.push(uid);
1154
1169
  }
1155
1170
  } catch (err) {
1156
- _iterator16.e(err);
1171
+ _iterator17.e(err);
1157
1172
  } finally {
1158
- _iterator16.f();
1173
+ _iterator17.f();
1159
1174
  }
1160
1175
  return {
1161
1176
  products: editProducts,
@@ -1209,16 +1224,16 @@ export function processCartPromotion(list, evaluator, options) {
1209
1224
  channel: options === null || options === void 0 ? void 0 : options.channel
1210
1225
  });
1211
1226
  var strategyActionMap = new Map();
1212
- var _iterator17 = _createForOfIteratorHelper(applicableStrategiesResult || []),
1213
- _step17;
1227
+ var _iterator18 = _createForOfIteratorHelper(applicableStrategiesResult || []),
1228
+ _step18;
1214
1229
  try {
1215
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1216
- var row = _step17.value;
1217
- var _iterator22 = _createForOfIteratorHelper((row === null || row === void 0 ? void 0 : row.applicableStrategies) || []),
1218
- _step22;
1230
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1231
+ var row = _step18.value;
1232
+ var _iterator23 = _createForOfIteratorHelper((row === null || row === void 0 ? void 0 : row.applicableStrategies) || []),
1233
+ _step23;
1219
1234
  try {
1220
- for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
1221
- var strategy = _step22.value;
1235
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
1236
+ var strategy = _step23.value;
1222
1237
  if (!(strategy !== null && strategy !== void 0 && strategy.strategyId)) continue;
1223
1238
  strategyActionMap.set(strategy.strategyId, {
1224
1239
  actionType: strategy.actionType,
@@ -1226,17 +1241,17 @@ export function processCartPromotion(list, evaluator, options) {
1226
1241
  });
1227
1242
  }
1228
1243
  } catch (err) {
1229
- _iterator22.e(err);
1244
+ _iterator23.e(err);
1230
1245
  } finally {
1231
- _iterator22.f();
1246
+ _iterator23.f();
1232
1247
  }
1233
1248
  }
1234
1249
 
1235
1250
  // 3. 评估器
1236
1251
  } catch (err) {
1237
- _iterator17.e(err);
1252
+ _iterator18.e(err);
1238
1253
  } finally {
1239
- _iterator17.f();
1254
+ _iterator18.f();
1240
1255
  }
1241
1256
  var result = evaluator.evaluateCartWithPricing({
1242
1257
  products: promotionProducts,
@@ -1245,11 +1260,11 @@ export function processCartPromotion(list, evaluator, options) {
1245
1260
 
1246
1261
  // 4. 收集每个策略的 sourceProductIds(参与策略的主商品 uid)
1247
1262
  var strategySourceProductIds = new Map();
1248
- var _iterator18 = _createForOfIteratorHelper(result.products),
1249
- _step18;
1263
+ var _iterator19 = _createForOfIteratorHelper(result.products),
1264
+ _step19;
1250
1265
  try {
1251
- for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1252
- var priced = _step18.value;
1266
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1267
+ var priced = _step19.value;
1253
1268
  if (priced.inPromotion && priced.strategyId) {
1254
1269
  var _priced$originalId;
1255
1270
  var sourceId = (_priced$originalId = priced.originalId) !== null && _priced$originalId !== void 0 ? _priced$originalId : priced.id;
@@ -1266,9 +1281,9 @@ export function processCartPromotion(list, evaluator, options) {
1266
1281
 
1267
1282
  // 5. 扩展 gifts,加 sourceProductIds
1268
1283
  } catch (err) {
1269
- _iterator18.e(err);
1284
+ _iterator19.e(err);
1270
1285
  } finally {
1271
- _iterator18.f();
1286
+ _iterator19.f();
1272
1287
  }
1273
1288
  var extendedGifts = result.gifts.map(function (gift) {
1274
1289
  return _objectSpread(_objectSpread({}, gift), {}, {
@@ -1278,26 +1293,26 @@ export function processCartPromotion(list, evaluator, options) {
1278
1293
 
1279
1294
  // 6. PricedProduct → OrderProduct(含拆分与价格调整)
1280
1295
  var strategyGiftInfoMap = new Map();
1281
- var _iterator19 = _createForOfIteratorHelper(extendedGifts),
1282
- _step19;
1296
+ var _iterator20 = _createForOfIteratorHelper(extendedGifts),
1297
+ _step20;
1283
1298
  try {
1284
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1285
- var _gift = _step19.value;
1299
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1300
+ var _gift = _step20.value;
1286
1301
  strategyGiftInfoMap.set(_gift.strategyId, _gift);
1287
1302
  }
1288
1303
  } catch (err) {
1289
- _iterator19.e(err);
1304
+ _iterator20.e(err);
1290
1305
  } finally {
1291
- _iterator19.f();
1306
+ _iterator20.f();
1292
1307
  }
1293
1308
  var strategyGiftInfoOwner = new Map();
1294
1309
  var processedProducts = [];
1295
- var _iterator20 = _createForOfIteratorHelper(result.products),
1296
- _step20;
1310
+ var _iterator21 = _createForOfIteratorHelper(result.products),
1311
+ _step21;
1297
1312
  try {
1298
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1313
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1299
1314
  var _priced$originalId2, _priced$product_id, _originalItem$product;
1300
- var _priced = _step20.value;
1315
+ var _priced = _step21.value;
1301
1316
  var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
1302
1317
  var _sourceId = Number(rawSourceId);
1303
1318
  var _originalData = Number.isFinite(_sourceId) ? originalItemMap.get(_sourceId) : undefined;
@@ -1318,17 +1333,17 @@ export function processCartPromotion(list, evaluator, options) {
1318
1333
  var wasInPromotion = wasInPromotionBeforeEvaluation(originalItem) || originalItem._wasInPromotionBeforeConsolidate === true;
1319
1334
  delete metadata._promotion;
1320
1335
  if (Array.isArray(newItem.product_bundle)) {
1321
- var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
1322
- _step23;
1336
+ var _iterator24 = _createForOfIteratorHelper(newItem.product_bundle),
1337
+ _step24;
1323
1338
  try {
1324
- for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
1325
- var b = _step23.value;
1339
+ for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
1340
+ var b = _step24.value;
1326
1341
  if (b && _typeof(b) === 'object') delete b._promotion;
1327
1342
  }
1328
1343
  } catch (err) {
1329
- _iterator23.e(err);
1344
+ _iterator24.e(err);
1330
1345
  } finally {
1331
- _iterator23.f();
1346
+ _iterator24.f();
1332
1347
  }
1333
1348
  }
1334
1349
  var originalBasePrice = getOrderProductOriginalPriceForPromotion(originalItem);
@@ -1414,9 +1429,9 @@ export function processCartPromotion(list, evaluator, options) {
1414
1429
 
1415
1430
  // 7. 赠品/编辑商品原样拼回;同时同步赠品的 sourceProductIds / sourceProductId
1416
1431
  } catch (err) {
1417
- _iterator20.e(err);
1432
+ _iterator21.e(err);
1418
1433
  } finally {
1419
- _iterator20.f();
1434
+ _iterator21.f();
1420
1435
  }
1421
1436
  for (var _i2 = 0, _existingGiftsWithInd = existingGiftsWithIndex; _i2 < _existingGiftsWithInd.length; _i2++) {
1422
1437
  var _getGiftInfo3;
@@ -1500,12 +1515,12 @@ export function processCartPromotion(list, evaluator, options) {
1500
1515
  var giftActions = calculateGiftActions(extendedGifts, existingGifts);
1501
1516
 
1502
1517
  // 10.1 更新 lastEvaluatedGiftCount,便于下次评估时判别「策略已变」
1503
- var _iterator21 = _createForOfIteratorHelper(existingGifts),
1504
- _step21;
1518
+ var _iterator22 = _createForOfIteratorHelper(existingGifts),
1519
+ _step22;
1505
1520
  try {
1506
- for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1521
+ for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
1507
1522
  var _getGiftInfo4, _metadata;
1508
- var _gift3 = _step21.value;
1523
+ var _gift3 = _step22.value;
1509
1524
  var _strategyId3 = (_getGiftInfo4 = getGiftInfo(_gift3)) === null || _getGiftInfo4 === void 0 ? void 0 : _getGiftInfo4.strategyId;
1510
1525
  if (!_strategyId3) continue;
1511
1526
  var _latest = strategyGiftInfoMap.get(_strategyId3);
@@ -1516,9 +1531,9 @@ export function processCartPromotion(list, evaluator, options) {
1516
1531
 
1517
1532
  // 11. 未满足促销
1518
1533
  } catch (err) {
1519
- _iterator21.e(err);
1534
+ _iterator22.e(err);
1520
1535
  } finally {
1521
- _iterator21.f();
1536
+ _iterator22.f();
1522
1537
  }
1523
1538
  var unfulfilledPromotions = calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts);
1524
1539
 
@@ -32,6 +32,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
32
32
  private orderCustomerDiscountRefreshCustomerId;
33
33
  private orderCustomerDiscountRefreshTarget;
34
34
  private orderCustomerPromotionRefreshInFlight;
35
+ private readonly customerResolveRequests;
35
36
  protected loadOpenDataInFlight: Promise<OpenDataConfig> | null;
36
37
  protected loadOpenDataInFlightTarget: string | null;
37
38
  protected openDataTarget: string | null;
@@ -80,10 +81,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
80
81
  resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
81
82
  /** 兼容既有优惠码扫码逻辑。 */
82
83
  private resolveCustomerByDiscountCustomerId;
83
- private findCustomerById;
84
84
  private normalizeCustomer;
85
85
  private getRawCustomerId;
86
- private hasUsableCustomerDetails;
87
86
  /**
88
87
  * 更新当前预约的 appointment_status。
89
88
  *