From d51a750d175a8425f0d2d68cc907274c2f82432f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=9D=E5=8D=9C?= Date: Fri, 13 Mar 2026 20:15:47 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=EF=BC=9A=E5=AF=B9=E8=B4=A6/=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E5=88=97=E8=A1=A8=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=90=BA=E5=B8=A6=20back=20=E5=B9=B6=E9=98=B2=E5=B5=8C?= =?UTF-8?q?=E5=A5=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/platform_orders/show.blade.php | 24 ++++- ...ndInconsistentListLinksContainBackTest.php | 97 +++++++++++++++++++ 2 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/AdminPlatformOrderShowReconcileRefundInconsistentListLinksContainBackTest.php diff --git a/resources/views/admin/platform_orders/show.blade.php b/resources/views/admin/platform_orders/show.blade.php index 950af39..506f2ba 100644 --- a/resources/views/admin/platform_orders/show.blade.php +++ b/resources/views/admin/platform_orders/show.blade.php @@ -110,7 +110,13 @@
已付:¥{{ number_format($paidAmountFloat, 2) }}|退款总额:¥{{ number_format($refundTotal, 2) }}
操作说明:该区块仅用于修正支付状态展示口径,不会改金额、不生成退款记录;请先核对退款轨迹。
- 查看全部退款不一致订单 + @php + $refundInconsistentListUrl = '/admin/platform-orders?' . \Illuminate\Support\Arr::query([ + 'refund_inconsistent' => 1, + 'back' => $orderShowSelf, + ]); + @endphp + 查看全部退款不一致订单
@if($canMarkRefunded) @@ -320,7 +326,13 @@ 去补一条支付回执 - 查看全部对账不一致订单 + @php + $reconcileMismatchListUrl = '/admin/platform-orders?' . \Illuminate\Support\Arr::query([ + 'reconcile_mismatch' => 1, + 'back' => $orderShowSelf, + ]); + @endphp + 查看全部对账不一致订单 @endif @@ -391,7 +403,13 @@
提示:该订单疑似存在「退款状态 vs 退款总额」不一致(按容差口径),建议核对退款轨迹、已付金额与支付状态。 - 查看全部退款不一致订单 + @php + $refundInconsistentListUrl = '/admin/platform-orders?' . \Illuminate\Support\Arr::query([ + 'refund_inconsistent' => 1, + 'back' => $orderShowSelf, + ]); + @endphp + 查看全部退款不一致订单
@endif diff --git a/tests/Feature/AdminPlatformOrderShowReconcileRefundInconsistentListLinksContainBackTest.php b/tests/Feature/AdminPlatformOrderShowReconcileRefundInconsistentListLinksContainBackTest.php new file mode 100644 index 0000000..e69617a --- /dev/null +++ b/tests/Feature/AdminPlatformOrderShowReconcileRefundInconsistentListLinksContainBackTest.php @@ -0,0 +1,97 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_show_page_list_links_should_carry_back_to_order_show_self_without_nested_back(): void + { + $this->loginAsPlatformAdmin(); + + $merchant = Merchant::query()->firstOrFail(); + $plan = Plan::query()->create([ + 'code' => 'po_show_reconcile_refund_list_back_plan', + 'name' => '平台订单详情对账/退款不一致列表 back 链接测试套餐', + 'billing_cycle' => 'monthly', + 'price' => 10, + 'list_price' => 10, + 'status' => 'active', + 'sort' => 10, + 'published_at' => now(), + ]); + + // 造一个“对账不一致”的订单:receipt_total(9) vs paid_amount(10) + $order = PlatformOrder::query()->create([ + 'merchant_id' => $merchant->id, + 'plan_id' => $plan->id, + 'order_no' => 'PO_SHOW_LIST_BACK_0001', + 'order_type' => 'new_purchase', + 'status' => 'pending', + '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(), + 'meta' => [ + 'payment_summary' => ['count' => 1, 'total' => 9], + 'payment_receipts' => [ + ['amount' => 9, 'paid_at' => now()->toDateTimeString(), 'channel' => 'offline', 'note' => 'test'], + ], + // 同时造一个“退款不一致”态:payment_status=refunded 但退款总额不足 + 'refund_summary' => ['count' => 1, 'total' => 1], + 'refund_receipts' => [ + ['amount' => 1, 'refunded_at' => now()->toDateTimeString(), 'channel' => 'offline', 'note' => 'test'], + ], + ], + ]); + + // 为了触发退款不一致提示:将状态改为 refunded + $order->update(['payment_status' => 'refunded']); + + // 模拟从列表进入详情页(带 back) + $res = $this->get('/admin/platform-orders/' . $order->id . '?back=' . urlencode('/admin/platform-orders?status=pending')); + $res->assertOk(); + + // 详情页自身(去掉 back) + $expectedOrderShowSelf = '/admin/platform-orders/' . $order->id; + + $expectedReconcileUrl = '/admin/platform-orders?' . Arr::query([ + 'reconcile_mismatch' => 1, + 'back' => $expectedOrderShowSelf, + ]); + + $expectedRefundUrl = '/admin/platform-orders?' . Arr::query([ + 'refund_inconsistent' => 1, + 'back' => $expectedOrderShowSelf, + ]); + + $res->assertSee($expectedReconcileUrl, false); + $res->assertSee($expectedRefundUrl, false); + + // 不允许 back 嵌套 + $res->assertDontSee('back%3D', false); + } +}