用户拍单可以通过商品选择sku
This commit is contained in:
1 parent
ec4d8073b3
commit
8e33d095f3
17 files changed
+1620
-616
No files matched your search
@@ -0,0 +1,128 @@
|
||||
<UserControl
|
||||
x:Class="_29WxOrderWpf.Ctrls.BuyerCtrls.SkuSelectListRowCtrl"
|
||||
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:local="clr-namespace:_29WxOrderWpf.Ctrls.BuyerCtrls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="150"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Border
|
||||
Margin="4"
|
||||
BorderBrush="LightSkyBlue"
|
||||
BorderThickness="1"
|
||||
CornerRadius="10">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
x:Name="imgSku"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Width="100"
|
||||
Height="100"
|
||||
Margin="8"
|
||||
VerticalAlignment="Top"
|
||||
Cursor="Hand"
|
||||
MouseDown="imgSku_MouseDown"
|
||||
MouseEnter="imgSku_MouseEnter"
|
||||
MouseLeave="imgSku_MouseLeave" />
|
||||
<Grid
|
||||
Grid.Column="1"
|
||||
Margin="0,8"
|
||||
VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<WrapPanel Visibility="{Binding SpecNameStr, Converter={StaticResource HasTextVisibility}}">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="商品标题:"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
d:Text="商品标题"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding GoodsNameStr}"
|
||||
TextWrapping="Wrap" />
|
||||
</WrapPanel>
|
||||
<WrapPanel Grid.Row="1" Visibility="{Binding SpecNameStr, Converter={StaticResource HasTextVisibility}}">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="商品规格:"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
d:Text="SKU规格"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
FontWeight="Bold"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding SpecNameStr}"
|
||||
TextWrapping="Wrap" />
|
||||
</WrapPanel>
|
||||
|
||||
<WrapPanel Grid.Row="2" Visibility="{Binding groupPrice, Converter={StaticResource HasTextVisibility}}">
|
||||
<TextBox
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="规格单价:"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Top"
|
||||
d:Opacity="0.5"
|
||||
d:Text="0.00"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding groupPrice}"
|
||||
TextWrapping="Wrap" />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
<Button
|
||||
x:Name="btnAdd"
|
||||
Grid.Column="100"
|
||||
MinWidth="48"
|
||||
MinHeight="28"
|
||||
Margin="8"
|
||||
Padding="4"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Click="btnAdd_Click"
|
||||
Content="确定关联"
|
||||
Style="{StaticResource BasePageButtonStyle}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,75 @@
|
||||
using _29WxOrderWpf.ViewModels;
|
||||
using AllBase;
|
||||
using AllBase.Model.DBModel;
|
||||
using AllBase.Model.Result;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace _29WxOrderWpf.Ctrls.BuyerCtrls;
|
||||
|
||||
/// <summary>
|
||||
/// SkuSelectListRowCtrl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SkuSelectListRowCtrl : UserControl
|
||||
{
|
||||
public SkuSelectListRowCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContextChanged += SkuSelectListRowCtrl_DataContextChanged;
|
||||
}
|
||||
|
||||
private void SkuSelectListRowCtrl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is frontSkuInfo3 frontSku)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
// 异步加载图片防止卡顿
|
||||
// 缩略图在有的电脑上无法显示
|
||||
//BitmapImage bImg = ImageUrlToBitmapImageConverter.LoadImageFromUrl(order_item.thumb_img + "?imageView2/1/w/100/format/webp|imageMogr2/auto-orient=");
|
||||
BitmapImage bImg = AllBase.ImageBuild.LoadBitmipImageFromUrl(frontSku.thumbUrl);
|
||||
Thread.Sleep(Randomx.GetId(200));
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
imgSku.Source = bImg;
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void imgSku_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void imgSku_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void imgSku_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async void btnAdd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is frontSkuInfo3 frontSku)
|
||||
{
|
||||
await BuyMapSkuViewModel.BuyMapSkuInstance.SetOrderMapSku(frontSku);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,24 +580,33 @@
|
||||
BorderThickness="0,0,0,1">
|
||||
<WrapPanel>
|
||||
<CheckBox
|
||||
x:Name="chkMapProdOnly"
|
||||
x:Name="chkNoMapProd"
|
||||
Margin="8,0,4,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{StaticResource mainColorBrush}"
|
||||
Click="chkMapProdOnly_Click"
|
||||
Content="已关联拍单"
|
||||
FontSize="12" />
|
||||
<CheckBox
|
||||
x:Name="chkNoMapProdOnly"
|
||||
Margin="8,0,4,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{StaticResource mainColorBrush}"
|
||||
Click="chkNoMapProdOnly_Click"
|
||||
Click="chkMapProd_Click"
|
||||
Content="未关联拍单"
|
||||
FontSize="12" />
|
||||
|
||||
<CheckBox
|
||||
x:Name="chkMapProd"
|
||||
Margin="8,0,4,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{StaticResource mainColorBrush}"
|
||||
Click="chkMapProd_Click"
|
||||
Content="已关联商品"
|
||||
FontSize="12" />
|
||||
<CheckBox
|
||||
x:Name="chkMapSku"
|
||||
Margin="8,0,4,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{StaticResource mainColorBrush}"
|
||||
Click="chkMapProd_Click"
|
||||
Content="已关联拍单"
|
||||
FontSize="12" />
|
||||
|
||||
<Button
|
||||
Width="Auto"
|
||||
|
||||
@@ -1512,9 +1512,11 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
{
|
||||
if (!order.IsWaitBuy)
|
||||
return true;
|
||||
if (chkMapProdOnly.IsChecked == true && order.orderItems.All(oi => oi.BuyMap == null))
|
||||
if (chkMapSku.IsChecked == true && order.orderItems.All(oi => oi.BuyMap == null && (oi.BuyMapSkus == null || oi.BuyMapSkus.Count == 0)))
|
||||
return true;
|
||||
if (chkNoMapProdOnly.IsChecked == true && order.orderItems.All(oi => oi.BuyMap != null))
|
||||
if (chkMapProd.IsChecked == true && order.orderItems.All(oi => oi.BuyMapSkus == null || oi.BuyMapSkus.Count == 0))
|
||||
return true;
|
||||
if (chkNoMapProd.IsChecked == true && order.orderItems.All(oi => oi.BuyMap != null))
|
||||
return true;
|
||||
}
|
||||
if (filterHeadStr.StartsWith("待发货"))
|
||||
@@ -1820,17 +1822,15 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
GlobalConfig.OrderTabHeaderStr = ((tabOrderType.SelectedItem as TabItem)?.Header).ParseToString();
|
||||
FilterOrders();
|
||||
}
|
||||
|
||||
private void chkMapProdOnly_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
private void chkMapProd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (chkMapProdOnly.IsChecked == true)
|
||||
chkNoMapProdOnly.IsChecked = false;
|
||||
FilterOrders();
|
||||
}
|
||||
private void chkNoMapProdOnly_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (chkNoMapProdOnly.IsChecked == true)
|
||||
chkMapProdOnly.IsChecked = false;
|
||||
if (sender is CheckBox chk)
|
||||
{
|
||||
var isCheck = !chk.IsChecked.ParseToBool();
|
||||
chkNoMapProd.IsChecked = chkMapProd.IsChecked = chkMapSku.IsChecked = false;
|
||||
chk.IsChecked = !isCheck;
|
||||
}
|
||||
FilterOrders();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +1,52 @@
|
||||
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListRowCtrl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
|
||||
xmlns:uc="clr-namespace:_29WxOrderWpf.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="230" d:DesignWidth="1200">
|
||||
<Border Margin="0,12,8,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" BorderThickness="1"
|
||||
BorderBrush="{StaticResource ListRowBorderColorBrush}" CornerRadius="10">
|
||||
<Border.Style>
|
||||
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<UserControl
|
||||
x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListRowCtrl"
|
||||
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:local="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uc="clr-namespace:_29WxOrderWpf.UserControls"
|
||||
d:DesignHeight="230"
|
||||
d:DesignWidth="1200"
|
||||
mc:Ignorable="d">
|
||||
<Border
|
||||
Margin="0,12,8,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
BorderBrush="{StaticResource ListRowBorderColorBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="10">
|
||||
<Border.Style>
|
||||
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--子控件是普通控件而非模板页控件,无需指定DataContext="{Binding}"-->
|
||||
<local:OrderListRowHeaderCtrl></local:OrderListRowHeaderCtrl>
|
||||
<!--<local:OrderListRowHeaderCtrl DataContext="{Binding}"></local:OrderListRowHeaderCtrl>-->
|
||||
<Border Grid.Row="1" Background="Transparent" CornerRadius="0,0,12,12" >
|
||||
<Grid x:Name="gridChildOrder">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="6"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!-- 子控件是普通控件而非模板页控件,无需指定DataContext="{Binding}" -->
|
||||
<local:OrderListRowHeaderCtrl />
|
||||
<!--<local:OrderListRowHeaderCtrl DataContext="{Binding}"></local:OrderListRowHeaderCtrl>-->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Background="Transparent"
|
||||
CornerRadius="0,0,12,12">
|
||||
<Grid x:Name="gridChildOrder">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="6" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="6" />
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
@@ -1757,6 +1757,19 @@
|
||||
Visibility="{Binding ItemOrder.IsWaitBuy, Converter={StaticResource visibleToVisibilityConverter}}"
|
||||
Style="{StaticResource BasePageButtonLightStyle}" Margin="4,0,0,0" Content="关联拍单" Width="56" Height="24"/>-->
|
||||
<WrapPanel Grid.Row="1" HorizontalAlignment="Center">
|
||||
<Button
|
||||
x:Name="btnMapSkus"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Height="24"
|
||||
MinWidth="38"
|
||||
Margin="4,4,0,4"
|
||||
HorizontalAlignment="Center"
|
||||
Click="btnMapSkus_Click"
|
||||
Content="选择SKU"
|
||||
Style="{StaticResource BasePageButtonLightStyle}"
|
||||
Visibility="{Binding MapSkusBtnVisibility}" />
|
||||
|
||||
|
||||
<Button
|
||||
x:Name="btnBuyOrder"
|
||||
|
||||
@@ -1585,6 +1585,16 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void btnMapSkus_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
if (DataContext is oms_wei_order_item_info orderItem)
|
||||
{
|
||||
BuyMapSkuSelectWindow window = new BuyMapSkuSelectWindow(orderItem);
|
||||
window.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user