发票助手 增加 发票状态筛选,修复不能选中bug,修复开票失败bug
This commit is contained in:
1 parent
df340c920a
commit
c0e3b998ac
3 files changed
+61
-6
No files matched your search
@@ -222,6 +222,22 @@
|
|||||||
Text="请输入订单号 / 商品名称"
|
Text="请输入订单号 / 商品名称"
|
||||||
Visibility="{Binding Text, ElementName=txtSearch, Converter={StaticResource NotHasTextVisibility}}" />
|
Visibility="{Binding Text, ElementName=txtSearch, Converter={StaticResource NotHasTextVisibility}}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<wpf:TitleContent
|
||||||
|
Title="发票状态"
|
||||||
|
Placement="Left"
|
||||||
|
TitleVerticalAlignment="Center">
|
||||||
|
<ComboBox
|
||||||
|
Width="100"
|
||||||
|
Height="28"
|
||||||
|
d:SelectedIndex="0"
|
||||||
|
SelectedIndex="{Binding InvoiceStatus}"
|
||||||
|
Style="{StaticResource RoundedComboBox}">
|
||||||
|
<ComboBoxItem Content="全部" />
|
||||||
|
<ComboBoxItem Content="待开票" />
|
||||||
|
<ComboBoxItem Content="已申请" />
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
|
</wpf:TitleContent>
|
||||||
<Button
|
<Button
|
||||||
Width="50"
|
Width="50"
|
||||||
Height="30"
|
Height="30"
|
||||||
@@ -479,8 +495,7 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsChecked="{Binding IsSelected}"
|
IsChecked="{Binding IsSelected}" />
|
||||||
IsEnabled="{Binding IsSelected}" />
|
|
||||||
|
|
||||||
<!-- 商品 -->
|
<!-- 商品 -->
|
||||||
<Grid Grid.Column="1" VerticalAlignment="Center">
|
<Grid Grid.Column="1" VerticalAlignment="Center">
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ async function fillInvoiceAndApply(data = {}) {
|
|||||||
console.log('✅ 已经申请过,无需重复操作');
|
console.log('✅ 已经申请过,无需重复操作');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const successElement = findElement('//*[text()="确认您的发票信息无误后再提交"]');
|
const successElement = findElement('//*[text()="确认发票信息无误后再提交"]');
|
||||||
if (successElement == null) {
|
if (successElement == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace _29WxOrderWpf.Ctrls.PDDInvoice.ViewModels;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class PDDInvoiceViewModel : BindableBaseEx
|
public partial class PDDInvoiceViewModel : BindableBaseEx
|
||||||
{
|
{
|
||||||
|
private const string ConfigPath = "./invoice.config";
|
||||||
private readonly ObservableCollection<PddBrowserOrderInvoiceViewModel> _allOrders = new();
|
private readonly ObservableCollection<PddBrowserOrderInvoiceViewModel> _allOrders = new();
|
||||||
private readonly HashSet<string> _orderSns = new();
|
private readonly HashSet<string> _orderSns = new();
|
||||||
private string _searchText = "";
|
private string _searchText = "";
|
||||||
@@ -49,9 +50,11 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
private bool _isInvoiceDetailOpen;
|
private bool _isInvoiceDetailOpen;
|
||||||
private string _invoiceTitle = "";
|
private string _invoiceTitle = "";
|
||||||
private string _taxNo = "";
|
private string _taxNo = "";
|
||||||
private CancellationTokenSource _cancellationTokenSource; public PDDInvoiceViewModel()
|
private CancellationTokenSource _cancellationTokenSource;
|
||||||
|
private InvoiceConfig Config { get; }
|
||||||
|
public PDDInvoiceViewModel()
|
||||||
{
|
{
|
||||||
|
Config = NaiBa.Util.Helper.ConfigHelper.LoadConfig<InvoiceConfig>(ConfigPath);
|
||||||
Orders = new ObservableCollection<PddBrowserOrderInvoiceViewModel>();
|
Orders = new ObservableCollection<PddBrowserOrderInvoiceViewModel>();
|
||||||
Orders.CollectionChanged += Orders_CollectionChanged;
|
Orders.CollectionChanged += Orders_CollectionChanged;
|
||||||
|
|
||||||
@@ -60,6 +63,10 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
|
|
||||||
|
|
||||||
InitBrowser();
|
InitBrowser();
|
||||||
|
if (Config == null) Config = new InvoiceConfig();
|
||||||
|
InvoiceTitle = Config.Title;
|
||||||
|
TaxNo = Config.TaxNo;
|
||||||
|
MaxAmount = Config.MaxAmount;
|
||||||
|
|
||||||
if (EnvironmentHelper.IsTest)
|
if (EnvironmentHelper.IsTest)
|
||||||
{
|
{
|
||||||
@@ -105,6 +112,17 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
|
|
||||||
|
|
||||||
public ObservableCollectionThreadSafe<BuyerLoginInfo> BuyerLoginList { get; set; } = new ObservableCollectionThreadSafe<BuyerLoginInfo>();
|
public ObservableCollectionThreadSafe<BuyerLoginInfo> BuyerLoginList { get; set; } = new ObservableCollectionThreadSafe<BuyerLoginInfo>();
|
||||||
|
public int InvoiceStatus
|
||||||
|
{
|
||||||
|
get => GetValue<int>();
|
||||||
|
set => SetValue(value, InvoiceStatusChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InvoiceStatusChanged()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public BuyerLoginInfo SelectedBuyer
|
public BuyerLoginInfo SelectedBuyer
|
||||||
{
|
{
|
||||||
get => GetProperty(() => SelectedBuyer);
|
get => GetProperty(() => SelectedBuyer);
|
||||||
@@ -371,6 +389,11 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
"批量开票");
|
"批量开票");
|
||||||
if (confirm.DialogResult != true) return;
|
if (confirm.DialogResult != true) return;
|
||||||
|
|
||||||
|
Config.Title = InvoiceTitle;
|
||||||
|
Config.TaxNo = TaxNo;
|
||||||
|
Config.MaxAmount = MaxAmount;
|
||||||
|
NaiBa.Util.Helper.ConfigHelper.SaveConfig(ConfigPath, Config);
|
||||||
|
|
||||||
await BatchInvoiceAsync(targets);
|
await BatchInvoiceAsync(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,8 +483,17 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
{
|
{
|
||||||
var keyword = SearchText?.Trim();
|
var keyword = SearchText?.Trim();
|
||||||
Orders.Clear();
|
Orders.Clear();
|
||||||
foreach (var order in _allOrders.Where(o => IsKeywordMatch(o, keyword)))
|
bool? _tempIsInvoiced = InvoiceStatus == 0 ? null : InvoiceStatus == 2;
|
||||||
|
foreach (var order in _allOrders)
|
||||||
{
|
{
|
||||||
|
if (_tempIsInvoiced.HasValue)
|
||||||
|
{
|
||||||
|
if (order.IsInvoiced != _tempIsInvoiced.Value) continue;
|
||||||
|
}
|
||||||
|
if (!IsKeywordMatch(order, keyword))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Orders.Add(order);
|
Orders.Add(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -476,6 +508,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
private void ResetSearch()
|
private void ResetSearch()
|
||||||
{
|
{
|
||||||
SearchText = "";
|
SearchText = "";
|
||||||
|
InvoiceStatus = 0;
|
||||||
Search();
|
Search();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -608,6 +641,7 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Orders.FirstOrDefault().IsInvoiced = true;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,3 +748,9 @@ public partial class PDDInvoiceViewModel : BindableBaseEx
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InvoiceConfig
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public string TaxNo { get; set; }
|
||||||
|
public decimal MaxAmount { get; set; }
|
||||||
|
}
|
||||||
Reference in new issue
Block a user