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()
{
PurchaserList = new ObservableCollection<Purchaser>();
PurchasePlatformList = new List<PurchasePlatformModel>();
PurchasePlatformList = new List<Platform>();
}
private PurchasePlatformModel selectedPurchasePlatformModel;
private Platform selectedPurchasePlatformModel;
/// <summary>
/// 商品Id
@ -41,12 +41,12 @@ namespace BBWY.Client.Models
/// <summary>
/// 采购平台集合
/// </summary>
public IList<PurchasePlatformModel> PurchasePlatformList { get; set; }
public IList<Platform> PurchasePlatformList { get; set; }
/// <summary>
/// 选中的采购平台
/// </summary>
public PurchasePlatformModel SelectedPurchasePlatformModel
public Platform SelectedPurchasePlatformModel
{
get => selectedPurchasePlatformModel;
set { Set(ref selectedPurchasePlatformModel, value); }
@ -54,8 +54,8 @@ namespace BBWY.Client.Models
public void CreatePlatformList()
{
PurchasePlatformList.Add(new PurchasePlatformModel() { ProductId = this.Id, PurchasePlatform = Platform. });
PurchasePlatformList.Add(new PurchasePlatformModel() { ProductId = this.Id, PurchasePlatform = Platform. });
PurchasePlatformList.Add(Platform.);
PurchasePlatformList.Add(Platform.);
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 SearchCommand { get; set; }
public ICommand ProductPageIndexChangedCommand { get; set; }
public ICommand SwitchPurchasePlatformCommand { get; set; }
#endregion
#region Methods
@ -57,6 +59,7 @@ namespace BBWY.Client.ViewModels
AddPurchaserCommand = new RelayCommand<Product>(AddPurchaser);
EditPurchaserCommand = new RelayCommand<Purchaser>(EditPurchaser);
DeletePurchaserCommand = new RelayCommand<Purchaser>(DeletePurchaser);
SwitchPurchasePlatformCommand = new RelayCommand<object>(SwitchPurchasePlatform);
SearchCommand = new RelayCommand(() =>
{
PageIndex = 1;
@ -194,9 +197,9 @@ namespace BBWY.Client.ViewModels
/// 加载采购方案
/// </summary>
/// <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)
{
App.Current.Dispatcher.BeginInvoke((Action)delegate { MessageBox.Show(response.Msg, "获取采购方案"); });
@ -312,7 +315,7 @@ namespace BBWY.Client.ViewModels
Task.Factory.StartNew(() =>
{
IsLoading = true;
LoadPurchaseScheme(skuList);
LoadPurchaseScheme(skuList, product.SelectedPurchasePlatformModel);
IsLoading = false;
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

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

@ -18,6 +18,7 @@
</b:Interaction.Triggers>
<Page.Resources>
<ctr:ItemHeightConverter x:Key="itemHeightConverter"/>
<ctr:MultiParameterTransferConverter x:Key="mptConverter"/>
</Page.Resources>
<Grid>
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999"/>
@ -242,12 +243,18 @@
<DataTemplate>
<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}">
<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}"/>
<b:Interaction.Triggers>
<b:EventTrigger EventName="MouseLeftButtonDown">
<b:InvokeCommandAction Command="{Binding DataContext.SwitchStorageTypeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
CommandParameter="{Binding }"/>
<b:InvokeCommandAction Command="{Binding DataContext.SwitchPurchasePlatformCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<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:Interaction.Triggers>
</Grid>

Loading…
Cancel
Save