From 25e8bd7cc2a53f4fdda8b3deaaa65c54d8458702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 03:49:02 +0000 Subject: [PATCH] =?UTF-8?q?chore(admin):=20=E5=BC=80=E9=80=9A=E7=BA=BF?= =?UTF-8?q?=E7=B4=A2=E7=8A=B6=E6=80=81=E6=93=8D=E4=BD=9C=E6=8C=89=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E7=8A=B6=E6=80=81=E6=99=BA=E8=83=BD=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_leads/index.blade.php | 51 ++++++++++---- ...atformLeadIndexStatusActionButtonsTest.php | 68 +++++++++++++++++++ 2 files changed, 104 insertions(+), 15 deletions(-) create mode 100644 tests/Feature/AdminPlatformLeadIndexStatusActionButtonsTest.php diff --git a/resources/views/admin/platform_leads/index.blade.php b/resources/views/admin/platform_leads/index.blade.php index 898528f..9206ad0 100644 --- a/resources/views/admin/platform_leads/index.blade.php +++ b/resources/views/admin/platform_leads/index.blade.php @@ -91,21 +91,42 @@
{{ $statusLabels[$l->status] ?? $l->status }} -
- @csrf - - -
-
- @csrf - - -
-
- @csrf - - -
+ + @php + // 轻量运营流转:仅展示“下一步可能动作”,减少噪音/误点。 + $nextActions = []; + switch ((string) $l->status) { + case 'new': + $nextActions = ['contacted', 'converted', 'closed']; + break; + case 'contacted': + $nextActions = ['qualified', 'converted', 'closed']; + break; + case 'qualified': + $nextActions = ['converted', 'closed']; + break; + case 'converted': + $nextActions = ['closed']; + break; + default: + $nextActions = []; + } + + $actionLabels = [ + 'contacted' => ['text' => '标记已联系', 'class' => 'btn-secondary btn-sm'], + 'qualified' => ['text' => '标记已确认需求', 'class' => 'btn-secondary btn-sm'], + 'converted' => ['text' => '标记已转化', 'class' => 'btn btn-sm'], + 'closed' => ['text' => '关闭', 'class' => 'btn-danger btn-sm'], + ]; + @endphp + + @foreach($nextActions as $status) +
+ @csrf + + +
+ @endforeach
{{ $l->name }} diff --git a/tests/Feature/AdminPlatformLeadIndexStatusActionButtonsTest.php b/tests/Feature/AdminPlatformLeadIndexStatusActionButtonsTest.php new file mode 100644 index 0000000..9ac1bf2 --- /dev/null +++ b/tests/Feature/AdminPlatformLeadIndexStatusActionButtonsTest.php @@ -0,0 +1,68 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_index_should_hide_actions_for_closed_leads(): void + { + $this->loginAsPlatformAdmin(); + + PlatformLead::query()->create([ + 'name' => '已关闭线索', + 'mobile' => '', + 'email' => '', + 'company' => '', + 'source' => 'test', + 'status' => 'closed', + 'plan_id' => null, + 'meta' => ['from' => 'test'], + ]); + + $res = $this->get('/admin/platform-leads'); + $res->assertOk(); + + // closed 不应再展示“关闭/标记”按钮 + $res->assertDontSee('标记已联系', false); + $res->assertDontSee('标记已转化', false); + $res->assertDontSee('标记已确认需求', false); + $res->assertDontSee('>关闭<', false); + } + + public function test_index_should_show_qualified_action_for_contacted_leads(): void + { + $this->loginAsPlatformAdmin(); + + PlatformLead::query()->create([ + 'name' => '已联系线索', + 'mobile' => '', + 'email' => '', + 'company' => '', + 'source' => 'test', + 'status' => 'contacted', + 'plan_id' => null, + 'meta' => ['from' => 'test'], + ]); + + $res = $this->get('/admin/platform-leads'); + $res->assertOk(); + + $res->assertSee('标记已确认需求', false); + } +}