import { Button, Form, Input, Select, notification } from 'antd' import '../../styles/home.scss' import { useRef, useState } from 'react' import { observer } from 'mobx-react' import store from '../../store' import { http_send_email, http_transfer } from '../../http/api' import { useTranslation } from 'react-i18next' import CountdownTimer, { CountdownTimerRef } from '../../components/CountdownTimer' const Transfer = () => { const { userInfo } = store.state const [form] = Form.useForm() const { t } = useTranslation() const options = [ { label: t('Cash Wallet-Asset Account'), value: 1 }, { label: t('Cash Wallet-Other Members'), value: 2 }, { label: t('Asset Account-Cash Wallet'), value: 3 } ] const [type, setType] = useState(-1) const countdownRef = useRef(null) const onSelect = (_type: any) => { setType(_type) } const getVerifyCode = async () => { try { if (countdownRef.current?.isActive) return countdownRef.current?.handleStart() const res: any = await http_send_email({ email: userInfo.email, type: 5 }) if (res.code === 0) { notification.success({ message: t('Verification code sent successfully') }) } else { notification.error({ message: t('Failed to send verification code') }) countdownRef.current?.handleStop() } } catch (error) { countdownRef.current?.handleStop() } } const onFinish = async (values: any) => { const res: any = await http_transfer({ ...values, type }) if (res.code === 0) { store.getUserInfo() form.resetFields() notification.success({ message: t('Submit success') }) } } return (
{t('Assets transfer')}
{t('Assets transfer-matters needing attention')}

{t('1.Please ensure the safety of the equipment during use,Prevent data from being tampered with or leaked。')}

{/*

{t('2.In the process of fund transfer, if there is a delay or other situation,Please handle it later or contact customer service。')}

*/} {/*

{t('3.After fund transfer operation,There may be delays in the system;If exceeding10Minutes have not yet arrived,Please contact customer service。')}

*/}
{t('Assets operations')}}> ) } { type === 1 && ( {t('Capital account')}}> ) } { type === 3 && ( {t('Capital account')}}> ) } {t('Transfer amount')}}> { type === 2 && ( {t('Verification Code')}} name="code" rules={[{ required: true, message: t('Verification Code') }]}>
) }
) } export default observer(Transfer)