@pisell/pisellos 2.2.277 → 2.2.800

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 (127) hide show
  1. package/dist/core/index.d.ts +0 -2
  2. package/dist/core/index.js +1 -7
  3. package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  4. package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
  5. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  6. package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
  7. package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
  8. package/dist/model/strategy/adapter/promotion/examples.js +0 -99
  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 +2 -90
  12. package/dist/model/strategy/adapter/promotion/type.js +0 -45
  13. package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -0
  14. package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -5
  15. package/dist/model/strategy/adapter/walletPass/utils.js +26 -57
  16. package/dist/modules/OpenData/index.d.ts +0 -2
  17. package/dist/modules/OpenData/index.js +0 -8
  18. package/dist/modules/Order/index.d.ts +8 -28
  19. package/dist/modules/Order/index.js +496 -808
  20. package/dist/modules/Order/types.d.ts +1 -35
  21. package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
  22. package/dist/modules/Order/utils.js +6 -10
  23. package/dist/modules/Payment/index.d.ts +0 -2
  24. package/dist/modules/Payment/index.js +49 -78
  25. package/dist/modules/Payment/types.d.ts +25 -106
  26. package/dist/modules/Payment/types.js +0 -17
  27. package/dist/modules/Payment/utils.js +1 -4
  28. package/dist/modules/Payment/walletpass.d.ts +1 -49
  29. package/dist/modules/Payment/walletpass.js +124 -1081
  30. package/dist/modules/Rules/index.d.ts +0 -3
  31. package/dist/modules/Rules/index.js +70 -100
  32. package/dist/server/index.d.ts +0 -25
  33. package/dist/server/index.js +1069 -2001
  34. package/dist/server/modules/index.d.ts +1 -1
  35. package/dist/server/modules/order/index.d.ts +4 -70
  36. package/dist/server/modules/order/index.js +728 -1816
  37. package/dist/server/modules/order/types.d.ts +3 -25
  38. package/dist/server/modules/order/types.js +1 -7
  39. package/dist/server/utils/small-ticket.js +2 -1
  40. package/dist/solution/BaseSales/index.d.ts +5 -109
  41. package/dist/solution/BaseSales/index.js +436 -1802
  42. package/dist/solution/BaseSales/types.d.ts +1 -55
  43. package/dist/solution/BaseSales/types.js +1 -2
  44. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  45. package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
  46. package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  47. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +4 -7
  48. package/dist/solution/BookingByStep/index.d.ts +1 -1
  49. package/dist/solution/BookingTicket/index.d.ts +5 -21
  50. package/dist/solution/BookingTicket/index.js +56 -139
  51. package/dist/solution/BookingTicket/types.d.ts +0 -1
  52. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  53. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +83 -173
  54. package/dist/solution/Sales/index.d.ts +0 -2
  55. package/dist/solution/Sales/index.js +4 -26
  56. package/dist/solution/ScanOrder/index.js +20 -31
  57. package/dist/solution/VenueBooking/index.d.ts +0 -1
  58. package/dist/solution/VenueBooking/index.js +19 -30
  59. package/dist/types/index.d.ts +0 -1
  60. package/lib/core/index.d.ts +0 -2
  61. package/lib/core/index.js +1 -4
  62. package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
  63. package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
  64. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
  65. package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
  66. package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
  67. package/lib/model/strategy/adapter/promotion/examples.js +0 -91
  68. package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
  69. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  70. package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
  71. package/lib/model/strategy/adapter/promotion/type.js +0 -2
  72. package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
  73. package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -5
  74. package/lib/model/strategy/adapter/walletPass/utils.js +11 -62
  75. package/lib/modules/OpenData/index.d.ts +0 -2
  76. package/lib/modules/OpenData/index.js +0 -5
  77. package/lib/modules/Order/index.d.ts +8 -28
  78. package/lib/modules/Order/index.js +69 -231
  79. package/lib/modules/Order/types.d.ts +1 -35
  80. package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
  81. package/lib/modules/Order/utils.js +4 -11
  82. package/lib/modules/Payment/index.d.ts +0 -2
  83. package/lib/modules/Payment/index.js +12 -33
  84. package/lib/modules/Payment/types.d.ts +25 -106
  85. package/lib/modules/Payment/types.js +0 -1
  86. package/lib/modules/Payment/utils.js +1 -5
  87. package/lib/modules/Payment/walletpass.d.ts +1 -49
  88. package/lib/modules/Payment/walletpass.js +22 -898
  89. package/lib/modules/Rules/index.d.ts +0 -3
  90. package/lib/modules/Rules/index.js +9 -38
  91. package/lib/server/index.d.ts +0 -25
  92. package/lib/server/index.js +31 -726
  93. package/lib/server/modules/index.d.ts +1 -1
  94. package/lib/server/modules/order/index.d.ts +4 -70
  95. package/lib/server/modules/order/index.js +69 -818
  96. package/lib/server/modules/order/types.d.ts +3 -25
  97. package/lib/server/modules/order/types.js +0 -1
  98. package/lib/server/utils/small-ticket.js +1 -1
  99. package/lib/solution/BaseSales/index.d.ts +5 -109
  100. package/lib/solution/BaseSales/index.js +27 -874
  101. package/lib/solution/BaseSales/types.d.ts +1 -55
  102. package/lib/solution/BaseSales/types.js +1 -2
  103. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
  104. package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
  105. package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
  106. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +3 -4
  107. package/lib/solution/BookingByStep/index.d.ts +1 -1
  108. package/lib/solution/BookingTicket/index.d.ts +5 -21
  109. package/lib/solution/BookingTicket/index.js +13 -64
  110. package/lib/solution/BookingTicket/types.d.ts +0 -1
  111. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
  112. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +5 -37
  113. package/lib/solution/Sales/index.d.ts +0 -2
  114. package/lib/solution/Sales/index.js +6 -20
  115. package/lib/solution/ScanOrder/index.js +0 -8
  116. package/lib/solution/VenueBooking/index.d.ts +0 -1
  117. package/lib/solution/VenueBooking/index.js +0 -8
  118. package/lib/types/index.d.ts +0 -1
  119. package/package.json +1 -1
  120. package/dist/modules/Order/payment-utils.d.ts +0 -26
  121. package/dist/modules/Order/payment-utils.js +0 -225
  122. package/dist/utils/payment-number.d.ts +0 -9
  123. package/dist/utils/payment-number.js +0 -69
  124. package/lib/modules/Order/payment-utils.d.ts +0 -26
  125. package/lib/modules/Order/payment-utils.js +0 -224
  126. package/lib/utils/payment-number.d.ts +0 -9
  127. package/lib/utils/payment-number.js +0 -64
@@ -20,7 +20,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var examples_exports = {};
21
21
  __export(examples_exports, {
22
22
  BUY_X_GET_Y_FREE_STRATEGY: () => BUY_X_GET_Y_FREE_STRATEGY,
23
- ITEM_REWARD_STRATEGY: () => ITEM_REWARD_STRATEGY,
24
23
  X_ITEMS_FOR_Y_PRICE_STRATEGY: () => X_ITEMS_FOR_Y_PRICE_STRATEGY
25
24
  });
26
25
  module.exports = __toCommonJS(examples_exports);
@@ -186,98 +185,8 @@ var BUY_X_GET_Y_FREE_STRATEGY = {
186
185
  }
187
186
  ]
188
187
  };
189
- var ITEM_REWARD_STRATEGY = {
190
- metadata: {
191
- id: "STRATEGY_003",
192
- name: {
193
- en: "Infant ticket free with child ticket",
194
- "zh-CN": "儿童票触发婴儿票免费",
195
- "zh-HK": "兒童票觸發嬰兒票免費"
196
- },
197
- type: "promotion",
198
- custom: {
199
- display: {
200
- product_card: {
201
- text: {
202
- en: "Infant ticket free",
203
- "zh-CN": "婴儿票免费",
204
- "zh-HK": "嬰兒票免費"
205
- },
206
- type: "tag"
207
- }
208
- }
209
- }
210
- },
211
- conditions: {
212
- operator: "and",
213
- rules: [
214
- {
215
- type: "operator",
216
- field: "currentDateTime",
217
- value: "2023-01-01 00:00:00",
218
- operator: ">="
219
- },
220
- {
221
- type: "operator",
222
- field: "currentDateTime",
223
- value: "2030-01-01 00:00:00",
224
- operator: "<="
225
- },
226
- {
227
- type: "operator",
228
- field: "productIdAndVariantId",
229
- value: [
230
- {
231
- product_id: 1001,
232
- // 条件商品:儿童票
233
- product_variant_id: 0
234
- // 0 = 匹配任意变体
235
- }
236
- ],
237
- operator: "product_match"
238
- }
239
- ],
240
- actionIds: ["1"]
241
- },
242
- actions: [
243
- {
244
- id: "1",
245
- type: "ITEM_REWARD",
246
- value: {
247
- rewardMethod: "free",
248
- // free | percent_off | amount_off | fixed_price
249
- rewardValue: 0,
250
- // free 可省略;其他 rewardMethod 使用
251
- quantityRule: "per_condition_quantity",
252
- // per_condition_quantity | all_targets | max_per_order
253
- triggerQuantity: 1,
254
- // N:每满足 N 个条件商品
255
- rewardQuantity: 1,
256
- // Y:奖励 Y 个目标商品
257
- maxRewardQuantity: 1
258
- // max_per_order 使用;本例保留为配置示意
259
- },
260
- valueType: "object",
261
- target: "product",
262
- priority: 1,
263
- config: {
264
- rewardTargets: [
265
- {
266
- product_id: 2001,
267
- // 奖励对象:婴儿票
268
- product_variant_id: 0
269
- // 0 = 匹配任意变体
270
- }
271
- ],
272
- targetSelection: "consumer_best"
273
- // consumer_best = 按可节省金额从高到低选择
274
- }
275
- }
276
- ]
277
- };
278
188
  // Annotate the CommonJS export names for ESM import in node:
