diff --git a/BBWY.Client/APIServices/StatisticsService.cs b/BBWY.Client/APIServices/StatisticsService.cs index 5d81087e..4c60ec25 100644 --- a/BBWY.Client/APIServices/StatisticsService.cs +++ b/BBWY.Client/APIServices/StatisticsService.cs @@ -17,11 +17,11 @@ namespace BBWY.Client.APIServices /// 今日业绩统计 /// /// - public ApiResponse GetTodayAchievementStatistics(DateTime startTime, DateTime endTime) + public ApiResponse GetTodayAchievementStatistics(DateTime startTime, DateTime endTime,long shopId) { return SendRequest(globalContext.BBYWApiHost, "Api/Statistics/GetOrderAchievementStatistics", new { - globalContext.User.Shop.ShopId, + shopId, startTime, endTime }, diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index c2bdb51a..b66a121a 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -31,10 +31,10 @@ namespace BBWY.Client string userToken = string.Empty; #if DEBUG //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; //刷单组测试 - //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs"; + userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs"; //齐越愉辰 //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyNDU1MzExNDYyNDAwIiwidGVhbUlkIjoiMTQzOTg5ODYxNzM1ODg0ODAwMCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUwNDA0ODZ9.0TvEhPzTeKvpQY31E5YhgfvRBJHYdvwWRrEHNnF9kkA"; //齐越悠仁 diff --git a/BBWY.Client/Resources/Themes/Path.xaml b/BBWY.Client/Resources/Themes/Path.xaml index 53260ddb..16ab78e7 100644 --- a/BBWY.Client/Resources/Themes/Path.xaml +++ b/BBWY.Client/Resources/Themes/Path.xaml @@ -34,4 +34,8 @@ + + \ No newline at end of file diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index b24cd428..36b850c1 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -192,11 +192,13 @@ namespace BBWY.Client.ViewModels CreateMenu(); - if (GlobalContext.User.TeamName == "刷单组") - return; + //if (GlobalContext.User.TeamName == "刷单组") + // return; IList departmentList = null; - if (managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) + if (GlobalContext.User.TeamName == "刷单组" || + managerDepartment.Contains(GlobalContext.User.TeamName) || + managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m))) { ShowShopChoosePanel = true; var response = shopService.GetDepartmentList(); @@ -221,11 +223,14 @@ namespace BBWY.Client.ViewModels else ShowShopChoosePanel = true; } - GlobalContext.User.DepartmentList = departmentList; + + if (GlobalContext.User.TeamName == "刷单组") + return; + App.Current.Dispatcher.Invoke(() => { - var selectShop = new SelectShop(departmentList); + var selectShop = new SelectShopW(departmentList); if (selectShop.ShowDialog() == true) { ChooseShop(selectShop.Shop, true); @@ -250,7 +255,7 @@ namespace BBWY.Client.ViewModels { try { - var selectShop = new SelectShop(GlobalContext.User.DepartmentList); + var selectShop = new SelectShopW(GlobalContext.User.DepartmentList); if (selectShop.ShowDialog() == true) { ChooseShop(selectShop.Shop, true); diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index e1d71119..98dfdce0 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -45,7 +45,7 @@ namespace BBWY.Client.ViewModels private bool excludeCanceled; private bool onlyUnhandle; private Random random; - private GlobalContext globalContext; + public GlobalContext globalContext { get; set; } private bool? includeAfterOrder; private bool includeExceptionOrder; private decimal currentConditionsTotalProfit; @@ -58,7 +58,7 @@ namespace BBWY.Client.ViewModels public IList OrderList { get; set; } - public IList AfterSaleOrderList { get; set; } + public IList AfterSaleOrderList { get; set; } public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } @@ -181,7 +181,6 @@ namespace BBWY.Client.ViewModels { PageIndex = 1; Task.Factory.StartNew(() => LoadOrder(1)); //手动点击查询订单 - Task.Factory.StartNew(() => LoadTodayAchievement(StartDate, EndDate)); }); SyncOrderCommand = new RelayCommand(SyncOrder); CopyTextCommand = new RelayCommand(s => @@ -205,12 +204,10 @@ namespace BBWY.Client.ViewModels StartDate = DateTime.Now.Date.AddDays(d * -1); PageIndex = 1; Task.Factory.StartNew(() => LoadOrder(1)); //点击日期查询订单 - Task.Factory.StartNew(() => LoadTodayAchievement(StartDate, EndDate)); }); OrderPageIndexChangedCommand = new RelayCommand(p => { Task.Factory.StartNew(() => LoadOrder(p.PageIndex)); - Task.Factory.StartNew(() => LoadTodayAchievement(StartDate, EndDate)); }); DecodeConsigneeCommand = new RelayCommand(DecodeConsignee); ChooseStorageTypeCommand = new RelayCommand(ChooseStorageType); @@ -353,7 +350,16 @@ namespace BBWY.Client.ViewModels LoadAfterSaleOrder(pageIndex); else LoadNormalOrder(pageIndex); - LoadOrderCount(); + + if (!IsSDGroup) + { + Task.Factory.StartNew(() => LoadTodayAchievement(StartDate, EndDate, queryShopId.Value)); + Task.Factory.StartNew(() => LoadOrderCount(StartDate, EndDate, queryShopId.Value)); + } + else + { + + } } private void LoadNormalOrder(int pageIndex) @@ -434,17 +440,17 @@ namespace BBWY.Client.ViewModels IsLoading = false; } - private void LoadTodayAchievement(DateTime startTime, DateTime endTime) + private void LoadTodayAchievement(DateTime startTime, DateTime endTime, long shopId) { - var response = statisticsService.GetTodayAchievementStatistics(startTime, endTime); + var response = statisticsService.GetTodayAchievementStatistics(startTime, endTime, shopId); if (!response.Success) return; _ = response.Data.Map(ToDayOrderAchievement); } - private void LoadOrderCount() + private void LoadOrderCount(DateTime startDate, DateTime endDate, long shopId) { - var response = statisticsService.GetOrderCountStatistics(globalContext.User.Shop.ShopId, StartDate, EndDate); + var response = statisticsService.GetOrderCountStatistics(shopId, startDate, endDate); if (!response.Success) return; WaitPurchaseOrderCount = response.Data.WaitPurchaseCount; diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs index 6c753537..78c59700 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel_SDGroup.cs @@ -1,4 +1,5 @@ -using GalaSoft.MvvmLight.Command; +using BBWY.Client.Models; +using GalaSoft.MvvmLight.Command; using System.Windows.Input; namespace BBWY.Client.ViewModels @@ -6,11 +7,14 @@ namespace BBWY.Client.ViewModels public partial class OrderListViewModel { private int sdGroupButtonIndex; + private Shop sdGroupSelectedShop; public int SDGroupButtonIndex { get => sdGroupButtonIndex; set { Set(ref sdGroupButtonIndex, value); }} public ICommand SetSDButtinIndexCommand { get; set; } + public Shop SdGroupSelectedShop { get => sdGroupSelectedShop; set { Set(ref sdGroupSelectedShop, value); } } + private void SDGroupInit() { diff --git a/BBWY.Client/Views/Order/SDGroup.xaml b/BBWY.Client/Views/Order/SDGroup.xaml index a34da986..2e77e4ec 100644 --- a/BBWY.Client/Views/Order/SDGroup.xaml +++ b/BBWY.Client/Views/Order/SDGroup.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BBWY.Client.Views.Order" xmlns:cmodel="clr-namespace:BBWY.Client.Models" + xmlns:selectShop="clr-namespace:BBWY.Client.Views.SelectShop" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" mc:Ignorable="d" @@ -27,7 +28,6 @@ - @@ -44,7 +44,19 @@ Command="{Binding SetSDButtinIndexCommand}" CommandParameter="{StaticResource d1}"/> - + + + + + + + + + + + @@ -110,6 +122,8 @@ Visibility="{Binding Visibility,ElementName=listbox_order}"/> + + diff --git a/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml b/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml new file mode 100644 index 00000000..75dff2e7 --- /dev/null +++ b/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml.cs b/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml.cs new file mode 100644 index 00000000..a31a0778 --- /dev/null +++ b/BBWY.Client/Views/SelectShop/SelectShopDialog.xaml.cs @@ -0,0 +1,66 @@ +using BBWY.Client.Models; +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; + +namespace BBWY.Client.Views.SelectShop +{ + /// + /// SelectShopDialog.xaml 的交互逻辑 + /// + public partial class SelectShopDialog : UserControl + { + + public Shop Shop { get; set; } + + public static readonly DependencyProperty DepartmentListProperty = DependencyProperty.Register("DepartmentList", typeof(IList), typeof(SelectShopDialog)); + public static readonly RoutedEvent OnShopChangedEvent = EventManager.RegisterRoutedEvent("OnShopChanged", RoutingStrategy.Bubble, typeof(EventHandler), typeof(SelectShopDialog)); + + public IList DepartmentList + { + get { return GetValue(DepartmentListProperty) as IList; } + set { SetValue(DepartmentListProperty, value); } + } + + public event RoutedEventHandler OnShopChanged + { + add { this.AddHandler(OnShopChangedEvent, value); } + remove { this.RemoveHandler(OnShopChangedEvent, value); } + } + + public SelectShopDialog() + { + InitializeComponent(); + } + + private void cbx_department_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + var d = cbx_department.SelectedItem as Department; + cbx_shop.ItemsSource = d.ShopList; + cbx_shop.SelectedIndex = 0; + } + + private void btn_ok_Click(object sender, RoutedEventArgs e) + { + popup.IsOpen = false; + Shop = cbx_shop.SelectedItem as Shop; + txtShopName.Text = Shop.ShopName; + var args = new OnShopChangedEventArgs(OnShopChangedEvent, this); + args.SelectedShop = Shop; + this.RaiseEvent(args); + } + + private void bd_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) + { + popup.IsOpen = true; + } + } + + public class OnShopChangedEventArgs : RoutedEventArgs + { + public OnShopChangedEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source) { } + + public Shop SelectedShop { get; set; } + } +} diff --git a/BBWY.Client/Views/SelectShop.xaml b/BBWY.Client/Views/SelectShop/SelectShopW.xaml similarity index 98% rename from BBWY.Client/Views/SelectShop.xaml rename to BBWY.Client/Views/SelectShop/SelectShopW.xaml index 9f2da93b..31e01ec1 100644 --- a/BBWY.Client/Views/SelectShop.xaml +++ b/BBWY.Client/Views/SelectShop/SelectShopW.xaml @@ -1,4 +1,4 @@ - /// SelectShop.xaml 的交互逻辑 /// - public partial class SelectShop : BWindow + public partial class SelectShopW : BWindow { public IList DepartmentList { get; set; } public Shop Shop { get; set; } - public SelectShop(IList departmentList) + public SelectShopW(IList departmentList) { InitializeComponent(); this.DepartmentList = departmentList;