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); + } +}