From b6b72e6bc3bcd10ac6502c525fff5cd3c7085941 Mon Sep 17 00:00:00 2001 From: chfei Date: Fri, 7 Aug 2026 10:07:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1Border?= =?UTF-8?q?=E3=80=82=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?DataGrid=E7=9A=84=E5=88=97=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/ShopRevenueStatisticsModels.cs | 136 +++++-- .../PeriodRevenueStatisticsView.xaml | 363 ++++++++---------- .../RevenueStatisticsSearchBar.xaml | 103 +++++ .../RevenueStatisticsSearchBar.xaml.cs | 16 + .../Ctrls/Statistics/RevenueSummaryCards.xaml | 283 ++++++++++++++ .../Statistics/RevenueSummaryCards.xaml.cs | 17 + .../Services/ShopRevenueStatisticsService.cs | 344 +++++++++-------- .../Statistics/ShopRevenueStatisticsView.xaml | 295 +------------- .../PeriodRevenueStatisticsViewModel.cs | 13 + 9 files changed, 883 insertions(+), 687 deletions(-) create mode 100644 29WxOrderWpf/Ctrls/Statistics/RevenueStatisticsSearchBar.xaml create mode 100644 29WxOrderWpf/Ctrls/Statistics/RevenueStatisticsSearchBar.xaml.cs create mode 100644 29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml create mode 100644 29WxOrderWpf/Ctrls/Statistics/RevenueSummaryCards.xaml.cs diff --git a/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs b/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs index 685a294..7ba2cea 100644 --- a/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs +++ b/29WxOrderWpf/Ctrls/Statistics/Models/ShopRevenueStatisticsModels.cs @@ -15,80 +15,128 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models /// 结束时间 public DateTime EndDate { get; set; } - /// 店铺 app_key(A.app_key),空/Null 表示全部店铺 + /// 店铺 shop_id(B.shop_id),空/Null 表示全部店铺 public string ShopKey { get; set; } } /// /// 店铺营收统计 - 接口返回的原始明细行。 - /// 对应接口返回字段: - /// A.app_key, B.create_time, B.order_id, B.status, - /// B.product_price, B.order_price, B.purchase_price, B.freight, - /// B.predict_commission_fee, B.commission_amount, B.discounted_price, B.profit, - /// B.purchase_status, c.refund_status - /// 其中 A 为店铺表,B 为订单表,c 为售后/退款表。 - /// 金额字段单位均为“分”,展示时需除以 100。 + /// 与后端 WXOrderAmountInfo 保持一致(camelCase JSON): + /// shopName, createTime, orderId, status, productPrice, orderPrice, purchasePrice, freight, + /// predictCommissionFee, commissionAmount, discountedPrice, profit, purchaseStatus, + /// outAmount, refundStatus, refundStatusString, refundAmount, externalProcurement + /// 金额字段单位均为分(显示时需除以 100)。 /// public class ShopRevenueStatisticsRow { - /// A.app_key 店铺 app_key - [JsonProperty("app_key")] - public string AppKey { get; set; } + /// + /// 店铺名称 + /// + [JsonProperty("shop_name")] + public string ShopName { get; set; } - /// B.create_time 订单创建时间(接口为秒级时间戳,由 UnixDateTimeConverter 转换为 DateTime) + /// + /// 下单时间(秒级时间戳) + /// [JsonProperty("create_time")] [JsonConverter(typeof(UnixDateTimeConverter))] public DateTime CreateTime { get; set; } - /// B.order_id 订单号 + /// + /// 订单号 + /// [JsonProperty("order_id")] public string OrderId { get; set; } - /// B.status 订单状态:10-待付款;20-待发货;21-部分发货;30-待收货;100-完成;200-全部商品售后之后订单取消;250-未付款用户主动取消或超时未付款订单自动取消 + /// + /// 订单状态 + /// + [JsonProperty("status")] public int Status { get; set; } - /// B.product_price 商品总价(分) + /// + /// 商品总价(分) + /// [JsonProperty("product_price")] public int ProductPrice { get; set; } - /// B.order_price 订单金额(分),计算公式:order_price = original_order_price - discounted_price - deduction_price - change_down_price + /// + /// 订单金额(分) + /// [JsonProperty("order_price")] public int OrderPrice { get; set; } - /// B.purchase_price 采购价(分) + /// + /// 采购价(分) + /// [JsonProperty("purchase_price")] public int PurchasePrice { get; set; } - /// B.freight 运费(分) + /// + /// 运费(分) + /// + [JsonProperty("freight")] public int Freight { get; set; } - /// B.predict_commission_fee 平台服务费(微信小店:预计技术服务费)(分) + /// + /// 平台服务费(预计技术服务费,分) + /// [JsonProperty("predict_commission_fee")] public int PredictCommissionFee { get; set; } - /// B.commission_amount 达人佣金(微信小店:分账金额)(分) + /// + /// 达人佣金(分) + /// [JsonProperty("commission_amount")] public int CommissionAmount { get; set; } - /// B.discounted_price 优惠券优惠金额(分) + /// + /// 优惠金额(分) + /// [JsonProperty("discounted_price")] public int DiscountedPrice { get; set; } - /// B.profit 利润(分),计算公式:实付金额 - 采购价 - 平台服务费 - 达人佣金(采购价、达人佣金为空值则按 0) + /// + /// 利润(分) + /// + [JsonProperty("profit")] public int Profit { get; set; } - /// B.purchase_status 采购状态:0-未采购;1-采购(默认值 0,推送仓库时修改为 1) + /// + /// 采购状态 + /// [JsonProperty("purchase_status")] public int PurchaseStatus { get; set; } - /// c.refund_status 退款状态(4/11 视为已退款,与 RevenueStatisticsAggregator.IsRefunded 保持一致) + /// + /// 外采金额(分),out_amount为空或0时从中转仓订单表补全 + /// + [JsonProperty("out_amount")] + public int OutAmount { get; set; } + + /// + /// 售后状态(订单明细 refund_status) + /// [JsonProperty("refund_status")] public int RefundStatus { get; set; } - /// 店铺名称(由 app_key 关联店铺表得到,展示用,非接口原始字段) - [JsonProperty("shop_name")] - public string ShopName { get; set; } + /// + /// 售后状态(退款单 status) + /// + [JsonProperty("refund_status_string")] + public string RefundStatusString { get; set; } + /// + /// 售后退款金额(分) + /// + [JsonProperty("refund_amount")] + public int RefundAmount { get; set; } + + /// + /// 是否外采:0=未从中转仓订单表查到,1=查到 + /// + [JsonProperty("external_procurement")] + public int ExternalProcurement { get; set; } } /// @@ -98,7 +146,6 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models { /// 销售额(最终有效销售额) public decimal SalesAmount { get; set; } - /// 有效订单数(已扣除退款订单) public int ValidOrderCount { get; set; } @@ -111,14 +158,20 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models /// 商品销量(有效销量) public int ProductSalesVolume { get; set; } - /// 客户数(成交客户) - public int CustomerCount { get; set; } + /// 平台服务费总额(元) + public decimal PlatformFeeTotal { get; set; } + + /// 达人佣金(元) + public decimal Commission { get; set; } /// 客单价(平均每单金额) public decimal AvgOrderAmount { get; set; } /// 退款率(退款订单占比,百分数,如 2.31 表示 2.31%) public decimal RefundRate { get; set; } + + /// 平均利润率(利润 / 采购金额,百分数,如 12.34 表示 12.34%) + public decimal AverageProfitRate { get; set; } } /// @@ -174,11 +227,17 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models /// 退款金额(元) public decimal RefundAmount { get; set; } - /// 客户数 - public int CustomerCount { get; set; } + /// 平台服务费总额(元) + public decimal PlatformFeeTotal { get; set; } + + /// 达人佣金(元) + public decimal Commission { get; set; } /// 客单价(元) public decimal AvgOrderAmount { get; set; } + + /// 平均利润率(利润 / 采购金额,百分数,如 12.34 表示 12.34%) + public decimal AverageProfitRate { get; set; } } /// @@ -220,6 +279,15 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models /// 退款金额(元) public decimal RefundAmount { get; set; } + /// 平台服务费总额(元) + public decimal PlatformFeeTotal { get; set; } + + /// 达人佣金(元) + public decimal Commission { get; set; } + + /// 平均利润率(利润 / 采购金额,百分数,如 12.34 表示 12.34%) + public decimal AverageProfitRate { get; set; } + /// 客户数 public int CustomerCount { get; set; } @@ -234,7 +302,7 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models { /// 店铺 app_key(A.app_key) public string AppKey { get; set; } - + public string ShopId { get; set; } /// 店铺名称 public string ShopName { get; set; } } @@ -299,4 +367,4 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Models writer.WriteValue(milliseconds); } } -} \ No newline at end of file +} diff --git a/29WxOrderWpf/Ctrls/Statistics/PeriodRevenueStatisticsView.xaml b/29WxOrderWpf/Ctrls/Statistics/PeriodRevenueStatisticsView.xaml index 668a765..477222e 100644 --- a/29WxOrderWpf/Ctrls/Statistics/PeriodRevenueStatisticsView.xaml +++ b/29WxOrderWpf/Ctrls/Statistics/PeriodRevenueStatisticsView.xaml @@ -4,6 +4,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:stat="clr-namespace:_29WxOrderWpf.Ctrls.Statistics" xmlns:vm="clr-namespace:_29WxOrderWpf.Ctrls.Statistics.ViewModels" d:Background="#F5F7FB" d:DataContext="{d:DesignInstance Type=vm:PeriodRevenueStatisticsViewModel}" @@ -13,11 +14,6 @@ - - - + + + + + + + + + + + + + + + +