Files
29WxOrder/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml
T
2026-10-07 16:16:55 +08:00

135 lines
4.6 KiB
XML

<UserControl
x:Class="_29WxOrderWpf.Ctrls.Statistics.ShowOrderDialogView"
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.Statistics"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="WPFCommon"
d:Background="White"
d:DesignHeight="450"
d:DesignWidth="800"
Focusable="True"
mc:Ignorable="d">
<UserControl.Resources>
<!-- 单元格文字居中 -->
<Style x:Key="CenterCellTextStyle" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border
Grid.Row="0"
Padding="10"
BorderBrush="Gray"
BorderThickness="0,0,0,1">
<wpf:SpacingStackPanel HorizontalSpacing="10" Orientation="Horizontal">
<wpf:TitleContent
Title="订单号:"
Width="180"
Placement="Left"
TitleVerticalAlignment="Center">
<TextBox Height="22" Text="{Binding OrderId, UpdateSourceTrigger=PropertyChanged}" />
</wpf:TitleContent>
<Button
Command="{Binding SelectAllCommand}"
Content="复制数据"
Style="{StaticResource BaseButtonLightStyle}" />
</wpf:SpacingStackPanel>
</Border>
<DataGrid
Grid.Row="1"
d:ItemsSource="{d:SampleData ItemCount=10}"
AlternatingRowBackground="#FAFAFA"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
ColumnHeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
HorizontalGridLinesBrush="#EEEEEE"
IsReadOnly="True"
ItemsSource="{Binding DataView}"
RowHeight="44"
SelectionMode="Single"
SelectionUnit="FullRow"
VerticalScrollBarVisibility="Auto">
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Style>
</DataGrid.RowStyle>
<DataGrid.Columns>
<!-- 店名 -->
<DataGridTextColumn
Width="*"
Binding="{Binding ShopName}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="店名" />
<!-- 订单(可复制) -->
<DataGridTemplateColumn Width="2*" Header="订单">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
Text="{Binding OrderId}"
ToolTip="点击“复制”复制订单号" />
<Button
Margin="5,0,0,0"
Click="CopyOrderId_Click"
Foreground="{StaticResource pageColorBrush}"
ToolTip="复制订单号">
<Button.Style>
<Style BasedOn="{StaticResource IconButtonStyle}" TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource pageColorBrush}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsSelected}" Value="True">
<Setter Property="Foreground" Value="White" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<TextBlock Style="{StaticResource TextBlockIcon}" Text="{StaticResource txt-copy}" />
</Button>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!-- 金额(分转元) -->
<DataGridTextColumn
Width="*"
Binding="{Binding OrderPrice, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding RefundAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="退款金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding OutAmount, Converter={StaticResource FenToYuanConverter}, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="外采金额" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>