Commit 0d6821c2 authored by liudong1993's avatar liudong1993

下单手续费

parent 2dbe9cf8
......@@ -3541,6 +3541,29 @@ namespace Mall.Module.Product
}
demodel.PreferPrice = TotalMoney + CouponsMoney;
#region 手续费计算
decimal ServiceCharge = Convert.ToDecimal(Config.SettlementRate) / 100;
if (ServiceCharge > 0)
{
decimal TotalFee = Math.Round((demodel.Income ?? 0) * ServiceCharge, 2, MidpointRounding.AwayFromZero);
if (demodel.DetailList.Any())
{
int dcount = demodel.DetailList.Count();
decimal avgFee = Math.Round(TotalFee / dcount, 2, MidpointRounding.AwayFromZero);
foreach (var item in demodel.DetailList)
{
item.ServiceCharge = avgFee;
}
if (avgFee * dcount != TotalFee)
{
//多余的 直接算在第一个商品里
var detailmodel = demodel.DetailList.FirstOrDefault();
detailmodel.ServiceCharge += (TotalFee - avgFee * dcount);
}
}
}
#endregion
var trans = goods_OrderRepository.DbTransaction;
try
{
......@@ -5113,7 +5136,8 @@ namespace Mall.Module.Product
RealMoney = 0,
YSMoney = 0,
CompanyId = demodel.CompanyId,
CompanyProfitRate = demodel.CompanyProfitRate
CompanyProfitRate = demodel.CompanyProfitRate,
ServiceCharge = item.ServiceCharge
}, trans);
item.Id = detailId;
if (detailId > 0 && SatisfiedGoodsList.Any())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment