@pisell/pisellos 2.3.102 → 2.3.103

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.
@@ -117,7 +117,7 @@ export interface OrderLastGiftActions {
117
117
  }>;
118
118
  toRemove: string[];
119
119
  }
120
- /** onPromotionApplied 事件 payload */
120
+ /** onPromotionApplied 稳定态事件 payload(促销、折扣与 summary 均已完成)。 */
121
121
  export interface OrderPromotionAppliedPayload {
122
122
  unfulfilledPromotions: OrderUnfulfilledPromotion[];
123
123
  giftActions: OrderLastGiftActions;
@@ -131,7 +131,7 @@ export interface OrderPromotionAppliedPayload {
131
131
  product_variant_id: number;
132
132
  }>;
133
133
  }>;
134
- /** 处理后的商品列表 */
134
+ /** 折扣重算后的最终商品列表 */
135
135
  products: OrderProduct[];
136
136
  }
137
137
  /**
@@ -979,7 +979,7 @@ export interface OrderModuleAPI {
979
979
  */
980
980
  appendPromotionTags: <T extends Record<string, any>>(products: T[]) => T[];
981
981
  /**
982
- * 应用购物车促销(评估 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied)。
982
+ * 应用购物车促销(评估 → 差异化赠品 → 折扣/summary 重算 → emit onPromotionApplied)。
983
983
  *
984
984
  * 自动在 addProductToOrder / updateOrderProductQuantity / removeProductFromOrder /
985
985
  * clearOrderCartLines / setOrderCustomer 等写路径末尾触发,业务一般无需手动调用。
@@ -41,7 +41,7 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
41
41
 
42
42
  /** 上一次 applyPromotion 计算出的赠品操作(仅供调试/读取使用) */
43
43
 
44
- /** onPromotionApplied 事件 payload */
44
+ /** onPromotionApplied 稳定态事件 payload(促销、折扣与 summary 均已完成)。 */
45
45
 
