@pisell/pisellos 2.2.263 → 2.2.264

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 (132) hide show
  1. package/dist/model/strategy/adapter/index.d.ts +0 -4
  2. package/dist/model/strategy/adapter/index.js +1 -5
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  4. package/dist/model/strategy/adapter/promotion/adapter.js +23 -0
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +279 -6
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +86 -0
  8. package/dist/model/strategy/adapter/promotion/examples.js +99 -0
  9. package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
  10. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  11. package/dist/model/strategy/adapter/promotion/type.d.ts +90 -2
  12. package/dist/model/strategy/adapter/promotion/type.js +45 -0
  13. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -16
  14. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
  15. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  16. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +1 -32
  17. package/dist/modules/Discount/index.d.ts +2 -5
  18. package/dist/modules/Discount/index.js +7 -30
  19. package/dist/modules/Discount/types.d.ts +0 -4
  20. package/dist/modules/Order/index.d.ts +2 -14
  21. package/dist/modules/Order/index.js +736 -1035
  22. package/dist/modules/Order/types.d.ts +0 -16
  23. package/dist/modules/Order/utils.d.ts +3 -4
  24. package/dist/modules/Order/utils.js +61 -54
  25. package/dist/modules/Product/types.d.ts +0 -22
  26. package/dist/modules/ProductList/index.d.ts +1 -1
  27. package/dist/modules/ProductList/index.js +2 -4
  28. package/dist/modules/ProductList/types.d.ts +0 -2
  29. package/dist/modules/Rules/index.d.ts +9 -2
  30. package/dist/modules/Rules/index.js +43 -69
  31. package/dist/modules/Rules/types.d.ts +1 -10
  32. package/dist/server/index.d.ts +0 -55
  33. package/dist/server/index.js +753 -1173
  34. package/dist/server/modules/order/index.d.ts +4 -10
  35. package/dist/server/modules/order/index.js +399 -404
  36. package/dist/server/modules/order/types.d.ts +0 -4
  37. package/dist/server/modules/products/index.d.ts +8 -31
  38. package/dist/server/modules/products/index.js +390 -549
  39. package/dist/server/modules/products/types.d.ts +0 -18
  40. package/dist/solution/BaseSales/index.d.ts +1 -21
  41. package/dist/solution/BaseSales/index.js +789 -1136
  42. package/dist/solution/BaseSales/types.d.ts +1 -6
  43. package/dist/solution/BaseSales/types.js +1 -1
  44. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  45. package/dist/solution/BaseSales/utils/cartPromotion.js +97 -50
  46. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  47. package/dist/solution/BaseSales/utils/parseSalesResponse.js +8 -6
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -14
  49. package/dist/solution/BookingByStep/index.d.ts +1 -1
  50. package/dist/solution/BookingTicket/index.js +25 -59
  51. package/dist/solution/BookingTicket/types.d.ts +0 -2
  52. package/dist/solution/ScanOrder/index.js +31 -20
  53. package/dist/solution/ShopDiscount/index.js +14 -15
  54. package/dist/solution/VenueBooking/index.js +30 -19
  55. package/lib/model/strategy/adapter/index.d.ts +0 -4
  56. package/lib/model/strategy/adapter/index.js +2 -13
  57. package/lib/model/strategy/adapter/promotion/adapter.d.ts +4 -0
  58. package/lib/model/strategy/adapter/promotion/adapter.js +20 -0
  59. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +17 -0
  60. package/lib/model/strategy/adapter/promotion/evaluator.js +235 -0
  61. package/lib/model/strategy/adapter/promotion/examples.d.ts +86 -0
  62. package/lib/model/strategy/adapter/promotion/examples.js +91 -0
  63. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  64. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  65. package/lib/model/strategy/adapter/promotion/type.d.ts +90 -2
  66. package/lib/model/strategy/adapter/promotion/type.js +2 -0
  67. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -5
  68. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -1
  69. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
  70. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +2 -23
  71. package/lib/modules/Discount/index.d.ts +2 -5
  72. package/lib/modules/Discount/index.js +3 -23
  73. package/lib/modules/Discount/types.d.ts +0 -4
  74. package/lib/modules/Order/index.d.ts +2 -14
  75. package/lib/modules/Order/index.js +60 -326
  76. package/lib/modules/Order/types.d.ts +0 -16
  77. package/lib/modules/Order/utils.d.ts +3 -4
  78. package/lib/modules/Order/utils.js +23 -22
  79. package/lib/modules/Product/types.d.ts +0 -22
  80. package/lib/modules/ProductList/index.d.ts +1 -1
  81. package/lib/modules/ProductList/index.js +2 -4
  82. package/lib/modules/ProductList/types.d.ts +0 -2
  83. package/lib/modules/Rules/index.d.ts +9 -2
  84. package/lib/modules/Rules/index.js +29 -61
  85. package/lib/modules/Rules/types.d.ts +1 -10
  86. package/lib/server/index.d.ts +0 -55
  87. package/lib/server/index.js +34 -332
  88. package/lib/server/modules/order/index.d.ts +4 -10
  89. package/lib/server/modules/order/index.js +139 -198
  90. package/lib/server/modules/order/types.d.ts +0 -4
  91. package/lib/server/modules/products/index.d.ts +8 -31
  92. package/lib/server/modules/products/index.js +35 -134
  93. package/lib/server/modules/products/types.d.ts +0 -18
  94. package/lib/solution/BaseSales/index.d.ts +1 -21
  95. package/lib/solution/BaseSales/index.js +72 -313
  96. package/lib/solution/BaseSales/types.d.ts +1 -6
  97. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  98. package/lib/solution/BaseSales/utils/cartPromotion.js +64 -25
  99. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +3 -3
  100. package/lib/solution/BaseSales/utils/parseSalesResponse.js +5 -4
  101. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +0 -8
  102. package/lib/solution/BookingByStep/index.d.ts +1 -1
  103. package/lib/solution/BookingTicket/index.js +8 -33
  104. package/lib/solution/BookingTicket/types.d.ts +0 -2
  105. package/lib/solution/ScanOrder/index.js +8 -0
  106. package/lib/solution/ShopDiscount/index.js +1 -2
  107. package/lib/solution/VenueBooking/index.js +8 -0
  108. package/package.json +1 -1
  109. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  110. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -167
  111. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  112. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -780
  113. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  114. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -277
  115. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  116. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  117. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  118. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  119. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
  120. package/dist/modules/Order/utils/orderCollectionIdentity.js +0 -405
  121. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -50
  122. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -149
  123. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -89
  124. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -583
  125. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  126. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -293
  127. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  128. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  129. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -148
  130. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
  131. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +0 -53
  132. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -415
