|
| 1 | +@inject IBaiduOcr OcrService |
| 2 | + |
| 3 | +<ButtonUpload TValue="string" OnChange="@OnClickToUpload" BrowserButtonText="VATInvoice" ShowUploadFileList="false"></ButtonUpload> |
| 4 | + |
| 5 | +@if (Invoice != null) |
| 6 | +{ |
| 7 | + <div class="row form-inline g-3 mt-0"> |
| 8 | + <div class="col-12 col-sm-6"> |
| 9 | + <Display ShowLabel="true" DisplayText="发票代码" @bind-Value="Invoice.InvoiceCode"></Display> |
| 10 | + </div> |
| 11 | + <div class="col-12 col-sm-6"> |
| 12 | + <Display ShowLabel="true" DisplayText="发票号码" Value="Invoice.InvoiceNum"></Display> |
| 13 | + </div> |
| 14 | + <div class="col-12 col-sm-6"> |
| 15 | + <Display ShowLabel="true" DisplayText="发票类型" @bind-Value="Invoice.ServiceType"></Display> |
| 16 | + </div> |
| 17 | + <div class="col-12 col-sm-6"> |
| 18 | + <Display ShowLabel="true" DisplayText="联次信息" Value="Invoice.SheetNum"></Display> |
| 19 | + </div> |
| 20 | + <div class="col-12 col-sm-6"> |
| 21 | + <Display ShowLabel="true" DisplayText="发票种类" @bind-Value="Invoice.InvoiceType"></Display> |
| 22 | + </div> |
| 23 | + <div class="col-12 col-sm-6"> |
| 24 | + <Display ShowLabel="true" DisplayText="发票名称" Value="Invoice.InvoiceTypeOrg"></Display> |
| 25 | + </div> |
| 26 | + <div class="col-12 col-sm-6"> |
| 27 | + <Display ShowLabel="true" DisplayText="发票标志" @bind-Value="Invoice.InvoiceTag"></Display> |
| 28 | + </div> |
| 29 | + <div class="col-12 col-sm-6"> |
| 30 | + <Display ShowLabel="true" DisplayText="开票日期" Value="Invoice.InvoiceDate"></Display> |
| 31 | + </div> |
| 32 | + <div class="col-12 col-sm-6"> |
| 33 | + <Display ShowLabel="true" DisplayText="购方名称" @bind-Value="Invoice.PurchaserName"></Display> |
| 34 | + </div> |
| 35 | + <div class="col-12 col-sm-6"> |
| 36 | + <Display ShowLabel="true" DisplayText="纳税人识别号" Value="Invoice.PurchaserRegisterNum"></Display> |
| 37 | + </div> |
| 38 | + <div class="col-12 col-sm-6"> |
| 39 | + <Display ShowLabel="true" DisplayText="开户行及账号" @bind-Value="Invoice.PurchaserBank"></Display> |
| 40 | + </div> |
| 41 | + <div class="col-12 col-sm-6"> |
| 42 | + <Display ShowLabel="true" DisplayText="购方地址" Value="Invoice.PurchaserAddress"></Display> |
| 43 | + </div> |
| 44 | + <div class="col-12 col-sm-6"> |
| 45 | + <Display ShowLabel="true" DisplayText="销售方名称" @bind-Value="Invoice.SellerName"></Display> |
| 46 | + </div> |
| 47 | + <div class="col-12 col-sm-6"> |
| 48 | + <Display ShowLabel="true" DisplayText="纳税人识别号" Value="Invoice.SellerRegisterNum"></Display> |
| 49 | + </div> |
| 50 | + <div class="col-12 col-sm-6"> |
| 51 | + <Display ShowLabel="true" DisplayText="销售方及账号" @bind-Value="Invoice.SellerBank"></Display> |
| 52 | + </div> |
| 53 | + <div class="col-12 col-sm-6"> |
| 54 | + <Display ShowLabel="true" DisplayText="销售方地址" Value="Invoice.SellerAddress"></Display> |
| 55 | + </div> |
| 56 | + <div class="col-12"> |
| 57 | + <Display ShowLabel="true" DisplayText="备注" @bind-Value="Invoice.Remarks"></Display> |
| 58 | + </div> |
| 59 | + <div class="col-12 col-sm-6"> |
| 60 | + <Display ShowLabel="true" DisplayText="价税合计" Value="Invoice.AmountInFiguers"></Display> |
| 61 | + </div> |
| 62 | + <div class="col-12 col-sm-6"> |
| 63 | + <Display ShowLabel="true" DisplayText="合计金额" Value="Invoice.TotalAmount"></Display> |
| 64 | + </div> |
| 65 | + <div class="col-12 col-sm-6"> |
| 66 | + <Display ShowLabel="true" DisplayText="合计税额" @bind-Value="Invoice.TotalTax"></Display> |
| 67 | + </div> |
| 68 | + <div class="col-12 col-sm-6"> |
| 69 | + </div> |
| 70 | + @if (Invoice.CommodityName?.Any() ?? false) |
| 71 | + { |
| 72 | + <div class="col-12 col-sm-6"> |
| 73 | + <Display ShowLabel="true" DisplayText="税率" Value="Invoice.CommodityName.First().CommodityName"></Display> |
| 74 | + </div> |
| 75 | + } |
| 76 | + @if (Invoice.CommodityTaxRate?.Any() ?? false) |
| 77 | + { |
| 78 | + <div class="col-12 col-sm-6"> |
| 79 | + <Display ShowLabel="true" DisplayText="税率" Value="Invoice.CommodityTaxRate.First().CommodityTaxRate"></Display> |
| 80 | + </div> |
| 81 | + } |
| 82 | + </div> |
| 83 | +} |
| 84 | + |
| 85 | +@code { |
| 86 | + private InvoiceEntity? Invoice { get; set; } |
| 87 | + |
| 88 | + private async Task OnClickToUpload(UploadFile file) |
| 89 | + { |
| 90 | + if (file.File != null) |
| 91 | + { |
| 92 | + var payload = await file.GetBytesAsync(file.File.Size); |
| 93 | + if (payload?.Any() ?? false) |
| 94 | + { |
| 95 | + Invoice = await OcrService.CheckVatInvoiceAsync(payload); |
| 96 | + StateHasChanged(); |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | +} |
0 commit comments