shanji 3 years ago
parent
commit
1a17e3575c
  1. 4
      BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs
  2. 18
      BBWY.Client/Models/Shop/Department2.cs
  3. 4
      BBWY.Client/Models/Shop/Shop.cs
  4. 7
      BBWY.Client/Models/User/User.cs
  5. 37
      BBWY.Client/ViewModels/MainViewModel.cs
  6. 55
      BBWY.Client/Views/SelectShop.xaml
  7. 36
      BBWY.Client/Views/SelectShop.xaml.cs

4
BBWY.Client/Models/APIModel/Response/Shop/ShopResponse.cs

@ -25,5 +25,9 @@ namespace BBWY.Client.Models
public string ManagePwd { get; set; }
public decimal? PlatformCommissionRatio { get; set; }
public string TeamId { get; set; }
public string TeamName { get; set; }
}
}

18
BBWY.Client/Models/Shop/Department2.cs

@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace BBWY.Client.Models
{
public class Department2
{
public string Id { get; set; }
public string Name { get; set; }
public IList<Shop> ShopList { get; set; }
public Department2()
{
ShopList = new List<Shop>();
}
}
}

4
BBWY.Client/Models/Shop/Shop.cs

@ -36,5 +36,9 @@ namespace BBWY.Client.Models
/// 店铺扣点
/// </summary>
public decimal? PlatformCommissionRatio { get; set; }
public string TeamId { get; set; }
public string TeamName { get; set; }
}
}

7
BBWY.Client/Models/User/User.cs

@ -1,4 +1,7 @@
namespace BBWY.Client.Models
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace BBWY.Client.Models
{
public class User : NotifyObject
{
@ -20,5 +23,7 @@
public string TeamName { get; set; }
public Shop Shop { get => shop; set { Set(ref shop, value); } }
public IList<Department2> DepartmentList { get; set; }
}
}

37
BBWY.Client/ViewModels/MainViewModel.cs

@ -1,5 +1,6 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.Views;
using BBWY.Common.Extensions;
using BBWY.Common.Http;
using BBWY.Common.Models;
@ -188,16 +189,44 @@ namespace BBWY.Client.ViewModels
var shopList = shopListResponse.Data.Map<IList<Shop>>();
if (shopList.Count == 1)
{
ShowShopChoosePanel = false;
ChooseShop(shopList[0], true);
}
else
{
ShowShopChoosePanel = true;
IList<Department2> department2s = new List<Department2>();
foreach (var shop in shopList)
{
var department = department2s.FirstOrDefault(d => d.Id == shop.TeamId);
if (department == null)
{
department = new Department2() { Id = shop.TeamId, Name = shop.TeamName };
department2s.Add(department);
}
department.ShopList.Add(shop);
}
GlobalContext.User.DepartmentList = department2s;
App.Current.Dispatcher.Invoke(() =>
{
foreach (var s in shopList)
ShopList.Add(s);
var selectShop = new SelectShop(department2s);
if (selectShop.ShowDialog() == true)
{
ChooseShop(selectShop.Shop, true);
}
else
{
Environment.Exit(Environment.ExitCode);
}
});
ShowShopChoosePanel = true;
//App.Current.Dispatcher.Invoke(() =>
//{
// foreach (var s in shopList)
// ShopList.Add(s);
//});
//ShowShopChoosePanel = true;
}
}
}
@ -230,7 +259,7 @@ namespace BBWY.Client.ViewModels
}
GlobalContext.User.Shop = shop;
ShowShopChoosePanel = false;
//ShowShopChoosePanel = false;
Task.Factory.StartNew(GetLogisticsList);
}

55
BBWY.Client/Views/SelectShop.xaml

@ -0,0 +1,55 @@
<c:BWindow x:Class="BBWY.Client.Views.SelectShop"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BBWY.Client.Views"
mc:Ignorable="d"
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls"
Title="SelectShop" Height="200" Width="300"
CloseButtonVisibility="Visible"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}"
Background="{StaticResource Border.Background}">
<TextBlock Text="选择店铺" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<Grid Grid.Row="1" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="团队" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox x:Name="cbx_department"
ItemsSource="{Binding DepartmentList,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type c:BWindow}}}"
SelectedIndex="0"
DisplayMemberPath="Name"
Width="150" Height="25"
HorizontalAlignment="Left" VerticalContentAlignment="Center"
Grid.Column="1" Margin="5,5,0,5"/>
<TextBlock Text="店铺" HorizontalAlignment="Right" Grid.Row="1" VerticalAlignment="Center" />
<ComboBox x:Name="cbx_shop" Width="150" Height="25"
SelectedIndex="0"
HorizontalAlignment="Left" VerticalContentAlignment="Center"
DisplayMemberPath="Name"
Grid.Column="1" Grid.Row="1" Margin="5,5,0,5"/>
</Grid>
<c:BButton x:Name="btn_ok" Content="确定" Grid.Row="2" Width="60" HorizontalAlignment="Right" Margin="0,0,8,0"
Click="btn_ok_Click"/>
</Grid>
</c:BWindow>

36
BBWY.Client/Views/SelectShop.xaml.cs

@ -0,0 +1,36 @@
using BBWY.Client.Models;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace BBWY.Client.Views
{
/// <summary>
/// SelectShop.xaml 的交互逻辑
/// </summary>
public partial class SelectShop : BWindow
{
public IList<Department2> DepartmentList { get; set; }
public Shop Shop { get; set; }
public SelectShop(IList<Department2> departmentList)
{
InitializeComponent();
this.DepartmentList = departmentList;
}
private void btn_ok_Click(object sender, RoutedEventArgs e)
{
}
}
}
Loading…
Cancel
Save