using System; namespace BBWY.Client.Models { public class ManualEditCostOrderSku : NotifyObject { /// /// 发货运费 /// private decimal deliveryExpressFreight; private string deliveryExpressFreightStr; /// /// 单件成本 /// private decimal unitCost; /// /// Sku成本(商品成本) /// private decimal skuAmount; private string skuAmountStr; /// /// 采购运费 /// private decimal purchaseFreight; private string purchaseFreightStr; /// /// 头程运费 /// private decimal firstFreight; private string firstFreightStr; /// /// 操作费 /// private decimal operationAmount; private string operationAmountStr; /// /// 耗材费 /// private decimal consumableAmount; private string consumableAmountStr; /// /// 仓储费 /// private decimal storageAmount; private string storageAmountStr; /// /// 总计(不含发货运费) /// private decimal totalCost; /// /// SkuId /// public string Id { get; set; } public int ItemTotal { get; set; } public string ProductId { get; set; } public string ProductItemNum { get; set; } public double Price { get; set; } /// /// Sku标题 /// public string Title { get; set; } public string Logo { get; set; } public decimal DeliveryExpressFreight { get => deliveryExpressFreight; set { if (Set(ref deliveryExpressFreight, value)) { OnAmountChanged?.Invoke(); } } } public decimal UnitCost { get => unitCost; set { Set(ref unitCost, value); } } public decimal SkuAmount { get => skuAmount; set { if (Set(ref skuAmount, value)) { CalculationCost(); } } } public decimal PurchaseFreight { get => purchaseFreight; set { if (Set(ref purchaseFreight, value)) { CalculationCost(); } } } public decimal FirstFreight { get => firstFreight; set { if (Set(ref firstFreight, value)) { CalculationCost(); } } } public decimal OperationAmount { get => operationAmount; set { if (Set(ref operationAmount, value)) { CalculationCost(); } } } public decimal ConsumableAmount { get => consumableAmount; set { if (Set(ref consumableAmount, value)) { CalculationCost(); } } } public decimal StorageAmount { get => storageAmount; set { if (Set(ref storageAmount, value)) { CalculationCost(); } } } public decimal TotalCost { get => totalCost; set { if (Set(ref totalCost, value)) { OnAmountChanged?.Invoke(); } } } private void CalculationCost() { TotalCost = SkuAmount + PurchaseFreight + FirstFreight + OperationAmount + ConsumableAmount + StorageAmount; UnitCost = ItemTotal == 0 ? 0 : TotalCost / ItemTotal; } public Action OnAmountChanged { get; set; } public string SkuAmountStr { get => skuAmountStr; set { if (Set(ref skuAmountStr, value)) { if (decimal.TryParse(skuAmountStr, out decimal d)) SkuAmount = d; } } } public string PurchaseFreightStr { get => purchaseFreightStr; set { if (Set(ref purchaseFreightStr, value)) { if (decimal.TryParse(purchaseFreightStr, out decimal d)) PurchaseFreight = d; } } } public string FirstFreightStr { get => firstFreightStr; set { if (Set(ref firstFreightStr, value)) { if (decimal.TryParse(firstFreightStr, out decimal d)) FirstFreight = d; } } } public string ConsumableAmountStr { get => consumableAmountStr; set { if (Set(ref consumableAmountStr, value)) { if (decimal.TryParse(consumableAmountStr, out decimal d)) ConsumableAmount = d; } } } public string StorageAmountStr { get => storageAmountStr; set { if (Set(ref storageAmountStr, value)) { if (decimal.TryParse(storageAmountStr, out decimal d)) StorageAmount = d; } } } public string OperationAmountStr { get => operationAmountStr; set { if (Set(ref operationAmountStr, value)) { if (decimal.TryParse(operationAmountStr, out decimal d)) OperationAmount = d; } } } public string DeliveryExpressFreightStr { get => deliveryExpressFreightStr; set { if (Set(ref deliveryExpressFreightStr, value)) { if (decimal.TryParse(deliveryExpressFreightStr, out decimal d)) DeliveryExpressFreight = d; } } } } }