@@ -198,7 +198,6 @@ export interface OrderProduct extends OrderProductIdentity {
198
198
  product_bundle: any[];
199
199
  booking_uid?: string;
200
200
  product_title?: OrderLocalizedText;
201
- product_cover?: string;
202
201
  metadata: Record<string, any>;
203
202
  note?: string;
204
203
  }
@@ -309,7 +308,6 @@ export interface OrderState {
309
308
  lastOrderInfo?: Record<string, any>;
310
309
  syncState?: OrderSyncState;
311
310
  discountList: any[];
312
- availableWalletIds?: number[];
313
311
  discount: DiscountModule | null;
314
312
  rules: RulesModule | null;
315
313
  }
@@ -342,19 +340,6 @@ export interface UpdateOrderProductParams {
342
340
  * });
343
341
  */
344
342
  allow_booking_reprice?: boolean;
345
- /**
346
- * Change time 重报价后,允许当前预约商品行重新应用已选编辑态折扣卡。
347
- *
348
- * @example
349
- * await order.updateOrderProduct({
350
- * product_id: 1,
351
- * product_variant_id: 0,
352
- * updates: { discount_list: [] },
353
- * booking: { duration: 2 },
354
- * allow_booking_discount_reapply: true,
355
- * });
356
- */
357
- allow_booking_discount_reapply?: boolean;
358
343
  }
359
344
  /** 仅更新购物车行数量;行定位语义与 updateOrderProduct / removeProductFromOrder 保持一致 */
360
345
  export interface UpdateOrderProductQuantityParams extends OrderProductIdentity {
@@ -776,7 +761,6 @@ export interface OrderModuleAPI {
776
761
  apply?: boolean;
777
762
  }) => Promise<Discount[]>;
