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