diff --git a/app/Http/Controllers/Business/CourierAgreementSignatures.php b/app/Http/Controllers/Business/CourierAgreementSignatures.php index b6e27238..13e908ce 100644 --- a/app/Http/Controllers/Business/CourierAgreementSignatures.php +++ b/app/Http/Controllers/Business/CourierAgreementSignatures.php @@ -278,6 +278,7 @@ class CourierAgreementSignatures extends Controller 'quote_version_id' => ['required_if:document_type,quote-confirmation', 'nullable', 'integer', 'min:1'], 'signing_subject' => ['required', 'string', 'min:2', 'max:255'], 'company_full_name' => ['required', 'string', 'min:2', 'max:255'], + 'signature_date' => ['required', 'date'], 'signing_deadline' => $date, 'esign_account' => ['required', 'string', 'max:255'], 'secondary_esign_account' => ['required_if:document_type,entity-change,cooperation-contract,authorization', 'nullable', 'string', 'max:255'], @@ -299,12 +300,10 @@ class CourierAgreementSignatures extends Controller 'entity_change_date' => ['required_if:document_type,entity-change', 'date'], 'changed_company_name' => ['required_if:document_type,entity-change', 'string', 'max:255'], 'changed_company_start_date' => ['required_if:document_type,entity-change', 'date'], - 'entity_proof_date' => ['required_if:document_type,entity-change', 'date'], 'contract_partner_name' => ['required_if:document_type,shared-contract', 'string', 'max:255'], 'shared_courier_names' => ['nullable', 'array', 'min:1'], 'shared_courier_names.*' => ['required', 'string', 'max:255'], 'shared_courier_name' => ['nullable', 'string', 'max:255'], - 'shared_proof_date' => ['nullable', 'date'], 'shared_note' => ['nullable', 'string', 'max:2000'], 'cooperation_party_a_name' => ['required_if:document_type,cooperation-contract', 'string', 'max:255'], 'cooperation_party_a_phone' => ['required_if:document_type,cooperation-contract', 'string', 'max:64'], @@ -342,7 +341,7 @@ class CourierAgreementSignatures extends Controller ->findOrFail((int) $data['quote_version_id']); $this->ensureQuoteVersionMatchesCourier($version, $data['courier_name']); - $signature = $this->quoteSignatureService->prepareVersion($version, user_id()); + $signature = $this->quoteSignatureService->prepareVersion($version, user_id(), $data['signature_date']); $account = trim((string) $data['esign_account']); $signature = $this->quoteSignatureService->send($signature, [ 'organization_name' => $version->carrier_name, diff --git a/app/Http/Controllers/Business/CourierQuoteSignatures.php b/app/Http/Controllers/Business/CourierQuoteSignatures.php index 98fb9a7d..bc9c31dc 100644 --- a/app/Http/Controllers/Business/CourierQuoteSignatures.php +++ b/app/Http/Controllers/Business/CourierQuoteSignatures.php @@ -19,11 +19,14 @@ class CourierQuoteSignatures extends Controller { } - public function prepare(CourierQuoteVersion $quoteVersion): RedirectResponse + public function prepare(Request $request, CourierQuoteVersion $quoteVersion): RedirectResponse { $this->ensureCanManage(); abort_unless($quoteVersion->status === 'approved', 422, '只有已审核报价版本可以生成签署文件。'); - $signature = $this->service->prepareVersion($quoteVersion, user_id()); + $data = $request->validate([ + 'signature_date' => ['required', 'date'], + ]); + $signature = $this->service->prepareVersion($quoteVersion, user_id(), $data['signature_date']); return redirect()->route('business.courier-quote-changes.show', $quoteVersion->source_change_id) ->with('success', "{$quoteVersion->version_code} 的签署 PDF 已生成,文件校验值已固定。") @@ -40,9 +43,15 @@ class CourierQuoteSignatures extends Controller 'operator_name' => ['required', 'string', 'min:2', 'max:100'], 'operator_account' => ['required', 'string', 'max:255'], 'notice_type' => ['required', 'in:1,2'], + 'signature_date' => ['required', 'date'], 'expires_at' => ['required', 'date', 'after:now', 'before_or_equal:' . now()->addDays(90)->toDateTimeString()], ]); $this->validateAccountForNotice($data['operator_account'], $data['notice_type']); + $quoteSignature = $this->service->prepareVersion( + $quoteSignature->version, + user_id(), + $data['signature_date'], + ); $signature = $this->service->send($quoteSignature, $data, user_id()); $environment = $signature->environment === 'sandbox' ? '沙箱' : '正式环境'; diff --git a/app/Support/CourierAgreementPdf.php b/app/Support/CourierAgreementPdf.php index d64ae502..8629db0d 100644 --- a/app/Support/CourierAgreementPdf.php +++ b/app/Support/CourierAgreementPdf.php @@ -3,17 +3,26 @@ namespace App\Support; use App\Models\Business\CourierAgreementSignature; +use Illuminate\Support\Carbon; use RuntimeException; final class CourierAgreementPdf { public function render(CourierAgreementSignature $signature): string { + $payload = $signature->payload ?? []; + $signatureDate = (string) ($payload['signature_date'] ?? $payload['entity_proof_date'] ?? $payload['shared_proof_date'] ?? ''); + try { + $signatureDate = $signatureDate !== '' ? Carbon::parse($signatureDate)->format('Y年n月j日') : '待填写'; + } catch (\Throwable) { + $signatureDate = '待填写'; + } $html = view('business.pdf.courier-agreement', [ 'signature' => $signature, 'type' => $signature->document_type, 'title' => $this->title($signature), - 'payload' => $signature->payload ?? [], + 'payload' => $payload, + 'signatureDate' => $signatureDate, 'fontPath' => str_replace('\\', '/', resource_path('fonts/DroidSansFallback.ttf')), ])->render(); diff --git a/app/Support/CourierQuotePdf.php b/app/Support/CourierQuotePdf.php index b85b85dc..04c267de 100644 --- a/app/Support/CourierQuotePdf.php +++ b/app/Support/CourierQuotePdf.php @@ -3,6 +3,7 @@ namespace App\Support; use App\Models\Business\CourierQuoteVersion; +use Illuminate\Support\Carbon; use RuntimeException; final class CourierQuotePdf @@ -11,9 +12,10 @@ final class CourierQuotePdf { } - public function render(CourierQuoteVersion $version): string + public function render(CourierQuoteVersion $version, ?string $signatureDate = null): string { $data = $this->confirmation->data($version); + $signatureDate = Carbon::parse($signatureDate ?: now())->format('Y年n月j日'); $html = view('business.pdf.courier-quote', [ 'version' => $version, 'change' => $version->change, @@ -23,6 +25,7 @@ final class CourierQuotePdf 'expiryDate' => $data['expiry_date'], 'faceFee' => $data['face_fee'], 'bubbleCoefficient' => $data['bubble_coefficient'], + 'signatureDate' => $signatureDate, 'generatedAt' => now(), 'fontPath' => str_replace('\\', '/', resource_path('fonts/DroidSansFallback.ttf')), ])->render(); diff --git a/app/Support/CourierQuoteSignatureService.php b/app/Support/CourierQuoteSignatureService.php index 72f60bae..c9bf7b2e 100644 --- a/app/Support/CourierQuoteSignatureService.php +++ b/app/Support/CourierQuoteSignatureService.php @@ -18,11 +18,11 @@ final class CourierQuoteSignatureService { } - public function prepareVersion(CourierQuoteVersion $version, int $userId): CourierQuoteSignature + public function prepareVersion(CourierQuoteVersion $version, int $userId, ?string $signatureDate = null): CourierQuoteSignature { $existing = $version->signature; - if ($existing && $this->sourcePdfIsIntact($existing)) { + if ($signatureDate === null && $existing && $this->sourcePdfIsIntact($existing)) { return $existing; } @@ -32,7 +32,7 @@ final class CourierQuoteSignatureService ]); } - $bytes = $this->pdf->render($version); + $bytes = $this->pdf->render($version, $signatureDate); $path = $this->path($version, 'source.pdf'); $sha256 = hash('sha256', $bytes); diff --git a/resources/views/business/pages/courier-payables/agreement-signing.blade.php b/resources/views/business/pages/courier-payables/agreement-signing.blade.php index 562ab5c1..8db7a0f6 100644 --- a/resources/views/business/pages/courier-payables/agreement-signing.blade.php +++ b/resources/views/business/pages/courier-payables/agreement-signing.blade.php @@ -1394,6 +1394,11 @@ +
该日期会直接写入待签文件,并随原文一起推送到 E 签宝。
+以上收款账户的变更,以我司的盖章为有效。
待填写:
-日期:签署后生成
+日期:{{ now()->format('Y年n月j日') }}
第 1 页 / 共 1 页
@@ -1667,7 +1668,7 @@以上收款账户的变更,以我司的盖章为有效。
待填写:
-日期:签署后生成
+日期:{{ now()->format('Y年n月j日') }}
第 1 页 / 共 1 页
@@ -1681,7 +1682,7 @@变更前公司法人签字盖公章:
变更后公司法人签字盖公章:
-待填写
+日期:{{ now()->format('Y年n月j日') }}
第 1 页 / 共 1 页
@@ -1693,7 +1694,7 @@备注:待填写
法人签字并公司盖章:
-日期:签署后生成
+日期:{{ now()->format('Y年n月j日') }}
第 1 页 / 共 1 页
@@ -1725,7 +1726,7 @@受托方:待填写
日期:签署后生成
+日期:{{ now()->format('Y年n月j日') }}
第 1 页 / 共 1 页
@@ -1745,7 +1746,7 @@双方确认以下报价版本作为快递服务结算依据。报价版本一经签署即形成独立留档,后续变价须生成新版本并重新签署。
乙方(快递方)签章:
日期:签署后生成
乙方(快递方)签章:
日期:{{ now()->format('Y年n月j日') }}
报价确认单 · 快递方单方签署
@@ -2421,7 +2422,7 @@ setText('[data-preview-template-code]', documentOption.dataset.code); setPreviewValue('company', companyName); setPreviewValue('courier', courier); - setPreviewValue('signatureDate', '签署后生成'); + setPreviewValue('signatureDate', formatDateField('[name="signature_date"]', '待填写')); if (templateType === 'account-proof') { setPreviewValue('proofEffectiveDate', formatDateField('[name="account_proof_effective_date"]', '待填写')); @@ -2450,7 +2451,6 @@ setPreviewValue('entityChangeDate', formatDateField('[name="entity_change_date"]', '待填写')); setPreviewValue('changedCompanyName', fieldValue('[name="changed_company_name"]', '待填写')); setPreviewValue('changedCompanyStartDate', formatDateField('[name="changed_company_start_date"]', '待填写')); - setPreviewValue('entityProofDate', formatDateField('[name="entity_proof_date"]', '待填写')); } if (templateType === 'shared-contract') { diff --git a/resources/views/business/pages/courier-payables/quote-change-show.blade.php b/resources/views/business/pages/courier-payables/quote-change-show.blade.php index 121a1f04..ee8a4082 100644 --- a/resources/views/business/pages/courier-payables/quote-change-show.blade.php +++ b/resources/views/business/pages/courier-payables/quote-change-show.blade.php @@ -72,7 +72,7 @@乙 方:待填写
代表人:
代表人:
-日 期:签署后生成
-日 期:签署后生成
+日 期:待填写
+日 期:待填写
签约地:常州市
甲 方:{!! $mixedText($payload['cooperation_party_a_name'] ?? '') !!}
乙 方:{!! $mixedText($payload['cooperation_party_b_name'] ?? '') !!}
代表人:
代表人:
日 期:签署后生成
日 期:签署后生成
签约地:常州市
甲 方:{!! $mixedText($payload['cooperation_party_a_name'] ?? '') !!}
乙 方:{!! $mixedText($payload['cooperation_party_b_name'] ?? '') !!}
代表人:
代表人:
日 期:{!! $mixedText($signatureDate) !!}
日 期:{!! $mixedText($signatureDate) !!}
签约地:常州市
请贵公司按照上述汇款资料付款,如因我司提供收款银行帐户资料错误,导致相关款项支付不到位,则由此产生的一切经济纠纷和责任由我司承担。我司承诺若上述收款银行帐户资料发生变化及时书面通知贵公司。
以上收款账户的变更,以我司的盖章为有效。
-公司盖章:
日期:签署后生成
公司盖章:
日期:{!! $mixedText($signatureDate) !!}
TO {!! $mixedText($payload['company_full_name']) !!}:
基于我公司正规化管理的需要,同时保证广大客户的汇款安全,我司收款账户将于 {!! $mixedText($payload['account_change_date']) !!} 变更账户,之前相应的账户(收款账户为:{!! $mixedText($payload['old_account_name']) !!},账号:{!! $mixedText($payload['old_account_number']) !!})于 {!! $mixedText($payload['old_account_stop_date']) !!} 停止使用,即日起我司收款的银行帐户进行变更,自 {!! $mixedText($payload['new_account_effective_date']) !!} 起我司与贵司往来款项请汇款至以下新账户,新汇款资料如下:
@@ -67,20 +67,20 @@如因我司提供收款银行帐户资料错误导致相关款项支付不到位,由此产生的一切经济纠纷和责任由我司承担。以上收款账户的变更,以我司的盖章为有效。
-公司盖章:
日期:签署后生成
公司盖章:
日期:{!! $mixedText($signatureDate) !!}
致 {!! $mixedText($payload['company_full_name']) !!}:
我司由于企业名称变更,原公司名称 {!! $mixedText($payload['former_company_name']) !!} 于 {!! $mixedText($payload['entity_change_date']) !!} 变更为 {!! $mixedText($payload['changed_company_name']) !!},自 {!! $mixedText($payload['changed_company_start_date']) !!} 开始,我司将启用变更后的公司与贵公司开展工作,原公司名称停止使用。
变更后,原公司的各项事宜由变更后的公司继续执行。原公司的结算未付款项,由变更之后的公司提供的收款账户收款。原公司的业务和款项若出现法律上的纠纷,由变更后的公司承担责任。
特此证明!
-变更前公司法人签字盖公章:{!! $mixedText($payload['former_company_name']) !!}
变更后公司法人签字盖公章:{!! $mixedText($payload['changed_company_name']) !!}
日期:{!! $mixedText($payload['entity_proof_date']) !!}
变更前公司法人签字盖公章:{!! $mixedText($payload['former_company_name']) !!}
变更后公司法人签字盖公章:{!! $mixedText($payload['changed_company_name']) !!}
日期:{!! $mixedText($signatureDate) !!}
与 {!! $mixedText($payload['contract_partner_name'] ?? '') !!} 合作的 {!! $mixedText($sharedCourierText) !!} 共同用一份合同,打款资料为同一份资料,同一个签字人以及同一个法人!
特此证明!
@if (filled($payload['shared_note'] ?? null))备注:{!! $mixedText($payload['shared_note']) !!}
@endif -法人签字并公司盖章:
日期:{!! $mixedText($payload['shared_proof_date'] ?? '签署后生成') !!}
法人签字并公司盖章:
日期:{!! $mixedText($signatureDate) !!}
委托有效期:从 {!! $mixedText($payload['authorization_start_date']) !!} 至 {!! $mixedText($payload['authorization_end_date']) !!} 止。
-委托方:{!! $mixedText($payload['principal_name']) !!}
受托方:{!! $mixedText($payload['trustee_name']) !!}
日期:签署后生成
委托方:{!! $mixedText($payload['principal_name']) !!}
受托方:{!! $mixedText($payload['trustee_name']) !!}
日期:{!! $mixedText($signatureDate) !!}