279
189
  0 && (module.exports = {
280
190
  BUY_X_GET_Y_FREE_STRATEGY,
281
- ITEM_REWARD_STRATEGY,
282
191
  X_ITEMS_FOR_Y_PRICE_STRATEGY
283
192
  });
@@ -1,4 +1,4 @@
1
1
  export { PromotionEvaluator } from './evaluator';
2
2
  export { PromotionAdapter } from './adapter';
3
3
  export { default } from './adapter';
4
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY, } from './examples';
4
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, } from './examples';
@@ -0,0 +1,49 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/model/strategy/adapter/promotion/index.ts
30
+ var promotion_exports = {};
31
+ __export(promotion_exports, {
32
+ BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
+ PromotionAdapter: () => import_adapter.PromotionAdapter,
34
+ PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
35
+ X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
36
+ default: () => import_adapter2.default
37
+ });
38
+ module.exports = __toCommonJS(promotion_exports);
39
+ var import_evaluator = require("./evaluator");
40
+ var import_adapter = require("./adapter");
41
+ var import_adapter2 = __toESM(require("./adapter"));
42
+ var import_examples = require("./examples");
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ BUY_X_GET_Y_FREE_STRATEGY,
46
+ PromotionAdapter,
47
+ PromotionEvaluator,
48
+ X_ITEMS_FOR_Y_PRICE_STRATEGY
49
+ });
@@ -12,8 +12,6 @@ export declare const PROMOTION_ACTION_TYPES: {
12
12
  readonly X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE";
13
13
  /** 买X送Y(买X件送Y件,可累计) */
14
14
  readonly BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE";
15
- /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
16
- readonly ITEM_REWARD: "ITEM_REWARD";
17
15
  /** 固定折扣 */
18
16
  readonly DISCOUNT_RATE: "DISCOUNT_RATE";
19
17
  /** 固定减价 */
@@ -68,59 +66,6 @@ export interface BuyXGetYFreeConfig {
68
66
  /** 可选的赠品列表 */
69
67
  giftProducts?: ProductIdentifier[];
70
68
  }
71
- /**
72
- * 商品奖励优惠方式
73
- *
74
- * - free: 目标商品最终价为 0
75
- * - percent_off: 目标商品按百分比折扣,rewardValue 为 0-100
76
- * - amount_off: 每个目标商品固定减免 rewardValue
77
- * - fixed_price: 目标商品改为固定价 rewardValue
78
- */
79
- export type ItemRewardMethod = 'free' | 'percent_off' | 'amount_off' | 'fixed_price';
80
- /**
81
- * 商品奖励数量规则
82
- *
83
- * - per_condition_quantity: 每满足 N 个条件商品,奖励 Y 个目标商品
84
- * - all_targets: 满足条件后奖励全部目标商品
85
- * - max_per_order: 满足条件后每单最多奖励固定数量目标商品
86
- */
87
- export type ItemRewardQuantityRule = 'per_condition_quantity' | 'all_targets' | 'max_per_order';
88
- /** 商品奖励目标选择规则 */
89
- export type ItemRewardTargetSelection = 'consumer_best';
90
- /**
91
- * 商品奖励 - Action Value
92
- *
93
- * @example
94
- * value: {
95
- * rewardMethod: 'free',
96
- * quantityRule: 'per_condition_quantity',
97
- * triggerQuantity: 1,
98
- * rewardQuantity: 1,
99
- * }
100
- */
101
- export interface ItemRewardValue {
102
- /** 奖励方式 */
103
- rewardMethod: ItemRewardMethod;
104
- /** 奖励值:percent_off/amount_off/fixed_price 使用,free 可省略 */
105
- rewardValue?: number;
106
- /** 奖励数量规则 */
107
- quantityRule: ItemRewardQuantityRule;
108
- /** 每满足 N 个条件商品;默认 1 */
109
- triggerQuantity?: number;
110
- /** 奖励 Y 个目标商品;默认 1 */
111
- rewardQuantity?: number;
112
- /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
113
- maxRewardQuantity?: number;
114
- }
115
- /**
116
- * 商品奖励 - Action Config
117
- */
118
- export interface ItemRewardConfig {
119
- /** 奖励对象,本期支持指定商品/变体;product_variant_id=0 表示任意变体 */
120
- rewardTargets?: ProductIdentifier[];
121
- /** 目标商品超额时的选择规则;本期支持 consumer_best */
122
- targetSelection?: ItemRewardTargetSelection;
123
- }
124
69
  /**
125
70
  * 商品标识
126
71
  *
@@ -157,19 +102,10 @@ export interface BuyXGetYFreeAction extends Omit<ActionEffect, 'type' | 'value'
157
102
  valueType: 'object';
158
103
  config?: BuyXGetYFreeConfig;
159
104
  }
160
- /**
161
- * 商品奖励 Action
162
- */
163
- export interface ItemRewardAction extends Omit<ActionEffect, 'type' | 'value' | 'config'> {
164
- type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
165
- value: ItemRewardValue;
166
- valueType: 'object';
167
- config?: ItemRewardConfig;
168
- }
169
105
  /**
170
106
  * 促销活动 Action 联合类型
171
107
  */
172
- export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction | ItemRewardAction;
108
+ export type PromotionAction = XItemsForYPriceAction | BuyXGetYFreeAction;
173
109
  /**
174
110
  * 促销相关运算符
175
111
  */
@@ -234,8 +170,6 @@ export interface PromotionProduct {
234
170
  quantity: number;
235
171
  /** 原价 */
236
172
  original_price?: number;
237
- /** 内部字段:编辑态订单行只允许参与 ITEM_REWARD,避免旧促销误算历史行 */
238
- _promotionOnlyForItemReward?: boolean;
239
173
  }
240
174
  /**
241
175
  * 促销活动适配器转换结果
@@ -261,7 +195,7 @@ export interface PromotionTransformResult {
261
195
  /**
262
196
  * Action 详情联合类型
263
197
  */
264
- export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail | ItemRewardActionDetail;
198
+ export type PromotionActionDetail = XItemsForYPriceActionDetail | BuyXGetYFreeActionDetail;
265
199
  /**
266
200
  * X件Y元 Action 详情
267
201
  */
@@ -292,28 +226,6 @@ export interface BuyXGetYFreeActionDetail {
292
226
  /** 可选的赠品列表 */
293
227
  giftProducts: ProductIdentifier[];
294
228
  }
295
- /**
296
- * 商品奖励 Action 详情
297
- */
298
- export interface ItemRewardActionDetail {
299
- type: typeof PROMOTION_ACTION_TYPES.ITEM_REWARD;
300
- /** 奖励方式 */
301
- rewardMethod: ItemRewardMethod;
302
- /** 奖励值:percent_off/amount_off/fixed_price 使用,free 为 0 */
303
- rewardValue: number;
304
- /** 奖励数量规则 */
305
- quantityRule: ItemRewardQuantityRule;
306
- /** 每满足 N 个条件商品;默认 1 */
307
- triggerQuantity: number;
308
- /** 奖励 Y 个目标商品;默认 1 */
309
- rewardQuantity: number;
310
- /** 每单最多奖励 Y 个目标商品;max_per_order 使用 */
311
- maxRewardQuantity?: number;
312
- /** 奖励对象,本期支持指定商品/变体 */
313
- rewardTargets: ProductIdentifier[];
314
- /** 目标商品超额时的选择规则 */
315
- targetSelection: ItemRewardTargetSelection;
316
- }
317
229
  /**
318
230
  * X件Y元 - 业务层计算结果
319
231
  *
@@ -28,8 +28,6 @@ var PROMOTION_ACTION_TYPES = {
28
28
  X_ITEMS_FOR_Y_PRICE: "X_ITEMS_FOR_Y_PRICE",
29
29
  /** 买X送Y(买X件送Y件,可累计) */
30
30
  BUY_X_GET_Y_FREE: "BUY_X_GET_Y_FREE",
31
- /** 商品奖励(满足条件后,订单内指定目标商品享优惠) */
32
- ITEM_REWARD: "ITEM_REWARD",
33
31
  /** 固定折扣 */
34
32
  DISCOUNT_RATE: "DISCOUNT_RATE",
35
33
  /** 固定减价 */
@@ -214,6 +214,7 @@ var WalletPassEvaluator = class {
214
214
  }
215
215
  const rawText = this.getText(reasonCode);
216
216
  const currency = failedField && AMOUNT_FIELDS.has(failedField) ? ((_g = (_f = this.otherParams) == null ? void 0 : _f.getData) == null ? void 0 : _g.call(_f, "shop_symbol")) || "" : "";
217
+ console.log(currency, "currency12345");
217
218
  const reason = thresholdValue !== void 0 ? formatReason(rawText, thresholdValue, currency) : rawText;
218
219
  results.push({
219
220
  voucher,
@@ -415,6 +416,7 @@ var WalletPassEvaluator = class {
415
416
  * 计算适用商品的总金额和数量
416
417
  */
417
418
  calculateApplicableProducts(products, applicableProductIds, deductTaxAndFee) {
419
+ console.log(products, "products1234");
418
420
  let total = 0;
419
421
  let count = 0;
420
422
  if (applicableProductIds !== null && applicableProductIds.length === 0) {
@@ -26,11 +26,6 @@ export interface Voucher {
26
26
  recommended_usage_amount: number;
27
27
  /** 后端计算推荐使用金额(仅商品) 不包含税费附加费 */
28
28
  recommended_pure_product_usage_amount: number;
29
- /**
30
- * 扫码资产自身可供前端重新计算的金额基准。
31
- * 后端 recommended_usage_amount 会包含当前已选券上下文,取消勾选后不能继续把它当作资产永久上限。
32
- */
33
- _wallet_asset_recalculation_base_amount?: number;
34
29
  /** 实际抵扣金额 */
35
30
  actualDeduction: number;
36
31
  /** 抵扣详情 */
@@ -43,21 +43,6 @@ __export(utils_exports, {
43
43
  });
44
44
  module.exports = __toCommonJS(utils_exports);
45
45
  var import_decimal = __toESM(require("decimal.js"));
46
- var DEFAULT_WALLET_PASS_CALCULATION_CONFIG = {
47
- maxDeductionAmount: 99999,
48
- maxUsagePerOrder: 0,
49
- allowCrossProduct: true,
50
- applicableProductLimit: 0,
51
- deductTaxAndFee: true,
52
- maxPassesPerItem: 0,
53
- deductOptionPrice: false
54
- };
55
- function getWalletPassCalculationConfig(voucher) {
56
- return {
57
- ...DEFAULT_WALLET_PASS_CALCULATION_CONFIG,
58
- ...(voucher == null ? void 0 : voucher.config) || {}
59
- };
60
- }
61
46
  var getProductQuantity = (product) => {
62
47
  return product.quantity || product.product_quantity || 1;
63
48
  };
@@ -120,15 +105,9 @@ function applyMaxPassUsageIncrements(usageMap, walletPassProductId, maxPassesPer
120
105
  });
121
106
  }
122
107
  var getRecommendedAmount = (voucher) => {
108
+ console.log("voucher312", voucher);
123
109
  const { config, recommended_usage_amount, recommended_pure_product_usage_amount } = voucher;
124
110
  const deductTaxAndFee = (config == null ? void 0 : config.deductTaxAndFee) ?? true;
125
- const rawRecalculationBaseAmount = voucher._wallet_asset_recalculation_base_amount;
126
- if (rawRecalculationBaseAmount !== void 0 && rawRecalculationBaseAmount !== null) {
127
- const recalculationBaseAmount = Number(rawRecalculationBaseAmount);
128
- if (Number.isFinite(recalculationBaseAmount) && recalculationBaseAmount >= 0) {
129
- return recalculationBaseAmount;
130
- }
131
- }
132
111
  return deductTaxAndFee ? recommended_usage_amount : recommended_pure_product_usage_amount ?? recommended_usage_amount;
133
112
  };
134
113
  var getApplicableProductIds = (voucher) => {
@@ -166,6 +145,7 @@ var getApplicableProducts = (voucher, productsData) => {
166
145
  return productsData.filter((p) => applicableProductIds.includes(p.product_id));
167
146
  };
168
147
  function processVouchers(applicableVouchers, orderTotalAmount, products) {
148
+ console.log(products, "products123");
169
149
  const productsCopy = expandProductsWithBundleItems(products, true);
170
150
  let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
171
151
  const getItemPassUsage = (usageMap, walletPassProductId, lineKey) => {
@@ -238,7 +218,7 @@ function processVouchers(applicableVouchers, orderTotalAmount, products) {
238
218
  return import_decimal.default.min(baseAmount, finalApplicableAmount, remainingOrderAmount);
239
219
  };
240
220
  const isVoucherAvailable = (voucher, productsData, usedVoucherCounts2, itemPassUsage) => {
241
- const { config, product_id } = voucher;
221
+ const { config, id, product_id } = voucher;
242
222
  const recommendedAmount = getRecommendedAmount(voucher);
243
223
  if (recommendedAmount <= 0) {
244
224
  return { isAvailable: false, reasonCode: "not_meet_the_required_conditions" };
@@ -473,7 +453,6 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
473
453
  const productsForCalc = expandProductsWithBundleItems(products, true);
474
454
  let remainingOrderAmount = new import_decimal.default(orderTotalAmount);
475
455
  const selectedWithDetails = [];
476
- const usedVoucherCounts = /* @__PURE__ */ new Map();
477
456
  const itemPassUsageMap = /* @__PURE__ */ new Map();
478
457
  const getItemPassUsageRecalc = (walletPassProductId, lineKey) => {
479
458
  var _a;
@@ -490,29 +469,8 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
490
469
  });
491
470
  };
492
471
  selectedVouchers.forEach((selectedVoucher) => {
493
- const { product_id } = selectedVoucher;
494
- const config = getWalletPassCalculationConfig(selectedVoucher);
495
- const {
496
- maxDeductionAmount,
497
- maxUsagePerOrder,
498
- allowCrossProduct,
499
- applicableProductLimit,
500
- deductTaxAndFee,
501
- maxPassesPerItem
502
- } = config;
503
- const usedCount = usedVoucherCounts.get(product_id) || 0;
504
- if (maxUsagePerOrder > 0 && usedCount >= maxUsagePerOrder) {
505
- selectedWithDetails.push({
506
- ...selectedVoucher,
507
- config,
508
- actualDeduction: 0,
509
- deductionDetails: [],
510
- _available_max_amount: 0,
511
- _unified_available_status: 0,
512
- reasonCode: "usage_limit_reached"
513
- });
514
- return;
515
- }
472
+ const { config, id } = selectedVoucher;
473
+ const { maxDeductionAmount, allowCrossProduct, applicableProductLimit, deductTaxAndFee = true, maxPassesPerItem = 0 } = config;
516
474
  const unitPriceField = deductTaxAndFee ? "unitPriceWithTax" : "unitPricePure";
517
475
  const amountField = deductTaxAndFee ? "remainingAmountWithTax" : "remainingAmountPure";
518
476
  let applicableProducts = getApplicableProducts(
@@ -523,7 +481,6 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
523
481
  if (applicableProducts.length === 0) {
524
482
  selectedWithDetails.push({
525
483
  ...selectedVoucher,
526
- config,
527
484
  actualDeduction: 0,
528
485
  deductionDetails: [],
529
486
  _available_max_amount: 0,
@@ -601,7 +558,6 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
601
558
  applyMaxPassUsageIncrements(itemPassUsageMap, selectedVoucher.product_id, maxPassesPerItem, deductionDetails);
602
559
  selectedWithDetails.push({
603
560
  ...selectedVoucher,
604
- config,
605
561
  actualDeduction: totalDeducted.toNumber(),
606
562
  // 转换为数字
607
563
  deductionDetails,
@@ -609,11 +565,12 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
609
565
  // 转换为数字
610
566
  _unified_available_status: totalDeducted.greaterThan(0) ? 1 : 0
611
567
  });
612
- if (totalDeducted.greaterThan(0)) {
613
- usedVoucherCounts.set(product_id, usedCount + 1);
614
- }
615
568
  });
616
569
  const selectedIds = new Set(selectedVouchers.map((v) => v.id));
570
+ const usedVoucherCounts = /* @__PURE__ */ new Map();
571
+ selectedVouchers.forEach((v) => {
572
+ usedVoucherCounts.set(v.product_id, (usedVoucherCounts.get(v.product_id) || 0) + 1);
573
+ });
617
574
  const allWithUpdatedStatus = allVouchers.map((voucher) => {
618
575
  if (selectedIds.has(voucher.id)) {
619
576
  const selectedDetail = selectedWithDetails.find(
@@ -621,15 +578,8 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
621
578
  );
622
579
  return selectedDetail || voucher;
623
580
  }
624
- const { product_id } = voucher;
625
- const config = getWalletPassCalculationConfig(voucher);
626
- const {
627
- maxDeductionAmount,
628
- allowCrossProduct,
629
- applicableProductLimit,
630
- deductTaxAndFee,
631
- maxPassesPerItem
632
- } = config;
581
+ const { config, id, product_id } = voucher;
582
+ const { maxDeductionAmount, allowCrossProduct, applicableProductLimit, deductTaxAndFee = true, maxPassesPerItem = 0 } = config;
633
583
  const unitPriceField = deductTaxAndFee ? "unitPriceWithTax" : "unitPricePure";
634
584
  const amountField = deductTaxAndFee ? "remainingAmountWithTax" : "remainingAmountPure";
635
585
  const recommendedAmount = getRecommendedAmount(voucher);
@@ -713,7 +663,6 @@ function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmount, pr
713
663
  }
714
664
  return {
715
665
  ...voucher,
716
- config,
717
666
  _available_max_amount: calculatedMaxAmount.toNumber(),
718
667
  // 转换为数字
719
668
  _unified_available_status: isAvailable ? 1 : 0,
@@ -27,8 +27,6 @@ export declare class OpenDataModule extends BaseModule implements Module {
27
27
  fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
28
28
  getOpenData(): OpenDataConfig | null;
29
29
  getLastFetchedAt(): number | null;
30
- /** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
31
- clearCache(): void;
32
30
  checkAvailability(scheduleModule?: ScheduleModule): OpenDataAvailabilityResult;
33
31
  storeChange(): void;
34
32
  }
@@ -104,11 +104,6 @@ var OpenDataModule = class extends import_BaseModule.BaseModule {
104
104
  getLastFetchedAt() {
105
105
  return this.store.lastFetchedAt ?? null;
106
106
  }
107
- /** 清除内存与 sessionStorage 镜像中的 OpenData,供宿主切店时调用。 */
108
- clearCache() {
109
- this.store.data = null;
110
- this.store.lastFetchedAt = null;
111
- }
112
107
  checkAvailability(scheduleModule) {
113
108
  var _a;
114
109
  const scheduleList = scheduleModule ? scheduleModule == null ? void 0 : scheduleModule.getScheduleListByIds(
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
3
3
  import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
4
4
  import { CartItem } from '../Cart/types';
5
5
  import { type SubmitPayloadEnhancer } from './utils';
6
- import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
6
+ import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
7
7
  import type { ICustomer } from '../AccountList/types';
8
8
  import type { Discount } from '../Discount/types';
9
9
  import { UnavailableReason } from '../Rules/types';
@@ -14,7 +14,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
14
14
  private request;
15
15
  private logger;
16
16
  private window;
17
- private appPlugin;
18
17
  private cacheId;
19
18
  private salesSummaryModuleName;
20
19
  private rulesHooksOverride?;
@@ -81,7 +80,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
81
80
  private ensureEditDiscountConfigForProductChange;
82
81
  scanCode(code: string, customerId?: number): Promise<{
83
82
  isAvailable: boolean;
84
- isAccepted?: boolean;
85
83
  discountList: Discount[];
86
84
  type: 'server' | 'clientCalc';
87
85
  unavailableReason?: UnavailableReason;
@@ -178,9 +176,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
178
176
  };
179
177
  private calculateDepositPaidAmount;
180
178
  private resolveNextOrderPaymentType;
181
- private getPaymentNumberAppData;
182
- private getPaymentNumberDevicePrefixSync;
183
- private getPaymentNumberDevicePrefixAsync;
184
179
  private normalizePaymentSource;
185
180
  private updateTempOrderPaymentStatus;
186
181
  private shouldKeepPaymentStatusAfterAmountRecalc;
@@ -312,20 +307,19 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
312
307
  * 用一组支付来源覆盖当前订单支付项。
313
308
  *
314
309
  * 入参允许来自 PaymentModule 的 PaymentItem,内部统一映射为 Sales 协议:
315
- * 新支付来源的 uuid 会作为 payment_number 的唯一号段,id -> custom_payment_id,
310
+ * uuid -> metadata.unique_payment_number,id -> custom_payment_id,
316
311
  * isSynced 等运行态字段不会进入 tempOrder.payments。
317
312
  */
318
313
  setOrderPayments(payments: OrderPaymentSource[]): OrderPaymentData[];
319
- /** 同步兼容入口:按调用当下的 device_id 或 LOCAL 生成支付编号。 */
314
+ /** 追加单个支付项,并立即持久化当前 tempOrder。 */
320
315
  addOrderPayment(payment: OrderPaymentSource): OrderPaymentData[];
321
- /** 异步入口:创建支付项时读取最新 IoT 设备短号。 */
322
- addOrderPaymentAsync(payment: OrderPaymentSource): Promise<OrderPaymentData[]>;
323
- private addOrderPaymentWithDevicePrefix;
324
316
  /**
325
- * 默认按支付唯一号精确更新;仅显式指定 legacy 时兼容历史支付标识。
326
- * metadata 与 transactions 会分别合并,避免覆盖支付会话号和已有交易记录。
317
+ * 按支付唯一号、后端支付 ID、自定义支付方式 ID 或旧 uuid 更新支付项。
318
+ *
319
+ * 该方法服务 PaymentModal 的 void / 编辑场景;更新 metadata 时会做浅合并,
320
+ * 避免覆盖 unique_payment_number、现金实付/找零等已有元数据。
327
321
  */
328
- updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions): Promise<OrderPaymentUpdateResult>;
322
+ updateOrderPayment(paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>): OrderPaymentData[];
329
323
  /** 从当前订单支付项中移除指定支付项。 */
330
324
  deleteOrderPayment(paymentIdentity: string | number): OrderPaymentData[];
331
325
  private confirmPendingVoucherPaymentsInList;
@@ -348,11 +342,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
348
342
  */
349
343
  updateVoucherOrderPayments(payments: OrderPaymentSource[], options?: {
350
344
  status?: 'paid' | 'payment_pending';
351
- devicePrefix?: string;
352
345
  }): OrderPaymentData[];
353
- updateVoucherOrderPaymentsAsync(payments: OrderPaymentSource[], options?: {
354
- status?: 'paid' | 'payment_pending';
355
- }): Promise<OrderPaymentData[]>;
356
346
  private shouldMergeProductToOrder;
357
347
  private hasOrderProductLineNote;
358
348
  /**
@@ -437,14 +427,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
437
427
  type?: string;
438
428
  }): import("./types").OrderSubmitPayload;
439
429
  applyLocalPrintOrderNumbers(order?: Record<string, any> | null): Promise<OrderTempOrder>;
440
- saveTempOrderAsDraft<T = any>(params?: {
441
- cacheId?: string;
442
- platform?: string;
443
- businessCode?: string;
444
- channel?: string;
445
- type?: string;
446
- enhancePayload?: SubmitPayloadEnhancer;
447
- }): Promise<T>;
448
430
  /**
449
431
  * 提交当前 Sales tempOrder。
450
432
  *
@@ -549,8 +531,6 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
549
531
  */
550
532
  private seedAnonymousBookingUidsFromProducts;
551
533
  private normalizeTempOrderForRuntime;
552
- private isSyntheticDraftOrderIdForRuntime;
553
- private withoutSyntheticDraftOrderIdForRuntime;
554
534
  private hydrateLinkedBookingIdentity;
555
535
  private pickHydratedDisplayText;
556
536
  private formatHydratedNamePair;