From 8a2d2b7d0fd8e5604169bc75314f2f4c11120dab Mon Sep 17 00:00:00 2001
From: limeng <1131177064@qq.com>
Date: Sat, 10 Oct 2026 12:09:23 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=B1=E7=94=A8=E5=90=88?=
=?UTF-8?q?=E5=90=8C=E5=90=88=E4=BD=9C=E6=96=B9=E5=8F=8A=E5=BD=92=E5=B1=9E?=
=?UTF-8?q?=E4=B8=BB=E4=BD=93=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=AA=E4=BA=BA?=
=?UTF-8?q?=E5=AE=9E=E5=90=8D=E7=AD=BE=E7=BD=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Business/CourierAgreementSignatures.php | 17 ++--
.../CourierAgreementSignatureService.php | 7 +-
.../agreement-signing.blade.php | 36 +++++---
.../business/pdf/courier-agreement.blade.php | 12 ++-
.../Business/AgreementSigningPageTest.php | 12 ++-
.../CourierAgreementSignatureWorkflowTest.php | 87 +++++++++++++++++--
6 files changed, 134 insertions(+), 37 deletions(-)
diff --git a/app/Http/Controllers/Business/CourierAgreementSignatures.php b/app/Http/Controllers/Business/CourierAgreementSignatures.php
index 385548c9..6b994ce1 100644
--- a/app/Http/Controllers/Business/CourierAgreementSignatures.php
+++ b/app/Http/Controllers/Business/CourierAgreementSignatures.php
@@ -56,7 +56,7 @@ class CourierAgreementSignatures extends Controller
]);
}
- if (in_array($requestedType, ['account-proof', 'account-change', 'entity-change', 'cooperation-contract', 'authorization'], true)
+ if (in_array($requestedType, ['account-proof', 'account-change', 'entity-change', 'cooperation-contract', 'authorization', 'shared-contract'], true)
&& ! $request->filled('counterparty_signer_type')) {
// Existing integrations omit this field and historically meant an
// enterprise signer, so keep that behavior as the compatibility default.
@@ -64,9 +64,6 @@ class CourierAgreementSignatures extends Controller
}
$data = $request->validate($this->rules(), [
- 'operator_name.required_if' => $requestedType === 'shared-contract'
- ? '请填写合同主体经办人的 E 签宝实名认证姓名。'
- : '请填写快递方经办人的 E 签宝实名认证姓名。',
'secondary_operator_name.required_if' => '请填写我方 E 签宝账号绑定的实名认证姓名。',
]);
$type = $data['document_type'];
@@ -74,6 +71,12 @@ class CourierAgreementSignatures extends Controller
throw ValidationException::withMessages(['authorization_items' => '授权委托书至少选择一项授权事项。']);
}
if ($type === 'shared-contract') {
+ $data['contract_partner_name'] = trim((string) $data['contract_partner_name']);
+ if ($data['counterparty_signer_type'] === 'person') {
+ $data['operator_name'] = $data['contract_partner_name'];
+ } elseif (blank($data['operator_name'] ?? null)) {
+ throw ValidationException::withMessages(['operator_name' => '请填写物流商归属企业经办人的 E 签宝实名认证姓名。']);
+ }
$sharedCouriers = collect($data['shared_courier_names'] ?? [])
->map(static fn ($name): string => trim((string) $name))
->filter()
@@ -371,9 +374,9 @@ class CourierAgreementSignatures extends Controller
'esign_account' => ['required', 'string', 'max:255'],
'secondary_esign_account' => ['required_if:document_type,cooperation-contract,authorization', 'nullable', 'string', 'max:255'],
'secondary_operator_name' => ['nullable', 'string', 'min:2', 'max:100'],
- 'operator_name' => ['required_if:document_type,shared-contract', 'nullable', 'string', 'min:2', 'max:100'],
+ 'operator_name' => ['nullable', 'string', 'min:2', 'max:100'],
'counterparty_organization_name' => ['required_if:document_type,account-proof,account-change', 'nullable', 'string', 'min:2', 'max:255'],
- 'counterparty_signer_type' => ['required_if:document_type,account-proof,account-change,entity-change,cooperation-contract,authorization', 'nullable', 'in:organization,person'],
+ 'counterparty_signer_type' => ['required_if:document_type,account-proof,account-change,entity-change,cooperation-contract,authorization,shared-contract', 'nullable', 'in:organization,person'],
'secondary_signer_type' => ['nullable', 'in:organization,person'],
'entity_change_old_company_deregistered' => ['nullable', 'boolean'],
'archive_mode' => ['required', 'in:auto,manual'],
@@ -393,7 +396,7 @@ 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'],
- 'contract_partner_name' => ['required_if:document_type,shared-contract', 'string', 'max:255'],
+ 'contract_partner_name' => ['required_if:document_type,shared-contract', 'string', 'min:2', 'max:255'],
'shared_courier_names' => ['nullable', 'array', 'min:1'],
'shared_courier_names.*' => ['required', 'string', 'max:255'],
'shared_courier_name' => ['nullable', 'string', 'max:255'],
diff --git a/app/Support/CourierAgreementSignatureService.php b/app/Support/CourierAgreementSignatureService.php
index 8bfcc5df..0f30160f 100644
--- a/app/Support/CourierAgreementSignatureService.php
+++ b/app/Support/CourierAgreementSignatureService.php
@@ -288,13 +288,14 @@ final class CourierAgreementSignatureService
$payload = $signature->payload ?? [];
if ($signature->document_type === 'shared-contract') {
+ $isPerson = ($payload['counterparty_signer_type'] ?? 'organization') === 'person';
if (blank($signature->operator_name)) {
- throw new RuntimeException('请填写合同主体经办人的 E 签宝实名认证姓名。');
+ throw new RuntimeException('请填写物流商归属主体签署人的 E 签宝实名认证姓名。');
}
return [[
- 'signer_type' => 1,
- 'organization_name' => $signature->organization_name,
+ 'signer_type' => $isPerson ? 0 : 1,
+ 'organization_name' => $isPerson ? null : $signature->organization_name,
'operator_name' => $signature->operator_name,
'operator_account' => $signature->operator_account,
]];
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 1438432d..e2336d00 100644
--- a/resources/views/business/pages/courier-payables/agreement-signing.blade.php
+++ b/resources/views/business/pages/courier-payables/agreement-signing.blade.php
@@ -1447,7 +1447,7 @@
-
+
@@ -1619,9 +1619,9 @@