步步为盈
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.

60 lines
2.5 KiB

using BBWY.Client.Models;
using BBWY.Controls;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
namespace BBWY.Client.Views.Order
{
/// <summary>
/// RelationPurchaseOrder.xaml 的交互逻辑
/// </summary>
public partial class RelationPurchaseOrder : BWindow
{
public OrderDropShipping OrderDropShipping { get; set; }
public IList<RelationPurchaseOrderSku> RelationPurchaseOrderSkuList { get; set; }
public RelationPurchaseOrder(string orderId, OrderDropShipping orderDropShipping, IList<RelationPurchaseOrderSku> relationPurchaseOrderSkuList)
{
InitializeComponent();
this.DataContext = this;
OrderDropShipping = new OrderDropShipping() { OrderId = orderId };
if (orderDropShipping != null)
{
OrderDropShipping.BuyerAccount = orderDropShipping.BuyerAccount;
OrderDropShipping.PurchaseAmount = orderDropShipping.PurchaseAmount;
OrderDropShipping.PurchaseOrderId = orderDropShipping.PurchaseOrderId;
OrderDropShipping.DeliveryFreight = orderDropShipping.DeliveryFreight;
OrderDropShipping.PurchasePlatform = orderDropShipping.PurchasePlatform;
OrderDropShipping.SellerAccount = orderDropShipping.SellerAccount;
OrderDropShipping.SkuAmount = orderDropShipping.SkuAmount;
OrderDropShipping.PurchaseFreight = orderDropShipping.PurchaseFreight;
OrderDropShipping.PurchaseFreightStr = orderDropShipping.PurchaseFreight.ToString();
}
this.RelationPurchaseOrderSkuList = relationPurchaseOrderSkuList;
foreach (var sku in RelationPurchaseOrderSkuList)
sku.OnSkuAmountChanged = OnSkuAmountChanged;
}
private void OnSkuAmountChanged()
{
OrderDropShipping.SkuAmount = RelationPurchaseOrderSkuList.Sum(sku => sku.SkuAmount);
}
private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (string.IsNullOrEmpty(OrderDropShipping.PurchaseOrderId) ||
string.IsNullOrEmpty(OrderDropShipping.SellerAccount) ||
string.IsNullOrEmpty(OrderDropShipping.BuyerAccount) ||
OrderDropShipping.PurchaseAmount == 0)
{
MessageBox.Show("关联订单信息不全", "提示");
return;
}
this.DialogResult = true;
this.Close();
}
}
}