@pisell/pisellos 2.3.124 → 2.3.125
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.
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +2 -4
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +19 -58
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +12 -24
- package/dist/modules/Customer/index.js +3 -6
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +151 -37
- package/dist/modules/Discount/types.d.ts +5 -36
- package/dist/modules/Order/index.d.ts +13 -8
- package/dist/modules/Order/index.js +307 -432
- package/dist/modules/Order/types.d.ts +5 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +12 -16
- package/dist/modules/Order/utils.d.ts +11 -1
- package/dist/modules/Order/utils.js +127 -122
- package/dist/modules/Payment/types.d.ts +1 -21
- package/dist/modules/Payment/types.js +0 -2
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +47 -80
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +186 -480
- package/dist/modules/Rules/types.d.ts +0 -4
- package/dist/server/modules/order/types.d.ts +0 -2
- package/dist/solution/BaseSales/index.d.ts +0 -1
- package/dist/solution/BaseSales/index.js +59 -51
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +126 -141
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -1
- package/dist/solution/BookingTicket/index.js +63 -60
- package/dist/solution/BookingTicket/types.d.ts +1 -5
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +147 -338
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +6 -19
- package/dist/solution/ShopDiscount/index.d.ts +0 -2
- package/dist/solution/ShopDiscount/index.js +42 -99
- package/dist/solution/ShopDiscount/utils.d.ts +2 -4
- package/dist/solution/ShopDiscount/utils.js +23 -43
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +0 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +6 -35
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +6 -13
- package/lib/modules/Customer/index.js +1 -5
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +129 -23
- package/lib/modules/Discount/types.d.ts +5 -36
- package/lib/modules/Order/index.d.ts +13 -8
- package/lib/modules/Order/index.js +107 -215
- package/lib/modules/Order/types.d.ts +5 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +11 -14
- package/lib/modules/Order/utils.d.ts +11 -1
- package/lib/modules/Order/utils.js +45 -39
- package/lib/modules/Payment/types.d.ts +1 -21
- package/lib/modules/Payment/types.js +0 -1
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +9 -29
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +110 -357
- package/lib/modules/Rules/types.d.ts +0 -4
- package/lib/server/modules/order/types.d.ts +0 -2
- package/lib/solution/BaseSales/index.d.ts +0 -1
- package/lib/solution/BaseSales/index.js +12 -5
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +4 -12
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -1
- package/lib/solution/BookingTicket/index.js +33 -36
- package/lib/solution/BookingTicket/types.d.ts +1 -5
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -2
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +42 -174
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +4 -8
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -6
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +3 -11
- package/lib/solution/ShopDiscount/index.d.ts +0 -2
- package/lib/solution/ShopDiscount/index.js +9 -55
- package/lib/solution/ShopDiscount/utils.d.ts +2 -4
- package/lib/solution/ShopDiscount/utils.js +25 -42
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
- package/dist/modules/Discount/availability.d.ts +0 -7
- package/dist/modules/Discount/availability.js +0 -49
- package/dist/modules/Discount/entitlementPass.d.ts +0 -34
- package/dist/modules/Discount/entitlementPass.js +0 -147
- package/lib/modules/Discount/availability.d.ts +0 -7
- package/lib/modules/Discount/availability.js +0 -43
- package/lib/modules/Discount/entitlementPass.d.ts +0 -34
- package/lib/modules/Discount/entitlementPass.js +0 -141
|
@@ -20,7 +20,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
20
20
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
21
|
import Decimal from 'decimal.js';
|
|
22
22
|
import { cloneDeep } from 'lodash-es';
|
|
23
|
-
import { isFullCoveragePass } from "../../../modules/Discount/entitlementPass";
|
|
24
23
|
import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
|
|
25
24
|
import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
|
|
26
25
|
|
|
@@ -473,7 +472,7 @@ function getProductLineNoteSignature(product) {
|
|
|
473
472
|
var uid = getOrderProductUid(product);
|
|
474
473
|
return uid ? "note:".concat(uid) : "note:".concat(normalizedNote);
|
|
475
474
|
}
|
|
476
|
-
function
|
|
475
|
+
function hasGoodPassDiscount(product) {
|
|
477
476
|
var _product$_extend;
|
|
478
477
|
var productBundle = Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle) ? product.product_bundle : [];
|
|
479
478
|
var extendedBundle = Array.isArray(product === null || product === void 0 || (_product$_extend = product._extend) === null || _product$_extend === void 0 || (_product$_extend = _product$_extend.other) === null || _product$_extend === void 0 ? void 0 : _product$_extend.bundle) ? product._extend.other.bundle : [];
|
|
@@ -482,23 +481,11 @@ function getFullCoveragePassDiscountType(product) {
|
|
|
482
481
|
})), _toConsumableArray(extendedBundle.map(function (item) {
|
|
483
482
|
return item === null || item === void 0 ? void 0 : item.discount_list;
|
|
484
483
|
})));
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (!Array.isArray(discountList)) continue;
|
|
491
|
-
var pass = discountList.find(function (item) {
|
|
492
|
-
return isFullCoveragePass(item);
|
|
493
|
-
});
|
|
494
|
-
if (pass) return String(pass.type || pass.tag);
|
|
495
|
-
}
|
|
496
|
-
} catch (err) {
|
|
497
|
-
_iterator5.e(err);
|
|
498
|
-
} finally {
|
|
499
|
-
_iterator5.f();
|
|
500
|
-
}
|
|
501
|
-
return null;
|
|
484
|
+
return discountLists.some(function (discountList) {
|
|
485
|
+
return Array.isArray(discountList) && discountList.some(function (item) {
|
|
486
|
+
return (item === null || item === void 0 ? void 0 : item.type) === 'good_pass' || (item === null || item === void 0 ? void 0 : item.tag) === 'good_pass';
|
|
487
|
+
});
|
|
488
|
+
});
|
|
502
489
|
}
|
|
503
490
|
|
|
504
491
|
/**
|
|
@@ -512,10 +499,8 @@ function getPromotionLineMergeBoundary(product) {
|
|
|
512
499
|
if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
|
|
513
500
|
return "custom:".concat(getOrderProductUid(product));
|
|
514
501
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
var boundary = fullCoveragePassType === 'good_pass' ? 'good-pass' : 'entitlement-pass';
|
|
518
|
-
return "".concat(boundary, ":").concat(getOrderProductUid(product));
|
|
502
|
+
if (hasGoodPassDiscount(product)) {
|
|
503
|
+
return "good-pass:".concat(getOrderProductUid(product));
|
|
519
504
|
}
|
|
520
505
|
if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
|
|
521
506
|
return "weighing:".concat(getOrderProductUid(product));
|
|
@@ -581,13 +566,13 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
581
566
|
return _toConsumableArray(entries || []);
|
|
582
567
|
}
|
|
583
568
|
var groups = new Map();
|
|
584
|
-
var
|
|
585
|
-
|
|
569
|
+
var _iterator5 = _createForOfIteratorHelper(entries),
|
|
570
|
+
_step5;
|
|
586
571
|
try {
|
|
587
|
-
for (
|
|
588
|
-
var
|
|
589
|
-
item =
|
|
590
|
-
originalListIndex =
|
|
572
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
573
|
+
var _step5$value = _step5.value,
|
|
574
|
+
item = _step5$value.item,
|
|
575
|
+
originalListIndex = _step5$value.originalListIndex;
|
|
591
576
|
var key = buildConsolidateKeyForPromotion(item);
|
|
592
577
|
var wasInPromotion = wasInPromotionBeforeEvaluation(item);
|
|
593
578
|
var existing = groups.get(key);
|
|
@@ -597,17 +582,17 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
597
582
|
delete metadata._promotion;
|
|
598
583
|
mergedItem.metadata = metadata;
|
|
599
584
|
if (Array.isArray(mergedItem.product_bundle)) {
|
|
600
|
-
var
|
|
601
|
-
|
|
585
|
+
var _iterator6 = _createForOfIteratorHelper(mergedItem.product_bundle),
|
|
586
|
+
_step6;
|
|
602
587
|
try {
|
|
603
|
-
for (
|
|
604
|
-
var bundle =
|
|
588
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
589
|
+
var bundle = _step6.value;
|
|
605
590
|
if (bundle && _typeof(bundle) === 'object') delete bundle._promotion;
|
|
606
591
|
}
|
|
607
592
|
} catch (err) {
|
|
608
|
-
|
|
593
|
+
_iterator6.e(err);
|
|
609
594
|
} finally {
|
|
610
|
-
|
|
595
|
+
_iterator6.f();
|
|
611
596
|
}
|
|
612
597
|
}
|
|
613
598
|
if (wasInPromotion) {
|
|
@@ -625,9 +610,9 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
625
610
|
}
|
|
626
611
|
}
|
|
627
612
|
} catch (err) {
|
|
628
|
-
|
|
613
|
+
_iterator5.e(err);
|
|
629
614
|
} finally {
|
|
630
|
-
|
|
615
|
+
_iterator5.f();
|
|
631
616
|
}
|
|
632
617
|
return Array.from(groups.values());
|
|
633
618
|
}
|
|
@@ -640,12 +625,12 @@ function consolidateMainProductsForPromotion(entries) {
|
|
|
640
625
|
*/
|
|
641
626
|
function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
|
|
642
627
|
var result = [];
|
|
643
|
-
var
|
|
644
|
-
|
|
628
|
+
var _iterator7 = _createForOfIteratorHelper(lines),
|
|
629
|
+
_step7;
|
|
645
630
|
try {
|
|
646
|
-
for (
|
|
631
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
647
632
|
var _line$metadata13, _actionMeta$actionDet;
|
|
648
|
-
var line =
|
|
633
|
+
var line = _step7.value;
|
|
649
634
|
var promo = line === null || line === void 0 || (_line$metadata13 = line.metadata) === null || _line$metadata13 === void 0 ? void 0 : _line$metadata13._promotion;
|
|
650
635
|
if (!(promo !== null && promo !== void 0 && promo.inPromotion) || !promo.strategyId) {
|
|
651
636
|
result.push(line);
|
|
@@ -675,9 +660,9 @@ function splitXItemsPromoLinesByGroup(lines, strategyActionMap) {
|
|
|
675
660
|
}
|
|
676
661
|
}
|
|
677
662
|
} catch (err) {
|
|
678
|
-
|
|
663
|
+
_iterator7.e(err);
|
|
679
664
|
} finally {
|
|
680
|
-
|
|
665
|
+
_iterator7.f();
|
|
681
666
|
}
|
|
682
667
|
return result;
|
|
683
668
|
}
|
|
@@ -732,12 +717,12 @@ function calculateGiftActions(gifts, existingGifts) {
|
|
|
732
717
|
|
|
733
718
|
// 按 strategyId 分组现有赠品
|
|
734
719
|
var existingByStrategy = new Map();
|
|
735
|
-
var
|
|
736
|
-
|
|
720
|
+
var _iterator8 = _createForOfIteratorHelper(existingGifts),
|
|
721
|
+
_step8;
|
|
737
722
|
try {
|
|
738
|
-
for (
|
|
723
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
739
724
|
var _getGiftInfo, _gift$num;
|
|
740
|
-
var gift =
|
|
725
|
+
var gift = _step8.value;
|
|
741
726
|
var strategyId = (_getGiftInfo = getGiftInfo(gift)) === null || _getGiftInfo === void 0 ? void 0 : _getGiftInfo.strategyId;
|
|
742
727
|
if (!strategyId) continue;
|
|
743
728
|
var existing = existingByStrategy.get(strategyId);
|
|
@@ -753,17 +738,17 @@ function calculateGiftActions(gifts, existingGifts) {
|
|
|
753
738
|
}
|
|
754
739
|
}
|
|
755
740
|
} catch (err) {
|
|
756
|
-
|
|
741
|
+
_iterator8.e(err);
|
|
757
742
|
} finally {
|
|
758
|
-
|
|
743
|
+
_iterator8.f();
|
|
759
744
|
}
|
|
760
745
|
var processedStrategyIds = new Set();
|
|
761
|
-
var
|
|
762
|
-
|
|
746
|
+
var _iterator9 = _createForOfIteratorHelper(gifts),
|
|
747
|
+
_step9;
|
|
763
748
|
try {
|
|
764
|
-
for (
|
|
749
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
765
750
|
var _existing$totalQuanti;
|
|
766
|
-
var giftInfo =
|
|
751
|
+
var giftInfo = _step9.value;
|
|
767
752
|
var _strategyId = giftInfo.strategyId,
|
|
768
753
|
strategyName = giftInfo.strategyName,
|
|
769
754
|
giftCount = giftInfo.giftCount,
|
|
@@ -793,12 +778,12 @@ function calculateGiftActions(gifts, existingGifts) {
|
|
|
793
778
|
var reduceItems = [];
|
|
794
779
|
var removeIds = [];
|
|
795
780
|
var reversed = _toConsumableArray((_existing === null || _existing === void 0 ? void 0 : _existing.items) || []).reverse();
|
|
796
|
-
var
|
|
797
|
-
|
|
781
|
+
var _iterator11 = _createForOfIteratorHelper(reversed),
|
|
782
|
+
_step11;
|
|
798
783
|
try {
|
|
799
|
-
for (
|
|
784
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
800
785
|
var _giftItem$num;
|
|
801
|
-
var giftItem =
|
|
786
|
+
var giftItem = _step11.value;
|
|
802
787
|
if (remaining <= 0) break;
|
|
803
788
|
var uid = getOrderProductUid(giftItem);
|
|
804
789
|
var _qty = Number((_giftItem$num = giftItem === null || giftItem === void 0 ? void 0 : giftItem.num) !== null && _giftItem$num !== void 0 ? _giftItem$num : 1) || 1;
|
|
@@ -815,9 +800,9 @@ function calculateGiftActions(gifts, existingGifts) {
|
|
|
815
800
|
}
|
|
816
801
|
}
|
|
817
802
|
} catch (err) {
|
|
818
|
-
|
|
803
|
+
_iterator11.e(err);
|
|
819
804
|
} finally {
|
|
820
|
-
|
|
805
|
+
_iterator11.f();
|
|
821
806
|
}
|
|
822
807
|
if (reduceItems.length > 0) toReduce.push({
|
|
823
808
|
strategyId: _strategyId,
|
|
@@ -829,35 +814,35 @@ function calculateGiftActions(gifts, existingGifts) {
|
|
|
829
814
|
|
|
830
815
|
// 失效策略的赠品:全部 remove
|
|
831
816
|
} catch (err) {
|
|
832
|
-
|
|
817
|
+
_iterator9.e(err);
|
|
833
818
|
} finally {
|
|
834
|
-
|
|
819
|
+
_iterator9.f();
|
|
835
820
|
}
|
|
836
|
-
var
|
|
837
|
-
|
|
821
|
+
var _iterator10 = _createForOfIteratorHelper(existingByStrategy),
|
|
822
|
+
_step10;
|
|
838
823
|
try {
|
|
839
|
-
for (
|
|
840
|
-
var
|
|
841
|
-
_strategyId2 =
|
|
842
|
-
_existing2 =
|
|
824
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
825
|
+
var _step10$value = _slicedToArray(_step10.value, 2),
|
|
826
|
+
_strategyId2 = _step10$value[0],
|
|
827
|
+
_existing2 = _step10$value[1];
|
|
843
828
|
if (processedStrategyIds.has(_strategyId2)) continue;
|
|
844
|
-
var
|
|
845
|
-
|
|
829
|
+
var _iterator12 = _createForOfIteratorHelper(_existing2.items),
|
|
830
|
+
_step12;
|
|
846
831
|
try {
|
|
847
|
-
for (
|
|
848
|
-
var _giftItem =
|
|
832
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
833
|
+
var _giftItem = _step12.value;
|
|
849
834
|
toRemove.push(getOrderProductUid(_giftItem));
|
|
850
835
|
}
|
|
851
836
|
} catch (err) {
|
|
852
|
-
|
|
837
|
+
_iterator12.e(err);
|
|
853
838
|
} finally {
|
|
854
|
-
|
|
839
|
+
_iterator12.f();
|
|
855
840
|
}
|
|
856
841
|
}
|
|
857
842
|
} catch (err) {
|
|
858
|
-
|
|
843
|
+
_iterator10.e(err);
|
|
859
844
|
} finally {
|
|
860
|
-
|
|
845
|
+
_iterator10.f();
|
|
861
846
|
}
|
|
862
847
|
return {
|
|
863
848
|
toAdd: toAdd,
|
|
@@ -877,11 +862,11 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
|
|
|
877
862
|
var _strategyConfig$condi;
|
|
878
863
|
var rules = strategyConfig === null || strategyConfig === void 0 || (_strategyConfig$condi = strategyConfig.conditions) === null || _strategyConfig$condi === void 0 ? void 0 : _strategyConfig$condi.rules;
|
|
879
864
|
if (!Array.isArray(rules)) return [];
|
|
880
|
-
var
|
|
881
|
-
|
|
865
|
+
var _iterator13 = _createForOfIteratorHelper(rules),
|
|
866
|
+
_step13;
|
|
882
867
|
try {
|
|
883
|
-
for (
|
|
884
|
-
var rule =
|
|
868
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
869
|
+
var rule = _step13.value;
|
|
885
870
|
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)) {
|
|
886
871
|
return rule.value.map(function (item) {
|
|
887
872
|
return {
|
|
@@ -894,9 +879,9 @@ export function extractProductMatchIdentifiersFromStrategyConfig(strategyConfig)
|
|
|
894
879
|
}
|
|
895
880
|
}
|
|
896
881
|
} catch (err) {
|
|
897
|
-
|
|
882
|
+
_iterator13.e(err);
|
|
898
883
|
} finally {
|
|
899
|
-
|
|
884
|
+
_iterator13.f();
|
|
900
885
|
}
|
|
901
886
|
return [];
|
|
902
887
|
}
|
|
@@ -985,11 +970,11 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
|
|
|
985
970
|
if (_ret === 0) continue;
|
|
986
971
|
}
|
|
987
972
|
var result = [];
|
|
988
|
-
var
|
|
989
|
-
|
|
973
|
+
var _iterator14 = _createForOfIteratorHelper(unfulfilledMap.values()),
|
|
974
|
+
_step14;
|
|
990
975
|
try {
|
|
991
|
-
for (
|
|
992
|
-
var data =
|
|
976
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
977
|
+
var data = _step14.value;
|
|
993
978
|
var needQuantity = data.requiredQuantity - data.currentQuantity;
|
|
994
979
|
if (needQuantity > 0) {
|
|
995
980
|
result.push(_objectSpread(_objectSpread({}, data), {}, {
|
|
@@ -998,9 +983,9 @@ export function calculateUnfulfilledPromotions(processedProducts, applicableStra
|
|
|
998
983
|
}
|
|
999
984
|
}
|
|
1000
985
|
} catch (err) {
|
|
1001
|
-
|
|
986
|
+
_iterator14.e(err);
|
|
1002
987
|
} finally {
|
|
1003
|
-
|
|
988
|
+
_iterator14.f();
|
|
1004
989
|
}
|
|
1005
990
|
return result;
|
|
1006
991
|
}
|
|
@@ -1040,11 +1025,11 @@ export function appendPromotionTags(products, evaluator) {
|
|
|
1040
1025
|
var data = strategies[index];
|
|
1041
1026
|
var tags = [];
|
|
1042
1027
|
if (data !== null && data !== void 0 && data.hasApplicableStrategy) {
|
|
1043
|
-
var
|
|
1044
|
-
|
|
1028
|
+
var _iterator15 = _createForOfIteratorHelper(data.applicableStrategies),
|
|
1029
|
+
_step15;
|
|
1045
1030
|
try {
|
|
1046
|
-
for (
|
|
1047
|
-
var strategy =
|
|
1031
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
1032
|
+
var strategy = _step15.value;
|
|
1048
1033
|
if (strategy.display) {
|
|
1049
1034
|
tags.push({
|
|
1050
1035
|
text: strategy.display.text,
|
|
@@ -1054,9 +1039,9 @@ export function appendPromotionTags(products, evaluator) {
|
|
|
1054
1039
|
}
|
|
1055
1040
|
}
|
|
1056
1041
|
} catch (err) {
|
|
1057
|
-
|
|
1042
|
+
_iterator15.e(err);
|
|
1058
1043
|
} finally {
|
|
1059
|
-
|
|
1044
|
+
_iterator15.f();
|
|
1060
1045
|
}
|
|
1061
1046
|
}
|
|
1062
1047
|
// 商品卡兼容两种位置:顶层 `_promotionTags` 与 `metadata._promotionTags`
|
|
@@ -1159,18 +1144,18 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1159
1144
|
});
|
|
1160
1145
|
if (existingGifts.length > 0) {
|
|
1161
1146
|
var toRemove = [];
|
|
1162
|
-
var
|
|
1163
|
-
|
|
1147
|
+
var _iterator16 = _createForOfIteratorHelper(existingGifts),
|
|
1148
|
+
_step16;
|
|
1164
1149
|
try {
|
|
1165
|
-
for (
|
|
1166
|
-
var gift =
|
|
1150
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
1151
|
+
var gift = _step16.value;
|
|
1167
1152
|
var uid = getOrderProductUid(gift);
|
|
1168
1153
|
if (uid) toRemove.push(uid);
|
|
1169
1154
|
}
|
|
1170
1155
|
} catch (err) {
|
|
1171
|
-
|
|
1156
|
+
_iterator16.e(err);
|
|
1172
1157
|
} finally {
|
|
1173
|
-
|
|
1158
|
+
_iterator16.f();
|
|
1174
1159
|
}
|
|
1175
1160
|
return {
|
|
1176
1161
|
products: editProducts,
|
|
@@ -1224,16 +1209,16 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1224
1209
|
channel: options === null || options === void 0 ? void 0 : options.channel
|
|
1225
1210
|
});
|
|
1226
1211
|
var strategyActionMap = new Map();
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1212
|
+
var _iterator17 = _createForOfIteratorHelper(applicableStrategiesResult || []),
|
|
1213
|
+
_step17;
|
|
1229
1214
|
try {
|
|
1230
|
-
for (
|
|
1231
|
-
var row =
|
|
1232
|
-
var
|
|
1233
|
-
|
|
1215
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
1216
|
+
var row = _step17.value;
|
|
1217
|
+
var _iterator22 = _createForOfIteratorHelper((row === null || row === void 0 ? void 0 : row.applicableStrategies) || []),
|
|
1218
|
+
_step22;
|
|
1234
1219
|
try {
|
|
1235
|
-
for (
|
|
1236
|
-
var strategy =
|
|
1220
|
+
for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
|
|
1221
|
+
var strategy = _step22.value;
|
|
1237
1222
|
if (!(strategy !== null && strategy !== void 0 && strategy.strategyId)) continue;
|
|
1238
1223
|
strategyActionMap.set(strategy.strategyId, {
|
|
1239
1224
|
actionType: strategy.actionType,
|
|
@@ -1241,17 +1226,17 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1241
1226
|
});
|
|
1242
1227
|
}
|
|
1243
1228
|
} catch (err) {
|
|
1244
|
-
|
|
1229
|
+
_iterator22.e(err);
|
|
1245
1230
|
} finally {
|
|
1246
|
-
|
|
1231
|
+
_iterator22.f();
|
|
1247
1232
|
}
|
|
1248
1233
|
}
|
|
1249
1234
|
|
|
1250
1235
|
// 3. 评估器
|
|
1251
1236
|
} catch (err) {
|
|
1252
|
-
|
|
1237
|
+
_iterator17.e(err);
|
|
1253
1238
|
} finally {
|
|
1254
|
-
|
|
1239
|
+
_iterator17.f();
|
|
1255
1240
|
}
|
|
1256
1241
|
var result = evaluator.evaluateCartWithPricing({
|
|
1257
1242
|
products: promotionProducts,
|
|
@@ -1260,11 +1245,11 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1260
1245
|
|
|
1261
1246
|
// 4. 收集每个策略的 sourceProductIds(参与策略的主商品 uid)
|
|
1262
1247
|
var strategySourceProductIds = new Map();
|
|
1263
|
-
var
|
|
1264
|
-
|
|
1248
|
+
var _iterator18 = _createForOfIteratorHelper(result.products),
|
|
1249
|
+
_step18;
|
|
1265
1250
|
try {
|
|
1266
|
-
for (
|
|
1267
|
-
var priced =
|
|
1251
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
1252
|
+
var priced = _step18.value;
|
|
1268
1253
|
if (priced.inPromotion && priced.strategyId) {
|
|
1269
1254
|
var _priced$originalId;
|
|
1270
1255
|
var sourceId = (_priced$originalId = priced.originalId) !== null && _priced$originalId !== void 0 ? _priced$originalId : priced.id;
|
|
@@ -1281,9 +1266,9 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1281
1266
|
|
|
1282
1267
|
// 5. 扩展 gifts,加 sourceProductIds
|
|
1283
1268
|
} catch (err) {
|
|
1284
|
-
|
|
1269
|
+
_iterator18.e(err);
|
|
1285
1270
|
} finally {
|
|
1286
|
-
|
|
1271
|
+
_iterator18.f();
|
|
1287
1272
|
}
|
|
1288
1273
|
var extendedGifts = result.gifts.map(function (gift) {
|
|
1289
1274
|
return _objectSpread(_objectSpread({}, gift), {}, {
|
|
@@ -1293,26 +1278,26 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1293
1278
|
|
|
1294
1279
|
// 6. PricedProduct → OrderProduct(含拆分与价格调整)
|
|
1295
1280
|
var strategyGiftInfoMap = new Map();
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1281
|
+
var _iterator19 = _createForOfIteratorHelper(extendedGifts),
|
|
1282
|
+
_step19;
|
|
1298
1283
|
try {
|
|
1299
|
-
for (
|
|
1300
|
-
var _gift =
|
|
1284
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
1285
|
+
var _gift = _step19.value;
|
|
1301
1286
|
strategyGiftInfoMap.set(_gift.strategyId, _gift);
|
|
1302
1287
|
}
|
|
1303
1288
|
} catch (err) {
|
|
1304
|
-
|
|
1289
|
+
_iterator19.e(err);
|
|
1305
1290
|
} finally {
|
|
1306
|
-
|
|
1291
|
+
_iterator19.f();
|
|
1307
1292
|
}
|
|
1308
1293
|
var strategyGiftInfoOwner = new Map();
|
|
1309
1294
|
var processedProducts = [];
|
|
1310
|
-
var
|
|
1311
|
-
|
|
1295
|
+
var _iterator20 = _createForOfIteratorHelper(result.products),
|
|
1296
|
+
_step20;
|
|
1312
1297
|
try {
|
|
1313
|
-
for (
|
|
1298
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
1314
1299
|
var _priced$originalId2, _priced$product_id, _originalItem$product;
|
|
1315
|
-
var _priced =
|
|
1300
|
+
var _priced = _step20.value;
|
|
1316
1301
|
var rawSourceId = (_priced$originalId2 = _priced.originalId) !== null && _priced$originalId2 !== void 0 ? _priced$originalId2 : _priced.id;
|
|
1317
1302
|
var _sourceId = Number(rawSourceId);
|
|
1318
1303
|
var _originalData = Number.isFinite(_sourceId) ? originalItemMap.get(_sourceId) : undefined;
|
|
@@ -1333,17 +1318,17 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1333
1318
|
var wasInPromotion = wasInPromotionBeforeEvaluation(originalItem) || originalItem._wasInPromotionBeforeConsolidate === true;
|
|
1334
1319
|
delete metadata._promotion;
|
|
1335
1320
|
if (Array.isArray(newItem.product_bundle)) {
|
|
1336
|
-
var
|
|
1337
|
-
|
|
1321
|
+
var _iterator23 = _createForOfIteratorHelper(newItem.product_bundle),
|
|
1322
|
+
_step23;
|
|
1338
1323
|
try {
|
|
1339
|
-
for (
|
|
1340
|
-
var b =
|
|
1324
|
+
for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {
|
|
1325
|
+
var b = _step23.value;
|
|
1341
1326
|
if (b && _typeof(b) === 'object') delete b._promotion;
|
|
1342
1327
|
}
|
|
1343
1328
|
} catch (err) {
|
|
1344
|
-
|
|
1329
|
+
_iterator23.e(err);
|
|
1345
1330
|
} finally {
|
|
1346
|
-
|
|
1331
|
+
_iterator23.f();
|
|
1347
1332
|
}
|
|
1348
1333
|
}
|
|
1349
1334
|
var originalBasePrice = getOrderProductOriginalPriceForPromotion(originalItem);
|
|
@@ -1429,9 +1414,9 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1429
1414
|
|
|
1430
1415
|
// 7. 赠品/编辑商品原样拼回;同时同步赠品的 sourceProductIds / sourceProductId
|
|
1431
1416
|
} catch (err) {
|
|
1432
|
-
|
|
1417
|
+
_iterator20.e(err);
|
|
1433
1418
|
} finally {
|
|
1434
|
-
|
|
1419
|
+
_iterator20.f();
|
|
1435
1420
|
}
|
|
1436
1421
|
for (var _i2 = 0, _existingGiftsWithInd = existingGiftsWithIndex; _i2 < _existingGiftsWithInd.length; _i2++) {
|
|
1437
1422
|
var _getGiftInfo3;
|
|
@@ -1515,12 +1500,12 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1515
1500
|
var giftActions = calculateGiftActions(extendedGifts, existingGifts);
|
|
1516
1501
|
|
|
1517
1502
|
// 10.1 更新 lastEvaluatedGiftCount,便于下次评估时判别「策略已变」
|
|
1518
|
-
var
|
|
1519
|
-
|
|
1503
|
+
var _iterator21 = _createForOfIteratorHelper(existingGifts),
|
|
1504
|
+
_step21;
|
|
1520
1505
|
try {
|
|
1521
|
-
for (
|
|
1506
|
+
for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
|
|
1522
1507
|
var _getGiftInfo4, _metadata;
|
|
1523
|
-
var _gift3 =
|
|
1508
|
+
var _gift3 = _step21.value;
|
|
1524
1509
|
var _strategyId3 = (_getGiftInfo4 = getGiftInfo(_gift3)) === null || _getGiftInfo4 === void 0 ? void 0 : _getGiftInfo4.strategyId;
|
|
1525
1510
|
if (!_strategyId3) continue;
|
|
1526
1511
|
var _latest = strategyGiftInfoMap.get(_strategyId3);
|
|
@@ -1531,9 +1516,9 @@ export function processCartPromotion(list, evaluator, options) {
|
|
|
1531
1516
|
|
|
1532
1517
|
// 11. 未满足促销
|
|
1533
1518
|
} catch (err) {
|
|
1534
|
-
|
|
1519
|
+
_iterator21.e(err);
|
|
1535
1520
|
} finally {
|
|
1536
|
-
|
|
1521
|
+
_iterator21.f();
|
|
1537
1522
|
}
|
|
1538
1523
|
var unfulfilledPromotions = calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts);
|
|
1539
1524
|
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -32,7 +32,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
32
32
|
private orderCustomerDiscountRefreshCustomerId;
|
|
33
33
|
private orderCustomerDiscountRefreshTarget;
|
|
34
34
|
private orderCustomerPromotionRefreshInFlight;
|
|
35
|
-
private readonly customerResolveRequests;
|
|
36
35
|
protected loadOpenDataInFlight: Promise<OpenDataConfig> | null;
|
|
37
36
|
protected loadOpenDataInFlightTarget: string | null;
|
|
38
37
|
protected openDataTarget: string | null;
|
|
@@ -81,8 +80,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
81
80
|
resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
|
|
82
81
|
/** 兼容既有优惠码扫码逻辑。 */
|
|
83
82
|
private resolveCustomerByDiscountCustomerId;
|
|
83
|
+
private findCustomerById;
|
|
84
84
|
private normalizeCustomer;
|
|
85
85
|
private getRawCustomerId;
|
|
86
|
+
private hasUsableCustomerDetails;
|
|
86
87
|
/**
|
|
87
88
|
* 更新当前预约的 appointment_status。
|
|
88
89
|
*
|