@pisell/pisellos 2.2.73 → 2.2.74
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/evaluator.js +8 -2
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/evaluator.js +9 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -719,7 +719,8 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
719
719
|
unitProducts.push({
|
|
720
720
|
product: product,
|
|
721
721
|
price: product.price,
|
|
722
|
-
productId: product.id
|
|
722
|
+
productId: product.id,
|
|
723
|
+
sourceAvailableQty: availableQty
|
|
723
724
|
});
|
|
724
725
|
}
|
|
725
726
|
}
|
|
@@ -736,8 +737,13 @@ export var PromotionEvaluator = /*#__PURE__*/function () {
|
|
|
736
737
|
};
|
|
737
738
|
}
|
|
738
739
|
|
|
739
|
-
// 2.
|
|
740
|
+
// 2. 排序:优先选择来源数量是 x 倍数的商品(可完整凑组不拆分),然后按价格从高到低
|
|
740
741
|
unitProducts.sort(function (a, b) {
|
|
742
|
+
// 优先级1:来源购物车项数量是 x 的倍数的排前面(这些商品可以完整凑组,避免拆分)
|
|
743
|
+
var aIsMultiple = a.sourceAvailableQty > 0 && a.sourceAvailableQty % x === 0 ? 1 : 0;
|
|
744
|
+
var bIsMultiple = b.sourceAvailableQty > 0 && b.sourceAvailableQty % x === 0 ? 1 : 0;
|
|
745
|
+
if (aIsMultiple !== bIsMultiple) return bIsMultiple - aIsMultiple;
|
|
746
|
+
// 优先级2:按价格从高到低(优先使用高价商品)
|
|
741
747
|
return b.price - a.price;
|
|
742
748
|
});
|
|
743
749
|
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|
|
@@ -512,14 +512,21 @@ var PromotionEvaluator = class {
|
|
|
512
512
|
unitProducts.push({
|
|
513
513
|
product,
|
|
514
514
|
price: product.price,
|
|
515
|
-
productId: product.id
|
|
515
|
+
productId: product.id,
|
|
516
|
+
sourceAvailableQty: availableQty
|
|
516
517
|
});
|
|
517
518
|
}
|
|
518
519
|
}
|
|
519
520
|
if (unitProducts.length === 0) {
|
|
520
521
|
return { products: [], originalAmount: 0, finalAmount: 0 };
|
|
521
522
|
}
|
|
522
|
-
unitProducts.sort((a, b) =>
|
|
523
|
+
unitProducts.sort((a, b) => {
|
|
524
|
+
const aIsMultiple = a.sourceAvailableQty > 0 && a.sourceAvailableQty % x === 0 ? 1 : 0;
|
|
525
|
+
const bIsMultiple = b.sourceAvailableQty > 0 && b.sourceAvailableQty % x === 0 ? 1 : 0;
|
|
526
|
+
if (aIsMultiple !== bIsMultiple)
|
|
527
|
+
return bIsMultiple - aIsMultiple;
|
|
528
|
+
return b.price - a.price;
|
|
529
|
+
});
|
|
523
530
|
const totalUnits = unitProducts.length;
|
|
524
531
|
const groupCount = cumulative ? Math.floor(totalUnits / x) : totalUnits >= x ? 1 : 0;
|
|
525
532
|
const promotionUnits = groupCount * x;
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "normal" | "duration" | "session";
|
|
53
53
|
}
|
|
@@ -123,7 +123,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
123
123
|
* 获取当前的客户搜索条件
|
|
124
124
|
* @returns 当前搜索条件
|
|
125
125
|
*/
|
|
126
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
126
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
127
127
|
/**
|
|
128
128
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
129
129
|
* @returns 客户状态
|