From 807cd159dcada83ef31e82311a072188172c94e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Sat, 14 Mar 2026 00:01:41 +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=E5=AD=98=E5=9C=A8=E9=80=80=E6=AC=BE/?= =?UTF-8?q?=E5=9B=9E=E6=89=A7=E5=B7=AE=E9=A2=9D=E6=97=B6=E7=A6=81=E7=94=A8?= =?UTF-8?q?BMPA=E6=8C=89=E9=92=AE=E5=B9=B6=E5=8A=A0=E6=8A=A4=E6=A0=8F?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 2 +- ...vateButtonDisabledWhenRefundExistsTest.php | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateButtonDisabledWhenRefundExistsTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index fc4df36..a1f8cbf 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -181,7 +181,7 @@
@csrf - +
@if($markPaidBlockedByRefund) diff --git a/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateButtonDisabledWhenRefundExistsTest.php b/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateButtonDisabledWhenRefundExistsTest.php new file mode 100644 index 0000000..0a78fbe --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowMarkPaidAndActivateButtonDisabledWhenRefundExistsTest.php @@ -0,0 +1,78 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_mark_paid_and_activate_button_should_be_disabled_when_refund_exists(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_disable_bmpa_refund_plan', + 'name' => '订单详情禁用BMPA-退款存在测试套餐', + '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_SHOW_DISABLE_BMPA_REFUND_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + 'payment_status' => 'unpaid', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 10, + 'paid_amount' => 0, + 'placed_at' => now(), + 'meta' => [ + 'refund_receipts' => [ + [ + 'type' => 'refund', + 'channel' => 'offline', + 'amount' => 1, + 'refunded_at' => now()->toDateTimeString(), + 'note' => 'test-refund', + 'created_at' => now()->toDateTimeString(), + 'admin_id' => 1, + ], + ], + ], + ]); + + $res = $this->get('/admin/platform-orders/' . $order->id); + $res->assertOk(); + + // 按现有页面渲染:应包含 disabled 属性(前端阻断,后端仍有安全阀) + $res->assertSee('action="/admin/platform-orders/' . $order->id . '/mark-paid-and-activate"', false); + $res->assertSee('标记支付并生效', false); + $res->assertSee('disabled', false); + } +}