From bebae1932c439f7401bef312453e6bc625520d54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Wed, 11 Mar 2026 08:45:17 +0000 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=EF=BC=9A?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=AE=A2=E9=98=85=E6=B2=BB=E7=90=86=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=B8=8E=E7=9B=B4=E8=BE=BE=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 11 ++ ...ActivateSubscriptionGovernanceHintTest.php | 117 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 tests/Feature/AdminPlatformOrderShowActivateSubscriptionGovernanceHintTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index d60c9a4..4efa7b2 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -157,6 +157,17 @@ + @if($order->isReconcileMismatch()) +
提示:当前订单命中「对账不一致」,建议先补齐支付回执并核对金额差额后再同步订阅。 + 去补回执 +
+ @endif + @if($order->isRefundInconsistent()) +
提示:当前订单命中「退款不一致」,建议先核对退款轨迹/状态后再同步订阅。 + 去核对退款 +
+ @endif + @if($order->siteSubscription) @php $subBack = '/admin/platform-orders/' . $order->id; diff --git a/tests/Feature/AdminPlatformOrderShowActivateSubscriptionGovernanceHintTest.php b/tests/Feature/AdminPlatformOrderShowActivateSubscriptionGovernanceHintTest.php new file mode 100644 index 0000000..e759bb4 --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowActivateSubscriptionGovernanceHintTest.php @@ -0,0 +1,117 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_order_show_page_shows_activate_subscription_governance_hint_when_reconcile_mismatch(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'show_activate_gov_hint_reconcile_test', + 'name' => '详情页同步订阅提示(对账不一致)测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 66, + 'list_price' => 66, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_ACT_GOV_HINT_RECON_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' => 66, + 'paid_amount' => 66, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'meta' => [ + 'payment_summary' => [ + 'count' => 1, + 'total_amount' => 65.98, + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('命中「对账不一致」', false) + ->assertSee('#add-payment-receipt', false); + } + + public function test_order_show_page_shows_activate_subscription_governance_hint_when_refund_inconsistent(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'show_activate_gov_hint_refund_test', + 'name' => '详情页同步订阅提示(退款不一致)测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 66, + 'list_price' => 66, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_ACT_GOV_HINT_REFUND_0002', + 'order_type' => 'new_purchase', + 'status' => 'activated', + 'payment_status' => 'refunded', + 'plan_name' => $plan->name, + 'billing_cycle' => $plan->billing_cycle, + 'period_months' => 1, + 'quantity' => 1, + 'payable_amount' => 66, + 'paid_amount' => 66, + 'placed_at' => now(), + 'paid_at' => now(), + 'activated_at' => now(), + 'refunded_at' => now(), + 'meta' => [ + 'refund_summary' => [ + 'count' => 1, + 'total_amount' => 65.98, + ], + ], + ]); + + $this->get('/admin/platform-orders/' . $order->id) + ->assertOk() + ->assertSee('命中「退款不一致」', false) + ->assertSee('#refund-receipts', false); + } +}