增加项目,分层
This commit is contained in:
1 parent
6e995a5bdb
commit
0a3e5af6a9
234 files changed
+26994
-1
No files matched your search
@@ -0,0 +1,60 @@
|
||||
using Store.Product.Models.Product.Sku;
|
||||
using System.Linq;
|
||||
|
||||
namespace Store.Product.Models.PublishParameters.Price
|
||||
{
|
||||
/// <summary>
|
||||
/// 高低价格配置
|
||||
/// </summary>
|
||||
public class HighLowPrice : PriceConfigBase
|
||||
{
|
||||
public override PriceStrategyType PriceType => PriceStrategyType.高低价格;
|
||||
|
||||
/// <summary>
|
||||
/// 低价倍数
|
||||
/// </summary>
|
||||
public decimal LowMultiples { get; set; } = 1;
|
||||
/// <summary>
|
||||
/// 其他倍数
|
||||
/// </summary>
|
||||
public decimal OtherMultiples { get; set; } = 1;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计算价格
|
||||
/// </summary>
|
||||
/// <param name="oldPrice"></param>
|
||||
/// <returns></returns>
|
||||
public override decimal ComputedPrice(decimal oldPrice)
|
||||
{
|
||||
return oldPrice * OtherMultiples;
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算最低价
|
||||
/// </summary>
|
||||
/// <param name="oldPrice"></param>
|
||||
/// <returns></returns>
|
||||
public decimal ComputedLowPrice(decimal oldPrice)
|
||||
{
|
||||
return oldPrice * LowMultiples;
|
||||
}
|
||||
|
||||
|
||||
public override SkuMaps ComputedPrice(SkuMaps skuMaps)
|
||||
{
|
||||
decimal minPrice = skuMaps.Min(a => a.Price);
|
||||
foreach (var item in skuMaps)
|
||||
{
|
||||
if (item.Price == minPrice)
|
||||
{
|
||||
ComputedLowPrice(item.Price);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Price = ComputedPrice(item.Price);
|
||||
}
|
||||
}
|
||||
return skuMaps;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user