import React from 'react'; import { AutoComplete, Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker,Switch,Upload} from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import moment from 'moment'; import './myClient.less'; import { orderStatusList,cityArr,customerStatus,intentionalService,newFollow} from '../../dataDic.js'; import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js'; //查询功能和初始列表 const PublicCustomer = React.createClass({ loadData(pageNumber, detailApiUrl) { this.state.data = []; this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url:globalConfig.context +'/api/admin/customer/listCompanyCustomer', data: { pageNumber: pageNumber || 1, pageSize: this.state.pagination.pageSize, companyName: this.state.companyName, //名称1 customerType: this.state.customerType, //客户类型1 locationProvince:this.state.locationProvince,//地区 customerStatus:this.state.customerStatus,//客户状态1 contactName:this.state.contactName,//联系人姓名1 contactTel:this.state.contactTel,//联系人手机 companyIntention:this.state.companyIntention,//意向服务 followSituation:this.state.followSituation,//最新跟进进度 //releaseDateStartDate: this.state.releaseDate[0], //releaseDateEndDate: this.state.releaseDate[1], }, success: function (data) { let theArr = []; if (!data.data || !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++) { let thisdata = data.data.list[i]; theArr.push({ key: i, id: thisdata.id, companyName:thisdata.companyName,//公司名称 customerType:thisdata.customerType, _customerType:thisdata._customerType,//客户类型 locationProvince:thisdata.locationProvince,//地区 contactName:thisdata.contactName, //联系人姓名 telNum:thisdata.telNum,//手机号 _customerStatus:thisdata._customerStatus,//客户状态 _companyIntention:thisdata._companyIntention,//意向服务 _followSituation:thisdata._followSituation,//最新跟进 customerStatus:thisdata.customerStatus,//客户状态 companyIntention:thisdata.companyIntention,//意向服务 followSituation:thisdata.followSituation,//最新跟进 adminName:thisdata.adminName, //跟进人 followDate:thisdata.followDate, customerStatus:thisdata.customerStatus,//客户状态 companyIntention:thisdata.companyIntention,//意向服务 }); }; this.state.pagination.current = data.data.pageNumber; this.state.pagination.total = data.data.totalCount; }; this.setState({ dataSource: theArr, pagination: this.state.pagination }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, //领取 handleSubmit (e) { let uids; let beforeCustomerStatus; let beforeFollowSituation; let beforeCustomerIntention; for (let idx = 0; idx < this.state.selectedRows.length; idx++) { let rowItem = this.state.selectedRows[idx]; if (rowItem.id) { uids=rowItem.id; beforeCustomerStatus=rowItem.customerStatus; beforeFollowSituation=rowItem.followSituation; beforeCustomerIntention=rowItem.companyIntention; }; }; this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/receivePublicCustomer', data: { id: uids, beforeCustomerIntention:beforeCustomerIntention, beforeCustomerStatus:beforeCustomerStatus, beforeFollowSituation:beforeFollowSituation, } }).done(function (data) { this.setState({ loading: false }); if (!data.error.length) { message.success('领取成功!'); this.setcancel(); } else { message.warning(data.error[0].message); }; }.bind(this)); }, //查看详情 Detailload(deletedIds){ $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/findCustomerDetails', data: { id: deletedIds }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; this.setState({ data: thisData, followSituation:thisData.followSituation, customerStatus:thisData.customerStatus, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { searchMore: true, searchType: 0, validityPeriodDate: [], releaseDate: [], selectedRowKeys: [], 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 + '条数据'; } }, contactInformation:[ { title: '姓名', dataIndex: 'contactName', key: 'contactName' },{ title: '性别', dataIndex: 'sex', key: 'sex', render: text => { return getsex(text); } }, { title: '手机号码', dataIndex: 'telNum', key: 'telNum' },{ title: '座机号', dataIndex: 'mobile', key: 'mobile' },{ title: 'QQ号码', dataIndex: 'qq', key: 'qq' },{ title: '邮箱号', dataIndex: 'email', key: 'email' },{ title: '微信', dataIndex: 'wechat', key: 'wechat' },{ title: '部门', dataIndex: 'depatrment', key: 'depatrment' },{ title: '职位', dataIndex: 'customerPosition', key: 'customerPosition' }, ], columns: [ { title: '公司名称', dataIndex: 'companyName', key: 'companyName', }, { title: '客户类型', dataIndex: '_customerType', key: '_customerType', //render: text => { return getcustomerTyp(text); } }, { title: '地区', dataIndex: 'locationProvince', key: 'locationProvince', render: text => { return getcityArr(text); } }, { title: '联系人姓名', dataIndex: 'contactName', key: 'contactName', }, { title: '手机号', dataIndex: 'telNum', key:'telNum', }, { title: '客户状态', dataIndex: '_customerStatus', key: '_customerStatus', //render: text => { return getcustomerStatue(text) } }, { title: '意向服务', dataIndex: '_companyIntention', key: '_companyIntention', //render: text => { return getCompanyIntention(text) } }, { title: '最新跟进', dataIndex: '_followSituation', key: '_followSituation', //render: text => { return getfllowSituation(text) } }, { title: '跟单人', dataIndex: 'adminName', key: 'adminName', }, { title: '时间', dataIndex: 'followDate', key: 'followDate', } ], dataSource: [], searchTime: [], }; }, componentWillMount() { let theArr = []; customerStatus.map(function (item) { theArr.push( {item.key} ) }); let intentionalArr = []; intentionalService.map(function (item) { intentionalArr.push( {item.key} ) }); let newArr = []; newFollow.map(function (item) { newArr.push( {item.key} ) }); let auditArr = []; cityArr.map(function (item) { auditArr.push( {item.key} ) }); this.state.customerStatuarr = theArr; this.state.intentionalOption = intentionalArr; this.state.newOption = newArr; this.state.auditStatusOption = auditArr; if (window.location.search) { let theObj = getSearchUrl(window.location.search); if (theObj.rid) { theObj.id = theObj.rid; if (theObj.rid != 'null') { this.tableRowClick(theObj); }; }; }; this.loadData(); }, tableRowClick(record) { this.state.RowData = record; this.setok(record.id); this.handleSubmit(record.id) this.setState({ hids:record.id }) }, tableRow(record) { console.log(record) }, closeDesc(e, s) { this.state.showDesc = e; if (s) { this.loadData(); }; }, search() { this.loadData(); }, reset() { this.state.companyName=''; this.state.customerType=undefined; this.state.id = undefined; this.state.shareType = undefined; this.state.companyIntention = undefined; this.state.followSituation = undefined; this.state.locationProvince = undefined; this.state.customerStatus = undefined; this.state.contactName = undefined; this.state.contactTel = undefined; this.state.contactName = undefined; this.state.releaseDate = []; this.loadData(); }, searchSwitch() { this.setState({ searchMore: !this.state.searchMore }); }, //点击消失函数 setok(e) { this.setState({ visible:true }); this.Detailload(e) }, setcancel(e) { this.setState({ visible:false }); }, setoks(index) { this.setState({ visible1:true }); this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/customer/findCustomerUserList", data:{ cid:this.state.hids }, success: function (data) { let theArr = []; let thedata=data.data; for (let i = 0; i < data.data.length; i++) { let thisdata = data.data[i]; theArr.push({ id:thisdata.id,//联系人ID contactName:thisdata.name,//联系人姓名 sex:thisdata.sex,//联系人性别 mobile:thisdata.mobile,//座机号 telNum:thisdata.telNum,//手机号 email:thisdata.email,//邮箱 qq:thisdata.qq,//qq wechat:thisdata.wechat,//微信号 depatrment:thisdata.depatrment,//部门 customerPosition:thisdata.customerPosition,//职位 }); }; this.setState({ information: theArr, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, setcancels(e) { this.setState({ visible1:false }); }, render() { const theData = this.state.data || {}; const rowSelection = { selectedRowKeys: this.state.selectedRowKeys, onChange: (selectedRowKeys, selectedRows) => { this.setState({ selectedRows: selectedRows.slice(-1), selectedRowKeys: selectedRowKeys.slice(-1) }); } }; const hasSelected = this.state.selectedRowKeys.length > 0; const { RangePicker } = DatePicker; return (
公共客户管理
{ this.setState({ companyName: e.target.value }); }} /> 更多搜索
{ this.setState({ contactName: e.target.value }); }} /> { this.setState({ contactTel: e.target.value }); }} />
客户类型:{theData._customerType}编号:{theData.cid} 录入时间:{theData.createTime}跟单人:{theData.adminName}基本资料: 公司名称:{theData.companyName}公司行业:{theData.companyIndustry} 意向服务:{getCompanyIntention(theData.companyIntention)}地区:{getcityArr(theData.locationProvince)} 最新跟进:{theData._followSituation}客户状态:{theData._customerStatus} 详细地址:{theData.adress} 备注:{theData.remarks}联系资料:查看联系人列表
); } }); export default PublicCustomer;