diff --git a/29WxOrderWpf/Ctrls/PDDInvoice/PDDInvoiceView.xaml b/29WxOrderWpf/Ctrls/PDDInvoice/PDDInvoiceView.xaml index 5b88d37..0873730 100644 --- a/29WxOrderWpf/Ctrls/PDDInvoice/PDDInvoiceView.xaml +++ b/29WxOrderWpf/Ctrls/PDDInvoice/PDDInvoiceView.xaml @@ -422,7 +422,7 @@ Margin="0,2,0,-2" Padding="0" HorizontalContentAlignment="Stretch" - ItemsSource="{Binding Orders}"> + ItemsSource="{Binding OrdersView}"> - /// 订单列表浏览器 + /// 订单列表浏览å™? /// public ChromiumWebBrowser Browser { get; private set; } /// - /// 内容浏览器 + /// 内容浏览å™? /// 订单详情 /// 发票详情 /// 申请发票 @@ -98,9 +98,9 @@ public partial class PDDInvoiceViewModel } /// - /// 注入发票填写脚本并执行。 - /// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入的 - /// window.__invoiceApplyResult,完成后通过 回传结果。 + /// 注入发票填写脚本并执行ã€? + /// 单张申请模式保持原有行为;批量开票模式下轮询脚本写入çš? + /// window.__invoiceApplyResult,完成后通过 回传结果ã€? /// private async Task ExecuteInvoiceApplyScriptAsync(ChromiumWebBrowser b) { @@ -111,10 +111,10 @@ public partial class PDDInvoiceViewModel await b.EvaluateScriptAsync(content); - if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行为 + if (_currentInvoiceTcs == null) return; // 单张申请模式:保持原有行ä¸? - // 批量模式:等待异步脚本执行完成 - // 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结果 + // 批量模式:等待异步脚本执行完æˆ? + // 捕获当前 TCS,避免批量循环超时进入下一个订单后,迟到的轮询误触发新订单的结æž? var tcs = _currentInvoiceTcs; for (int i = 0; i < 120; i++) { @@ -224,7 +224,7 @@ public partial class PDDInvoiceViewModel var jsStr = @"window.scroll({ top: " + top + @", left: 0, - behavior: 'smooth' // 可选,使滚动平滑 + behavior: 'smooth' // 可选,使滚动平æ»? });"; var client = Browser.GetDevToolsClient(); diff --git a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs index 1b33fba..63b11a2 100644 --- a/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs +++ b/29WxOrderWpf/Ctrls/PDDInvoice/ViewModels/PDDInvoiceViewModel.cs @@ -13,6 +13,7 @@ using CefSharp.Wpf; using MAX.Core.Helpers; using NaiBa.Util.Extension; using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -27,6 +28,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Data; using System.Windows.Input; using System.Windows.Threading; using Work._29Tools.CefTools; @@ -54,9 +56,13 @@ public partial class PDDInvoiceViewModel : BindableBaseEx private InvoiceConfig Config { get; } public PDDInvoiceViewModel() { + _cancellationTokenSource = new CancellationTokenSource(); Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig(ConfigPath); Orders = new ObservableCollection(); Orders.CollectionChanged += Orders_CollectionChanged; + OrdersView =CollectionViewSource.GetDefaultView(Orders); + OrdersView.SortDescriptions.Add( + new SortDescription(nameof(PddBrowserOrderInvoiceViewModel.order_time), ListSortDirection.Ascending)); BuyerLoginList = GlobalConfig.PDDBuyerLoginList; //Orders = new ObservableCollection(_allOrders); @@ -138,7 +144,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx /// 订单列表 public ObservableCollection Orders { get; } - + public ICollectionView OrdersView { get; } /// 搜索关键字:订单号 / 商品名称 / 买家 public string SearchText {