import React, { Component } from "react";
import { Modal, Form, Input, Button, Alert, Select, notification, Radio, Col } from 'antd';
import PFromUpload from '../../../../components/Pro/PFromUpload';
import {
getConfigBankList, systemPlatNewsSendVerificationCode, systemPlatNewsVerificationCode, saveBankCardChangeEvent,
BhAccountSendVerifyCode,
taskComBhAccountUpdateComBhAccount
} from '../../../../services/api'
// import modal from "../../../../utils/modal";
import $modal from '../../../../utils/modal';
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: [], //银行列表
}
}
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 { bankCardNo, comName, bankNo, bankOutlets, isBhBank, activeCode, } = values;
const { mobilePhone } = this.props.bankInfo;
taskComBhAccountUpdateComBhAccount({
bankCardNo, comName, bankNo, bankOutlets, isBhBank, activeCode, mobilePhone
}).then(res => {
if (res.retType == '0') {
this.props.update();
this.props.onCancel();
const _this = this
$modal('修改成功!', '', [{
text: '确定',
type: 'primary',
onPress: () => {
_this.props.form.resetFields();
}
}], 'success');
}
})
});
}
render() {
const { getFieldDecorator, getFieldValue } = this.props.form;
const { mobilePhone, bhVirlAcctNo, bankOutlets, bankNo, isBhBank, comName,bankCardNo } = this.props.bankInfo
return (
{
this.props.form.resetFields();
this.props.onCancel()
}}
className="wallet_modal"
>
{getFieldDecorator('oldBankCardNo', {
initialValue: bankCardNo,
rules: [
{
required: true,
message: '未获取到原账号'
}
]
})()}
{getFieldDecorator('comName', {
initialValue: comName,
rules: [
{
required: true,
message: '请输入新基本户户名'
},
]
})()}
{getFieldDecorator('isBhBank', {
initialValue: isBhBank,
rules: [
{
required: true,
message: '请选择是否渤海银行'
}
]
})(
是
否
)}
{/* 不是渤海银行卡,则需要填写开户银行名称、开户银行行号;但是还是要传 */}
{getFieldDecorator('bankOutlets', {
// initialValue: bankOutlets,
rules: [{ required: true, message: '请输入开户银行名称!' }]
})(
)}
{getFieldDecorator('bankNo', {
// initialValue: bankNo,
rules: [
{
required: true,
message: '请输入开户银行行号'
},
]
})()}
{getFieldDecorator('bankCardNo', {
// initialValue: this.state.activeCode,
rules: [
{
required: true,
message: '请输入新基本户账号'
},
{
validator: (rule, value, callback) => {
if (value && !/^\d{0,40}$/.test(value)) {
callback('请输入正确卡号!');
} else {
callback();
}
}
}
]
})()}
{mobilePhone}
{getFieldDecorator('activeCode', {
initialValue: 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}
/>)}
);
}
}