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 @@