Commit e0e8d0dd authored by 吴春's avatar 吴春

修复修改订单报错

parent 3dfe59a3
...@@ -2201,10 +2201,16 @@ namespace Edu.Module.Course ...@@ -2201,10 +2201,16 @@ namespace Edu.Module.Course
{ nameof(RB_Order_ViewModel.UpOrderId),demodel.UpOrderId}, { nameof(RB_Order_ViewModel.UpOrderId),demodel.UpOrderId},
{ nameof(RB_Order_ViewModel.CustomerId),demodel.CustomerId}, { nameof(RB_Order_ViewModel.CustomerId),demodel.CustomerId},
{ nameof(RB_Order_ViewModel.CourseConsultantId),demodel.CourseConsultantId}, { nameof(RB_Order_ViewModel.CourseConsultantId),demodel.CourseConsultantId},
{ nameof(RB_Order_ViewModel.TotalClassHours),demodel.TotalClassHours},
{ nameof(RB_Order_ViewModel.TextbookFee),demodel.TextbookFee}, { nameof(RB_Order_ViewModel.TextbookFee),demodel.TextbookFee},
{ nameof(RB_Order_ViewModel.CoursewareFee),demodel.CoursewareFee}, { nameof(RB_Order_ViewModel.CoursewareFee),demodel.CoursewareFee},
}; };
if (demodel.TotalClassHours == 0)//兼容之前的数据
{
demodel.TotalClassHours = (glist?.FirstOrDefault()?.TotalHours ?? 0);
}
keyValues.Add(nameof(RB_Order_ViewModel.TotalClassHours), demodel.TotalClassHours);
flag = orderRepository.Update(keyValues, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), demodel.OrderId));//更新订单信息 flag = orderRepository.Update(keyValues, new WhereHelper(nameof(RB_Order_ViewModel.OrderId), demodel.OrderId));//更新订单信息
#region 更新Order_Guest中的有效课时和课时单价 2024-09-06 add by:W #region 更新Order_Guest中的有效课时和课时单价 2024-09-06 add by:W
...@@ -2212,10 +2218,18 @@ namespace Edu.Module.Course ...@@ -2212,10 +2218,18 @@ namespace Edu.Module.Course
{ {
foreach (var item in glist) foreach (var item in glist)
{ {
item.TotalHours = demodel.TotalClassHours; item.TotalHours = demodel.TotalClassHours == 0 ? item.TotalHours : demodel.TotalClassHours;
item.ClassUnitPrice = Math.Round(((demodel.PreferPrice - demodel.TextbookFee - demodel.CoursewareFee) / demodel.TotalClassHours), 6);//课时单价 (应收总金额-教材费-课件费)/总课时 if (item.TotalHours == 0)
decimal validClassHours = Math.Round(((demodel.Income + demodel.PlatformTax - demodel.Refund - demodel.TextbookFee - demodel.CoursewareFee) / item.ClassUnitPrice), 2); {
item.ValidClassHours = validClassHours < item.CompleteHours ? item.CompleteHours : validClassHours;//有效课时 = (实收+手续费-退款 - 课件费 - 教材费)/课时单价 ; 如果 有效课时 < 已完成课时 ,有效课时 = 已完成课时 item.ClassUnitPrice = 0;
item.ValidClassHours = 0;
}
else
{
item.ClassUnitPrice = Math.Round(((demodel.PreferPrice - demodel.TextbookFee - demodel.CoursewareFee) / demodel.TotalClassHours), 6);//课时单价 (应收总金额-教材费-课件费)/总课时
decimal validClassHours = Math.Round(((demodel.Income + demodel.PlatformTax - demodel.Refund - demodel.TextbookFee - demodel.CoursewareFee) / item.ClassUnitPrice), 2);
item.ValidClassHours = validClassHours < item.CompleteHours ? item.CompleteHours : validClassHours;//有效课时 = (实收+手续费-退款 - 课件费 - 教材费)/课时单价 ; 如果 有效课时 < 已完成课时 ,有效课时 = 已完成课时
}
Dictionary<string, object> keyValuesOG = new Dictionary<string, object>() Dictionary<string, object> keyValuesOG = new Dictionary<string, object>()
{ {
{ nameof(RB_Order_Guest_ViewModel.TotalHours),item.TotalHours}, { nameof(RB_Order_Guest_ViewModel.TotalHours),item.TotalHours},
......
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