@pisell/pisellos 2.2.183 → 2.2.185

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.
@@ -1,5 +1,4 @@
1
1
  var _excluded = ["_promotionTags"];
2
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
2
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
3
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -7,6 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
8
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
12
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
@@ -230,7 +230,7 @@ export function mergeIdenticalPromotionCartLines(products) {
230
230
  _step;
231
231
  try {
232
232
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
233
- var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$product_variant;
233
+ var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$booking_uid, _line$metadata4, _line$product_variant;
234
234
  var line = _step.value;
235
235
  if (getGiftInfo(line)) {
236
236
  merged.push(line);
@@ -244,7 +244,8 @@ export function mergeIdenticalPromotionCartLines(products) {
244
244
  var fingerprint = buildProductLineFingerprint(line.product_option_item, line.product_bundle);
245
245
  var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
246
246
  var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
247
- var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, promotion.strategyId, unitPrice, promoUnitPrice].join('#');
247
+ var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
248
+ var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
248
249
  var hitIndex = indexByKey.get(mergeKey);
249
250
  if (hitIndex === undefined) {
250
251
  indexByKey.set(mergeKey, merged.length);
@@ -277,9 +278,9 @@ function dedupePromotionProcessedLines(lines) {
277
278
  _step2;
278
279
  try {
279
280
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
280
- var _line$metadata5;
281
+ var _line$metadata6;
281
282
  var line = _step2.value;
282
- var promo = line === null || line === void 0 || (_line$metadata5 = line.metadata) === null || _line$metadata5 === void 0 ? void 0 : _line$metadata5._promotion;
283
+ var promo = line === null || line === void 0 || (_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6._promotion;
283
284
  var originalUid = String(line._originalProductUid || getOrderProductUid(line) || '');
284
285
  if (!(promo !== null && promo !== void 0 && promo.inPromotion) || !originalUid) {
285
286
  passthrough.push(line);
@@ -295,8 +296,8 @@ function dedupePromotionProcessedLines(lines) {
295
296
  _iterator2.f();
296
297
  }
297
298
  var promotionDelta = function promotionDelta(line) {
298
- var _line$metadata4;
299
- var promo = (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4._promotion;
299
+ var _line$metadata5;
300
+ var promo = (_line$metadata5 = line.metadata) === null || _line$metadata5 === void 0 ? void 0 : _line$metadata5._promotion;
300
301
  var original = Number(promo === null || promo === void 0 ? void 0 : promo.originalPrice);
301
302
  var final = Number(promo === null || promo === void 0 ? void 0 : promo.finalPrice);
302
303
  if (!Number.isFinite(original) || !Number.isFinite(final)) return 0;
@@ -307,7 +308,7 @@ function dedupePromotionProcessedLines(lines) {
307
308
  _step3;
308
309
  try {
309
310
  var _loop = function _loop() {
310
- var _winner$metadata, _winner$metadata2;
311
+ var _winner$metadata, _winner$metadata2, _winner$metadata3;
311
312
  var _step3$value = _slicedToArray(_step3.value, 2),
312
313
  originalUid = _step3$value[0],
313
314
  group = _step3$value[1];
@@ -322,33 +323,48 @@ function dedupePromotionProcessedLines(lines) {
322
323
  return promotionDelta(line) > 0;
323
324
  });
324
325
  var xItemsLines = (pricingLines.length ? pricingLines : group).filter(function (line) {
325
- var _line$metadata6;
326
- return getPromotionActionType((_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6._promotion) === X_ITEMS_FOR_Y_PRICE;
326
+ var _line$metadata7;
327
+ return getPromotionActionType((_line$metadata7 = line.metadata) === null || _line$metadata7 === void 0 ? void 0 : _line$metadata7._promotion) === X_ITEMS_FOR_Y_PRICE;
327
328
  });
328
329
  var pool = xItemsLines.length ? xItemsLines : pricingLines.length ? pricingLines : group;
329
330
  var winner = pool[0];
330
331
  var expectedUnit = resolveXItemsExpectedUnitPrice((_winner$metadata = winner.metadata) === null || _winner$metadata === void 0 ? void 0 : _winner$metadata._promotion, sourceCartNum);
331
332
  if (expectedUnit != null && pool.length > 1) {
332
333
  winner = pool.reduce(function (best, line) {
333
- var _best$metadata, _line$metadata7;
334
+ var _best$metadata, _line$metadata8;
334
335
  var bestDiff = Math.abs(Number((_best$metadata = best.metadata) === null || _best$metadata === void 0 || (_best$metadata = _best$metadata._promotion) === null || _best$metadata === void 0 ? void 0 : _best$metadata.finalPrice) - expectedUnit);
335
- var lineDiff = Math.abs(Number((_line$metadata7 = line.metadata) === null || _line$metadata7 === void 0 || (_line$metadata7 = _line$metadata7._promotion) === null || _line$metadata7 === void 0 ? void 0 : _line$metadata7.finalPrice) - expectedUnit);
336
+ var lineDiff = Math.abs(Number((_line$metadata8 = line.metadata) === null || _line$metadata8 === void 0 || (_line$metadata8 = _line$metadata8._promotion) === null || _line$metadata8 === void 0 ? void 0 : _line$metadata8.finalPrice) - expectedUnit);
336
337
  return lineDiff < bestDiff ? line : best;
337
338
  }, pool[0]);
338
339
  } else if (pool.length > 1 && !expectedUnit) {
339
340
  winner = pool.reduce(function (best, line) {
340
- var _best$metadata2, _line$metadata8, _line$metadata9;
341
+ var _best$metadata2, _line$metadata9, _line$metadata10;
341
342
  var bestFinal = Number((_best$metadata2 = best.metadata) === null || _best$metadata2 === void 0 || (_best$metadata2 = _best$metadata2._promotion) === null || _best$metadata2 === void 0 ? void 0 : _best$metadata2.finalPrice);
342
- var lineFinal = Number((_line$metadata8 = line.metadata) === null || _line$metadata8 === void 0 || (_line$metadata8 = _line$metadata8._promotion) === null || _line$metadata8 === void 0 ? void 0 : _line$metadata8.finalPrice);
343
- var original = Number((_line$metadata9 = line.metadata) === null || _line$metadata9 === void 0 || (_line$metadata9 = _line$metadata9._promotion) === null || _line$metadata9 === void 0 ? void 0 : _line$metadata9.originalPrice);
343
+ var lineFinal = Number((_line$metadata9 = line.metadata) === null || _line$metadata9 === void 0 || (_line$metadata9 = _line$metadata9._promotion) === null || _line$metadata9 === void 0 ? void 0 : _line$metadata9.finalPrice);
344
+ var original = Number((_line$metadata10 = line.metadata) === null || _line$metadata10 === void 0 || (_line$metadata10 = _line$metadata10._promotion) === null || _line$metadata10 === void 0 ? void 0 : _line$metadata10.originalPrice);
344
345
  if (Number.isFinite(original) && lineFinal >= original && bestFinal >= original) {
345
346
  return lineFinal < bestFinal ? line : best;
346
347
  }
347
348
  return promotionDelta(line) > promotionDelta(best) ? line : best;
348
349
  }, pool[0]);
349
350
  }
350
- winner.num = getSafeProductNum(sourceCartNum || winner.num || 1);
351
- var recomputeUnit = resolveXItemsExpectedUnitPrice((_winner$metadata2 = winner.metadata) === null || _winner$metadata2 === void 0 ? void 0 : _winner$metadata2._promotion, sourceCartNum);
351
+
352
+ // X件Y元:评估器会按单件均摊产出多条 inPromotion 行(如 $1 + $9),
353
+ // dedupe 应合并为「同组 X件Y元 行 num 之和」,不能用 sourceCartNum(整单 3 件)。
354
+ var winnerIsXItems = getPromotionActionType((_winner$metadata2 = winner.metadata) === null || _winner$metadata2 === void 0 ? void 0 : _winner$metadata2._promotion) === X_ITEMS_FOR_Y_PRICE;
355
+ if (winnerIsXItems) {
356
+ var xItemsGroupLines = group.filter(function (line) {
357
+ var _line$metadata11;
358
+ return getPromotionActionType((_line$metadata11 = line.metadata) === null || _line$metadata11 === void 0 ? void 0 : _line$metadata11._promotion) === X_ITEMS_FOR_Y_PRICE;
359
+ });
360
+ var evaluatedPromoQty = xItemsGroupLines.reduce(function (sum, line) {
361
+ return sum + Number(line.num || 0);
362
+ }, 0);
363
+ winner.num = getSafeProductNum(evaluatedPromoQty || winner.num || 1);
364
+ } else {
365
+ winner.num = getSafeProductNum(sourceCartNum || winner.num || 1);
366
+ }
367
+ var recomputeUnit = resolveXItemsExpectedUnitPrice((_winner$metadata3 = winner.metadata) === null || _winner$metadata3 === void 0 ? void 0 : _winner$metadata3._promotion, sourceCartNum);
352
368
  if (recomputeUnit != null) {
353
369
  var _promo$strategyMetada;
354
370
  var _promo = winner.metadata._promotion;
@@ -363,10 +379,10 @@ function dedupePromotionProcessedLines(lines) {
363
379
  _step4;
364
380
  try {
365
381
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
366
- var _line$metadata10, _winner$metadata3;
382
+ var _line$metadata12, _winner$metadata4;
367
383
  var _line = _step4.value;
368
- var giftInfo = (_line$metadata10 = _line.metadata) === null || _line$metadata10 === void 0 || (_line$metadata10 = _line$metadata10._promotion) === null || _line$metadata10 === void 0 ? void 0 : _line$metadata10.giftInfo;
369
- if (giftInfo && (_winner$metadata3 = winner.metadata) !== null && _winner$metadata3 !== void 0 && _winner$metadata3._promotion && !winner.metadata._promotion.giftInfo) {
384
+ var giftInfo = (_line$metadata12 = _line.metadata) === null || _line$metadata12 === void 0 || (_line$metadata12 = _line$metadata12._promotion) === null || _line$metadata12 === void 0 ? void 0 : _line$metadata12.giftInfo;
385
+ if (giftInfo && (_winner$metadata4 = winner.metadata) !== null && _winner$metadata4 !== void 0 && _winner$metadata4._promotion && !winner.metadata._promotion.giftInfo) {
370
386
  winner.metadata._promotion.giftInfo = giftInfo;
371
387
  }
372
388
  }
@@ -413,6 +429,126 @@ function getProductBundleForEvaluator(product) {
413
429
  });
414
430
  }
415
431
 
432
+ /**
433
+ * 促销评估前合并同 SKU 拆分行(含促销/原价行),避免加购后仅前 2 件享受优惠。
434
+ * 带 `booking_uid` 的预约行不参与合并(每次加车独立 booking + 商品行)。
435
+ *
436
+ * @example
437
+ * consolidateMainProductsForPromotion([
438
+ * { item: promoLineNum2, originalListIndex: 0 },
439
+ * { item: regularLineNum2, originalListIndex: 1 },
440
+ * ]);
441
+ * // => 单行 num=4,清除 _promotion 后重新评估
442
+ */
443
+ export function buildConsolidateKeyForPromotion(item) {
444
+ var _item$booking_uid, _item$metadata, _item$product_variant2;
445
+ var fingerprint = buildProductLineFingerprint(item.product_option_item, item.product_bundle);
446
+ var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
447
+ if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
448
+ var _item$product_variant;
449
+ return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(bookingUid)].join('#');
450
+ }
451
+ return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint].join('#');
452
+ }
453
+ function consolidateMainProductsForPromotion(entries) {
454
+ if (!Array.isArray(entries) || entries.length <= 1) {
455
+ return _toConsumableArray(entries || []);
456
+ }
457
+ var groups = new Map();
458
+ var _iterator5 = _createForOfIteratorHelper(entries),
459
+ _step5;
460
+ try {
461
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
462
+ var _step5$value = _step5.value,
463
+ item = _step5$value.item,
464
+ originalListIndex = _step5$value.originalListIndex;
465
+ var key = buildConsolidateKeyForPromotion(item);
466
+ var existing = groups.get(key);
467
+ if (!existing) {
468
+ var mergedItem = cloneDeep(item);
469
+ var metadata = mergedItem.metadata || {};
470
+ delete metadata._promotion;
471
+ mergedItem.metadata = metadata;
472
+ if (Array.isArray(mergedItem.product_bundle)) {
473
+ var _iterator6 = _createForOfIteratorHelper(mergedItem.product_bundle),
474
+ _step6;
475
+ try {
476
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
477
+ var bundle = _step6.value;
478
+ if (bundle && _typeof(bundle) === 'object') delete bundle._promotion;
479
+ }
480
+ } catch (err) {
481
+ _iterator6.e(err);
482
+ } finally {
483
+ _iterator6.f();
484
+ }
485
+ }
486
+ groups.set(key, {
487
+ item: mergedItem,
488
+ originalListIndex: originalListIndex
489
+ });
490
+ continue;
491
+ }
492
+ existing.item.num = getSafeProductNum(Number(existing.item.num || 0) + Number(item.num || 0));
493
+ }
494
+ } catch (err) {
495
+ _iterator5.e(err);
496
+ } finally {
497
+ _iterator5.f();
498
+ }
499
+ return Array.from(groups.values());
500
+ }
501
+
502
+ /**
503
+ * X件Y元 整组凑满时按每组 x 件拆开展示(4 件 → 2 行各 2 件 $10)。
504
+ *
505
+ * @example
506
+ * splitXItemsPromoLinesByGroup(mergedLines, strategyActionMap);
507
+ */
508
+ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
509
+ var result = [];
510
+ var _iterator7 = _createForOfIteratorHelper(lines),
511
+ _step7;
512
+ try {
513
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
514
+ var _line$metadata13, _actionMeta$actionDet;
515
+ var line = _step7.value;
516
+ var promo = line === null || line === void 0 || (_line$metadata13 = line.metadata) === null || _line$metadata13 === void 0 ? void 0 : _line$metadata13._promotion;
517
+ if (!(promo !== null && promo !== void 0 && promo.inPromotion) || !promo.strategyId) {
518
+ result.push(line);
519
+ continue;
520
+ }
521
+ if (getPromotionActionType(promo) !== X_ITEMS_FOR_Y_PRICE) {
522
+ result.push(line);
523
+ continue;
524
+ }
525
+ var actionMeta = strategyActionMap.get(promo.strategyId);
526
+ var detail = (_actionMeta$actionDet = actionMeta === null || actionMeta === void 0 ? void 0 : actionMeta.actionDetail) !== null && _actionMeta$actionDet !== void 0 ? _actionMeta$actionDet : promo.actionDetail;
527
+ var x = Number(detail === null || detail === void 0 ? void 0 : detail.x);
528
+ var num = Number(line.num || 0);
529
+ var isCumulative = (detail === null || detail === void 0 ? void 0 : detail.cumulative) !== false;
530
+ if (!isCumulative || !Number.isFinite(x) || x <= 0 || num <= x || num % x !== 0) {
531
+ result.push(line);
532
+ continue;
533
+ }
534
+ var groupCount = num / x;
535
+ for (var i = 0; i < groupCount; i++) {
536
+ var splitLine = cloneDeep(line);
537
+ splitLine.num = getSafeProductNum(x);
538
+ splitLine.metadata = _objectSpread(_objectSpread({}, splitLine.metadata || {}), {}, {
539
+ unique_identification_number: createUuidV4()
540
+ });
541
+ result.push(splitLine);
542
+ }
543
+ }
544
+ } catch (err) {
545
+ _iterator7.e(err);
546
+ } finally {
547
+ _iterator7.f();
548
+ }
549
+ return result;
550
+ }
551
+
416
552
  /** 生成新 numeric id(仅用于评估器内部追踪) */
417
553
  function generateNumericId() {
418
554
  return Math.floor(Math.random() * 1000000000) + Date.now();
@@ -428,6 +564,7 @@ function convertToPromotionProduct(product, index) {
428
564
  var _product$product_id, _product$product_vari, _product$num;
429
565
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
430
566
  var numericId = generateNumericId();
567
+ var originalItem = product;
431
568
  return {
432
569
  id: numericId,
433
570
  product_id: Number((_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : 0) || 0,
@@ -436,7 +573,7 @@ function convertToPromotionProduct(product, index) {
436
573
  price: getOrderProductOriginalPriceForPromotion(product),
437
574
  quantity: Number((_product$num = product === null || product === void 0 ? void 0 : product.num) !== null && _product$num !== void 0 ? _product$num : 1) || 1,
438
575
  bundle: getProductBundleForEvaluator(product),
439
- _originalItem: product,
576
+ _originalItem: originalItem,
440
577
  _originalId: getOrderProductUid(product),
441
578
  _originalIndex: index
442
579
  };
@@ -458,12 +595,12 @@ function calculateGiftActions(gifts, existingGifts) {
458
595
 
459
596
  // 按 strategyId 分组现有赠品
460
597
  var existingByStrategy = new Map();
461
- var _iterator5 = _createForOfIteratorHelper(existingGifts),
462
- _step5;
598
+ var _iterator8 = _createForOfIteratorHelper(existingGifts),
599
+ _step8;
463
600
  try {
464
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
601
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
465
602
  var _getGiftInfo, _gift$num;
466
- var gift = _step5.value;
603
+ var gift = _step8.value;
467
604
  var strategyId = (_getGiftInfo = getGiftInfo(gift)) === null || _getGiftInfo === void 0 ? void 0 : _getGiftInfo.strategyId;
468
605
  if (!strategyId) continue;
469
606
  var existing = existingByStrategy.get(strategyId);
@@ -479,17 +616,17 @@ function calculateGiftActions(gifts, existingGifts) {
479
616
  }
480
617
  }
481
618
  } catch (err) {
482
- _iterator5.e(err);
619
+ _iterator8.e(err);
483
620
  } finally {
484
- _iterator5.f();
621
+ _iterator8.f();
485
622
  }
486
623
  var processedStrategyIds = new Set();
487
- var _iterator6 = _createForOfIteratorHelper(gifts),
488
- _step6;
624
+ var _iterator9 = _createForOfIteratorHelper(gifts),
625
+ _step9;
489
626
  try {
490
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
627
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
491
628
  var _existing$totalQuanti;
492
- var giftInfo = _step6.value;
629
+ var giftInfo = _step9.value;
493
630
  var _strategyId = giftInfo.strategyId,
494
631
  strategyName = giftInfo.strategyName,
495
632
  giftCount = giftInfo.giftCount,
@@ -519,12 +656,12 @@ function calculateGiftActions(gifts, existingGifts) {
519
656
  var reduceItems = [];
520
657
  var removeIds = [];
521
658
  var reversed = _toConsumableArray((_existing === null || _existing === void 0 ? void 0 : _existing.items) || []).reverse();
522
- var _iterator8 = _createForOfIteratorHelper(reversed),
523
- _step8;
659
+ var _iterator11 = _createForOfIteratorHelper(reversed),
660
+ _step11;
524
661
  try {
525
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
662
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
526
663
  var _giftItem$num;
527
- var giftItem = _step8.value;
664
+ var giftItem = _step11.value;
528
665
  if (remaining <= 0) break;
529
666
  var uid = getOrderProductUid(giftItem);
530
667
  var _qty = Number((_giftItem$num = giftItem === null || giftItem === void 0 ? void 0 : giftItem.num) !== null && _giftItem$num !== void 0 ? _giftItem$num : 1) || 1;
@@ -541,9 +678,9 @@ function calculateGiftActions(gifts, existingGifts) {
541
678
  }
542
679
  }
543
680
  } catch (err) {
544
- _iterator8.e(err);
681
+ _iterator11.e(err);
545
682
  } finally {
546
- _iterator8.f();
683
+ _iterator11.f();
547
684
  }
548
685
  if (reduceItems.length > 0) toReduce.push({
549
686
  strategyId: _strategyId,
@@ -555,35 +692,35 @@ function calculateGiftActions(gifts, existingGifts) {
555
692
 
556
693
  // 失效策略的赠品:全部 remove
557
694
  } catch (err) {
558
- _iterator6.e(err);
695
+ _iterator9.e(err);
559
696
  } finally {
560
- _iterator6.f();
697
+ _iterator9.f();
561
698
  }
562
- var _iterator7 = _createForOfIteratorHelper(existingByStrategy),
563
- _step7;
699
+ var _iterator10 = _createForOfIteratorHelper(existingByStrategy),
700
+ _step10;
564
701
  try {
565
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
566
- var _step7$value = _slicedToArray(_step7.value, 2),
567
- _strategyId2 = _step7$value[0],
568
- _existing2 = _step7$value[1];
702
+ for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
703
+ var _step10$value = _slicedToArray(_step10.value, 2),
704
+ _strategyId2 = _step10$value[0],
705
+ _existing2 = _step10$value[1];
569
706
  if (processedStrategyIds.has(_strategyId2)) continue;
570
- var _iterator9 = _createForOfIteratorHelper(_existing2.items),
571
- _step9;
707
+ var _iterator12 = _createForOfIteratorHelper(_existing2.items),
708
+ _step12;
572
709
  try {
573
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
574
- var _giftItem = _step9.value;
710
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
711
+ var _giftItem = _step12.value;
575
712
  toRemove.push(getOrderProductUid(_giftItem));
576
713
  }
577
714
  } catch (err) {
578
- _iterator9.e(err);
715
+ _iterator12.e(err);
579
716
  } finally {
580
- _iterator9.f();
717
+ _iterator12.f();
581
718
  }
582
719
  }
583
720
  } catch (err) {
584
- _iterator7.e(err);
721
+ _iterator10.e(err);
585
722
  } finally {
586
- _iterator7.f();
723
+ _iterator10.f();
587
724
  }
588
725
  return {
589
726
  toAdd: toAdd,
@@ -603,11 +740,11 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
603
740
  var _strategyConfig$condi;
604
741
  var rules = strategyConfig === null || strategyConfig === void 0 || (_strategyConfig$condi = strategyConfig.conditions) === null || _strategyConfig$condi === void 0 ? void 0 : _strategyConfig$condi.rules;
605
742
  if (!Array.isArray(rules)) return [];
606
- var _iterator10 = _createForOfIteratorHelper(rules),
607
- _step10;
743
+ var _iterator13 = _createForOfIteratorHelper(rules),
744
+ _step13;
608
745
  try {
609
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
610
- var rule = _step10.value;
746
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
747
+ var rule = _step13.value;
611
748
  if ((rule === null || rule === void 0 ? void 0 : rule.field) === 'productIdAndVariantId' && ((rule === null || rule === void 0 ? void 0 : rule.operator) === 'product_match' || (rule === null || rule === void 0 ? void 0 : rule.operator) === 'object_in') && Array.isArray(rule === null || rule === void 0 ? void 0 : rule.value)) {
612
749
  return rule.value.map(function (item) {
613
750
  return {
@@ -620,9 +757,9 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
620
757
  }
621
758
  }
622
759
  } catch (err) {
623
- _iterator10.e(err);
760
+ _iterator13.e(err);
624
761
  } finally {
625
- _iterator10.f();
762
+ _iterator13.f();
626
763
  }
627
764
  return [];
628
765
  }
@@ -708,11 +845,11 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
708
845
  if (_ret === 0) continue;
709
846
  }
710
847
  var result = [];
711
- var _iterator11 = _createForOfIteratorHelper(unfulfilledMap.values()),
712
- _step11;
848
+ var _iterator14 = _createForOfIteratorHelper(unfulfilledMap.values()),
849
+ _step14;
713
850
  try {
714
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
715
- var data = _step11.value;
851
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
852
+ var data = _step14.value;
716
853
  var needQuantity = data.requiredQuantity - data.currentQuantity;
717
854
  if (needQuantity > 0) {
718
855
  result.push(_objectSpread(_objectSpread({}, data), {}, {
@@ -721,9 +858,9 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
721
858
  }
722
859
  }
723
860
  } catch (err) {
724
- _iterator11.e(err);
861
+ _iterator14.e(err);
725
862
  } finally {
726
- _iterator11.f();
863
+ _iterator14.f();
727
864
  }
728
865
  return result;
729
866
  }
@@ -745,11 +882,11 @@ export function appendPromotionTags(products, evaluator) {
745
882
 
746
883
  // 评估器期望的 product shape,最少字段集
747
884
  var evaluatorInput = products.map(function (item, index) {
748
- var _ref14, _item$id, _item$product_variant, _item$price, _item$quantity;
885
+ var _ref14, _item$id, _item$product_variant3, _item$price, _item$quantity;
749
886
  return {
750
887
  id: index,
751
888
  product_id: Number((_ref14 = (_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id) !== null && _ref14 !== void 0 ? _ref14 : 0) || 0,
752
- product_variant_id: Number((_item$product_variant = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0) || 0,
889
+ product_variant_id: Number((_item$product_variant3 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0) || 0,
753
890
  name: (item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.name) || '',
754
891
  price: Number((_item$price = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price !== void 0 ? _item$price : 0) || 0,
755
892
  quantity: Number((_item$quantity = item === null || item === void 0 ? void 0 : item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : 1) || 1,
@@ -763,11 +900,11 @@ export function appendPromotionTags(products, evaluator) {
763
900
  var data = strategies[index];
764
901
  var tags = [];
765
902
  if (data !== null && data !== void 0 && data.hasApplicableStrategy) {
766
- var _iterator12 = _createForOfIteratorHelper(data.applicableStrategies),
767
- _step12;
903
+ var _iterator15 = _createForOfIteratorHelper(data.applicableStrategies),
904
+ _step15;
768
905
  try {
769
- for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
770
- var strategy = _step12.value;
906
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
907
+ var strategy = _step15.value;
771
908
  if (strategy.display) {
772
909
  tags.push({
773
910
  text: strategy.display.text,
@@ -777,9 +914,9 @@ export function appendPromotionTags(products, evaluator) {
777
914
  }
778
915
  }
779
916
  } catch (err) {
780
- _iterator12.e(err);
917
+ _iterator15.e(err);
781
918
  } finally {
782
- _iterator12.f();
919
+ _iterator15.f();
783
920
  }
784
921
  }
785
922
  // 商品卡兼容两种位置:顶层 `_promotionTags` 与 `metadata._promotionTags`
@@ -855,7 +992,8 @@ export function processCartPromotion(list, evaluator, options) {
855
992
  });
856
993
  }
857
994
  }
858
- var mainProducts = mainProductsWithIndex.map(function (x) {
995
+ var consolidatedMainProductsWithIndex = consolidateMainProductsForPromotion(mainProductsWithIndex);
996
+ var mainProducts = consolidatedMainProductsWithIndex.map(function (x) {
859
997
  return x.item;
860
998
  });
861
999
  var existingGifts = existingGiftsWithIndex.map(function (x) {
@@ -867,18 +1005,18 @@ export function processCartPromotion(list, evaluator, options) {
867
1005
  });
868
1006
  if (existingGifts.length > 0) {
869
1007
  var toRemove = [];
870
- var _iterator13 = _createForOfIteratorHelper(existingGifts),
871
- _step13;
1008
+ var _iterator16 = _createForOfIteratorHelper(existingGifts),
1009
+ _step16;
872
1010
  try {
873
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
874
- var gift = _step13.value;
1011
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1012
+ var gift = _step16.value;
875
1013
  var uid = getOrderProductUid(gift);
876
1014
  if (uid) toRemove.push(uid);
877
1015
  }
878
1016
  } catch (err) {
879
- _iterator13.e(err);
1017
+ _iterator16.e(err);
880
1018
  } finally {
881
- _iterator13.f();
1019
+ _iterator16.f();
882
1020
  }
883
1021
  return {
884
1022
  products: editProducts,
@@ -900,23 +1038,23 @@ export function processCartPromotion(list, evaluator, options) {
900
1038
  // 1. 转 PromotionProduct
901
1039
  var promotionProducts = [];
902
1040
  var originalItemMap = new Map();
903
- var productsForStrategies = mainProductsWithIndex.map(function (_ref16, i) {
904
- var _item$product_id, _item$product_variant2, _item$metadata, _item$num;
1041
+ var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
1042
+ var _item$product_id, _item$product_variant4, _item$metadata2, _item$num;
905
1043
  var item = _ref16.item;
906
1044
  return {
907
1045
  id: i,
908
1046
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
909
- product_variant_id: Number((_item$product_variant2 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0) || 0,
910
- name: (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1047
+ product_variant_id: Number((_item$product_variant4 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant4 !== void 0 ? _item$product_variant4 : 0) || 0,
1048
+ name: (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
911
1049
  price: getOrderProductBasePrice(item),
912
1050
  quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
913
1051
  bundle: getProductBundleForEvaluator(item)
914
1052
  };
915
1053
  });
916
- for (var _i = 0; _i < mainProductsWithIndex.length; _i++) {
917
- var _mainProductsWithInde = mainProductsWithIndex[_i],
918
- _item = _mainProductsWithInde.item,
919
- originalListIndex = _mainProductsWithInde.originalListIndex;
1054
+ for (var _i = 0; _i < consolidatedMainProductsWithIndex.length; _i++) {
1055
+ var _consolidatedMainProd = consolidatedMainProductsWithIndex[_i],
1056
+ _item = _consolidatedMainProd.item,
1057
+ originalListIndex = _consolidatedMainProd.originalListIndex;
920
1058
  var promotionProduct = convertToPromotionProduct(_item, originalListIndex);
921
1059
  promotionProducts.push(promotionProduct);
922
1060
  originalItemMap.set(promotionProduct.id, {
@@ -931,16 +1069,16 @@ export function processCartPromotion(list, evaluator, options) {
931
1069
  channel: options === null || options === void 0 ? void 0 : options.channel
932
1070
  });
933
1071
  var strategyActionMap = new Map();
934
- var _iterator14 = _createForOfIteratorHelper(applicableStrategiesResult || []),
935
- _step14;
1072
+ var _iterator17 = _createForOfIteratorHelper(applicableStrategiesResult || []),
1073
+ _step17;
936
1074
  try {
937
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
938
- var row = _step14.value;
939
- var _iterator19 = _createForOfIteratorHelper((row === null || row === void 0 ? void 0 : row.applicableStrategies) || []),
940
- _step19;
1075
+ for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1076
+ var row = _step17.value;
1077
+ var _iterator22 = _createForOfIteratorHelper((row === null || row === void 0 ? void 0 : row.applicableStrategies) || []),
1078
+ _step22;
941
1079
  try {
942
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
943
- var strategy = _step19.value;
1080
+ for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
1081
+ var strategy = _step22.value;
944
1082
  if (!(strategy !== null && strategy !== void 0 && strategy.strategyId)) continue;
945
1083
  strategyActionMap.set(strategy.strategyId, {
946
1084
  actionType: strategy.actionType,
@@ -948,17 +1086,17 @@ export function processCartPromotion(list, evaluator, options) {
948
1086
  });
949
1087
  }
950
1088
  } catch (err) {
951
- _iterator19.e(err);
1089
+ _iterator22.e(err);
952
1090
  } finally {
953
- _iterator19.f();
1091
+ _iterator22.f();
954
1092
  }
955
1093
  }
956
1094
 
957
1095
  // 3. 评估器
958
1096
  } catch (err) {
959
- _iterator14.e(err);
1097
+ _iterator17.e(err);
960
1098
  } finally {
961
- _iterator14.f();
1099
+ _iterator17.f();
962
1100
  }
963
1101
  var result = evaluator.evaluateCartWithPricing({
964
1102
  products: promotionProducts,
@@ -967,11 +1105,11 @@ export function processCartPromotion(list, evaluator, options) {
967
1105
 
968
1106
  // 4. 收集每个策略的 sourceProductIds(参与策略的主商品 uid)
969
1107
  var strategySourceProductIds = new Map();
970
- var _iterator15 = _createForOfIteratorHelper(result.products),
971
- _step15;
1108
+ var _iterator18 = _createForOfIteratorHelper(result.products),
1109
+ _step18;
972
1110
  try {
973
- for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
974
- var priced = _step15.value;
1111
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1112
+ var priced = _step18.value;
975
1113
  if (priced.inPromotion && priced.strategyId) {
976
1114
  var _priced$originalId;
977
1115
  var sourceId = (_priced$originalId = priced.originalId) !== null && _priced$originalId !== void 0 ? _priced$originalId : priced.id;
@@ -988,9 +1126,9 @@ export function processCartPromotion(list, evaluator, options) {
988
1126
 
989
1127
  // 5. 扩展 gifts,加 sourceProductIds
990
1128
  } catch (err) {
991
- _iterator15.e(err);
1129
+ _iterator18.e(err);
992
1130
  } finally {
993
- _iterator15.f();
1131
+ _iterator18.f();
994
1132
  }
995
1133
  var extendedGifts = result.gifts.map(function (gift) {
996
1134
  return _objectSpread(_objectSpread({}, gift), {}, {
@@ -1000,26 +1138,26 @@ export function processCartPromotion(list, evaluator, options) {
1000
1138
 
1001
1139
  // 6. PricedProduct → OrderProduct(含拆分与价格调整)
1002
1140
  var strategyGiftInfoMap = new Map();
1003
- var _iterator16 = _createForOfIteratorHelper(extendedGifts),
1004
- _step16;
1141
+ var _iterator19 = _createForOfIteratorHelper(extendedGifts),
1142
+ _step19;
1005
1143
  try {
1006
- for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1007
- var _gift = _step16.value;
1144
+ for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
1145
+ var _gift = _step19.value;
1008
1146
  strategyGiftInfoMap.set(_gift.strategyId, _gift);
1009
1147
  }
1010
1148
  } catch (err) {
1011
- _iterator16.e(err);
1149
+ _iterator19.e(err);
1012
1150
  } finally {
1013
- _iterator16.f();
1151
+ _iterator19.f();
1014
1152
  }
1015
1153
  var strategyGiftInfoOwner = new Map();
1016
1154
  var processedProducts = [];
1017
- var _iterator17 = _createForOfIteratorHelper(result.products),
1018
- _step17;
1155
+ var _iterator20 = _createForOfIteratorHelper(result.products),
1156
+ _step20;
1019
1157
  try {
1020
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
1158
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1021
1159
  var _priced$originalId2, _priced$product_id, _originalItem$product, _metadata$_promotion2;
1022
- var _priced = _step17.value;
1160
+ var _priced = _step20.value;
1023
1161
  var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
1024
1162
  var _sourceId = Number(rawSourceId);
1025
1163
  var _originalData = Number.isFinite(_sourceId) ? originalItemMap.get(_sourceId) : undefined;
@@ -1040,17 +1178,17 @@ export function processCartPromotion(list, evaluator, options) {
1040
1178
  var wasInPromotion = ((_metadata$_promotion2 = metadata._promotion) === null || _metadata$_promotion2 === void 0 ? void 0 : _metadata$_promotion2.inPromotion) === true;
1041
1179
  delete metadata._promotion;
1042
1180
  if (Array.isArray(newItem.product_bundle)) {
1043
- var _iterator20 = _createForOfIteratorHelper(newItem.product_bundle),
1044
- _step20;
1181
+ var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
1182
+ _step23;
1045
1183
  try {
1046
- for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
1047
- var b = _step20.value;
1184
+ for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
1185
+ var b = _step23.value;
1048
1186
  if (b && _typeof(b) === 'object') delete b._promotion;
1049
1187
  }
1050
1188
  } catch (err) {
1051
- _iterator20.e(err);
1189
+ _iterator23.e(err);
1052
1190
  } finally {
1053
- _iterator20.f();
1191
+ _iterator23.f();
1054
1192
  }
1055
1193
  }
1056
1194
  var originalBasePrice = getOrderProductOriginalPriceForPromotion(originalItem);
@@ -1135,9 +1273,9 @@ export function processCartPromotion(list, evaluator, options) {
1135
1273
 
1136
1274
  // 7. 赠品/编辑商品原样拼回;同时同步赠品的 sourceProductIds / sourceProductId
1137
1275
  } catch (err) {
1138
- _iterator17.e(err);
1276
+ _iterator20.e(err);
1139
1277
  } finally {
1140
- _iterator17.f();
1278
+ _iterator20.f();
1141
1279
  }
1142
1280
  for (var _i2 = 0, _existingGiftsWithInd = existingGiftsWithIndex; _i2 < _existingGiftsWithInd.length; _i2++) {
1143
1281
  var _getGiftInfo3;
@@ -1182,6 +1320,8 @@ export function processCartPromotion(list, evaluator, options) {
1182
1320
  processedProducts.splice.apply(processedProducts, [0, processedProducts.length].concat(_toConsumableArray(dedupedPromotionLines)));
1183
1321
  var mergedPromotionLines = mergeIdenticalPromotionCartLines(processedProducts);
1184
1322
  processedProducts.splice.apply(processedProducts, [0, processedProducts.length].concat(_toConsumableArray(mergedPromotionLines)));
1323
+ var splitPromoLines = splitXItemsPromoLinesByGroup(processedProducts, strategyActionMap);
1324
+ processedProducts.splice.apply(processedProducts, [0, processedProducts.length].concat(_toConsumableArray(splitPromoLines)));
1185
1325
 
1186
1326
  // 9. 给「有适用策略但未参与促销」的主商品打 inPromotion:false
1187
1327
  var _loop3 = function _loop3() {
@@ -1219,12 +1359,12 @@ export function processCartPromotion(list, evaluator, options) {
1219
1359
  var giftActions = calculateGiftActions(extendedGifts, existingGifts);
1220
1360
 
1221
1361
  // 10.1 更新 lastEvaluatedGiftCount,便于下次评估时判别「策略已变」
1222
- var _iterator18 = _createForOfIteratorHelper(existingGifts),
1223
- _step18;
1362
+ var _iterator21 = _createForOfIteratorHelper(existingGifts),
1363
+ _step21;
1224
1364
  try {
1225
- for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1365
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1226
1366
  var _getGiftInfo4, _metadata;
1227
- var _gift3 = _step18.value;
1367
+ var _gift3 = _step21.value;
1228
1368
  var _strategyId3 = (_getGiftInfo4 = getGiftInfo(_gift3)) === null || _getGiftInfo4 === void 0 ? void 0 : _getGiftInfo4.strategyId;
1229
1369
  if (!_strategyId3) continue;
1230
1370
  var _latest = strategyGiftInfoMap.get(_strategyId3);
@@ -1235,9 +1375,9 @@ export function processCartPromotion(list, evaluator, options) {
1235
1375
 
1236
1376
  // 11. 未满足促销
1237
1377
  } catch (err) {
1238
- _iterator18.e(err);
1378
+ _iterator21.e(err);
1239
1379
  } finally {
1240
- _iterator18.f();
1380
+ _iterator21.f();
1241
1381
  }
1242
1382
  var unfulfilledPromotions = calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts);
1243
1383
 
@@ -1247,6 +1387,7 @@ export function processCartPromotion(list, evaluator, options) {
1247
1387
  delete product._sortIndex;
1248
1388
  delete product._sortSubIndex;
1249
1389
  delete product._originalProductUid;
1390
+ delete product._sourceCartNum;
1250
1391
  }
1251
1392
  return {
1252
1393
  products: processedProducts,