46
46
  /**
47
47
  * tempOrder 上的下单客户协议字段视图。
@@ -2767,7 +2767,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2767
2767
  value: function () {
2768
2768
  var _loadDiscountConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
2769
2769
  var _this$getOrderIdentit, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _discountModule$getDi, _discountModule$getOr, _discountModule$getDi2;
2770
- var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, preparedDiscountList, _discountModule$setOr, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
2770
+ var tempOrder, orderStore, discountModule, rulesModule, orderId, customerId, currentDiscountList, originalDiscountList, hasManualDiscountSelection, discountAction, discountConfigCacheKey, searchedDiscountList, searchedDiscountIds, preparedDiscountList, _discountModule$setOr, _discountModule$setOr2, _discountModule$setDi, nextDiscountList, shouldSkipAutoApplyFetchedDiscounts, _summary, _orderStore$summary, orderTotalAmount, result, _iterator3, _step3, _product$metadata5, _tempOrder$_extend3, _product$metadata$sou, _product$metadata6, _product$metadata7, _product$original_pri, product, productUid, runtimeOrigin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, summary;
2771
2771
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2772
2772
  while (1) switch (_context25.prev = _context25.next) {
2773
2773
  case 0:
@@ -2789,43 +2789,52 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2789
2789
  return discount.isManualSelect;
2790
2790
  });
2791
2791
  discountAction = (params === null || params === void 0 ? void 0 : params.action) || (orderId ? 'edit' : 'create');
2792
- discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':');
2793
- preparedDiscountList = [];
2792
+ discountConfigCacheKey = [customerId, discountAction, Number(orderId) || 0].join(':'); // Walk-In 不请求 prepare config;当前搜索/扫码券必须继续参与本次重算。
2793
+ // current 优先于 original,保留搜索后的最新选择与可用状态。
2794
+ searchedDiscountList = currentDiscountList.filter(function (discount) {
2795
+ return discount.isScan;
2796
+ });
2797
+ searchedDiscountIds = new Set(searchedDiscountList.map(function (discount) {
2798
+ return String(discount.id);
2799
+ }));
2800
+ preparedDiscountList = [].concat(_toConsumableArray(searchedDiscountList), _toConsumableArray(originalDiscountList.filter(function (discount) {
2801
+ return !searchedDiscountIds.has(String(discount.id));
2802
+ })));
2794
2803
  if (!(customerId && customerId !== 1)) {
2795
- _context25.next = 25;
2804
+ _context25.next = 27;
2796
2805
  break;
2797
2806
  }
2798
2807
  if (!(!(params !== null && params !== void 0 && params.force) && this.discountConfigCacheKey === discountConfigCacheKey)) {
2799
- _context25.next = 19;
2808
+ _context25.next = 21;
2800
2809
  break;
2801
2810
  }
2802
2811
  preparedDiscountList = originalDiscountList;
2803
- _context25.next = 25;
2812
+ _context25.next = 27;
2804
2813
  break;
2805
- case 19:
2806
- _context25.next = 21;
2814
+ case 21:
2815
+ _context25.next = 23;
2807
2816
  return this.store.order.loadDiscountConfig({
2808
2817
  customerId: customerId,
2809
2818
  action: discountAction,
2810
2819
  orderId: Number(orderId) || undefined,
2811
2820
  apply: false
2812
2821
  });
2813
- case 21:
2822
+ case 23:
2814
2823
  preparedDiscountList = _context25.sent;
2815
2824
  this.discountConfigCacheKey = discountConfigCacheKey;
2816
- _context25.next = 25;
2825
+ _context25.next = 27;
2817
2826
  return discountModule === null || discountModule === void 0 || (_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, preparedDiscountList);
2818
- case 25:
2827
+ case 27:
2819
2828
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
2820
- _context25.next = 33;
2829
+ _context25.next = 35;
2821
2830
  break;
2822
2831
  }
2823
- _context25.next = 28;
2824
- return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
2825
- case 28:
2826
2832
  _context25.next = 30;
2827
- return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
2833
+ return discountModule === null || discountModule === void 0 || (_discountModule$setOr2 = discountModule.setOriginalDiscountList) === null || _discountModule$setOr2 === void 0 ? void 0 : _discountModule$setOr2.call(discountModule, []);
2828
2834
  case 30:
2835
+ _context25.next = 32;
2836
+ return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, []);
2837
+ case 32:
2829
2838
  tempOrder.discount_list = [];
2830
2839
  tempOrder.shop_discount = '0.00';
2831
2840
  return _context25.abrupt("return", {
@@ -2834,9 +2843,9 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2834
2843
  availableWalletIds: this.getAvailableWalletIds(),
2835
2844
  virtualCurrencyList: this.store.order.getVirtualCurrencyList()
2836
2845
  });
2837
- case 33:
2846
+ case 35:
2838
2847
  if (!(hasManualDiscountSelection && currentDiscountList.length)) {
2839
- _context25.next = 35;
2848
+ _context25.next = 37;
2840
2849
  break;
2841
2850
  }
2842
2851
  return _context25.abrupt("return", {
@@ -2845,12 +2854,12 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2845
2854
  availableWalletIds: this.getAvailableWalletIds(),
2846
2855
  virtualCurrencyList: this.store.order.getVirtualCurrencyList()
2847
2856
  });
2848
- case 35:
2857
+ case 37:
2849
2858
  nextDiscountList = this.mergeHistoricalDiscountList(preparedDiscountList || (discountModule === null || discountModule === void 0 || (_discountModule$getDi2 = discountModule.getDiscountList) === null || _discountModule$getDi2 === void 0 ? void 0 : _discountModule$getDi2.call(discountModule)) || [], tempOrder.products || []);
2850
2859
  nextDiscountList = this.mergeCurrentDiscountSelectionState(nextDiscountList, currentDiscountList);
2851
- _context25.next = 39;
2860
+ _context25.next = 41;
2852
2861
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2853
- case 39:
2862
+ case 41:
2854
2863
  shouldSkipAutoApplyFetchedDiscounts = this.shouldSkipAutoApplyFetchedDiscountsInEditMode({
2855
2864
  discountAction: discountAction,
2856
2865
  products: tempOrder.products || [],
@@ -2858,33 +2867,33 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2858
2867
  nextDiscountList: nextDiscountList
2859
2868
  });
2860
2869
  if (!shouldSkipAutoApplyFetchedDiscounts) {
2861
- _context25.next = 48;
2870
+ _context25.next = 50;
2862
2871
  break;
2863
2872
  }
2864
- _context25.next = 43;
2873
+ _context25.next = 45;
2865
2874
  return this.store.order.recalculateSummary({
2866
2875
  createIfMissing: true
2867
2876
  });
2868
- case 43:
2877
+ case 45:
2869
2878
  _summary = _context25.sent;
2870
2879
  this.store.order.persistTempOrder();
2871
- _context25.next = 47;
2880
+ _context25.next = 49;
2872
2881
  return this.effectsEmit('onDiscountApplied', {
2873
2882
  productList: tempOrder.products || [],
2874
2883
  discountList: nextDiscountList,
2875
2884
  selectedDiscountList: tempOrder.discount_list || [],
2876
2885
  tempOrder: tempOrder
2877
2886
  });
2878
- case 47:
2887
+ case 49:
2879
2888
  return _context25.abrupt("return", {
2880
2889
  productList: tempOrder.products || [],
2881
2890
  discountList: nextDiscountList,
2882
2891
  availableWalletIds: this.getAvailableWalletIds(),
2883
2892
  virtualCurrencyList: this.store.order.getVirtualCurrencyList()
2884
2893
  });
2885
- case 48:
2894
+ case 50:
2886
2895
  if (!rulesModule) {
2887
- _context25.next = 84;
2896
+ _context25.next = 86;
2888
2897
  break;
2889
2898
  }
2890
2899
  orderTotalAmount = Number(((_orderStore$summary = orderStore.summary) === null || _orderStore$summary === void 0 ? void 0 : _orderStore$summary.total_amount) || 0);
@@ -2904,22 +2913,22 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2904
2913
  tempOrder.products = preserveManualProductDiscountProducts(tempOrder.products, result.productList);
2905
2914
  }
2906
2915
  _iterator3 = _createForOfIteratorHelper(tempOrder.products || []);
2907
- _context25.prev = 53;
2916
+ _context25.prev = 55;
2908
2917
  _iterator3.s();
2909
- case 55:
2918
+ case 57:
2910
2919
  if ((_step3 = _iterator3.n()).done) {
2911
- _context25.next = 70;
2920
+ _context25.next = 72;
2912
2921
  break;
2913
2922
  }
2914
2923
  product = _step3.value;
2915
2924
  productUid = (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number;
2916
2925
  runtimeOrigin = productUid ? (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[productUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin : undefined;
2917
2926
  if (!(runtimeOrigin !== null && runtimeOrigin !== void 0 && runtimeOrigin.isManualDiscount || isBaseSalesManualProductDiscountProduct(product))) {
2918
- _context25.next = 61;
2927
+ _context25.next = 63;
2919
2928
  break;
2920
2929
  }
2921
- return _context25.abrupt("continue", 68);
2922
- case 61:
2930
+ return _context25.abrupt("continue", 70);
2931
+ case 63:
2923
2932
  totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
2924
2933
  return sum + Number(pd.amount || 0);
2925
2934
  }, 0);
@@ -2935,60 +2944,60 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
2935
2944
  mainPrice: newMainSellingPrice,
2936
2945
  bundle: product.product_bundle
2937
2946
  });
2938
- case 68:
2939
- _context25.next = 55;
2940
- break;
2941
2947
  case 70:
2942
- _context25.next = 75;
2948
+ _context25.next = 57;
2943
2949
  break;
2944
2950
  case 72:
2945
- _context25.prev = 72;
2946
- _context25.t0 = _context25["catch"](53);
2951
+ _context25.next = 77;
2952
+ break;
2953
+ case 74:
2954
+ _context25.prev = 74;
2955
+ _context25.t0 = _context25["catch"](55);
2947
2956
  _iterator3.e(_context25.t0);
2948
- case 75:
2949
- _context25.prev = 75;
2957
+ case 77:
2958
+ _context25.prev = 77;
2950
2959
  _iterator3.f();
2951
- return _context25.finish(75);
2952
- case 78:
2960
+ return _context25.finish(77);
2961
+ case 80:
2953
2962
  if (!result.discountList) {
2954
- _context25.next = 84;
2963
+ _context25.next = 86;
2955
2964
  break;
2956
2965
  }
2957
2966
  nextDiscountList = this.mergeHistoricalDiscountList(result.discountList, tempOrder.products || []);
2958
2967
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
2959
- _context25.next = 83;
2968
+ _context25.next = 85;
2960
2969
  return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
2961
- case 83:
2970
+ case 85:
2962
2971
  tempOrder.discount_list = nextDiscountList.filter(function (discount) {
2963
2972
  return discount.isSelected;
2964
2973
  });
2965
- case 84:
2966
- _context25.next = 86;
2974
+ case 86:
2975
+ _context25.next = 88;
2967
2976
  return this.store.order.recalculateSummary({
2968
2977
  createIfMissing: true
2969
2978
  });
2970
- case 86:
2979
+ case 88:
2971
2980
  summary = _context25.sent;
2972
2981
  this.store.order.persistTempOrder();
2973
- _context25.next = 90;
2982
+ _context25.next = 92;
2974
2983
  return this.effectsEmit('onDiscountApplied', {
2975
2984
  productList: tempOrder.products || [],
2976
2985
  discountList: nextDiscountList,
2977
2986
  selectedDiscountList: tempOrder.discount_list || [],
2978
2987
  tempOrder: tempOrder
2979
2988
  });
2980
- case 90:
2989
+ case 92:
2981
2990
  return _context25.abrupt("return", {
2982
2991
  productList: tempOrder.products || [],
2983
2992
  discountList: nextDiscountList,
2984
2993
  availableWalletIds: this.getAvailableWalletIds(),
2985
2994
  virtualCurrencyList: this.store.order.getVirtualCurrencyList()
2986
2995
  });
2987
- case 91:
2996
+ case 93:
2988
2997
  case "end":
2989
2998
  return _context25.stop();
2990
2999
  }
2991
- }, _callee25, this, [[53, 72, 75, 78]]);
3000
+ }, _callee25, this, [[55, 74, 77, 80]]);
2992
3001
  }));
2993
3002
  function loadDiscountConfig(_x17) {
2994
3003
  return _loadDiscountConfig.apply(this, arguments);
@@ -4458,7 +4467,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4458
4467
  if (this.store.payment) {
4459
4468
  var committed = this.getCommittedWalletAssets();
4460
4469
  var state = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
4461
- void this.publishWalletAssetsState(state);
4470
+ void this.publishWalletAssetsState(state, 'local');
4462
4471
  }
4463
4472
  return payments;
4464
4473
  }
@@ -4663,16 +4672,20 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4663
4672
  key: "publishWalletAssetsState",
4664
4673
  value: function () {
4665
4674
  var _publishWalletAssetsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(state) {
4675
+ var changeSource,
4676
+ _args43 = arguments;
4666
4677
  return _regeneratorRuntime().wrap(function _callee43$(_context43) {
4667
4678
  while (1) switch (_context43.prev = _context43.next) {
4668
4679
  case 0:
4669
- _context43.next = 2;
4680
+ changeSource = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : 'derived';
4681
+ _context43.next = 3;
4670
4682
  return this.effectsEmit(BaseSalesHookNames.onWalletAssetsStateChanged, {
4671
- state: state
4683
+ state: state,
4684
+ changeSource: changeSource
4672
4685
  });
4673
- case 2:
4674
- return _context43.abrupt("return", state);
4675
4686
  case 3:
4687
+ return _context43.abrupt("return", state);
4688
+ case 4:
4676
4689
  case "end":
4677
4690
  return _context43.stop();
4678
4691
  }
@@ -4929,7 +4942,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4929
4942
  _context47.next = 5;
4930
4943
  return this.syncSelectedWalletAssets(state);
4931
4944
  case 5:
4932
- return _context47.abrupt("return", this.publishWalletAssetsState(state));
4945
+ return _context47.abrupt("return", this.publishWalletAssetsState(state, 'local'));
4933
4946
  case 6:
4934
4947
  case "end":
4935
4948
  return _context47.stop();
@@ -4959,7 +4972,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
4959
4972
  _context48.next = 5;
4960
4973
  return this.syncSelectedWalletAssets(state);
4961
4974
  case 5:
4962
- return _context48.abrupt("return", this.publishWalletAssetsState(state));
4975
+ return _context48.abrupt("return", this.publishWalletAssetsState(state, 'local'));
4963
4976
  case 6:
4964
4977
  case "end":
4965
4978
  return _context48.stop();
@@ -5002,7 +5015,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5002
5015
  return this.syncSelectedWalletAssets(result.state);
5003
5016
  case 11:
5004
5017
  _context49.next = 13;
5005
- return this.publishWalletAssetsState(result.state);
5018
+ return this.publishWalletAssetsState(result.state, 'local');
5006
5019
  case 13:
5007
5020
  return _context49.abrupt("return", result);
5008
5021
  case 14:
@@ -5034,7 +5047,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5034
5047
  _context50.next = 5;
5035
5048
  return this.syncSelectedWalletAssets(state);
5036
5049
  case 5:
5037
- return _context50.abrupt("return", this.publishWalletAssetsState(state));
5050
+ return _context50.abrupt("return", this.publishWalletAssetsState(state, 'local'));
5038
5051
  case 6:
5039
5052
  case "end":
5040
5053
  return _context50.stop();
@@ -5265,7 +5278,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5265
5278
  committed = this.getCommittedWalletAssets();
5266
5279
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5267
5280
  _context53.next = 33;
5268
- return this.publishWalletAssetsState(walletState);
5281
+ return this.publishWalletAssetsState(walletState, 'local');
5269
5282
  case 33:
5270
5283
  _context53.next = 38;
5271
5284
  break;
@@ -5411,7 +5424,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5411
5424
  committed = this.getCommittedWalletAssets();
5412
5425
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5413
5426
  _context54.next = 40;
5414
- return this.publishWalletAssetsState(walletState);
5427
+ return this.publishWalletAssetsState(walletState, 'local');
5415
5428
  case 40:
5416
5429
  return _context54.abrupt("return", {
5417
5430
  payment: payment || {},
@@ -5573,7 +5586,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
5573
5586
  committed = this.getCommittedWalletAssets();
5574
5587
  walletState = this.store.payment.wallet.setCommittedWalletAssets(committed.ids, committed.assets);
5575
5588
  _context55.next = 41;
5576
- return this.publishWalletAssetsState(walletState);
5589
+ return this.publishWalletAssetsState(walletState, 'local');
5577
5590
  case 41:
5578
5591
  return _context55.abrupt("return", {
5579
5592
  payment: payment || {},
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -345,7 +345,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
345
345
  count: number;
346
346
  left: number;
347
347
  summaryCount: number;
348
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
348
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
349
349
  }[];
350
350
  /**
351
351
  * 找到多个资源的公共可用时间段
@@ -181,6 +181,7 @@ function buildCacheItemFromOrderLine(input) {
181
181
  booking,
182
182
  sourceProduct
183
183
  } = input;
184
+ const holderConfig = sourceProduct?.holder_config ?? sourceProduct?.origin?.holder_config ?? product.metadata?.holder_config;
184
185
  const resolvedId = product.product_id ?? sourceProduct?.id;
185
186
  const selling = Number(product.selling_price ?? 0);
186
187
  const original = Number(product.original_price ?? selling);
@@ -249,6 +250,9 @@ function buildCacheItemFromOrderLine(input) {
249
250
  }
250
251
  const base = {
251
252
  ...(sourceProduct || {}),
253
+ ...(holderConfig !== undefined && holderConfig !== null ? {
254
+ holder_config: holderConfig
255
+ } : {}),
252
256
  id: resolvedId,
253
257
  product_id: resolvedId,
254
258
  extension_type: sourceProduct?.extension_type ?? booking?.product?.extension_type ?? sourceProduct?.extension_type,
@@ -29,8 +29,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
29
29
  private promotionEvaluator;
30
30
  /** 赠品选择 resolver;由 SDK host bridge 注入 */
