import React from 'react'; import { Radio, Select, Input, Form } from 'antd'; // import { $Axios } from '../../common/publish'; import select_data from '../../common/ssq'; import '../center-s/centerS.scss' export default class centerS extends React.Component { constructor(props) { super(props) this.state = { selectData: select_data, Params: this.props.arr, cityOs: true, citylist: [], registerRole: '', //1为自然人2为企业 registerRoleTxt: '', //是否为个体工商户 regisClick: '', offlist: select_data.offlist, validation_list: [], form_width: 200, contactName : JSON.parse(localStorage.getItem('oData')).contactName } } componentDidMount() { this.props.onRef(this) let selectData = this.state.selectData; let registerRole = selectData.contract.find((item, index) => { return item.value == JSON.parse(localStorage.getItem('oData')).registerRole; }); this.setState({ registerRole: registerRole.type, registerRoleTxt: registerRole.txt, regisClick: registerRole.type == 1 ? 'PRIVATE' : 'PUBLIC' }) this.initData(); } toParent = (data) => { this.props.parent.getParams_s(this, data) } initData() { if (this.props.arr) { //初始化判断数据回填 if (this.state.Params.provinceCode !== undefined && this.state.Params.provinceCode !== '') { // 判断回填数据内是否有省编码 let Province = this.state.Params.provinceCode; //获取省编码 let data = this.state.selectData.Area; //拿到省数据组 let cityList = data.find((item, index) => { return Province == item.provinceCode }); //抽取省编码内下的城市列表数据 this.setState({ //重新设置数据 cityOs: false, citylist: cityList.mallCityList, }) } else { } } } InputSdata(e) { let Params = { bankCode: this.state.Params.bankCode,//开户行 bankBranchName: document.getElementById("bankBranchName").value,//支行名称 accountName: document.getElementById("accountName").value,//开户名称 bankCardNo: document.getElementById("bankCardNo").value,//开户账号 cityCode: this.state.Params.cityCode == undefined ? '' : this.state.Params.cityCode,//市编码 provinceCode: this.state.Params.provinceCode == undefined ? '' : this.state.Params.provinceCode,//省编码 accountType: this.state.Params.accountType == undefined ? 'PUBLIC' : this.state.Params.accountType, //结算银行卡属性 PUBLIC 对公 PRIVATE 对私 liquidationType: 'WITHDRAW',//清算方式 WITHDRAW 提现 SETTLE 结算 // withdrawRateType: this.state.Params.withdrawRateType == undefined ? 'SINGLE' : this.state.Params.withdrawRateType,//提现费率类型 withdrawRateType: '',//提现费率类型 // withdrawRate: document.getElementById("withdrawRate").value,//提现费率 withdrawRate: '',//提现费率 } localStorage.setItem('sData', JSON.stringify(Params)) return Params } childMethod() { //暴露给父组件的方法,集合当前页面拿到的参数存入缓存 let data = this.InputSdata(); this.toParent(data) } handleChange(value) { // console.log(`Selected: ${value}`); } selectChange_1(value) { //开户行选择 this.state.Params.bankCode = value; } selectChange_2(value) { //省编码选择 this.state.Params.provinceCode = value; let citylist = this.state.selectData.Area.find((item, index) => { return value == item.provinceCode }); this.setState({ cityOs: false, citylist: citylist.mallCityList, }); } selectChange_3(value) { //市编码选择 this.state.Params.cityCode = value; } onChangeRadio(e) { let accountType = e.target.value; this.state.Params.accountType = accountType; this.setState({ regisClick: accountType }) } onChangeRadio_s(e) { let withdrawRateType = e; this.state.Params.withdrawRateType = withdrawRateType; } listTypes(e) { let data = this.state.offlist; let type = data.find((item, index) => { return item.value == e }); if (type !== undefined) { type = true } else { type = false } return type } verification(e) { //暴露给父组件的方法,验证当前页面必填项 this.setState({ validation_list: e, }) } render() { const { selectData, cityOs, citylist, Params, contactName, registerRole, regisClick, validation_list, form_width } = this.state; const { Option } = Select; const { TextArea } = Input; const layout = { labelCol: { span: 4 }, }; const onFinish = (values) => { // console.log('xxx: ', values); }; return (