diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 1fb1048..da357d8 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -776,7 +776,7 @@
¥{{ number_format($delta, 2) }}
{{ $summaryStats['reconciliation_delta_note'] ?? '回执总额 - 订单已付总额' }}(当前筛选范围)
对账不一致订单: - {{ $summaryStats['reconcile_mismatch_orders'] ?? 0 }} + {{ $summaryStats['reconcile_mismatch_orders'] ?? 0 }}
@php $tol = (float) config('saasshop.amounts.tolerance', 0.01); @endphp
当前容差:¥{{ number_format($tol, 2) }}
@@ -787,7 +787,7 @@

退款不一致订单

- {{ $summaryStats['refund_inconsistent_orders'] ?? 0 }} + {{ $summaryStats['refund_inconsistent_orders'] ?? 0 }}
@php $refundTol = (float) config('saasshop.amounts.tolerance', 0.01); @endphp
口径:状态=refunded 但退款总额 + 容差 < 已付;或状态!=refunded 且退款总额 >= 已付 + 容差
diff --git a/tests/Feature/AdminPlatformOrderIndexSummaryLinksShouldHaveDataRoleAndKeepBackTest.php b/tests/Feature/AdminPlatformOrderIndexSummaryLinksShouldHaveDataRoleAndKeepBackTest.php new file mode 100644 index 0000000..53bc70b --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexSummaryLinksShouldHaveDataRoleAndKeepBackTest.php @@ -0,0 +1,65 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_platform_orders_index_summary_links_should_have_data_role_and_keep_back(): void + { + $this->loginAsPlatformAdmin(); + + $res = $this->get('/admin/platform-orders?merchant_id=1&back=/admin&page=2'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $cases = [ + [ + 'role' => 'po-summary-link-reconcile-mismatch-orders', + 'expect' => ['reconcile_mismatch' => '1'], + ], + [ + 'role' => 'po-summary-link-refund-inconsistent-orders', + 'expect' => ['refund_inconsistent' => '1'], + ], + ]; + + foreach ($cases as $c) { + $role = (string) ($c['role'] ?? ''); + $this->assertNotSame('', $role); + + $re = '/]*data-role="' . preg_quote($role, '/') . '"[^>]*href="([^"]+)"/u'; + $this->assertMatchesRegularExpression($re, $html); + preg_match($re, $html, $m); + + $rawHref = (string) ($m[1] ?? ''); + $this->assertStringNotContainsString('&back=', $rawHref); + + $href = html_entity_decode($rawHref); + $query = parse_url($href, PHP_URL_QUERY) ?: ''; + parse_str($query, $q); + + foreach (($c['expect'] ?? []) as $k => $v) { + $this->assertSame((string) $v, (string) ($q[$k] ?? ''), $role . ' missing expected ' . $k); + } + + $this->assertSame('/admin', (string) ($q['back'] ?? '')); + $this->assertArrayNotHasKey('page', $q); + } + } +}