diff --git a/resources/views/admin/platform_orders/index.blade.php b/resources/views/admin/platform_orders/index.blade.php index 3a3dbb8..e892db4 100644 --- a/resources/views/admin/platform_orders/index.blade.php +++ b/resources/views/admin/platform_orders/index.blade.php @@ -1061,6 +1061,14 @@
清理失败标记:同步订阅
+ @php + // 清理同步失败标记:前端治理提示(后端仍有 confirm=YES 等安全阀,这里只做“减少误点/更可治理”) + $clearSyncBlockedReason = ''; + if ((string) ($filters['sync_status'] ?? '') !== 'failed' && (string) ($filters['fail_only'] ?? '') === '') { + $clearSyncBlockedReason = '建议先筛选「同步失败」集合(sync_status=failed)后再执行清理,避免误清理。'; + } + $clearSyncBlocked = $clearSyncBlockedReason !== ''; + @endphp
@csrf @@ -1087,7 +1095,10 @@
- + + @if($clearSyncBlocked) +
提示:{{ $clearSyncBlockedReason }}
+ @endif
@@ -1109,6 +1120,14 @@
清理失败标记:批量 BMPA
+ @php + // 清理 BMPA 失败标记:前端治理提示(建议先进入 BMPA 失败集合再清理,避免误清理) + $clearBmpaBlockedReason = ''; + if ((string) ($filters['bmpa_failed_only'] ?? '') === '' && (string) ($filters['bmpa_error_keyword'] ?? '') === '' && (string) ($filters['batch_mark_paid_and_activate_24h'] ?? '') === '') { + $clearBmpaBlockedReason = '建议先筛选「BMPA失败」集合(bmpa_failed_only=1 或失败原因关键词)后再执行清理,避免误清理。'; + } + $clearBmpaBlocked = $clearBmpaBlockedReason !== ''; + @endphp
@csrf @@ -1135,7 +1154,10 @@
- + + @if($clearBmpaBlocked) +
提示:{{ $clearBmpaBlockedReason }}
+ @endif
diff --git a/tests/Feature/AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest.php b/tests/Feature/AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest.php new file mode 100644 index 0000000..4285bbf --- /dev/null +++ b/tests/Feature/AdminPlatformOrderIndexClearErrorButtonsShouldDisableWhenNotInFailedScopeTest.php @@ -0,0 +1,43 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_clear_error_buttons_should_disable_when_filters_not_in_failed_scopes(): void + { + $this->loginAsPlatformAdmin(); + + // 默认列表(未进入失败集合) + $res = $this->get('/admin/platform-orders'); + $res->assertOk(); + + $html = (string) $res->getContent(); + + $this->assertStringContainsString('清除同步失败标记(当前筛选范围)', $html); + $this->assertStringContainsString('data-role="clear-sync-errors-blocked-hint"', $html); + $this->assertStringContainsString('同步失败', $html); + + $this->assertStringContainsString('清除批量标记支付失败标记(当前筛选范围)', $html); + $this->assertStringContainsString('data-role="clear-bmpa-errors-blocked-hint"', $html); + $this->assertStringContainsString('BMPA失败', $html); + + // 按钮 disabled(宽松断言) + $this->assertTrue(str_contains($html, 'type="submit" disabled') || str_contains($html, 'disabled="disabled"')); + } +}