ui: show receipt-none governance hint; normalize order show actions

This commit is contained in:
萝卜
2026-03-14 06:48:03 +00:00
parent 41e3246381
commit 45dc8f2397
3 changed files with 91 additions and 10 deletions

View File

@@ -553,6 +553,18 @@
@endif
@endif
@if((($filters['receipt_status'] ?? '') === 'none') && $hasSyncableOnlyFilter)
<div class="card governance-block mb-10">
<div class="muted text-danger governance-block-title"><strong>回执缺失提示</strong></div>
<div class="muted governance-block-body">
当前集合为「无回执」且已勾选「只看可同步」。为保证收费闭环可治理,建议先补齐支付回执留痕,再执行批量同步订阅。
<a class="link" href="{{ request()->fullUrlWithQuery(['receipt_status' => 'has', 'page' => null]) }}">切到有回执集合</a>
<span class="muted"></span>
<a class="link" href="{{ request()->fullUrlWithQuery(['syncable_only' => null, 'page' => null]) }}">取消只看可同步(先治理)</a>
</div>
</div>
@endif
@if($hasSyncFailedFilter)
<div class="card governance-block mb-10">
<div class="muted text-danger governance-block-title"><strong>同步失败治理提示</strong></div>

View File

@@ -163,21 +163,21 @@
@if($canMarkRefunded)
<div class="muted">
当前支付状态不是「已退款」,但退款总额已达到/超过已付金额。
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-refunded" style="display:inline; margin-left:8px;" onsubmit="return confirm('确认将该订单支付状态标记为已退款?该操作不会自动写入退款回执,仅修正状态');">
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-refunded" class="inline-form" onsubmit="return confirm('确认将该订单支付状态标记为已退款?该操作不会自动写入退款回执,仅修正状态');">
@csrf
<button class="button-danger" type="submit">标记为已退款</button>
<button class="btn btn-danger btn-sm" type="submit">标记为已退款</button>
</form>
</div>
@else
<div class="muted">
当前支付状态为「已退款」,但退款总额不足。
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-partially-refunded" style="display:inline; margin-left:8px;" onsubmit="return confirm('确认将该订单支付状态标记为部分退款?该操作不会自动写入退款回执,仅修正状态');">
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-partially-refunded" class="inline-form" onsubmit="return confirm('确认将该订单支付状态标记为部分退款?该操作不会自动写入退款回执,仅修正状态');">
@csrf
<button class="button-danger" type="submit">标记为部分退款</button>
<button class="btn btn-danger btn-sm" type="submit">标记为部分退款</button>
</form>
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-paid-status" style="display:inline; margin-left:8px;" onsubmit="return confirm('确认将该订单支付状态标记为已支付?该操作不会自动写入回执/退款回执,仅修正状态');">
<form method="post" action="/admin/platform-orders/{{ $order->id }}/mark-paid-status" class="inline-form" onsubmit="return confirm('确认将该订单支付状态标记为已支付?该操作不会自动写入回执/退款回执,仅修正状态');">
@csrf
<button class="button-danger" type="submit">标记为已支付</button>
<button class="btn btn-danger btn-sm" type="submit">标记为已支付</button>
</form>
</div>
@endif
@@ -186,9 +186,9 @@
@if($isRefundInconsistent)
@if($order->payment_status === 'refunded')
<div class="muted text-danger" style="margin-top:10px;">提示:当前订单状态为「已退款」,但退款总额小于已付金额,可能存在数据不一致,请核对退款轨迹与订单金额。</div>
<div class="muted text-danger mt-10">提示:当前订单状态为「已退款」,但退款总额小于已付金额,可能存在数据不一致,请核对退款轨迹与订单金额。</div>
@else
<div class="muted text-danger" style="margin-top:10px;">提示:退款总额已达到/超过已付金额,建议核对是否应将支付状态调整为「已退款」。</div>
<div class="muted text-danger mt-10">提示:退款总额已达到/超过已付金额,建议核对是否应将支付状态调整为「已退款」。</div>
@endif
@endif
@@ -257,8 +257,8 @@
<div class="card governance-block">
<div class="muted text-danger governance-block-title"><strong>同步订阅治理提示</strong>(当前不建议/不可直接同步)</div>
<div class="muted governance-block-body">
<div>原因:订单命中「对账不一致/退款不一致」。为避免把“带病订单”同步到订阅,请先完成金额/状态治理。</div>
<div style="margin-top:6px;">
<div>当前订单命中「对账不一致/退款不一致」。为避免把“带病订单”同步到订阅,请先完成金额/状态治理。</div>
<div class="mt-6">
@if($order->isReconcileMismatch())
@php
$fixReceiptUrl = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $orderShowSelf]) . '#add-payment-receipt';

View File

@@ -0,0 +1,69 @@
<?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 AdminPlatformOrderToolsReceiptNoneHintTest 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_tools_page_shows_receipt_none_hint_when_receipt_status_none_and_syncable_only_present(): void
{
$this->loginAsPlatformAdmin();
$merchant = Merchant::query()->firstOrFail();
$plan = Plan::query()->create([
'code' => 'receipt_none_tools_hint_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,
'order_no' => 'PO_RCPT_NONE_TOOLS_HINT_0001',
'order_type' => 'renewal',
'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(),
// 无 payment_summary/payment_receipts即“无回执”集合
'meta' => [],
]);
$res = $this->get('/admin/platform-orders?syncable_only=1&receipt_status=none');
$res->assertOk();
$res->assertSee('回执缺失提示', false);
$res->assertSee('当前集合为「无回执」且已勾选「只看可同步」', false);
$res->assertSee('切到有回执集合', false);
$res->assertSee('取消只看可同步(先治理)', false);
}
}