feat: platform order show hint reconcile mismatch and link to filter
This commit is contained in:
@@ -239,6 +239,18 @@
|
|||||||
<h3>支付回执(对账留痕)</h3>
|
<h3>支付回执(对账留痕)</h3>
|
||||||
<p class="muted muted-tight">用于“线下收款/转账/人工核对”的留痕记录(当前阶段先落 meta,不引入独立表)。</p>
|
<p class="muted muted-tight">用于“线下收款/转账/人工核对”的留痕记录(当前阶段先落 meta,不引入独立表)。</p>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$isReconcileMismatch = (bool) $order->isReconcileMismatch();
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if($isReconcileMismatch)
|
||||||
|
<div class="muted text-danger" style="margin-top:10px; margin-bottom:10px;">
|
||||||
|
提示:该订单「回执总额 vs 已付金额」存在差异,可能对账不一致。
|
||||||
|
<span class="muted">|</span>
|
||||||
|
<a class="link" href="/admin/platform-orders?reconcile_mismatch=1">查看全部对账不一致订单</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if(count($paymentReceipts) > 0)
|
@if(count($paymentReceipts) > 0)
|
||||||
@php $items = array_slice(array_reverse($paymentReceipts), 0, 20); @endphp
|
@php $items = array_slice(array_reverse($paymentReceipts), 0, 20); @endphp
|
||||||
<table>
|
<table>
|
||||||
@@ -298,16 +310,8 @@
|
|||||||
<p class="muted muted-tight">用于记录退款动作与对账轨迹(先落 meta,不引入独立表)。追加退款后,系统会自动把支付状态推进为“部分退款/已退款”(仅在订单当前为已支付时)。</p>
|
<p class="muted muted-tight">用于记录退款动作与对账轨迹(先落 meta,不引入独立表)。追加退款后,系统会自动把支付状态推进为“部分退款/已退款”(仅在订单当前为已支付时)。</p>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
// 退款不一致(与列表/筛选口径保持一致,按分取整 + 0.01 容差)
|
// 退款不一致(统一口径:模型方法)
|
||||||
$paidAmountFloat3 = (float) ($order->paid_amount ?? 0);
|
$isRefundInconsistent3 = (bool) $order->isRefundInconsistent();
|
||||||
$isRefundInconsistent3 = false;
|
|
||||||
if ($paidAmountFloat3 > 0) {
|
|
||||||
if ((string) $order->payment_status === 'refunded') {
|
|
||||||
$isRefundInconsistent3 = (round($refundTotal * 100) + 1) < round($paidAmountFloat3 * 100);
|
|
||||||
} else {
|
|
||||||
$isRefundInconsistent3 = round($refundTotal * 100) >= round($paidAmountFloat3 * 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@if($isRefundInconsistent3)
|
@if($isRefundInconsistent3)
|
||||||
|
|||||||
@@ -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 AdminPlatformOrderShowReconcileMismatchHintTest 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_show_page_can_render_reconcile_mismatch_hint_and_link(): void
|
||||||
|
{
|
||||||
|
$this->loginAsPlatformAdmin();
|
||||||
|
|
||||||
|
$merchant = Merchant::query()->firstOrFail();
|
||||||
|
$plan = Plan::query()->create([
|
||||||
|
'code' => 'show_reconcile_mismatch_hint_01',
|
||||||
|
'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_SHOW_RECONCILE_MISMATCH_0001',
|
||||||
|
'order_type' => 'subscription',
|
||||||
|
'status' => 'activated',
|
||||||
|
'payment_status' => 'paid',
|
||||||
|
'plan_name' => $plan->name,
|
||||||
|
'billing_cycle' => 'monthly',
|
||||||
|
'period_months' => 1,
|
||||||
|
'quantity' => 1,
|
||||||
|
'payable_amount' => 10,
|
||||||
|
'paid_amount' => 10,
|
||||||
|
'placed_at' => now(),
|
||||||
|
'paid_at' => now(),
|
||||||
|
'meta' => [
|
||||||
|
'payment_summary' => [
|
||||||
|
'count' => 1,
|
||||||
|
'total_amount' => 9.99,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->get('/admin/platform-orders/' . $order->id)
|
||||||
|
->assertOk()
|
||||||
|
->assertSee('对账不一致')
|
||||||
|
->assertSee('/admin/platform-orders?reconcile_mismatch=1', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user