import React from 'react'; import { Grid, Box, Flex, BoxProps, useTheme, Button, Table, Thead, Tbody, Tr, Th, Td, TableContainer } from '@chakra-ui/react'; import { useTranslation } from 'next-i18next'; import { useQuery } from '@tanstack/react-query'; import { getPromotionInitData, getPromotionRecords } from '@/web/support/activity/promotion/api'; import { useUserStore } from '@/web/support/user/useUserStore'; import { useCopyData } from '@/web/common/hooks/useCopyData'; import dayjs from 'dayjs'; import { usePagination } from '@fastgpt/web/hooks/usePagination'; import { useLoading } from '@fastgpt/web/hooks/useLoading'; import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip'; import EmptyTip from '@fastgpt/web/components/common/EmptyTip'; const Promotion = () => { const { t } = useTranslation(); const theme = useTheme(); const { copyData } = useCopyData(); const { userInfo } = useUserStore(); const { Loading } = useLoading(); const { data: promotionRecords, isLoading, total, pageSize, Pagination } = usePagination({ api: getPromotionRecords, pageSize: 20 }); const { data: { invitedAmount = 0, earningsAmount = 0 } = {} } = useQuery( ['getPromotionInitData'], getPromotionInitData ); const statisticsStyles: BoxProps = { p: [4, 5], border: theme.borders.base, textAlign: 'center', fontSize: ['md', 'lg'], borderRadius: 'md' }; const titleStyles: BoxProps = { mt: 2, fontSize: ['lg', '28px'], fontWeight: 'bold' }; return ( {t('common:user.Amount of inviter')} {invitedAmount} {t('common:user.Amount of earnings')} {earningsAmount} {t('common:user.Promotion Rate')} {userInfo?.promotionRate || 15}% {t('common:user.Invite Url')} {promotionRecords.map((item) => ( ))}
{t('common:user.Time')} {t('common:user.type')} {t('common:pay.amount')}
{item.createTime ? dayjs(item.createTime).format('YYYY/MM/DD HH:mm:ss') : '-'} {t(`user:promotion.${item.type}` as any)} {item.amount}
{!isLoading && promotionRecords.length === 0 && ( )} {total > pageSize && ( )}
); }; export default Promotion;