778
763
  getDiscountList: () => Discount[];
779
- getAvailableWalletIds: () => number[];
780
764
  applyDiscount: () => void;
781
765
  /**
782
766
  * 注入促销评估器。
@@ -3,7 +3,6 @@ import type { CartItem } from "../Cart";
3
3
  import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
4
4
  import type { RulesParamsHooks } from '../Rules/types';
5
5
  import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
6
- import { createUuidV4 } from './utils/orderCollectionIdentity';
7
6
  export interface OrderProductsDepositProtocol {
8
7
  id: number;
9
8
  title: string;
@@ -68,8 +67,8 @@ export declare function sumOptionUnitPrice(options?: Array<{
68
67
  /**
69
68
  * 仅基于 tempOrder.products 重算整单定金。
70
69
  *
71
- * 商品折扣在进入定金计算前已体现在商品行价格字段中,
72
- * 因此这里只按商品定金规则汇总,不再扣减 discount_list;tempOrder.bookings 不参与这里的计算。
70
+ * 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
71
+ * 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
73
72
  */
74
73
  export declare function calculateOrderProductsDeposit(products?: OrderProduct[], options?: {
75
74
  productsByUid?: Record<string, Record<string, any>>;
@@ -178,7 +177,7 @@ export declare const mergeRelationForms: (relationForms: {
178
177
  form_record_ids: number[];
179
178
  }[];
180
179
  export declare const getAllDiscountList: (cartItem: CartItem) => any;
181
- export { createUuidV4 };
180
+ export declare function createUuidV4(): string;
182
181
  export declare function isTempOrder(data: any): data is OrderTempOrder;
183
182
  export declare function formatDateTime(date: Date): string;
184
183
  export declare function normalizeBookingIsAll(booking: Record<string, any>): 0 | 1;
@@ -21,7 +21,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
21
21
  import dayjs from "dayjs";
22
22
  import Decimal from 'decimal.js';
23
23
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
24
- import { createUuidV4 } from "./utils/orderCollectionIdentity";
25
24
  /**
26
25
  * 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
27
26
  *
@@ -253,8 +252,8 @@ function getOrderProductDeposit(product, runtimeOrigin) {
253
252
  /**
254
253
  * 仅基于 tempOrder.products 重算整单定金。
255
254
  *
256
- * 商品折扣在进入定金计算前已体现在商品行价格字段中,
257
- * 因此这里只按商品定金规则汇总,不再扣减 discount_list;tempOrder.bookings 不参与这里的计算。
255
+ * 对齐 Checkout relation_products 分支:商品定金先按商品规则计算,
256
+ * 再扣减商品券/折扣卡抵扣金额;tempOrder.bookings 不参与这里的计算。
258
257
  */
259
258
  export function calculateOrderProductsDeposit() {
260
259
  var products = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -274,18 +273,30 @@ export function calculateOrderProductsDeposit() {
274
273
  product.deposit = deposit;
275
274
  if (!(deposit !== null && deposit !== void 0 && deposit.total) || Number(deposit.total) <= 0) continue;
276
275
  total = total.plus(deposit.total);
277
- var _iterator4 = _createForOfIteratorHelper(deposit.protocols || []),
276
+ var _iterator4 = _createForOfIteratorHelper(product.discount_list || []),
278
277
  _step4;
279
278
  try {
280
279
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
281
- var protocol = _step4.value;
282
- if (!protocolMap.has(protocol.id)) protocolMap.set(protocol.id, protocol);
280
+ var discount = _step4.value;
281
+ total = total.minus((discount === null || discount === void 0 ? void 0 : discount.amount) || 0);
283
282
  }
284
283
  } catch (err) {
285
284
  _iterator4.e(err);
286
285
  } finally {
287
286
  _iterator4.f();
288
287
  }
288
+ var _iterator5 = _createForOfIteratorHelper(deposit.protocols || []),
289
+ _step5;
290
+ try {
291
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
292
+ var protocol = _step5.value;
293
+ if (!protocolMap.has(protocol.id)) protocolMap.set(protocol.id, protocol);
294
+ }
295
+ } catch (err) {
296
+ _iterator5.e(err);
297
+ } finally {
298
+ _iterator5.f();
299
+ }
289
300
  hasDeposit = true;
290
301
  }
291
302
  } catch (err) {
@@ -449,19 +460,19 @@ function resolveSubmitBundleMapId(bundle) {
449
460
  }
450
461
  function collectSubmitProductDiscountList(product) {
451
462
  var submitDiscountList = Array.isArray(product === null || product === void 0 ? void 0 : product.discount_list) ? _toConsumableArray(product.discount_list) : [];
452
- var _iterator5 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
453
- _step5;
463
+ var _iterator6 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
464
+ _step6;
454
465
  try {
455
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
456
- var bundle = _step5.value;
466
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
467
+ var bundle = _step6.value;
457
468
  if (!bundle || _typeof(bundle) !== 'object') continue;
458
469
  var bundleMapId = resolveSubmitBundleMapId(bundle);
459
470
  var bundleDiscountList = Array.isArray(bundle.discount_list) ? bundle.discount_list : [];
460
- var _iterator6 = _createForOfIteratorHelper(bundleDiscountList),
461
- _step6;
471
+ var _iterator7 = _createForOfIteratorHelper(bundleDiscountList),
472
+ _step7;
462
473
  try {
463
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
464
- var discount = _step6.value;
474
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
475
+ var discount = _step7.value;
465
476
  if (!discount || _typeof(discount) !== 'object') continue;
466
477
  var discountMetadata = discount.metadata && _typeof(discount.metadata) === 'object' ? discount.metadata : {};
467
478
  var discountMapId = discountMetadata.custom_product_bundle_map_id !== undefined && discountMetadata.custom_product_bundle_map_id !== null && discountMetadata.custom_product_bundle_map_id !== '' ? discountMetadata.custom_product_bundle_map_id : bundleMapId;
@@ -472,15 +483,15 @@ function collectSubmitProductDiscountList(product) {
472
483
  } : {}));
473
484
  }
474
485
  } catch (err) {
475
- _iterator6.e(err);
486
+ _iterator7.e(err);
476
487
  } finally {
477
- _iterator6.f();
488
+ _iterator7.f();
478
489
  }
479
490
  }
