feat(admin): 仪表盘占比卡套餐名可跳平台订单并回跳

This commit is contained in:
萝卜
2026-03-15 19:18:52 +08:00
parent 7f59bb9985
commit 4a3e6942e6
2 changed files with 40 additions and 1 deletions

View File

@@ -183,8 +183,14 @@
$pct = $totalOrders > 0 ? round(($count / $totalOrders) * 100, 1) : 0;
$planName = (string) (($planIdToName[$planId] ?? '') ?: ('#' . $planId));
@endphp
@php
$planOrdersUrl = \App\Support\BackUrl::withBack(
'/admin/platform-orders?' . \Illuminate\Support\Arr::query(['plan_id' => $planId]),
$selfWithoutBack
);
@endphp
<tr>
<td>{{ $planName }}</td>
<td><a class="link" href="{!! $planOrdersUrl !!}">{{ $planName }}</a></td>
<td>{{ $count }}</td>
<td>{{ $pct }}%</td>
</tr>

View File

@@ -0,0 +1,33 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminDashboardPlanOrderSharePlanLinkShouldCarryBackTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_dashboard_plan_order_share_plan_link_should_carry_back(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin');
$res->assertOk();
// 套餐占比表格里,点击套餐名应跳到平台订单列表并带 back 回到仪表盘
$res->assertSee('href="/admin/platform-orders?plan_id=1&back=%2Fadmin"', false);
$res->assertDontSee('&amp;back=', false);
}
}