From a696f9b7e2e73e792d05957b3024c63c9039ab8a Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Fri, 23 Sep 2022 03:15:11 +0800 Subject: [PATCH] SD --- BBWY.Client/APIServices/OrderService.cs | 13 +++++++ BBWY.Client/Models/Order/Order.cs | 2 +- .../Order/OrderListViewModel_SDGroup.cs | 35 +++++++++++++++++-- BBWY.Client/Views/Order/OrderListControl.xaml | 25 ++++++++----- BBWY.Client/Views/Order/SDGroup.xaml | 13 +++++++ 5 files changed, 76 insertions(+), 12 deletions(-) diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs index 8e0fa244..f8c1c229 100644 --- a/BBWY.Client/APIServices/OrderService.cs +++ b/BBWY.Client/APIServices/OrderService.cs @@ -261,5 +261,18 @@ namespace BBWY.Client.APIServices excludeCanceled }, null, HttpMethod.Post); } + + public ApiResponse SDGroupPullOrder(string orderId, Shop shop) + { + return SendRequest(globalContext.BBYWApiHost, "Api/Order/SDGroupPullOrder", new + { + orderId, + shop.ShopId, + shop.Platform, + shop.AppKey, + shop.AppSecret, + shop.AppToken + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/Models/Order/Order.cs b/BBWY.Client/Models/Order/Order.cs index 52faa95f..c1b419d7 100644 --- a/BBWY.Client/Models/Order/Order.cs +++ b/BBWY.Client/Models/Order/Order.cs @@ -218,7 +218,7 @@ namespace BBWY.Client.Models return OrderState != OrderState.已取消 && StorageType != Models.StorageType.SD && ((StorageType != null && beforeTotalCost == 0M) || (beforeTotalCost > OrderSellerPrice + FreightPrice) || - (StorageType == null && OrderState != OrderState.等待采购)); + (StorageType == null && OrderState != OrderState.等待采购 && OrderState != OrderState.待付款)); } } diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs index 5a10a6b3..4da49774 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs @@ -1,7 +1,9 @@ using BBWY.Client.Models; using BBWY.Client.Views.SelectShop; +using BBWY.Common.Extensions; using GalaSoft.MvvmLight.Command; -using System; +using System.Threading.Tasks; +using System.Windows; using System.Windows.Input; namespace BBWY.Client.ViewModels @@ -16,6 +18,8 @@ namespace BBWY.Client.ViewModels public ICommand SetSDButtinIndexCommand { get; set; } public ICommand SDGroupSelectedShopChangedCommand { get; set; } + public ICommand SDGroupPullCommand { get; set; } + public Shop SdGroupSelectedShop { get => sdGroupSelectedShop; set { Set(ref sdGroupSelectedShop, value); } } @@ -23,6 +27,7 @@ namespace BBWY.Client.ViewModels { SetSDButtinIndexCommand = new RelayCommand(SetSDButtinIndex); SDGroupSelectedShopChangedCommand = new RelayCommand(SDGroupSelectedShopChanged); + SDGroupPullCommand = new RelayCommand(SDGroupPull); } private void SetSDButtinIndex(int index) @@ -35,6 +40,32 @@ namespace BBWY.Client.ViewModels this.SdGroupSelectedShop = args.SelectedShop; } - + private void SDGroupPull() + { + if (string.IsNullOrEmpty(SearchOrderId) || this.SdGroupSelectedShop == null) + { + MessageBox.Show("拉取条件不齐全", "提示"); + return; + } + IsLoading = true; + Task.Factory.StartNew(() => orderService.SDGroupPullOrder(SearchOrderId, SdGroupSelectedShop)).ContinueWith(t => + { + IsLoading = false; + var response = t.Result; + if (!response.Success) + { + App.Current.Dispatcher.Invoke(() => MessageBox.Show(response.Msg, "拉取订单")); + return; + } + PageIndex = 1; + OrderCount = 1; + var order = response.Data.Map(); + App.Current.Dispatcher.Invoke(() => + { + OrderList.Clear(); + OrderList.Add(order); + }); + }); + } } } diff --git a/BBWY.Client/Views/Order/OrderListControl.xaml b/BBWY.Client/Views/Order/OrderListControl.xaml index 14e27b59..f22a564c 100644 --- a/BBWY.Client/Views/Order/OrderListControl.xaml +++ b/BBWY.Client/Views/Order/OrderListControl.xaml @@ -38,7 +38,7 @@ - + @@ -47,8 +47,8 @@ - - + + @@ -56,7 +56,7 @@ - + @@ -83,6 +83,7 @@ + - + @@ -289,6 +290,9 @@ + @@ -800,7 +804,10 @@ - + + @@ -832,11 +839,11 @@ - + VerticalAlignment="Center"/>--> - + diff --git a/BBWY.Client/Views/Order/SDGroup.xaml b/BBWY.Client/Views/Order/SDGroup.xaml index cd53353b..4a6e4a1b 100644 --- a/BBWY.Client/Views/Order/SDGroup.xaml +++ b/BBWY.Client/Views/Order/SDGroup.xaml @@ -131,6 +131,19 @@ + + + + + + + + +