shanji 2 years ago
parent
commit
cb10535ff4
  1. 12
      BBWY.Client/Models/Product/Product.cs
  2. 18
      BBWY.Client/ViewModels/Ware/WareManagerViewModel.cs
  3. 13
      BBWY.Client/Views/Ware/WareManager.xaml

12
BBWY.Client/Models/Product/Product.cs

@ -8,10 +8,10 @@ namespace BBWY.Client.Models
public Product() public Product()
{ {
PurchaserList = new ObservableCollection<Purchaser>(); PurchaserList = new ObservableCollection<Purchaser>();
PurchasePlatformList = new List<PurchasePlatformModel>(); PurchasePlatformList = new List<Platform>();
} }
private PurchasePlatformModel selectedPurchasePlatformModel; private Platform selectedPurchasePlatformModel;
/// <summary> /// <summary>
/// 商品Id /// 商品Id
@ -41,12 +41,12 @@ namespace BBWY.Client.Models
/// <summary> /// <summary>
/// 采购平台集合 /// 采购平台集合
/// </summary> /// </summary>
public IList<PurchasePlatformModel> PurchasePlatformList { get; set; } public IList<Platform> PurchasePlatformList { get; set; }
/// <summary> /// <summary>
/// 选中的采购平台 /// 选中的采购平台
/// </summary> /// </summary>
public PurchasePlatformModel SelectedPurchasePlatformModel public Platform SelectedPurchasePlatformModel
{ {
get => selectedPurchasePlatformModel; get => selectedPurchasePlatformModel;
set { Set(ref selectedPurchasePlatformModel, value); } set { Set(ref selectedPurchasePlatformModel, value); }
@ -54,8 +54,8 @@ namespace BBWY.Client.Models
public void CreatePlatformList() public void CreatePlatformList()
{ {
PurchasePlatformList.Add(new PurchasePlatformModel() { ProductId = this.Id, PurchasePlatform = Platform. }); PurchasePlatformList.Add(Platform.);
PurchasePlatformList.Add(new PurchasePlatformModel() { ProductId = this.Id, PurchasePlatform = Platform. }); PurchasePlatformList.Add(Platform.);
SelectedPurchasePlatformModel = PurchasePlatformList[0]; SelectedPurchasePlatformModel = PurchasePlatformList[0];
} }
} }

18
BBWY.Client/ViewModels/Ware/WareManagerViewModel.cs

