@pisell/pisellos 2.3.110 → 2.3.112

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -132,7 +132,8 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
132
132
  key: "shouldSkipInvoiceTemplateDocument",
133
133
  value: function shouldSkipInvoiceTemplateDocument() {
134
134
  var _this$otherParams;
135
- return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
135
+ var platform = String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
136
+ return platform === 'pc' || platform === 'h5';
136
137
  }
137
138
  }, {
138
139
  key: "fetchOpenData",
@@ -2,10 +2,9 @@
2
2
  * 现金支付推荐算法
3
3
  *
4
4
  * 核心原理:
5
- * 1. 每个推荐金额都应该是独立的最优组合
6
- * 2. 不推荐在已有最优解基础上添加额外面额的组合
7
- * 3. 优先推荐使用不同数量币种的组合
8
- * 4. 根据组合判断去重,避免扩展组合
5
+ * 1. 第一项始终是精确应付金额
6
+ * 2. 其余推荐只能是严格大于应付金额的真实币种面额
7
+ * 3. 最多推荐三个更高面额
9
8
  */
10
9
  /**
11
10
  * 常见国家货币面额配置
@@ -13,7 +12,7 @@
13
12
  export declare const CURRENCY_DENOMINATIONS: Record<string, number[]>;
14
13
  /**
15
14
  * 最优支付金额推荐算法
16
- * 推荐通过不同数量面额组合刚好足够支付的最小金额
15
+ * 返回精确应付金额,以及最多三个更高的真实币种面额
17
16
  *
18
17
  * @param targetAmount 目标金额
19
18
  * @param denominations 币种面值数组
@@ -8,10 +8,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
8
8
  * 现金支付推荐算法
9
9
  *
10
10
  * 核心原理:
11
- * 1. 每个推荐金额都应该是独立的最优组合
12
- * 2. 不推荐在已有最优解基础上添加额外面额的组合
13
- * 3. 优先推荐使用不同数量币种的组合
14
- * 4. 根据组合判断去重,避免扩展组合
11
+ * 1. 第一项始终是精确应付金额
12
+ * 2. 其余推荐只能是严格大于应付金额的真实币种面额
13
+ * 3. 最多推荐三个更高面额
15
14
  */
16
15
 
17
16
  /**
@@ -47,377 +46,28 @@ export var CURRENCY_DENOMINATIONS = {
47
46
  'DEFAULT': [100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01]
48
47
  };
49
48
 
50
- /**
51
- * 支付组合类型定义
52
- */
53
-
54
49
  /**
55
50
  * 最优支付金额推荐算法
56
- * 推荐通过不同数量面额组合刚好足够支付的最小金额
51
+ * 返回精确应付金额,以及最多三个更高的真实币种面额
57
52
  *
58
53
  * @param targetAmount 目标金额
59
54
  * @param denominations 币种面值数组
60
55
  * @returns 推荐支付金额数组
61
56
  */
62
57
  export function recommendOptimalPayments(targetAmount, denominations) {
63
- // 参数验证
64
- if (targetAmount <= 0 || !isFinite(targetAmount) || isNaN(targetAmount)) {
58
+ if (targetAmount <= 0 || !Number.isFinite(targetAmount)) {
65
59
  return [];
66
60
  }
67
- if (!denominations || !Array.isArray(denominations) || denominations.length === 0) {
68
- return [Math.ceil(targetAmount)];
69
- }
70
-
71
- // 过滤有效面额并限制搜索空间以提高性能
72
- var maxReasonableDenom = targetAmount * 5; // 适度限制搜索空间
73
- var validDenoms = denominations.filter(function (denom) {
74
- return denom > 0 && isFinite(denom) && !isNaN(denom) && denom <= maxReasonableDenom;
75
- }).slice(0, 8); // 限制面额数量以提高性能
76
-
77
- if (validDenoms.length === 0) {
78
- // 如果没有合适的面额,返回最接近的整数金额
79
- return [Math.ceil(targetAmount)];
80
- }
81
- try {
82
- // 处理精度问题,将金额转换为整数计算
83
- var precision = 100; // 假设最小单位是0.01
84
- var target = Math.round(targetAmount * precision);
85
- var denoms = validDenoms.map(function (d) {
86
- return Math.round(d * precision);
87
- }).sort(function (a, b) {
88
- return b - a;
89
- });
90
-
91
- // 存储不同的支付组合方案
92
- var paymentOptions = [];
93
-
94
- // 首先尝试找到精确匹配的组合
95
- var exactCombination = findExactCombination(target, denoms, precision);
96
- if (exactCombination) {
97
- paymentOptions.push(exactCombination);
98
- }
99
-
100
- // 为了提高效率,我们将按币种数量来生成组合
101
- // 1币种组合:只用一种面额
102
- for (var i = 0; i < Math.min(denoms.length, 6); i++) {
103
- var denom = denoms[i];
104
- var count = Math.ceil(target / denom);
105
- var sum = count * denom;
106
- if (sum >= target && count <= 12) {
107
- // 限制硬币数量以提高性能
108
- paymentOptions.push({
109
- combination: Array(count).fill(denom / precision),
110
- sum: sum / precision,
111
- coinCount: count,
112
- denomTypes: 1
113
- });
114
- }
115
- }
116
-
117
- // 2币种组合:使用两种面额(大幅限制搜索范围以提高性能)
118
- for (var _i = 0; _i < Math.min(denoms.length - 1, 5); _i++) {
119
- for (var j = _i + 1; j < Math.min(denoms.length, 6); j++) {
120
- var denom1 = denoms[_i];
121
- var denom2 = denoms[j];
122
-
123
- // 大幅限制搜索范围,基于目标金额动态调整
124
- var maxCount1 = Math.min(Math.ceil(target / denom1) + 1, 8);
125
- var maxCount2 = Math.min(Math.ceil(target / denom2) + 1, 10);
126
- for (var count1 = 1; count1 <= maxCount1; count1++) {
127
- for (var count2 = 1; count2 <= maxCount2; count2++) {
128
- var _sum = count1 * denom1 + count2 * denom2;
129
- if (_sum >= target) {
130
- var combination = [].concat(_toConsumableArray(Array(count1).fill(denom1 / precision)), _toConsumableArray(Array(count2).fill(denom2 / precision)));
131
- paymentOptions.push({
132
- combination: combination,
133
- sum: _sum / precision,
134
- coinCount: count1 + count2,
135
- denomTypes: 2
136
- });
137
- }
138
- }
139
- }
140
- }
141
- }
142
-
143
- // 3币种组合:使用三种面额(大幅限制搜索以提高效率)
144
- for (var _i2 = 0; _i2 < Math.min(denoms.length - 2, 3); _i2++) {
145
- for (var _j = _i2 + 1; _j < Math.min(denoms.length - 1, 4); _j++) {
146
- for (var k = _j + 1; k < Math.min(denoms.length, 5); k++) {
147
- var _denom = denoms[_i2];
148
- var _denom2 = denoms[_j];
149
- var denom3 = denoms[k];
150
-
151
- // 大幅限制搜索范围
152
- var _maxCount = Math.min(Math.ceil(target / _denom) + 1, 5);
153
- var _maxCount2 = Math.min(Math.ceil(target / _denom2) + 1, 6);
154
- var maxCount3 = Math.min(Math.ceil(target / denom3) + 1, 8);
155
- for (var _count = 1; _count <= _maxCount; _count++) {
156
- for (var _count2 = 1; _count2 <= _maxCount2; _count2++) {
157
- for (var count3 = 1; count3 <= maxCount3; count3++) {
158
- var _sum2 = _count * _denom + _count2 * _denom2 + count3 * denom3;
159
- if (_sum2 >= target) {
160
- var _combination = [].concat(_toConsumableArray(Array(_count).fill(_denom / precision)), _toConsumableArray(Array(_count2).fill(_denom2 / precision)), _toConsumableArray(Array(count3).fill(denom3 / precision)));
161
- paymentOptions.push({
162
- combination: _combination,
163
- sum: _sum2 / precision,
164
- coinCount: _count + _count2 + count3,
165
- denomTypes: 3
166
- });
167
- }
168
- }
169
- }
170
- }
171
- }
172
- }
173
- }
174
-
175
- // 4币种组合:使用四种面额(极度限制搜索以提高性能)
176
- for (var _i3 = 0; _i3 < Math.min(denoms.length - 3, 2); _i3++) {
177
- for (var _j2 = _i3 + 1; _j2 < Math.min(denoms.length - 2, 3); _j2++) {
178
- for (var _k = _j2 + 1; _k < Math.min(denoms.length - 1, 4); _k++) {
179
- for (var l = _k + 1; l < Math.min(denoms.length, 5); l++) {
180
- var _denom3 = denoms[_i3];
181
- var _denom4 = denoms[_j2];
182
- var _denom5 = denoms[_k];
183
- var denom4 = denoms[l];
184
-
185
- // 极度限制搜索范围
186
- var _maxCount3 = Math.min(Math.ceil(target / _denom3) + 1, 3);
187
- var _maxCount4 = Math.min(Math.ceil(target / _denom4) + 1, 4);
188
- var _maxCount5 = Math.min(Math.ceil(target / _denom5) + 1, 5);
189
- var maxCount4 = Math.min(Math.ceil(target / denom4) + 1, 6);
190
- for (var _count3 = 1; _count3 <= _maxCount3; _count3++) {
191
- for (var _count4 = 1; _count4 <= _maxCount4; _count4++) {
192
- for (var _count5 = 1; _count5 <= _maxCount5; _count5++) {
193
- for (var count4 = 1; count4 <= maxCount4; count4++) {
194
- var _sum3 = _count3 * _denom3 + _count4 * _denom4 + _count5 * _denom5 + count4 * denom4;
195
- if (_sum3 >= target) {
196
- var _combination2 = [].concat(_toConsumableArray(Array(_count3).fill(_denom3 / precision)), _toConsumableArray(Array(_count4).fill(_denom4 / precision)), _toConsumableArray(Array(_count5).fill(_denom5 / precision)), _toConsumableArray(Array(count4).fill(denom4 / precision)));
197
- paymentOptions.push({
198
- combination: _combination2,
199
- sum: _sum3 / precision,
200
- coinCount: _count3 + _count4 + _count5 + count4,
201
- denomTypes: 4
202
- });
203
- }
204
- }
205
- }
206
- }
207
- }
208
- }
209
- }
210
- }
211
- }
212
-
213
- // 如果没有找到任何组合,提供默认建议
214
- if (paymentOptions.length === 0) {
215
- // 找到大于等于目标金额的最小面额
216
- var minValidDenom = validDenoms.find(function (denom) {
217
- return denom >= targetAmount;
218
- });
219
- if (minValidDenom) {
220
- return [minValidDenom];
221
- } else {
222
- // 使用最大面额的组合
223
- var maxDenom = Math.max.apply(Math, _toConsumableArray(validDenoms));
224
- var _count6 = Math.ceil(targetAmount / maxDenom);
225
- return [_count6 * maxDenom];
226
- }
227
- }
228
-
229
- // 移除重复和扩展组合
230
- var uniqueCombinations = removeDuplicateAndExtendedCombinations(paymentOptions, targetAmount);
231
-
232
- // 按币种类型数量排序,然后按总硬币数量排序,最后按金额排序
233
- uniqueCombinations.sort(function (a, b) {
234
- if (a.denomTypes !== b.denomTypes) {
235
- return a.denomTypes - b.denomTypes;
236
- }
237
- if (a.coinCount !== b.coinCount) {
238
- return a.coinCount - b.coinCount;
239
- }
240
- return a.sum - b.sum;
241
- });
242
-
243
- // 按金额去重并返回推荐的支付金额
244
- var uniqueAmounts = new Set();
245
- var finalResults = [];
246
- for (var _i4 = 0, _uniqueCombinations = uniqueCombinations; _i4 < _uniqueCombinations.length; _i4++) {
247
- var item = _uniqueCombinations[_i4];
248
- var roundedAmount = Math.round(item.sum * 100) / 100; // 处理浮点数精度
249
- if (!uniqueAmounts.has(roundedAmount) && finalResults.length < 10) {
250
- uniqueAmounts.add(roundedAmount);
251
- finalResults.push(roundedAmount);
252
- }
253
- }
254
- return finalResults.sort(function (a, b) {
255
- return a - b;
256
- });
257
- } catch (error) {
258
- // 发生错误时返回安全的默认值
259
- console.warn('推荐支付金额计算出错:', error);
260
- // 返回最接近的整数金额作为兜底
261
- var safeAmount = Math.ceil(targetAmount);
262
- return [targetAmount, safeAmount];
263
- }
264
- }
265
-
266
- /**
267
- * 尝试找到精确匹配目标金额的组合
268
- */
269
- function findExactCombination(target, denoms, precision) {
270
- // 简单的深度优先搜索,限制搜索深度
271
- function dfs(remaining, denomIndex, currentCombination) {
272
- if (remaining === 0) {
273
- return currentCombination;
274
- }
275
- if (remaining < 0 || denomIndex >= denoms.length || currentCombination.length > 10) {
276
- return null;
277
- }
278
- var denom = denoms[denomIndex];
279
-
280
- // 尝试使用当前面额 0 到 maxCount 次
281
- var maxCount = Math.min(Math.floor(remaining / denom), 8);
282
- for (var count = maxCount; count >= 0; count--) {
283
- var newCombination = [].concat(_toConsumableArray(currentCombination), _toConsumableArray(Array(count).fill(denom)));
284
- var result = dfs(remaining - count * denom, denomIndex + 1, newCombination);
285
- if (result) {
286
- return result;
287
- }
288
- }
289
- return null;
290
- }
291
- var exactMatch = dfs(target, 0, []);
292
- if (exactMatch && exactMatch.length > 0) {
293
- var denomTypes = new Set(exactMatch).size;
294
- return {
295
- combination: exactMatch.map(function (d) {
296
- return d / precision;
297
- }),
298
- sum: target / precision,
299
- coinCount: exactMatch.length,
300
- denomTypes: denomTypes
301
- };
302
- }
303
- return null;
304
- }
305
-
306
- /**
307
- * 移除重复和扩展组合
308
- * 核心原理:如果组合A包含组合B的所有硬币,并且还有额外硬币,则A是B的扩展,应该被移除
309
- */
310
- function removeDuplicateAndExtendedCombinations(combinations, targetAmount) {
311
- var result = [];
312
-
313
- // 按币种类型数量、硬币数量、金额排序,确保较简单的组合在前面
314
- combinations.sort(function (a, b) {
315
- if (a.denomTypes !== b.denomTypes) {
316
- return a.denomTypes - b.denomTypes;
317
- }
318
- if (a.coinCount !== b.coinCount) {
319
- return a.coinCount - b.coinCount;
320
- }
321
- return a.sum - b.sum;
322
- });
323
- for (var i = 0; i < combinations.length; i++) {
324
- var current = combinations[i];
325
- var shouldSkip = false;
326
-
327
- // 检查当前组合是否与已添加的组合重复或者是扩展
328
- for (var j = 0; j < result.length; j++) {
329
- var existing = result[j];
330
-
331
- // 如果完全相同,跳过
332
- if (isSameCombination(current.combination, existing.combination)) {
333
- shouldSkip = true;
334
- break;
335
- }
336
-
337
- // 如果当前组合是已存在组合的扩展,跳过
338
- if (isExtensionOf(current.combination, existing.combination)) {
339
- shouldSkip = true;
340
- break;
341
- }
342
- }
343
-
344
- // 检查是否有其他组合是当前组合的扩展,如果有,移除那些扩展
345
- if (!shouldSkip) {
346
- // 移除所有当前组合的扩展
347
- for (var _j3 = result.length - 1; _j3 >= 0; _j3--) {
348
- if (isExtensionOf(result[_j3].combination, current.combination)) {
349
- result.splice(_j3, 1);
350
- }
351
- }
352
- result.push(current);
353
- }
354
- }
355
- return result;
356
- }
357
-
358
- /**
359
- * 检查组合A是否是组合B的扩展(即A包含B的所有硬币,并且还有额外的硬币)
360
- */
361
- function isExtensionOf(combinationA, combinationB) {
362
- // 如果A的硬币数量少于等于B,A不可能是B的扩展
363
- if (combinationA.length <= combinationB.length) {
364
- return false;
365
- }
366
-
367
- // 统计每个面额的数量
368
- var countA = {};
369
- var countB = {};
370
- combinationA.forEach(function (coin) {
371
- countA[coin] = (countA[coin] || 0) + 1;
372
- });
373
- combinationB.forEach(function (coin) {
374
- countB[coin] = (countB[coin] || 0) + 1;
375
- });
376
-
377
- // 检查B的所有面额在A中是否都有足够的数量
378
- for (var coin in countB) {
379
- if (!countA[coin] || countA[coin] < countB[coin]) {
380
- return false;
381
- }
382
- }
383
-
384
- // 检查A是否有B没有的额外硬币
385
- var hasExtra = false;
386
- for (var _coin in countA) {
387
- if (countA[_coin] > (countB[_coin] || 0)) {
388
- hasExtra = true;
389
- break;
390
- }
391
- }
392
- return hasExtra;
393
- }
394
-
395
- /**
396
- * 检查两个组合是否本质相同(相同的面额组合)
397
- */
398
- function isSameCombination(combinationA, combinationB) {
399
- if (combinationA.length !== combinationB.length) {
400
- return false;
401
- }
402
- var countA = {};
403
- var countB = {};
404
- combinationA.forEach(function (coin) {
405
- countA[coin] = (countA[coin] || 0) + 1;
406
- });
407
- combinationB.forEach(function (coin) {
408
- countB[coin] = (countB[coin] || 0) + 1;
409
- });
410
-
411
- // 检查两个组合是否有相同的面额和数量
412
- for (var coin in countA) {
413
- if (countA[coin] !== (countB[coin] || 0)) {
414
- return false;
415
- }
416
- }
417
- for (var _coin2 in countB) {
418
- if (countB[_coin2] !== (countA[_coin2] || 0)) {
419
- return false;
420
- }
421
- }
422
- return true;
61
+ var precision = 100;
62
+ var normalizedTarget = Math.round(targetAmount * precision) / precision;
63
+ var higherDenominations = _toConsumableArray(new Set((Array.isArray(denominations) ? denominations : []).filter(function (denomination) {
64
+ return denomination > 0 && Number.isFinite(denomination);
65
+ }).map(function (denomination) {
66
+ return Math.round(denomination * precision) / precision;
67
+ }))).filter(function (denomination) {
68
+ return denomination > normalizedTarget;
69
+ }).sort(function (a, b) {
70
+ return a - b;
71
+ }).slice(0, 3);
72
+ return [normalizedTarget].concat(_toConsumableArray(higherDenominations));
423
73
  }
@@ -45,6 +45,7 @@ export interface SmallTicketProduct {
45
45
  product_uid?: string | number;
46
46
  booking_uid?: string | number;
47
47
  product_note?: string;
48
+ allergy?: string;
48
49
  options?: Array<{
49
50
  name: string;
50
51
  num?: number;
@@ -319,6 +319,7 @@ function buildBaseData(params) {
319
319
  }
320
320
  function buildProducts(order, locale, productMap) {
321
321
  var products = Array.isArray(order.products) ? order.products : [];
322
+ var allergyByProductUid = buildProductAllergyMap(order, locale);
322
323
  return products.map(function (rawProduct) {
323
324
  var _ref, _ref2, _product$product_quan, _ref3, _ref4, _ref5, _product$original_pri, _ref6, _ref7, _product$selling_pric, _product$product_id, _product$metadata, _product$metadata2;
324
325
  var product = restoreReceiptDiscountHierarchy(rawProduct);
@@ -360,10 +361,11 @@ function buildProducts(order, locale, productMap) {
360
361
  originalPrice: originalPrice
361
362
  });
362
363
  var productNote = resolveProductNote(product, locale);
364
+ var allergy = isPresentId(productUid) ? allergyByProductUid.get(String(productUid).trim()) || '' : '';
363
365
  var basePrice = resolveProductBasePrice(product);
364
366
  var resolvedCombinations = Array.isArray(product.combinations) && product.combinations.length ? normalizeExistingCombinations(product.combinations, locale, currencySymbol) : combinations;
365
367
  var shouldIncludeBasePrice = options.length > 0 || resolvedCombinations.length > 0 || hasProductDiscount(product, extensionList);
366
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
368
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
367
369
  product_title: productTitle,
368
370
  product_quantity: quantity,
369
371
  selling_price: formatMoney(sellingPrice, currencySymbol),
@@ -385,6 +387,8 @@ function buildProducts(order, locale, productMap) {
385
387
  booking_uid: bookingUid
386
388
  } : {}), productNote ? {
387
389
  product_note: productNote
390
+ } : {}), allergy ? {
391
+ allergy: allergy
388
392
  } : {}), options.length ? {
389
393
  options: options
390
394
  } : {}), resolvedVariant ? {
@@ -810,6 +814,25 @@ function resolveProductNote(product, locale) {
810
814
  if (productNote) return productNote;
811
815
  return getLocalizedValue(product.note, locale).trim();
812
816
  }
817
+ function buildProductAllergyMap(order, locale) {
818
+ var allergyByProductUid = new Map();
819
+ for (var _i = 0, _normalizeArray = normalizeArray(order.notes); _i < _normalizeArray.length; _i++) {
820
+ var _note$content, _relation$target_uuid;
821
+ var note = _normalizeArray[_i];
822
+ if (!note || _typeof(note) !== 'object' || Array.isArray(note) || String(note.note_type || '').trim() !== 'allergy') {
823
+ continue;
824
+ }
825
+ var content = getLocalizedValue((_note$content = note.content) === null || _note$content === void 0 ? void 0 : _note$content.text, locale).trim();
826
+ if (!content) continue;
827
+ var relation = normalizeArray(note.note_relations).find(function (item) {
828
+ return item && _typeof(item) === 'object' && !Array.isArray(item) && item.relation_type === 'about' && item.target_type === 'order_detail' && Number(item.is_primary) === 1;
829
+ });
830
+ var productUid = String((_relation$target_uuid = relation === null || relation === void 0 ? void 0 : relation.target_uuid) !== null && _relation$target_uuid !== void 0 ? _relation$target_uuid : '').trim();
831
+ if (!productUid || allergyByProductUid.has(productUid)) continue;
832
+ allergyByProductUid.set(productUid, content);
833
+ }
834
+ return allergyByProductUid;
835
+ }
813
836
  function resolveBundleProductTitle(params) {
814
837
  var _ref29, _ref30, _bundle$bundle_produc;
815
838
  var bundle = params.bundle,
@@ -1043,9 +1066,9 @@ function buildFees(params) {
1043
1066
  currencySymbol = params.currencySymbol,
1044
1067
  financials = params.financials;
1045
1068
  var fees = [];
1046
- for (var _i = 0, _normalizeArray = normalizeArray(order.surcharges || summary.surcharges); _i < _normalizeArray.length; _i++) {
1069
+ for (var _i2 = 0, _normalizeArray2 = normalizeArray(order.surcharges || summary.surcharges); _i2 < _normalizeArray2.length; _i2++) {
1047
1070
  var _ref48, _surcharge$amount;
1048
- var surcharge = _normalizeArray[_i];
1071
+ var surcharge = _normalizeArray2[_i2];
1049
1072
  var value = (_ref48 = (_surcharge$amount = surcharge.amount) !== null && _surcharge$amount !== void 0 ? _surcharge$amount : surcharge.value) !== null && _ref48 !== void 0 ? _ref48 : surcharge.total_amount;
1050
1073
  if (!isNonZero(value)) continue;
1051
1074
  fees.push({
@@ -1266,8 +1289,8 @@ function firstValidBookingDate() {
1266
1289
  for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1267
1290
  values[_key2] = arguments[_key2];
1268
1291
  }
1269
- for (var _i2 = 0, _values = values; _i2 < _values.length; _i2++) {
1270
- var value = _values[_i2];
1292
+ for (var _i3 = 0, _values = values; _i3 < _values.length; _i3++) {
1293
+ var value = _values[_i3];
1271
1294
  if (!isPresentId(value)) continue;
1272
1295
  var parsed = dayjs(value);
1273
1296
  if (parsed.isValid()) return parsed;
@@ -1324,9 +1347,9 @@ function sortBookings(bookings) {
1324
1347
  var leftStart = bookingStartTimestamp(left.booking);
1325
1348
  var rightStart = bookingStartTimestamp(right.booking);
1326
1349
  if (leftStart !== rightStart) return leftStart < rightStart ? -1 : 1;
1327
- for (var _i3 = 0, _arr = ['booking_id', 'schedule_event_id']; _i3 < _arr.length; _i3++) {
1350
+ for (var _i4 = 0, _arr = ['booking_id', 'schedule_event_id']; _i4 < _arr.length; _i4++) {
1328
1351
  var _left$booking, _right$booking;
1329
- var field = _arr[_i3];
1352
+ var field = _arr[_i4];
1330
1353
  var fieldOrder = compareOptionalValues((_left$booking = left.booking) === null || _left$booking === void 0 ? void 0 : _left$booking[field], (_right$booking = right.booking) === null || _right$booking === void 0 ? void 0 : _right$booking[field]);
1331
1354
  if (fieldOrder !== 0) return fieldOrder;
1332
1355
  }
@@ -1339,8 +1362,8 @@ function sortBookings(bookings) {
1339
1362
  }
1340
1363
  function bookingStartTimestamp(booking) {
1341
1364
  var startValues = [booking === null || booking === void 0 ? void 0 : booking.start_at, booking === null || booking === void 0 ? void 0 : booking.start_datetime, booking === null || booking === void 0 ? void 0 : booking.booking_time, isPresentId(booking === null || booking === void 0 ? void 0 : booking.start_date) ? "".concat(booking.start_date, " ").concat(stringify(booking.start_time)).trim() : undefined];
1342
- for (var _i4 = 0, _startValues = startValues; _i4 < _startValues.length; _i4++) {
1343
- var startValue = _startValues[_i4];
1365
+ for (var _i5 = 0, _startValues = startValues; _i5 < _startValues.length; _i5++) {
1366
+ var startValue = _startValues[_i5];
1344
1367
  if (!isPresentId(startValue)) continue;
1345
1368
  var timestamp = dayjs(startValue).valueOf();
1346
1369
  if (Number.isFinite(timestamp)) return timestamp;
@@ -1583,8 +1606,9 @@ function buildVoucherAssets(params) {
1583
1606
  }].concat(_toConsumableArray(timeRow ? [timeRow] : []))];
1584
1607
  });
1585
1608
  }
1609
+ var TICKET_VOUCHER_TAGS = new Set(['ticket', 'product_package_ticket', 'appointment_ticket', 'session_ticket']);
1586
1610
  function isTicketVoucher(voucher) {
1587
- return stringify(voucher.tag).trim().toLowerCase() === 'ticket';
1611
+ return TICKET_VOUCHER_TAGS.has(stringify(voucher.tag).trim().toLowerCase());
1588
1612
  }
1589
1613
  function getVoucherValidity(voucher, locale) {
1590
1614
  var _voucher$metadata, _voucher$metadata2, _voucher$metadata3, _voucher$metadata4, _voucher$metadata5, _voucher$metadata6, _voucher$metadata7, _voucher$metadata8, _voucher$metadata9, _voucher$metadata10, _voucher$start_time, _voucher$metadata11, _voucher$end_time, _voucher$metadata12;
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -153,7 +153,8 @@ class OpenDataModule extends _BaseModule.BaseModule {
153
153
  this.fatherModule = this.otherParams.fatherModule;
154
154
  }
155
155
  shouldSkipInvoiceTemplateDocument() {
156
- return String(this.otherParams?.platform || '').trim().toLowerCase() === 'h5';
156
+ const platform = String(this.otherParams?.platform || '').trim().toLowerCase();
157
+ return platform === 'pc' || platform === 'h5';
157
158
  }
158
159
  async fetchOpenData(params) {
159
160
  const fetchRevision = ++this.fetchRevision;
@@ -2,10 +2,9 @@
2
2
  * 现金支付推荐算法
3
3
  *
4
4
  * 核心原理:
5
- * 1. 每个推荐金额都应该是独立的最优组合
6
- * 2. 不推荐在已有最优解基础上添加额外面额的组合
7
- * 3. 优先推荐使用不同数量币种的组合
8
- * 4. 根据组合判断去重,避免扩展组合
5
+ * 1. 第一项始终是精确应付金额
6
+ * 2. 其余推荐只能是严格大于应付金额的真实币种面额
7
+ * 3. 最多推荐三个更高面额
9
8
  */
10
9
  /**
11
10
  * 常见国家货币面额配置
@@ -13,7 +12,7 @@
13
12
  export declare const CURRENCY_DENOMINATIONS: Record<string, number[]>;
14
13
  /**
15
14
  * 最优支付金额推荐算法
16
- * 推荐通过不同数量面额组合刚好足够支付的最小金额
15
+ * 返回精确应付金额,以及最多三个更高的真实币种面额
17
16
  *
18
17
  * @param targetAmount 目标金额
19
18
  * @param denominations 币种面值数组
@@ -9,10 +9,9 @@ exports.recommendOptimalPayments = recommendOptimalPayments;
9
9
  * 现金支付推荐算法
10
10
  *
11
11
  * 核心原理:
12
- * 1. 每个推荐金额都应该是独立的最优组合
13
- * 2. 不推荐在已有最优解基础上添加额外面额的组合
14
- * 3. 优先推荐使用不同数量币种的组合
15
- * 4. 根据组合判断去重,避免扩展组合
12
+ * 1. 第一项始终是精确应付金额
13
+ * 2. 其余推荐只能是严格大于应付金额的真实币种面额
14
+ * 3. 最多推荐三个更高面额
16
15
  */
17
16
 
18
17
  /**
@@ -48,364 +47,20 @@ const CURRENCY_DENOMINATIONS = exports.CURRENCY_DENOMINATIONS = {
48
47
  'DEFAULT': [100, 50, 20, 10, 5, 1, 0.5, 0.25, 0.1, 0.05, 0.01]
49
48
  };
50
49
 
51
- /**
52
- * 支付组合类型定义
53
- */
54
-
55
50
  /**
56
51
  * 最优支付金额推荐算法
57
- * 推荐通过不同数量面额组合刚好足够支付的最小金额
52
+ * 返回精确应付金额,以及最多三个更高的真实币种面额
58
53
  *
59
54
  * @param targetAmount 目标金额
60
55
  * @param denominations 币种面值数组
61
56
  * @returns 推荐支付金额数组
62
57
  */
63
58
  function recommendOptimalPayments(targetAmount, denominations) {
64
- // 参数验证
65
- if (targetAmount <= 0 || !isFinite(targetAmount) || isNaN(targetAmount)) {
59
+ if (targetAmount <= 0 || !Number.isFinite(targetAmount)) {
66
60
  return [];
67
61
  }
68
- if (!denominations || !Array.isArray(denominations) || denominations.length === 0) {
69
- return [Math.ceil(targetAmount)];
70
- }
71
-
72
- // 过滤有效面额并限制搜索空间以提高性能
73
- const maxReasonableDenom = targetAmount * 5; // 适度限制搜索空间
74
- const validDenoms = denominations.filter(denom => denom > 0 && isFinite(denom) && !isNaN(denom) && denom <= maxReasonableDenom).slice(0, 8); // 限制面额数量以提高性能
75
-
76
- if (validDenoms.length === 0) {
77
- // 如果没有合适的面额,返回最接近的整数金额
78
- return [Math.ceil(targetAmount)];
79
- }
80
- try {
81
- // 处理精度问题,将金额转换为整数计算
82
- const precision = 100; // 假设最小单位是0.01
83
- const target = Math.round(targetAmount * precision);
84
- const denoms = validDenoms.map(d => Math.round(d * precision)).sort((a, b) => b - a);
85
-
86
- // 存储不同的支付组合方案
87
- const paymentOptions = [];
88
-
89
- // 首先尝试找到精确匹配的组合
90
- const exactCombination = findExactCombination(target, denoms, precision);
91
- if (exactCombination) {
92
- paymentOptions.push(exactCombination);
93
- }
94
-
95
- // 为了提高效率,我们将按币种数量来生成组合
96
- // 1币种组合:只用一种面额
97
- for (let i = 0; i < Math.min(denoms.length, 6); i++) {
98
- const denom = denoms[i];
99
- const count = Math.ceil(target / denom);
100
- const sum = count * denom;
101
- if (sum >= target && count <= 12) {
102
- // 限制硬币数量以提高性能
103
- paymentOptions.push({
104
- combination: Array(count).fill(denom / precision),
105
- sum: sum / precision,
106
- coinCount: count,
107
- denomTypes: 1
108
- });
109
- }
110
- }
111
-
112
- // 2币种组合:使用两种面额(大幅限制搜索范围以提高性能)
113
- for (let i = 0; i < Math.min(denoms.length - 1, 5); i++) {
114
- for (let j = i + 1; j < Math.min(denoms.length, 6); j++) {
115
- const denom1 = denoms[i];
116
- const denom2 = denoms[j];
117
-
118
- // 大幅限制搜索范围,基于目标金额动态调整
119
- const maxCount1 = Math.min(Math.ceil(target / denom1) + 1, 8);
120
- const maxCount2 = Math.min(Math.ceil(target / denom2) + 1, 10);
121
- for (let count1 = 1; count1 <= maxCount1; count1++) {
122
- for (let count2 = 1; count2 <= maxCount2; count2++) {
123
- const sum = count1 * denom1 + count2 * denom2;
124
- if (sum >= target) {
125
- const combination = [...Array(count1).fill(denom1 / precision), ...Array(count2).fill(denom2 / precision)];
126
- paymentOptions.push({
127
- combination: combination,
128
- sum: sum / precision,
129
- coinCount: count1 + count2,
130
- denomTypes: 2
131
- });
132
- }
133
- }
134
- }
135
- }
136
- }
137
-
138
- // 3币种组合:使用三种面额(大幅限制搜索以提高效率)
139
- for (let i = 0; i < Math.min(denoms.length - 2, 3); i++) {
140
- for (let j = i + 1; j < Math.min(denoms.length - 1, 4); j++) {
141
- for (let k = j + 1; k < Math.min(denoms.length, 5); k++) {
142
- const denom1 = denoms[i];
143
- const denom2 = denoms[j];
144
- const denom3 = denoms[k];
145
-
146
- // 大幅限制搜索范围
147
- const maxCount1 = Math.min(Math.ceil(target / denom1) + 1, 5);
148
- const maxCount2 = Math.min(Math.ceil(target / denom2) + 1, 6);
149
- const maxCount3 = Math.min(Math.ceil(target / denom3) + 1, 8);
150
- for (let count1 = 1; count1 <= maxCount1; count1++) {
151
- for (let count2 = 1; count2 <= maxCount2; count2++) {
152
- for (let count3 = 1; count3 <= maxCount3; count3++) {
153
- const sum = count1 * denom1 + count2 * denom2 + count3 * denom3;
154
- if (sum >= target) {
155
- const combination = [...Array(count1).fill(denom1 / precision), ...Array(count2).fill(denom2 / precision), ...Array(count3).fill(denom3 / precision)];
156
- paymentOptions.push({
157
- combination: combination,
158
- sum: sum / precision,
159
- coinCount: count1 + count2 + count3,
160
- denomTypes: 3
161
- });
162
- }
163
- }
164
- }
165
- }
166
- }
167
- }
168
- }
169
-
170
- // 4币种组合:使用四种面额(极度限制搜索以提高性能)
171
- for (let i = 0; i < Math.min(denoms.length - 3, 2); i++) {
172
- for (let j = i + 1; j < Math.min(denoms.length - 2, 3); j++) {
173
- for (let k = j + 1; k < Math.min(denoms.length - 1, 4); k++) {
174
- for (let l = k + 1; l < Math.min(denoms.length, 5); l++) {
175
- const denom1 = denoms[i];
176
- const denom2 = denoms[j];
177
- const denom3 = denoms[k];
178
- const denom4 = denoms[l];
179
-
180
- // 极度限制搜索范围
181
- const maxCount1 = Math.min(Math.ceil(target / denom1) + 1, 3);
182
- const maxCount2 = Math.min(Math.ceil(target / denom2) + 1, 4);
183
- const maxCount3 = Math.min(Math.ceil(target / denom3) + 1, 5);
184
- const maxCount4 = Math.min(Math.ceil(target / denom4) + 1, 6);
185
- for (let count1 = 1; count1 <= maxCount1; count1++) {
186
- for (let count2 = 1; count2 <= maxCount2; count2++) {
187
- for (let count3 = 1; count3 <= maxCount3; count3++) {
188
- for (let count4 = 1; count4 <= maxCount4; count4++) {
189
- const sum = count1 * denom1 + count2 * denom2 + count3 * denom3 + count4 * denom4;
190
- if (sum >= target) {
191
- const combination = [...Array(count1).fill(denom1 / precision), ...Array(count2).fill(denom2 / precision), ...Array(count3).fill(denom3 / precision), ...Array(count4).fill(denom4 / precision)];
192
- paymentOptions.push({
193
- combination: combination,
194
- sum: sum / precision,
195
- coinCount: count1 + count2 + count3 + count4,
196
- denomTypes: 4
197
- });
198
- }
199
- }
200
- }
201
- }
202
- }
203
- }
204
- }
205
- }
206
- }
207
-
208
- // 如果没有找到任何组合,提供默认建议
209
- if (paymentOptions.length === 0) {
210
- // 找到大于等于目标金额的最小面额
211
- const minValidDenom = validDenoms.find(denom => denom >= targetAmount);
212
- if (minValidDenom) {
213
- return [minValidDenom];
214
- } else {
215
- // 使用最大面额的组合
216
- const maxDenom = Math.max(...validDenoms);
217
- const count = Math.ceil(targetAmount / maxDenom);
218
- return [count * maxDenom];
219
- }
220
- }
221
-
222
- // 移除重复和扩展组合
223
- const uniqueCombinations = removeDuplicateAndExtendedCombinations(paymentOptions, targetAmount);
224
-
225
- // 按币种类型数量排序,然后按总硬币数量排序,最后按金额排序
226
- uniqueCombinations.sort((a, b) => {
227
- if (a.denomTypes !== b.denomTypes) {
228
- return a.denomTypes - b.denomTypes;
229
- }
230
- if (a.coinCount !== b.coinCount) {
231
- return a.coinCount - b.coinCount;
232
- }
233
- return a.sum - b.sum;
234
- });
235
-
236
- // 按金额去重并返回推荐的支付金额
237
- const uniqueAmounts = new Set();
238
- const finalResults = [];
239
- for (const item of uniqueCombinations) {
240
- const roundedAmount = Math.round(item.sum * 100) / 100; // 处理浮点数精度
241
- if (!uniqueAmounts.has(roundedAmount) && finalResults.length < 10) {
242
- uniqueAmounts.add(roundedAmount);
243
- finalResults.push(roundedAmount);
244
- }
245
- }
246
- return finalResults.sort((a, b) => a - b);
247
- } catch (error) {
248
- // 发生错误时返回安全的默认值
249
- console.warn('推荐支付金额计算出错:', error);
250
- // 返回最接近的整数金额作为兜底
251
- const safeAmount = Math.ceil(targetAmount);
252
- return [targetAmount, safeAmount];
253
- }
254
- }
255
-
256
- /**
257
- * 尝试找到精确匹配目标金额的组合
258
- */
259
- function findExactCombination(target, denoms, precision) {
260
- // 简单的深度优先搜索,限制搜索深度
261
- function dfs(remaining, denomIndex, currentCombination) {
262
- if (remaining === 0) {
263
- return currentCombination;
264
- }
265
- if (remaining < 0 || denomIndex >= denoms.length || currentCombination.length > 10) {
266
- return null;
267
- }
268
- const denom = denoms[denomIndex];
269
-
270
- // 尝试使用当前面额 0 到 maxCount 次
271
- const maxCount = Math.min(Math.floor(remaining / denom), 8);
272
- for (let count = maxCount; count >= 0; count--) {
273
- const newCombination = [...currentCombination, ...Array(count).fill(denom)];
274
- const result = dfs(remaining - count * denom, denomIndex + 1, newCombination);
275
- if (result) {
276
- return result;
277
- }
278
- }
279
- return null;
280
- }
281
- const exactMatch = dfs(target, 0, []);
282
- if (exactMatch && exactMatch.length > 0) {
283
- const denomTypes = new Set(exactMatch).size;
284
- return {
285
- combination: exactMatch.map(d => d / precision),
286
- sum: target / precision,
287
- coinCount: exactMatch.length,
288
- denomTypes: denomTypes
289
- };
290
- }
291
- return null;
292
- }
293
-
294
- /**
295
- * 移除重复和扩展组合
296
- * 核心原理:如果组合A包含组合B的所有硬币,并且还有额外硬币,则A是B的扩展,应该被移除
297
- */
298
- function removeDuplicateAndExtendedCombinations(combinations, targetAmount) {
299
- const result = [];
300
-
301
- // 按币种类型数量、硬币数量、金额排序,确保较简单的组合在前面
302
- combinations.sort((a, b) => {
303
- if (a.denomTypes !== b.denomTypes) {
304
- return a.denomTypes - b.denomTypes;
305
- }
306
- if (a.coinCount !== b.coinCount) {
307
- return a.coinCount - b.coinCount;
308
- }
309
- return a.sum - b.sum;
310
- });
311
- for (let i = 0; i < combinations.length; i++) {
312
- const current = combinations[i];
313
- let shouldSkip = false;
314
-
315
- // 检查当前组合是否与已添加的组合重复或者是扩展
316
- for (let j = 0; j < result.length; j++) {
317
- const existing = result[j];
318
-
319
- // 如果完全相同,跳过
320
- if (isSameCombination(current.combination, existing.combination)) {
321
- shouldSkip = true;
322
- break;
323
- }
324
-
325
- // 如果当前组合是已存在组合的扩展,跳过
326
- if (isExtensionOf(current.combination, existing.combination)) {
327
- shouldSkip = true;
328
- break;
329
- }
330
- }
331
-
332
- // 检查是否有其他组合是当前组合的扩展,如果有,移除那些扩展
333
- if (!shouldSkip) {
334
- // 移除所有当前组合的扩展
335
- for (let j = result.length - 1; j >= 0; j--) {
336
- if (isExtensionOf(result[j].combination, current.combination)) {
337
- result.splice(j, 1);
338
- }
339
- }
340
- result.push(current);
341
- }
342
- }
343
- return result;
344
- }
345
-
346
- /**
347
- * 检查组合A是否是组合B的扩展(即A包含B的所有硬币,并且还有额外的硬币)
348
- */
349
- function isExtensionOf(combinationA, combinationB) {
350
- // 如果A的硬币数量少于等于B,A不可能是B的扩展
351
- if (combinationA.length <= combinationB.length) {
352
- return false;
353
- }
354
-
355
- // 统计每个面额的数量
356
- const countA = {};
357
- const countB = {};
358
- combinationA.forEach(coin => {
359
- countA[coin] = (countA[coin] || 0) + 1;
360
- });
361
- combinationB.forEach(coin => {
362
- countB[coin] = (countB[coin] || 0) + 1;
363
- });
364
-
365
- // 检查B的所有面额在A中是否都有足够的数量
366
- for (const coin in countB) {
367
- if (!countA[coin] || countA[coin] < countB[coin]) {
368
- return false;
369
- }
370
- }
371
-
372
- // 检查A是否有B没有的额外硬币
373
- let hasExtra = false;
374
- for (const coin in countA) {
375
- if (countA[coin] > (countB[coin] || 0)) {
376
- hasExtra = true;
377
- break;
378
- }
379
- }
380
- return hasExtra;
381
- }
382
-
383
- /**
384
- * 检查两个组合是否本质相同(相同的面额组合)
385
- */
386
- function isSameCombination(combinationA, combinationB) {
387
- if (combinationA.length !== combinationB.length) {
388
- return false;
389
- }
390
- const countA = {};
391
- const countB = {};
392
- combinationA.forEach(coin => {
393
- countA[coin] = (countA[coin] || 0) + 1;
394
- });
395
- combinationB.forEach(coin => {
396
- countB[coin] = (countB[coin] || 0) + 1;
397
- });
398
-
399
- // 检查两个组合是否有相同的面额和数量
400
- for (const coin in countA) {
401
- if (countA[coin] !== (countB[coin] || 0)) {
402
- return false;
403
- }
404
- }
405
- for (const coin in countB) {
406
- if (countB[coin] !== (countA[coin] || 0)) {
407
- return false;
408
- }
409
- }
410
- return true;
62
+ const precision = 100;
63
+ const normalizedTarget = Math.round(targetAmount * precision) / precision;
64
+ const higherDenominations = [...new Set((Array.isArray(denominations) ? denominations : []).filter(denomination => denomination > 0 && Number.isFinite(denomination)).map(denomination => Math.round(denomination * precision) / precision))].filter(denomination => denomination > normalizedTarget).sort((a, b) => a - b).slice(0, 3);
65
+ return [normalizedTarget, ...higherDenominations];
411
66
  }
@@ -45,6 +45,7 @@ export interface SmallTicketProduct {
45
45
  product_uid?: string | number;
46
46
  booking_uid?: string | number;
47
47
  product_note?: string;
48
+ allergy?: string;
48
49
  options?: Array<{
49
50
  name: string;
50
51
  num?: number;
@@ -311,6 +311,7 @@ function buildBaseData(params) {
311
311
  }
312
312
  function buildProducts(order, locale, productMap) {
313
313
  const products = Array.isArray(order.products) ? order.products : [];
314
+ const allergyByProductUid = buildProductAllergyMap(order, locale);
314
315
  return products.map(rawProduct => {
315
316
  const product = restoreReceiptDiscountHierarchy(rawProduct);
316
317
  const quantity = toNumber(product.product_quantity ?? product.quantity ?? product.num ?? 1, 1);
@@ -351,6 +352,7 @@ function buildProducts(order, locale, productMap) {
351
352
  originalPrice
352
353
  });
353
354
  const productNote = resolveProductNote(product, locale);
355
+ const allergy = isPresentId(productUid) ? allergyByProductUid.get(String(productUid).trim()) || '' : '';
354
356
  const basePrice = resolveProductBasePrice(product);
355
357
  const resolvedCombinations = Array.isArray(product.combinations) && product.combinations.length ? normalizeExistingCombinations(product.combinations, locale, currencySymbol) : combinations;
356
358
  const shouldIncludeBasePrice = options.length > 0 || resolvedCombinations.length > 0 || hasProductDiscount(product, extensionList);
@@ -380,6 +382,9 @@ function buildProducts(order, locale, productMap) {
380
382
  ...(productNote ? {
381
383
  product_note: productNote
382
384
  } : {}),
385
+ ...(allergy ? {
386
+ allergy
387
+ } : {}),
383
388
  ...(options.length ? {
384
389
  options
385
390
  } : {}),
@@ -782,6 +787,21 @@ function resolveProductNote(product, locale) {
782
787
  if (productNote) return productNote;
783
788
  return getLocalizedValue(product.note, locale).trim();
784
789
  }
790
+ function buildProductAllergyMap(order, locale) {
791
+ const allergyByProductUid = new Map();
792
+ for (const note of normalizeArray(order.notes)) {
793
+ if (!note || typeof note !== 'object' || Array.isArray(note) || String(note.note_type || '').trim() !== 'allergy') {
794
+ continue;
795
+ }
796
+ const content = getLocalizedValue(note.content?.text, locale).trim();
797
+ if (!content) continue;
798
+ const relation = normalizeArray(note.note_relations).find(item => item && typeof item === 'object' && !Array.isArray(item) && item.relation_type === 'about' && item.target_type === 'order_detail' && Number(item.is_primary) === 1);
799
+ const productUid = String(relation?.target_uuid ?? '').trim();
800
+ if (!productUid || allergyByProductUid.has(productUid)) continue;
801
+ allergyByProductUid.set(productUid, content);
802
+ }
803
+ return allergyByProductUid;
804
+ }
785
805
  function resolveBundleProductTitle(params) {
786
806
  const {
787
807
  bundle,
@@ -1470,8 +1490,9 @@ function buildVoucherAssets(params) {
1470
1490
  }, ...(timeRow ? [timeRow] : [])]];
1471
1491
  });
1472
1492
  }
1493
+ const TICKET_VOUCHER_TAGS = new Set(['ticket', 'product_package_ticket', 'appointment_ticket', 'session_ticket']);
1473
1494
  function isTicketVoucher(voucher) {
1474
- return stringify(voucher.tag).trim().toLowerCase() === 'ticket';
1495
+ return TICKET_VOUCHER_TAGS.has(stringify(voucher.tag).trim().toLowerCase());
1475
1496
  }
1476
1497
  function getVoucherValidity(voucher, locale) {
1477
1498
  const availableTime = firstPresentValue(voucher.available_time, voucher.avaliable_time, voucher.metadata?.available_time, voucher.metadata?.avaliable_time);
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
329
+ weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.110",
4
+ "version": "2.3.112",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",