fix: default cooperation secondary esign account

This commit is contained in:
limeng 2026-08-31 15:14:16 +08:00
parent a4724f12e2
commit 9c29360e91
4 changed files with 31 additions and 1 deletions

View File

@ -18,6 +18,8 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
class CourierAgreementSignatures extends Controller
{
private const COOPERATION_SECONDARY_ESIGN_ACCOUNT = '18052733960';
public function __construct(private readonly CourierAgreementSignatureService $service)
{
}
@ -28,6 +30,13 @@ class CourierAgreementSignatures extends Controller
abort_unless(EsignClient::configured(), 422, 'E 签宝沙箱尚未配置 App ID 或 AppSecret。');
abort_unless(Schema::hasTable('business_courier_agreement_signatures'), 503, '协议签署数据表尚未完成迁移,请先执行数据库迁移。');
if ($request->input('document_type') === 'cooperation-contract') {
// 合作合同统一由我方固定 E 签宝账号完成第二签署方签署。
$request->merge([
'secondary_esign_account' => self::COOPERATION_SECONDARY_ESIGN_ACCOUNT,
]);
}
$data = $request->validate($this->rules());
$type = $data['document_type'];
if ($type === 'authorization' && count($data['authorization_items'] ?? []) === 0) {

View File

@ -1,6 +1,7 @@
@php($agreementTasks = $agreementTasks ?? collect())
@php($agreementSubjects = $agreementSubjects ?? collect())
@php($agreementCourierAccounts = $agreementCourierAccounts ?? [])
@php($agreementCooperationSecondaryEsignAccount = '18052733960')
@php($agreementDefaultSubject = $agreementSubjects->firstWhere('is_default', true) ?: $agreementSubjects->first())
@php($agreementCompanyName = $agreementDefaultSubject?->name ?: company()?->name ?: '当前公司')
@php($agreementSubjectPayload = $agreementSubjects->map(fn ($subject) => ['id' => $subject->id, 'name' => $subject->name, 'unified_social_credit_code' => $subject->unified_social_credit_code, 'is_default' => (bool) $subject->is_default])->values())
@ -1287,7 +1288,7 @@
<div class="agreement-field" data-secondary-signer-fields hidden>
<label for="agreement-secondary-esign-account">第二签署方E签宝账号 <span class="agreement-required" aria-hidden="true">*</span></label>
<input class="agreement-control" id="agreement-secondary-esign-account" name="secondary_esign_account" type="text" placeholder="填写另一签署方的手机号或邮箱" autocomplete="email" disabled>
<p class="agreement-help">主体变更、合作合同和授权委托书需要双方分别实名签署。</p>
<p class="agreement-help">主体变更、合作合同和授权委托书需要双方分别实名签署;合作合同统一使用我方账号 {{ $agreementCooperationSecondaryEsignAccount }}。</p>
</div>
</div>
</section>
@ -1721,6 +1722,8 @@
var esignAccountInput = root.querySelector('input[name="esign_account"]');
var subjects = @json($agreementSubjectPayload);
var fallbackSubjectName = @json($agreementCompanyName);
var cooperationSecondaryEsignAccount = @json($agreementCooperationSecondaryEsignAccount);
var secondaryEsignAccountInput = root.querySelector('input[name="secondary_esign_account"]');
var lastSubjectTrigger = null;
function announce(message) {
@ -2051,7 +2054,22 @@
secondary.querySelectorAll('input').forEach(function (control) {
control.disabled = !needsSecondary;
control.required = needsSecondary;
if (templateType === 'cooperation-contract') {
control.value = cooperationSecondaryEsignAccount;
control.readOnly = true;
} else {
control.readOnly = false;
if (control.dataset.cooperationDefault === 'true') {
control.value = '';
delete control.dataset.cooperationDefault;
}
}
});
if (templateType === 'cooperation-contract' && secondaryEsignAccountInput) {
secondaryEsignAccountInput.dataset.cooperationDefault = 'true';
}
}
setText('[data-template-name]', documentOption.dataset.name);
setText('[data-template-code]', documentOption.dataset.code);

View File

@ -62,6 +62,7 @@ class AgreementSigningPageTest extends FeatureTestCase
->assertSeeText('公司全称')
->assertSeeText('签署截止日期')
->assertSeeText('对方E签宝账号')
->assertSeeText('合作合同统一使用我方账号 18052733960')
->assertSeeText('填写变量')
->assertSeeText('签署完成后自动归档')
->assertSeeText('人工确认后归档')

View File

@ -97,6 +97,7 @@ class CourierAgreementSignatureWorkflowTest extends FeatureTestCase
$signature = CourierAgreementSignature::query()->firstOrFail();
$this->assertSame('cooperation-contract', $signature->document_type);
$this->assertSame('TPL-COOPERATION-CONTRACT-V1', $signature->template_code);
$this->assertSame('18052733960', $signature->payload['secondary_esign_account']);
$this->assertSame('0519-88886666', $signature->payload['cooperation_party_a_phone']);
$this->assertSame('2026-12-31', $signature->payload['cooperation_end_date']);
@ -110,6 +111,7 @@ class CourierAgreementSignatureWorkflowTest extends FeatureTestCase
return count($signers) === 2
&& ($signers[0]['orgSignerInfo']['orgName'] ?? null) === $this->company->name
&& ($signers[0]['orgSignerInfo']['transactorInfo']['psnAccount'] ?? null) === '18052733960'
&& ($signers[1]['orgSignerInfo']['orgName'] ?? null) === '新北中通快递有限公司';
});
}