diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index 245cff3..897ded6 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -320,6 +320,13 @@ $syncFailedListUrl = \App\Support\BackUrl::withBack('/admin/platform-orders?sync_status=failed', $selfWithoutBack); $bmpaFailedListUrl = \App\Support\BackUrl::withBack('/admin/platform-orders?bmpa_failed_only=1', $selfWithoutBack); + // 扫描行:直达治理锚点(与下方提示块的链接口径保持一致) + $scanGoReconcileUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $po->id, $selfWithoutBack, 'payment-receipts'); + $scanGoRefundUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $po->id, $selfWithoutBack, 'refund-receipts'); + $scanGoSyncFailedUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $po->id, $selfWithoutBack, 'sync-failed'); + $scanGoBmpaFailedUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $po->id, $selfWithoutBack, 'bmpa-failed'); + $scanGoRelationUrl = \App\Support\BackUrl::withBackAndFragment('/admin/platform-orders/' . $po->id, $selfWithoutBack, 'relation-subscription'); + // 运营扫描用的“治理状态摘要”(不替代下方的治理提示入口,只用于快速判断) // 注意:为避免对“未支付订单”造成误导,回执/对账/退款在非 paid/refunded 时显示 "-"。 $isPaid = ((string) $po->payment_status === 'paid'); @@ -366,15 +373,50 @@
回执:{{ $receiptStatusText }} - 对账:{{ $reconcileStatusText }} + + 对账: + @if($reconcileStatusText !== '-' && $reconcileStatusText !== '一致') + {{ $reconcileStatusText }} + @else + {{ $reconcileStatusText }} + @endif + - 退款:{{ $refundStatusText }} + + 退款: + @if($refundStatusText !== '-' && $refundStatusText !== '正常') + {{ $refundStatusText }} + @else + {{ $refundStatusText }} + @endif + - 同步:{{ $syncStatusText }} + + 同步: + @if($syncStatusText === '失败') + {{ $syncStatusText }} + @else + {{ $syncStatusText }} + @endif + - BMPA:{{ $bmpaStatusText }} + + BMPA: + @if($bmpaStatusText === '失败') + {{ $bmpaStatusText }} + @else + {{ $bmpaStatusText }} + @endif + - 订阅:{{ $subscriptionStatusText }} + + 订阅: + @if($subscriptionStatusText === '缺') + {{ $subscriptionStatusText }} + @else + {{ $subscriptionStatusText }} + @endif +
¥{{ number_format((float) $po->payable_amount, 2) }} diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineAbnormalItemsShouldLinkToAnchorsTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineAbnormalItemsShouldLinkToAnchorsTest.php new file mode 100644 index 0000000..1c4e5ca --- /dev/null +++ b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineAbnormalItemsShouldLinkToAnchorsTest.php @@ -0,0 +1,81 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_dashboard_recent_platform_orders_scanline_abnormal_items_should_link_to_anchors(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $platformAdminId = (int) Admin::query()->where('email', 'platform.admin@demo.local')->value('id'); + + $plan = Plan::query()->create([ + 'code' => 'dash_recent_order_scanline_link_plan', + 'name' => '仪表盘扫描行异常直达测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'site_subscription_id' => null, + 'created_by_admin_id' => $platformAdminId ?: null, + 'order_no' => 'PO_DASH_SCANLINE_LINK_0001', + 'order_type' => 'renewal', + 'status' => 'pending', + 'payment_status' => 'paid', + 'payable_amount' => 10, + 'paid_amount' => 10, + 'placed_at' => now(), + 'meta' => [ + // 有回执证据 + 对账不一致(回执 1 vs paid 10) + 'payment_summary' => ['total_amount' => 1], + // 同步/BMPA 失败 + 'subscription_activation_error' => ['message' => 'sync failed'], + 'batch_mark_paid_and_activate_error' => ['message' => 'bmpa failed'], + ], + ]); + + $res = $this->get('/admin'); + $res->assertOk(); + + // 对账不一致应可直达 payment-receipts + $res->assertSee('对账:', false); + $res->assertSee('#payment-receipts', false); + + // 同步失败直达 sync-failed + $res->assertSee('#sync-failed', false); + + // BMPA 失败直达 bmpa-failed + $res->assertSee('#bmpa-failed', false); + + // 续费缺订阅直达 relation-subscription + $res->assertSee('#relation-subscription', false); + } +} diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhenNotPaidTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhenNotPaidTest.php index e26be1b..6e0e556 100644 --- a/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhenNotPaidTest.php +++ b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhenNotPaidTest.php @@ -66,7 +66,9 @@ class AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhe $res->assertSee('data-role="recent-platform-order-scanline"', false); $res->assertSee('回执:-', false); - $res->assertSee('对账:-', false); - $res->assertSee('退款:-', false); + $res->assertSee('对账:', false); + $res->assertSee('-', false); + $res->assertSee('退款:', false); + $res->assertSee('-', false); } } diff --git a/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest.php b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest.php index 6cee4b5..efee95e 100644 --- a/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest.php +++ b/tests/Feature/AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest.php @@ -69,9 +69,13 @@ class AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest $res->assertSee('data-role="recent-platform-order-scanline"', false); $res->assertSee('回执:', false); - $res->assertSee('对账:不一致', false); - $res->assertSee('同步:失败', false); - $res->assertSee('BMPA:失败', false); - $res->assertSee('订阅:', false); + $res->assertSee('对账:', false); + $res->assertSee('不一致', false); + $res->assertSee('同步:', false); + $res->assertSee('失败', false); + $res->assertSee('BMPA:', false); + $res->assertSee('失败', false); + $res->assertSee('订阅:', false); + $res->assertSee('缺', false); } }