|
@@ -0,0 +1,179 @@
|
|
|
|
|
+import styles from "./styles.module.scss";
|
|
|
|
|
+import Spring from "@components/Spring";
|
|
|
|
|
+import React, {useEffect} from "react";
|
|
|
|
|
+import {ReactComponent as PixLogo} from "@assets/singlesvg/pix.svg";
|
|
|
|
|
+import {useDispatch, useSelector} from "react-redux";
|
|
|
|
|
+import {getWithdrawBaseInfo, getWithdrawInfo} from "@features/paySlice";
|
|
|
|
|
+import SmallLoading from "@components/SmallLoading";
|
|
|
|
|
+import {reqWithdrawInfo} from "@features/api";
|
|
|
|
|
+import {Controller, useForm} from "react-hook-form";
|
|
|
|
|
+import PasswordInput from "@components/UInput/PasswordInput";
|
|
|
|
|
+import classNames from "classnames";
|
|
|
|
|
+import {APP_GENDER} from "@constants/app";
|
|
|
|
|
+const i18n=global.i18n;
|
|
|
|
|
+const BRAccountEdit=()=>{
|
|
|
|
|
+ let info=useSelector(getWithdrawBaseInfo);
|
|
|
|
|
+ if (info==null)info={};
|
|
|
|
|
+ const dispatch=useDispatch();
|
|
|
|
|
+ const {register, handleSubmit, formState: {errors}, control} = useForm({
|
|
|
|
|
+ defaultValues: {
|
|
|
|
|
+ account: info.AccountsBank||"",
|
|
|
|
|
+ userName: info.BankUserName||"",
|
|
|
|
|
+ bank: info.BankNO||"",
|
|
|
|
|
+ branceBank: info.BranchBank||"",
|
|
|
|
|
+ phone: info.PhoneNumber||"",
|
|
|
|
|
+ PAN: info.PANNumber||"",
|
|
|
|
|
+ IFSC:info.IFSCNumber||"",
|
|
|
|
|
+ email: info.EmailAddress||"",
|
|
|
|
|
+ PixNum: info.PixNum||"",
|
|
|
|
|
+ adhaar: info.AdhaarNumber||"",
|
|
|
|
|
+ PixType: info.PixType||"",
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ useEffect(()=>{
|
|
|
|
|
+ // dispatch(reqWithdrawInfo());
|
|
|
|
|
+ },[])
|
|
|
|
|
+ const handleChange=(data)=>{
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ const renderPixLogo=()=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className={styles.pix_title}>
|
|
|
|
|
+ <PixLogo className={styles.logo}/>
|
|
|
|
|
+ {i18n.t("deposit.order_info.pay_type_pix")}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ const renderAccoutForm=()=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <form autoComplete="off" className={styles.accout_form} onSubmit={handleSubmit((data) => {
|
|
|
|
|
+ handleChange(data);
|
|
|
|
|
+ })}>
|
|
|
|
|
+ <Controller control={control}
|
|
|
|
|
+ name="userName"
|
|
|
|
|
+ rules={{required: true}}
|
|
|
|
|
+ render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
|
|
+ <div className={styles.form_item}>
|
|
|
|
|
+ <div className={styles.title}>{i18n.t("withdraw.account.userName")}</div>
|
|
|
|
|
+ <div className={`input-control ${error?'input-control--error':''}`}>
|
|
|
|
|
+ <input
|
|
|
|
|
+ value={value}
|
|
|
|
|
+ onChange={e => onChange(e.target.value)}
|
|
|
|
|
+ placeholder={i18n.t('withdraw.account.name_holder')}
|
|
|
|
|
+ ref={ref}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Controller control={control}
|
|
|
|
|
+ name="phone"
|
|
|
|
|
+ rules={{required: true}}
|
|
|
|
|
+ render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
|
|
+ <div className={styles.form_item}>
|
|
|
|
|
+ <div className={styles.title}>{i18n.t("withdraw.account.phone")}</div>
|
|
|
|
|
+ <div className={`input-control ${error?'input-control--error':''}`}>
|
|
|
|
|
+ <input
|
|
|
|
|
+ value={value}
|
|
|
|
|
+ onChange={e => onChange(e.target.value)}
|
|
|
|
|
+ placeholder={i18n.t('withdraw.account.phone_holder')}
|
|
|
|
|
+ ref={ref}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Controller control={control}
|
|
|
|
|
+ name="email"
|
|
|
|
|
+ rules={{required: true}}
|
|
|
|
|
+ render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
|
|
+ <div className={styles.form_item}>
|
|
|
|
|
+ <div className={styles.title}>{i18n.t("withdraw.account.email")}</div>
|
|
|
|
|
+ <div className={`input-control ${error?'input-control--error':''}`}>
|
|
|
|
|
+ <input
|
|
|
|
|
+ value={value}
|
|
|
|
|
+ onChange={e => onChange(e.target.value)}
|
|
|
|
|
+ placeholder={i18n.t('withdraw.account.email_holder')}
|
|
|
|
|
+ ref={ref}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Controller control={control}
|
|
|
|
|
+ name="PixNum"
|
|
|
|
|
+ rules={{required: true}}
|
|
|
|
|
+ render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
|
|
+ <div className={styles.form_item}>
|
|
|
|
|
+ <div className={styles.title}>{i18n.t("withdraw.account.cpf")}</div>
|
|
|
|
|
+ <div className={`input-control ${error?'input-control--error':''}`}>
|
|
|
|
|
+ <input
|
|
|
|
|
+ value={value}
|
|
|
|
|
+ onChange={e => onChange(e.target.value)}
|
|
|
|
|
+ placeholder={i18n.t('withdraw.account.cpf_holder')}
|
|
|
|
|
+ ref={ref}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Controller control={control}
|
|
|
|
|
+ name="PixType"
|
|
|
|
|
+ rules={{required: true}}
|
|
|
|
|
+ render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
|
|
+ <div className={styles.form_item}>
|
|
|
|
|
+ <div className={styles.title}>{i18n.t("withdraw.account.cpf_dict")}</div>
|
|
|
|
|
+ <div className={styles.pix_con}>
|
|
|
|
|
+ <button type={"button"} className={`${styles.radio_btn} ${value==="0"?styles.active:''}`} onClick={()=>{
|
|
|
|
|
+ onChange("0");
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <div className={styles.circle}>
|
|
|
|
|
+ <div className={styles.dot}/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>{i18n.t("withdraw.account.cpf")}</div>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button type={"button"} className={`${styles.radio_btn} ${value==="1"?styles.active:''}`} onClick={()=>{
|
|
|
|
|
+ onChange("1");
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <div className={styles.circle}>
|
|
|
|
|
+ <div className={styles.dot}/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>{i18n.t("withdraw.account.e_mail")}</div>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button type={"button"} className={`${styles.radio_btn} ${value==="2"?styles.active:''}`} onClick={()=>{
|
|
|
|
|
+ onChange("2");
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <div className={styles.circle}>
|
|
|
|
|
+ <div className={styles.dot}/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>{i18n.t("withdraw.account.phone_type")}</div>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
|
|
+ />
|
|
|
|
|
+ <button className={"button-green"}>
|
|
|
|
|
+ {i18n.t("withdraw.account.btn_save")}
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <div className={styles.tips}>{i18n.t("withdraw.account.help")}</div>
|
|
|
|
|
+ </form>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ {
|
|
|
|
|
+ info==null?(
|
|
|
|
|
+ <div className={styles.loading}>
|
|
|
|
|
+ <SmallLoading/>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ ):(
|
|
|
|
|
+ <Spring type="slideUp" className={styles.container}>
|
|
|
|
|
+ {renderPixLogo()}
|
|
|
|
|
+ {renderAccoutForm()}
|
|
|
|
|
+ </Spring>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ </>
|
|
|
|
|
+ )
|
|
|
|
|
+}
|
|
|
|
|
+export default BRAccountEdit;
|