480
491
  } catch (err) {
481
- _iterator5.e(err);
492
+ _iterator6.e(err);
482
493
  } finally {
483
- _iterator5.f();
494
+ _iterator6.f();
484
495
  }
485
496
  return normalizeOrderProductDiscountList(submitDiscountList);
486
497
  }
@@ -533,7 +544,8 @@ export function resolveEffectivePerUnitDiscount(product) {
533
544
  return sum + Number((discount === null || discount === void 0 ? void 0 : discount.amount) || 0);
534
545
  }, 0);
535
546
  var hasPromoDiscountItem = discountList.some(function (item) {
536
- return (item === null || item === void 0 ? void 0 : item.type) === 'promotion';
547
+ var _item$metadata, _item$metadata2;
548
+ return (item === null || item === void 0 ? void 0 : item.type) === 'promotion' || (item === null || item === void 0 ? void 0 : item.type) === 'product' && (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.source) === 'promotion' && (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.actionType) === 'ITEM_REWARD';
537
549
  });
538
550
  if (hasPromoDiscountItem) return fromList;
539
551
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
@@ -575,14 +587,11 @@ export function createDefaultOrderRulesHooks() {
575
587
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
576
588
  var current = currentByIdentity.get(getBundleIdentity(bundle));
577
589
  if (!current) return bundle;
578
- var bundleWithDisplayFields = _objectSpread(_objectSpread({}, bundle), isEmptyOrderProductDisplayValue(bundle.cover) && !isEmptyOrderProductDisplayValue(current.cover) ? {
579
- cover: current.cover
580
- } : {});
581
590
  var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
582
- if (!isProductPriceBundle) return bundleWithDisplayFields;
591
+ if (!isProductPriceBundle) return bundle;
583
592
  var sourcePrice = (_ref18 = (_ref19 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref19 !== void 0 ? _ref19 : current.original_price) !== null && _ref18 !== void 0 ? _ref18 : current.bundle_selling_price;
584
593
  var originalPrice = (_ref20 = (_ref21 = (_ref22 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref22 !== void 0 ? _ref22 : current.price) !== null && _ref21 !== void 0 ? _ref21 : current.custom_price) !== null && _ref20 !== void 0 ? _ref20 : sourcePrice;
585
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundleWithDisplayFields), sourcePrice !== undefined ? {
594
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundle), sourcePrice !== undefined ? {
586
595
  price: sourcePrice
587
596
  } : {}), originalPrice !== undefined ? {
588
597
  original_price: originalPrice
@@ -755,7 +764,14 @@ export var getAllDiscountList = function getAllDiscountList(cartItem) {
755
764
 
756
765
  // ─── 以下为从 ScanOrder/utils.ts 迁入的 Order 专属工具函数 ───
757
766
 
758
- export { createUuidV4 };
767
+ export function createUuidV4() {
768
+ var template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
769
+ return template.replace(/[xy]/g, function (char) {
770
+ var randomValue = Math.floor(Math.random() * 16);
771
+ var value = char === 'x' ? randomValue : randomValue & 0x3 | 0x8;
772
+ return value.toString(16);
773
+ });
774
+ }
759
775
  export function isTempOrder(data) {
760
776
  if (!data || _typeof(data) !== 'object') return false;
761
777
  if (!Array.isArray(data.products)) return false;
@@ -848,7 +864,6 @@ function formatSubmitBundleItems(bundle) {
848
864
  bundle_group_id: (_rawBundle$bundle_gro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_group_id) !== null && _rawBundle$bundle_gro !== void 0 ? _rawBundle$bundle_gro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.group_id,
849
865
  bundle_id: (_rawBundle$bundle_id = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_id) !== null && _rawBundle$bundle_id !== void 0 ? _rawBundle$bundle_id : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.id,
850
866
  bundle_product_id: (_rawBundle$bundle_pro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_product_id) !== null && _rawBundle$bundle_pro !== void 0 ? _rawBundle$bundle_pro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle._bundle_product_id,
851
- cover: rawBundle.cover,
852
867
  metadata: _objectSpread(_objectSpread(_objectSpread({}, submitMetadata), hasSubmitBundleDiscounts && bundleMapId !== undefined ? {
853
868
  custom_product_bundle_map_id: bundleMapId
854
869
  } : {}), {}, {
@@ -910,9 +925,6 @@ function normalizeSubmitProduct(product) {
910
925
  if (rawMetadata.is_rule !== undefined) {
911
926
  cleanMetadata.is_rule = rawMetadata.is_rule;
912
927
  }
913
- if (rawMetadata.holder_config !== undefined) {
914
- cleanMetadata.holder_config = rawMetadata.holder_config;
915
- }
916
928
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
917
929
  option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option)
918
930
  });
@@ -943,19 +955,19 @@ export function normalizeBookingSubType(booking) {
943
955
  export function normalizeSubmitBooking(booking) {
944
956
  var rawMetadata = booking.metadata || {};
945
957
  var cleanMetadata = {};
946
- var _iterator7 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
947
- _step7;
958
+ var _iterator8 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
959
+ _step8;
948
960
  try {
949
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
950
- var key = _step7.value;
961
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
962
+ var key = _step8.value;
951
963
  if (rawMetadata[key] !== undefined) {
952
964
  cleanMetadata[key] = rawMetadata[key];
953
965
  }
954
966
  }
955
967
  } catch (err) {
956
- _iterator7.e(err);
968
+ _iterator8.e(err);
957
969
  } finally {
958
- _iterator7.f();
970
+ _iterator8.f();
959
971
  }
960
972
  if (cleanMetadata.holder_id === undefined) cleanMetadata.holder_id = null;
961
973
  var bookingRecord = booking;
@@ -1268,25 +1280,25 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1268
1280
  target[key] = null;
1269
1281
  changed = true;
1270
1282
  };
1271
- var _iterator8 = _createForOfIteratorHelper(tempOrder.products || []),
1272
- _step8;
1283
+ var _iterator9 = _createForOfIteratorHelper(tempOrder.products || []),
1284
+ _step9;
1273
1285
  try {
1274
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1275
- var product = _step8.value;
1286
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1287
+ var product = _step9.value;
1276
1288
  if (product.metadata && _typeof(product.metadata) === 'object') {
1277
1289
  resetHolderField(product.metadata);
1278
1290
  }
1279
1291
  }
1280
1292
  } catch (err) {
1281
- _iterator8.e(err);
1293
+ _iterator9.e(err);
1282
1294
  } finally {
1283
- _iterator8.f();
1295
+ _iterator9.f();
1284
1296
  }
1285
- var _iterator9 = _createForOfIteratorHelper(tempOrder.bookings || []),
1286
- _step9;
1297
+ var _iterator10 = _createForOfIteratorHelper(tempOrder.bookings || []),
1298
+ _step10;
1287
1299
  try {
1288
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1289
- var booking = _step9.value;
1300
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1301
+ var booking = _step10.value;
1290
1302
  var bookingRecord = booking;
1291
1303
  if (booking.metadata && _typeof(booking.metadata) === 'object') {
1292
1304
  resetHolderField(booking.metadata);
@@ -1297,9 +1309,9 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1297
1309
  }
1298
1310
  }
1299
1311
  } catch (err) {
1300
- _iterator9.e(err);
1312
+ _iterator10.e(err);
1301
1313
  } finally {
1302
- _iterator9.f();
1314
+ _iterator10.f();
1303
1315
  }
1304
1316
  var productsByUid = (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid;
1305
1317
  if (productsByUid && _typeof(productsByUid) === 'object') {
@@ -1350,16 +1362,11 @@ export function isHolderConfigRequired(holderConfig) {
1350
1362
  return Number(holderConfig.required) === 1;
1351
1363
  }
1352
1364
  export function productRequiresFormSubject(tempOrder, product) {
1353
- var _tempOrder$products, _orderProduct$metadat;
1354
- var _orderProduct = tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.find(function (item) {
1355
- return item.metadata.unique_identification_number === product._id || item.product_id === product.id;
1356
- });
1357
1365
  var runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
1358
- return isHolderConfigRequired(_orderProduct === null || _orderProduct === void 0 || (_orderProduct$metadat = _orderProduct.metadata) === null || _orderProduct$metadat === void 0 ? void 0 : _orderProduct$metadat.holder_config) || isHolderConfigRequired(runtimeOrigin === null || runtimeOrigin === void 0 ? void 0 : runtimeOrigin.holder_config) || isHolderConfigRequired(product === null || product === void 0 ? void 0 : product.holder_config);
1366
+ return isHolderConfigRequired(product === null || product === void 0 ? void 0 : product.holder_config) || isHolderConfigRequired(runtimeOrigin === null || runtimeOrigin === void 0 ? void 0 : runtimeOrigin.holder_config);
1359
1367
  }
1360
1368
  export function resolveIsFormSubject(tempOrder, product) {
1361
1369
  var _tempOrder$holder;
1362
- debugger;
1363
1370
  // 旧版预约维度的 holder 类型仍然生效;新版则从当前商品 holder_config 判断。
1364
1371
  if ((tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.type) === 'form') return true;
1365
1372
  if (product) return productRequiresFormSubject(tempOrder, product);
@@ -1399,7 +1406,7 @@ export function isEmptyOrderProductDisplayValue(value) {
1399
1406
  */
1400
1407
  export function mergeOrderProductDisplayFields(previous, next) {
1401
1408
  var merged = _objectSpread({}, next);
1402
- var displayFields = ['product_title', 'product_name', 'product_cover', 'cover', 'product_cover', 'variant_title', 'product_sku', 'payment_price'];
1409
+ var displayFields = ['product_title', 'product_name', 'product_cover', 'cover', 'variant_title', 'product_sku', 'payment_price'];
1403
1410
  displayFields.forEach(function (field) {
1404
1411
  if (isEmptyOrderProductDisplayValue(merged[field]) && !isEmptyOrderProductDisplayValue(previous[field])) {
1405
1412
  merged[field] = previous[field];
@@ -9,26 +9,6 @@ export interface ProductCollection {
9
9
  /** 商品集合封面 */
10
10
  cover: string;
11
11
  }
12
- /**
13
- * 商品 Data Variant 记录,结构与后端 data_variant 表对齐。
14
- */
15
- export interface ProductDataVariant {
16
- /** 变体记录 id */
17
- id: number;
18
- /** 店铺 id */
19
- shop_id: number;
20
- /** 所属模块,商品场景固定为 product */
21
- module: string;
22
- /** 模块数据 id,商品场景对应 product.id */
23
- module_data_id: number;
24
- /** 关联 data_variant_rule.id */
25
- data_variant_rule_id: number;
26
- /** 命中策略后覆盖到商品上的字段 */
27
- data: Record<string, any>;
28
- created_at: string | null;
29
- updated_at: string | null;
30
- deleted_at: string | null;
31
- }
32
12
  /**
33
13
  * 商品基本信息接口
34
14
  */
@@ -234,8 +214,6 @@ export interface ProductData {
234
214
  bundle_group_count: number;
235
215
  /** 选项组数量 */
236
216
  option_group_count: number;
237
- /** 智能定价变体列表,/product/query with dataVariants 返回 */
238
- data_variants?: ProductDataVariant[];
239
217
  /** 服务时长 */
240
218
  service_times?: any;
241
219
  }
@@ -26,7 +26,7 @@ export declare class ProductList extends BaseModule implements Module {
26
26
  * const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
27
27
  */
28
28
  getAddTimeProducts(params?: ProductListLoadProductsParams): Promise<any>;
29
- loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, strategy_context, }?: ProductListLoadProductsParams, options?: {
29
+ loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, extension_type, status, }?: ProductListLoadProductsParams, options?: {
30
30
  callback?: (result: any) => void;
31
31
  subscriberId?: string;
32
32
  }): Promise<any>;
@@ -152,7 +152,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
152
152
  extension_type,
153
153
  _ref$status,
154
154
  status,
155
- strategy_context,
156
155
  options,
157
156
  userPlugin,
158
157
  customer_id,
@@ -163,7 +162,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
163
162
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
164
163
  while (1) switch (_context4.prev = _context4.next) {
165
164
  case 0:
166
- _ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status, strategy_context = _ref.strategy_context;
165
+ _ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule, extension_type = _ref.extension_type, _ref$status = _ref.status, status = _ref$status === void 0 ? 'published' : _ref$status;
167
166
  options = _args4.length > 1 ? _args4[1] : undefined;
168
167
  // // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
169
168
  // if (!schedule_ids?.length) {
@@ -207,8 +206,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
207
206
  is_eject: 1,
208
207
  with_schedule: with_schedule,
209
208
  schedule_datetime: schedule_datetime,
210
- extension_type: extension_type,
211
- strategy_context: strategy_context
209
+ extension_type: extension_type
212
210
  }, {
213
211
  osServer: true,
214
212
  callback: options === null || options === void 0 ? void 0 : options.callback,
@@ -12,8 +12,6 @@ export interface ProductListLoadProductsParams {
12
12
  with_schedule?: number;
13
13
  extension_type?: string[];
14
14
  status?: string;
15
- /** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
16
- strategy_context?: Record<string, any>;
17
15
  }
18
16
  export interface ProductListData {
19
17
  list: ProductData[];
@@ -1,7 +1,8 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, UnavailableReason } from './types';
3
+ import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, UnavailableReason } from './types';
4
4
  import { Discount } from '../Discount/types';
5
+ import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
5
6
  import { WindowPlugin } from '../../plugins';
6
7
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
7
8
  protected defaultName: string;
@@ -35,6 +36,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
35
36
  excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
36
37
  /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
37
38
  resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
39
+ private isItemRewardProductDiscount;
38
40
  private getUnavailableReason;
39
41
  calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
40
42
  discountList: Discount[];
@@ -44,7 +46,12 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
44
46
  }[];
45
47
  isFormSubject: RulesFormSubject;
46
48
  orderTotalAmount: number;
47
- }, options?: RulesCalcDiscountOptions): DiscountResult;
49
+ }, options?: {
50
+ isSelected?: boolean;
51
+ discountId?: number;
52
+ selectedList?: SetDiscountSelectedParams[];
53
+ scan?: boolean;
54
+ }): DiscountResult;
48
55
  /**
49
56
  * 检查优惠是否符合 PackageSubItemUsageRules 配置
50
57
  * @param discount 优惠券