import React from 'react'; import { Radio, Icon, Button, Cascader, Input, Select, Spin, Popconfirm, Table, Switch, message, DatePicker, Modal, Upload, Form, Row, Col,Tabs } from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import './myClient.less'; import QueryCustomer from './myRejectOne.jsx'; import { citySelect, provinceList, areaSelect } from '../../../areaList'; import {getProvinceList} from '../../../addressList'; const { Column, ColumnGroup } = Table; const TabPane = Tabs.TabPane; const monthFormat = 'YYYY/MM'; import CustomerDetail from './myClientDesc.jsx'; import { socialAttribute, industry, auditStatusL, newFollow, lvl, currentMember, statuslist, customerStatus, intentionalService } from '../../../dataDic.js'; import { getSocialAttribute, splitUrl, getAuditStatus, getCompanyIntention, getStatuslist, getContactType, getIndustryType, getfllowSituation, beforeUploadFile, getWhether, getcustomerStatue, getfllowSituationOn, getCertification, getcustomerTyp, getLvl, getCurrentMember, getprovince, ShowModal } from "../../../tools.js"; import ShowModalDiv from "@/showModal.jsx"; import {ChooseList} from "../../order/orderNew/chooseList"; const PublicCustomer = Form.create()(React.createClass({ loadData(pageNo) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/findEnteringAuditIsNo', data: { pageNo: pageNo || 1, pageSize: this.state.pagination.pageSize, name: this.state.nameSearch,//客户名称 adminName:this.state.adminName,//营销员名称 }, success: function(data) { ShowModal(this); let theArr = []; let thisdata; if(data.error.length || data.data.list == "") { if(data.error && data.error.length) { message.warning(data.error[0].message); }; } else { for(let i = 0; i < data.data.list.length; i++) { thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.uid, name: thisdata.name, createTime: thisdata.createTime, adminName: thisdata.adminName, contactMobile: thisdata.contactMobile, auditOpinion:thisdata.auditOpinion, societyTag:thisdata.societyTag, }); }; this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; }; if(data.data&&data.data.list&&!data.data.list.length){ this.state.pagination.current=0; this.state.pagination.total=0; } this.setState({ dataSource: theArr, pagination: this.state.pagination, selectedRowKeys:[] }); }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, //点击出现函数 setModal2VisibleOk(e) { this.setState({ modal2Visible: true }); }, //点击消失函数 setModal2Visiblecancel(e) { this.setState({ modal2Visible: false }); }, getPictureUrl(e) { this.setState({ pictureUrl: e }); }, handleOk(e) { this.setState({ visible: false, }); }, handleCancel(e) { this.setState({ visible: false, }); }, getInitialState() { return { addressSearch: [], orgCodeUrl: [], companyLogoUrl: [], visible: false, searchMore: true, releaseDate: [], releaseDate: [], selectedRowKeys: [], selectedRowKey: [], selectedRows: [], loading: false, pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function(page) { this.loadData(page); }.bind(this), showTotal: function(total) { return '共' + total + '条数据'; } }, columns: [{ title: '客户名称', dataIndex: 'name', key: 'name', }, { title: '联系电话', dataIndex: 'contactMobile', key: 'contactMobile', }, { title: '营销员', dataIndex: 'adminName', key: 'adminName', }, { title: '创建时间', dataIndex: 'createTime', key: 'createTime', }, { title: '拒绝原因', dataIndex: 'auditOpinion', key: 'auditOpinion', } ], dataSource: [], }; }, //审核通过 examineCancel(record){ let api=0; this.examine(api,record); }, //审核不通过 examineOK(record){ let api=1; this.examine(api,record); }, examine(api,record) { this.setState({ selectedRowKeys: [], }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/updateEnteringAudit', data: { id:record.id, auditStatus:api, auditOpinion:this.state.auditOpinion, } }).done(function (data) { if (!data.error.length) { message.success('操作成功'); this.setState({ loading: false, }); } else { message.warning(data.error[0].message); }; this.loadData(); }.bind(this)); }, componentWillMount() { this.loadData(); }, //审核实名认证不通过功能 auditRows(e) { e.preventDefault(); $.ajax({ url: globalConfig.context + '/api/admin/customer/updateEnteringAudit', method: 'post', data: { id:this.state.id, auditOpinion:this.state.auditOpinion, auditStatus:2, } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('操作成功!'); this.detailsModal() this.loadData(); } else { message.warning(data.error[0].message); } }.bind(this)); }, //修改信息提交 submit(e) { e.preventDefault(); this.props.form.validateFields((err, values) => { if(!this.state.societyTag){ message.warning('社会属性不能为空') return false; }; if(this.state.mobile.length>13){ message.warning('电话号码字数不超过13个') return false; }; if (!err) { this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/updateRefusedCustomer', data: { nickname:this.state.nickname, societyTag:this.state.societyTag, mobile: this.state.mobile, id: this.state.id, } }).done(function (data) { this.setState({ loading: false }); if (!data.error.length) { message.success('提交成功!'); this.detailsModal(); this.loadData(); } else { message.warning(data.error[0].message); } }.bind(this)); } }); }, //审核实名认证通过功能 auditRowse(e) { e.preventDefault(); $.ajax({ url: globalConfig.context + '/api/admin/customer/updateEnteringAudit', method: 'post', data: { id:this.state.id, auditOpinion:this.state.auditOpinion, auditStatus:1, } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('操作成功!'); this.detailsModal() this.loadData(); } else { message.warning(data.error[0].message); } }.bind(this)); }, search() { this.loadData(); }, reset() { this.state.nameSearch = ''; this.state.adminName='' this.loadData(); }, searchSwitch() { this.setState({ searchMore: !this.state.searchMore }); }, //整行点击 tableRowClick(record, index) { this.state.RowData = record; this.detailsModalOk(record); this.setState({ nickname:record.name, mobile:record.contactMobile, societyTag:record.societyTag, id:record.id, }) }, detailsModalOk(e) { this.setState({ modal5Visible: true }); //需要一个请求数据 }, detailsModal(e){ this.setState({ modal5Visible: false }); }, componentWillReceiveProps(nextProps) { if(!this.props.visible && nextProps.visible) { if(nextProps.data && nextProps.data.id) { this.loadData(nextProps.data.id, nextProps.detailApiUrl); }; this.state.data = {}; this.state.companyLogoUrl = []; this.state.orgCodeUrl = []; this.loadData(null); }; }, changeList(arr) { const newArr = []; this.state.columns.forEach(item => { arr.forEach(val => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr }); }, render() { const FormItem = Form.Item const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows.slice(-1), selectedRowKeys: selectedRowKeys.slice(-1) }); }, onSelect: (recordt, selected, selectedRows) => { this.setState({ recordt: recordt.id }) }, }; const rowSelections = { selectedRowKeys: this.state.selectedRowKey, onChange: (selectedRowKey, selectedRow) => { this.setState({ selectedRow: selectedRow.slice(-1), selectedRowKey: selectedRowKey.slice(-1) }); }, onSelect: (records, selected, selectedRow) => { this.setState({ selectedRow: selectedRow.slice(-1), records: records.id, }) }, }; const hasSelected = this.state.selectedRowKeys.length > 0; const { RangePicker } = DatePicker; const { getFieldDecorator } = this.props.form; const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 }, }; //const theDatak = this.state.datak || {}; const theInformation = this.state.dataInformation || {} const contactsOption = ""; const formItemLayput = { labelCol: { span: 10 }, wrapperCol: { span: 14 }, }; const contacts = this.state.contacts || ''; return (