31
31
  private giftSelectResolver;
32
- /** applyPromotion 递归保护 flag(写路径同步调 applyPromotion,禁止重入) */
32
+ /** 促销评估递归保护 flag(写路径同步评估促销,禁止重入) */
33
33
  private isApplyingPromotion;
34
+ /** 保持旧事件语义:同步事件监听器内触发的订单写入不得递归评估促销。 */
35
+ private isEmittingPromotionApplied;
34
36
  /** 商品曾应用过客户券卡,客户变更剥离后需强制跑一次 calcDiscount 复位价格 */
35
37
  private hasActiveCustomerBoundDiscount;
36
38
  /** 最近一次 applyPromotion 的未满足促销提示 */
@@ -124,7 +126,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
124
126
  */
125
127
  appendPromotionTags<T extends Record<string, any>>(products: T[]): T[];
126
128
  /**
127
- * 应用购物车促销:计算 → 差异化赠品 → 写回 tempOrder.products → emit onPromotionApplied。
129
+ * 只执行购物车促销评估与赠品写回,不发布稳定态事件。
128
130
  *
129
131
  * 调用时机:写路径(add/update/remove/clear/setCustomer)末尾自动触发;外部一般无需手动调。
130
132
  *
@@ -132,8 +134,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
132
134
  * - 不调用任何公开 CRUD API(如 removeProductFromOrder),全部内部 mutate tempOrder.products,避免事件风暴;
133
135
  * - 用 `isApplyingPromotion` 防递归;
134
136
  * - 多选项赠品依赖 giftSelectResolver,未注入则跳过且 console.warn;
135
- * - 不主动调用 applyDiscount / recalculateSummary,调用方负责跟进。
137
+ * - 不主动调用 applyDiscount / recalculateSummary,调用方负责跟进;
138
+ * - 返回的 payload 只能在 applyDiscount(商品写路径还需 summary/persist)完成后发布。
136
139
  */
140
+ private evaluatePromotion;
141
+ /** 发布促销稳定态;products 必须读取折扣计算后的当前数组。 */
142
+ private emitPromotionApplied;
143
+ /** 公开入口:促销、折扣、summary 与持久化完成后发布稳定态事件。 */
137
144
  applyPromotion(): Promise<void>;
138
145
  /** 最近一次 applyPromotion 输出的未满足促销列表 */
139
146
  getUnfulfilledPromotions(): OrderUnfulfilledPromotion[];
@@ -430,6 +437,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
430
437
  * if (pending) await pending;
431
438
  */
432
439
  private appendProductLineToTempOrder;
440
+ /**
441
+ * booking 数量拆行时,若 Holder 数量与拆行数严格一致,则按下标分配。
442
+ * 数量不一致时保持旧数据,避免猜测 Holder 与商品份数的对应关系。
443
+ */
444
+ private createSplitBookingLine;
433
445
  /**
434
446
  * 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
435
447
  *