@pisell/pisellos 2.1.54 → 2.1.59

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 (95) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/modules/Cart/types.d.ts +0 -2
  4. package/dist/modules/Cart/utils/cartProduct.js +0 -11
  5. package/dist/modules/Discount/types.d.ts +2 -15
  6. package/dist/modules/Payment/index.d.ts +1 -2
  7. package/dist/modules/Payment/index.js +7 -10
  8. package/dist/modules/Payment/utils.js +0 -3
  9. package/dist/modules/Payment/walletpass.d.ts +0 -23
  10. package/dist/modules/Payment/walletpass.js +95 -191
  11. package/dist/modules/Rules/index.d.ts +5 -8
  12. package/dist/modules/Rules/index.js +31 -154
  13. package/dist/modules/Rules/types.d.ts +1 -1
  14. package/dist/modules/Summary/types.d.ts +0 -2
  15. package/dist/modules/Summary/utils.d.ts +0 -6
  16. package/dist/modules/Summary/utils.js +0 -21
  17. package/dist/plugins/window.d.ts +0 -2
  18. package/dist/solution/BookingByStep/index.d.ts +1 -2
  19. package/dist/solution/Checkout/index.js +0 -2
  20. package/dist/solution/ShopDiscount/index.d.ts +4 -1
  21. package/dist/solution/ShopDiscount/index.js +11 -12
  22. package/dist/solution/ShopDiscount/types.d.ts +4 -1
  23. package/dist/solution/ShopDiscount/utils.js +28 -29
  24. package/lib/index.d.ts +0 -1
  25. package/lib/index.js +1 -3
  26. package/lib/modules/Cart/types.d.ts +0 -2
  27. package/lib/modules/Cart/utils/cartProduct.js +0 -9
  28. package/lib/modules/Discount/types.d.ts +2 -15
  29. package/lib/modules/Payment/index.d.ts +1 -2
  30. package/lib/modules/Payment/index.js +0 -1
  31. package/lib/modules/Payment/utils.js +0 -3
  32. package/lib/modules/Payment/walletpass.d.ts +0 -23
  33. package/lib/modules/Payment/walletpass.js +17 -94
  34. package/lib/modules/Rules/index.d.ts +5 -8
  35. package/lib/modules/Rules/index.js +197 -372
  36. package/lib/modules/Rules/types.d.ts +1 -1
  37. package/lib/modules/Summary/types.d.ts +0 -2
  38. package/lib/modules/Summary/utils.d.ts +0 -6
  39. package/lib/modules/Summary/utils.js +0 -15
  40. package/lib/plugins/window.d.ts +0 -2
  41. package/lib/solution/BookingByStep/index.d.ts +1 -2
  42. package/lib/solution/Checkout/index.js +0 -2
  43. package/lib/solution/ShopDiscount/index.d.ts +4 -1
  44. package/lib/solution/ShopDiscount/index.js +9 -8
  45. package/lib/solution/ShopDiscount/types.d.ts +4 -1
  46. package/lib/solution/ShopDiscount/utils.js +18 -13
  47. package/package.json +1 -1
  48. package/dist/model/index.d.ts +0 -1
  49. package/dist/model/index.js +0 -1
  50. package/dist/model/strategy/adapter/index.d.ts +0 -3
  51. package/dist/model/strategy/adapter/index.js +0 -4
  52. package/dist/model/strategy/adapter/type.d.ts +0 -28
  53. package/dist/model/strategy/adapter/type.js +0 -1
  54. package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  55. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -496
  56. package/dist/model/strategy/adapter/walletPass/example.d.ts +0 -4
  57. package/dist/model/strategy/adapter/walletPass/example.js +0 -258
  58. package/dist/model/strategy/adapter/walletPass/index.d.ts +0 -32
  59. package/dist/model/strategy/adapter/walletPass/index.js +0 -182
  60. package/dist/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  61. package/dist/model/strategy/adapter/walletPass/locales.js +0 -23
  62. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -163
  63. package/dist/model/strategy/adapter/walletPass/type.js +0 -1
  64. package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  65. package/dist/model/strategy/adapter/walletPass/utils.js +0 -965
  66. package/dist/model/strategy/index.d.ts +0 -94
  67. package/dist/model/strategy/index.js +0 -551
  68. package/dist/model/strategy/strategy-example.d.ts +0 -5
  69. package/dist/model/strategy/strategy-example.js +0 -331
  70. package/dist/model/strategy/type.d.ts +0 -228
  71. package/dist/model/strategy/type.js +0 -94
  72. package/lib/model/index.d.ts +0 -1
  73. package/lib/model/index.js +0 -23
  74. package/lib/model/strategy/adapter/index.d.ts +0 -3
  75. package/lib/model/strategy/adapter/index.js +0 -45
  76. package/lib/model/strategy/adapter/type.d.ts +0 -28
  77. package/lib/model/strategy/adapter/type.js +0 -17
  78. package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -84
  79. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -420
  80. package/lib/model/strategy/adapter/walletPass/example.d.ts +0 -4
  81. package/lib/model/strategy/adapter/walletPass/example.js +0 -207
  82. package/lib/model/strategy/adapter/walletPass/index.d.ts +0 -32
  83. package/lib/model/strategy/adapter/walletPass/index.js +0 -142
  84. package/lib/model/strategy/adapter/walletPass/locales.d.ts +0 -1
  85. package/lib/model/strategy/adapter/walletPass/locales.js +0 -51
  86. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -163
  87. package/lib/model/strategy/adapter/walletPass/type.js +0 -17
  88. package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -50
  89. package/lib/model/strategy/adapter/walletPass/utils.js +0 -660
  90. package/lib/model/strategy/index.d.ts +0 -94
  91. package/lib/model/strategy/index.js +0 -413
  92. package/lib/model/strategy/strategy-example.d.ts +0 -5
  93. package/lib/model/strategy/strategy-example.js +0 -318
  94. package/lib/model/strategy/type.d.ts +0 -228
  95. package/lib/model/strategy/type.js +0 -44
