platform_orders index: compact view keeps governance fix links reachable
This commit is contained in:
@@ -85,3 +85,7 @@
|
||||
/* 平台订单列表:精简视图(默认隐藏部分列,避免列表过长) */
|
||||
.platform-orders-table .col-optional{display:none;}
|
||||
.platform-orders-table.is-full .col-optional{display:table-cell;}
|
||||
|
||||
/* 平台订单列表:精简视图也要可达的治理提示(对账/退款不一致) */
|
||||
.platform-orders-table .governance-hints{margin-bottom:6px;}
|
||||
.platform-orders-table .governance-hint{line-height:1.4;}
|
||||
|
||||
@@ -1296,8 +1296,33 @@
|
||||
@endphp
|
||||
@php
|
||||
$canMarkPaid = ($order->payment_status !== 'paid') || ($order->status !== 'activated');
|
||||
|
||||
// 精简视图也要可达的“治理入口”:不要只依赖可选列(col-optional)里的提示
|
||||
$needReconcileFix = (bool) $order->isReconcileMismatch();
|
||||
$needRefundFix = (bool) $order->isRefundInconsistent();
|
||||
$reconcileFixUrlCompact = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#add-payment-receipt';
|
||||
$refundFixUrlCompact = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#refund-receipts';
|
||||
@endphp
|
||||
|
||||
@if($needReconcileFix || $needRefundFix)
|
||||
<div class="governance-hints">
|
||||
@if($needReconcileFix)
|
||||
<div class="muted text-danger muted-xs governance-hint">
|
||||
对账不一致
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $reconcileFixUrlCompact !!}">去补回执</a>
|
||||
</div>
|
||||
@endif
|
||||
@if($needRefundFix)
|
||||
<div class="muted text-danger muted-xs governance-hint">
|
||||
退款不一致
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $refundFixUrlCompact !!}">去核对退款</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-paid-and-activate" onsubmit="return confirm('确认将该订单标记为已支付并生效?此操作会推进状态并尝试同步订阅');" class="mb-6">
|
||||
@csrf
|
||||
<button class="btn btn-sm" type="submit" @disabled(! $canMarkPaid)>标记支付并生效</button>
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexCompactViewGovernanceHintsStillReachableTest 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_compact_view_still_shows_fix_links_for_reconcile_and_refund_inconsistent_orders(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'compact_view_governance_hints_test',
|
||||
'name' => '精简视图治理入口测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$reconcileOrder = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_COMPACT_GOV_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' => 10,
|
||||
'paid_amount' => 10,
|
||||
'placed_at' => now(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'meta' => [
|
||||
'payment_summary' => [
|
||||
'count' => 1,
|
||||
'total_amount' => 9.98,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$refundOrder = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_COMPACT_GOV_REFUND_0001',
|
||||
'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' => 10,
|
||||
'paid_amount' => 10,
|
||||
'placed_at' => now(),
|
||||
'paid_at' => now(),
|
||||
'activated_at' => now(),
|
||||
'refunded_at' => now(),
|
||||
'meta' => [
|
||||
'refund_summary' => [
|
||||
'count' => 1,
|
||||
'total_amount' => 9.98,
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
// 默认即为精简视图:确保治理入口不依赖 col-optional 列依然可达
|
||||
$backEncoded = rawurlencode('/admin/platform-orders');
|
||||
|
||||
$this->get('/admin/platform-orders')
|
||||
->assertOk()
|
||||
->assertSee('/admin/platform-orders/' . $reconcileOrder->id . '?back=' . $backEncoded . '#add-payment-receipt', false)
|
||||
->assertSee('去补回执')
|
||||
->assertSee('/admin/platform-orders/' . $refundOrder->id . '?back=' . $backEncoded . '#refund-receipts', false)
|
||||
->assertSee('去核对退款');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user