import React, { Component } from "react";
import { Modal, Form, Input, Button, Alert, Select, notification, Row, Col } from 'antd';
import PFromUpload from '../../../../components/Pro/PFromUpload';
import { getConfigBankList, systemPlatNewsSendVerificationCode, systemPlatNewsVerificationCode, saveBankCardChangeEvent } from '../../../../services/api'
const { Option } = Select;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
md: { span: 12 }
}
};
@Form.create()
export default class WalletModal extends Component {
constructor(props) {
super(props);
this.state = {
time: 0, // 可发送验证码剩余时间
btnName: '获取验证码', // 发送验证码按钮名字
timer: null, // 验证码定时器
bankList: [], //银行列表
key:0
}
}
componentDidMount() {
this.__getConfigBankList();
}
__getConfigBankList() {
getConfigBankList().then(res => {
const keyArr = []; //过滤bankCode相同的选项后的值(只取第一个)
res.data.forEach(bank => {
const nowArr = JSON.parse(JSON.stringify(keyArr));
if (!nowArr.find(item => item.bankCode == bank.bankCode)) { //数组里面没有
keyArr.push(bank);
}
});
this.setState({
bankList: keyArr
});
});
}
_formSubmit = e => {
e.preventDefault();
this.props.form.validateFields((err, values) => {
// if(err) return;
const { activeCode, bank, bankCardNo, bankCardUrl, changeProveUrl } = values;
const { mobile } = this.props;
const bankCode = bank[0].split('-')[0];
const bankName = bank[0].split('-')[1];
// 检查验证码是否正确
systemPlatNewsVerificationCode({ mobile, code: activeCode }).then(res => {
// 保存钱包银行卡信息变更
saveBankCardChangeEvent({
changeProveUrl,
bankCardUrl,
bankCode,
bankName,
bankCardNo
}).then(result => {
this.props.form.resetFields();
this.props.onCancel();
this.props.update();
this.setState({
key: Math.random(),
})
});
});
});
}
render() {
const { getFieldDecorator } = this.props.form;
return (
{
this.props.form.resetFields();
this.setState({
key: Math.random(),
})
this.props.onCancel();
}}
className="wallet_modal"
>
1、企业对公账户提交修改后,需等平台客服进行审核,预计1~3个工作日完成;
2、审核通过,页面数据直接变更。审核期间,绑定卡仍以旧卡信息为准;
3、审核期间,若非紧急情况,请勿转账充值,以免到款入账时,绑定卡信息已变更,造成无法入账。
}
type="warning"
showIcon
/>
{getFieldDecorator('bank', {
rules: [{ required: true, message: '请选择新绑定卡银行!' }]
})(
,
)}
{/*
结算卡:企业钱包余额充值、提现等结算专用账户。
*/}
{getFieldDecorator('bankCardNo', {
value: this.state.activeCode,
rules: [
{
required: true,
message: '请输入新绑定卡卡号'
},
{
validator: (rule, value, callback) => {
if (value && !/^\d{0,40}$/.test(value)) {
callback('请输入正确卡号!');
} else {
callback();
}
}
}
]
})()}
{this.props.mobile}
{getFieldDecorator('activeCode', {
value: this.state.activeCode,
rules: [
{
required: true,
message: '请输入验证码'
},
{
validator: (rule, value, callback) => {
if (value && !/\d{0,6}/.test(value)) {
callback('请输入正确验证码');
} else {
callback();
}
}
}
]
})( {
this.setState({
codeValue: e.target.value
});
}}
maxLength={50}
/>)}
);
}
}