Commit a1d1750a authored by liudong1993's avatar liudong1993

订单增加 同行返佣

parent fd68c329
...@@ -225,6 +225,16 @@ namespace Edu.Model.Entity.Course ...@@ -225,6 +225,16 @@ namespace Edu.Model.Entity.Course
/// </summary> /// </summary>
public decimal CommissionRate { get; set; } public decimal CommissionRate { get; set; }
/// <summary>
/// 销售返佣类型 0百分比 1固定值 (同行)
/// </summary>
public decimal CommissionTypeTH { get; set; }
/// <summary>
/// 提成比例/固定值 (同行)
/// </summary>
public decimal CommissionRateTH { get; set; }
/// <summary> /// <summary>
/// 提成补交 /// 提成补交
/// </summary> /// </summary>
......
...@@ -424,9 +424,11 @@ namespace Edu.Module.Course ...@@ -424,9 +424,11 @@ namespace Edu.Module.Course
} }
orderModel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0; orderModel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0;
orderModel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0; orderModel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0;
orderModel.CommissionTypeTH = coursePreferentialModel?.B2BCommissionType ?? 0;
orderModel.CommissionRateTH = coursePreferentialModel?.B2BCommissionMoney ?? 0;
if (coursePreferentialModel != null) if (coursePreferentialModel != null)
{ {
orderModel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + orderModel.CommissionType + " 返佣比例/金额:" + orderModel.CommissionRate; orderModel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + orderModel.CommissionType + " 返佣比例/金额:" + orderModel.CommissionRate + " 同行返佣类型:" + orderModel.CommissionTypeTH + " 同行返佣比例/金额:" + orderModel.CommissionRateTH;
} }
#endregion #endregion
} }
......
...@@ -368,9 +368,11 @@ namespace Edu.Module.Course ...@@ -368,9 +368,11 @@ namespace Edu.Module.Course
} }
demodel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0; demodel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0;
demodel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0; demodel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0;
demodel.CommissionTypeTH = coursePreferentialModel?.B2BCommissionType ?? 0;
demodel.CommissionRateTH = coursePreferentialModel?.B2BCommissionMoney ?? 0;
if (coursePreferentialModel != null) if (coursePreferentialModel != null)
{ {
demodel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + demodel.CommissionType + " 返佣比例/金额:" + demodel.CommissionRate; demodel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + demodel.CommissionType + " 返佣比例/金额:" + demodel.CommissionRate + " 同行返佣类型:" + demodel.CommissionTypeTH + " 同行返佣比例/金额:" + demodel.CommissionRateTH;
} }
#endregion #endregion
} }
...@@ -703,13 +705,17 @@ namespace Edu.Module.Course ...@@ -703,13 +705,17 @@ namespace Edu.Module.Course
#region 记录提成信息 #region 记录提成信息
item.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0; item.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0;
item.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0; item.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0;
item.CommissionTypeTH = coursePreferentialModel?.B2BCommissionType ?? 0;
item.CommissionRateTH = coursePreferentialModel?.B2BCommissionMoney ?? 0;
if (coursePreferentialModel != null) if (coursePreferentialModel != null)
{ {
item.CommissionRemark = "初始化使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + item.CommissionType + " 返佣比例/金额:" + item.CommissionRate; item.CommissionRemark = "初始化使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + item.CommissionType + " 返佣比例/金额:" + item.CommissionRate + " 同行返佣类型:" + item.CommissionTypeTH + " 同行返佣比例/金额:" + item.CommissionRateTH;
} }
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Order_ViewModel.CommissionType),item.CommissionType}, { nameof(RB_Order_ViewModel.CommissionType),item.CommissionType},
{ nameof(RB_Order_ViewModel.CommissionRate),item.CommissionRate}, { nameof(RB_Order_ViewModel.CommissionRate),item.CommissionRate},
{ nameof(RB_Order_ViewModel.CommissionTypeTH),item.CommissionTypeTH},
{ nameof(RB_Order_ViewModel.CommissionRateTH),item.CommissionRateTH},
{ nameof(RB_Order_ViewModel.CommissionRemark),item.CommissionRemark}, { nameof(RB_Order_ViewModel.CommissionRemark),item.CommissionRemark},
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
......
...@@ -399,13 +399,34 @@ namespace Edu.Module.Course ...@@ -399,13 +399,34 @@ namespace Edu.Module.Course
#region 订单应发提成 (不包括 额外提成) #region 订单应发提成 (不包括 额外提成)
decimal YFCommission = 0; decimal YFCommission = 0;
if (item.CommissionType == 1) if (item.CommissionType == item.CommissionTypeTH)
{ {
YFCommission = item.CommissionRate;// 固定金额 暂时只做人民币; if (item.CommissionType == 1)
{
YFCommission = item.CommissionRate + item.CommissionRateTH;// 固定金额 暂时只做人民币;
}
else
{
YFCommission = Math.Round((item.PreferPrice - item.DiscountMoney + item.LessPrice) * (item.CommissionRate + item.CommissionRateTH) / 100, 2, MidpointRounding.AwayFromZero);
}
} }
else else {
{ if (item.CommissionType == 1)
YFCommission = Math.Round((item.PreferPrice - item.DiscountMoney + item.LessPrice) * item.CommissionRate / 100, 2, MidpointRounding.AwayFromZero); {
YFCommission = item.CommissionRate;// 固定金额 暂时只做人民币;
}
else
{
YFCommission = Math.Round((item.PreferPrice - item.DiscountMoney + item.LessPrice) * item.CommissionRate / 100, 2, MidpointRounding.AwayFromZero);
}
if (item.CommissionTypeTH == 1)
{
YFCommission += item.CommissionRateTH;// 固定金额 暂时只做人民币;
}
else
{
YFCommission += Math.Round((item.PreferPrice - item.DiscountMoney + item.LessPrice) * item.CommissionRateTH / 100, 2, MidpointRounding.AwayFromZero);
}
} }
if (item.LessPrice > 0) if (item.LessPrice > 0)
{ {
......
...@@ -1026,9 +1026,11 @@ namespace Edu.Module.Course ...@@ -1026,9 +1026,11 @@ namespace Edu.Module.Course
} }
orderModel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0; orderModel.CommissionType = coursePreferentialModel?.SaleCommissionType ?? 0;
orderModel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0; orderModel.CommissionRate = coursePreferentialModel?.SaleCommissionMoney ?? 0;
orderModel.CommissionTypeTH = coursePreferentialModel?.B2BCommissionType ?? 0;
orderModel.CommissionRateTH = coursePreferentialModel?.B2BCommissionMoney ?? 0;
if (coursePreferentialModel != null) if (coursePreferentialModel != null)
{ {
orderModel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + orderModel.CommissionType + " 返佣比例/金额:" + orderModel.CommissionRate; orderModel.CommissionRemark = "使用优惠Id:" + coursePreferentialModel.Id + " 返佣类型:" + orderModel.CommissionType + " 返佣比例/金额:" + orderModel.CommissionRate + " 同行返佣类型:" + orderModel.CommissionTypeTH + " 同行返佣比例/金额:" + orderModel.CommissionRateTH;
} }
#endregion #endregion
} }
......
...@@ -203,7 +203,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -203,7 +203,7 @@ namespace Edu.WebApi.Controllers.Course
OrderSourceName = x.OrderSource.ToName(), OrderSourceName = x.OrderSource.ToName(),
x.EnterID, x.EnterID,
EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "", EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "",
YFCommissionMoney = x.CommissionType == 1 ? x.CommissionRate : Math.Round((x.PreferPrice - x.DiscountMoney) * x.CommissionRate / 100, 2, MidpointRounding.AwayFromZero), YFCommissionMoney = GetOrderYFCommission(x),
x.CommissionMoney, x.CommissionMoney,
x.ExtraCommissionMoney, x.ExtraCommissionMoney,
x.ExtraRewardMoney, x.ExtraRewardMoney,
...@@ -222,7 +222,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -222,7 +222,7 @@ namespace Edu.WebApi.Controllers.Course
x.EduOccupation, x.EduOccupation,
x.IsLessPrice, x.IsLessPrice,
x.LessPrice, x.LessPrice,
OpenTime=Common.ConvertHelper.FormatDate(x.OpenTime), OpenTime = Common.ConvertHelper.FormatDate(x.OpenTime),
x.EffectStatus, x.EffectStatus,
x.EffectStatusStr, x.EffectStatusStr,
EffectTime = Common.ConvertHelper.FormatDate(x.EffectTime), EffectTime = Common.ConvertHelper.FormatDate(x.EffectTime),
...@@ -289,7 +289,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -289,7 +289,7 @@ namespace Edu.WebApi.Controllers.Course
OrderStateName = x.OrderState.ToName(), OrderStateName = x.OrderState.ToName(),
x.EnterID, x.EnterID,
EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "", EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "",
YFCommissionMoney = x.CommissionType == 1 ? x.CommissionRate : Math.Round((x.PreferPrice - x.DiscountMoney) * x.CommissionRate / 100, 2, MidpointRounding.AwayFromZero), YFCommissionMoney = GetOrderYFCommission(x),
x.CommissionMoney, x.CommissionMoney,
x.ExtraCommissionMoney, x.ExtraCommissionMoney,
x.ExtraRewardMoney, x.ExtraRewardMoney,
...@@ -354,6 +354,31 @@ namespace Edu.WebApi.Controllers.Course ...@@ -354,6 +354,31 @@ namespace Edu.WebApi.Controllers.Course
}); });
} }
/// <summary>
/// 获取订单应发提成
/// </summary>
/// <param name="x"></param>
/// <returns></returns>
private static decimal GetOrderYFCommission(RB_Order_ViewModel x)
{
if (x.CommissionType == x.CommissionTypeTH)
{
if (x.CommissionType == 1)
{
return x.CommissionRate + x.CommissionRateTH - x.LessPrice;
}
else {
return Math.Round((x.PreferPrice - x.DiscountMoney + x.LessPrice) * (x.CommissionRate + x.CommissionRateTH) / 100, 2, MidpointRounding.AwayFromZero) - x.LessPrice;
}
}
else
{
decimal commission1 = x.CommissionType == 1 ? x.CommissionRate : Math.Round((x.PreferPrice - x.DiscountMoney + x.LessPrice) * x.CommissionRate / 100, 2, MidpointRounding.AwayFromZero);
decimal commission2 = x.CommissionTypeTH == 1 ? x.CommissionRateTH : Math.Round((x.PreferPrice - x.DiscountMoney + x.LessPrice) * x.CommissionRateTH / 100, 2, MidpointRounding.AwayFromZero);
return commission1 + commission2 - x.LessPrice;
}
}
/// <summary> /// <summary>
/// 获取班级订单下拉列表 /// 获取班级订单下拉列表
/// </summary> /// </summary>
...@@ -1165,7 +1190,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1165,7 +1190,7 @@ namespace Edu.WebApi.Controllers.Course
OrderSourceName = x.OrderSource.ToName(), OrderSourceName = x.OrderSource.ToName(),
x.EnterID, x.EnterID,
EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "", EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "",
YFCommissionMoney = x.CommissionType == 1 ? x.CommissionRate : Math.Round((x.PreferPrice - x.DiscountMoney) * x.CommissionRate / 100, 2, MidpointRounding.AwayFromZero), YFCommissionMoney = GetOrderYFCommission(x),
x.CommissionMoney, x.CommissionMoney,
x.ExtraCommissionMoney, x.ExtraCommissionMoney,
x.ExtraRewardMoney, x.ExtraRewardMoney,
...@@ -1315,7 +1340,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1315,7 +1340,7 @@ namespace Edu.WebApi.Controllers.Course
OrderSourceName = x.OrderSource.ToName(), OrderSourceName = x.OrderSource.ToName(),
x.EnterID, x.EnterID,
EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "", EnterName = UserReidsCache.GetUserLoginInfo(x.EnterID)?.AccountName ?? "",
YFCommissionMoney = x.CommissionType == 1 ? x.CommissionRate : Math.Round((x.PreferPrice - x.DiscountMoney) * x.CommissionRate / 100, 2, MidpointRounding.AwayFromZero), YFCommissionMoney = GetOrderYFCommission(x),
x.CommissionMoney, x.CommissionMoney,
x.ExtraCommissionMoney, x.ExtraCommissionMoney,
x.ExtraRewardMoney, x.ExtraRewardMoney,
......
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