用户列表页面完成 订单列表页面开始 10%

This commit is contained in:
wule committed 2026-06-19 16:56:02 +08:00
1 parent 25cdf642bf
commit edc7913637
52 files changed
+2032 -365

No files matched your search

+41 -2
View File
@@ -56,6 +56,9 @@
<Reference Include="NaiBa.Util">
<HintPath>..\DllReference\NaiBa.Util.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
@@ -81,10 +84,23 @@
<DependentUpon>BaseMsgWindow.xaml</DependentUpon>
</Compile>
<Compile Include="BaseWindows\BaseWindow.cs" />
<Compile Include="Converters\TextToVisibilityConverter.cs" />
<Compile Include="Ctrls\OrderCtrls\OrderListRowCtrl.xaml.cs">
<DependentUpon>OrderListRowCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\OrderCtrls\OrderListRowHeaderCtrl.xaml.cs">
<DependentUpon>OrderListRowHeaderCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\ShopCtrls\ShopDataGridCtrl.xaml.cs">
<DependentUpon>ShopDataGridCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="Ctrls\ShopCtrls\ShopListCtrl.xaml.cs">
<DependentUpon>ShopListCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="LoginWindows\LoginWindow.xaml.cs">
<DependentUpon>LoginWindow.xaml</DependentUpon>
</Compile>
<Compile Include="OrderCtrls\OrderListCtrl.xaml.cs">
<Compile Include="Ctrls\OrderCtrls\OrderListCtrl.xaml.cs">
<DependentUpon>OrderListCtrl.xaml</DependentUpon>
</Compile>
<Compile Include="ToolCtrls\Icons.xaml.cs">
@@ -94,10 +110,27 @@
<Compile Include="UserControls\UcWindowBoxes.xaml.cs">
<DependentUpon>UcWindowBoxes.xaml</DependentUpon>
</Compile>
<Compile Include="Utils\UiCtrlUtils.cs" />
<Page Include="BaseWindows\BaseMsgWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\OrderCtrls\OrderListRowCtrl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Ctrls\OrderCtrls\OrderListRowHeaderCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\ShopCtrls\ShopDataGridCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Ctrls\ShopCtrls\ShopListCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LoginWindows\LoginWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -114,7 +147,7 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="OrderCtrls\OrderListCtrl.xaml">
<Page Include="Ctrls\OrderCtrls\OrderListCtrl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -126,6 +159,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\BaseDataGridStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\BaseTextBoxStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -177,6 +214,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -237,5 +275,6 @@
<ItemGroup>
<Resource Include="Resources\close_gray.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+3 -1
View File
@@ -7,14 +7,16 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles/BaseWindowStyle.xaml" />
<ResourceDictionary Source="Styles/BaseDataGridStyle.xaml" />
<ResourceDictionary Source="Styles/BaseButtonStyle.xaml" />
<ResourceDictionary Source="Styles/BaseTextBoxStyle.xaml" />
<ResourceDictionary Source="Styles/BaseComboBoxStyle.xaml" />
<ResourceDictionary Source="Styles/BaseComboBoxStyle.xaml" />
<ResourceDictionary Source="Styles/UcImageButtonStyle.xaml" />
<ResourceDictionary Source="Styles/StaticImageDictionary.xaml" />
<ResourceDictionary Source="Styles/StaticColorBrushDictionary.xaml" />
<ResourceDictionary Source="Styles/StaticImageBrushDictionary.xaml" />
<!-- 可以添加更多资源字典 -->
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
+106 -10
View File
@@ -1,11 +1,15 @@
using System;
using _29WxOrderWpf.BaseWindows;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
using Work;
using Work.BaseForms;
namespace _29WxOrderWpf
{
@@ -23,15 +27,107 @@ namespace _29WxOrderWpf
args = e.Args;
}
#region 后台修改logo
//// 替换字典程序logo等
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
//// 获取资源字典
//ResourceDictionary dict = Application.Current.Resources;
//// 添加或更新资源
//dict["main29WeixinIcon"] = newBitmapImage;
#endregion
try
{
//设置应用程序处理异常方式:ThreadException处理
//Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
//处理UI线程异常
//Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
//处理非UI线程异常
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
//StartUp.Init();
new Initialization().Get();
#region 贴牌
//本地缓存文件
string IgPakFile = "locales/ig.pak";//贴牌客服端码
string OenVersionFile = "locales/igv.pak";//贴牌资源配置版本
string IaPakFile = "locales/ia.pak";//logo
string IbPakFile = "locales/ib.pak";//ico
string IcPakFile = "locales/ic.pak";//功能配置
//OenMechanism(IgPakFile, OenVersionFile, IaPakFile, IbPakFile, IcPakFile);
#region 后台修改logo 贴牌用
//// 替换字典程序logo等
//Uri imageUri = new Uri("pack://application:,,,/Resources/WindowBoxes/close.hover.png"); // 新的图片路径
//BitmapImage newBitmapImage = new BitmapImage(imageUri);
//// 获取资源字典
//ResourceDictionary dict = Application.Current.Resources;
//// 添加或更新资源
//dict["main29WeixinIcon"] = newBitmapImage;
#endregion
#endregion
}
catch (Exception ex)
{
string str = GetExceptionMsg(ex, string.Empty);
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
//BaseMsgForm.ShowError(str, "系统错误");
BaseMsgWindow.ShowError(null, str, "系统错误");
}
}
//static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
//{
// string str = GetExceptionMsg(e.Exception, e.ToString());
// NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
// BaseMsgWindow.ShowError(null, str, "系统错误");
//}
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.Exception, e.ToString());
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
BaseMsgWindow.ShowError(null, str, "系统错误");
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
NaiBa.Util.Helper.LogHelper.WriteWithTime("SystemError:" + str);
BaseMsgWindow.ShowError(null, str, "系统错误");
}
/// <summary>
/// 生成自定义异常消息
/// </summary>
/// <param name="ex">异常对象</param>
/// <param name="backStr">备用异常消息:当ex为null时有效</param>
/// <returns>异常字符串文本</returns>
static string GetExceptionMsg(Exception ex, string backStr)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("****************************异常文本****************************");
sb.AppendLine("【出现时间】:" + DateTime.Now.ToString());
if (ex != null)
{
sb.AppendLine("【异常类型】:" + ex.GetType().Name);
sb.AppendLine("【异常信息】:" + ex.Message);
sb.AppendLine("【堆栈调用】:" + ex.StackTrace);
}
else
{
sb.AppendLine("【未处理异常】:" + backStr);
}
sb.AppendLine("***************************************************************");
NaiBa.Util.Helper.LogHelper.WriteWithTime("Error:" + sb);
BaseMsgWindow.ShowError(null, sb.ToString(), "系统错误");
return sb.ToString();
}
/// <summary>
/// Oen贴牌机制
/// </summary>
/// <param name="sIgPakFile">贴牌商客户端码文件</param>
/// <param name="sOenVersionFile">贴牌配置版本号文件</param>
/// <param name="sIaPakFile">ico本地缓存文件</param>
/// <param name="sIbPakFile">logo本地缓存文件</param>
/// <param name="sIcPakFile">贴牌配置本地缓存文件</param>
private static void OenMechanism(string IgPakFile, string OenVersionFile, string IaPakFile, string IbPakFile, string IcPakFile)
{
//todo: 贴牌相关处理逻辑
}
}
}
+39
View File
@@ -21,6 +21,45 @@ namespace _29WxOrderWpf.BaseWindows
WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 8, ResizeBorderThickness = new Thickness(4), });
this.DataContext = this;
this.Loaded += BaseWindow_Loaded;
SizeChanged += BaseWindow_SizeChanged;
}
private void BaseWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (WindowState == WindowState.Maximized)
{
//// 获取当前屏幕的工作区(排除任务栏)
//var workArea = SystemParameters.WorkArea;
//// 设置窗口位置和大小
//this.Left = workArea.Left;
//this.Top = workArea.Top;
//this.Width = workArea.Width;
//this.Height = workArea.Height;
this.Padding = new Thickness(6);
}
else
this.Padding = new Thickness(0);
}
private void BaseWindow_Loaded(object sender, RoutedEventArgs e)
{
if (SystemParameters.PrimaryScreenWidth < this.Width + 0)
this.Width = SystemParameters.PrimaryScreenWidth - 0;
if (SystemParameters.WorkArea.Height < this.Height + 0)
this.Height = SystemParameters.WorkArea.Height - 0;
this.MaxHeight = SystemParameters.WorkArea.Height + 14;
//this.MaxWidth = SystemParameters.WorkArea.Width + 13;
double screenWidth = SystemParameters.PrimaryScreenWidth;
double screenHeight = SystemParameters.WorkArea.Height;
double windowWidth = this.ActualWidth;
double windowHeight = this.ActualHeight;
this.Left = (screenWidth / 2) - (windowWidth / 2);
this.Top = (screenHeight / 2) - (windowHeight / 2);
}
}
}
@@ -0,0 +1,36 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
namespace _29WxOrderWpf.Converters
{
public class HasTextToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
public class NotHasTextToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.ParseToString().IsNullOrEmpty() ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException(); // 单向绑定可不实现
}
}
}
@@ -0,0 +1,82 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListCtrl"
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:_29WxOrderWpf.Ctrls.OrderCtrls"
xmlns:utils="clr-namespace:_29WxOrderWpf.Utils"
xmlns:converters="clr-namespace:_29WxOrderWpf.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Loaded="Window_Loaded">
<UserControl.Resources>
<converters:NotHasTextToVisibilityConverter x:Key="NotHasTextVisibility"/>
</UserControl.Resources>
<Grid Background="{StaticResource ListCtrlBackColorBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridSearch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox x:Name="txtShopName" Grid.Column="0" Margin="4,0,-4,0" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" Height="28" VerticalContentAlignment="Center"
Style="{StaticResource BaseRoundCornerTextBoxStyle}" />
<TextBlock Text="全部店铺" Grid.Column="0" Margin="8,0,8,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray" Visibility="{Binding ElementName=txtShopName,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>
<Button Grid.Column="1" x:Name="btnMultiShopChoice" Style="{StaticResource BasePageButtonStyle}" Margin="-4,0,0,0" Grid.Row="4" Content=" ... " Width="28" Height="28" Click="btnMultiShopChoice_Click"></Button>
<TextBox x:Name="txtGoodsName" Grid.Column="2" Margin="4,0" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" Height="28" VerticalContentAlignment="Center"
Style="{StaticResource BaseRoundCornerTextBoxStyle}"/>
<TextBlock Text="商品标题" Grid.Column="2" Margin="8,0,8,0" VerticalAlignment="Center" IsHitTestVisible="False" Foreground="LightGray" Visibility="{Binding ElementName=txtGoodsName,Path=Text,Converter={StaticResource NotHasTextVisibility}}"></TextBlock>
</Grid>
<Grid x:Name="gridListHeader" Margin="4,0" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<ListBox IsHitTestVisible="True" BorderThickness="0" ItemsSource="{Binding lstOrder}" Grid.Row="2" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="4,0,4,4">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--此处绑定将数据源传递给子自定义控件OrderListRowCtrl-->
<local:OrderListRowCtrl DataContext="{Binding}"></local:OrderListRowCtrl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>
@@ -0,0 +1,174 @@
using AllBase;
using AllBase.Extension;
using AllBase.Helper;
using AllBase.Model;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Shapes;
using Work;
using Work.BLL;
namespace _29WxOrderWpf.Ctrls.OrderCtrls
{
/// <summary>
/// OrderListCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListCtrl : UserControl
{
public ObservableCollection<oms_wei_order_info> lstOrder { get; set; } = new ObservableCollection<oms_wei_order_info>();
public List<oms_wei_order_info> lstOrder1 { get; set; } = new List<oms_wei_order_info>();
public OrderListCtrl()
{
InitializeComponent();
DataContext = this;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项
//_myDataCollection.Add(newItem); // 添加到集合中
//dataGrid.Items.Refresh();.
//dgOrder.Items.Add(1111111);
//dgOrder.ItemsSource = lstOrder;
//lbxOrder.ItemsSource = lstOrder;
Task.Run(() =>
{
while (!MainWindow.Instance.hasReadShop)
{
Thread.Sleep(100);
}
GetOrder();
//GetOrderTest();
});
}
void GetOrderTest()
{
for (int i = 0; i < 10000; i++)
{
//lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
}
lstOrder.SortDesc(o => o.order_id.ParseToLong());
}
void GetOrder()
{
Task.Run(() =>
{
int page = 0;
int totalPage = 1;
while (true)
{
if (page >= totalPage)
{
break;
}
page++;
var url = BaseClass.Build29WxObjString("order/get_order_list");
var data = UserLogin.GetSignaturex() + "&page=" + page;
var shop_id = string.Join(",", GlobalConfig.ShopLoginList.Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty()));
data += "&erp_shop_id_in=" + shop_id;
Dispatcher.Invoke(new Action(() =>
{
if (!string.IsNullOrEmpty(txtShopName.Text.Trim()))
{
var shopNames = txtShopName.Text.Trim().Split(';').Where(s => !s.IsNullOrEmpty()).ToList();
shop_id = string.Join(",", GlobalConfig.ShopLoginList.Where(s => shopNames.Contains(s.ShopAccount)).Select(s => s.ErpShopId).Where(s => !s.IsNullOrEmpty()));
}
}));
Thread.Sleep(200);
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
break;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
break;
foreach (JObject jObj in jArr)
{
Dispatcher.Invoke(new Action(() =>
{
var order = JsonHelper.DeserializeJsonToObject<oms_wei_order_info>(JsonHelper.SerializeObject(jObj));
var orderExist = this.lstOrder.FirstOrDefault(o => o.order_id == order.order_id);
if (orderExist != null)
this.lstOrder.Remove(orderExist);
var nextOrder = this.lstOrder.FirstOrDefault(o => o.create_time < order.create_time);
if (nextOrder != null)
{
lstOrder.Insert(lstOrder.IndexOf(nextOrder), order);
}
else
{
lstOrder.Add(order);
}
}));
}
}
});
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
private void btnMultiShopChoice_Click(object sender, RoutedEventArgs e)
{
MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged;
MainWindow.Instance.shopListCtrl.Visibility = Visibility.Visible;
MainWindow.Instance.shopListCtrl.IsVisibleChanged += ShopListCtrl_IsVisibleChanged;
}
private void ShopListCtrl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!MainWindow.Instance.shopListCtrl.IsVisible && MainWindow.Instance.shopListCtrl.IsAcceptChoiceShop == true)
{
var list = MainWindow.Instance.shopListCtrl.lbxShop.ItemsSource as ObservableCollection<ShopLoginInfo>;
if (list != null)
this.txtShopName.Text = string.Join(";", list.Where(s => s.IsSelect == true).Select(s => s.ShopAccount));
}
MainWindow.Instance.shopListCtrl.IsVisibleChanged -= ShopListCtrl_IsVisibleChanged;
}
}
}
@@ -0,0 +1,40 @@
<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"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="800">
<Border Margin="12,12,12,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 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="Stretch" MinHeight="120">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</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>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</Border>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,41 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.OrderCtrls
{
/// <summary>
/// OrderListRowCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListRowCtrl : UserControl
{
public OrderListRowCtrl()
{
InitializeComponent();
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,29 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.OrderCtrls.OrderListRowHeaderCtrl"
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"
mc:Ignorable="d"
d:DesignHeight="150" d:DesignWidth="800">
<Border Background="{StaticResource ListRowBorderColorBrush}" CornerRadius="12,12,0,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="8,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="店铺单号:" BorderThickness="0" />
<TextBox Grid.Column="1" Margin="0,8,8,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True"
Text="{Binding order_id}" BorderThickness="0" />
<Border Grid.Column="2" Width="12" Background="Transparent" Height="12" VerticalAlignment="Center" Cursor="Hand"
Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown">
<Path Margin="0,0,0,0" Fill="#409eff" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown" Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z" Stretch="Uniform" />
</Border>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,41 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.OrderCtrls
{
/// <summary>
/// OrderListRowHeaderCtrl.xaml 的交互逻辑
/// </summary>
public partial class OrderListRowHeaderCtrl : UserControl
{
public OrderListRowHeaderCtrl()
{
InitializeComponent();
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
@@ -0,0 +1,73 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopDataGridCtrl"
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.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
AutoGenerateColumns = "False" HorizontalGridLinesBrush="{StaticResource HorizontalGridLinesBrush}"
VerticalGridLinesBrush="{StaticResource VerticalGridLinesBrush}" CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="{StaticResource ListBackColorBrush}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{StaticResource ListRowHoverBackColorBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource mainForegroundColorBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Width="50"/>
<DataGridTemplateColumn Width="*" Header="订单编号" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="图标">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="26" Padding="0" Margin="5" CornerRadius="5" Background="LightYellow" BorderBrush="Orange" BorderThickness="1">
<Label HorizontalAlignment="Center" Width="Auto" Content="店铺待发货" Foreground="Orange"></Label>
</Border>
<TextBox Grid.Row="2" HorizontalAlignment="Center" Width="Auto" Height="20" IsReadOnly="True" Text="收货地址 吕* 1********** 江苏省 镇江市 京口区" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.ShopCtrls
{
/// <summary>
/// ShopDataGridCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopDataGridCtrl : UserControl
{
public ShopDataGridCtrl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,145 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopListCtrl"
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.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" x:Name="shopListCtrl" Loaded="shopListCtrl_Loaded">
<Grid Background="{StaticResource ListCtrlBackColorBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridSearch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="店名" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Margin="6,0,0,0"/>
<Border Grid.Column="1" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<TextBox x:Name="txtShopName" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseTextBoxStyle}"/>
</Border>
<TextBlock Text="分组" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2"/>
<Border Grid.Column="3" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<ComboBox x:Name="cmbGroup" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseComboBoxStyle}" SelectionChanged="cmbGroup_SelectionChanged"/>
</Border>
<TextBlock Text="备注" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="4"/>
<Border Grid.Column="5" Margin="4" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<ComboBox x:Name="cmbNotes" Margin="3,0" VerticalContentAlignment="Center" Style="{StaticResource BaseComboBoxStyle}" SelectionChanged="cmbNotes_SelectionChanged"/>
</Border>
<Button Grid.Column="6" x:Name="btnSearch" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 搜索 " Height="26" Click="btnSearch_Click"></Button>
<Button Grid.Column="7" x:Name="btnRestore" Style="{StaticResource BasePageButtonLightStyle}" Grid.Row="4" Content=" 还原 " Height="26" Click="btnRestore_Click" Margin="4,0,6,0"></Button>
</Grid>
<Grid x:Name="lstTitle" Grid.Row="1" Margin="4,0" Background="{StaticResource ListHeadBackColorBrush}">
<Border BorderThickness="0,0,1,0" BorderBrush="{StaticResource ListHeadBorderColorBrush}">
<DataGrid Margin="0,0,18,0" x:Name="dgShopHeader" Grid.ColumnSpan="100" AutoGenerateColumns="False" CanUserReorderColumns="False"
ColumnHeaderHeight="{Binding ElementName=lstTitle, Path=ActualHeight}" BorderThickness="0"
ColumnDisplayIndexChanged="dgShopHeader_ColumnDisplayIndexChanged"
LayoutUpdated="dgShopHeader_LayoutUpdated">
<DataGrid.Columns>
<DataGridTemplateColumn x:Name="colSelectAll" Header="选择" Width="50" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<Grid Width="14" Height="14">
<!--<CheckBox x:Name="headerCheckBox" BorderThickness="0" IsChecked="{Binding DataContext.AreAllSelected, RelativeSource={RelativeSource AncestorType=DataGrid}, UpdateSourceTrigger=PropertyChanged}" Checked="HeaderCheckBox_Checked" Unchecked="HeaderCheckBox_Unchecked"/>-->
<CheckBox x:Name="chkSelectAll" BorderThickness="0" IsChecked="False" Checked="ChkSelectAll_Checked" Unchecked="ChkSelectAll_Unchecked" Loaded="ChkSelectAll_Loaded" IsThreeState="True"/>
<Border BorderThickness="1" Background="Transparent" BorderBrush="{StaticResource mainColorBrush}" Width="14" Height="14"
HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="False">
</Border>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!--<CheckBox IsChecked="{Binding IsSelected, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<CheckBox HorizontalAlignment="Center" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="AppId"/>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="店铺名称"/>
<DataGridTextColumn Width="100*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header="分组"/>
<DataGridTextColumn Width="82*" HeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}" Header=" 备注"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
<!--<ListBox Grid.Row="2" x:Name="lbxShop" ItemsSource="{Binding GlobalConfig.ShopLoginList}" BorderThickness="0" Margin="4,0,4,4">-->
<ListBox Grid.Row="2" x:Name="lbxShop" BorderThickness="0" Margin="4,0,4,4" SelectionMode="Extended">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<!--<local:ShopListRowCtrl></local:ShopListRowCtrl>-->
<Border Margin="0,0,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="0, 0, 0, 1" MinHeight="50"
BorderBrush="{StaticResource ListRowBorderColorBrush}" CornerRadius="0">
<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 x:Name="gridListItem">
<Grid.ColumnDefinitions>
<!--<ColumnDefinition Width="{Binding colShopIdWidth,RelativeSource={RelativeSource AncestorType={x:Type local:ShopListCtrl}}}" ></ColumnDefinition>-->
<ColumnDefinition x:Name="colCheck" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colShopId" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colShopName" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colGroupName" Width="100*"></ColumnDefinition>
<ColumnDefinition x:Name="colNotes" Width="100*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Tag="{Binding ShopId}" IsChecked="{Binding IsSelect, Mode=TwoWay}" Click="CheckBox_Click"/>
<TextBox Grid.Column="1" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding ShopId}" />
<TextBox Grid.Column="2" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding ShopAccount}" />
<TextBox Grid.Column="3" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding GroupName}" />
<TextBox Grid.Column="4" Background="Transparent" TextWrapping="Wrap" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" BorderThickness="0" Tag="{Binding ShopId}" Text="{Binding Notes}" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid x:Name="gridRefreshOrSelect" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" x:Name="btnRefreshShop" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 刷新店铺 " Height="26" Margin="6,0,0,0" Click="btnRefreshShop_Click"></Button>
<Button Grid.Column="6" x:Name="btnApplySelectShop" Style="{StaticResource BasePageButtonStyle}" Grid.Row="4" Content=" 确定 " Height="26" Click="btnApplySelectShop_Click"></Button>
<Button Grid.Column="7" x:Name="btnCancelSelectShop" Style="{StaticResource BasePageButtonLightStyle}" Grid.Row="4" Content=" 取消 " Height="26" Margin="4,0,6,0" Click="btnCancelSelectShop_Click"></Button>
</Grid>
</Grid>
</UserControl>
@@ -0,0 +1,191 @@
using _29WxOrderWpf.Utils;
using AllBase.Helper;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
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.ShopCtrls
{
/// <summary>
/// ShopListCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopListCtrl : UserControl
{
public bool? IsAcceptChoiceShop { get; set; } = false;
CheckBox chkSelectAll = null;
public ShopListCtrl()
{
InitializeComponent();
DataContext = this;
}
private void shopListCtrl_Loaded(object sender, RoutedEventArgs e)
{
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
Task.Run(() => {
while(MainWindow.Instance.hasReadShop == false)
{
Thread.Sleep(100);
}
Dispatcher.Invoke(new Action(() => {
cmbGroup.Items.Clear();
cmbGroup.Items.Add("");
foreach (var group in GlobalConfig.ShopLoginList.Select(s => s.GroupName).Distinct())
{
if (!string.IsNullOrEmpty(group))
this.cmbGroup.Items.Add(group);
}
cmbNotes.Items.Clear();
cmbNotes.Items.Add("");
foreach (var notes in GlobalConfig.ShopLoginList.Select(s => s.Notes).Distinct())
{
if (!string.IsNullOrEmpty(notes))
this.cmbNotes.Items.Add(notes);
}
}));
});
}
private void dgShopHeader_ColumnDisplayIndexChanged(object sender, DataGridColumnEventArgs e)
{
}
private void dgShopHeader_LayoutUpdated(object sender, EventArgs e)
{
foreach (var item in lbxShop.Items)
{
ListBoxItem container = (ListBoxItem)lbxShop.ItemContainerGenerator.ContainerFromIndex(lbxShop.Items.IndexOf(item));
if (container != null)
{
// 找到grid控件并修改列大小
Grid grid = UiCtrlUtils.FindVisualChild<Grid>(container, "gridListItem");
if (grid != null)
{
for(int i = 0; i< grid.ColumnDefinitions.Count; i++)
{
if (dgShopHeader.Columns.Count > i)
{
// 最后一列因滚动条变窄,已在表头补偿
if (i == grid.ColumnDefinitions.Count - 1)
grid.ColumnDefinitions[i].Width = new GridLength(Math.Max(0, dgShopHeader.Columns[i].ActualWidth - 0));
else
grid.ColumnDefinitions[i].Width = new GridLength(dgShopHeader.Columns[i].ActualWidth);
}
}
}
}
}
}
private void ChkSelectAll_Checked(object sender, RoutedEventArgs e)
{
foreach (var shop in GlobalConfig.ShopLoginList.ToList())
{
//shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool();
shop.IsSelect = true;
}
}
private void ChkSelectAll_Unchecked(object sender, RoutedEventArgs e)
{
foreach (var shop in GlobalConfig.ShopLoginList.ToList())
{
//shop.IsSelect = ((sender as CheckBox)?.IsChecked).ParseToBool();
shop.IsSelect = false;
}
}
private void ChkSelectAll_Loaded(object sender, RoutedEventArgs e)
{
chkSelectAll = sender as CheckBox;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
chkSelectAll.Checked -= ChkSelectAll_Checked;
chkSelectAll.Unchecked -= ChkSelectAll_Unchecked;
if (GlobalConfig.ShopLoginList.All(s => s.IsSelect))
chkSelectAll.IsChecked = true;
else if (GlobalConfig.ShopLoginList.All(s => !s.IsSelect))
chkSelectAll.IsChecked = false;
else
chkSelectAll.IsChecked = null;
chkSelectAll.Checked += ChkSelectAll_Checked;
chkSelectAll.Unchecked += ChkSelectAll_Unchecked;
}
private void cmbNotes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void cmbGroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
ObservableCollection<ShopLoginInfo> shops = new ObservableCollection<ShopLoginInfo>();
foreach (var shop in GlobalConfig.ShopLoginList)
{
if (!shop.ShopAccount.ParseToString().Contains(txtShopName.Text))
continue;
if (!shop.GroupName.ParseToString().Contains(cmbGroup.Text))
continue;
if (!shop.Notes.ParseToString().Contains(cmbNotes.Text))
continue;
shops.Add(shop);
}
this.lbxShop.ItemsSource = shops;
}
private void btnRestore_Click(object sender, RoutedEventArgs e)
{
txtShopName.Text = "";
cmbNotes.Text = "";
cmbGroup.Text = "";
this.lbxShop.ItemsSource = GlobalConfig.ShopLoginList;
}
private void btnRefreshShop_Click(object sender, RoutedEventArgs e)
{
MainWindow.Instance.GetServerShop();
}
private void btnCancelSelectShop_Click(object sender, RoutedEventArgs e)
{
this.IsAcceptChoiceShop = false;
MainWindow.Instance.gridUser.Visibility = Visibility.Hidden;
}
private void btnApplySelectShop_Click(object sender, RoutedEventArgs e)
{
this.IsAcceptChoiceShop = true;
MainWindow.Instance.gridUser.Visibility = Visibility.Hidden;
}
}
}
@@ -0,0 +1,12 @@
<UserControl x:Class="_29WxOrderWpf.Ctrls.ShopCtrls.ShopListRowCtrl"
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.ShopCtrls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="{Binding ShopAccount}"></TextBlock>
</Grid>
</UserControl>
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.ShopCtrls
{
/// <summary>
/// ShopListRowCtrl.xaml 的交互逻辑
/// </summary>
public partial class ShopListRowCtrl : UserControl
{
public ShopListRowCtrl()
{
InitializeComponent();
}
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _29WxOrderWpf.Ctrls.ShopCtrls
{
internal class ShopListViewModel
{
}
}
+8 -3
View File
@@ -12,7 +12,7 @@
<RowDefinition Height="120"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Background="{StaticResource mainForegroundLinearColorBrush}"></Border>
<Border Background="{StaticResource mainLinearColorBrush}"></Border>
<Grid Grid.Row="1" Margin="2,0,2,2" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
@@ -26,6 +26,7 @@
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
@@ -52,15 +53,19 @@
<Border Grid.Row="2" BorderBrush="{StaticResource mainColorBrush}" BorderThickness="1" CornerRadius="4" Height="26">
<PasswordBox x:Name="txtPassword" Margin="6,0" VerticalContentAlignment="Center" Style="{StaticResource BasePasswordBoxStyle}"></PasswordBox>
</Border>
<Button x:Name="btnLogin" Style="{StaticResource BaseButtonStyle}" Grid.Row="4" Content="安 全 登 录" Height="26" Click="btnLogin_Click"></Button>
<CheckBox Content="记住密码" x:Name="chkRemember" BorderBrush="{StaticResource mainColorBrush}" FontSize="12" HorizontalAlignment="Left" Grid.Row="3" VerticalAlignment="Center" Checked="chkRemember_Checked"/>
<Button x:Name="btnLogin" Style="{StaticResource BaseButtonStyle}" Grid.Row="4" Content="安 全 登 录" Height="26" Click="btnLogin_Click"></Button>
<CheckBox Content="调试模式" Height="24" Visibility="Collapsed" x:Name="chkDebug" BorderBrush="{StaticResource mainColorBrush}"
FontSize="12" VerticalContentAlignment="Center" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Center" Checked="chkDebug_Checked" Unchecked="chkDebug_Checked"/>
</Grid>
</Grid>
<Image Source="{StaticResource main29WeixinIcon}" Height="24" Width="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4"></Image>
<Label x:Name="lblAppName" FontSize="28" Margin="0,14,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" Content="拍单软件"></Label>
<Image Source="{StaticResource main29WeixinIcon}" Height="24" Width="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="4"></Image>
<Label x:Name="lblTitle" Margin="30,2" Foreground="White" Content="{Binding ElementName=loginWindow, Path=Title}"></Label>
<userctrls:UcWindowBoxes VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Collapsed" MinBoxVisibility="Collapsed"/>
</Grid>
</basewindows:BaseWindow>
+20 -3
View File
@@ -32,7 +32,7 @@ namespace _29WxOrderWpf.LoginWindows
{
public static ConcurrentList<UserParam> UserParamList { get; set; } = new ConcurrentList<UserParam>();
bool isLogin = false;
public bool IsLogin { get; set; } = false;
string[] argsuser;
@@ -43,6 +43,7 @@ namespace _29WxOrderWpf.LoginWindows
if (!string.IsNullOrEmpty(BaseClass.ProgramName))
{
lblAppName.Content = BaseClass.ProgramName;
MainWindow.Instance.lblAppName.Content = lblAppName.Content;
}
this.Title = "用户登录";
@@ -51,6 +52,10 @@ namespace _29WxOrderWpf.LoginWindows
private void loginWindow_Loaded(object sender, RoutedEventArgs e)
{
#if DEBUG
chkDebug.Visibility = Visibility.Visible;
#endif
GetUserList();
foreach (var user in UserParamList)
{
@@ -83,7 +88,7 @@ namespace _29WxOrderWpf.LoginWindows
//else
// e.Cancel = true;
if (!isLogin)
if (!IsLogin)
{
if (BaseMsgWindow.ShowConfirm(this, "是否关闭软件?\r\n必须登录账户才能使用,无账户请先注册一个。", "请先登录或者注册").DialogResult == true)
Process.GetCurrentProcess().Kill();
@@ -136,7 +141,7 @@ namespace _29WxOrderWpf.LoginWindows
});
SaveUserList();
}
this.isLogin = true;
this.IsLogin = true;
this.Close();
}
@@ -193,5 +198,17 @@ namespace _29WxOrderWpf.LoginWindows
{
BaseClass.Remember = chkRemember.IsChecked.ParseToBool();
}
private void chkDebug_Checked(object sender, RoutedEventArgs e)
{
if (chkDebug.IsChecked == true)
{
BaseClass.LoginApiUrl = BaseClass.DebugUrl;
}
else
{
BaseClass.LoginApiUrl = BaseClass.ServerUrl;
}
}
}
}
+26 -4
View File
@@ -4,18 +4,40 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:_29WxOrderWpf"
xmlns:orderctrls="clr-namespace:_29WxOrderWpf.OrderCtrls"
xmlns:orderctrls="clr-namespace:_29WxOrderWpf.Ctrls.OrderCtrls"
xmlns:shopctrls="clr-namespace:_29WxOrderWpf.Ctrls.ShopCtrls"
xmlns:userctrls="clr-namespace:_29WxOrderWpf.UserControls"
mc:Ignorable="d" Style="{StaticResource BaseNoneBorderWindowStyle}"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded" Closing="BaseWindow_Closing">
x:Name="mainWindow" Title="MainWindow" Height="900" Width="1600" Loaded="Window_Loaded" Closing="BaseWindow_Closing">
<Grid Background="Transparent">
<Grid Background="Transparent" Margin="{Binding ElementName=mainWindow, Path=Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="gridTitle">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image Source="{StaticResource main29WeixinIcon}" Height="50" Width="50" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="4"></Image>
<Label x:Name="lblAppName" FontSize="20" Margin="0,0,0,0" Foreground="{StaticResource mainColorLightBrush}" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalContentAlignment="Center" Content="拍单软件" Grid.Column="1"></Label>
</Grid>
<Grid x:Name="gridContainer" Grid.Row="1" Background="White" Margin="2,0,2,2">
<orderctrls:OrderListWindow x:Name="OrderListWindow" Visibility="Hidden"></orderctrls:OrderListWindow>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<orderctrls:OrderListCtrl x:Name="orderListCtrl" Grid.Column="1" Visibility="Collapsed"></orderctrls:OrderListCtrl>
<Grid x:Name="gridUser" Visibility="Hidden" Grid.ColumnSpan="2" Background="#7F000000">
<Border CornerRadius="4" Width="500" Height="600" Background="White">
<shopctrls:ShopListCtrl x:Name="shopListCtrl" Visibility="{Binding ElementName=gridUser,Mode=TwoWay,Path=Visibility}" Margin="2"
Grid.ColumnSpan="2"></shopctrls:ShopListCtrl>
</Border>
</Grid>
</Grid>
<userctrls:UcWindowBoxes VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4" MaxBoxVisibility="Visible"/>
</Grid>
+89 -3
View File
@@ -1,10 +1,14 @@
using _29WxOrderWpf.BaseWindows;
using _29WxOrderWpf.OrderCtrls;
using _29WxOrderWpf.Ctrls.OrderCtrls;
using AllBase;
using AllBase.DouYinModel.Result;
using AllBase.Extension;
using AllBase.Helper;
using AllBase.Model;
using AllBase.Model.Result;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -27,7 +31,9 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Xml.Linq;
using Work;
using Work.BLL;
namespace _29WxOrderWpf
{
@@ -36,13 +42,15 @@ namespace _29WxOrderWpf
/// </summary>
public partial class MainWindow : BaseWindow
{
public static MainWindow Instance { get; private set; }
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
Instance = this;
this.Height = 800;
this.Width = 1600;
gridUser.Visibility = Visibility.Collapsed;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
@@ -54,6 +62,16 @@ namespace _29WxOrderWpf
loginWindow.Owner = this;
loginWindow.ShowDialog();
#endregion
if (loginWindow.IsLogin)
{
//shopListCtrl.Visibility = Visibility.Visible;
orderListCtrl.Visibility = Visibility.Visible;
Task.Run(() =>
{
GetServerShop();
});
}
}
#region 反抓包功能
@@ -175,5 +193,73 @@ namespace _29WxOrderWpf
else
e.Cancel = true;
}
public bool readShop { get; set; } = false;
public bool hasReadShop { get; set; } = false;
public void GetServerShop()
{
if (readShop == false)
{
List<ShopLoginInfo> list = new List<ShopLoginInfo>();
Dispatcher.Invoke(new Action(() =>
{
}));
readShop = true;
int page = 0;
while (true)
{
page++;
var url = BaseClass.Build29WxObjString("shop/get_shop_list");
var data = UserLogin.GetSignaturex() + "&page=" + page;
data += "&is_get_erp_shop_id=true";
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html)
|| !html.Contains("shop_id") || !html.Contains("shop_account") || !html.Contains("login_pass"))
{
break;
}
var jArr = JObject.Parse(html)["data"];
if (jArr.Count() == 0)
break;
foreach (JObject jObj in jArr)
{
var shop = ShopBLL.DeserializationShop(jObj);
var shopExist = list.Where(l => l.ShopId == shop.ShopId).ToList();
if (shopExist != null)
shopExist.Remove(shop);
list.Add(shop);
if (!GlobalConfig.ShopLoginList.Any(s => s.ShopId == shop.ShopId && !shop.is_point_shop_expire))
{
Dispatcher.Invoke(new Action(() =>
{
GlobalConfig.ShopLoginList.Add(shop);
}));
}
}
}
Dispatcher.Invoke(new Action(() =>
{
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => !list.Any(ss => ss.ShopId == s.ShopId)).ToList())
{
GlobalConfig.ShopLoginList.Remove(shop);
}
foreach (var shop in GlobalConfig.ShopLoginList.Where(s => s.is_point_shop_expire).ToList())
{
GlobalConfig.ShopLoginList.Remove(shop);
}
}));
readShop = false;
hasReadShop = true;
}
}
}
}
-158
View File
@@ -1,158 +0,0 @@
<UserControl x:Class="_29WxOrderWpf.OrderCtrls.OrderListWindow"
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:_29WxOrderWpf.OrderCtrls"
mc:Ignorable="d"
Height="450" Width="800" Loaded="Window_Loaded">
<Grid Background="AliceBlue">
<DataGrid Grid.Row="1" Opacity="0" HorizontalContentAlignment="Center" Margin="2,0,2,2" RowHeight="60" x:Name="dgOrder" Grid.ColumnSpan="2"
ItemsSource="{Binding lstOrder}" AutoGenerateColumns = "False" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray"
CanUserDeleteRows="False" CanUserAddRows="False" ColumnHeaderHeight="40">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="White"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{x:Null}" ClipboardContentBinding="{x:Null}" Width="50"/>
<DataGridTemplateColumn Width="*" Header="订单编号" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*" Header="图标">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Grid.Row="1" HorizontalAlignment="Center" Width="Auto" Height="26" Padding="0" Margin="5" CornerRadius="5" Background="LightYellow" BorderBrush="Orange" BorderThickness="1">
<Label HorizontalAlignment="Center" Width="Auto" Content="店铺待发货" Foreground="Orange"></Label>
</Border>
<TextBox Grid.Row="2" HorizontalAlignment="Center" Width="Auto" Height="20" Background="Transparent" IsReadOnly="True" Text="收货地址 吕* 1********** 江苏省 镇江市 京口区" BorderThickness="0"></TextBox>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid Margin="4,0" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="100*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
<ColumnDefinition Width="50*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<ListBox IsHitTestVisible="True" Opacity="1" ItemsSource="{Binding lstOrder}" Grid.Row="1" HorizontalContentAlignment="Stretch" x:Name="lbxOrder" Margin="4,0,4,4">
<!--使用自定义属性模板去除ListBox高亮显示框-->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Border Margin="12,12,12,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="LightGray" CornerRadius="10">
<Border.Style>
<!-- 鼠标进入或悬停Border时切换颜色(悬停时Border的填充控件必须有填充Border,所在层级不限,仅填充透明Grid则触发器无效) -->
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="AliceBlue"/>
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="120">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Border Background="AliceBlue" CornerRadius="12,12,0,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Margin="8,8,0,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="店铺单号:" BorderThickness="0" />
<TextBox Grid.Column="1" Margin="0,8,8,8" VerticalAlignment="Center" FontSize="14" Background="Transparent" IsReadOnly="True" Text="{Binding order_id}" BorderThickness="0" />
<Border Grid.Column="2" Width="12" Background="AliceBlue" Height="12" VerticalAlignment="Center" Cursor="Hand" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown">
<Path Margin="0,0,0,0" Fill="#409eff" Tag="{Binding order_id}" MouseLeftButtonDown="Path_MouseLeftButtonDown" Data="M80 432a128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128h-384a128 128 0 0 1-128-128v-384z m128-64a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64h-384z M816 144h-384a64 64 0 0 0-64 64 32 32 0 0 1-64 0 128 128 0 0 1 128-128h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128 32 32 0 0 1 0-64 64 64 0 0 0 64-64v-384a64 64 0 0 0-64-64z" Stretch="Uniform" />
</Border>
</Grid>
</Border>
<Border Grid.Row="1" Background="Transparent" CornerRadius="0,0,12,12" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
</Border>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</UserControl>
@@ -1,67 +0,0 @@
using AllBase;
using AllBase.Extension;
using AllBase.Model;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
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.Shapes;
namespace _29WxOrderWpf.OrderCtrls
{
/// <summary>
/// OrderListWindow.xaml 的交互逻辑
/// </summary>
public partial class OrderListWindow : UserControl
{
public ObservableCollection<oms_wei_order_info> lstOrder { get; set; } = new ObservableCollection<oms_wei_order_info>();
public List<oms_wei_order_info> lstOrder1 { get; set; } = new List<oms_wei_order_info>();
public OrderListWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//MyData newItem = new MyData { Name = "New Person", Age = 28 }; // 创建新数据项
//_myDataCollection.Add(newItem); // 添加到集合中
//dataGrid.Items.Refresh();.
//dgOrder.Items.Add(1111111);
dgOrder.ItemsSource = lstOrder;
lbxOrder.ItemsSource = lstOrder;
for (int i = 0; i < 10000; i++)
{
//lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = ("3737033423685556736".ParseToLong() + Randomx.GetId(0,100)).ParseToString(), shop_name = "媛卡曦工厂优选" });
lstOrder.Add(new oms_wei_order_info() { id = 1, is_select = false, order_id = Randomx.GetId(1000, 10000).ParseToString(), shop_name = "媛卡曦工厂优选" });
}
lstOrder.SortDesc(o => o.order_id.ParseToLong());
}
private void Path_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var orderId = ((sender as Border)?.Tag).ParseToString();
try
{
Clipboard.SetText(orderId);
}
catch (Exception ex)
{
}
}
}
}
+67 -3
View File
@@ -41,8 +41,8 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorDarkBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
BorderBrush="{DynamicResource mainColorDarkBrush}" CornerRadius="0"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
@@ -72,7 +72,7 @@
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorLightBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorBrush}"
BorderBrush="{DynamicResource mainColorBrush}" CornerRadius="0"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
@@ -98,4 +98,68 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BasePageButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorDarkBrush}" CornerRadius="4"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="BasePageButtonLightStyle" TargetType="Button">
<Setter Property="Foreground" Value="{DynamicResource mainColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="buttonBorder" Background="{DynamicResource mainColorLightBrush}" Cursor="Hand"
BorderBrush="{DynamicResource mainColorBrush}" CornerRadius="4"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="buttonBorder" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainColorLightBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -0,0 +1,23 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="BaseDataGridColumnHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource ListHeadBackColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderBrush" Value="{DynamicResource ListHeadBorderColorBrush}"/>
<Setter Property="BorderThickness" Value="1,0,0,0"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="BaseDataGridColumnHeaderLeftAlignmentStyle" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource ListHeadBackColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderBrush" Value="{DynamicResource ListHeadBorderColorBrush}"/>
<Setter Property="BorderThickness" Value="1,0,0,0"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
</Style>
</ResourceDictionary>
+23
View File
@@ -22,6 +22,29 @@
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="BaseRoundCornerTextBoxStyle" TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border" CornerRadius="4" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!--去除高亮框-->
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
+2 -2
View File
@@ -4,7 +4,7 @@
<Style x:Key="BaseWindowStyle" TargetType="Window">
<Setter Property="Background" Value="{DynamicResource mainColorBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontSize" Value="12"/>
<!-- 其他样式设置 -->
</Style>
@@ -13,7 +13,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource mainColorDarkBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource mainForegroundColorBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True"/>
</Style>
@@ -4,8 +4,19 @@
<SolidColorBrush x:Key="mainColorLightBrush" Color="#f5ebff"/>
<SolidColorBrush x:Key="mainColorDarkBrush" Color="#FF6b5393"/>
<SolidColorBrush x:Key="mainForegroundColorBrush" Color="#FF666666"/>
<LinearGradientBrush x:Key="mainForegroundLinearColorBrush" StartPoint="0,0" EndPoint="1,0" >
<LinearGradientBrush x:Key="mainLinearColorBrush" StartPoint="0,0" EndPoint="1,0" >
<GradientStop Color="#FF98638f" Offset="0.0"/>
<GradientStop Color="#FF6b5393" Offset="1.0"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ListCtrlBackColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListHeadBackColorBrush" Color="#FFf8f8f9"/>
<SolidColorBrush x:Key="ListHeadBorderColorBrush" Color="#FFe9e9ea"/>
<SolidColorBrush x:Key="ListBackColorBrush" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="ListRowTitleBackColorBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="ListRowBorderColorBrush" Color="#FFf8f8f9"/>
<SolidColorBrush x:Key="ListRowHoverBackColorBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="HorizontalGridLinesBrush" Color="#FFf5f7fa"/>
<SolidColorBrush x:Key="VerticalGridLinesBrush" Color="#FFFFFFFF"/>
</ResourceDictionary>
+70
View File
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace _29WxOrderWpf.Utils
{
public class UiCtrlUtils
{
/// <summary>
/// 查找模板控件的子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static T FindVisualChild<T>(DependencyObject obj) where T : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
if (child != null && child is T)
{
return (T)child;
}
else
{
T childOfChild = FindVisualChild<T>(child);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}
/// <summary>
/// 查找模板控件的子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <param name="xName"></param>
/// <returns></returns>
public static T FindVisualChild<T>(DependencyObject obj, string xName) where T : DependencyObject
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
string controlName = child?.GetValue(Control.NameProperty) as string;
if (controlName == xName)
{
return (T)child;
}
else
{
T childOfChild = FindVisualChild<T>(child, xName);
if (childOfChild != null)
{
return childOfChild;
}
}
}
return null;
}
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" />
</packages>