@pisell/pisellos 2.2.318 → 2.2.319

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 (33) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
  2. package/dist/modules/Discount/types.d.ts +4 -0
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/index.js +740 -775
  5. package/dist/modules/Order/types.d.ts +2 -2
  6. package/dist/modules/Order/types.js +2 -2
  7. package/dist/modules/Order/utils.js +45 -45
  8. package/dist/modules/Payment/walletpass.js +32 -6
  9. package/dist/modules/Rules/index.d.ts +3 -10
  10. package/dist/modules/Rules/index.js +169 -87
  11. package/dist/modules/Rules/promotionSelection.d.ts +14 -0
  12. package/dist/modules/Rules/promotionSelection.js +390 -0
  13. package/dist/modules/Rules/types.d.ts +9 -0
  14. package/dist/solution/BaseSales/index.js +41 -21
  15. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
  16. package/dist/solution/BookingByStep/index.d.ts +1 -1
  17. package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
  18. package/lib/modules/Discount/types.d.ts +4 -0
  19. package/lib/modules/Order/index.d.ts +1 -1
  20. package/lib/modules/Order/index.js +13 -8
  21. package/lib/modules/Order/types.d.ts +2 -2
  22. package/lib/modules/Order/types.js +2 -2
  23. package/lib/modules/Order/utils.js +1 -1
  24. package/lib/modules/Payment/walletpass.js +23 -1
  25. package/lib/modules/Rules/index.d.ts +3 -10
  26. package/lib/modules/Rules/index.js +62 -22
  27. package/lib/modules/Rules/promotionSelection.d.ts +14 -0
  28. package/lib/modules/Rules/promotionSelection.js +230 -0
  29. package/lib/modules/Rules/types.d.ts +9 -0
  30. package/lib/solution/BaseSales/index.js +19 -5
  31. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  32. package/lib/solution/BookingByStep/index.d.ts +1 -1
  33. package/package.json +1 -1
@@ -792,6 +792,7 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
792
792
  _iterator11.f();
793
793
  }
794
794
  var allocatedPricesByProductId = new Map();
795
+ var expectedPromoTotal = new Decimal(0);
795
796
  for (var g = 0; g < groupCount; g++) {
796
797
  var startIdx = g * x;
797
798
  var endIdx = startIdx + x;
@@ -802,8 +803,9 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
802
803
  return sum.plus(u.price);
803
804
  }, new Decimal(0));
804
805
 
805
- // 按原价比例均摊
806
- var groupPriceDecimal = new Decimal(groupPrice);
806
+ // 组价高于本组原价时保留原价,尾差目标也必须使用封顶后的实际组价。
807
+ var groupPriceDecimal = Decimal.min(new Decimal(groupPrice), groupOriginalTotal);
808
+ expectedPromoTotal = expectedPromoTotal.plus(groupPriceDecimal);
807
809
  var allocatedSum = new Decimal(0);
808
810
  for (var i = 0; i < groupUnits.length; i++) {
809
811
  var unit = groupUnits[i];
@@ -911,14 +913,13 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
911
913
  processedQuantityMap.set(_key, _processedQty + _availableQty);
912
914
  }
913
915
 
914
- // 8. 尾差调整:确保促销商品的 finalPrice × quantity 之和精确等于 groupPrice × groupCount
916
+ // 8. 尾差调整:只补实际组价的舍入差额,不将高于原价的组价补到某一件。
915
917
  } catch (err) {
916
918
  _iterator12.e(err);
917
919
  } finally {
918
920
  _iterator12.f();
919
921
  }
920
922
  if (groupCount > 0) {
921
- var expectedPromoTotal = new Decimal(groupPrice).mul(groupCount);
922
923
  var promoItems = result.filter(function (p) {
923
924
  return p.inPromotion;
924
925
  });
@@ -158,6 +158,10 @@ export interface Discount {
158
158
  discount_calculation_mode: 'item_level' | 'order_level';
159
159
  };
160
160
  isManualSelect?: boolean;
161
+ /** X 件 Y 元互斥选择的手动意图;isSelected 只表示本次实际应用结果。 */
162
+ promotionSelection?: 'card' | 'promotion';
163
+ /** 记录手动操作影响的促销组,避免卡失效后普通重算丢失取消意图。 */
164
+ promotionSelectionStrategyIds?: string[];
161
165
  isDisabled?: boolean;
162
166
  isSelected?: boolean;
163
167
  isAvailable?: boolean;
@@ -595,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
595
595
  generateIdempotencyToken(): string;
596
596
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
597
597
  createOrder(params: CommitOrderParams['query']): {
598
- type: "appointment_booking" | "virtual";
598
+ type: "virtual" | "appointment_booking";
599
599
  platform: string;
600
600
  sales_channel: string;
601
601
  order_sales_channel: string;