using BBWY.Client.Models; using BBWY.Controls; using System.Windows; namespace BBWY.Client.Views.Order { /// /// ManualCalculationCost.xaml 的交互逻辑 /// public partial class ManualCalculationCost : BWindow { public string OrderId { get; private set; } public bool IsSetStorageType { get; private set; } public StorageType StorageType { get; private set; } public decimal PurchaseCost { get; private set; } public decimal DeliveryExpressFreight { get; private set; } public ManualCalculationCost(string orderId, bool isSetStorageType, StorageType storageType) { InitializeComponent(); this.OrderId = orderId; this.IsSetStorageType = isSetStorageType; this.StorageType = storageType; this.Loaded += ManualCalculationCost_Loaded; } private void ManualCalculationCost_Loaded(object sender, RoutedEventArgs e) { txt_StorageType.Text = $"{this.StorageType}-手动计算成本"; if (StorageType != StorageType.云仓 && StorageType != StorageType.京仓) { txtFirstFreight.Visibility = Visibility.Collapsed; this.Height = 290; } } private void btn_fillFromLately_Click(object sender, System.Windows.RoutedEventArgs e) { } private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e) { if (!decimal.TryParse(txtSkuAmount.Text, out decimal skuAmount) || !decimal.TryParse(txtFeright.Text, out decimal feright) || !decimal.TryParse(txtDeliveryExpressFreight.Text, out decimal deliveryExpressFreight)) { MessageBox.Show("请填写完整信息", "手动编辑成本"); return; } decimal.TryParse(txtFirstFreight.Text, out decimal firstFreight); decimal.TryParse(txtOperationAmount.Text, out decimal operationAmount); decimal.TryParse(txtConsumableAmount.Text, out decimal consumableAmount); decimal.TryParse(txtStorageAmount.Text, out decimal storageAmount); this.PurchaseCost = skuAmount + feright + firstFreight + operationAmount + consumableAmount + storageAmount; this.DeliveryExpressFreight = deliveryExpressFreight; this.DialogResult = true; this.Close(); } } }