feat(admin-dashboard): scanline abnormal statuses link to governance anchors
This commit is contained in:
@@ -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 @@
|
||||
<div class="muted muted-xs adm-order-scanline" data-role="recent-platform-order-scanline">
|
||||
<span class="adm-order-scanitem" title="支付回执证据(payment_summary/payment_receipts)">回执:<strong>{{ $receiptStatusText }}</strong></span>
|
||||
<span class="adm-order-scansep">|</span>
|
||||
<span class="adm-order-scanitem" title="回执金额 vs 已付金额(仅在有回执证据时判断)">对账:<strong>{{ $reconcileStatusText }}</strong></span>
|
||||
<span class="adm-order-scanitem" title="回执金额 vs 已付金额(仅在有回执证据时判断)">
|
||||
对账:
|
||||
@if($reconcileStatusText !== '-' && $reconcileStatusText !== '一致')
|
||||
<a class="link" href="{!! $scanGoReconcileUrl !!}"><strong>{{ $reconcileStatusText }}</strong></a>
|
||||
@else
|
||||
<strong>{{ $reconcileStatusText }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
<span class="adm-order-scansep">|</span>
|
||||
<span class="adm-order-scanitem" title="退款金额与支付状态一致性">退款:<strong>{{ $refundStatusText }}</strong></span>
|
||||
<span class="adm-order-scanitem" title="退款金额与支付状态一致性">
|
||||
退款:
|
||||
@if($refundStatusText !== '-' && $refundStatusText !== '正常')
|
||||
<a class="link" href="{!! $scanGoRefundUrl !!}"><strong>{{ $refundStatusText }}</strong></a>
|
||||
@else
|
||||
<strong>{{ $refundStatusText }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
<span class="adm-order-scansep">|</span>
|
||||
<span class="adm-order-scanitem" title="订阅激活同步(subscription_activation_error)">同步:<strong>{{ $syncStatusText }}</strong></span>
|
||||
<span class="adm-order-scanitem" title="订阅激活同步(subscription_activation_error)">
|
||||
同步:
|
||||
@if($syncStatusText === '失败')
|
||||
<a class="link" href="{!! $scanGoSyncFailedUrl !!}"><strong>{{ $syncStatusText }}</strong></a>
|
||||
@else
|
||||
<strong>{{ $syncStatusText }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
<span class="adm-order-scansep">|</span>
|
||||
<span class="adm-order-scanitem" title="批量标记已付并激活(batch_mark_paid_and_activate_error)">BMPA:<strong>{{ $bmpaStatusText }}</strong></span>
|
||||
<span class="adm-order-scanitem" title="批量标记已付并激活(batch_mark_paid_and_activate_error)">
|
||||
BMPA:
|
||||
@if($bmpaStatusText === '失败')
|
||||
<a class="link" href="{!! $scanGoBmpaFailedUrl !!}"><strong>{{ $bmpaStatusText }}</strong></a>
|
||||
@else
|
||||
<strong>{{ $bmpaStatusText }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
<span class="adm-order-scansep">|</span>
|
||||
<span class="adm-order-scanitem" title="续费单订阅关联(site_subscription_id)">订阅:<strong>{{ $subscriptionStatusText }}</strong></span>
|
||||
<span class="adm-order-scanitem" title="续费单订阅关联(site_subscription_id)">
|
||||
订阅:
|
||||
@if($subscriptionStatusText === '缺')
|
||||
<a class="link" href="{!! $scanGoRelationUrl !!}"><strong>{{ $subscriptionStatusText }}</strong></a>
|
||||
@else
|
||||
<strong>{{ $subscriptionStatusText }}</strong>
|
||||
@endif
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>¥{{ number_format((float) $po->payable_amount, 2) }}</td>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Admin;
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminDashboardRecentPlatformOrdersScanlineAbnormalItemsShouldLinkToAnchorsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,9 @@ class AdminDashboardRecentPlatformOrdersScanlineShouldHideReceiptAndReconcileWhe
|
||||
$res->assertSee('data-role="recent-platform-order-scanline"', false);
|
||||
|
||||
$res->assertSee('回执:<strong>-</strong>', false);
|
||||
$res->assertSee('对账:<strong>-</strong>', false);
|
||||
$res->assertSee('退款:<strong>-</strong>', false);
|
||||
$res->assertSee('对账:', false);
|
||||
$res->assertSee('<strong>-</strong>', false);
|
||||
$res->assertSee('退款:', false);
|
||||
$res->assertSee('<strong>-</strong>', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,13 @@ class AdminDashboardRecentPlatformOrdersScanlineShouldShowGovernanceSummaryTest
|
||||
$res->assertSee('data-role="recent-platform-order-scanline"', false);
|
||||
|
||||
$res->assertSee('回执:<strong>有</strong>', false);
|
||||
$res->assertSee('对账:<strong>不一致</strong>', false);
|
||||
$res->assertSee('同步:<strong>失败</strong>', false);
|
||||
$res->assertSee('BMPA:<strong>失败</strong>', false);
|
||||
$res->assertSee('订阅:<strong>缺</strong>', 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user