import { StatusBadge } from '@/components/ui/status-badge'; import { Ionicons } from '@expo/vector-icons'; import React, { useState } from 'react'; import { Pressable, ScrollView, Text, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; type ReportTab = '全部' | '征信报告' | '匹配结果'; type ReportTag = { text: string; variant: 'primary' | 'secondary' | 'tertiary' | 'error'; }; type Report = { id: string; customerName: string; type: '征信报告' | '匹配结果'; time: string; status: '已完成' | '解析中' | '待匹配'; score?: string; matchCount?: number; matchRate?: string; tags?: ReportTag[]; }; const TABS: ReportTab[] = ['全部', '征信报告', '匹配结果']; const REPORTS: Report[] = [ { id: '1', customerName: '张德发', type: '征信报告', time: '今天 10:42', status: '已完成', score: 'B+', tags: [ { text: '收入稳定', variant: 'primary' }, { text: '查询偏多', variant: 'tertiary' }, { text: '负债率偏高', variant: 'error' }, ], }, { id: '2', customerName: '张德发', type: '匹配结果', time: '今天 11:05', status: '已完成', matchCount: 3, matchRate: '92%', }, { id: '3', customerName: '李美华', type: '征信报告', time: '昨天 15:20', status: '已完成', score: 'A', tags: [ { text: '信用优秀', variant: 'primary' }, { text: '负债较低', variant: 'secondary' }, ], }, { id: '4', customerName: '王五', type: '征信报告', time: '今天 09:16', status: '解析中', }, { id: '5', customerName: '赵丽', type: '匹配结果', time: '5天前', status: '待匹配', }, ]; function getStatusVariant(status: Report['status']) { switch (status) { case '已完成': return 'success' as const; case '解析中': return 'secondary' as const; case '待匹配': return 'error' as const; default: return 'secondary' as const; } } export default function ReportsScreen() { const [activeTab, setActiveTab] = useState('全部'); const filteredReports = REPORTS.filter( (item) => activeTab === '全部' || item.type === activeTab ); const completedCount = REPORTS.filter((item) => item.status === '已完成').length; return ( 报表 汇总查看征信分析结果、匹配建议和当前处理进度 {REPORTS.length} 总报告数 {completedCount} 已完成 92% 最高匹配 {TABS.map((tab) => { const active = activeTab === tab; return ( setActiveTab(tab)} className={`flex-1 rounded-xl py-2.5 ${ active ? 'bg-surface-container-lowest' : '' }`} style={({ pressed }) => ({ opacity: pressed ? 0.88 : 1, })} > {tab} ); })} {filteredReports.map((report) => ( ({ opacity: pressed ? 0.93 : 1, })} > {report.customerName} {report.type} {report.time} {report.type === '征信报告' && report.status === '已完成' ? ( {report.score} 关键标签 {report.tags?.map((tag) => ( ))} 建议可申请额度:20万-35万,优先推荐更看重流水稳定性的产品。 ) : null} {report.type === '匹配结果' && report.status === '已完成' ? ( {report.matchCount} 匹配产品数 {report.matchRate} 最高匹配度 ) : null} {report.status === '解析中' ? ( 正在生成报告... 72% ) : null} {report.status === '待匹配' ? ( 当前客户信息已同步,待进入智能匹配流程生成推荐结果。 ) : null} {report.status === '已完成' ? ( ({ opacity: pressed ? 0.88 : 1, })} > {report.type === '征信报告' ? '查看详情' : '查看匹配'} ({ opacity: pressed ? 0.88 : 1, })} > {report.type === '征信报告' ? '智能匹配' : '重新匹配'} ) : null} ))} ); }