|
|
@@ -1,6 +1,12 @@
|
|
|
import { SectionHeader } from '@/components/ui/section-header';
|
|
|
import { StatusBadge } from '@/components/ui/status-badge';
|
|
|
+import { Colors } from '@/constants/theme';
|
|
|
+import api from '@/utils/api';
|
|
|
+import { useSWC } from '@/utils/cache';
|
|
|
+import { Icon } from '@ant-design/react-native';
|
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
|
+import { Link } from 'expo-router';
|
|
|
+
|
|
|
import { Pressable, ScrollView, Text, View } from 'react-native';
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
|
type QuickAction = {
|
|
|
@@ -92,7 +98,19 @@ function getGreeting() {
|
|
|
}
|
|
|
|
|
|
export default function HomeScreen() {
|
|
|
-
|
|
|
+ const { data: summary, loading: summaryLoding, error } = useSWC<{
|
|
|
+ pendding: number;
|
|
|
+ matched: number;
|
|
|
+ completed: number;
|
|
|
+ }>('home/summary', async () => {
|
|
|
+ return api.get("share/summary");
|
|
|
+ }, {
|
|
|
+ cacheTimeout: 300,
|
|
|
+ cacheOnly: false
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
return (
|
|
|
<SafeAreaView className="flex-1 bg-surface" edges={['top']}>
|
|
|
<View className="h-14 flex-row items-center justify-between border-b border-outline-variant/20 bg-surface-container-lowest px-5">
|
|
|
@@ -124,23 +142,12 @@ export default function HomeScreen() {
|
|
|
</View>
|
|
|
|
|
|
<View className="mb-8 gap-3">
|
|
|
- <View className="rounded-2xl bg-primary-container px-5 py-5">
|
|
|
- <View className="mb-5 flex-row items-start justify-between">
|
|
|
- <View className="h-11 w-11 items-center justify-center rounded-2xl bg-white/20">
|
|
|
- <Ionicons name="briefcase-outline" size={22} color="#ffffff" />
|
|
|
- </View>
|
|
|
- <View className="rounded-full bg-white/20 px-3 py-1">
|
|
|
- <Text className="text-sm font-bold text-on-primary">+12%</Text>
|
|
|
- </View>
|
|
|
- </View>
|
|
|
- <Text className="mb-2 text-base text-on-primary/80">待处理申请</Text>
|
|
|
- <Text className="text-5xl font-extrabold text-on-primary">24</Text>
|
|
|
- </View>
|
|
|
+
|
|
|
|
|
|
<View className="flex-row gap-3">
|
|
|
<View className="flex-1 rounded-2xl border border-outline-variant bg-surface-container-lowest px-4 py-5">
|
|
|
- <Text className="mb-2 text-base text-on-surface-variant">进行中</Text>
|
|
|
- <Text className="text-4xl font-bold text-on-surface">156</Text>
|
|
|
+ <Text className="mb-2 text-base text-on-surface-variant">已分析</Text>
|
|
|
+ <Text className="text-4xl font-bold text-on-surface">{summary ? summary.pendding : '...'}</Text>
|
|
|
<View className="mt-4 h-1.5 rounded-full bg-surface-container">
|
|
|
<View
|
|
|
className="h-full rounded-full bg-secondary"
|
|
|
@@ -149,11 +156,21 @@ export default function HomeScreen() {
|
|
|
</View>
|
|
|
</View>
|
|
|
<View className="flex-1 rounded-2xl border border-outline-variant bg-surface-container-lowest px-4 py-5">
|
|
|
- <Text className="mb-2 text-base text-on-surface-variant">成功撮合</Text>
|
|
|
- <Text className="text-4xl font-bold text-on-surface">1,280</Text>
|
|
|
+ <Text className="mb-2 text-base text-on-surface-variant">待匹配</Text>
|
|
|
+ <Text className="text-4xl font-bold text-on-surface">{summary ? summary.matched : '...'}</Text>
|
|
|
+ <View className="mt-4 h-1.5 rounded-full bg-surface-container">
|
|
|
+ <View
|
|
|
+ className="h-full rounded-full bg-tertiary-fixed-dim"
|
|
|
+ style={{ width: '88%' }}
|
|
|
+ />
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ <View className="flex-1 rounded-2xl border border-outline-variant bg-surface-container-lowest px-4 py-5">
|
|
|
+ <Text className="mb-2 text-base text-on-surface-variant">已匹配</Text>
|
|
|
+ <Text className="text-4xl font-bold text-on-surface">{summary ? summary.completed : '...'}</Text>
|
|
|
<View className="mt-4 h-1.5 rounded-full bg-surface-container">
|
|
|
<View
|
|
|
- className="h-full rounded-full bg-tertiary-container"
|
|
|
+ className="h-full rounded-full bg-blue-600"
|
|
|
style={{ width: '88%' }}
|
|
|
/>
|
|
|
</View>
|
|
|
@@ -162,25 +179,21 @@ export default function HomeScreen() {
|
|
|
</View>
|
|
|
|
|
|
<View className="mb-8">
|
|
|
- <SectionHeader title="快捷操作" />
|
|
|
- <View className="flex-row items-start justify-between">
|
|
|
- {QUICK_ACTIONS.map((action) => (
|
|
|
- <Pressable
|
|
|
- key={action.label}
|
|
|
- className="items-center"
|
|
|
- style={({ pressed }) => ({
|
|
|
- opacity: pressed ? 0.84 : 1,
|
|
|
- transform: [{ scale: pressed ? 0.96 : 1 }],
|
|
|
- })}
|
|
|
- >
|
|
|
- <View className="mb-2.5 h-14 w-14 items-center justify-center rounded-2xl bg-surface-container-high">
|
|
|
- <Ionicons name={action.icon} size={26} color="#004ac6" />
|
|
|
- </View>
|
|
|
- <Text className="text-sm font-medium text-on-surface-variant">
|
|
|
- {action.label}
|
|
|
- </Text>
|
|
|
+ <SectionHeader title="快捷入口" />
|
|
|
+ <View className="flex-row items-start justify-around">
|
|
|
+ <Link href="/customer/add" asChild >
|
|
|
+ <Pressable className='flex-1 h-12 rounded-lg flex-row justify-center items-center bg-primary'>
|
|
|
+ <Icon name='user-add' color='#fff' />
|
|
|
+ <Text className='ml-2 text-lg font-medium text-white'>添加客户</Text>
|
|
|
</Pressable>
|
|
|
- ))}
|
|
|
+ </Link>
|
|
|
+ <View className='w-5' />
|
|
|
+ <Link href="/customer/add" asChild>
|
|
|
+ <Pressable className='flex-1 h-12 rounded-lg flex-row justify-center items-center border-2 border-primary/50'>
|
|
|
+ <Icon name='user-add' color={Colors.primary.DEFAULT} />
|
|
|
+ <Text className='ml-2 text-lg font-medium text-primary'>添加客户</Text>
|
|
|
+ </Pressable>
|
|
|
+ </Link>
|
|
|
</View>
|
|
|
</View>
|
|
|
|