增加工单模块
This commit is contained in:
1 parent
dc136e449e
commit
f9dcae4610
17 files changed
+4908
No files matched your search
@@ -0,0 +1,912 @@
|
||||
<UserControl
|
||||
x:Class="OrderSupportTicket.Views.OrderSupportTicketView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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: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}"
|
||||
Background="#EEF1F4"
|
||||
FontFamily="Microsoft YaHei UI"
|
||||
FontSize="14"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibility" />
|
||||
<SolidColorBrush x:Key="BrandBrush" Color="#98638F" />
|
||||
<SolidColorBrush x:Key="BrandSoftBrush" Color="#F3EAF2" />
|
||||
<SolidColorBrush x:Key="LineBrush" Color="#DDE2E8" />
|
||||
<SolidColorBrush x:Key="TextBrush" Color="#1F2933" />
|
||||
<SolidColorBrush x:Key="SubTextBrush" Color="#6B7785" />
|
||||
<SolidColorBrush x:Key="BackgroundBrush" Color="#EEF1F4" />
|
||||
<SolidColorBrush x:Key="PanelBrush" Color="#FFFFFF" />
|
||||
<SolidColorBrush x:Key="OtherBubbleBrush" Color="#F1F3F6" />
|
||||
<SolidColorBrush x:Key="ErrorBrush" Color="#B3261E" />
|
||||
<SolidColorBrush x:Key="WaitingBrush" Color="#B45309" />
|
||||
<SolidColorBrush x:Key="WaitingBackgroundBrush" Color="#FDF0DA" />
|
||||
<SolidColorBrush x:Key="RepliedBrush" Color="#1D5FA8" />
|
||||
<SolidColorBrush x:Key="RepliedBackgroundBrush" Color="#E2EDF9" />
|
||||
<SolidColorBrush x:Key="DoneBrush" Color="#5B6673" />
|
||||
<SolidColorBrush x:Key="DoneBackgroundBrush" Color="#E9ECF0" />
|
||||
|
||||
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="{StaticResource BrandBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrandBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="14,6" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
x:Name="Root"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<ContentPresenter
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Root" Property="Opacity" Value="0.88" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Root" Property="Opacity" Value="0.72" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Root" Property="Opacity" Value="0.45" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="GhostButtonStyle" TargetType="Button">
|
||||
<Setter Property="Foreground" Value="{StaticResource BrandBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BrandBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Padding" Value="12,5" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
x:Name="Root"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="4">
|
||||
<ContentPresenter
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Root" Property="Background" Value="{StaticResource BrandSoftBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Root" Property="Opacity" Value="0.42" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StatusTagStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="{StaticResource DoneBackgroundBrush}" />
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="Padding" Value="8,2" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="waiting_reply">
|
||||
<Setter Property="Background" Value="{StaticResource WaitingBackgroundBrush}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="replied">
|
||||
<Setter Property="Background" Value="{StaticResource RepliedBackgroundBrush}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="completed">
|
||||
<Setter Property="Background" Value="{StaticResource DoneBackgroundBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="StatusTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource DoneBrush}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="waiting_reply">
|
||||
<Setter Property="Foreground" Value="{StaticResource WaitingBrush}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="replied">
|
||||
<Setter Property="Foreground" Value="{StaticResource RepliedBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TicketListItemStyle" TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Border
|
||||
x:Name="Root"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="3,0,0,1">
|
||||
<ContentPresenter />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Root" Property="Background" Value="{StaticResource BackgroundBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Root" Property="Background" Value="{StaticResource BrandSoftBrush}" />
|
||||
<Setter TargetName="Root" Property="BorderBrush" Value="{StaticResource BrandBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ChatListItemStyle" TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="IsHitTestVisible" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="16">
|
||||
<Border
|
||||
Background="{StaticResource PanelBrush}"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,0,1,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Height="52"
|
||||
Margin="14,0">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
FontSize="15"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="历史工单" />
|
||||
<Border
|
||||
Margin="8,0,0,0"
|
||||
Padding="7,2"
|
||||
VerticalAlignment="Center"
|
||||
Background="#B3261E"
|
||||
CornerRadius="9"
|
||||
Visibility="{Binding HasNewData, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock
|
||||
FontSize="11"
|
||||
Foreground="White"
|
||||
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="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Padding="11,10,14,10"
|
||||
Background="{StaticResource BrandSoftBrush}"
|
||||
BorderBrush="{StaticResource BrandBrush}"
|
||||
BorderThickness="3,1,0,1"
|
||||
Visibility="{Binding IsDraftVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="新工单(未提交)" />
|
||||
<TextBlock
|
||||
Margin="0,5,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding SelectedOrder.OrderId, StringFormat=订单 {0}}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
Margin="0,4,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="请在右侧描述问题" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
behaviors:ListBoxInteractionBehavior.SelectedItemCommand="{Binding SelectTicketCommand}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource TicketListItemStyle}"
|
||||
ItemsSource="{Binding Tickets}"
|
||||
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.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0" Margin="0,0,0,5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding WechatOrderId}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<Border
|
||||
x:Name="UnreadBadge"
|
||||
Height="18"
|
||||
MinWidth="18"
|
||||
Margin="6,-1,0,0"
|
||||
Padding="5,0"
|
||||
Background="{StaticResource BrandBrush}"
|
||||
CornerRadius="9">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="11"
|
||||
Foreground="White"
|
||||
Text="{Binding UnreadCount}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<Border HorizontalAlignment="Right" 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.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding PreviewText}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="8,0,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding UpdatedAtText}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding UnreadCount}" Value="0">
|
||||
<Setter TargetName="UnreadBadge" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<Button
|
||||
Grid.Row="2"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Command="{Binding RetryRealtimeCommand}"
|
||||
Cursor="Hand"
|
||||
ToolTip="点击重新连接">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter Margin="14,9" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Ellipse
|
||||
Width="8"
|
||||
Height="8"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center">
|
||||
<Ellipse.Style>
|
||||
<Style TargetType="Ellipse">
|
||||
<Setter Property="Fill" Value="{StaticResource SubTextBrush}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SseState}" Value="Connected">
|
||||
<Setter Property="Fill" Value="#2F7D4F" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding SseState}" Value="Connecting">
|
||||
<Setter Property="Fill" Value="{StaticResource WaitingBrush}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding SseState}" Value="Reconnecting">
|
||||
<Setter Property="Fill" Value="{StaticResource WaitingBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Ellipse.Style>
|
||||
</Ellipse>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
d:Text="推送"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding SseStatusText}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="14,12,14,0"
|
||||
Padding="10,7"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Setter Property="Background" Value="#FFF7E8" />
|
||||
<Setter Property="BorderBrush" Value="#E8C98C" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding NoticeText}" Value="">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding NoticeText}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsNoticeError}" Value="True">
|
||||
<Setter Property="Background" Value="#FDECEA" />
|
||||
<Setter Property="BorderBrush" Value="#E8AAA4" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="{Binding NoticeText}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid Visibility="{Binding IsChatVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Padding="18,11"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
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>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding SelectedTicket.AppId, StringFormat=店铺 {0}}" />
|
||||
</StackPanel>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Command="{Binding LoadEarlierMessagesCommand}"
|
||||
Content="加载更早留言">
|
||||
<Button.Style>
|
||||
<Style BasedOn="{StaticResource GhostButtonStyle}" TargetType="Button">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasMoreMessages}" Value="False">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<ListBox
|
||||
x:Name="MessagesListBox"
|
||||
Margin="18,10"
|
||||
behaviors:ListBoxInteractionBehavior.ScrollVersion="{Binding MessageScrollVersion}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource ChatListItemStyle}"
|
||||
ItemsSource="{Binding Messages}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:ChatMessageViewModel}">
|
||||
<Grid Margin="0,5">
|
||||
<StackPanel
|
||||
x:Name="BubbleColumn"
|
||||
MaxWidth="560"
|
||||
HorizontalAlignment="Left">
|
||||
<TextBlock
|
||||
x:Name="SenderText"
|
||||
Margin="1,0,0,3"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}">
|
||||
<Run Text="{Binding SenderDisplayName, Mode=OneWay}" />
|
||||
<Run Text=" " />
|
||||
<Run Text="{Binding CreatedAtText, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
<Border
|
||||
x:Name="Bubble"
|
||||
Padding="13,9"
|
||||
Background="{StaticResource OtherBubbleBrush}"
|
||||
CornerRadius="8,8,8,2">
|
||||
<TextBlock
|
||||
x:Name="BubbleText"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
LineHeight="22"
|
||||
Text="{Binding Content}"
|
||||
TextWrapping="Wrap" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsCustomer}" Value="True">
|
||||
<Setter TargetName="BubbleColumn" Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter TargetName="Bubble" Property="Background" Value="{StaticResource BrandBrush}" />
|
||||
<Setter TargetName="Bubble" Property="CornerRadius" Value="8,8,2,8" />
|
||||
<Setter TargetName="BubbleText" Property="Foreground" Value="White" />
|
||||
<Setter TargetName="SenderText" Property="HorizontalAlignment" Value="Right" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsRecalled}" Value="True">
|
||||
<Setter TargetName="Bubble" Property="Opacity" Value="0.62" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="18"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="暂无公开留言">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Messages.Count}" Value="0">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Padding="18,12"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Border
|
||||
Padding="12,10"
|
||||
Background="{StaticResource PanelBrush}"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
MinHeight="64"
|
||||
MaxHeight="110"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
MaxLength="4000"
|
||||
Text="{Binding ChatText, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap"
|
||||
ToolTip="{Binding ComposerPlaceholder}"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding
|
||||
Key="Enter"
|
||||
Command="{Binding SendMessageCommand}"
|
||||
Modifiers="Control" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<Grid Grid.Row="1" Margin="0,8,0,0">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="Ctrl+Enter 发送" />
|
||||
<TextBlock
|
||||
Margin="0,0,82,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding ChatCharacterCountText}" />
|
||||
<Button
|
||||
Width="72"
|
||||
Height="32"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding SendMessageCommand}"
|
||||
Content="发送"
|
||||
Style="{StaticResource PrimaryButtonStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid Visibility="{Binding IsDraftVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Padding="18,11"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,0,0,1">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
Text="新建工单" />
|
||||
<TextBlock
|
||||
Margin="0,2,0,0"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="提交后进入等待客服回复;已完结订单再次提交会重开原工单。" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Border
|
||||
Margin="18"
|
||||
Padding="14,12"
|
||||
VerticalAlignment="Top"
|
||||
Background="#FAFBFC"
|
||||
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}" />
|
||||
<TextBlock
|
||||
Margin="10,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 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>
|
||||
|
||||
<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>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,7,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>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Padding="18,12"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<Border
|
||||
Padding="12,10"
|
||||
Background="{StaticResource PanelBrush}"
|
||||
BorderBrush="{StaticResource LineBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
MinHeight="64"
|
||||
MaxHeight="110"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{StaticResource TextBrush}"
|
||||
MaxLength="2000"
|
||||
Text="{Binding DraftText, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextWrapping="Wrap"
|
||||
ToolTip="请描述您遇到的问题"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding
|
||||
Key="Enter"
|
||||
Command="{Binding CreateTicketCommand}"
|
||||
Modifiers="Control" />
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
<Grid Grid.Row="1" Margin="0,8,0,0">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="Ctrl+Enter 提交" />
|
||||
<TextBlock
|
||||
Margin="0,0,96,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="{Binding DraftCharacterCountText}" />
|
||||
<Button
|
||||
Width="86"
|
||||
Height="32"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{Binding CreateTicketCommand}"
|
||||
Content="提交工单"
|
||||
Style="{StaticResource PrimaryButtonStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsEmptyVisible, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="在左侧选择工单,或点击“新建”提交新工单" />
|
||||
<TextBlock
|
||||
Margin="0,6,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{StaticResource SubTextBrush}"
|
||||
Text="实时通知已订阅当前拍单账号下的全部店铺" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<ProgressBar
|
||||
Grid.RowSpan="2"
|
||||
Height="3"
|
||||
VerticalAlignment="Top"
|
||||
Foreground="{StaticResource BrandBrush}"
|
||||
IsIndeterminate="True"
|
||||
Visibility="{Binding IsLoading, Converter={StaticResource BoolToVisibility}}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,94 @@
|
||||
using OrderSupportTicket.Models;
|
||||
using OrderSupportTicket.Services;
|
||||
using OrderSupportTicket.ViewModels;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace OrderSupportTicket.Views;
|
||||
|
||||
/// <summary>
|
||||
/// 工单对话页面。页面生命周期只负责激活/停用 ViewModel,业务交互均在 ViewModel 中。
|
||||
/// </summary>
|
||||
public partial class OrderSupportTicketView : UserControl
|
||||
{
|
||||
private bool _active;
|
||||
|
||||
public OrderSupportTicketView()
|
||||
: this(
|
||||
new TicketApiService(),
|
||||
new EventSourceTicketRealtimeService(),
|
||||
TicketClientOptions.FromApplicationSettings())
|
||||
{
|
||||
}
|
||||
|
||||
public OrderSupportTicketView(
|
||||
ITicketApiService api,
|
||||
ITicketRealtimeService realtime,
|
||||
TicketClientOptions options = null)
|
||||
{
|
||||
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);
|
||||
DataContext = ViewModel;
|
||||
Loaded += OnLoaded;
|
||||
Unloaded += OnUnloaded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前页面对应的工单 ViewModel。
|
||||
/// </summary>
|
||||
public OrderSupportTicketViewModel ViewModel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 宿主可在页面加载前注入账号、APPID 与本地订单数据。
|
||||
/// </summary>
|
||||
public void Configure(TicketClientOptions options)
|
||||
{
|
||||
ViewModel.Configure(options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从订单页直接打开新工单草稿。
|
||||
/// </summary>
|
||||
public void OpenNewTicket(TicketOrderOption order)
|
||||
{
|
||||
ViewModel.OpenNewTicket(order);
|
||||
}
|
||||
|
||||
private async void OnLoaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (_active)
|
||||
return;
|
||||
_active = true;
|
||||
await ViewModel.InitializeAsync();
|
||||
}
|
||||
|
||||
private async void OnUnloaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (!_active)
|
||||
return;
|
||||
_active = false;
|
||||
await ViewModel.DeactivateAsync();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user