diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs index c8d32fea..91822375 100644 --- a/BBWY.Client/APIServices/OrderService.cs +++ b/BBWY.Client/APIServices/OrderService.cs @@ -256,5 +256,10 @@ namespace BBWY.Client.APIServices excludeCanceled }, null, HttpMethod.Post); } + + public ApiResponse EditAfterSaleOrderSku(AfterSaleOrder afterSaleOrder) + { + return SendRequest(globalContext.BBYWApiHost, "Api/Order/EditAfterSaleOrderSku", afterSaleOrder, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/Order/AfterSaleOrder.cs b/BBWY.Client/Models/Order/AfterSaleOrder.cs index 2ac9de4d..6a7de108 100644 --- a/BBWY.Client/Models/Order/AfterSaleOrder.cs +++ b/BBWY.Client/Models/Order/AfterSaleOrder.cs @@ -2,53 +2,57 @@ namespace BBWY.Client.Models { - public class AfterSaleOrder + public class AfterSaleOrder : NotifyObject, ICloneable { - - public long Id { get; set; } - public DateTime? CreateTime { get; set; } - - public string OrderId { get; set; } - - public string ProductId { get; set; } - - /// - /// 商品处理结果 - /// - public ProductResult? ProductResult { get; set; } - - /// - /// 退款金额 - /// - public decimal? RefundAmount { get; set; } = 0.00M; - - /// - /// 退款时间 - /// - public DateTime? RefundTime { get; set; } - - /// - /// 售后补发成本 - /// - public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M; - - /// - /// 补发快递费 - /// - public decimal? ReissueFreight { get; set; } = 0.00M; - - /// - /// 补发货款成本 - /// - public decimal? ReissueProductAmount { get; set; } = 0.00M; - - /// - /// 服务单处理结果 - /// - public ServiceResult? ServiceResult { get; set; } - - public long? ShopId { get; set; } - - public string SkuId { get; set; } - } + private ProductResult? productResult; + private ServiceResult? serviceResult; + private decimal? reissueAfterSaleAmount = 0.00M; + private decimal? reissueFreight = 0.00M; + private decimal? reissueProductAmount = 0.00M; + + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + + public string OrderId { get; set; } + + public string ProductId { get; set; } + + + /// + /// 退款金额 + /// + public decimal? RefundAmount { get; set; } = 0.00M; + + /// + /// 退款时间 + /// + public DateTime? RefundTime { get; set; } + + + public long? ShopId { get; set; } + + public string SkuId { get; set; } + public ProductResult? ProductResult { get => productResult; set { Set(ref productResult, value); } } + /// + /// 售后补偿成本 + /// + public decimal? ReissueAfterSaleAmount { get => reissueAfterSaleAmount; set { Set(ref reissueAfterSaleAmount, value); } } + /// + /// 补发快递费 + /// + public decimal? ReissueFreight { get => reissueFreight; set { Set(ref reissueFreight, value); } } + /// + /// 补发货款成本 + /// + public decimal? ReissueProductAmount { get => reissueProductAmount; set { Set(ref reissueProductAmount, value); } } + /// + /// 服务单处理结果 + /// + public ServiceResult? ServiceResult { get => serviceResult; set { Set(ref serviceResult, value); } } + + public object Clone() + { + return this.MemberwiseClone(); + } + } } diff --git a/BBWY.Client/Models/Order/Order.cs b/BBWY.Client/Models/Order/Order.cs index a1d5b9a6..8deefd02 100644 --- a/BBWY.Client/Models/Order/Order.cs +++ b/BBWY.Client/Models/Order/Order.cs @@ -199,7 +199,7 @@ namespace BBWY.Client.Models /// /// 售后信息 /// - public IList AfterSaleOrderList { get; set; } + public IList AfterSaleOrderList { get; set; } public void ConvertOrderCostDetailToGroup() { diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index af63fac3..a432714e 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -104,6 +104,8 @@ namespace BBWY.Client.ViewModels public ICommand SetIncludeAfterOrderCommand { get; set; } + public ICommand EditAfterSaleOrderCommand { get; set; } + public OrderListViewModel(OrderService orderService, StatisticsService statisticsService, GlobalContext globalContext, ChoosePurchaseSchemeViewModel choosePurchaseSchemeViewModel) { random = new Random(); @@ -160,6 +162,7 @@ namespace BBWY.Client.ViewModels EditVenderRemarkCommand = new RelayCommand(EditVenderRemark); ExportCommand = new RelayCommand(Export); SetIncludeAfterOrderCommand = new RelayCommand(SetIncludeAfterOrder); + EditAfterSaleOrderCommand = new RelayCommand(EditAfterSaleOrder); SearchOrderCommand.Execute(null); } @@ -726,5 +729,52 @@ namespace BBWY.Client.ViewModels } }); } + + private void EditAfterSaleOrder(object param) + { + var paramList = (object[])param; + var orderId = paramList[0].ToString(); + var skuId = paramList[1].ToString(); + + var order = OrderList.FirstOrDefault(o => o.Id == orderId); + var sku = order.ItemList.FirstOrDefault(s => s.Id == skuId); + + var afterSaleOrderSku = order.AfterSaleOrderList.FirstOrDefault(aso => aso.OrderId == orderId && aso.SkuId == skuId); + if (afterSaleOrderSku == null) + { + afterSaleOrderSku = new AfterSaleOrder() + { + Id = 0, + SkuId = skuId, + OrderId = orderId, + ProductId = sku.ProductId, + ShopId = globalContext.User.Shop.ShopId + }; + } + var editAfterSaleOrderSku = new EditAfterSaleOrderSku(afterSaleOrderSku); + editAfterSaleOrderSku.Closed += EditAfterSaleOrderSku_Closed; + editAfterSaleOrderSku.ShowDialog(); + } + + private void EditAfterSaleOrderSku_Closed(object sender, EventArgs e) + { + var editAfterSaleOrderSku = sender as EditAfterSaleOrderSku; + if (editAfterSaleOrderSku.DialogResult != true) + return; + + var afterSaleOrder = editAfterSaleOrderSku.SaleOrder; + IsLoading = true; + Task.Factory.StartNew(() => orderService.EditAfterSaleOrderSku(afterSaleOrder)).ContinueWith(t => + { + var response = t.Result; + if (!response.Success) + { + IsLoading = false; + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "修改售后")); + return; + } + RefreshOrder(afterSaleOrder.OrderId); + }); + } } } diff --git a/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml new file mode 100644 index 00000000..1bcb6148 --- /dev/null +++ b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs new file mode 100644 index 00000000..fad2d34c --- /dev/null +++ b/BBWY.Client/Views/Order/EditAfterSaleOrderSku.xaml.cs @@ -0,0 +1,27 @@ +using BBWY.Client.Models; +using BBWY.Controls; + +namespace BBWY.Client.Views.Order +{ + /// + /// EditAfterSaleOrderSku.xaml 的交互逻辑 + /// + public partial class EditAfterSaleOrderSku : BWindow + { + public AfterSaleOrder SaleOrder { get; set; } + + public EditAfterSaleOrderSku(AfterSaleOrder afterSaleOrder) + { + InitializeComponent(); + if (afterSaleOrder.Id != 0) + SaleOrder = (AfterSaleOrder)afterSaleOrder.Clone(); + this.DataContext = this; + } + + private void btn_Save_Click(object sender, System.Windows.RoutedEventArgs e) + { + this.DialogResult = true; + this.Close(); + } + } +} diff --git a/BBWY.Client/Views/Order/OrderList.xaml b/BBWY.Client/Views/Order/OrderList.xaml index c43c400d..94f17206 100644 --- a/BBWY.Client/Views/Order/OrderList.xaml +++ b/BBWY.Client/Views/Order/OrderList.xaml @@ -392,7 +392,15 @@ + Visibility="{Binding DataContext.OrderState,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}},Converter={StaticResource objConverter},ConverterParameter=已完成:Visible:Collapsed}" + Command="{Binding DataContext.EditAfterSaleOrderCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"> + + + + + + + diff --git a/BBWY.Server.Model/MappingProfiles.cs b/BBWY.Server.Model/MappingProfiles.cs index f3fd80aa..2edf95d8 100644 --- a/BBWY.Server.Model/MappingProfiles.cs +++ b/BBWY.Server.Model/MappingProfiles.cs @@ -24,6 +24,8 @@ namespace BBWY.Server.Model CreateMap(); CreateMap(); + < CreateMap(); + CreateMap(); CreateMap(); CreateMap(); @@ -57,16 +59,7 @@ namespace BBWY.Server.Model .ForPath(t => t.OrderCost.ReissueAfterSaleAmount, opt => opt.MapFrom(f => f.ReissueAfterSaleAmount)) .ForPath(t => t.OrderCost.ReissueFreight, opt => opt.MapFrom(f => f.ReissueFreight)) .ForPath(t => t.OrderCost.ReissueProductAmount, opt => opt.MapFrom(f => f.ReissueProductAmount)); - //.ForPath(t => t.OrderDropShipping.PurchaseAmount, opt => opt.MapFrom(f => f.PurchaseAmount)) - //.ForPath(t => t.OrderDropShipping.PurchaseOrderId, opt => opt.MapFrom(f => f.PurchaseOrderId)) - //.ForPath(t => t.OrderDropShipping.OrderId, opt => opt.MapFrom(f => f.Id)) - //.ForPath(t => t.OrderDropShipping.DeliveryFreight, opt => opt.MapFrom(f => f.DeliveryFreight)) - //.ForPath(t => t.OrderDropShipping.PurchasePlatform, opt => opt.MapFrom(f => f.PurchasePlatform)) - //.ForPath(t => t.OrderDropShipping.BuyerAccount, opt => opt.MapFrom(f => f.BuyerAccount)) - //.ForPath(t => t.OrderDropShipping.SellerAccount, opt => opt.MapFrom(f => f.SellerAccount)) - //.ForPath(t => t.OrderDropShipping.SkuAmount, opt => opt.MapFrom(f => f.OrderDropShippingSkuAmount)) - //.ForPath(t => t.OrderDropShipping.PurchaseFreight, opt => opt.MapFrom(f => f.OrderDropShippingPurchaseFreight)); - + } } }