@ -49,6 +49,8 @@ namespace BBWY.Client.ViewModels
public ICommand DeletePurchaserCommand { get; set; } public ICommand DeletePurchaserCommand { get; set; }
public ICommand SearchCommand { get; set; } public ICommand SearchCommand { get; set; }
public ICommand ProductPageIndexChangedCommand { get; set; } public ICommand ProductPageIndexChangedCommand { get; set; }
public ICommand SwitchPurchasePlatformCommand { get; set; }
#endregion #endregion
#region Methods #region Methods
@ -57,6 +59,7 @@ namespace BBWY.Client.ViewModels
AddPurchaserCommand = new RelayCommand<Product>(AddPurchaser); AddPurchaserCommand = new RelayCommand<Product>(AddPurchaser);
EditPurchaserCommand = new RelayCommand<Purchaser>(EditPurchaser); EditPurchaserCommand = new RelayCommand<Purchaser>(EditPurchaser);
DeletePurchaserCommand = new RelayCommand<Purchaser>(DeletePurchaser); DeletePurchaserCommand = new RelayCommand<Purchaser>(DeletePurchaser);
SwitchPurchasePlatformCommand = new RelayCommand<object>(SwitchPurchasePlatform);
SearchCommand = new RelayCommand(() => SearchCommand = new RelayCommand(() =>
{ {
PageIndex = 1; PageIndex = 1;
@ -194,9 +197,9 @@ namespace BBWY.Client.ViewModels
/// 加载采购方案 /// 加载采购方案
/// </summary> /// </summary>
/// <param name="productList"></param> /// <param name="productList"></param>
private void LoadPurchaseScheme(IList<ProductSku> skuList) private void LoadPurchaseScheme(IList<ProductSku> skuList, Platform? platform = Platform.)
{ {
var response = purchaseService.GetPurchaseSchemeList(skuList.Select(s => s.Id).ToList(), string.Empty, globalContext.User.Shop.ShopId); var response = purchaseService.GetPurchaseSchemeList(skuList.Select(s => s.Id).ToList(), string.Empty, globalContext.User.Shop.ShopId, platform: platform);
if (!response.Success) if (!response.Success)
{ {
App.Current.Dispatcher.BeginInvoke((Action)delegate { MessageBox.Show(response.Msg, "获取采购方案"); }); App.Current.Dispatcher.BeginInvoke((Action)delegate { MessageBox.Show(response.Msg, "获取采购方案"); });
@ -312,7 +315,7 @@ namespace BBWY.Client.ViewModels
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{ {
IsLoading = true; IsLoading = true;
LoadPurchaseScheme(skuList); LoadPurchaseScheme(skuList, product.SelectedPurchasePlatformModel);
IsLoading = false; IsLoading = false;
App.Current.Dispatcher.BeginInvoke((Action)delegate App.Current.Dispatcher.BeginInvoke((Action)delegate
{ {
@ -321,6 +324,15 @@ namespace BBWY.Client.ViewModels
}); });
} }
} }
private void SwitchPurchasePlatform(object param)
{
var paramList = (object[])param;
var productId = paramList[0].ToString();
var platform = (Platform)paramList[1];
}
#endregion #endregion

13
BBWY.Client/Views/Ware/WareManager.xaml

@ -18,6 +18,7 @@
</b:Interaction.Triggers> </b:Interaction.Triggers>
<Page.Resources> <Page.Resources>
<ctr:ItemHeightConverter x:Key="itemHeightConverter"/> <ctr:ItemHeightConverter x:Key="itemHeightConverter"/>
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
</Page.Resources> </Page.Resources>
<Grid> <Grid>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/> <c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
@ -242,12 +243,18 @@
<DataTemplate> <DataTemplate>
<Grid x:Name="grid_purchasePlatform" Width="{Binding ActualWidth,ElementName=listbox_purchasePlatform,Converter={StaticResource widthConverter},ConverterParameter=7}" Margin="5,5,5,0" Height="25" <Grid x:Name="grid_purchasePlatform" Width="{Binding ActualWidth,ElementName=listbox_purchasePlatform,Converter={StaticResource widthConverter},ConverterParameter=7}" Margin="5,5,5,0" Height="25"
Background="{StaticResource Button.Normal.Background}"> Background="{StaticResource Button.Normal.Background}">
<TextBlock x:Name="txt_Platform" Text="{Binding PurchasePlatform}" HorizontalAlignment="Center" VerticalAlignment="Center" <TextBlock x:Name="txt_Platform" Text="{Binding }" HorizontalAlignment="Center" VerticalAlignment="Center"
Foreground="{StaticResource Text.Color}"/> Foreground="{StaticResource Text.Color}"/>
<b:Interaction.Triggers> <b:Interaction.Triggers>
<b:EventTrigger EventName="MouseLeftButtonDown"> <b:EventTrigger EventName="MouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.SwitchStorageTypeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}" <b:InvokeCommandAction Command="{Binding DataContext.SwitchPurchasePlatformCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
CommandParameter="{Binding }"/> <b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/>
<Binding Path="."/>
</MultiBinding>
</b:InvokeCommandAction.CommandParameter>
</b:InvokeCommandAction>
</b:EventTrigger> </b:EventTrigger>
</b:Interaction.Triggers> </b:Interaction.Triggers>
</Grid> </Grid>

Loading…
Cancel
Save