diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 032bc1f..b460363 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -308,6 +308,7 @@ 最近批量生效 回执数 退款数 + 退款总额 操作 @@ -440,7 +441,8 @@ @php - $refundCount = count((array) (data_get($order->meta, 'refund_receipts', []) ?? [])); + $refunds = (array) (data_get($order->meta, 'refund_receipts', []) ?? []); + $refundCount = count($refunds); @endphp @if($refundCount > 0) {{ $refundCount }} @@ -448,6 +450,19 @@ 0 @endif + + @php + $refundTotal = 0.0; + foreach ($refunds as $r) { + $refundTotal += (float) (data_get($r, 'amount') ?? 0); + } + @endphp + @if($refundTotal > 0) + ¥{{ number_format($refundTotal, 2) }} + @else + - + @endif + @php $canActivate = ($order->payment_status === 'paid') && ($order->status === 'activated'); diff --git a/tests/Feature/AdminPlatformOrderTest.php b/tests/Feature/AdminPlatformOrderTest.php index 739d8cc..0e24307 100644 --- a/tests/Feature/AdminPlatformOrderTest.php +++ b/tests/Feature/AdminPlatformOrderTest.php @@ -41,6 +41,10 @@ class AdminPlatformOrderTest extends TestCase ->assertSee('待支付') ->assertSee('待生效') ->assertSee('可同步订阅') + ->assertSee('部分退款') + ->assertSee('已退款') + ->assertSee('退款数') + ->assertSee('退款总额') ->assertSee('/admin/platform-orders?payment_status=paid&status=pending', false); }