chore(admin-ui): migrate product import histories to filters/list card and admin pagination
This commit is contained in:
@@ -4,10 +4,7 @@
|
|||||||
@section('page_title', '平台商品导入历史')
|
@section('page_title', '平台商品导入历史')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="card">
|
@php
|
||||||
<p class="muted muted-tight">这里集中查看平台视角的商品导入历史,适合运营侧复盘批量导入结果、失败明细与清理后文件状态。</p>
|
|
||||||
|
|
||||||
@php
|
|
||||||
$exportHistoryQuery = http_build_query(array_filter([
|
$exportHistoryQuery = http_build_query(array_filter([
|
||||||
'merchant_id' => $importHistoryFilters['merchant_id'] ?? '',
|
'merchant_id' => $importHistoryFilters['merchant_id'] ?? '',
|
||||||
'import_result_status' => $importHistoryFilters['result_status'] ?? 'all',
|
'import_result_status' => $importHistoryFilters['result_status'] ?? 'all',
|
||||||
@@ -19,8 +16,21 @@
|
|||||||
'start_date', 'end_date' => $value !== null && $value !== '',
|
'start_date', 'end_date' => $value !== null && $value !== '',
|
||||||
default => $value !== null && $value !== '' && $value !== 'all' && $value !== 'latest',
|
default => $value !== null && $value !== '' && $value !== 'all' && $value !== 'latest',
|
||||||
}, ARRAY_FILTER_USE_BOTH));
|
}, ARRAY_FILTER_USE_BOTH));
|
||||||
@endphp
|
@endphp
|
||||||
<form method="get" action="/admin/products/import-histories" class="mb-12">
|
|
||||||
|
<details class="card mb-20 collapsible filters-card" data-role="collapsible" data-storage-key="admin.products.import_histories.filters" open>
|
||||||
|
<summary class="collapsible-summary filters-summary">
|
||||||
|
<div class="flex-between items-center">
|
||||||
|
<div>
|
||||||
|
<h3 class="mb-0">平台商品导入历史</h3>
|
||||||
|
<div class="muted muted-xs">集中复盘平台视角的商品导入结果、失败明细与文件状态(面向运营)。</div>
|
||||||
|
</div>
|
||||||
|
<span class="muted muted-xs">点击收起/展开</span>
|
||||||
|
</div>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
<div class="collapsible-body filters-body">
|
||||||
|
<form method="get" action="/admin/products/import-histories" class="filters-grid">
|
||||||
<div class="actions gap-10">
|
<div class="actions gap-10">
|
||||||
<select name="merchant_id">
|
<select name="merchant_id">
|
||||||
<option value="">全部商家</option>
|
<option value="">全部商家</option>
|
||||||
@@ -55,21 +65,32 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
@if(!empty($importHistoryFilters['date_errors']))
|
@if(!empty($importHistoryFilters['date_errors']))
|
||||||
<div class="info-warning">
|
<div class="info-warning mt-12">
|
||||||
@foreach($importHistoryFilters['date_errors'] as $dateError)
|
@foreach($importHistoryFilters['date_errors'] as $dateError)
|
||||||
<div>{{ $dateError }}</div>
|
<div>{{ $dateError }}</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
<div class="grid-4 mb-12">
|
<div class="card mb-20">
|
||||||
|
<div class="grid-4">
|
||||||
<div class="stat-box"><div class="muted">累计导入批次</div><strong class="num-sm">{{ $importHistoryStats['total_imports'] ?? 0 }}</strong></div>
|
<div class="stat-box"><div class="muted">累计导入批次</div><strong class="num-sm">{{ $importHistoryStats['total_imports'] ?? 0 }}</strong></div>
|
||||||
<div class="stat-box"><div class="muted">累计成功商品</div><strong class="num-sm">{{ $importHistoryStats['total_success'] ?? 0 }}</strong></div>
|
<div class="stat-box"><div class="muted">累计成功商品</div><strong class="num-sm">{{ $importHistoryStats['total_success'] ?? 0 }}</strong></div>
|
||||||
<div class="stat-box"><div class="muted">累计失败商品</div><strong class="num-sm">{{ $importHistoryStats['total_failed'] ?? 0 }}</strong></div>
|
<div class="stat-box"><div class="muted">累计失败商品</div><strong class="num-sm">{{ $importHistoryStats['total_failed'] ?? 0 }}</strong></div>
|
||||||
<div class="stat-box"><div class="muted">含失败批次</div><strong class="num-sm">{{ $importHistoryStats['warning_imports'] ?? 0 }}</strong></div>
|
<div class="stat-box"><div class="muted">含失败批次</div><strong class="num-sm">{{ $importHistoryStats['warning_imports'] ?? 0 }}</strong></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table>
|
<div class="card list-card">
|
||||||
|
<div class="list-card-header">
|
||||||
|
<div>
|
||||||
|
<h3 class="list-card-title">导入记录</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="list-card-body">
|
||||||
|
<table class="list-card-table">
|
||||||
<thead><tr><th>ID</th><th>导入时间</th><th>商家</th><th>上传文件</th><th>结果</th><th>成功</th><th>失败</th><th>操作者</th><th>失败明细</th></tr></thead>
|
<thead><tr><th>ID</th><th>导入时间</th><th>商家</th><th>上传文件</th><th>结果</th><th>成功</th><th>失败</th><th>操作者</th><th>失败明细</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@forelse($importHistories as $history)
|
@forelse($importHistories as $history)
|
||||||
@@ -99,11 +120,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
<tr><td colspan="9" class="muted">暂无导入记录</td></tr>
|
<tr><td colspan="9" class="muted table-empty">暂无导入记录</td></tr>
|
||||||
@endforelse
|
@endforelse
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="pagination-wrap">{{ $importHistories->links() }}</div>
|
{{ $importHistories->links('pagination.admin') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AdminProductImportHistoriesIndexShouldUseFiltersAndListCardStructureTest 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_admin_product_import_histories_index_should_use_filters_and_list_card_structure(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$res = $this->get('/admin/products/import-histories');
|
||||||
|
$res->assertOk();
|
||||||
|
|
||||||
|
// 护栏:导入历史页应使用统一 Filters Card + List Card 结构。
|
||||||
|
$res->assertSee('filters-card', false);
|
||||||
|
$res->assertSee('filters-summary', false);
|
||||||
|
$res->assertSee('filters-body', false);
|
||||||
|
$res->assertSee('filters-grid', false);
|
||||||
|
|
||||||
|
$res->assertSee('list-card', false);
|
||||||
|
$res->assertSee('list-card-header', false);
|
||||||
|
$res->assertSee('list-card-body', false);
|
||||||
|
$res->assertSee('list-card-table', false);
|
||||||
|
|
||||||
|
// 分页统一:用扫描型护栏断言。
|
||||||
|
$blade = file_get_contents(resource_path('views/admin/products/import_histories.blade.php'));
|
||||||
|
$this->assertIsString($blade);
|
||||||
|
$this->assertStringContainsString("links('pagination.admin')", $blade);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user