修改工单流程页面,订单列表增加工单按钮
This commit is contained in:
1 parent
f9dcae4610
commit
10bb0803d9
44 files changed
+5920
-1291
No files matched your search
@@ -4,12 +4,14 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:behaviors="clr-namespace:OrderSupportTicket.Behaviors"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:fk="WxOrder.Framework"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:models="clr-namespace:OrderSupportTicket.Models"
|
||||
xmlns:vm="clr-namespace:OrderSupportTicket.ViewModels"
|
||||
MinWidth="760"
|
||||
MinHeight="480"
|
||||
d:DataContext="{d:DesignInstance Type=vm:OrderSupportTicketViewModel}"
|
||||
fk:DialogWindowProperty.Height="750"
|
||||
fk:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
|
||||
fk:DialogWindowProperty.Width="1000"
|
||||
fk:DialogWindowProperty.WindowStartupLocation="CenterScreen"
|
||||
Background="#EEF1F4"
|
||||
FontFamily="Microsoft YaHei UI"
|
||||
FontSize="14"
|
||||
@@ -21,6 +23,7 @@
|
||||
<SolidColorBrush x:Key="LineBrush" Color="#DDE2E8" />
|
||||
<SolidColorBrush x:Key="TextBrush" Color="#1F2933" />
|
||||
<SolidColorBrush x:Key="SubTextBrush" Color="#6B7785" />
|
||||
<SolidColorBrush x:Key="PriceBrush" Color="#C2410C" />
|
||||
<SolidColorBrush x:Key="BackgroundBrush" Color="#EEF1F4" />
|
||||
<SolidColorBrush x:Key="PanelBrush" Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="OtherBubbleBrush" Color="#F1F3F6" />
|
||||
@@ -32,6 +35,20 @@
|
||||
<SolidColorBrush x:Key="DoneBrush" Color="#5B6673" />
|
||||
<SolidColorBrush x:Key="DoneBackgroundBrush" Color="#E9ECF0" />
|
||||
|
||||
<Style x:Key="CopyableOrderIdStyle" TargetType="TextBlock">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Foreground" Value="{StaticResource TextBrush}" />
|
||||
<Setter Property="ToolTip" Value="点击复制订单号" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="{StaticResource BrandBrush}" />
|
||||
<Setter Property="TextDecorations" Value="Underline" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="{StaticResource BrandBrush}" />
|
||||
@@ -146,7 +163,7 @@
|
||||
x:Name="Root"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="3,0,0,1">
|
||||
BorderThickness="3,0,0,0">
|
||||
<ContentPresenter />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
@@ -187,12 +204,13 @@
|
||||
CornerRadius="6">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Width="300"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,0,1,0">
|
||||
<Grid>
|
||||
@@ -225,22 +243,48 @@
|
||||
Text="{Binding NewDataText}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding NewTicketCommand}"
|
||||
Content="新建"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="11,8,14,4">
|
||||
<TextBox
|
||||
Padding="8,5"
|
||||
Background="#FAFBFC"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
GotFocus="TicketSearchBox_GotFocus"
|
||||
Text="{Binding TicketSearchText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock
|
||||
Margin="9,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Text="搜索订单号、商品、店铺或状态">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding TicketSearchText}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding TicketSearchText}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Grid.Row="1"
|
||||
Padding="11,10,14,10"
|
||||
Background="{StaticResource BrandSoftBrush}"
|
||||
BorderBrush="{StaticResource BrandBrush}"
|
||||
@@ -254,7 +298,9 @@
|
||||
<TextBlock
|
||||
Margin="0,5,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
MouseLeftButtonUp="CopyOrderId_MouseLeftButtonUp"
|
||||
Style="{StaticResource CopyableOrderIdStyle}"
|
||||
Tag="{Binding SelectedOrder.OrderId}"
|
||||
Text="{Binding SelectedOrder.OrderId, StringFormat=订单 {0}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
@@ -266,33 +312,44 @@
|
||||
</Border>
|
||||
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
Grid.Row="2"
|
||||
behaviors:ListBoxInteractionBehavior.SelectedItemCommand="{Binding SelectTicketCommand}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource TicketListItemStyle}"
|
||||
ItemsSource="{Binding Tickets}"
|
||||
ItemsSource="{Binding TicketView}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
SelectedItem="{Binding SelectedTicket, Mode=OneWay}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:WorkOrderSummaryViewModel}">
|
||||
<Grid Margin="11,10,14,10" ToolTip="{Binding AppId}">
|
||||
<Grid Margin="11,10,14,10" ToolTip="{Binding ProductNameText}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="0,0,0,5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Grid Grid.Row="0" Margin="0,0,0,6">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
MouseLeftButtonUp="CopyOrderId_MouseLeftButtonUp"
|
||||
Style="{StaticResource CopyableOrderIdStyle}"
|
||||
Tag="{Binding WechatOrderId}"
|
||||
Text="{Binding WechatOrderId}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Border
|
||||
x:Name="UnreadBadge"
|
||||
Grid.Column="1"
|
||||
Height="18"
|
||||
MinWidth="18"
|
||||
Margin="6,-1,0,0"
|
||||
@@ -306,37 +363,97 @@
|
||||
Foreground="White"
|
||||
Text="{Binding UnreadCount}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Border HorizontalAlignment="Right" Style="{StaticResource StatusTagStyle}">
|
||||
</Grid>
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
Style="{StaticResource StatusTagStyle}">
|
||||
<TextBlock Style="{StaticResource StatusTextStyle}" Text="{Binding StatusText}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,4"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding AppId, StringFormat=店铺 {0}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding PreviewText}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
|
||||
<Grid
|
||||
Width="48"
|
||||
Height="48"
|
||||
VerticalAlignment="Center">
|
||||
<Border
|
||||
Background="#F1F3F6"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
FontSize="18"
|
||||
Foreground="#9AA5B1"
|
||||
Text="" />
|
||||
</Border>
|
||||
<Border
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Border.Background>
|
||||
<ImageBrush
|
||||
ImageSource="{Binding ProductImage}"
|
||||
Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding UpdatedAtText}" />
|
||||
Margin="9,0,0,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding ProductNameText}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Grid Margin="0,3,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource PriceBrush}"
|
||||
Text="{Binding ProductAmountText}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding ShopName, StringFormat=店铺 {0}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
<Grid Margin="0,3,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
FontSize="11"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding PreviewText}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
FontSize="11"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding UpdatedAtText}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
@@ -458,26 +575,93 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid
|
||||
Width="44"
|
||||
Height="44"
|
||||
VerticalAlignment="Center">
|
||||
<Border
|
||||
Background="#F1F3F6"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
FontSize="17"
|
||||
Foreground="#9AA5B1"
|
||||
Text="" />
|
||||
</Border>
|
||||
<Border
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<Border.Background>
|
||||
<ImageBrush
|
||||
ImageSource="{Binding SelectedTicket.ProductImage}"
|
||||
Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
MouseLeftButtonUp="CopyOrderId_MouseLeftButtonUp"
|
||||
Style="{StaticResource CopyableOrderIdStyle}"
|
||||
Tag="{Binding SelectedTicket.WechatOrderId}"
|
||||
Text="{Binding SelectedTicket.WechatOrderId}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Border
|
||||
Grid.Column="1"
|
||||
Margin="9,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding SelectedTicket}"
|
||||
Style="{StaticResource StatusTagStyle}">
|
||||
<TextBlock Style="{StaticResource StatusTextStyle}" Text="{Binding StatusText}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding SelectedTicket.WechatOrderId}" />
|
||||
<Border
|
||||
Margin="9,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
DataContext="{Binding SelectedTicket}"
|
||||
Style="{StaticResource StatusTagStyle}">
|
||||
<TextBlock Style="{StaticResource StatusTextStyle}" Text="{Binding StatusText}" />
|
||||
</Border>
|
||||
Text="{Binding SelectedTicket.ProductNameText}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Grid Margin="0,2,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
FontSize="12"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource PriceBrush}"
|
||||
Text="{Binding SelectedTicket.ProductAmountText}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding SelectedTicket.ShopName, StringFormat=店铺 {0}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding SelectedTicket.AppId, StringFormat=店铺 {0}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Command="{Binding LoadEarlierMessagesCommand}"
|
||||
@@ -638,6 +822,7 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Visibility="{Binding IsDraftVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
@@ -674,147 +859,58 @@
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="关联订单:" />
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="1">
|
||||
<TextBox
|
||||
Padding="8,5"
|
||||
Background="White"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding OrderFilterText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid
|
||||
Width="72"
|
||||
Height="72"
|
||||
VerticalAlignment="Center">
|
||||
<Border
|
||||
Background="#F1F3F6"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
IsHitTestVisible="False"
|
||||
Text="输入订单号或商品名筛选">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding OrderFilterText}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Button
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="8,0,0,0"
|
||||
Padding="10,4"
|
||||
Command="{Binding ClearOrderFilterCommand}"
|
||||
Content="清除"
|
||||
Style="{StaticResource GhostButtonStyle}" />
|
||||
|
||||
<ComboBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
ItemsSource="{Binding FilteredOrders}"
|
||||
SelectedItem="{Binding SelectedOrder}"
|
||||
ToolTip="{Binding SelectedOrder.DisplayText}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:TicketOrderOption}">
|
||||
<Grid MaxWidth="480">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="0,0,8,0"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding OrderId}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
MaxWidth="280"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding GoodsName}"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
ToolTip="{Binding GoodsName}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
FontSize="22"
|
||||
Foreground="#9AA5B1"
|
||||
Text="" />
|
||||
</Border>
|
||||
<Border
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<Border.Background>
|
||||
<ImageBrush
|
||||
ImageSource="{Binding SelectedOrderImage}"
|
||||
Stretch="UniformToFill" />
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Grid>
|
||||
<StackPanel
|
||||
Grid.Column="1"
|
||||
Margin="14,0,0,0"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Foreground="{StaticResource SubTextBrush}" Text="关联订单" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,7,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource ErrorBrush}"
|
||||
Text="未找到匹配订单,请检查订单号,或换一个商品名关键词。">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding HasAvailableOrders}" Value="True" />
|
||||
<Condition Binding="{Binding HasFilteredOrders}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
Margin="0,4,0,0"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding SelectedOrderText}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,7,0,0"
|
||||
Margin="0,4,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding OrderFilterSummaryText}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasFilteredOrders}" Value="False">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Margin="0,10,0,0"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
LineHeight="23"
|
||||
Text="{Binding SelectedOrderDescription}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
Text="{Binding SelectedOrderDescription}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -878,6 +974,7 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
@@ -888,7 +985,7 @@
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="在左侧选择工单,或点击“新建”提交新工单" />
|
||||
Text="在左侧选择工单查看对话" />
|
||||
<TextBlock
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using _29WxOrderWpf.ToolCtrls;
|
||||
using OrderSupportTicket.Models;
|
||||
using OrderSupportTicket.Services;
|
||||
using OrderSupportTicket.ViewModels;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace OrderSupportTicket.Views;
|
||||
|
||||
@@ -11,12 +14,14 @@ namespace OrderSupportTicket.Views;
|
||||
public partial class OrderSupportTicketView : UserControl
|
||||
{
|
||||
private bool _active;
|
||||
private Window _hostWindow;
|
||||
|
||||
public OrderSupportTicketView()
|
||||
: this(
|
||||
new TicketApiService(),
|
||||
new EventSourceTicketRealtimeService(),
|
||||
TicketClientOptions.FromApplicationSettings())
|
||||
CreateDefaultOptions(),
|
||||
ownsRealtime: true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -24,37 +29,76 @@ public partial class OrderSupportTicketView : UserControl
|
||||
ITicketApiService api,
|
||||
ITicketRealtimeService realtime,
|
||||
TicketClientOptions options = null)
|
||||
: this(api, realtime, options, ownsRealtime: true)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建工单页。ownsRealtime 为 false 时复用宿主提供的共享 SSE 连接,
|
||||
/// 页面关闭不会停止该连接。
|
||||
/// </summary>
|
||||
public OrderSupportTicketView(
|
||||
ITicketApiService api,
|
||||
ITicketRealtimeService realtime,
|
||||
TicketClientOptions options,
|
||||
bool ownsRealtime)
|
||||
{
|
||||
InitializeComponent();
|
||||
options = new TicketClientOptions
|
||||
{
|
||||
UserName="18990991234",
|
||||
AppIds = ["wx316b1291351558aa", "wx7999743c3d64c05c"],
|
||||
Orders = [
|
||||
new TicketOrderOption
|
||||
{
|
||||
Amount=109m,
|
||||
AppId="wx316b1291351558aa",
|
||||
GoodsName="梵客隆收腹内裤女新款高腰无痕磨毛暖融收小肚子提臀塑身平角裤",
|
||||
OrderId="9000000000000000001",
|
||||
OrderedAt=new DateTime(2020, 1, 1),
|
||||
},
|
||||
new TicketOrderOption
|
||||
{
|
||||
Amount=109m,
|
||||
AppId="wx7999743c3d64c05c",
|
||||
GoodsName="洁柔抽纸粉Face家用实惠装批发纸巾大包面纸餐巾纸抽整箱可湿水纸",
|
||||
OrderId="9000000000000000002",
|
||||
OrderedAt=new DateTime(2020, 1, 1),
|
||||
}
|
||||
]
|
||||
};
|
||||
ViewModel = new OrderSupportTicketViewModel(api, realtime, options);
|
||||
ViewModel = new OrderSupportTicketViewModel(
|
||||
api,
|
||||
realtime,
|
||||
options ?? CreateDefaultOptions(),
|
||||
ownsRealtime);
|
||||
DataContext = ViewModel;
|
||||
Loaded += OnLoaded;
|
||||
Unloaded += OnUnloaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前联调使用的默认参数。正式接入时可由宿主替换为登录账号和店铺 APPID。
|
||||
/// </summary>
|
||||
public static TicketClientOptions CreateDefaultOptions(string fallbackUserName = null)
|
||||
{
|
||||
var configured = TicketClientOptions.FromApplicationSettings();
|
||||
var userName = !string.IsNullOrWhiteSpace(configured.UserName)
|
||||
? configured.UserName
|
||||
: (!string.IsNullOrWhiteSpace(fallbackUserName)
|
||||
? fallbackUserName.Trim()
|
||||
: "18990991234");
|
||||
var appIds = configured.AppIds != null && configured.AppIds.Count > 0
|
||||
? configured.AppIds
|
||||
: new List<string>
|
||||
{
|
||||
"wx316b1291351558aa",
|
||||
"wx7999743c3d64c05c"
|
||||
};
|
||||
|
||||
return new TicketClientOptions
|
||||
{
|
||||
UserName = userName,
|
||||
AppIds = appIds,
|
||||
Orders =
|
||||
[
|
||||
new TicketOrderOption
|
||||
{
|
||||
Amount = 109m,
|
||||
AppId = "wx316b1291351558aa",
|
||||
GoodsName = "梵客隆收腹内裤女新款高腰无痕磨毛暖融收小肚子提臀塑身平角裤",
|
||||
OrderId = "9000000000000000001",
|
||||
OrderedAt = new DateTime(2020, 1, 1),
|
||||
},
|
||||
new TicketOrderOption
|
||||
{
|
||||
Amount = 109m,
|
||||
AppId = "wx7999743c3d64c05c",
|
||||
GoodsName = "洁柔抽纸粉Face家用实惠装批发纸巾大包面纸餐巾纸抽整箱可湿水纸",
|
||||
OrderId = "9000000000000000002",
|
||||
OrderedAt = new DateTime(2020, 1, 1),
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前页面对应的工单 ViewModel。
|
||||
/// </summary>
|
||||
@@ -76,11 +120,58 @@ public partial class OrderSupportTicketView : UserControl
|
||||
ViewModel.OpenNewTicket(order);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开并定位到指定工单。
|
||||
/// </summary>
|
||||
public void OpenTicket(string appId, string wechatOrderId)
|
||||
{
|
||||
ViewModel.OpenTicket(appId, wechatOrderId);
|
||||
}
|
||||
|
||||
private void TicketSearchBox_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.CancelNewTicketDraft();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 点击订单号复制到剪贴板,并使用宿主窗口的 Toast 提示结果。
|
||||
/// </summary>
|
||||
private void CopyOrderId_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender is not FrameworkElement element)
|
||||
return;
|
||||
|
||||
var orderId = element.Tag as string;
|
||||
if (string.IsNullOrWhiteSpace(orderId)
|
||||
&& element.DataContext is WorkOrderSummaryViewModel ticket)
|
||||
{
|
||||
orderId = ticket.WechatOrderId;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(orderId))
|
||||
return;
|
||||
|
||||
var window = Window.GetWindow(this) ?? _hostWindow;
|
||||
if (window == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(orderId);
|
||||
ToastHelper.Show(window, "订单号已复制");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ToastHelper.Show(window, "复制失败:" + ex.Message, ToastType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnLoaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (_active)
|
||||
return;
|
||||
_active = true;
|
||||
AttachHostWindow(Window.GetWindow(this));
|
||||
UpdateWindowActiveState();
|
||||
await ViewModel.InitializeAsync();
|
||||
}
|
||||
|
||||
@@ -89,6 +180,72 @@ public partial class OrderSupportTicketView : UserControl
|
||||
if (!_active)
|
||||
return;
|
||||
_active = false;
|
||||
ViewModel.IsWindowActive = false;
|
||||
DetachHostWindow();
|
||||
await ViewModel.DeactivateAsync();
|
||||
}
|
||||
|
||||
private void AttachHostWindow(Window window)
|
||||
{
|
||||
DetachHostWindow();
|
||||
_hostWindow = window;
|
||||
if (_hostWindow == null)
|
||||
return;
|
||||
|
||||
_hostWindow.Activated += OnHostWindowActivated;
|
||||
_hostWindow.Deactivated += OnHostWindowDeactivated;
|
||||
_hostWindow.IsVisibleChanged += OnHostWindowIsVisibleChanged;
|
||||
_hostWindow.StateChanged += OnHostWindowStateChanged;
|
||||
_hostWindow.Closed += OnHostWindowClosed;
|
||||
}
|
||||
|
||||
private void DetachHostWindow()
|
||||
{
|
||||
if (_hostWindow == null)
|
||||
return;
|
||||
|
||||
_hostWindow.Activated -= OnHostWindowActivated;
|
||||
_hostWindow.Deactivated -= OnHostWindowDeactivated;
|
||||
_hostWindow.IsVisibleChanged -= OnHostWindowIsVisibleChanged;
|
||||
_hostWindow.StateChanged -= OnHostWindowStateChanged;
|
||||
_hostWindow.Closed -= OnHostWindowClosed;
|
||||
_hostWindow = null;
|
||||
}
|
||||
|
||||
private void UpdateWindowActiveState()
|
||||
{
|
||||
var window = _hostWindow;
|
||||
ViewModel.IsWindowActive = window != null
|
||||
&& window.IsVisible
|
||||
&& window.IsActive
|
||||
&& window.WindowState != WindowState.Minimized;
|
||||
}
|
||||
|
||||
private void OnHostWindowActivated(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWindowActiveState();
|
||||
}
|
||||
|
||||
private void OnHostWindowDeactivated(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWindowActiveState();
|
||||
}
|
||||
|
||||
private void OnHostWindowIsVisibleChanged(
|
||||
object sender,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
UpdateWindowActiveState();
|
||||
}
|
||||
|
||||
private void OnHostWindowStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateWindowActiveState();
|
||||
}
|
||||
|
||||
private void OnHostWindowClosed(object sender, EventArgs e)
|
||||
{
|
||||
ViewModel.IsWindowActive = false;
|
||||
DetachHostWindow();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user