WithdrawResultScreen.tsx 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { StackScreenProps } from '@react-navigation/stack';
  2. import * as React from 'react';
  3. import { RefreshControl } from 'react-native';
  4. import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
  5. import { ScrollView } from 'react-native-gesture-handler';
  6. import { useRequest, useCreation } from 'ahooks';
  7. import { RootStackParamList } from '../types';
  8. import { applyMap } from '../utils/MoneyUtils';
  9. import { getMoney } from '../utils/SystemUtils';
  10. import { useTranslation } from 'react-i18next';
  11. const logo = require('../assets/images/logo2.png');
  12. const next = require('../assets/images/next.png');
  13. export default function WithdrawResultScreen({
  14. navigation,
  15. route,
  16. }: StackScreenProps) {
  17. const { t } = useTranslation();
  18. const { params } = route;
  19. const { id } = params || {};
  20. const { data, loading, refresh } = useRequest('/withdrawApply/get/' + id, {
  21. defaultLoading: false,
  22. });
  23. const statusInfo = useCreation(() => {
  24. if (data) {
  25. return applyMap.get(data.status);
  26. } else {
  27. return {};
  28. }
  29. }, [data]);
  30. const bankCard = useCreation(() => {
  31. if (data) {
  32. return data.bankCard || {};
  33. } else {
  34. return {};
  35. }
  36. }, [data]);
  37. return (
  38. <Div bg="gray100" flex={1}>
  39. <ScrollView
  40. contentContainerStyle={{
  41. flexGrow: 1,
  42. backgroundColor: '#f2f2f2',
  43. }}
  44. refreshControl={
  45. <RefreshControl refreshing={loading} onRefresh={refresh} />
  46. }
  47. >
  48. <Div row bg="white" alignItems="center" pl={31} pr={52} pt={10}>
  49. <Image source={logo} w={66} h={66} />
  50. <Div flex={1} h={2} bg="yellow500" />
  51. <Image source={next} w={33} h={33} />
  52. <Div flex={1} h={2} bg={statusInfo.color} />
  53. <Icon
  54. name={statusInfo.icon}
  55. color={statusInfo.color}
  56. fontSize="6xl"
  57. />
  58. </Div>
  59. <Text bg="white" textAlign="center" py={10}>
  60. {t(statusInfo.name)}
  61. </Text>
  62. {!!data && (
  63. <Div p={15} bg="white" mt={10}>
  64. <Div row py={2} justifyContent="space-between">
  65. <Text>{t('shen-qing-shi-jian')}</Text>
  66. <Text>{data.withdrawTime}</Text>
  67. </Div>
  68. <Div row py={2} justifyContent="space-between">
  69. <Text>{t('yin-hang-ka')}</Text>
  70. <Text>
  71. {bankCard.bankName} ({bankCard.cardNo})
  72. </Text>
  73. </Div>
  74. <Div row py={2} justifyContent="space-between">
  75. <Text>{t('ti-xian-jin-e')}</Text>
  76. <Text>¥{getMoney(data.amount)}</Text>
  77. </Div>
  78. </Div>
  79. )}
  80. </ScrollView>
  81. </Div>
  82. );
  83. }