@@ -25,7 +25,7 @@ export interface RulesModuleAPI {
25
25
  holders: {
26
26
  form_record_id: number;
27
27
  }[];
28
- orderTotalAmount: number;
28
+ isFormSubject: boolean;
29
29
  }) => DiscountResult;
30
30
  }
31
31
  type ProductDetail = {
@@ -5,8 +5,6 @@ export interface ISummaryState {
5
5
  subtotal: string | number;
6
6
  /** 最终总价 */
7
7
  total: string | number;
8
- /** 最终原始价格 不包含折扣卡商品券折扣 */
9
- originTotal: string | number;
10
8
  /** 税率标题 */
11
9
  taxTitle?: string;
12
10
  /** 商品总费率 */
@@ -8,12 +8,6 @@ export declare const calculatePriceDetails: (shopInfo: any, items: CartItem[]) =
8
8
  * @returns 商品总价字符串,保留2位小数
9
9
  */
10
10
  export declare const calculateSubtotal: (items: CartItem[]) => string;
11
- /**
12
- * 计算商品小计(不含其他费用 不包含折扣卡商品券抵扣金额)
13
- * @param items - 购物车商品数组
14
- * @returns 商品总价字符串,保留2位小数
15
- */
16
- export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
17
11
  /**
18
12
  * @title: 单个商品的税费
19
13
  * @description:
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  calculateDeposit: () => calculateDeposit,
33
- calculateOriginSubtotal: () => calculateOriginSubtotal,
34
33
  calculatePriceDetails: () => calculatePriceDetails,
35
34
  calculateSubtotal: () => calculateSubtotal,
36
35
  calculateTaxFee: () => calculateTaxFee
@@ -39,15 +38,12 @@ module.exports = __toCommonJS(utils_exports);
39
38
  var import_decimal = __toESM(require("decimal.js"));
40
39
  var calculatePriceDetails = (shopInfo, items) => {
41
40
  const subtotal = new import_decimal.default(calculateSubtotal(items));
42
- const subOriginTotal = new import_decimal.default(calculateOriginSubtotal(items));
43
41
  const totalTaxFee = new import_decimal.default(calculateTaxFee(shopInfo, items));
44
42
  const total = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subtotal : subtotal.plus(totalTaxFee);
45
- const originTotal = (shopInfo == null ? void 0 : shopInfo.is_price_include_tax) ? subOriginTotal : subOriginTotal.plus(totalTaxFee);
46
43
  const deposit = calculateDeposit(items);
47
44
  return {
48
45
  subtotal: subtotal.toFixed(2),
49
46
  total: total.toFixed(2),
50
- originTotal: originTotal.toFixed(2),
51
47
  taxTitle: shopInfo == null ? void 0 : shopInfo.tax_title,
52
48
  totalTaxFee: totalTaxFee.toFixed(2),
53
49
  isPriceIncludeTax: shopInfo == null ? void 0 : shopInfo.is_price_include_tax,
@@ -64,16 +60,6 @@ var calculateSubtotal = (items) => {
64
60
  }, new import_decimal.default(0));
65
61
  return subtotal.toFixed(2);
66
62
  };
67
- var calculateOriginSubtotal = (items) => {
68
- if (!(items == null ? void 0 : items.length)) {
69
- return "0.00";
70
- }
71
- const subtotal = items.reduce((sum, item) => {
72
- const cartItemTotalPrice = new import_decimal.default(item.summaryOriginTotal || 0);
73
- return sum.plus(cartItemTotalPrice);
74
- }, new import_decimal.default(0));
75
- return subtotal.toFixed(2);
76
- };
77
63
  var calculateTaxFee = (shopInfo, items) => {
78
64
  if (!(items == null ? void 0 : items.length)) {
79
65
  return "0.00";
@@ -115,7 +101,6 @@ var calculateDeposit = (items) => {
115
101
  // Annotate the CommonJS export names for ESM import in node:
116
102
  0 && (module.exports = {
117
103
  calculateDeposit,
118
- calculateOriginSubtotal,
119
104
  calculatePriceDetails,
120
105
  calculateSubtotal,
121
106
  calculateTaxFee
@@ -1,4 +1,3 @@
1
- import { WalletPassEvaluator } from '../model';
2
1
  import { Plugin } from '../types';
3
2
  /**
4
3
  * WindowPlugin 接口定义
@@ -15,7 +14,6 @@ export interface WindowPlugin extends Plugin {
15
14
  document: Partial<Document>;
16
15
  history: History;
17
16
  interaction?: any;
18
- getWalletPassEvaluator?: () => WalletPassEvaluator;
19
17
  }
20
18
  /**
21
19
  * 简单的 Storage 接口实现
@@ -144,7 +144,6 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
144
144
  getSummary(): Promise<{
145
145
  subtotal: string | number;
146
146
  total: string | number;
147
- originTotal: string | number;
148
147
  taxTitle?: string | undefined;
149
148
  totalTaxFee?: string | number | undefined;
150
149
  isPriceIncludeTax?: 0 | 1 | undefined;
@@ -343,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
343
342
  };
344
343
  setOtherData(key: string, value: any): void;
345
344
  getOtherData(key: string): any;
346
- getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
345
+ getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
347
346
  /**
348
347
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
349
348
  *
@@ -222,7 +222,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
222
222
  product_id: item.product_id,
223
223
  product_variant_id: item.product_variant_id,
224
224
  quantity: item.num,
225
- is_price_include_tax: item.is_price_include_tax,
226
225
  // 商品是否含税:1;0
227
226
  is_charge_tax: item.is_charge_tax ?? 0,
228
227
  // 若商品不含税,计算得到的税费,单位(元)
@@ -247,7 +246,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
247
246
  },
248
247
  product_bundle: item.product_bundle.map((bundle) => {
249
248
  return {
250
- is_price_include_tax: item.is_price_include_tax,
251
249
  bundle_id: bundle.bundle_id,
252
250
  bundle_product_id: bundle.bundle_product_id,
253
251
  bundle_variant_id: bundle.bundle_variant_id,
@@ -21,10 +21,13 @@ export declare class ShopDiscountImpl extends BaseModule implements Module {
21
21
  getCurrentBookingTime(): string | null;
22
22
  private filterDiscountListByBookingTime;
23
23
  setCustomer(customer: Customer): Promise<void>;
24
- setOriginTotalAmount(amount: number): void;
25
24
  setHolders(holders: {
26
25
  form_record_id: number;
27
26
  }[]): void;
27
+ setBookingSubject(bookingSubject: {
28
+ type?: 'form' | 'customer';
29
+ [key: string]: any;
30
+ }): void;
28
31
  calcDiscount(productList: Record<string, any>[], options?: SetDiscountSelectedParams): {
29
32
  productList: Record<string, any>[];
30
33
  discountList: Discount[];
@@ -55,7 +55,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
55
55
  originalDiscountList: [],
56
56
  currentBookingTime: "",
57
57
  filteredDiscountList: [],
58
- orderTotalAmount: 0
58
+ bookingSubject: void 0
59
59
  };
60
60
  }
61
61
  // =========== 生命周期方法 ===========
@@ -193,15 +193,16 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
193
193
  );
194
194
  }
195
195
  }
196
- setOriginTotalAmount(amount) {
197
- this.store.orderTotalAmount = amount;
198
- }
199
196
  // 设置holders
200
197
  setHolders(holders) {
201
198
  this.store.holders = holders;
202
199
  }
200
+ setBookingSubject(bookingSubject) {
201
+ this.store.bookingSubject = bookingSubject;
202
+ }
203
203
  // 计算优惠券
204
204
  calcDiscount(productList, options) {
205
+ var _a;
205
206
  this.store.productList = productList;
206
207
  const rulesModule = this.core.getModule(`${this.name}_rules`);
207
208
  if (!rulesModule) {
@@ -212,7 +213,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
212
213
  productList,
213
214
  discountList: this.getDiscountList(),
214
215
  holders: this.store.holders || [],
215
- orderTotalAmount: this.store.orderTotalAmount || 0
216
+ isFormSubject: ((_a = this.store.bookingSubject) == null ? void 0 : _a.type) === "form"
216
217
  },
217
218
  options
218
219
  ) || { productList, discountList: this.getDiscountList() };
@@ -259,7 +260,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
259
260
  }
260
261
  // 扫码输入code
261
262
  async scanCode(code, customerId) {
262
- var _a, _b;
263
+ var _a, _b, _c;
263
264
  try {
264
265
  const resultDiscountList = await ((_a = this.store.discount) == null ? void 0 : _a.batchSearch(code, customerId)) || [];
265
266
  const rulesModule = this.store.rules;
@@ -303,7 +304,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
303
304
  oldDiscountList: this.getDiscountList(),
304
305
  newDiscountList: withScanList,
305
306
  holders: this.store.holders || [],
306
- orderTotalAmount: this.store.orderTotalAmount || 0
307
+ isFormSubject: ((_b = this.store.bookingSubject) == null ? void 0 : _b.type) === "form"
307
308
  }) || {
308
309
  isAvailable: false,
309
310
  productList: this.store.productList || [],
@@ -313,7 +314,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
313
314
  this.setDiscountList(newDiscountList || []);
314
315
  this.store.originalDiscountList = newDiscountList || [];
315
316
  this.setProductList(newProductList || []);
316
- if (this.isWalkIn() && resultDiscountList.length && ((_b = this.options.otherParams) == null ? void 0 : _b.platform) === "shop") {
317
+ if (this.isWalkIn() && resultDiscountList.length && ((_c = this.options.otherParams) == null ? void 0 : _c.platform) === "shop") {
317
318
  await this.getCustomerWallet(
318
319
  resultDiscountList[0].customer_id
319
320
  );
@@ -31,7 +31,10 @@ export interface ShopDiscountState {
31
31
  originalDiscountList: Discount[];
32
32
  currentBookingTime: string | null;
33
33
  filteredDiscountList: Discount[];
34
- orderTotalAmount?: number;
34
+ bookingSubject?: {
35
+ type?: 'form' | 'customer';
36
+ [key: string]: any;
37
+ };
35
38
  }
36
39
  export interface SetDiscountSelectedParams {
37
40
  discountId: number;
@@ -54,18 +54,14 @@ var isAllNormalProduct = (items) => {
54
54
  };
55
55
  var getDiscountAmount = (discount, total, price) => {
56
56
  var _a;
57
- let discountedPrice = 0;
58
57
  if (discount.tag === "good_pass") {
59
- discountedPrice = new import_decimal.default(price).minus(new import_decimal.default(price || 0)).toNumber();
60
- } else {
61
- const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
62
- if (isFixedAmount) {
63
- discountedPrice = Math.max(new import_decimal.default(price).minus(new import_decimal.default(discount.par_value || 0)).toNumber(), 0);
64
- } else {
65
- discountedPrice = new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
66
- }
58
+ return new import_decimal.default(price).minus(new import_decimal.default(price || 0)).toNumber();
59
+ }
60
+ const isFixedAmount = ((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.discount_card_type) === "fixed_amount";
61
+ if (isFixedAmount) {
62
+ return Math.max(new import_decimal.default(price).minus(new import_decimal.default(discount.par_value || 0)).toNumber(), 0);
67
63
  }
68
- return discountedPrice;
64
+ return new import_decimal.default(100).minus(discount.par_value || 0).div(100).mul(new import_decimal.default(price)).toNumber();
69
65
  };
70
66
  var getDiscountListAmountTotal = (discount) => {
71
67
  return discount.reduce((acc, cur) => {
@@ -294,11 +290,20 @@ var filterDiscountListByBookingTime = (discountList, bookingTime) => {
294
290
  return discountList;
295
291
  }
296
292
  return discountList.filter((discount) => {
297
- var _a, _b, _c;
298
- if (!((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.validity_type) || ((_b = discount == null ? void 0 : discount.metadata) == null ? void 0 : _b.validity_type) === "fixed_validity") {
293
+ var _a, _b;
294
+ if (((_a = discount == null ? void 0 : discount.metadata) == null ? void 0 : _a.validity_type) === "custom_schedule_validity") {
295
+ return getDateIsInSchedule(bookingTime, ((_b = discount.custom_schedule_snapshot) == null ? void 0 : _b.data) || []);
296
+ }
297
+ try {
298
+ const isHasStart = !!discount.start_date && !!discount.start_time;
299
+ const startDate = (0, import_dayjs.default)(`${discount.start_date} ${discount.start_time}`);
300
+ const bookingTimeDayjs = (0, import_dayjs.default)(bookingTime);
301
+ const isAfterStart = isHasStart ? bookingTimeDayjs.isSameOrAfter(startDate) : true;
302
+ const isBeforeExpire = discount.expire_time ? bookingTimeDayjs.isSameOrBefore((0, import_dayjs.default)(discount.expire_time)) : true;
303
+ return isAfterStart && isBeforeExpire;
304
+ } catch (error) {
299
305
  return true;
300
306
  }
301
- return getDateIsInSchedule(bookingTime, ((_c = discount.custom_schedule_snapshot) == null ? void 0 : _c.data) || []);
302
307
  });
303
308
  };
304
309
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.54",
4
+ "version": "2.1.59",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- export * from './strategy';
@@ -1 +0,0 @@
1
- export * from "./strategy";
@@ -1,3 +0,0 @@
1
- export * from './type';
2
- export { default as WalletPassAdapter } from './walletPass';
3
- export { WalletPassEvaluator } from './walletPass/evaluator';
@@ -1,4 +0,0 @@
1
- export * from "./type";
2
- export { default as WalletPassAdapter } from "./walletPass";
3
- export { WalletPassEvaluator } from "./walletPass/evaluator";
4
- // export * from './walletPass/type';
@@ -1,28 +0,0 @@
1
- import { EvaluationResult, RuntimeContext } from '../type';
2
- export interface BusinessAdapter {
3
- /**
4
- * 适配器名称
5
- */
6
- name: string;
7
- /**
8
- * 适配器版本
9
- */
10
- version: string;
11
- /**
12
- * 准备运行时上下文
13
- * 将业务数据转换为策略引擎可识别的上下文
14
- */
15
- prepareContext(businessData: any): RuntimeContext;
16
- /**
17
- * 转换执行结果
18
- * 将策略引擎的通用结果转换为业务层需要的格式
19
- */
20
- transformResult(result: EvaluationResult, businessData?: any): any;
21
- /**
22
- * 根据业务数据重新格式化配置
23
- */
24
- formatConfig(result: EvaluationResult, businessData?: any): {
25
- result: EvaluationResult;
26
- businessData?: any;
27
- };
28
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,84 +0,0 @@
1
- import { StrategyConfig } from '../../type';
2
- import { Voucher, Product, VoucherEvaluationResult, EvaluatorInput } from './type';
3
- /**
4
- * Wallet Pass 评估器
5
- * 用于评估哪些 voucher 可以在当前订单中使用
6
- */
7
- export declare class WalletPassEvaluator {
8
- private engine;
9
- private strategyConfigs;
10
- private locale;
11
- constructor();
12
- setStrategyConfigs(strategyConfigs: StrategyConfig[]): void;
13
- getStrategyConfigs(): StrategyConfig[];
14
- setLocale(locale: string): void;
15
- getText(key: string): string;
16
- /**
17
- * 搜索券的格式
18
- * @param input 输入
19
- * @returns 返回搜索券的格式
20
- */
21
- searchVoucherFormat(input: EvaluatorInput): Voucher[];
22
- /**
23
- * 评估可用的 vouchers
24
- */
25
- evaluate(input: EvaluatorInput): VoucherEvaluationResult[];
26
- /** 检查代金券/折扣卡是否可用 并返回config */
27
- checkVoucherAvailability(input: EvaluatorInput): {
28
- isAvailable: boolean;
29
- config: {
30
- [x: string]: any;
31
- };
32
- };
33
- /**
34
- * 获取推荐券
35
- * @param input 输入
36
- * @returns 返回推荐券列表
37
- */
38
- getRecommendedVouchers(input: EvaluatorInput): {
39
- recommendedAmount: any;
40
- recommended: any[];
41
- transformList: any[];
42
- noApplicableVoucher: Voucher[];
43
- };
44
- enhanceWithReason(voucher: any): any;
45
- /**
46
- * 优惠券处理函数
47
- * @param applicableVouchers 可用的券列表
48
- * @param orderTotalAmount 订单总金额
49
- * @param products 订单商品列表
50
- * @returns 返回推荐券列表和全部列表,每个券包含 _available_max_amount 和 _unified_available_status
51
- */
52
- processVouchers(vouchers: Voucher[], orderTotalAmount: number, products: Product[]): {
53
- recommended: any[];
54
- transformList: any[];
55
- };
56
- /**
57
- * 重新计算优惠券状态(基于已选券的增量计算)
58
- * @param allVouchers 所有原始券列表
59
- * @param selectedVouchers 已选中的券列表(按选中顺序)
60
- * @param orderTotalAmount 订单总金额
61
- * @param products 订单商品列表
62
- * @returns 返回更新后的所有券列表和已选券的详细抵扣信息
63
- */
64
- recalculateVouchers(allVouchers: any[], selectedVouchers: any[], orderTotalAmount: number, products: any[]): {
65
- allWithUpdatedStatus: any[];
66
- selectedWithDetails: any[];
67
- };
68
- /**
69
- * 查找适用于指定 voucher 的策略配置
70
- */
71
- private findApplicableStrategies;
72
- /**
73
- * 检查策略中是否包含指定的 voucher ID
74
- */
75
- private checkVoucherInStrategy;
76
- /**
77
- * 递归检查条件组中是否包含 voucher ID
78
- */
79
- private checkVoucherInConditionGroup;
80
- /**
81
- * 计算适用商品的总金额和数量
82
- */
83
- private calculateApplicableProducts;
84
- }