| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- import { StackScreenProps } from '@react-navigation/stack';
- import * as React from 'react';
- import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
- import { ScrollView } from 'react-native-gesture-handler';
- import { RootStackParamList } from '../types';
- import { useRequest } from 'ahooks';
- import useModel from 'flooks';
- import User from '../stores/User';
- import { getMoney } from '../utils/SystemUtils';
- import request from '../utils/RequestUtils';
- import { today } from '../utils/TimeUtils';
- import { useTranslation } from 'react-i18next';
- import ReacordCom from './ReacordCom';
- export default function MineWalletScreen({
- navigation,
- }: StackScreenProps<RootStackParamList, 'Login'>) {
- const { t } = useTranslation();
- const { userInfo } = useModel(User, ['userInfo']);
- const { data, loading } = useRequest(
- () => {
- return request.get(__DEV__ ? '/moneyRecord/all' : '/moneyRecord/my', {
- params: {
- query: {
- time: today(),
- },
- },
- });
- },
- {
- formatResult: (response) => response.content,
- initialData: [],
- defaultLoading: false,
- }
- );
- const { money } = userInfo;
- return (
- <Div bg="gray100" flex={1}>
- <Div bg="yellow500" row>
- <Text color="red700" fontSize="sm" flex={1} pl={20} pt={30}>
- {t('yu-e')}
- </Text>
- <Text
- flex={1}
- textAlign="center"
- fontSize="6xl"
- color="white"
- fontWeight="bold"
- py={20}
- >
- {getMoney(money)}
- </Text>
- <Button
- onPress={() => navigation.navigate('BankCard')}
- flex={1}
- bg="transparent"
- alignSelf="flex-end"
- py={30}
- >
- <Text
- textDecorLine="underline"
- textDecorColor="white"
- color="white"
- fontSize="xl"
- >
- {t('ti-xian')}
- </Text>
- </Button>
- </Div>
- <ScrollView
- contentContainerStyle={{
- flexGrow: 1,
- backgroundColor: '#f2f2f2',
- }}
- stickyHeaderIndices={[0, 2]}
- >
- <Div row h={40} alignItems="center" bg="gray100" px={20}>
- <Text flex={1} fontSize="sm">
- {t('jin-ri-zhang-dan')}
- </Text>
- <Text fontSize="sm" color="gray500">
- {t('jin-ri-shou-ru')}¥ 16,752.95
- </Text>
- <Text fontSize="sm" color="gray500" ml={10}>
- {t('jin-ri-zhi-chu')} ¥ 6,752.95
- </Text>
- </Div>
- <Div bg="white" px={15}>
- {data.map((item) => {
- return <ReacordCom key={item.id} info={item} />;
- })}
- {data.length == 0 && !loading && (
- <Text p={15} textAlign="center">
- {t('jin-ri-huan-mei-you-zhang-dan-xin-xio')}
- </Text>
- )}
- </Div>
- <Button
- p={0}
- block
- mb={50}
- bg="white"
- mt={10}
- onPress={() => navigation.navigate('MineRecord')}
- >
- <Div flex={1} row h={52} alignItems="center" px={15}>
- <Text flex={1} fontSize="sm">
- {t('wo-de-dui-zhang-dan')}
- </Text>
- <Icon ml={5} name="right" fontSize="sm" />
- </Div>
- </Button>
- </ScrollView>
- </Div>
- );
- }
|