Commit 9bd55b11 authored by 吴春's avatar 吴春

提交代码

parent b3beabf2
...@@ -349,5 +349,15 @@ namespace Mall.Model.Query ...@@ -349,5 +349,15 @@ namespace Mall.Model.Query
/// </summary> /// </summary>
public int OrderClassify { get; set; } public int OrderClassify { get; set; }
/// <summary>
/// 订单来源(平台) 枚举
/// </summary>
public Common.Enum.User.UserSourceEnum? OrderSource
{
get;
set;
}
} }
} }
...@@ -1410,7 +1410,7 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -1410,7 +1410,7 @@ GROUP BY od.GoodsId,o.OrderId
//GROUP BY b.Id order by b.Id desc"; //GROUP BY b.Id order by b.Id desc";
string sql = $@" SELECT a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, string sql = $@" SELECT a.OrderSource,a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice ,
(IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight, (IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
...@@ -1473,7 +1473,7 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1473,7 +1473,7 @@ GROUP BY b.Id order by b.Id asc";
} }
} }
string sql = $@" SELECT a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, string sql = $@" SELECT a.OrderSource,a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice ,
(IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight, (IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
...@@ -1541,7 +1541,7 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1541,7 +1541,7 @@ GROUP BY b.Id order by b.Id asc";
where += $" and DATE_FORMAT(a.CancelTime,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) "; where += $" and DATE_FORMAT(a.CancelTime,'%Y-%m-%d' )<= DATE_FORMAT('{dmodel.EndDate}','%Y-%m-%d' ) ";
} }
} }
string sql = $@" SELECT a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, string sql = $@" SELECT a.OrderSource,a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice ,
(IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight, (IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
...@@ -1610,7 +1610,7 @@ GROUP BY b.Id order by b.Id asc"; ...@@ -1610,7 +1610,7 @@ GROUP BY b.Id order by b.Id asc";
} }
} }
string sql = $@" SELECT a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName, string sql = $@" SELECT a.OrderSource,a.OrderStatus,sum(b.InsuranceCostMoney) as InsuranceCostMoney,sum(b.InsuranceMoney) as InsuranceMoney,b.CarType,a.OrderClassify,B.Id,b.ServiceCharge,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice , SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney+IFNULL(b.InsuranceMoney,0)) as AllPrice ,
(IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight, (IFNULL(b.CostMoney,0)) as CostMoney,0 as PackingMoney, 0 as CostFreight,sum(b.FreightCostMoney) as GoodsFreight,
0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney 0 as OtherPrice,b.LiveCommission,b.LiveFinanceIds,b.LivePeopleNum,0 as Paid,oa.RefundActual,b.CouponMoney,b.CompanyProfitRate,b.CompanyId,muser.`Name` as CompanyName,b.YSMoney,b.RealMoney,b.YFMoney,b.PayMoney
......
...@@ -140,31 +140,59 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -140,31 +140,59 @@ namespace Mall.WebApi.Controllers.AppletWeChat
demodel.TenantId = requestParm.TenantId; demodel.TenantId = requestParm.TenantId;
demodel.MallBaseId = requestParm.MallBaseId; demodel.MallBaseId = requestParm.MallBaseId;
List<OrderStatistics_Query> list = new List<OrderStatistics_Query>(); List<OrderStatistics_Query> list = new List<OrderStatistics_Query>();
List<OrderStatistics_Query> listCancel = new List<OrderStatistics_Query>();
List<OrderStatistics_Query> listAftersale = new List<OrderStatistics_Query>();
long count = 0; long count = 0;
if (demodel.IsFxCommission == 0) if (demodel.IsFxCommission == 0)
{ {
list = statisticsModule.GetOrderProfitLossList(pagelist.pageIndex, pagelist.pageSize, out count, demodel); list = statisticsModule.GetOrderProfitLossList(pagelist.pageIndex, pagelist.pageSize, out count, demodel);
} }
else else
{ {
list = statisticsModule.GetFXOrderProfitLossList(pagelist.pageIndex, pagelist.pageSize, out count, demodel); list = statisticsModule.GetFXOrderProfitLossList(pagelist.pageIndex, pagelist.pageSize, out count, demodel);
if (list != null && list.Any())
{
string ids = string.Join(",", list.Select(x => x.Id));
demodel.Ids = ids;
listCancel = statisticsModule.GetFXAllCancelOrderProfitLossList(demodel);
listAftersale = statisticsModule.GetFXAllAftersaleOrderProfitLossList(demodel);
}
} }
foreach (var item in list) foreach (var item in list)
{ {
if (item.OrderStatus == 7) if (item.OrderStatus == 7)
{ {
item.FXCommission = 0; item.FXCommission = 0;
item.LiveCommission = 0; item.LiveCommission = 0;
item.RemitFXCommission = 0; item.RemitFXCommission = 0;
item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice; item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice;
// item.ServiceCharge = item.ServiceCharge * (-1);
} }
if (item.RefundActual > 0)
if (item.OrderSource == Common.Enum.User.UserSourceEnum.ERP)
{
item.ReturnServiceCharge = 0;
item.ServiceCharge = 0;
}
else
{ {
//decimal totalPrice = goodsDetailList.Where(x => x.OrderId == goodsDetailGroupItem.Key).Sum(x => (x.FreightMoney ?? 0) + (x.Final_Price ?? 0) + (x.InsuranceMoney ?? 0)) * (Convert.ToDecimal(Config.SettlementRate) / 100); if (item.RefundActual > 0 && (item.OrderSource.HasValue && item.OrderSource != Common.Enum.User.UserSourceEnum.ERP))
item.ServiceCharge = (item.AllPrice - item.RefundActual) * (Convert.ToDecimal(Config.SettlementRate) / 100) * (-1); {
if (listCancel != null && listCancel.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = item.ServiceCharge;
}
else if (listAftersale != null && listAftersale.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = Math.Round((item.RefundActual * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero);
}
}
} }
item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number)); item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number));
item.ALLCommission = item.CostMoney + item.GoodsFreight + item.InsuranceCostMoney + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney; item.ALLCommission = item.CostMoney + item.GoodsFreight + item.InsuranceCostMoney + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney;
item.NoPaid = item.ALLCommission; item.NoPaid = item.ALLCommission;
...@@ -386,17 +414,26 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -386,17 +414,26 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.RemitFXCommission = 0; item.RemitFXCommission = 0;
item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice; item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice;
} }
if (item.RefundActual > 0)//判断当前的订单是否存在在售后获取取消中 if (item.OrderSource == Common.Enum.User.UserSourceEnum.ERP)
{ {
if (listCancel != null && listCancel.Any(x => x.Id == item.Id))//存在取消中 item.ReturnServiceCharge = 0;
{ item.ServiceCharge = 0;
item.ReturnServiceCharge = item.ServiceCharge; }
} else
else if (listAftersale != null && listAftersale.Any(x => x.Id == item.Id))//存在取消中 {
if (item.RefundActual > 0 && (item.OrderSource.HasValue && item.OrderSource != Common.Enum.User.UserSourceEnum.ERP))//判断当前的订单是否存在在售后获取取消中
{ {
item.ReturnServiceCharge = Math.Round((item.RefundActual * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero); if (listCancel != null && listCancel.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = item.ServiceCharge;
}
else if (listAftersale != null && listAftersale.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = Math.Round((item.RefundActual * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero);
}
} }
} }
item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number)); item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number));
item.ALLCommission = item.CostMoney + item.GoodsFreight + item.InsuranceCostMoney + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney; item.ALLCommission = item.CostMoney + item.GoodsFreight + item.InsuranceCostMoney + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney;
// item.ALLCommission = item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney; // item.ALLCommission = item.CostMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.RefundActual + item.YFMoney;
...@@ -437,7 +474,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -437,7 +474,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: item.AllPrice.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.AllPrice.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.YSMoney.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.YSMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (item.AllPrice + item.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: (item.AllPrice + item.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (item.ServiceCharge-item.ReturnServiceCharge).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: (item.ServiceCharge - item.ReturnServiceCharge).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.CostMoney.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.CostMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GoodsFreight.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.GoodsFreight.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.InsuranceCostMoney.ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.InsuranceCostMoney.ToString("#0.00")) { });
...@@ -487,11 +524,11 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -487,11 +524,11 @@ namespace Mall.WebApi.Controllers.AppletWeChat
if (listCancel != null && listCancel.Any()) if (listCancel != null && listCancel.Any())
{ {
totalReturn += listCancel.Sum(x => x.AllPrice); totalReturn += listCancel.Where(x => x.OrderSource != Common.Enum.User.UserSourceEnum.ERP).Sum(x => x.AllPrice);
} }
if (listAftersale != null && listAftersale.Any()) if (listAftersale != null && listAftersale.Any())
{ {
totalReturn += listAftersale.Sum(x => x.RefundActual); totalReturn += listAftersale.Where(x => x.OrderSource != Common.Enum.User.UserSourceEnum.ERP).Sum(x => x.RefundActual);
} }
if (totalReturn > 0) if (totalReturn > 0)
{ {
...@@ -515,7 +552,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -515,7 +552,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice + x.YSMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice + x.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (list.Sum(x => x.ServiceCharge)-totalReturn).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: (list.Sum(x => x.ServiceCharge) - totalReturn).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GoodsFreight).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GoodsFreight).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.InsuranceCostMoney).ToString("#0.00")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.InsuranceCostMoney).ToString("#0.00")) { });
...@@ -622,15 +659,25 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -622,15 +659,25 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.RemitFXCommission = 0; item.RemitFXCommission = 0;
item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice; item.RefundActual = item.RefundActual > 0 ? item.RefundActual : item.AllPrice;
} }
if (item.RefundActual > 0)//判断当前的订单是否存在在售后获取取消中
if (item.OrderSource == Common.Enum.User.UserSourceEnum.ERP)
{ {
if (listCancel != null && listCancel.Any(x => x.Id == item.Id))//存在取消中 item.ReturnServiceCharge = 0;
{ item.ServiceCharge = 0;
item.ReturnServiceCharge = item.ServiceCharge; }
} else
else if (listAftersale != null && listAftersale.Any(x => x.Id == item.Id))//存在取消中 {
if (item.RefundActual > 0 && (item.OrderSource.HasValue && item.OrderSource != Common.Enum.User.UserSourceEnum.ERP))//判断当前的订单是否存在在售后获取取消中
{ {
item.ReturnServiceCharge = Math.Round((item.RefundActual * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero); if (listCancel != null && listCancel.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = item.ServiceCharge;
}
else if (listAftersale != null && listAftersale.Any(x => x.Id == item.Id))//存在取消中
{
item.ReturnServiceCharge = Math.Round((item.RefundActual * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero);
}
} }
} }
item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number)); item.CostMoney = ((item.OrderClassify == 1 && item.CarType != 5) ? item.CostMoney : (item.CostMoney * item.Number));
...@@ -661,15 +708,15 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -661,15 +708,15 @@ namespace Mall.WebApi.Controllers.AppletWeChat
if (listCancel != null && listCancel.Any()) if (listCancel != null && listCancel.Any())
{ {
totalReturn += listCancel.Sum(x => x.AllPrice); totalReturn += listCancel.Where(x => x.OrderSource != Common.Enum.User.UserSourceEnum.ERP).Sum(x => x.AllPrice);
} }
if (listAftersale != null && listAftersale.Any()) if (listAftersale != null && listAftersale.Any())
{ {
totalReturn += listAftersale.Sum(x => x.RefundActual); totalReturn += listAftersale.Where(x => x.OrderSource != Common.Enum.User.UserSourceEnum.ERP).Sum(x => x.RefundActual);
} }
if (totalReturn > 0) if (totalReturn > 0)
{ {
totalReturn= Math.Round((totalReturn * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero); totalReturn = Math.Round((totalReturn * (Convert.ToDecimal(Config.SettlementRate) / 100)), 2, MidpointRounding.AwayFromZero);
} }
var retult = new var retult = new
......
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