6 changed files with 230 additions and 4 deletions
@ -0,0 +1,101 @@ |
|||
<c:BWindow x:Class="BBWY.Client.Views.SealBox.AddProductWindow" |
|||
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" |
|||
|
|||
mc:Ignorable="d" |
|||
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
|||
WindowStartupLocation="CenterScreen" |
|||
CloseButtonVisibility="Visible" |
|||
xmlns:hc="https://handyorg.github.io/handycontrol" |
|||
CloseButtonColor="{StaticResource WindowButtonColor}" |
|||
MinButtonVisibility="Collapsed" |
|||
MaxButtonVisibility="Collapsed" |
|||
Width="450" Height="400" |
|||
RightButtonGroupMargin="0,5,5,0"> |
|||
<!--CloseButtonColor="{StaticResource WindowButtonColor}" ResizeMode="NoResize" --> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="39"/> |
|||
<RowDefinition/> |
|||
<RowDefinition Height="36"/> |
|||
|
|||
</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" Margin="20 20 20 20"> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="40"/> |
|||
<RowDefinition/> |
|||
</Grid.RowDefinitions> |
|||
<Grid > |
|||
<c:BTextBox Height="35" Text="{Binding SkuId}" WaterRemark="请输入SKU" HorizontalAlignment="Stretch" /> |
|||
<c:BButton Height="35" Content="查询" HorizontalAlignment="Right" Width="120" Click="BButton_Click_1"/> |
|||
</Grid> |
|||
<Grid Grid.Row="1" |
|||
Visibility="{Binding Logo,Converter={StaticResource objConverter},ConverterParameter=#null:Collapsed:Visible}" |
|||
> |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="150"/> |
|||
<ColumnDefinition/> |
|||
|
|||
</Grid.ColumnDefinitions> |
|||
<c:BAsyncImage Height="150" Width="150" UrlSource="{Binding Logo}" |
|||
|
|||
/> |
|||
<UniformGrid Grid.Column="1" Rows="3" Height="150" Margin="20 0 0 0" > |
|||
<Grid > |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="40"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="名称:" Style="{StaticResource middleTextBlock}"/> |
|||
<TextBlock Text="{Binding SkuTitle}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center"/> |
|||
</Grid> |
|||
<Grid > |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="40"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="数量:" Style="{StaticResource middleTextBlock}"/> |
|||
<c:BTextBox WaterRemark="数量" Text="{Binding Count,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" HorizontalAlignment="Stretch" /> |
|||
</Grid> |
|||
<Grid > |
|||
<Grid.ColumnDefinitions> |
|||
<ColumnDefinition Width="40"/> |
|||
<ColumnDefinition/> |
|||
</Grid.ColumnDefinitions> |
|||
<TextBlock Text="仓库:" Style="{StaticResource middleTextBlock}"/> |
|||
<Grid Grid.Column="1" Height="30"> |
|||
<Rectangle Height="30" Stroke="{StaticResource Border.Brush}" StrokeThickness="1"/> |
|||
<ComboBox Height="30" ItemsSource="{Binding PositionTypes}" Text="{Binding PositionType}" BorderThickness="0" Margin="1" > |
|||
<ComboBox.Resources> |
|||
<ResourceDictionary> |
|||
<ResourceDictionary.MergedDictionaries > |
|||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/> |
|||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/> |
|||
</ResourceDictionary.MergedDictionaries> |
|||
</ResourceDictionary> |
|||
</ComboBox.Resources> |
|||
</ComboBox> |
|||
|
|||
</Grid> |
|||
</Grid> |
|||
</UniformGrid> |
|||
</Grid> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</Grid> |
|||
|
|||
<Border Height="1" Background="{StaticResource Border.Brush}" Grid.Row="2" VerticalAlignment="Top"/> |
|||
<c:BButton Grid.Row="2" Content="保存" HorizontalAlignment="Right" Width="105" VerticalAlignment="Center" Height="40" Click="BButton_Click" |
|||
/> |
|||
|
|||
</Grid> |
|||
</c:BWindow> |
@ -0,0 +1,94 @@ |
|||
using BBWY.Client.APIServices; |
|||
using BBWY.Client.Models; |
|||
using BBWY.Controls; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Collections.ObjectModel; |
|||
using System.Linq; |
|||
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; |
|||
using WebSocketSharp; |
|||
|
|||
namespace BBWY.Client.Views.SealBox |
|||
{ |
|||
/// <summary>
|
|||
/// AddProductWindow.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class AddProductWindow : BWindow |
|||
{ |
|||
public AddProductWindow(PackTaskService packTaskService, ProductService productService) |
|||
{ |
|||
this. packTaskService = packTaskService; |
|||
this. productService = productService; |
|||
InitializeComponent(); |
|||
this.DataContext = this; |
|||
} |
|||
ProductService productService; |
|||
PackTaskService packTaskService; |
|||
private int count; |
|||
public int Count { get => count; set { Set(ref count, value); } } |
|||
|
|||
private string skuId; |
|||
public string SkuId { get=>skuId; set { Set(ref skuId, value); } } |
|||
|
|||
private string logo; |
|||
public string Logo { get => logo; set { Set(ref logo, value); } } |
|||
|
|||
private string skuTitle; |
|||
public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } } |
|||
|
|||
|
|||
public ObservableCollection<PositionType> PositionTypes { get; set; }=new ObservableCollection<PositionType>() { |
|||
PositionType.商家仓, PositionType.云仓, PositionType.京仓, PositionType.聚水潭 |
|||
}; |
|||
|
|||
private PositionType positionType; |
|||
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } } |
|||
|
|||
private void BButton_Click(object sender, RoutedEventArgs e) |
|||
{ |
|||
if (Count<=0) |
|||
{ |
|||
MessageBox.Show("请输入任务数"); return; |
|||
} |
|||
var res = packTaskService.AddSealBoxProduct(SkuId, PositionType, Count); |
|||
|
|||
if (res == null || !res.Success) |
|||
{ |
|||
MessageBox.Show(res?.Msg); return; |
|||
} |
|||
|
|||
this.Close(); |
|||
} |
|||
|
|||
private void BButton_Click_1(object sender, RoutedEventArgs e) |
|||
{ |
|||
if (SkuId.IsNullOrEmpty()) |
|||
{ |
|||
MessageBox.Show("请输入SkuId"); return; |
|||
} |
|||
SkuId = SkuId.Trim(); |
|||
var res = productService.GetProductSkuList(null, SkuId); |
|||
if (res==null||!res.Success) |
|||
{ |
|||
MessageBox.Show(res?.Msg);return; |
|||
} |
|||
var productSku = res.Data.SingleOrDefault(d => d.Id == SkuId); |
|||
|
|||
if (productSku==null) |
|||
{ |
|||
MessageBox.Show("不存在对应的sku商品数据."); return; |
|||
} |
|||
SkuTitle = productSku.Title; |
|||
Logo= productSku.Logo.Replace("80x80","150x150"); |
|||
|
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue