diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 0ee75bec..e5e0d7b9 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -540,29 +540,54 @@ namespace BBWY.Client.ViewModels } else if (storageType == StorageType.代发) { - var chooseDFType = new ChooseDFType(); - if (chooseDFType.ShowDialog() != true) - return; - - if (chooseDFType.DFType == DFType.关联订单) + IsLoading = true; + Task.Factory.StartNew(() => statisticsService.GetSkuRecentSales(order.ItemList.Select(osku => osku.Id).ToList())).ContinueWith(t => { - var relationPurchaseOrder = new RelationPurchaseOrder(orderId, globalContext.User.Shop.PurchaseAccountList, null, null, order.ItemList.Select(osku => new RelationPurchaseOrderSku() + IsLoading = false; + if (t.Result.Success) { - Logo = osku.Logo, - ProductId = osku.ProductId, - SkuId = osku.Id, - Quantity = osku.ItemTotal, - Title = osku.Title - }).ToList()); - relationPurchaseOrder.Closed += RelationPurchaseOrder_Closed; - relationPurchaseOrder.ShowDialog(); - } - else if (chooseDFType.DFType == DFType.在线采购) - { - choosePurchaseSchemeViewModel.SetData(order); - var choosePurchaseScheme = new ChoosePurchaseScheme(); - choosePurchaseScheme.ShowDialog(); - } + var tartgetSkus = t.Result.Data.Where(s => s.SaleCount >= 5).Select(s => s.SkuId).ToList(); + if (tartgetSkus.Count() > 0) + { + bool? dialog = false; + App.Current.Dispatcher.Invoke(() => + { + var confirmWindow = new SkuRecentSalesConfirmWindow(tartgetSkus); + dialog = confirmWindow.ShowDialog(); + }); + if (dialog != true) + return; + } + } + + App.Current.Dispatcher.Invoke(() => + { + var chooseDFType = new ChooseDFType(); + if (chooseDFType.ShowDialog() != true) + return; + + if (chooseDFType.DFType == DFType.关联订单) + { + var relationPurchaseOrder = new RelationPurchaseOrder(orderId, globalContext.User.Shop.PurchaseAccountList, null, null, order.ItemList.Select(osku => new RelationPurchaseOrderSku() + { + Logo = osku.Logo, + ProductId = osku.ProductId, + SkuId = osku.Id, + Quantity = osku.ItemTotal, + Title = osku.Title + }).ToList()); + relationPurchaseOrder.Closed += RelationPurchaseOrder_Closed; + relationPurchaseOrder.ShowDialog(); + } + else if (chooseDFType.DFType == DFType.在线采购) + { + choosePurchaseSchemeViewModel.SetData(order); + var choosePurchaseScheme = new ChoosePurchaseScheme(); + choosePurchaseScheme.ShowDialog(); + } + }); + }); + } } diff --git a/BBWY.Client/Views/MainWindow.xaml b/BBWY.Client/Views/MainWindow.xaml index 20c83537..a8d0a8ef 100644 --- a/BBWY.Client/Views/MainWindow.xaml +++ b/BBWY.Client/Views/MainWindow.xaml @@ -26,7 +26,7 @@ - + diff --git a/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml b/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml new file mode 100644 index 00000000..559d87f0 --- /dev/null +++ b/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml.cs b/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml.cs new file mode 100644 index 00000000..abf86348 --- /dev/null +++ b/BBWY.Client/Views/Order/SkuRecentSalesConfirmWindow.xaml.cs @@ -0,0 +1,24 @@ +using BBWY.Controls; +using System.Collections.Generic; +using System.Windows; + +namespace BBWY.Client.Views.Order +{ + /// + /// SkuRecentSalesConfirmWindow.xaml 的交互逻辑 + /// + public partial class SkuRecentSalesConfirmWindow : BWindow + { + public SkuRecentSalesConfirmWindow(IList skuIds) + { + InitializeComponent(); + txtContent.Text = $"SKU {string.Join(',', skuIds)} 最近30天一件代发已超过5件, 建议批量采购入仓,权重更高,推广费用更便宜"; + } + + private void BButton_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + this.Close(); + } + } +}