商品成本明细新增平台列 #573

Merged
chenxi merged 1 commits from feature/chenxi-product-cost-platform-column into main 2026-10-25 23:48:36 +08:00
2 changed files with 12 additions and 3 deletions

View File

@ -37,6 +37,7 @@
],
];
$tableColumns = [
'platform' => '平台',
'occurred_date' => '发生时间',
'store_name' => '店铺名称',
'online_order_no' => '线上单号',
@ -561,7 +562,7 @@
.product-cost-table {
width: 100%;
min-width: 78rem;
min-width: 84rem;
border-collapse: separate;
border-spacing: 0;
font-size: .75rem;
@ -1344,6 +1345,7 @@
<table class="product-cost-table" data-product-cost-table>
<thead>
<tr>
<th data-column-key="platform">平台</th>
<th data-column-key="occurred_date">发生时间</th>
<th data-column-key="store_name">店铺名称</th>
<th data-column-key="online_order_no">线上单号</th>
@ -1358,6 +1360,7 @@
<tbody>
@forelse ($rows ?? [] as $row)
<tr data-product-cost-row>
<td data-column-key="platform">{{ $text($row->platform) }}</td>
<td data-column-key="occurred_date">{{ $text(substr((string) ($row->occurred_date ?? ''), 0, 10)) }}</td>
<td data-column-key="store_name">{{ $text($row->store_name) }}</td>
<td data-column-key="online_order_no">{{ $text($row->online_order_no) }}</td>
@ -1370,7 +1373,7 @@
</tr>
@empty
<tr>
<td colspan="9">
<td colspan="10">
<div class="product-cost-empty">
{{ $error ? '镜像读取失败,请稍后重试。' : '暂无符合条件的商品成本数据;生成完成后会自动显示。' }}
</div>
@ -1378,7 +1381,7 @@
</tr>
@endforelse
<tr class="product-cost-search-empty" data-product-cost-search-empty hidden>
<td colspan="9">当前页没有匹配的数据。</td>
<td colspan="10">当前页没有匹配的数据。</td>
</tr>
</tbody>
</table>

View File

@ -12,6 +12,7 @@ class ProductCostPageLayoutTest extends TestCase
{
URL::defaults(['company_id' => 1]);
$row = (object) [
'platform' => '京东账单',
'occurred_date' => '2026-09-01',
'store_name' => '测试店铺',
'online_order_no' => 'ORDER-1',
@ -100,6 +101,11 @@ class ProductCostPageLayoutTest extends TestCase
$this->assertStringContainsString('全部筛选结果', $html);
$this->assertStringContainsString('当前显示列及顺序', $html);
$this->assertStringContainsString('id="product-cost-table"', $html);
$this->assertLessThan(
strpos($html, 'data-column-key="occurred_date">发生时间'),
strpos($html, 'data-column-key="platform">平台')
);
$this->assertStringContainsString('data-column-key="platform">京东账单</td>', $html);
$this->assertStringContainsString('导出当前筛选结果', $html);
}
}