From 1b3fb9fac817904039eb26c46b7484825c98aeae Mon Sep 17 00:00:00 2001 From: "Joanne.Chuang" Date: Wed, 14 Jan 2026 19:03:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=90=E8=B4=88=E7=A2=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Altob.NtuInvoiceGateway/Models/InvoiceRequest.cs | 5 ++--- Altob.NtuInvoiceGateway/Pages/Invoice.cshtml | 13 +++++++------ Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs | 9 +++------ Altob.NtuInvoiceGateway/appsettings.json | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Altob.NtuInvoiceGateway/Models/InvoiceRequest.cs b/Altob.NtuInvoiceGateway/Models/InvoiceRequest.cs index 0fb9e2e..8538a2f 100644 --- a/Altob.NtuInvoiceGateway/Models/InvoiceRequest.cs +++ b/Altob.NtuInvoiceGateway/Models/InvoiceRequest.cs @@ -44,9 +44,8 @@ public class InvoiceRequest [RegularExpression(@"^\d{8}$", ErrorMessage = "統編格式不正確,必須為8位數字")] public string? BuyerIdentifier { get; set; } = string.Empty; - [StringLength(6, ErrorMessage = "愛心碼長度不能超過6碼")] - [RegularExpression(@"^$|^\d{6}$", ErrorMessage = "愛心碼須為空值或6位數字")] - public string LoveCode { get; set; } = string.Empty; + [RegularExpression(@"^$|^\d+$", ErrorMessage = "捐贈碼須為空值或數字")] + public string? LoveCode { get; set; } = string.Empty; [Required(ErrorMessage = "稅別為必填")] [StringLength(1, ErrorMessage = "稅別長度不能超過1個字元")] diff --git a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml index db15e55..cdadbcc 100644 --- a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml +++ b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml @@ -58,7 +58,7 @@
- 注意:以下三個選項至少需填寫一個 + 注意:以下四個選項至少需填寫一個
@@ -82,12 +82,12 @@ 8位數字
- @*
- +
+ 輸入為捐贈發票 -
*@ +
@@ -141,7 +141,8 @@ const requiredGroup = [ document.querySelector('input[name="InvoiceData.Email"]'), document.querySelector('input[name="InvoiceData.CarrierID"]'), - document.querySelector('input[name="InvoiceData.BuyerIdentifier"]') + document.querySelector('input[name="InvoiceData.BuyerIdentifier"]'), + document.querySelector('input[name="InvoiceData.LoveCode"]') ]; const form = document.querySelector('form[method="post"]'); @@ -179,7 +180,7 @@ const hasValue = requiredGroup.some(field => field && field.value.trim() !== ''); if (!hasValue) { event.preventDefault(); - showError('Email、手機條碼、購買者統編至少需填寫一項。'); + showError('Email、手機條碼、購買者統編、捐贈碼至少需填寫一項。'); return; } diff --git a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs index c761ccf..2c76fdb 100644 --- a/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs +++ b/Altob.NtuInvoiceGateway/Pages/Invoice.cshtml.cs @@ -105,7 +105,8 @@ public class InvoiceModel : PageModel // 判斷是否為初始轉頁(三個選項都沒填寫) bool isInitialRedirect = string.IsNullOrEmpty(InvoiceData.Email) && string.IsNullOrEmpty(InvoiceData.CarrierID) && - string.IsNullOrEmpty(InvoiceData.BuyerIdentifier); + string.IsNullOrEmpty(InvoiceData.BuyerIdentifier) && + string.IsNullOrEmpty(InvoiceData.LoveCode); // 如果是初始轉頁,直接顯示表單讓用戶填寫 if (isInitialRedirect) @@ -134,7 +135,7 @@ public class InvoiceModel : PageModel if (!string.IsNullOrEmpty(InvoiceData.Email)) filledCount++; if (!string.IsNullOrEmpty(InvoiceData.CarrierID)) filledCount++; if (!string.IsNullOrEmpty(InvoiceData.BuyerIdentifier)) filledCount++; - // if (!string.IsNullOrEmpty(InvoiceData.LoveCode)) filledCount++; + if (!string.IsNullOrEmpty(InvoiceData.LoveCode)) filledCount++; if (filledCount == 0) { @@ -232,13 +233,9 @@ public class InvoiceModel : PageModel InvoiceData.TransDateTime = InvoiceData.TransDateTime ?? string.Empty; InvoiceData.TransAmount = InvoiceData.TransAmount ?? string.Empty; InvoiceData.DeviceID = InvoiceData.DeviceID ?? string.Empty; - InvoiceData.Email = InvoiceData.Email ?? string.Empty; - InvoiceData.CarrierID = InvoiceData.CarrierID ?? string.Empty; InvoiceData.LocationID = InvoiceData.LocationID ?? string.Empty; InvoiceData.CarPlateNum = InvoiceData.CarPlateNum ?? string.Empty; InvoiceData.OrderID = InvoiceData.OrderID ?? string.Empty; - InvoiceData.BuyerIdentifier = InvoiceData.BuyerIdentifier ?? string.Empty; - InvoiceData.LoveCode = InvoiceData.LoveCode ?? string.Empty; InvoiceData.TaxType = InvoiceData.TaxType ?? string.Empty; } diff --git a/Altob.NtuInvoiceGateway/appsettings.json b/Altob.NtuInvoiceGateway/appsettings.json index fd9c777..cd9dd94 100644 --- a/Altob.NtuInvoiceGateway/appsettings.json +++ b/Altob.NtuInvoiceGateway/appsettings.json @@ -31,7 +31,7 @@ }, "AllowedHosts": "*", "CompanyInfo": { - "Name": "國立台灣大學臨時停車場", + "Name": "國立臺灣大學臨時停車場", "TaxId": "18384226" }, "InvoiceApi": {