From 4b80486c0a97a7819a2a961ce3c11dc946d4f51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 11 Mar 2026 05:25:51 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=9A=E6=95=B4=E7=90=86=E9=80=80=E6=AC=BE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=B2=BB=E7=90=86=E5=8C=BA=E5=9D=97=EF=BC=88=E6=9B=B4?= =?UTF-8?q?=E9=86=92=E7=9B=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 45 +++++++----- ...formOrderShowRefundGovernanceBlockTest.php | 70 +++++++++++++++++++ 2 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index f946aab..0124a24 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -91,25 +91,32 @@ && $order->payment_status === 'refunded' && (round($refundTotal * 100) + 1) < round($paidAmountFloat * 100); @endphp - @if($canMarkRefunded) -
- 提示:退款总额已达到/超过已付金额,但支付状态尚未是「已退款」,如确认无误,可直接修正。 -
- @csrf - -
-
- @elseif($canFixRefundedButNotEnough) -
- 提示:当前支付状态为「已退款」,但退款总额不足。如确认无误,可将状态修正为「部分退款」或「已支付」。 -
- @csrf - -
-
- @csrf - -
+ @if($canMarkRefunded || $canFixRefundedButNotEnough) +
+
退款状态治理(仅修正状态,不自动写回执/退款回执)
+
已付:¥{{ number_format($paidAmountFloat, 2) }}|退款总额:¥{{ number_format($refundTotal, 2) }}
+ + @if($canMarkRefunded) +
+ 当前支付状态不是「已退款」,但退款总额已达到/超过已付金额。 +
+ @csrf + +
+
+ @else +
+ 当前支付状态为「已退款」,但退款总额不足。 +
+ @csrf + +
+
+ @csrf + +
+
+ @endif
@endif diff --git a/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php new file mode 100644 index 0000000..7c8611f --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowRefundGovernanceBlockTest.php @@ -0,0 +1,70 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_can_render_refund_governance_block_when_refund_total_reaches_paid_amount(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'refund_governance_block_01', + 'name' => '退款治理区块测试', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_REFUND_GOV_BLOCK_0001', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'paid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'meta' => [ + 'refund_summary' => [ + 'count' => 1, + 'total_amount' => 10.00, + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('退款状态治理') + ->assertSee('/admin/platform-orders/' . $order->id . '/mark-refunded'); + } +}