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

129 lines
4.8 KiB

3 years ago
using BBWY.Client.Models;
using BBWY.Controls;
using System.Collections.Generic;
using System.Linq;
3 years ago
using System.Windows;
using System.Windows.Controls;
namespace BBWY.Client.Views.Order
{
/// <summary>
/// SD.xaml 的交互逻辑
/// </summary>
public partial class SD : BWindow
{
public string OrderId { get; private set; }
public bool IsSetStorageType { get; private set; }
public decimal SDCommissionAmount { get; private set; }
3 years ago
public decimal SDOrderAmount { get; private set; }
3 years ago
public decimal DeliveryExpressFreight { get; private set; }
public SDType? SDType { get; private set; }
public string Flag { get; private set; }
public string VenderRemark { get; private set; }
3 years ago
public string SDKey { get; private set; }
public PayBillType? PayChannel { get; set; }
public string SdPayBillNo { get; set; }
public string SdOperator { get; set; }
3 years ago
public SD(string orderId,
bool isSetStorageType,
string venderRemark,
string flag,
string sdKey,
PayBillType? payChannel,
string sdPayBillNo,
string sdOperator,
decimal sdCommissionAmount,
decimal sdOrderAmount,
decimal deliveryExpressFreight,
SDType sDType = Models.SDType.)
3 years ago
{
InitializeComponent();
this.OrderId = orderId;
this.IsSetStorageType = isSetStorageType;
this.VenderRemark = venderRemark;
this.Flag = flag;
3 years ago
this.SDKey = sdKey;
this.PayChannel = payChannel;
this.SdPayBillNo = sdPayBillNo;
this.SdOperator = sdOperator;
3 years ago
this.SDCommissionAmount = sdCommissionAmount;
3 years ago
this.SDOrderAmount = sdOrderAmount;
3 years ago
this.DeliveryExpressFreight = deliveryExpressFreight;
this.SDType = sDType;
}
private void BWindow_Loaded(object sender, RoutedEventArgs e)
{
txtVenderRemark.Text = VenderRemark;
cbx_sdType.SelectedItem = SDType;
var flagList = new List<KVModel>()
{
new KVModel() {Key="灰色",Value="Gray"},
new KVModel() {Key="红色",Value="Red"},
new KVModel() {Key="黄色",Value="Yellow"},
new KVModel() {Key="绿色",Value="Green"},
new KVModel() {Key="蓝色",Value="Blue"},
new KVModel() {Key="紫色",Value="Purple"}
};
cbx_flag.ItemsSource = flagList;
if (!string.IsNullOrEmpty(Flag))
cbx_flag.SelectedItem = flagList.FirstOrDefault(kv => kv.Value == Flag) ?? flagList[0];
3 years ago
this.txt_SDKey.Text = SDKey;
if (PayChannel != null)
this.cbx_SDPayChannel.SelectedItem = PayChannel;
this.txt_SDPayBillNo.Text = SdPayBillNo;
this.txt_SDOperator.Text = SdOperator;
3 years ago
this.txtDeliveryExpressFreight.Text = DeliveryExpressFreight.ToString();
this.txtSDCommissionAmount.Text = SDCommissionAmount.ToString();
3 years ago
this.txtSDOrderAmount.Text = SDOrderAmount.ToString();
3 years ago
lblSDCommissionAmount.Text = (SDType)cbx_sdType.SelectedItem == Models.SDType. ? "空单号费" : "佣金";
3 years ago
}
private void btn_Save_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(txtVenderRemark.Text))
{
MessageBox.Show("商家备注必填", "提示");
return;
}
3 years ago
decimal.TryParse(txtSDCommissionAmount.Text, out decimal sdCommissionAmount);
3 years ago
decimal.TryParse(txtDeliveryExpressFreight.Text, out decimal deliveryExpressFreight);
3 years ago
decimal.TryParse(txtSDOrderAmount.Text, out decimal sdOrderAmount);
SDCommissionAmount = sdCommissionAmount;
SDOrderAmount = sdOrderAmount;
3 years ago
DeliveryExpressFreight = deliveryExpressFreight;
Flag = (cbx_flag.SelectedItem as KVModel).Value;
3 years ago
SDType = (SDType)cbx_sdType.SelectedItem;
VenderRemark = txtVenderRemark.Text;
3 years ago
SDKey = this.txt_SDKey.Text;
PayChannel = (PayBillType)this.cbx_SDPayChannel.SelectedItem;
SdPayBillNo = this.txt_SDPayBillNo.Text;
SdOperator = this.txt_SDOperator.Text;
3 years ago
this.DialogResult = true;
this.Close();
}
3 years ago
private void cbx_sdType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (lblSDCommissionAmount == null)
return;
lblSDCommissionAmount.Text = (SDType)cbx_sdType.SelectedItem == Models.SDType. ? "空单号费" : "佣金";
}
3 years ago
}
}