feat(platform-orders): 列表展示退款总额并补充退款快捷入口断言

This commit is contained in:
萝卜
2026-03-10 17:01:40 +00:00
parent 55450e9100
commit 9164d84c82
2 changed files with 20 additions and 1 deletions

View File

@@ -308,6 +308,7 @@
<th>最近批量生效</th> <th>最近批量生效</th>
<th>回执数</th> <th>回执数</th>
<th>退款数</th> <th>退款数</th>
<th>退款总额</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
@@ -440,7 +441,8 @@
</td> </td>
<td> <td>
@php @php
$refundCount = count((array) (data_get($order->meta, 'refund_receipts', []) ?? [])); $refunds = (array) (data_get($order->meta, 'refund_receipts', []) ?? []);
$refundCount = count($refunds);
@endphp @endphp
@if($refundCount > 0) @if($refundCount > 0)
<a href="/admin/platform-orders/{{ $order->id }}" class="muted">{{ $refundCount }}</a> <a href="/admin/platform-orders/{{ $order->id }}" class="muted">{{ $refundCount }}</a>
@@ -448,6 +450,19 @@
<span class="muted">0</span> <span class="muted">0</span>
@endif @endif
</td> </td>
<td>
@php
$refundTotal = 0.0;
foreach ($refunds as $r) {
$refundTotal += (float) (data_get($r, 'amount') ?? 0);
}
@endphp
@if($refundTotal > 0)
<span class="muted">¥{{ number_format($refundTotal, 2) }}</span>
@else
<span class="muted">-</span>
@endif
</td>
<td> <td>
@php @php
$canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated'); $canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated');

View File

@@ -41,6 +41,10 @@ class AdminPlatformOrderTest extends TestCase
->assertSee('待支付') ->assertSee('待支付')
->assertSee('待生效') ->assertSee('待生效')
->assertSee('可同步订阅') ->assertSee('可同步订阅')
->assertSee('部分退款')
->assertSee('已退款')
->assertSee('退款数')
->assertSee('退款总额')
->assertSee('/admin/platform-orders?payment_status=paid&status=pending', false); ->assertSee('/admin/platform-orders?payment_status=paid&status=pending', false);
} }