platform_orders index: show paid-but-no-receipt hint with fix link
This commit is contained in:
@@ -1060,6 +1060,19 @@
|
||||
<td>
|
||||
{{ $paymentStatusLabels[$order->payment_status] ?? $order->payment_status }}
|
||||
<div class="muted">{{ $order->payment_status }}</div>
|
||||
|
||||
@php
|
||||
$hasReceiptEvidenceRow = (data_get($order->meta, 'payment_summary.total_amount') !== null)
|
||||
|| (data_get($order->meta, 'payment_receipts.0.amount') !== null);
|
||||
$noReceiptFixUrlRow = '/admin/platform-orders/' . $order->id . '?' . \Illuminate\Support\Arr::query(['back' => $selfWithoutBack]) . '#add-payment-receipt';
|
||||
@endphp
|
||||
@if($order->payment_status === 'paid' && ! $hasReceiptEvidenceRow)
|
||||
<div class="muted text-danger muted-xs">
|
||||
无回执
|
||||
<span class="muted">|</span>
|
||||
<a class="link" href="{!! $noReceiptFixUrlRow !!}">去补回执</a>
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
<td>¥{{ number_format((float) $order->payable_amount, 2) }}</td>
|
||||
<td>¥{{ number_format((float) $order->paid_amount, 2) }}</td>
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Merchant;
|
||||
use App\Models\Plan;
|
||||
use App\Models\PlatformOrder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Arr;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformOrderIndexCompactViewPaidButNoReceiptShowsFixLinkTest 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_shows_fix_link_when_paid_but_no_receipt_evidence(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$merchant = Merchant::query()->firstOrFail();
|
||||
|
||||
$plan = Plan::query()->create([
|
||||
'code' => 'compact_view_no_receipt_fix_link_test',
|
||||
'name' => '精简视图无回执修复入口测试套餐',
|
||||
'billing_cycle' => 'monthly',
|
||||
'price' => 10,
|
||||
'list_price' => 10,
|
||||
'status' => 'active',
|
||||
'sort' => 10,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
|
||||
$order = PlatformOrder::query()->create([
|
||||
'merchant_id' => $merchant->id,
|
||||
'plan_id' => $plan->id,
|
||||
'order_no' => 'PO_COMPACT_NO_RECEIPT_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(),
|
||||
// 关键:无 payment_summary / payment_receipts
|
||||
'meta' => [],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-orders?status=activated');
|
||||
$res->assertOk();
|
||||
|
||||
$indexSelfWithoutBack = '/admin/platform-orders?' . Arr::query([
|
||||
'status' => 'activated',
|
||||
]);
|
||||
|
||||
$fixUrl = '/admin/platform-orders/' . $order->id . '?' . Arr::query([
|
||||
'back' => $indexSelfWithoutBack,
|
||||
]) . '#add-payment-receipt';
|
||||
|
||||
$res->assertSee('无回执', false);
|
||||
$res->assertSee($fixUrl, false);
|
||||
$res->assertSee('去补回执', false);
|
||||
|
||||
// full 视图:仍应保留该提示(因为“无回执”不属于对账差额/退款总额等可选列的内容)
|
||||
$this->get('/admin/platform-orders?status=activated&view=full')
|
||||
->assertOk()
|
||||
->assertSee('无回执', false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user