import React, { Component } from "react";
import { connect } from 'dva';
import { Alert } from 'antd';
import {
sendVerifyCode,
getComWalletAccountAmount,
comWalletAccountExtract,
getWalletRechargeToken
} from '../../../../services/api';
// import $modal from '../../modal';
import $modal from '../../../../utils/modal';
import $nModal from '../../../../utils/modal/nModal';
import { SMS_OP_WITHDRAW } from '../../../../constants/shortMessage';
// import { getHostByPath } from '../../../../utils/request.js';
import { Tooltip, Icon, Button, Modal, notification, Radio, Form, Input,InputNumber } from 'antd';
import WalletModal from './WalletModal';
import yl from '../../../../assets/images/wallet/yl.png';
import cq from '../../../../assets/images/wallet/cq.png';
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 12 },
md: { span: 12 }
}
};
@Form.create()
@connect(state => ({
global: state.global
}))
export default class StepFive extends Component {
constructor(props, context) {
super(props, context);
this.state = {
companyInfo: JSON.parse(window.sessionStorage.getItem('companyInfo'))||this.props.global.companyInfo, // 公司信息
rechargeVisbale: false,
rechargeValue: '', // 充值金额的值
rechargeShowTip: false, //显示提示
codeValue: '', //提现短信验证码
rechargeRadio: '0', // 充值选项框 0->企业网银充值 1->线下转账充值,
rechargeBtnDisable: false, // 充值按钮的disable控制
rechargeBtnToken: '', // 充值时通过接口获取的token
moneyReg: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/, //金额正则
cashOutVisbale: false, // 提现对话框
moneyInfo: {}, // 资金信息
accountInfo: {}, //账户信息
payUrl: '', //充值表单提交url
time: 0, // 可发送验证码剩余时间
btnName: '获取验证码', // 发送验证码按钮名字
timer: null, // 验证码定时器
orderId: '',//提现的时候短信验证码发送后返回的orderid 在提现接口中要用到
editModalVisble: false // 修改对公账户模态框
};
}
componentDidMount() {
this.setState({
companyInfo: JSON.parse(window.sessionStorage.getItem('companyInfo'))||this.props.global.companyInfo,
});
}
componentDidUpdate() {
this.__initPage();
}
static getDerivedStateFromProps(nextProps, prevState) {
let props = {
accountInfo: nextProps.accountInfo
};
return props;
}
_cashOutSubmit = e => {
// e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
const { bankCardNo, walletAccountNo, mobilePhone } = this.state.accountInfo;
const POST_DATA = {
...values,
comName: this.state.companyInfo.comName,
bankCardNo,
walletAccountNo,
mobilePhone,
orderId: this.state.orderId
};
comWalletAccountExtract(POST_DATA).then(res => {
// const MSG = res.msg;
$modal('钱包提现申请提交成功!', '到账时间以收款银行为准。', [{
text: '确定',
type: 'primary',
onPress: () => {
console.log('成功');
// this.props.updateBackInfo();
}
}], 'success');
});
}
});
}
__initPage() {
// getComWalletAccount().then(res => {
// this.setState({
// accountInfo: res.data
// });
const { walletAccountNo } = this.state.accountInfo;
if (!this.state.hasLoad) {
if (walletAccountNo) {
this.setState({
hasLoad: true
});
getComWalletAccountAmount({ walletAccountNo }).then(res => {
this.setState({
moneyInfo: res.data
});
});
}
}
// });
}
render() {
return (
{/*
您好{this.state.companyInfo&&this.state.companyInfo.comName && `,${this.state.companyInfo.comName}!`}
中国银联
与富民银行
联合为您提供资金监管及安全保障服务!
《富民银行委托结算服务协议》
*/}
-
企业ID:
{this.state.accountInfo.comId ?
{this.state.accountInfo.comId} :
}
-
钱包账户号:
{this.state.accountInfo.walletAccountNo ?
{this.state.accountInfo.walletAccountNo} :
}
-
账户状态:
{this.state.accountInfo.accountStatus}
-
{this.state.accountInfo.mobilePhone}
{/*
}
type="warning"
showIcon
style={{ marginBottom: '15px' }}
/>
点击下载: 重庆富民银行企富通用户信息变更申请表.doc
>
)
})
}}>修改
*/}
{/*
建设银行 8888 8888 8888 8888 888
*/}
{this.state.accountInfo.bankName} {this.state.accountInfo.bankCardNo}
{/*
*/}
开户时间:
{this.state.accountInfo.createTime}
{/* 修改对公账户对话框 */}
{ this.__initPage() }}
onCancel={() => {
this.setState({
editModalVisble: false
});
}}
/>
{/* 充值对话框*/}
{
this.setState({
rechargeVisbale: false
});
}}
visible={this.state.rechargeVisbale}
>
{/*
{
this.setState({
rechargeRadio: e.target.value
});
}}
>
企业网银充值
转账充值
*/}
{/*
转账充值
*/}
{/* 企业网银充值 */}
{this.state.rechargeRadio == '0' &&
注:钱包充值服务,由工商银行提供技术支持与资金数据处理服务,确保您的资金安全到账!
{(() => {
const { getFieldDecorator } = this.props.form;
return (
`¥${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
parser={value => value.replace(/¥\s?|(,*)/g, '')}
min={0}
onChange={val => {
const value = val;
this.setState({
rechargeValue: value,
rechargeShowTip: !this.state.moneyReg.test(value) || value == 0
});
}}
maxLength={50}
/>
请输入正确金额,如:1000.00
);
})()}
}
{/* 线下转账充值 */}
{
this.state.rechargeRadio == '1' &&
转账充值说明:
请使用绑定的企业对公账户向富民银行安保人资服务专用户转账,系统确认到账后会自动为您的账户充值;
使用其他银行账户转账将无法识别充值!
企业对公账户:
{this.state.accountInfo.bankCardNo} {this.state.accountInfo.bankName}
转账至:
收款银行: 重庆富民银行
收款户名: 富民银行安保人资服务专用户
收款账户: 6800 0010 1931 0967 121
注:部分银行系统,收款银行选择不到"重庆富民银行"的,请选择"民营银行",并填写"重庆富民银行"。
}
{/* 提现对话框*/}
{
this.setState({
cashOutVisbale: false,
time: 0,
btnName: '获取验证码',
timer: null
});
clearInterval(this.state.timer);
}}
visible={this.state.cashOutVisbale}
destroyOnClose
>
注:钱包提现服务,由工商银行提供技术支持与资金数据处理服务,确保您的资金安全到账!
{(() => {
const { getFieldDecorator } = this.props.form;
return (
{getFieldDecorator('amount', {
value: this.state.cashOutValue,
rules: [
{
required: true,
message: '请输入提现金额'
},
{
validator: (rule, value, callback) => {
if (value && !this.state.moneyReg.test(value) || parseFloat(value) == 0) {
callback('请输入正确金额,如:1000.00');
} else {
callback();
}
}
}
]
})( `¥${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
parser={value => value.replace(/¥\s?|(,*)/g, '')}
min={0}
maxLength={50}
/>)}
{this.state.accountInfo.bankCardNo}
{this.state.accountInfo.mobilePhone}
{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}
/>)}
);
})()}
{/*
);
}
}