@pisell/pisellos 2.2.260 → 2.2.261

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 (129) 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 +1 -1
  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 +17 -13
  14. package/dist/modules/Order/index.d.ts +33 -2
  15. package/dist/modules/Order/index.js +615 -288
  16. package/dist/modules/Order/types.d.ts +20 -2
  17. package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  18. package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
  19. package/dist/modules/Order/utils.d.ts +4 -0
  20. package/dist/modules/Order/utils.js +116 -29
  21. package/dist/modules/Product/types.d.ts +0 -22
  22. package/dist/modules/ProductList/index.d.ts +1 -1
  23. package/dist/modules/ProductList/index.js +2 -4
  24. package/dist/modules/ProductList/types.d.ts +0 -2
  25. package/dist/modules/Rules/index.d.ts +4 -3
  26. package/dist/modules/Rules/index.js +42 -17
  27. package/dist/modules/Rules/types.d.ts +2 -1
  28. package/dist/modules/SalesSummary/index.d.ts +7 -3
  29. package/dist/modules/SalesSummary/index.js +67 -39
  30. package/dist/modules/SalesSummary/types.d.ts +1 -0
  31. package/dist/modules/SalesSummary/utils.js +2 -1
  32. package/dist/modules/SurchargeList/index.d.ts +6 -4
  33. package/dist/modules/SurchargeList/index.js +62 -39
  34. package/dist/modules/SurchargeList/types.d.ts +6 -2
  35. package/dist/server/index.d.ts +3 -50
  36. package/dist/server/index.js +1075 -1040
  37. package/dist/server/modules/order/index.d.ts +22 -3
  38. package/dist/server/modules/order/index.js +398 -316
  39. package/dist/server/modules/products/index.d.ts +7 -26
  40. package/dist/server/modules/products/index.js +76 -166
  41. package/dist/server/modules/products/types.d.ts +0 -14
  42. package/dist/solution/BaseSales/index.d.ts +22 -2
  43. package/dist/solution/BaseSales/index.js +995 -701
  44. package/dist/solution/BaseSales/types.d.ts +1 -0
  45. package/dist/solution/BaseSales/types.js +2 -1
  46. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  47. package/dist/solution/BaseSales/utils/cartPromotion.js +74 -29
  48. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  49. package/dist/solution/BookingByStep/index.d.ts +1 -1
  50. package/dist/solution/BookingTicket/index.d.ts +9 -1
  51. package/dist/solution/BookingTicket/index.js +153 -6
  52. package/dist/solution/BookingTicket/types.d.ts +0 -2
  53. package/dist/solution/ScanOrder/index.js +31 -20
  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 +2 -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 +11 -1
  68. package/lib/modules/Order/index.d.ts +33 -2
  69. package/lib/modules/Order/index.js +402 -64
  70. package/lib/modules/Order/types.d.ts +20 -2
  71. package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
  72. package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
  73. package/lib/modules/Order/utils.d.ts +4 -0
  74. package/lib/modules/Order/utils.js +90 -3
  75. package/lib/modules/Product/types.d.ts +0 -22
  76. package/lib/modules/ProductList/index.d.ts +1 -1
  77. package/lib/modules/ProductList/index.js +2 -4
  78. package/lib/modules/ProductList/types.d.ts +0 -2
  79. package/lib/modules/Rules/index.d.ts +4 -3
  80. package/lib/modules/Rules/index.js +27 -7
  81. package/lib/modules/Rules/types.d.ts +2 -1
  82. package/lib/modules/SalesSummary/index.d.ts +7 -3
  83. package/lib/modules/SalesSummary/index.js +28 -11
  84. package/lib/modules/SalesSummary/types.d.ts +1 -0
  85. package/lib/modules/SalesSummary/utils.js +2 -0
  86. package/lib/modules/SurchargeList/index.d.ts +6 -4
  87. package/lib/modules/SurchargeList/index.js +41 -21
  88. package/lib/modules/SurchargeList/types.d.ts +6 -2
  89. package/lib/server/index.d.ts +3 -50
  90. package/lib/server/index.js +244 -215
  91. package/lib/server/modules/order/index.d.ts +22 -3
  92. package/lib/server/modules/order/index.js +103 -53
  93. package/lib/server/modules/products/index.d.ts +7 -26
  94. package/lib/server/modules/products/index.js +35 -113
  95. package/lib/server/modules/products/types.d.ts +0 -14
  96. package/lib/solution/BaseSales/index.d.ts +22 -2
  97. package/lib/solution/BaseSales/index.js +246 -60
  98. package/lib/solution/BaseSales/types.d.ts +1 -0
  99. package/lib/solution/BaseSales/types.js +2 -1
  100. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +3 -1
  101. package/lib/solution/BaseSales/utils/cartPromotion.js +59 -16
  102. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -6
  103. package/lib/solution/BookingByStep/index.d.ts +1 -1
  104. package/lib/solution/BookingTicket/index.d.ts +9 -1
  105. package/lib/solution/BookingTicket/index.js +101 -0
  106. package/lib/solution/BookingTicket/types.d.ts +0 -2
  107. package/lib/solution/ScanOrder/index.js +8 -0
  108. package/lib/solution/VenueBooking/index.js +8 -0
  109. package/package.json +1 -1
  110. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
  111. package/dist/model/strategy/adapter/dataVariant/adapter.js +0 -152
  112. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
  113. package/dist/model/strategy/adapter/dataVariant/evaluator.js +0 -755
  114. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  115. package/dist/model/strategy/adapter/dataVariant/examples.js +0 -282
  116. package/dist/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  117. package/dist/model/strategy/adapter/dataVariant/index.js +0 -4
  118. package/dist/model/strategy/adapter/dataVariant/type.d.ts +0 -146
  119. package/dist/model/strategy/adapter/dataVariant/type.js +0 -54
  120. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +0 -49
  121. package/lib/model/strategy/adapter/dataVariant/adapter.js +0 -139
  122. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +0 -87
  123. package/lib/model/strategy/adapter/dataVariant/evaluator.js +0 -564
  124. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +0 -39
  125. package/lib/model/strategy/adapter/dataVariant/examples.js +0 -295
  126. package/lib/model/strategy/adapter/dataVariant/index.d.ts +0 -4
  127. package/lib/model/strategy/adapter/dataVariant/index.js +0 -38
  128. package/lib/model/strategy/adapter/dataVariant/type.d.ts +0 -146
  129. package/lib/model/strategy/adapter/dataVariant/type.js +0 -31
