利润统计 功能开放

统计页面增加新的统计功能
This commit is contained in:
chfei committed 2026-08-07 18:52:33 +08:00
1 parent f12a7f14ea
commit d25374956e
10 files changed
+571 -323

No files matched your search

@@ -5,11 +5,12 @@
xmlns:charts="clr-namespace:_29WxOrderWpf.Ctrls.Statistics.Charts"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:_29WxOrderWpf.Ctrls.Statistics.ViewModels"
xmlns:stat="clr-namespace:_29WxOrderWpf.Ctrls.Statistics"
xmlns:vm="clr-namespace:_29WxOrderWpf.Ctrls.Statistics.ViewModels"
xmlns:wpf="clr-namespace:_29WxOrderWpf.Common"
d:Background="#F5F7FB"
d:DataContext="{d:DesignInstance Type=vm:ShopRevenueStatisticsViewModel,IsDesignTimeCreatable=True}"
d:DataContext="{d:DesignInstance Type=vm:ShopRevenueStatisticsViewModel,
IsDesignTimeCreatable=True}"
d:DesignHeight="900"
d:DesignWidth="1600"
wpf:DialogWindowProperty.ResizeMode="CanResizeWithGrip"
@@ -67,16 +68,14 @@
Background="Transparent">
<TabPanel
x:Name="HeaderPanel"
IsItemsHost="True"
Background="Transparent" />
Background="Transparent"
IsItemsHost="True" />
</Border>
<Border
Grid.Row="1"
Background="Transparent"
CornerRadius="0,8,8,8">
<ContentPresenter
x:Name="PART_SelectedContentHost"
ContentSource="SelectedContent" />
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" />
</Border>
</Grid>
</ControlTemplate>
@@ -124,158 +123,208 @@
<Grid Background="#F5F7FB">
<TabControl Style="{StaticResource StatisticsTabControlStyle}">
<TabItem
Header="综合统计"
Style="{StaticResource StatisticsTabItemStyle}">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Margin="12">
<TabItem Header="综合统计" Style="{StaticResource StatisticsTabItemStyle}">
<ScrollViewer
wpf:ScrollViewerBehavior.FixMouseWheel="True"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<StackPanel Margin="12">
<!-- ============ 查询条件工具栏(共享 UserControl) ============ -->
<stat:RevenueStatisticsSearchBar />
<!-- ============ 查询条件工具栏(共享 UserControl) ============ -->
<stat:RevenueStatisticsSearchBar />
<!-- ============ 汇总卡片(共享 UserControl) ============ -->
<stat:RevenueSummaryCards />
<!-- ============ 汇总卡片(共享 UserControl) ============ -->
<stat:RevenueSummaryCards />
<!-- ============ 图表区域 ============ -->
<Grid Margin="3,8,3,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<!-- ============ 图表区域 ============ -->
<Grid Margin="3,8,3,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<!-- 销售趋势 -->
<Border
Grid.Column="0"
Margin="6,6,3,6"
Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock Style="{StaticResource PanelTitleStyle}" Text="销售趋势" />
<charts:RevenueLineChart
Height="330"
Margin="0,10,0,0"
Points="{Binding TrendData}" />
</StackPanel>
</Border>
<!-- 销售趋势 -->
<Border
Grid.Column="0"
Margin="6,6,3,6"
Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock Style="{StaticResource PanelTitleStyle}" Text="销售趋势" />
<charts:RevenueLineChart
Height="330"
Margin="0,10,0,0"
Points="{Binding TrendData}" />
</StackPanel>
</Border>
<!-- 店铺销售占比 -->
<Border
Grid.Column="1"
Margin="3,6,6,6"
Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock Style="{StaticResource PanelTitleStyle}" Text="店铺销售占比 TOP 5" />
<charts:RevenuePieChart
Height="330"
Margin="0,10,0,0" MaxItems="5"
ItemsSource="{Binding ShopProportionData}" />
</StackPanel>
</Border>
</Grid>
<!-- 店铺销售占比 -->
<Border
Grid.Column="1"
Margin="3,6,6,6"
Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock Style="{StaticResource PanelTitleStyle}" Text="店铺销售占比 TOP 5" />
<charts:RevenuePieChart
Height="330"
Margin="0,10,0,0"
ItemsSource="{Binding ShopProportionData}"
MaxItems="5" />
</StackPanel>
</Border>
</Grid>
<!-- ============ 店铺统计表格 ============ -->
<Border Margin="6,8,6,12" Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock
Margin="0,0,0,10"
Style="{StaticResource PanelTitleStyle}"
Text="店铺统计" />
<DataGrid
AlternatingRowBackground="#FAFAFA"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
ColumnHeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}"
FontSize="13"
Foreground="#333333"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
HorizontalGridLinesBrush="#EEEEEE"
IsReadOnly="True"
ItemsSource="{Binding ShopStatistics}"
RowHeight="46"
ScrollViewer.CanContentScroll="True"
SelectionMode="Single"
SelectionUnit="FullRow"
VerticalScrollBarVisibility="Disabled">
<DataGrid.Columns>
<DataGridTextColumn
Width="*"
Binding="{Binding ShopName}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="店铺" />
<DataGridTextColumn
Width="*"
Binding="{Binding OrderCount, StringFormat={}{0:N0}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="订单数" />
<DataGridTextColumn
Width="*"
Binding="{Binding SalesAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="销售额" />
<DataGridTextColumn
Width="*"
Binding="{Binding Profit, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="利润" />
<DataGridTextColumn
Width="*"
Binding="{Binding RefundAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="退款金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding PlatformFeeTotal, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="平台服务费总额" />
<DataGridTextColumn
Width="*"
Binding="{Binding Commission, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="达人佣金" />
<DataGridTextColumn
Width="*"
Binding="{Binding AverageProfitRate, StringFormat={}{0:0.00}%}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="平均利润率" />
<DataGridTextColumn
Width="*"
Binding="{Binding AvgOrderAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="客单价" />
</DataGrid.Columns>
</DataGrid>
<!-- ============ 店铺统计表格 ============ -->
<Border Margin="6,8,6,12" Style="{StaticResource CardBorderStyle}">
<StackPanel>
<TextBlock
Margin="0,0,0,10"
Style="{StaticResource PanelTitleStyle}"
Text="店铺统计" />
<DataGrid
AlternatingRowBackground="#FAFAFA"
AutoGenerateColumns="False"
Background="Transparent"
BorderThickness="0"
CanUserAddRows="False"
CanUserDeleteRows="False"
CanUserReorderColumns="False"
CanUserResizeRows="False"
ColumnHeaderStyle="{StaticResource BaseDataGridColumnHeaderStyle}"
FontSize="13"
Foreground="#333333"
GridLinesVisibility="Horizontal"
HeadersVisibility="Column"
HorizontalGridLinesBrush="#EEEEEE"
IsReadOnly="True"
ItemsSource="{Binding ShopStatistics}"
RowHeight="46"
ScrollViewer.CanContentScroll="True"
SelectionMode="Single"
SelectionUnit="FullRow"
VerticalScrollBarVisibility="Disabled">
<DataGrid.Columns>
<DataGridTextColumn
Width="*"
Binding="{Binding ShopName}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="店铺" />
<DataGridTextColumn
Width="*"
Binding="{Binding OrderCount, StringFormat={}{0:N0}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="订单数" />
<DataGridTextColumn
Width="*"
Binding="{Binding SalesAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="销售额" />
<DataGridTextColumn
Width="*"
Binding="{Binding BuyerPaymentAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="采购金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding Profit, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="利润" />
<DataGridTextColumn
Width="*"
Binding="{Binding RefundAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="退款金额" />
<DataGridTextColumn
Width="*"
Binding="{Binding PlatformFeeTotal, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="平台服务费总额" />
<DataGridTextColumn
Width="*"
Binding="{Binding Commission, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="达人佣金" />
<DataGridTextColumn
Width="*"
Binding="{Binding AverageProfitRate, StringFormat={}{0:0.00}%}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="平均利润率" />
<DataGridTextColumn
Width="*"
Binding="{Binding AvgOrderAmount, StringFormat={}¥{0:N2}}"
ElementStyle="{StaticResource CenterCellTextStyle}"
Header="客单价" />
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Border>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</TabItem>
</ScrollViewer>
</TabItem>
<TabItem
Header="天统计"
Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Day" />
</TabItem>
<TabItem Header="天统计" Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Day" />
</TabItem>
<TabItem
Header="周统计"
Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Week" />
</TabItem>
<TabItem Header="周统计" Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Week" />
</TabItem>
<TabItem
Header="月统计"
Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Month" />
</TabItem>
<TabItem Header="月统计" Style="{StaticResource StatisticsTabItemStyle}">
<stat:PeriodRevenueStatisticsView PeriodType="Month" />
</TabItem>
</TabControl>
<!-- helper -->
<Border
Margin="0,20,30,0"
Padding="10"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="{StaticResource pageColorBrush}"
BorderThickness="1"
Cursor="Hand"
MouseLeftButtonDown="help_mouseLeftButtonDown">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="Black"
Foreground="White"
Text="利润计算逻辑" />
</Border>
<!-- Popup 弹出层 -->
<Popup
x:Name="InfoPopup"
AllowsTransparency="True"
Placement="Center"
PopupAnimation="Fade">
<Border
Padding="20"
Background="{StaticResource pageColorBrush}"
BorderThickness="1"
CornerRadius="4">
<Grid>
<Button
Margin="0,-10,-10,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="Transparent" Click="close"
Content="x" />
<TextBlock Margin="0,10,0,0"
x:Name="PopupText"
MaxWidth="500"
FontSize="16"
Foreground="White"
LineHeight="25"
Text="利润计算:真实店铺利润。已下单的订单金额减去采购金额减去平台手续费减去达人佣金=实际计算利润,未下单的订单不计入。 &#x0a;&#x0a;售后计算:只计算采购后发生的售后。发生售后金额减去发生售后采购总金额减去采购已退回金额=没退回金额(次月拉上月即可查到售后货损)发生售后店铺毛利自动减少。计算出店铺精准毛利。 &#x0a;&#x0a;纯利计算:你们减去中转仓金额和店铺运费险。人工等额外金额。即可精准算出。"
TextWrapping="WrapWithOverflow" />
</Grid>
</Border>
</Popup>
<!-- ============ 加载遮罩 ============ -->
<Border Background="#66FFFFFF" Visibility="{Binding IsLoading, Converter={StaticResource boolToVisibilityConverter}}" d:Visibility="Collapsed" >
<Border
d:Visibility="Collapsed"
Background="#66FFFFFF"
Visibility="{Binding IsLoading, Converter={StaticResource boolToVisibilityConverter}}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<ProgressBar
Width="240"