|
|
@@ -1,5 +1,5 @@
|
|
|
import React, {useEffect, useRef, useState} from "react";
|
|
|
-import {reqMexWithdrawSetInfo, reqWithdrawInfo, reqWithdrawSetInfo} from "@features/api";
|
|
|
+import {reqMexWithdrawSetInfo, reqRuWithdrawSetInfo, reqWithdrawInfo, reqWithdrawSetInfo} from "@features/api";
|
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
|
import {getUserInfo} from "@features/mainSlice";
|
|
|
import {getWDBaseInfoStatus, getWDInfoStatus, getWDSetInfoStatus, getWithdrawInfo} from "@features/paySlice";
|
|
|
@@ -49,6 +49,12 @@ const RUAccountEdit=({close})=>{
|
|
|
useEffect(()=>{
|
|
|
dispatch(reqWithdrawInfo({UserID:user.UserID}));
|
|
|
},[])
|
|
|
+ useEffect(()=>{
|
|
|
+ if (info!=null){
|
|
|
+ setBankNo(info.BranchBank||"");
|
|
|
+ setShowPixType(dinfo.PixType||"1")
|
|
|
+ }
|
|
|
+ },[info])
|
|
|
const checkLockStatus=()=>{
|
|
|
if (baseStatus===REQ_STATUS.LOADING)return true;
|
|
|
if (setStatus===REQ_STATUS.LOADING)return true;
|
|
|
@@ -120,7 +126,7 @@ const RUAccountEdit=({close})=>{
|
|
|
if (checkLockStatus())return;
|
|
|
data.bank=bankNo;
|
|
|
data.callback=callback;
|
|
|
- dispatch(reqWithdrawSetInfo(data));
|
|
|
+ dispatch(reqRuWithdrawSetInfo(data));
|
|
|
}
|
|
|
const renderAccoutForm=()=>{
|
|
|
return (
|
|
|
@@ -128,26 +134,49 @@ const RUAccountEdit=({close})=>{
|
|
|
handleChange(data);
|
|
|
})}>
|
|
|
{
|
|
|
- showPixType==="1"?(
|
|
|
- <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_ru.userName")}</div>
|
|
|
- <div className={`input-control ${error ? 'input-control--error' : ''}`}>
|
|
|
- <input
|
|
|
- value={value}
|
|
|
- onChange={e => onChange(e.target.value)}
|
|
|
- placeholder={i18n.t('withdraw.account_ru.name_holder')}
|
|
|
- ref={ref}
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <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_ru.userName")}</div>
|
|
|
+ <div className={`input-control ${error ? 'input-control--error' : ''}`}>
|
|
|
+ <input
|
|
|
+ value={value}
|
|
|
+ onChange={e => onChange(e.target.value)}
|
|
|
+ placeholder={i18n.t('withdraw.account_ru.name_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_ru.withdraw_via")}</div>
|
|
|
+ <div className={styles.pix_con}>
|
|
|
+ <RadioBtn className={styles.radio_type} selected={(value + "") === "1"}
|
|
|
+ value={"1"} onChange={(value) => {
|
|
|
+ setShowPixType(value)
|
|
|
+ onChange(value);
|
|
|
+ }}>
|
|
|
+ <span>{i18n.t("withdraw.account_ru.pix_type_1")}</span>
|
|
|
+ </RadioBtn>
|
|
|
+ <RadioBtn className={styles.radio_type} selected={(value + "") === "2"}
|
|
|
+ value={"2"} onChange={(value) => {
|
|
|
+ setShowPixType(value)
|
|
|
+ onChange(value);
|
|
|
+ }}>
|
|
|
+ <span>{i18n.t("withdraw.account_ru.pix_type_2")}</span>
|
|
|
+ </RadioBtn>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ />
|
|
|
{
|
|
|
showPixType==="1"?(<></>):(
|
|
|
<Controller control={control}
|
|
|
@@ -170,23 +199,6 @@ const RUAccountEdit=({close})=>{
|
|
|
/>
|
|
|
)
|
|
|
}
|
|
|
- <Controller control={control}
|
|
|
- name="email"
|
|
|
- rules={{required: true, validate: validateMail}}
|
|
|
- render={({field: {ref, onChange, value}, fieldState: {error}}) => (
|
|
|
- <div className={styles.form_item}>
|
|
|
- <div className={styles.title}>{i18n.t("withdraw.account_ru.email")}</div>
|
|
|
- <div className={`input-control ${error ? 'input-control--error' : ''}`}>
|
|
|
- <input
|
|
|
- value={value}
|
|
|
- onChange={e => onChange(e.target.value)}
|
|
|
- placeholder={i18n.t('withdraw.account_ru.email_holder')}
|
|
|
- ref={ref}
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- />
|
|
|
{
|
|
|
showPixType==="1"?(
|
|
|
<Controller control={control}
|
|
|
@@ -209,8 +221,8 @@ const RUAccountEdit=({close})=>{
|
|
|
):(<></>)
|
|
|
}
|
|
|
{
|
|
|
- // showPixType==="1"?(<></>):(
|
|
|
- (
|
|
|
+ showPixType==="1"?(<></>):(
|
|
|
+ // (
|
|
|
<Controller control={control}
|
|
|
name="bankName"
|
|
|
rules={{validate: validateBankCode}}
|
|
|
@@ -242,31 +254,7 @@ const RUAccountEdit=({close})=>{
|
|
|
/>
|
|
|
)
|
|
|
}
|
|
|
- <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_ru.withdraw_via")}</div>
|
|
|
- <div className={styles.pix_con}>
|
|
|
- <RadioBtn className={styles.radio_type} selected={(value + "") === "1"}
|
|
|
- value={"1"} onChange={(value) => {
|
|
|
- setShowPixType(value)
|
|
|
- onChange(value);
|
|
|
- }}>
|
|
|
- <span>{i18n.t("withdraw.account_ru.pix_type_1")}</span>
|
|
|
- </RadioBtn>
|
|
|
- <RadioBtn className={styles.radio_type} selected={(value + "") === "2"}
|
|
|
- value={"2"} onChange={(value) => {
|
|
|
- setShowPixType(value)
|
|
|
- onChange(value);
|
|
|
- }}>
|
|
|
- <span>{i18n.t("withdraw.account_ru.pix_type_2")}</span>
|
|
|
- </RadioBtn>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- />
|
|
|
+
|
|
|
<button className={`button-green ${styles.btn_save}`}>
|
|
|
{checkLockStatus() ? (
|
|
|
<SmallLoading fill={"#FFF"}></SmallLoading>) : i18n.t("withdraw.account.btn_save")}
|