@@ -491,7 +491,7 @@ export interface OrderPaymentData {
491
491
  voucher_id?: string | number;
492
492
  origin_amount?: string;
493
493
  service_fee?: string;
494
- status?: 'active' | 'voided' | string;
494
+ status?: 'active' | 'paid' | 'voided' | 'payment_pending' | string;
495
495
  /** 支付时间 (格式: YYYY-MM-DD HH:mm:ss) */
496
496
  payment_time?: string;
497
497
  wallet_pass_usage_unit?: unknown;
@@ -537,9 +537,15 @@ export interface SyncPaymentsToOrderParams {
537
537
  smallTicketDataFlag?: number;
538
538
  businessCode?: string;
539
539
  channel?: string;
540
+ confirmPendingVoucherPayments?: boolean;
540
541
  }
541
542
  export interface SyncPaymentsToOrderResult<T = any> {
542
543
  isFullyPaid: boolean;
544
+ isOrderFullyPaid: boolean;
545
+ isDepositFullyPaid: boolean;
546
+ paymentStage: 'deposit' | 'normal';
547
+ depositAmount: string;
548
+ orderExpectedAmount: string;
543
549
  submitResult?: T;
544
550
  }
545
551
  export interface OrderIdentitySnapshot {
@@ -691,6 +697,7 @@ export interface OrderModuleAPI {
691
697
  payments?: OrderPaymentSource[];
692
698
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
693
699
  smallTicketDataFlag?: number;
700
+ confirmPendingVoucherPayments?: boolean;
694
701
  enhancePayload?: SubmitPayloadEnhancer;
695
702
  }) => Promise<T>;
696
703
  submitTempOrderAsync: <T = any>(params?: {
@@ -702,6 +709,7 @@ export interface OrderModuleAPI {
702
709
  payments?: OrderPaymentSource[];
703
710
  paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
704
711
  smallTicketDataFlag?: number;
712
+ confirmPendingVoucherPayments?: boolean;
705
713
  enhancePayload?: SubmitPayloadEnhancer;
706
714
  }) => Promise<T>;
707
715
  getOrderPayments: () => OrderPaymentData[];
@@ -709,7 +717,17 @@ export interface OrderModuleAPI {
709
717
  addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
710
718
  updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
711
719
  deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
712
- updateVoucherOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
720
+ updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
721
+ status?: 'paid' | 'payment_pending';
722
+ }) => OrderPaymentData[];
723
+ confirmPendingVoucherPayments: (options?: {
724
+ persist?: boolean;
725
+ recalculateSummary?: boolean;
726
+ }) => OrderPaymentData[];
727
+ discardPendingVoucherPayments: (options?: {
728
+ persist?: boolean;
729
+ recalculateSummary?: boolean;
730
+ }) => OrderPaymentData[];
713
731
  sendCustomerPayLink: <T = any>(params: SendCustomerPayLinkParams) => Promise<T>;
714
732
  saveDraft: () => Promise<void>;
715
733
  hydrateTempOrderFromRecord: (record: Record<string, any>, options?: {
@@ -0,0 +1,5 @@
1
+ import type { OrderProductDiscountItem } from '../types';
2
+ type NormalizeDiscountList = (discountList?: unknown[] | null) => OrderProductDiscountItem[];
3
+ export declare function restoreHydratedBundleDiscounts<T extends Record<string, any>>(product: T, normalizeDiscountList: NormalizeDiscountList): T;
4
+ export declare function expandHydratedProductsForDiscountCollection(products: any[] | undefined | null): any[];
5
+ export {};
@@ -0,0 +1,144 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ var BUNDLE_MAP_ID_KEY = 'custom_product_bundle_map_id';
15
+ function getBundleMapId(bundle) {
16
+ var _bundle$metadata;
17
+ var metadataMapId = bundle === null || bundle === void 0 || (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 ? void 0 : _bundle$metadata[BUNDLE_MAP_ID_KEY];
18
+ if (metadataMapId !== undefined && metadataMapId !== null && metadataMapId !== '') {
19
+ return String(metadataMapId);
20
+ }
21
+ if ((bundle === null || bundle === void 0 ? void 0 : bundle._id) !== undefined && bundle._id !== null && bundle._id !== '') {
22
+ return String(bundle._id);
23
+ }
24
+ return null;
25
+ }
26
+ function getDiscountBundleMapId(discount) {
27
+ var _discount$metadata;
28
+ var mapId = discount === null || discount === void 0 || (_discount$metadata = discount.metadata) === null || _discount$metadata === void 0 ? void 0 : _discount$metadata[BUNDLE_MAP_ID_KEY];
29
+ if (mapId === undefined || mapId === null || mapId === '') return null;
30
+ return String(mapId);
31
+ }
32
+ function hasSameBundleDiscount(discountList, discount) {
33
+ var _ref, _discount$discount$re, _discount$discount;
34
+ var targetOrderDiscountId = discount.order_discount_id;
35
+ if (targetOrderDiscountId !== undefined && targetOrderDiscountId !== null) {
36
+ return discountList.some(function (item) {
37
+ return (item === null || item === void 0 ? void 0 : item.order_discount_id) === targetOrderDiscountId;
38
+ });
39
+ }
40
+ var targetResourceId = (_ref = (_discount$discount$re = discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _discount$discount$re !== void 0 ? _discount$discount$re : discount === null || discount === void 0 ? void 0 : discount.resource_id) !== null && _ref !== void 0 ? _ref : discount === null || discount === void 0 ? void 0 : discount.discount_id;
41
+ var targetMapId = getDiscountBundleMapId(discount);
42
+ return discountList.some(function (item) {
43
+ var _ref2, _item$discount$resour, _item$discount, _item$amount, _discount$amount;
44
+ var resourceId = (_ref2 = (_item$discount$resour = item === null || item === void 0 || (_item$discount = item.discount) === null || _item$discount === void 0 ? void 0 : _item$discount.resource_id) !== null && _item$discount$resour !== void 0 ? _item$discount$resour : item === null || item === void 0 ? void 0 : item.resource_id) !== null && _ref2 !== void 0 ? _ref2 : item === null || item === void 0 ? void 0 : item.discount_id;
45
+ return resourceId === targetResourceId && String((_item$amount = item === null || item === void 0 ? void 0 : item.amount) !== null && _item$amount !== void 0 ? _item$amount : '') === String((_discount$amount = discount === null || discount === void 0 ? void 0 : discount.amount) !== null && _discount$amount !== void 0 ? _discount$amount : '') && getDiscountBundleMapId(item) === targetMapId;
46
+ });
47
+ }
48
+ export function restoreHydratedBundleDiscounts(product, normalizeDiscountList) {
49
+ if (!Array.isArray(product.product_bundle) || !Array.isArray(product.discount_list)) {
50
+ return product;
51
+ }
52
+ var bundleByMapId = new Map();
53
+ product.product_bundle.forEach(function (bundle) {
54
+ if (!bundle || _typeof(bundle) !== 'object') return;
55
+ var mapId = getBundleMapId(bundle);
56
+ if (mapId) bundleByMapId.set(mapId, bundle);
57
+ });
58
+ if (!bundleByMapId.size) return product;
59
+ var mainDiscountList = [];
60
+ var bundleDiscounts = [];
61
+ product.discount_list.forEach(function (discount) {
62
+ var mapId = getDiscountBundleMapId(discount);
63
+ if (mapId && bundleByMapId.has(mapId)) {
64
+ bundleDiscounts.push({
65
+ mapId: mapId,
66
+ discount: discount
67
+ });
68
+ } else {
69
+ mainDiscountList.push(discount);
70
+ }
71
+ });
72
+ if (!bundleDiscounts.length) return product;
73
+ return _objectSpread(_objectSpread({}, product), {}, {
74
+ discount_list: normalizeDiscountList(mainDiscountList),
75
+ product_bundle: product.product_bundle.map(function (bundle) {
76
+ if (!bundle || _typeof(bundle) !== 'object') return bundle;
77
+ var mapId = getBundleMapId(bundle);
78
+ if (!mapId) return bundle;
79
+ var matchedDiscounts = bundleDiscounts.filter(function (item) {
80
+ return item.mapId === mapId;
81
+ }).map(function (item) {
82
+ return item.discount;
83
+ });
84
+ if (!matchedDiscounts.length) return bundle;
85
+ var currentDiscountList = Array.isArray(bundle.discount_list) ? _toConsumableArray(bundle.discount_list) : [];
86
+ var _iterator = _createForOfIteratorHelper(matchedDiscounts),
87
+ _step;
88
+ try {
89
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
90
+ var discount = _step.value;
91
+ if (!hasSameBundleDiscount(currentDiscountList, discount)) {
92
+ currentDiscountList.push(discount);
93
+ }
94
+ }
95
+ } catch (err) {
96
+ _iterator.e(err);
97
+ } finally {
98
+ _iterator.f();
99
+ }
100
+ return _objectSpread(_objectSpread({}, bundle), {}, {
101
+ discount_list: normalizeDiscountList(currentDiscountList),
102
+ metadata: _objectSpread(_objectSpread({}, bundle.metadata || {}), {}, _defineProperty({}, BUNDLE_MAP_ID_KEY, mapId))
103
+ });
104
+ })
105
+ });
106
+ }
107
+ export function expandHydratedProductsForDiscountCollection(products) {
108
+ var expanded = [];
109
+ var _iterator2 = _createForOfIteratorHelper(products || []),
110
+ _step2;
111
+ try {
112
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
113
+ var product = _step2.value;
114
+ expanded.push(product);
115
+ var _iterator3 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
116
+ _step3;
117
+ try {
118
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
119
+ var _ref3, _ref4, _bundle$bundle_produc, _ref5, _bundle$num, _ref6, _bundle$quantity, _ref7, _bundle$original_pric, _bundle$bundle_sellin, _bundle$is_charge_tax;
120
+ var bundle = _step3.value;
121
+ if (!Array.isArray(bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || bundle.discount_list.length === 0) continue;
122
+ expanded.push(_objectSpread(_objectSpread({}, product), {}, {
123
+ product_id: (_ref3 = (_ref4 = (_bundle$bundle_produc = bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle._bundle_product_id) !== null && _ref4 !== void 0 ? _ref4 : bundle.product_id) !== null && _ref3 !== void 0 ? _ref3 : product === null || product === void 0 ? void 0 : product.product_id,
124
+ num: (_ref5 = (_bundle$num = bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle.quantity) !== null && _ref5 !== void 0 ? _ref5 : product === null || product === void 0 ? void 0 : product.num,
125
+ product_quantity: (_ref6 = (_bundle$quantity = bundle.quantity) !== null && _bundle$quantity !== void 0 ? _bundle$quantity : bundle.num) !== null && _ref6 !== void 0 ? _ref6 : product === null || product === void 0 ? void 0 : product.product_quantity,
126
+ original_price: (_ref7 = (_bundle$original_pric = bundle.original_price) !== null && _bundle$original_pric !== void 0 ? _bundle$original_pric : bundle.product_price) !== null && _ref7 !== void 0 ? _ref7 : bundle.price,
127
+ selling_price: (_bundle$bundle_sellin = bundle.bundle_selling_price) !== null && _bundle$bundle_sellin !== void 0 ? _bundle$bundle_sellin : bundle.price,
128
+ is_charge_tax: (_bundle$is_charge_tax = bundle.is_charge_tax) !== null && _bundle$is_charge_tax !== void 0 ? _bundle$is_charge_tax : product === null || product === void 0 ? void 0 : product.is_charge_tax,
129
+ discount_list: bundle.discount_list
130
+ }));
131
+ }
132
+ } catch (err) {
133
+ _iterator3.e(err);
134
+ } finally {
135
+ _iterator3.f();
136
+ }
137
+ }
138
+ } catch (err) {
139
+ _iterator2.e(err);
140
+ } finally {
141
+ _iterator2.f();
142
+ }
143
+ return expanded;
144
+ }
@@ -254,6 +254,10 @@ export declare function clearTempOrderHolderAssignments(tempOrder: OrderTempOrde
254
254
  * getOrderProductLineUid({ metadata: { unique_identification_number: 'line-1' } }); // 'line-1'
255
255
  */
256
256
  export declare function getOrderProductLineUid(product: Record<string, any> | null | undefined): string | null;
257
+ export declare function getRuntimeProductOrigin(tempOrder: OrderTempOrder | null | undefined, product: any): Record<string, any> | null;
258
+ export declare function isHolderConfigRequired(holderConfig: any): boolean;
259
+ export declare function productRequiresFormSubject(tempOrder: OrderTempOrder | null | undefined, product: any): boolean;
260
+ export declare function resolveIsFormSubject(tempOrder: OrderTempOrder | null | undefined, product?: any): boolean;
257
261
  /**
258
262
  * 判断展示字段是否为空(含 i18n 对象全空)。
259
263
  *
@@ -1,7 +1,8 @@
1
- var _excluded = ["unique_identification_number"],
2
- _excluded2 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
3
- _excluded3 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id"],
4
- _excluded4 = ["collect_pax", "table_occupancy_duration"];
1
+ var _excluded = ["custom_product_bundle_map_id"],
2
+ _excluded2 = ["unique_identification_number"],
3
+ _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
4
+ _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id"],
5
+ _excluded5 = ["collect_pax", "table_occupancy_duration"];
5
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
7
8
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -446,6 +447,54 @@ export function normalizeOrderProductDiscountList(discountList) {
446
447
  return normalized;
447
448
  });
448
449
  }
450
+ function resolveSubmitBundleMapId(bundle) {
451
+ var _bundle$metadata;
452
+ var metadataMapId = (_bundle$metadata = bundle.metadata) === null || _bundle$metadata === void 0 ? void 0 : _bundle$metadata.custom_product_bundle_map_id;
453
+ if (metadataMapId !== undefined && metadataMapId !== null && metadataMapId !== '') {
454
+ return metadataMapId;
455
+ }
456
+ if (bundle._id !== undefined && bundle._id !== null && bundle._id !== '') {
457
+ return bundle._id;
458
+ }
459
+ return undefined;
460
+ }
461
+ function collectSubmitProductDiscountList(product) {
462
+ var submitDiscountList = Array.isArray(product === null || product === void 0 ? void 0 : product.discount_list) ? _toConsumableArray(product.discount_list) : [];
463
+ var _iterator6 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
464
+ _step6;
465
+ try {
466
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
467
+ var bundle = _step6.value;
468
+ if (!bundle || _typeof(bundle) !== 'object') continue;
469
+ var bundleMapId = resolveSubmitBundleMapId(bundle);
470
+ var bundleDiscountList = Array.isArray(bundle.discount_list) ? bundle.discount_list : [];
471
+ var _iterator7 = _createForOfIteratorHelper(bundleDiscountList),
472
+ _step7;
473
+ try {
474
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
475
+ var discount = _step7.value;
476
+ if (!discount || _typeof(discount) !== 'object') continue;
477
+ var discountMetadata = discount.metadata && _typeof(discount.metadata) === 'object' ? discount.metadata : {};
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;
479
+ submitDiscountList.push(_objectSpread(_objectSpread({}, discount), discountMapId !== undefined ? {
480
+ metadata: _objectSpread(_objectSpread({}, discountMetadata), {}, {
481
+ custom_product_bundle_map_id: discountMapId
482
+ })
483
+ } : {}));
484
+ }
485
+ } catch (err) {
486
+ _iterator7.e(err);
487
+ } finally {
488
+ _iterator7.f();
489
+ }
490
+ }
491
+ } catch (err) {
492
+ _iterator6.e(err);
493
+ } finally {
494
+ _iterator6.f();
495
+ }
496
+ return normalizeOrderProductDiscountList(submitDiscountList);
497
+ }
449
498
 
450
499
  /**
451
500
  * 手动改价(price_override)时行级 original_price(composite 单价):
@@ -495,7 +544,8 @@ export function resolveEffectivePerUnitDiscount(product) {
495
544
  return sum + Number((discount === null || discount === void 0 ? void 0 : discount.amount) || 0);
496
545
  }, 0);
497
546
  var hasPromoDiscountItem = discountList.some(function (item) {
498
- 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';
499
549
  });
500
550
  if (hasPromoDiscountItem) return fromList;
501
551
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
@@ -783,6 +833,8 @@ function formatSubmitBundleItems(bundle) {
783
833
  var _ref25, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref26, _rawBundle$price_type, _ref27, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
784
834
  var rawBundle = b && _typeof(b) === 'object' ? b : {};
785
835
  var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
836
+ var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
837
+ submitMetadata = _objectWithoutProperties(existedMetadata, _excluded);
786
838
 
787
839
  // bundle_selling_price 出站存「正净额」:markdown 为 |price| − Σoptions(如 3.70),
788
840
  // markup/原价维持原值;与后端口径一致(price 仍为毛价)。
@@ -794,6 +846,8 @@ function formatSubmitBundleItems(bundle) {
794
846
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
795
847
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
796
848
  var num = toBundleNumber((_rawBundle$num = rawBundle.num) !== null && _rawBundle$num !== void 0 ? _rawBundle$num : rawBundle.quantity, 1);
849
+ var bundleMapId = resolveSubmitBundleMapId(rawBundle);
850
+ var hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
797
851
  return {
798
852
  is_charge_tax: (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
799
853
  bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
@@ -810,7 +864,9 @@ function formatSubmitBundleItems(bundle) {
810
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,
811
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,
812
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,
813
- metadata: _objectSpread(_objectSpread({}, existedMetadata), {}, {
867
+ metadata: _objectSpread(_objectSpread(_objectSpread({}, submitMetadata), hasSubmitBundleDiscounts && bundleMapId !== undefined ? {
868
+ custom_product_bundle_map_id: bundleMapId
869
+ } : {}), {}, {
814
870
  surcharge_fee: surchargeFee,
815
871
  relation_surcharge_ids: relationSurchargeIds,
816
872
  product_discount_difference: productDiscountDifference
@@ -839,7 +895,7 @@ function normalizeSubmitProduct(product) {
839
895
  var _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
840
896
  var _ref28 = product,
841
897
  _runtimeUid = _ref28.unique_identification_number,
842
- submitProduct = _objectWithoutProperties(_ref28, _excluded);
898
+ submitProduct = _objectWithoutProperties(_ref28, _excluded2);
843
899
  var num = submitProduct.num,
844
900
  _productSurchargeFee = submitProduct.surcharge_fee,
845
901
  _deprecatedDiscountAmount = submitProduct.discount_amount,
@@ -847,7 +903,7 @@ function normalizeSubmitProduct(product) {
847
903
  _deprecatedDiscountway = submitProduct.discountway,
848
904
  _deprecatedProductDiscountReason = submitProduct.product_discount_reason,
849
905
  _deprecatedDiscountPer = submitProduct.discount_per,
850
- productRest = _objectWithoutProperties(submitProduct, _excluded2);
906
+ productRest = _objectWithoutProperties(submitProduct, _excluded3);
851
907
  delete productRest["product_".concat('option', "_item")];
852
908
  var rawMetadata = submitProduct.metadata || {};
853
909
  var bookingUid = rawMetadata.booking_uid;
@@ -877,7 +933,7 @@ function normalizeSubmitProduct(product) {
877
933
  } : {}), {}, {
878
934
  product_quantity: toBundleNumber(num !== null && num !== void 0 ? num : submitProduct.product_quantity, 1),
879
935
  product_sku: productSku,
880
- discount_list: normalizeOrderProductDiscountList(submitProduct.discount_list),
936
+ discount_list: collectSubmitProductDiscountList(submitProduct),
881
937
  product_bundle: formatSubmitBundleItems(submitProduct.product_bundle),
882
938
  metadata: cleanMetadata,
883
939
  // 出站兼容:后端消费 payment_price 字段(行 composite 已减整单折扣均摊)。
@@ -899,19 +955,19 @@ export function normalizeBookingSubType(booking) {
899
955
  export function normalizeSubmitBooking(booking) {
900
956
  var rawMetadata = booking.metadata || {};
901
957
  var cleanMetadata = {};
902
- var _iterator6 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
903
- _step6;
958
+ var _iterator8 = _createForOfIteratorHelper(SUBMIT_BOOKING_METADATA_WHITELIST),
959
+ _step8;
904
960
  try {
905
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
906
- var key = _step6.value;
961
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
962
+ var key = _step8.value;
907
963
  if (rawMetadata[key] !== undefined) {
908
964
  cleanMetadata[key] = rawMetadata[key];
909
965
  }
910
966
  }
911
967
  } catch (err) {
912
- _iterator6.e(err);
968
+ _iterator8.e(err);
913
969
  } finally {
914
- _iterator6.f();
970
+ _iterator8.f();
915
971
  }
916
972
  if (cleanMetadata.holder_id === undefined) cleanMetadata.holder_id = null;
917
973
  var bookingRecord = booking;
@@ -1035,7 +1091,7 @@ export function buildSubmitPayload(params) {
1035
1091
  _totalRefundAmount = _ref29.total_refund_amount,
1036
1092
  _createDate = _ref29.create_date,
1037
1093
  _holderId = _ref29.holder_id,
1038
- tempOrderRest = _objectWithoutProperties(_ref29, _excluded3);
1094
+ tempOrderRest = _objectWithoutProperties(_ref29, _excluded4);
1039
1095
  var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
1040
1096
  if (!submitType) {
1041
1097
  var _tempOrder$bookings;
@@ -1086,7 +1142,7 @@ export function buildSubmitPayload(params) {
1086
1142
  var _ref31 = tempOrder.metadata || {},
1087
1143
  _collectPax = _ref31.collect_pax,
1088
1144
  _tableOccupancyDuration = _ref31.table_occupancy_duration,
1089
- rest = _objectWithoutProperties(_ref31, _excluded4);
1145
+ rest = _objectWithoutProperties(_ref31, _excluded5);
1090
1146
  return _objectSpread({}, rest);
1091
1147
  }(),
1092
1148
  products: (tempOrder.products || []).map(function (product) {
@@ -1224,25 +1280,25 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1224
1280
  target[key] = null;
1225
1281
  changed = true;
1226
1282
  };
1227
- var _iterator7 = _createForOfIteratorHelper(tempOrder.products || []),
1228
- _step7;
1283
+ var _iterator9 = _createForOfIteratorHelper(tempOrder.products || []),
1284
+ _step9;
1229
1285
  try {
1230
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1231
- var product = _step7.value;
1286
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1287
+ var product = _step9.value;
1232
1288
  if (product.metadata && _typeof(product.metadata) === 'object') {
1233
1289
  resetHolderField(product.metadata);
1234
1290
  }
1235
1291
  }
1236
1292
  } catch (err) {
1237
- _iterator7.e(err);
1293
+ _iterator9.e(err);
1238
1294
  } finally {
1239
- _iterator7.f();
1295
+ _iterator9.f();
1240
1296
  }
1241
- var _iterator8 = _createForOfIteratorHelper(tempOrder.bookings || []),
1242
- _step8;
1297
+ var _iterator10 = _createForOfIteratorHelper(tempOrder.bookings || []),
1298
+ _step10;
1243
1299
  try {
1244
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1245
- var booking = _step8.value;
1300
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
1301
+ var booking = _step10.value;
1246
1302
  var bookingRecord = booking;
1247
1303
  if (booking.metadata && _typeof(booking.metadata) === 'object') {
1248
1304
  resetHolderField(booking.metadata);
@@ -1253,9 +1309,9 @@ export function clearTempOrderHolderAssignments(tempOrder) {
1253
1309
  }
1254
1310
  }
1255
1311
  } catch (err) {
1256
- _iterator8.e(err);
1312
+ _iterator10.e(err);
1257
1313
  } finally {
1258
- _iterator8.f();
1314
+ _iterator10.f();
1259
1315
  }
1260
1316
  var productsByUid = (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid;
1261
1317
  if (productsByUid && _typeof(productsByUid) === 'object') {
@@ -1287,6 +1343,37 @@ export function getOrderProductLineUid(product) {
1287
1343
  if (uid === undefined || uid === null || uid === '') return null;
1288
1344
  return String(uid);
1289
1345
  }
1346
+ export function getRuntimeProductOrigin(tempOrder, product) {
1347
+ var _tempOrder$_extend2, _tempOrder$_extend3;
1348
+ var uid = getOrderProductLineUid(product);
1349
+ if (uid && tempOrder !== null && tempOrder !== void 0 && (_tempOrder$_extend2 = tempOrder._extend) !== null && _tempOrder$_extend2 !== void 0 && (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) !== null && _tempOrder$_extend2 !== void 0 && (_tempOrder$_extend2 = _tempOrder$_extend2[uid]) !== null && _tempOrder$_extend2 !== void 0 && _tempOrder$_extend2.origin) {
1350
+ return tempOrder._extend.productsByUid[uid].origin;
1351
+ }
1352
+ var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1353
+ var _ref32, _item$product_id, _ref33, _product$product_id;
1354
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref32 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref32 !== void 0 ? _ref32 : '') === String((_ref33 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref33 !== void 0 ? _ref33 : '');
1355
+ });
1356
+ var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1357
+ return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[matchedUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin) || null : null;
1358
+ }
1359
+ export function isHolderConfigRequired(holderConfig) {
1360
+ if (!holderConfig || _typeof(holderConfig) !== 'object') return false;
1361
+ if (holderConfig.status === 'disable') return false;
1362
+ return Number(holderConfig.required) === 1;
1363
+ }
1364
+ export function productRequiresFormSubject(tempOrder, product) {
1365
+ var runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
1366
+ return isHolderConfigRequired(product === null || product === void 0 ? void 0 : product.holder_config) || isHolderConfigRequired(runtimeOrigin === null || runtimeOrigin === void 0 ? void 0 : runtimeOrigin.holder_config);
1367
+ }
1368
+ export function resolveIsFormSubject(tempOrder, product) {
1369
+ var _tempOrder$holder;
1370
+ // 旧版预约维度的 holder 类型仍然生效;新版则从当前商品 holder_config 判断。
1371
+ if ((tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.type) === 'form') return true;
1372
+ if (product) return productRequiresFormSubject(tempOrder, product);
1373
+ return ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).some(function (item) {
1374
+ return productRequiresFormSubject(tempOrder, item);
1375
+ });
1376
+ }
1290
1377
 
1291
1378
  /**
1292
1379
  * 判断展示字段是否为空(含 i18n 对象全空)。
@@ -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,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Rules, RulesModuleAPI, DiscountResult, UnavailableReason } from './types';
3
+ import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, UnavailableReason } from './types';
4
4
  import { Discount } from '../Discount/types';
5
5
  import { SetDiscountSelectedParams } from '../../solution/ShopDiscount/types';
6
6
  import { WindowPlugin } from '../../plugins';
@@ -24,7 +24,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
24
24
  holders: {
25
25
  form_record_id: number;
26
26
  }[];
27
- isFormSubject: boolean;
27
+ isFormSubject: RulesFormSubject;
28
28
  }): {
29
29
  isAvailable: boolean;
30
30
  discountList: Discount[];
@@ -36,6 +36,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
36
36
  excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
37
37
  /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
38
38
  resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
39
+ private isItemRewardProductDiscount;
39
40
  private getUnavailableReason;
40
41
  calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
41
42
  discountList: Discount[];
@@ -43,7 +44,7 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
43
44
  holders: {
44
45
  form_record_id: number;
45
46
  }[];
46
- isFormSubject: boolean;
47
+ isFormSubject: RulesFormSubject;
47
48
  orderTotalAmount: number;
48
49
  }, options?: {
49
50
  isSelected?: boolean;