import React from 'react'; import { Icon, Modal, message, Spin, Button, Tabs, Input, InputNumber, Select, Form, DatePicker, Cascader, Upload } from 'antd'; import './userList.less'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import { eduLevelList, auditStatusList, certifyStepList } from '../../dataDic.js' import { beforeUploadFile, getAuditState, newDownloadFile } from '../../tools.js'; import { areaSelect, getProvince } from '../../NewDicProvinceList'; import { getTechField, techFieldList } from '../../DicTechFieldList'; const OrgShow = Form.create()(React.createClass({ getInitialState() { return { loading: false, tabKey: "1", eduLvlOption: [], eduLvlObj: {}, field: [] }; }, loadData(uid) { this.state.data = []; this.props.spinState(true); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/userCertify/orgDetail", data: { uid: uid }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; this.setState({ id: thisData.id, licenceProvince: thisData.licenceProvince, licenceCity: thisData.licenceCity, licenceArea: thisData.licenceArea, locationProvince: thisData.locationProvince, locationCity: thisData.locationCity, locationArea: thisData.locationArea, contacts: thisData.contacts, contactMobile: thisData.contactMobile, fixedTel: thisData.fixedTel, qq: thisData.qq, postalAddress: thisData.postalAddress, postcode: thisData.postcode, aftUsername: thisData.aftUsername, unitName: thisData.unitName, identityType: thisData.identityType, //组织性质 registeredCapital: thisData.registeredCapital, //注册资金 firstContacts: thisData.firstContacts, firstMobile: thisData.firstMobile, secondContacts: thisData.secondContacts, secondMobile: thisData.secondMobile, thirdContacts: thisData.thirdContacts, thirdMobile: thisData.thirdMobile, field: thisData.field ? thisData.field.split(',') : [], legalPerson: thisData.legalPerson, legalPersonIdCard: thisData.legalPersonIdCard, licenceNumber: thisData.licenceNumber, licenceScanningUrl: thisData.licenceScanningUrl, orgCode: thisData.orgCode, orgCodeUrl: thisData.orgCodeUrl, bankAccount: thisData.bankAccount, banks: thisData.banks, bankBranch: thisData.bankBranch, bankCardNumber: thisData.bankCardNumber, validationAmount: thisData.validationAmount, //打款金额 paymentDate: thisData.paymentDate, paymentDateFormattedDate: thisData.paymentDateFormattedDate, lastYearTaxReportUrl: thisData.lastYearTaxReportUrl, auditStatus: thisData.auditStatus, level: thisData.lvl, aid: thisData.aid, //业务员ID mid: thisData.mid //客户经理ID }); this.props.form.resetFields(); }.bind(this), }).always(function () { this.props.spinState(false); }.bind(this)); }, getAccountManagerList() { this.props.spinState(true); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/userCertify/accountManager", success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; for (var item in data.data) { theArr.push( {data.data[item]} ) }; this.setState({ accountManagerOption: theArr, accountManagerList: data.data }); }.bind(this), }).always(function () { this.props.spinState(false); }.bind(this)); }, getTechnicianList() { this.props.spinState(true); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/userCertify/technician", success: function (data) { let theArr = []; if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; return; }; for (var item in data.data) { theArr.push( {data.data[item]} ) }; this.setState({ technicianOption: theArr, technicianList: data.data }); }.bind(this), }).always(function () { this.props.spinState(false); }.bind(this)); }, handleSubmit(e) { e.preventDefault(); this.props.form.validateFields((err, values) => { if (!err) { this.props.spinState(true); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/userCertify/updateOrgDetail", data: { uid: this.props.uid, id: this.state.id, auditStatus: values.auditStatus, //level: this.state.level, aid: values.aid, //指派业务员ID mid: values.mid, //指派客户经理ID } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.props.spinState(false); this.props.handleOk(); }.bind(this)); } }); }, handleCancel() { this.props.closeDesc(false); }, componentWillMount() { let _me = this; eduLevelList.map(function (item, i) { _me.state.eduLvlObj[item.value] = item.key }); this.loadData(this.props.uid); this.getAccountManagerList(); this.getTechnicianList(); }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { this.loadData(nextProps.uid); this.state.tabKey = "1"; }; }, render() { const { getFieldDecorator } = this.props.form; const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 12 }, }; return (
{ this.setState({ tabKey: e }); }}> {getFieldDecorator('unitName')( {this.state.unitName} )} {getFieldDecorator('aftUsername', { initialValue: this.state.aftUsername })( {this.state.aftUsername} )} {getFieldDecorator('field')( {getTechField(this.state.field[0], this.state.field[1], this.state.field[2])} )} {getFieldDecorator('identityType')( {this.state.eduLvlObj[this.state.identityType]} )} {getFieldDecorator('firstContacts')( {this.state.firstContacts} )} {getFieldDecorator('firstMobile')( {this.state.firstMobile} )} {getFieldDecorator('secondContacts')( {this.state.secondContacts} )} {getFieldDecorator('secondMobile')( {this.state.secondMobile} )} {getFieldDecorator('thirdContacts')( {this.state.thirdContacts} )} {getFieldDecorator('thirdMobile')( {this.state.thirdMobile} )} {getFieldDecorator('legalPerson')( {this.state.legalPerson} )} {getFieldDecorator('legalPersonIdCard')( {this.state.legalPersonIdCard} )} {getFieldDecorator('registeredCapital')( {this.state.registeredCapital || 0} 万元 )} {getFieldDecorator('licenceNumber')( {this.state.licenceNumber} )} {getFieldDecorator('licenceAddress', { initialValue: this.state.licenceAddress })( {getProvince(this.state.licenceProvince, this.state.licenceCity, this.state.licenceArea)} )}
{this.state.licenceScanningUrl ?
未上传

}
{getFieldDecorator('orgCode')( {this.state.orgCode} )}
{this.state.orgCodeUrl ?
未上传

}
{this.state.lastYearTaxReportUrl ? :

未上传

}
{getFieldDecorator('banks')( {this.state.banks} )} {getFieldDecorator('bankBranch')( {this.state.bankBranch} )} {getFieldDecorator('bankCardNumber')( {this.state.bankCardNumber} )} {getFieldDecorator('locationAddress', { initialValue: this.state.locationAddress })( {getProvince(this.state.locationProvince, this.state.locationCity, this.state.locationArea)} )} {getFieldDecorator('level')( {"Lv." + (this.state.level || 0)} )} {getFieldDecorator('auditStatus', { initialValue: this.state.auditStatus })( )} {getFieldDecorator('aid', { initialValue: this.state.aid })( )} {getFieldDecorator('mid', { initialValue: this.state.mid })( )} ); } })); const OrgCertify = Form.create()(React.createClass({ getInitialState() { return { loading: false, tabKey: "1", saveSign: "save", eduLvlOption: [], auditStatusOption: [] }; }, loadData(uid) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/orgDetail", data: { uid: uid }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; this.setState({ id: thisData.id, licenceAddress: [thisData.licenceProvince, thisData.licenceCity, thisData.licenceArea], locationAddress: [thisData.locationProvince, thisData.locationCity, thisData.locationArea], contacts: thisData.contacts, contactMobile: thisData.contactMobile, fixedTel: thisData.fixedTel, qq: thisData.qq, postalAddress: thisData.postalAddress, postcode: thisData.postcode, aftUsername: thisData.aftUsername, unitName: thisData.unitName, identityType: thisData.identityType, //组织性质 field: thisData.field ? thisData.field.split(',') : [], registeredCapital: thisData.registeredCapital, //注册资金 firstContacts: thisData.firstContacts, firstMobile: thisData.firstMobile, secondContacts: thisData.secondContacts, secondMobile: thisData.secondMobile, thirdContacts: thisData.thirdContacts, thirdMobile: thisData.thirdMobile, legalPerson: thisData.legalPerson, legalPersonIdCard: thisData.legalPersonIdCard, licenceNumber: thisData.licenceNumber, licenceScanningUrl: thisData.licenceScanningUrl, orgCode: thisData.orgCode, orgCodeUrl: thisData.orgCodeUrl, bankAccount: thisData.bankAccount, banks: thisData.banks, bankBranch: thisData.bankBranch, bankCardNumber: thisData.bankCardNumber, validationAmount: thisData.validationAmount, //打款金额 paymentDate: thisData.paymentDate, paymentDateFormattedDate: thisData.paymentDateFormattedDate, lastYearTaxReportUrl: thisData.lastYearTaxReportUrl, auditStatus: thisData.auditStatus, level: thisData.level, aid: thisData.aid, //业务员ID mid: thisData.mid //客户经理ID }); this.props.form.resetFields(); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, handleSubmit(e) { if (e) { e.preventDefault(); }; this.props.form.validateFields((err, values) => { if (!err) { this.props.spinState(true); // //金额判断 // if (values.amountMoney && values.amountMoney < 0 && values.amountMoney > 100 && /^\d+(\.\d{2})?$/.test(values.amountMoney)) { // message.warning('请输入0-100以内的金额'); // return; // }; if ((this.state.auditStatus == "5" && values.level == "0") || (this.state.auditStatus != "5" && values.level != "0")) { message.warning('认证状态和用户等级不匹配!'); return; }; $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/updateOrgDetail", data: { uid: this.props.uid, id: this.state.id, contacts: values.contacts, contactMobile: values.contactMobile, postalAddress: values.postalAddress, postcode: values.postcode, aftUsername: values.aftUsername, unitName: values.unitName, identityType: values.identityType, //组织性质 registeredCapital: values.registeredCapital, //注册资金 legalPerson: values.legalPerson, legalPersonIdCard: values.legalPersonIdCard, licenceNumber: values.licenceNumber, orgCode: values.orgCode, field: values.field ? values.field.join(',') : undefined, firstContacts: values.firstContacts, firstMobile: values.firstMobile, secondContacts: values.secondContacts, secondMobile: values.secondMobile, thirdContacts: values.thirdContacts, thirdMobile: values.thirdMobile, bankAccount: values.bankAccount, banks: values.banks, bankBranch: values.bankBranch, bankCardNumber: values.bankCardNumber, validationAmount: values.validationAmount, //打款金额 paymentDateFormattedDate: values.paymentDateFormattedDate ? values.paymentDateFormattedDate.format("YYYY-MM-DD") : undefined, licenceScanningUrl: this.state.licenceScanningUrl, orgCodeUrl: this.state.orgCodeUrl, lastYearTaxReportUrl: this.state.lastYearTaxReportUrl, //process: this.state.process, licenceArea: values.licenceAddress[2], licenceCity: values.licenceAddress[1], licenceProvince: values.licenceAddress[0], locationArea: values.locationAddress[2], locationCity: values.locationAddress[1], locationProvince: values.locationAddress[0], //auditStatus: this.state.auditStatus, level: values.level, aid: values.aid, //指派业务员ID mid: values.mid, //指派客户经理ID saveSign: this.state.saveSign } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); } else { message.warning(data.error[0].message); } }.bind(this)).always(function () { this.setState({ saveSign: "save" }); this.props.spinState(false); this.props.handleOk(); }.bind(this)); } }); }, handleCancel() { this.props.closeDesc(false); }, componentWillMount() { let _me = this; eduLevelList.map(function (item, i) { _me.state.eduLvlOption.push( {item.key} ); }); this.loadData(this.props.uid); }, componentWillReceiveProps(nextProps) { if (!this.props.visible && nextProps.visible) { this.loadData(nextProps.uid); this.state.tabKey = "1"; }; }, render() { const { getFieldDecorator } = this.props.form; const FormItem = Form.Item const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 12 }, }; return (
{ this.setState({ tabKey: e }); }}> {getFieldDecorator('unitName', { initialValue: this.state.unitName })( )} {getFieldDecorator('aftUsername', { initialValue: this.state.aftUsername })( )} {getFieldDecorator('identityType', { initialValue: this.state.identityType })( )} {getFieldDecorator('field', { initialValue: this.state.field })( )} {getFieldDecorator('firstContacts', { initialValue: this.state.firstContacts })( )} {getFieldDecorator('firstMobile', { initialValue: this.state.firstMobile })( )} {getFieldDecorator('secondContacts', { initialValue: this.state.secondContacts })( )} {getFieldDecorator('secondMobile', { initialValue: this.state.secondMobile })( )} {getFieldDecorator('thirdContacts', { initialValue: this.state.thirdContacts })( )} {getFieldDecorator('thirdMobile', { initialValue: this.state.thirdMobile })( )} {getFieldDecorator('legalPerson', { initialValue: this.state.legalPerson })( )} {getFieldDecorator('legalPersonIdCard', { initialValue: this.state.legalPersonIdCard })( )} {getFieldDecorator('registeredCapital', { initialValue: this.state.registeredCapital })( )} 万元 {getFieldDecorator('licenceNumber', { initialValue: this.state.licenceNumber })( )} {getFieldDecorator('licenceAddress', { initialValue: this.state.licenceAddress })( )}
{this.state.licenceScanningUrl ?
未上传

} { if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.licenceScanningUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); } }} >
{getFieldDecorator('orgCode', { initialValue: this.state.orgCode })( )}
{this.state.orgCodeUrl ?
未上传

} { if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.orgCodeUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); } }} >
{this.state.lastYearTaxReportUrl ? :

未上传

} { if (info.file.status !== 'uploading') { console.log(info.file, info.fileList); } if (info.file.status === 'done') { if (!info.file.response.error.length) { message.success(`${info.file.name} 文件上传成功!`); } else { message.warning(info.file.response.error[0].message); return; }; this.state.lastYearTaxReportUrl = info.file.response.data; } else if (info.file.status === 'error') { message.error(`${info.file.name} 文件上传失败。`); } }} >
{getFieldDecorator('banks', { initialValue: this.state.banks })( )} {getFieldDecorator('bankBranch', { initialValue: this.state.bankBranch })( )} {getFieldDecorator('bankCardNumber', { initialValue: this.state.bankCardNumber })( )} {getFieldDecorator('locationAddress', { initialValue: this.state.locationAddress })( )} {getFieldDecorator('level', { initialValue: this.state.level })( )} {getFieldDecorator('auditStatus')( {getAuditState(this.state.auditStatus)} )} {getFieldDecorator('aid')( {this.props.data.adminName} )} {getFieldDecorator('mid')( {this.props.data.managerName} )} ); } })); const OrgDesc = React.createClass({ getInitialState() { return { visible: false, loading: false }; }, showModal() { this.setState({ visible: true, }); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, handleOk(e) { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, componentWillReceiveProps(nextProps) { this.state.visible = nextProps.showDesc; }, spinChange(e) { this.setState({ loading: e }); }, render() { if (this.props.data) { return (
{window.showAuditStatus ? : }
); } else { return
} }, }); export default OrgDesc; // // {getFieldDecorator('validationAmount', { // initialValue: this.state.validationAmount // })( // // )} // // // {getFieldDecorator('paymentDateFormattedDate', { // initialValue: this.state.paymentDate ? moment(this.state.paymentDate) : null // })( // // )} //