增加商铺列表

This commit is contained in:
chfei committed 2026-11-16 12:17:45 +08:00
1 parent d5232c581c
commit 440510aa8c
19 files changed
+734 -77

No files matched your search

@@ -176,7 +176,7 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="Foreground" Value="{Binding SelectedRowForeground, RelativeSource={RelativeSource AncestorType={x:Type local:DataGridEx}}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -203,7 +203,7 @@
</Border>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Value="True">
<Setter Property="Foreground" Value="White" />
<Setter Property="Foreground" Value="{Binding SelectedRowForeground, RelativeSource={RelativeSource AncestorType={x:Type local:DataGridEx}}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -334,7 +334,7 @@
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="fousIcon" Property="Opacity" Value="1" />
<!-- 整行变色 -->
<Setter TargetName="border" Property="Background" Value="#4BB2FF" />
<Setter TargetName="border" Property="Background" Value="{Binding SelectedRowBackground, RelativeSource={RelativeSource AncestorType={x:Type local:DataGridEx}}}" />
</Trigger>
<Trigger Property="DetailsVisibility" Value="Visible">
<Setter TargetName="DetailsPresenter" Property="Margin" Value="0,0,1,0" />
@@ -370,65 +370,42 @@
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<Border
Padding="0"
Background="White"
BorderBrush="#DDE0E5"
BorderThickness="1"
CornerRadius="6">
BorderBrush="LightGray"
BorderThickness="1">
<StackPanel KeyboardNavigation.DirectionalNavigation="Cycle">
<StackPanel Margin="14,12,14,8">
<TextBlock
FontSize="14"
FontWeight="SemiBold"
Text="显示的列" />
<TextBlock
Margin="0,4,0,0"
Foreground="#858A94"
Text="勾选后立即生效" />
</StackPanel>
<Border
Padding="10,0"
Background="#eeeeee"
BorderBrush="{StaticResource BorderBrush}"
BorderThickness="0,0,0,1">
<Grid>
<TextBlock
VerticalAlignment="Center"
FontSize="14"
FontWeight="SemiBold"
Text="显示的列" />
<Button
Width="64"
Height="28"
HorizontalAlignment="Right"
Background="Transparent"
BorderThickness="0"
Command="{x:Static ApplicationCommands.Close}"
Content="完成"
Style="{x:Null}" />
</Grid>
</Border>
<ScrollViewer
MaxHeight="340"
Margin="6,0,6,8"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Cycle" />
</ScrollViewer>
<Border
Padding="12,9"
Background="#FAFAFB"
BorderBrush="#ECEEF1"
BorderThickness="0,1,0,0">
<Button
x:Name="PART_DoneButton"
Width="64"
Height="28"
HorizontalAlignment="Right"
Background="#98638F"
BorderThickness="0"
Command="{x:Static ApplicationCommands.Close}"
Content="完成"
Foreground="White">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border
x:Name="ButtonBorder"
Background="{TemplateBinding Background}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Opacity" Value="0.85" />
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="#343A40" />
<Setter TargetName="ButtonBorder" Property="BorderThickness" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</Border>
</StackPanel>
</Border>
</ControlTemplate>
@@ -1006,7 +983,10 @@
<Setter Property="HorizontalContentAlignment" Value="Right" />
</Style>
<Style x:Key="DataGridExBaseStyle" BasedOn="{StaticResource DataGridExDefaultDataGridStyle}" TargetType="local:DataGridEx">
<Style
x:Key="DataGridExBaseStyle"
BasedOn="{StaticResource DataGridExDefaultDataGridStyle}"
TargetType="local:DataGridEx">
<Setter Property="EnableRowVirtualization" Value="True" />
<Setter Property="EnableColumnVirtualization" Value="True" />
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True" />
@@ -0,0 +1,11 @@
using Riok.Mapperly.Abstractions;
using Store.Management.Framework.ViewModels;
using Store.Management.Models;
namespace Store.Management.Framework.Mappers;
[Mapper]
public static partial class ShopMapper
{
public static partial IReadOnlyList<ShopItemViewModel> ToItemViewModels(IReadOnlyList<ShopInfo> shops);
}
@@ -13,6 +13,58 @@
<ResourceDictionary Source="/Store.Management.Framework;component/Controls/DataGridEx/DataGridEx.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="IconButtonStyle"
BasedOn="{StaticResource ButtonCustom}"
TargetType="Button">
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="28" />
<Setter Property="Padding" Value="0" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Cursor" Value="Hand" />
</Style>
<!-- 表格搜索区:统一尺寸,窄窗口允许换行。 -->
<Style x:Key="TableSearchTextBoxStyle" BasedOn="{StaticResource TextBoxExtend}" TargetType="TextBox">
<Setter Property="Width" Value="180" />
<Setter Property="Height" Value="32" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style x:Key="TableSearchComboBoxStyle" BasedOn="{StaticResource {x:Type ComboBox}}" TargetType="ComboBox">
<Setter Property="Width" Value="180" />
<Setter Property="Height" Value="32" />
</Style>
<Style x:Key="TableSearchButtonStyle" BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Setter Property="Width" Value="80" />
<Setter Property="Height" Value="32" />
<Setter Property="Padding" Value="8,0" />
</Style>
<Style x:Key="TableSearchPrimaryButtonStyle" BasedOn="{StaticResource ButtonPrimary}" TargetType="Button">
<Setter Property="Width" Value="80" />
<Setter Property="Height" Value="32" />
<Setter Property="Padding" Value="8,0" />
</Style>
<Style x:Key="TableSearchBarStyle" TargetType="wpf:SpacingStackPanel">
<Style.Resources>
<Style BasedOn="{StaticResource TableSearchTextBoxStyle}" TargetType="TextBox" />
<Style BasedOn="{StaticResource TableSearchComboBoxStyle}" TargetType="ComboBox" />
<Style BasedOn="{StaticResource TableSearchButtonStyle}" TargetType="Button" />
</Style.Resources>
<Setter Property="MinHeight" Value="44" />
<Setter Property="Margin" Value="10,0" />
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="ChildWrapping" Value="True" />
<Setter Property="HorizontalSpacing" Value="8" />
<Setter Property="VerticalSpacing" Value="8" />
<Setter Property="ItemVerticalAlignment" Value="Center" />
</Style>
<FontFamily x:Key="IconPack">Fonts/iconfont.ttf#iconfont</FontFamily>
<Style BasedOn="{StaticResource DataGridExBaseStyle}" TargetType="{x:Type f:DataGridEx}">
@@ -0,0 +1,22 @@
using MAX.Core.DependencyInjection;
using Store.Management.Api;
using Store.Management.Api.Models;
using Store.Management.Api.Shops;
using Store.Management.Models;
namespace Store.Management.Framework.Services;
public interface IShopService
{
Task<IReadOnlyList<ShopCookieInfo>> GetCookiesAsync(string shopId, CancellationToken cancellationToken = default);
Task<PageResult<ShopInfo>> SearchAsync(ShopQueryRequest request, CancellationToken cancellationToken = default);
}
internal sealed class ShopService(StoreApiClient client) : IShopService, ISingletonDependency
{
public Task<IReadOnlyList<ShopCookieInfo>> GetCookiesAsync(string shopId, CancellationToken cancellationToken = default)
=> client.Shops.GetCookiesAsync(shopId, cancellationToken);
public Task<PageResult<ShopInfo>> SearchAsync(ShopQueryRequest request, CancellationToken cancellationToken = default)
=> client.Shops.SearchAsync(request, cancellationToken);
}
@@ -0,0 +1,14 @@
namespace Store.Management.Framework.ViewModels;
public sealed class ShopItemViewModel
{
public int Id { get; init; }
public string? UserName { get; init; }
public string? ShopId { get; init; }
public string? ShopAccount { get; init; }
public string? LoginStatus { get; init; }
public bool IsLoggedOut => LoginStatus?.Contains("未登录", StringComparison.Ordinal) == true;
public string? CompanyName { get; init; }
public string? Notes { get; init; }
public string? GroupName { get; init; }
}