You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.3 KiB
29 lines
1.3 KiB
3 years ago
|
using BBWY.Server.Model.Db;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
|
||
|
namespace BBWY.Server.Business.Extensions
|
||
|
{
|
||
|
public static class OrderCostExtension
|
||
|
{
|
||
|
public static void CalculationOrderProfitAndCost(this OrderCost orderCost, Order order, IList<AfterSaleOrder> afterSaleOrders)
|
||
|
{
|
||
|
orderCost.AfterTotalCost = afterSaleOrders.Count == 0 ? 0M : afterSaleOrders.Sum(aso => aso.AfterTotalCost);
|
||
|
orderCost.RefundAmount = afterSaleOrders.Count == 0 ? 0M : afterSaleOrders.Sum(aso => aso.RefundAmount ?? 0M);
|
||
|
orderCost.RefundPurchaseAmount = afterSaleOrders.Count == 0M ? 0M : afterSaleOrders.Sum(aso => aso.RefundPurchaseAmount ?? 0);
|
||
|
|
||
|
//退款之后平台扣点
|
||
|
orderCost.PlatformCommissionAmount = (order.OrderSellerPrice - orderCost.RefundAmount) * (orderCost.PlatformCommissionRatio);
|
||
|
|
||
|
orderCost.Profit = order.OrderSellerPrice + order.FreightPrice - orderCost.RefundAmount -
|
||
|
orderCost.PurchaseAmount -
|
||
|
orderCost.DeliveryExpressFreight -
|
||
|
orderCost.PlatformCommissionAmount -
|
||
|
orderCost.AfterTotalCost +
|
||
|
orderCost.RefundPurchaseAmount;
|
||
|
}
|
||
|
}
|
||
|
}
|