Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ValidateForm Model="Model" OnValidSubmit="@Verify">
<EditorForm TModel="InvoiceForm" RowType="RowType.Inline" AutoGenerateAllItem="false">
<FieldItems>
<EditorItem @bind-Field="@context.InvoiceType" Text="发票种类" Readonly="true" />
<EditorItem @bind-Field="@context.InvoiceType" Text="发票种类" />
<EditorItem @bind-Field="@context.InvoiceCode" Text="发票代码" />
<EditorItem @bind-Field="@context.InvoiceNum" Text="发票号码" />
<EditorItem @bind-Field="@context.InvoiceDate" Text="开票日期" PlaceHolder="YYYYMMDD" />
Expand All @@ -18,26 +18,22 @@
</EditorForm>
</ValidateForm>

@if (InvoiceVerifyResult != null)
{
<div class="mt-3">@InvoiceVerifyResult.VerifyMessage</div>
}

@code {
/// <summary>
/// 取消请求令牌
/// </summary>
private CancellationTokenSource? TokenSource { get; set; }

private InvoiceVerifyResult? InvoiceVerifyResult { get; set; }

private InvoiceForm Model { get; set; } = new() { InvoiceType = "elec_special_vat_invoice", TotalAmount = "0" };

private async Task Verify(EditContext context)
{
var result = await OcrService.VerifyInvoiceAsync(Model.InvoiceCode, Model.InvoiceNum, Model.InvoiceDate, Model.InvoiceType, Model.CheckCode, Model.TotalAmount);
InvoiceVerifyResult = result.Entity;
StateHasChanged();
if (result.ErrorCode != 0)
{
await ToastService.Information("Verify Vat", $"{result.ErrorCode}: {result.ErrorMessage}");
}
else if (result.Entity != null)
{
await ToastService.Success("Verify Vat", result.Entity?.VerifyMessage);
}
}

/// <summary>
Expand Down