import { Ionicons } from '@expo/vector-icons';
import { useRouter } from 'expo-router';
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useLegalData } from '../../src/hooks';
import { LoadingState, ErrorState, EmptyState } from '../../src/components/StateView';
import { colors } from '../../src/theme';
import type { LegalPlan } from '../../src/types';
/* ===================== 顶部导航 ===================== */
function Header({ onBack }: { onBack: () => void }) {
return (
开通会员
);
}
/* ===================== 套餐卡片 ===================== */
function PlanCard({ plan }: { plan: LegalPlan }) {
return (
{plan.recommended && (
推荐
)}
{plan.name}
¥
{plan.price}
{plan.period}
{plan.benefits.map((benefit, idx) => (
{benefit}
))}
);
}
/* ===================== 页面 ===================== */
export default function LegalUpgradeScreen() {
const router = useRouter();
const { plans, loading, error, refresh } = useLegalData();
return (
router.back()} />
{loading ? (
) : error ? (
) : plans.length === 0 ? (
) : (
开通会员后可享受律师咨询、合同审核等专属法律服务
{plans.map((plan) => (
))}
)}
);
}
const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: colors.pageBg,
},
header: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
paddingHorizontal: 8,
height: 48,
backgroundColor: colors.white,
borderBottomWidth: 1,
borderBottomColor: colors.borderLight,
},
headerBtn: {
width: 40,
height: 40,
alignItems: 'center',
justifyContent: 'center',
},
headerTitle: {
fontSize: 17,
fontWeight: '700',
color: colors.textPrimary,
},
scroll: {
flex: 1,
},
content: {
padding: 12,
paddingBottom: 24,
},
tip: {
fontSize: 13,
color: colors.textSecondary,
marginBottom: 12,
},
planGrid: {
gap: 12,
},
planCard: {
padding: 14,
borderRadius: 8,
backgroundColor: colors.white,
borderWidth: 1,
borderColor: colors.border,
},
planCardRecommended: {
borderColor: colors.action,
backgroundColor: colors.actionLight,
},
recommendedTag: {
alignSelf: 'flex-start',
paddingHorizontal: 6,
paddingVertical: 2,
borderRadius: 4,
backgroundColor: colors.action,
marginBottom: 8,
},
recommendedText: {
fontSize: 10,
fontWeight: '700',
color: colors.white,
},
planName: {
fontSize: 15,
fontWeight: '700',
color: colors.textPrimary,
},
planPriceRow: {
flexDirection: 'row',
alignItems: 'baseline',
marginTop: 8,
marginBottom: 10,
},
planCurrency: {
fontSize: 14,
fontWeight: '700',
color: colors.actionText,
},
planPrice: {
fontSize: 28,
fontWeight: '700',
color: colors.actionText,
},
planPeriod: {
fontSize: 13,
color: colors.textSecondary,
},
benefits: {
gap: 6,
},
benefitRow: {
flexDirection: 'row',
alignItems: 'center',
gap: 6,
},
benefitText: {
fontSize: 12,
color: colors.textSecondary,
},
});