Browse Source

SD组登录逻辑调整

qianyi
shanji 3 years ago
parent
commit
47eb80e66f
  1. 8
      BBWY.Client/APIServices/OrderService.cs
  2. 6
      BBWY.Client/App.xaml.cs
  3. 93
      BBWY.Client/ViewModels/MainViewModel.cs
  4. 25
      BBWY.Client/ViewModels/Order/OrderListViewModel.cs
  5. 23
      BBWY.Client/Views/Order/OrderList.xaml

8
BBWY.Client/APIServices/OrderService.cs

@ -26,11 +26,12 @@ namespace BBWY.Client.APIServices
string contactName, string contactName,
int pageIndex, int pageIndex,
int pageSize, int pageSize,
long shopId, long? shopId,
bool onlyDF, bool onlyDF,
bool excludeSD, bool excludeSD,
bool excludeCanceled, bool excludeCanceled,
bool includeExceptionOrder) bool includeExceptionOrder,
string sdOperator)
{ {
return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new return SendRequest<OrderListResponse>(globalContext.BBYWApiHost, "api/order/getOrderList", new
{ {
@ -49,7 +50,8 @@ namespace BBWY.Client.APIServices
onlyDF, onlyDF,
excludeSD, excludeSD,
excludeCanceled, excludeCanceled,
includeExceptionOrder includeExceptionOrder,
sdOperator
}, null, HttpMethod.Post); }, null, HttpMethod.Post);
} }

6
BBWY.Client/App.xaml.cs

@ -8,7 +8,6 @@ using Microsoft.Extensions.DependencyInjection;
using System; using System;
using System.IO; using System.IO;
using System.IO.MemoryMappedFiles; using System.IO.MemoryMappedFiles;
using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
@ -33,8 +32,11 @@ namespace BBWY.Client
#if DEBUG #if DEBUG
//齐越山鸡 //齐越山鸡
//userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw"; //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw";
//刷单组测试
userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTcxODUyODE0OTAzMTUyNjQwIiwidGVhbUlkIjoiMTU3MTg1MjQ1MDI5NjUwMDIyNCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUxNDc2ODh9.hVupdHnhgHHGo3QrMSDqhINqtq6Q5_RovWyXjiMkkEs";
//齐越愉辰 //齐越愉辰
userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyNDU1MzExNDYyNDAwIiwidGVhbUlkIjoiMTQzOTg5ODYxNzM1ODg0ODAwMCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUwNDA0ODZ9.0TvEhPzTeKvpQY31E5YhgfvRBJHYdvwWRrEHNnF9kkA"; //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyNDU1MzExNDYyNDAwIiwidGVhbUlkIjoiMTQzOTg5ODYxNzM1ODg0ODAwMCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTUwNDA0ODZ9.0TvEhPzTeKvpQY31E5YhgfvRBJHYdvwWRrEHNnF9kkA";
//齐越悠仁 //齐越悠仁
//userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyMzAxODIwOTA3NTIwIiwidGVhbUlkIjoiMTQzOTg5ODU5MzE3MDI5NjgzMiIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTQ4NjU2NjR9.yQlRKUnnXl4cEzvqRwd-BSktGuW6-AAHLuCicp7f-EM"; //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNDM5OTEyMzAxODIwOTA3NTIwIiwidGVhbUlkIjoiMTQzOTg5ODU5MzE3MDI5NjgzMiIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTQ4NjU2NjR9.yQlRKUnnXl4cEzvqRwd-BSktGuW6-AAHLuCicp7f-EM";
//齐越小戴 //齐越小戴

93
BBWY.Client/ViewModels/MainViewModel.cs

