feat(admin): 仪表盘占比卡套餐名可跳平台订单并回跳
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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('&back=', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user