From c70fa07d7d0f71822ac85459f63d5a2a30da9dd9 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 28 Aug 2026 19:05:00 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=AD=9B=E9=80=89=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ctrls/OrderCtrls/OrderListCtrl.xaml | 59 +- .../Ctrls/OrderCtrls/OrderListCtrl.xaml.cs | 42 +- .../OrderCtrls/OrderListRowHeaderCtrl.xaml.cs | 4 +- .../OrderCtrls/OrderListRowItemCtrl.xaml | 93 +-- .../OrderCtrls/OrderListRowItemCtrl.xaml.cs | 20 + 29WxOrderWpf/MainWindow.xaml.cs | 4 +- AllBase/Model/DBModel/oms_wei_order_info.cs | 10 +- Work/29WxOrderWork.csproj | 12 +- ...upplierBLL.cs => WxSimOrderSupplierBLL.cs} | 2 +- Work/_29Tools/BLL/WxSimProductBLL.cs | 109 ++++ Work/_29Tools/Forms/PddMobileBuyOrderForm.cs | 14 +- .../Forms/PddMobileBuyOrderForm.designer.cs | 1 + .../WXOrderListOptimizeForm.Designer.cs | 550 ++++++++++++++++++ .../ProductForms/WXOrderListOptimizeForm.cs | 450 ++++++++++++++ .../ProductForms/WXOrderListOptimizeForm.resx | 298 ++++++++++ 15 files changed, 1600 insertions(+), 68 deletions(-) rename Work/_29Tools/BLL/{WxOrderSupplierBLL.cs => WxSimOrderSupplierBLL.cs} (97%) create mode 100644 Work/_29Tools/BLL/WxSimProductBLL.cs create mode 100644 Work/_29Tools/Forms/ProductForms/WXOrderListOptimizeForm.Designer.cs create mode 100644 Work/_29Tools/Forms/ProductForms/WXOrderListOptimizeForm.cs create mode 100644 Work/_29Tools/Forms/ProductForms/WXOrderListOptimizeForm.resx diff --git a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml index ebdec1d..4d6a1a2 100644 --- a/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml +++ b/29WxOrderWpf/Ctrls/OrderCtrls/OrderListCtrl.xaml @@ -622,7 +622,22 @@ + SizeChanged="TabItem_SizeChanged"> + + + + - + @@ -178,7 +198,7 @@ Text="预计技术服务费" /> - + @@ -201,44 +221,60 @@ - - + + + + + + + + + + + FontSize="14" + Foreground="#888888" + Text="总采购金额" /> + Margin="0,12,0,0" + FontSize="30" + FontWeight="Bold" + Foreground="#333333" + Text="{Binding Summary.BuyerRefundAmount, StringFormat={}¥{0:N2}}" /> + Margin="0,10,0,0" + FontSize="12" + Foreground="#999999" + Text="售后采购金额" /> @@ -263,26 +299,42 @@ - - - + + + + + + + + + + + diff --git a/29WxOrderWpf/Ctrls/Statistics/Services/ShopRevenueStatisticsService.cs b/29WxOrderWpf/Ctrls/Statistics/Services/ShopRevenueStatisticsService.cs index 7941294..ee66da0 100644 --- a/29WxOrderWpf/Ctrls/Statistics/Services/ShopRevenueStatisticsService.cs +++ b/29WxOrderWpf/Ctrls/Statistics/Services/ShopRevenueStatisticsService.cs @@ -45,6 +45,9 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services /// 获取店铺下拉列表(用于查询条件) Task> GetShopOptionsAsync(); + + + } /// @@ -133,8 +136,8 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services int totalOrderCount = list.Count(); int refundOrderCount = refunded.Select(r => r.OrderId).Distinct().Count(); Debug.WriteLine($"计算利润:{(salesAmount - buyerPaymentAmount - platformFeeTotal)}"); - Debug.WriteLine($"正常订单利润:{valid.Sum(r => (decimal)(r.Profit))/100}"); - Debug.WriteLine($"售后订单利润:{refunded.Sum(r => (decimal)(r.Profit))/100}"); + Debug.WriteLine($"正常订单利润:{valid.Sum(r => (decimal)(r.Profit)) / 100}"); + Debug.WriteLine($"售后订单利润:{refunded.Sum(r => (decimal)(r.Profit)) / 100}"); return new ShopRevenueSummary { SalesAmount = salesAmount, @@ -152,6 +155,41 @@ namespace _29WxOrderWpf.Ctrls.Statistics.Services BuyerRefundSuccessedAmount = buyerRefundSuccessedAmount, }; } + /// + /// 获取有效订单 + /// + /// + /// + public static List GetValidOrder(IEnumerable rows) + { + var list = GetPaymentOrderList(rows); //买手付钱后的订单数量 + return list.Where(IsValidOrder).ToList(); + } + /// + /// 获取退款订单 + /// + /// + /// + public static List GetRefundOrder(IEnumerable rows) + { + var list = GetPaymentOrderList(rows); //买手付钱后的订单数量 + return list.Where(IsRefunded).ToList(); + } + /// + /// 获取退款订单 + /// + /// + /// + public static List GetBuyerRefundRemainingOrder(IEnumerable rows) + { + var list = GetPaymentOrderList(rows); //买手付钱后的订单数量 + var refunded = list.Where(IsRefunded).ToList(); + + decimal buyerRefundAmount = refunded.Sum(r => (decimal)(r.OutAmount)) / 100m; //买手号退款金额(采购退款金额) + decimal buyerRefundSuccessedAmount = refunded.Where(a => IsBuyerRefundSuccessful(a) == false).Sum(r => (decimal)(r.BuyerRefundAmount)) / 100m; //买手号退款成功金额 + + return refunded.Where(a => IsBuyerRefundSuccessful(a) == false).ToList(); + } /// 销售趋势(按天,缺失日期补 0,仅统计有效订单) public static List GetSalesTrend(IEnumerable rows, DateTime startDate, DateTime endDate) diff --git a/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml new file mode 100644 index 0000000..6eb7118 --- /dev/null +++ b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml.cs b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml.cs new file mode 100644 index 0000000..8bbb966 --- /dev/null +++ b/29WxOrderWpf/Ctrls/Statistics/ShowOrderDialogView.xaml.cs @@ -0,0 +1,50 @@ +using _29WxOrderWpf.Ctrls.Statistics.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace _29WxOrderWpf.Ctrls.Statistics; + +/// +/// ShowOrderDialogView.xaml 的交互逻辑 +/// +public partial class ShowOrderDialogView : UserControl +{ + public ShowOrderDialogView(List list) + { + InitializeComponent(); + this.DataContext = new ShowOrderDialogViewModel(list); + } + + /// + /// 复制订单号到剪贴板 + /// + private void CopyOrderId_Click(object sender, RoutedEventArgs e) + { + if (sender is FrameworkElement element + && element.DataContext is ShopRevenueStatisticsRow row + && !string.IsNullOrEmpty(row.OrderId)) + { + Clipboard.SetText(row.OrderId); + } + } +} +class ShowOrderDialogViewModel +{ + public List Data { get; set; } + public ShowOrderDialogViewModel(List list) + { + Data = list ?? new List(); + } +} diff --git a/29WxOrderWpf/Ctrls/Statistics/ViewModels/PeriodRevenueStatisticsViewModel.cs b/29WxOrderWpf/Ctrls/Statistics/ViewModels/PeriodRevenueStatisticsViewModel.cs index b41b843..39b55cc 100644 --- a/29WxOrderWpf/Ctrls/Statistics/ViewModels/PeriodRevenueStatisticsViewModel.cs +++ b/29WxOrderWpf/Ctrls/Statistics/ViewModels/PeriodRevenueStatisticsViewModel.cs @@ -1,14 +1,15 @@ -using System; +using _29WxOrderWpf.Commands; +using _29WxOrderWpf.Common; +using _29WxOrderWpf.Ctrls.Statistics.Models; +using _29WxOrderWpf.Ctrls.Statistics.Services; +using AllBase.Model.MvvmBaseClasses; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; -using System.Windows.Input; using System.Windows; -using AllBase.Model.MvvmBaseClasses; -using _29WxOrderWpf.Ctrls.Statistics.Models; -using _29WxOrderWpf.Ctrls.Statistics.Services; -using _29WxOrderWpf.Commands; +using System.Windows.Input; namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels { @@ -545,5 +546,42 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels } #endregion + + + + public ICommand ShowOrderListCommand => new AsyncDelegateCommand(ShowOrderList); + + private async Task ShowOrderList(string type) + { + var query = new ShopRevenueStatisticsQuery + { + StartDate = StartDate, + EndDate = EndDate, + ShopKeys = BuildSelectedShopKeys(), + }; + var rows = await _service.QueryRowsAsync(query); + List showList = new List(); + switch (type) + { + case "ValidOrderCount": + showList = RevenueStatisticsAggregator.GetValidOrder(rows); + break; //有效订单 + case "RefundOrderCount": + showList = RevenueStatisticsAggregator.GetRefundOrder(rows); + break;//退款订单 + case "BuyerRefundRemainingAmount": + showList = RevenueStatisticsAggregator.GetBuyerRefundRemainingOrder(rows); + break;//待退回采购金额 + default: + break; + } + + new DialogWindow() + { + Title = "订单列表", + Content = new ShowOrderDialogView(showList), + DataContext = rows + }.ShowDialog(); + } } } \ No newline at end of file diff --git a/29WxOrderWpf/Ctrls/Statistics/ViewModels/ShopRevenueStatisticsViewModel.cs b/29WxOrderWpf/Ctrls/Statistics/ViewModels/ShopRevenueStatisticsViewModel.cs index ca2b6da..979a401 100644 --- a/29WxOrderWpf/Ctrls/Statistics/ViewModels/ShopRevenueStatisticsViewModel.cs +++ b/29WxOrderWpf/Ctrls/Statistics/ViewModels/ShopRevenueStatisticsViewModel.cs @@ -1,14 +1,16 @@ -using System; +using _29WxOrderWpf.Commands; +using _29WxOrderWpf.Common; +using _29WxOrderWpf.Ctrls.Statistics.Models; +using _29WxOrderWpf.Ctrls.Statistics.Services; +using AllBase.Model.MvvmBaseClasses; +using CefSharp; +using NPOI.SS.Formula.Functions; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Threading.Tasks; using System.Windows.Input; -using AllBase.Model.MvvmBaseClasses; -using _29WxOrderWpf.Ctrls.Statistics.Models; -using _29WxOrderWpf.Ctrls.Statistics.Services; -using CefSharp; -using _29WxOrderWpf.Commands; namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels { @@ -300,5 +302,41 @@ namespace _29WxOrderWpf.Ctrls.Statistics.ViewModels } #endregion + + + public ICommand ShowOrderListCommand => new AsyncDelegateCommand(ShowOrderList); + + private async Task ShowOrderList(string type) + { + var query = new ShopRevenueStatisticsQuery + { + StartDate = StartDate, + EndDate = EndDate, + ShopKeys = BuildSelectedShopKeys(), + }; + var rows = await _service.QueryRowsAsync(query); + List showList = new List(); + switch (type) + { + case "ValidOrderCount": + showList = RevenueStatisticsAggregator.GetValidOrder(rows); + break; //有效订单 + case "RefundOrderCount": + showList = RevenueStatisticsAggregator.GetRefundOrder(rows); + break;//退款订单 + case "BuyerRefundRemainingAmount": + showList = RevenueStatisticsAggregator.GetBuyerRefundRemainingOrder(rows); + break;//待退回采购金额 + default: + break; + } + + new DialogWindow() + { + Title="订单列表", + Content = new ShowOrderDialogView(showList), + DataContext = rows + }.ShowDialog(); + } } } \ No newline at end of file diff --git a/29WxOrderWpf/Styles/BaseButtonStyle.xaml b/29WxOrderWpf/Styles/BaseButtonStyle.xaml index 9c6e70b..79c3141 100644 --- a/29WxOrderWpf/Styles/BaseButtonStyle.xaml +++ b/29WxOrderWpf/Styles/BaseButtonStyle.xaml @@ -229,4 +229,47 @@ + + + \ No newline at end of file From 2fa313d4804e111f155ceaedd06f5d6a5819850a Mon Sep 17 00:00:00 2001 From: wule Date: Tue, 1 Sep 2026 10:16:53 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + AllBase/BaseClass.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 625ce4a..6bed541 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ bin /Update/Update/*.user *.user /29WxOrderPublish.sln +/29WxOrder Publish.sln diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index d15cd6f..59695f1 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -36,7 +36,7 @@ namespace AllBase /// 版本ID /// - public static int VersionCount = 267; + public static int VersionCount = 269; public static string ServerUrl { get; set; } = "http://1.13.195.131:9000"; public static string DebugUrl { get; set; } = "http://localhost:9000";