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) }}
提示:该订单疑似存在「退款状态 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);
+ }
+}