@ -100,46 +100,72 @@ namespace BBWY.Client.ViewModels
ShopList = new ObservableCollection<Shop>(); ShopList = new ObservableCollection<Shop>();
MenuList = new ObservableCollection<MenuModel>() MenuList = new ObservableCollection<MenuModel>()
{ {
new MenuModel()
};
Task.Factory.StartNew(Login);
if (!CheckWebview2Runtime())
{
//下载webview2 runtime
Task.Factory.StartNew(DownloadWebview2Runtime);
}
}
private void CreateMenu()
{
if (GlobalContext.User.TeamName == "刷单组")
{
App.Current.Dispatcher.Invoke(() => MenuList.Add(new MenuModel()
{
Name = "订单管理",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="刷单组",Url="/Views/Order/SDOrderList.xaml" }
}
}));
return;
}
App.Current.Dispatcher.Invoke(() =>
{
MenuList.Add(new MenuModel()
{ {
Name="订单管理",ChildList=new List<MenuModel>() Name = "订单管理",
ChildList = new List<MenuModel>()
{ {
new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" }, new MenuModel(){ Name="最近订单",Url="/Views/Order/OrderList.xaml" }
//new MenuModel(){ Name="售后管理",Url="/Views/Order/OrderList.xaml" }
} }
}, });
new MenuModel() MenuList.Add(new MenuModel()
{ {
Name="商品管理",ChildList=new List<MenuModel>() Name = "商品管理",
ChildList = new List<MenuModel>()
{ {
new MenuModel(){ Name="货源管理",Url="/Views/Ware/WareManager.xaml" }, new MenuModel(){ Name="货源管理",Url="/Views/Ware/WareManager.xaml" },
new MenuModel(){ Name="产品库存",Url="/Views/Ware/WareStock.xaml" } new MenuModel(){ Name="产品库存",Url="/Views/Ware/WareStock.xaml" }
} }
}, });
new MenuModel() MenuList.Add(new MenuModel()
{ {
Name="设置",ChildList=new List<MenuModel>() Name = "设置",
ChildList = new List<MenuModel>()
{ {
new MenuModel(){ Name="店铺设置",Url="/Views/Setting/ShopSetting.xaml" }, new MenuModel(){ Name="店铺设置",Url="/Views/Setting/ShopSetting.xaml" },
new MenuModel(){ Name="团队配置",Url="/Views/Setting/TeamSetting.xaml" } new MenuModel(){ Name="团队配置",Url="/Views/Setting/TeamSetting.xaml" }
} }
}, });
new MenuModel() });
{
Name="财务端",ChildList=new List<MenuModel>()
{
new MenuModel(){ Name="采购审计",Url="/Views/FinancialTerminal/ProcurementAudit.xaml" }
//new MenuModel(){ Name="补单审计",Url="/Views/FinancialTerminal/ShopSetting.xaml" },
//new MenuModel(){ Name="利润表",Url="/Views/FinancialTerminal/ShopSetting.xaml" }
}
}
};
Task.Factory.StartNew(Login);
if (!CheckWebview2Runtime()) if (managerDepartment.Contains(GlobalContext.User.TeamName) && managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m)))
{ {
//下载webview2 runtime App.Current.Dispatcher.Invoke(() => MenuList.Add(new MenuModel()
Task.Factory.StartNew(DownloadWebview2Runtime); {
Name = "财务端",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="采购审计",Url="/Views/FinancialTerminal/ProcurementAudit.xaml" }
}
}));
} }
} }
@ -160,22 +186,17 @@ namespace BBWY.Client.ViewModels
throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}");
GlobalContext.User = mdsUserResponse.Data.Map<User>(); GlobalContext.User = mdsUserResponse.Data.Map<User>();
GlobalContext.User.SonDepartmentNames = string.Empty;
if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0) if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0)
GlobalContext.User.SonDepartmentNames = string.Join(',', mdsUserResponse.Data.SonDepartmentList.Select(sd => sd.DepartmentName)); GlobalContext.User.SonDepartmentNames = string.Join(',', mdsUserResponse.Data.SonDepartmentList.Select(sd => sd.DepartmentName));
#if RELEASE CreateMenu();
if (!managerDepartment.Contains(GlobalContext.User.TeamName) && !managerDepartment.Any(m =>!string.IsNullOrEmpty(GlobalContext.User.SonDepartmentNames) && GlobalContext.User.SonDepartmentNames.Contains(m))) //非管理账号,屏蔽财务端
{
App.Current.Dispatcher.Invoke(() =>
{
MenuList.RemoveAt(MenuList.Count() - 1);
});
}
#endif if (GlobalContext.User.TeamName == "刷单组")
IList<Department> departmentList = null; return;
if (managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => !string.IsNullOrEmpty(GlobalContext.User.SonDepartmentNames) && GlobalContext.User.SonDepartmentNames.Contains(m))) IList<Department> departmentList = null;
if (managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m)))
{ {
ShowShopChoosePanel = true; ShowShopChoosePanel = true;
var response = shopService.GetDepartmentList(); var response = shopService.GetDepartmentList();

25
BBWY.Client/ViewModels/Order/OrderListViewModel.cs

@ -52,6 +52,9 @@ namespace BBWY.Client.ViewModels
private string searchServiceId; private string searchServiceId;
private long waitPurchaseOrderCount; private long waitPurchaseOrderCount;
private long exceptionOrderCount; private long exceptionOrderCount;
private long? queryShopId;
private string querySDOperator;
private bool isSDGroup;
public IList<Order> OrderList { get; set; } public IList<Order> OrderList { get; set; }
@ -140,10 +143,25 @@ namespace BBWY.Client.ViewModels
public bool IncludeExceptionOrder { get => includeExceptionOrder; set { Set(ref includeExceptionOrder, value); } } public bool IncludeExceptionOrder { get => includeExceptionOrder; set { Set(ref includeExceptionOrder, value); } }
public long WaitPurchaseOrderCount { get => waitPurchaseOrderCount; set { Set(ref waitPurchaseOrderCount, value); } } public long WaitPurchaseOrderCount { get => waitPurchaseOrderCount; set { Set(ref waitPurchaseOrderCount, value); } }
public long ExceptionOrderCount { get => exceptionOrderCount; set { Set(ref exceptionOrderCount , value); } } public long ExceptionOrderCount { get => exceptionOrderCount; set { Set(ref exceptionOrderCount, value); } }
/// <summary>
/// 是否为刷单组
/// </summary>
public bool IsSDGroup { get => isSDGroup; set { Set(ref isSDGroup, value); } }
public OrderListViewModel(OrderService orderService, StatisticsService statisticsService, AfterOrderService afterOrderService, GlobalContext globalContext, ChoosePurchaseSchemeViewModel choosePurchaseSchemeViewModel) public OrderListViewModel(OrderService orderService, StatisticsService statisticsService, AfterOrderService afterOrderService, GlobalContext globalContext, ChoosePurchaseSchemeViewModel choosePurchaseSchemeViewModel)
{ {
IsSDGroup = globalContext.User.TeamName == "刷单组";
if (IsSDGroup)
{
querySDOperator = globalContext.User.Name;
}
else
{
queryShopId = globalContext.User.Shop.ShopId;
}
random = new Random(); random = new Random();
this.globalContext = globalContext; this.globalContext = globalContext;
this.orderService = orderService; this.orderService = orderService;
@ -352,11 +370,12 @@ namespace BBWY.Client.ViewModels
SearchContactName, SearchContactName,
pageIndex, pageIndex,
pageSize, pageSize,
globalContext.User.Shop.ShopId, queryShopId,
OnlyDF, OnlyDF,
ExcludeSD, ExcludeSD,
ExcludeCanceled, ExcludeCanceled,
IncludeExceptionOrder); IncludeExceptionOrder,
querySDOperator);
if (!response.Success) if (!response.Success)
{ {
IsLoading = false; IsLoading = false;

23
BBWY.Client/Views/Order/OrderList.xaml

@ -57,7 +57,8 @@
<!--Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}" <!--Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}"--> Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=#null:White:#4A4A4A}"-->
<c:BButton Content="近一个月订单" Width="100" <c:BButton Content="近一个月订单" Width="100"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Null}"> Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Null}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}">
<c:BButton.Background> <c:BButton.Background>
<MultiBinding Converter="{StaticResource mobjConverter}" <MultiBinding Converter="{StaticResource mobjConverter}"
ConverterParameter=";;false:&amp;:#8080FF:#F2F2F2:6"> ConverterParameter=";;false:&amp;:#8080FF:#F2F2F2:6">
@ -68,7 +69,7 @@
</c:BButton.Background> </c:BButton.Background>
<c:BButton.Foreground> <c:BButton.Foreground>
<MultiBinding Converter="{StaticResource mobjConverter}" <MultiBinding Converter="{StaticResource mobjConverter}"
ConverterParameter=";:&amp;:#FFFFFF:#4A4A4A:6"> ConverterParameter=";;false:&amp;:White:#4A4A4A:6">
<Binding Path="OrderState"/> <Binding Path="OrderState"/>
<Binding Path="IncludeAfterOrder"/> <Binding Path="IncludeAfterOrder"/>
<Binding Path="IncludeExceptionOrder"/> <Binding Path="IncludeExceptionOrder"/>
@ -78,7 +79,8 @@
<c:BButton Width="100" <c:BButton Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:#8080FF:#F2F2F2}" Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:White:#4A4A4A}" Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=等待采购:White:#4A4A4A}"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.等待采购}"> Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.等待采购}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}">
<c:BButton.Content> <c:BButton.Content>
<TextBlock> <TextBlock>
<Run Text="等待采购"/> <Run Text="等待采购"/>
@ -102,19 +104,23 @@
<c:BButton Content="待付款" Width="100" <c:BButton Content="待付款" Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}" Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}" Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=待付款:White:#4A4A4A}"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待付款}"/> Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.待付款}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}"/>
<c:BButton Content="锁定" Width="100" <c:BButton Content="锁定" Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:#8080FF:#F2F2F2}" Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:White:#4A4A4A}" Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=锁定:White:#4A4A4A}"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.锁定}"/> Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.锁定}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}"/>
<c:BButton Content="已取消" Width="100" <c:BButton Content="已取消" Width="100"
Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:#8080FF:#F2F2F2}" Background="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:#8080FF:#F2F2F2}"
Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:White:#4A4A4A}" Foreground="{Binding OrderState,Converter={StaticResource objConverter},ConverterParameter=已取消:White:#4A4A4A}"
Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.已取消}"/> Command="{Binding SetOrderStateCommand}" CommandParameter="{x:Static cmodel:OrderState.已取消}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}"/>
<c:BButton Width="100" <c:BButton Width="100"
Background="{Binding IncludeExceptionOrder,Converter={StaticResource objConverter},ConverterParameter=true:#8080FF:#F2F2F2}" Background="{Binding IncludeExceptionOrder,Converter={StaticResource objConverter},ConverterParameter=true:#8080FF:#F2F2F2}"
Foreground="{Binding IncludeExceptionOrder,Converter={StaticResource objConverter},ConverterParameter=true:White:#4A4A4A}" Foreground="{Binding IncludeExceptionOrder,Converter={StaticResource objConverter},ConverterParameter=true:White:#4A4A4A}"
Command="{Binding SetIncludeExceptionOrderCommand}"> Command="{Binding SetIncludeExceptionOrderCommand}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}">
<c:BButton.Content> <c:BButton.Content>
<TextBlock> <TextBlock>
<Run Text="异常单"/> <Run Text="异常单"/>
@ -126,7 +132,8 @@
<c:BButton Content="售后单" Width="100" <c:BButton Content="售后单" Width="100"
Background="{Binding IncludeAfterOrder,Converter={StaticResource objConverter},ConverterParameter=true:#8080FF:#F2F2F2}" Background="{Binding IncludeAfterOrder,Converter={StaticResource objConverter},ConverterParameter=true:#8080FF:#F2F2F2}"
Foreground="{Binding IncludeAfterOrder,Converter={StaticResource objConverter},ConverterParameter=true:White:#4A4A4A}" Foreground="{Binding IncludeAfterOrder,Converter={StaticResource objConverter},ConverterParameter=true:White:#4A4A4A}"
Command="{Binding SetIncludeAfterOrderCommand}"/> Command="{Binding SetIncludeAfterOrderCommand}"
Visibility="{Binding IsSDGroup,ConverterParameter=true:Collapsed:Visible,Converter={StaticResource objConverter}}"/>
</StackPanel> </StackPanel>
<Grid Grid.Row="2" Background="{StaticResource Border.Background}"> <Grid Grid.Row="2" Background="{StaticResource Border.Background}">

Loading…
Cancel
Save