import React from 'react';
import { Radio, Icon, Button, Input, Select, Tabs,Spin,Popconfirm, Table, Switch, message, DatePicker, Modal, Upload,Form ,Row,Col,TimePicker} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import moment from 'moment';
import './myClient.less';
import { areaSelect } from '../../NewDicProvinceList';
const { Column, ColumnGroup } = Table;
const TabPane = Tabs.TabPane;
import CustomerDetail from './myClientDesc.jsx';
import { achievementCategoryList, techAuditStatusList,cityArr,tag,customerStatus,intentionalService,newFollow ,contact,sex} from '../../dataDic.js';
import { beforeUploadFile, companySearch, getAchievementCategory,getsex,getSearchUrl,getTag,getTechAuditStatus,getcustomerTyp,getcityArr,getCompanyIntentionOn,getcustomerStatue,getCompanyIntention,getfllowSituation,getcontact,getfllowSituationOn,getcustomerStatueOn} from '../../tools.js';
//图片组件
const PicturesWall = React.createClass({
getInitialState() {
return {
previewVisible: false,
previewImage: '',
fileList: [],
}
},
handleCancel() {
this.setState({ previewVisible: false })
},
handlePreview(file) {
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
});
},
handleChange(info) {
let fileList = info.fileList;
this.setState({ fileList });
this.props.fileList(fileList);
},
componentWillReceiveProps(nextProps) {
this.state.fileList = nextProps.pictureUrl;
},
render() {
const { previewVisible, previewImage, fileList } = this.state;
const uploadButton = (
);
return (
{fileList.length >= 5 ? null : uploadButton}
);
}
});
const AchievementList = Form.create()(React.createClass({
loadData(pageNo, apiUrl) {
this.state.data = [];
this.setState({
loading: true
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/listPrivateCustomer',
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
companyName: this.state.companyNamet, //名称1
customerType: this.state.customerTypet, //客户类型1
locationProvince:this.state.locationProvincet,//地区
customerStatus:this.state.customerStatust,//客户状态1
contactName:this.state.contactNamet,//联系人姓名1
//contactTel:this.state.contactTelt,//联系人手机
companyIntention:this.state.companyIntentiont,//意向服务
followSituation:this.state.followSituationt,//最新跟进进度
},
success: function (data) {
let theArr = [];
let ad;
if (data.error.length || data.data.list=="") {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
ad=data.data.list[0].aid;
for (let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
let intentionText=thisdata._companyIntention.split("-");
let intentionstring=intentionText.slice("0","1").join('-')
theArr.push({
key: i,
id: thisdata.id,
companyName:thisdata.companyName,//公司名称
_shareType:thisdata._shareType,//客户类型
locationProvince:thisdata.locationProvince,//地区
contactName:thisdata.contactName, //联系人姓名
telNum:thisdata.telNum,//手机号
_customerStatus:thisdata._customerStatus,//客户状态
_companyIntention:intentionstring,//意向服务
_followSituation:thisdata._followSituation,//最新跟进
customerStatus:thisdata.customerStatus,//客户状态
companyIntention:thisdata.companyIntention,//意向服务
followSituation:thisdata.followSituation,//最新跟进
adminName:thisdata.adminName, //跟进人
followDate:thisdata.followDate,
_customerType:thisdata._customerType,//客户类型
});
};
this.state.pagination.current = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
};
this.setState({
aid:ad,
dataSource: theArr,
pagination: this.state.pagination
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击+号进行两次查询,这个是查询联系人的函数
getNewWoman(index) {
this.state.data = []
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findCustomerUserList",
data:{
cid:index
},
success: function (data) {
let theArr = [];
let thedata=data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
thedata = {};
};
var email=[];
var telNum=[];
var watch=[];
var qq=[];
var contactIds=[];
thedata.map(function (item,index) {
watch.push(thedata[index].wechat);
qq.push(thedata[index].qq);
email.push(thedata[index].email);
contactIds.push(thedata[index].id);
telNum.push(thedata[index].telNum);
theArr.push({item.name})
});
var lastName= thedata[thedata.length-1].name;
var nub=thedata[thedata.length-1].telNum;
var kid=thedata[thedata.length-1].id;
var contacts='电话';
this.setState({
idt:thedata[0].id,
kid:kid,
contactIds:contactIds,
contacts:contacts,
nub:nub,
telNum:telNum,
email:email,
watch:watch,
qq:qq,
lastName:lastName,
orderStatusOption: theArr,
technicalPictureUrl: thedata.sign ? splitUrl(thedata.sign, ',', globalConfig.avatarHost + '/upload') : [],
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//在添加联系记录页面,选择联系方式查看号码
contacts(e){
let conts='';
if(e==0){
conts='电话'
this.state.nub=this.state.changNub
}
if(e==1){
conts='邮件'
this.state.nub=this.state.changEmail
}
if(e==2){
conts='微信'
this.state.nub=this.state.changWatch
}
if(e==3){
conts='QQ'
this.state.nub=this.state.changQq
}
this.setState({
conts:conts,
contacts: e,
});
},
//通过ID查询这一条的信息
Detailload(deletedIds,record){
this.RowClick;
$.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 = {};
};
//意向服务多选
// let companyArr=[];
// let companyString=thisData.companyIntention;
// companyArr=companyString.split(",") ;
// let creatMent=thisData.createTime.substr(10,9);
// let createYear=thisData.createTime.substr(0,10);
let followSituationTxt=getfllowSituation(thisData.followSituation.toString());
let yearMonth = new Date().toLocaleDateString();
let yearString = yearMonth.split('/').join('-');
let days = new Date();
let hours = parseInt(days.getHours())<10 ? "0"+days.getHours():days.getHours();
let minutes =parseInt(days.getMinutes())<10 ? "0"+days.getMinutes():days.getMinutes();
let seconds =parseInt(days.getSeconds())<10 ? "0"+days.getSeconds():days.getSeconds();
let pjstringY=hours+':'+minutes+':'+seconds ;
this.setState({
locationProvince:thisData.locationProvince,
addId:thisData.id,
creatMent:pjstringY,
createYear:yearString,
addCid:thisData.cid,
datak: thisData,
companyIndustry:thisData.companyIndustry,
address:thisData.address,
followSituation:followSituationTxt,
customerStatus:thisData.customerStatus.toString(),
companyIntention:thisData.companyIntention,
_followSituation:thisData._followSituation,
_customerStatus:thisData._customerStatus,
_companyIntention:thisData._companyIntention,
cid:thisData.cid,
customerType:thisData.customerType,
companyName:thisData.companyName,
adminName:thisData.adminName
});
if (thisData.ownerId) {
this.getContactsList(thisData.ownerId);
};
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击出现函数
//点击消失函数
setModal1Visiblecancel(e) {
this.setState({
modal1Visible:false
});
this.reset();
},
//点击添加跟进记录,点击最新跟进下的+号,将会查询出很多数据,展示在列表里面,
setModal1VisibleOk(e) {
this.setState({modal1Visible:true});
this.state.remarkst='';
let deletedIds=this.state.recordt;
this.setState({
remarks:'',
selectedRowKeys: this.state.selectedRowKeys,
});
this.Detailload(deletedIds);
this.getNewWoman(deletedIds);
},
//点击出现函数
setModal2VisibleOk(e) {
this.setState({
modal2Visible:true
});
this.state.hotst=undefined;
this.state.hott=undefined;
this.state.paymentIdt='';
this.state.entIdt='';
this.state.payt='';
this.state.paymt='';
this.state.paytIdtt='';
this.state.paentIdt='';
this.state.payIdt='';
this.state.emailst='';
},
//点击消失函数
setModal2Visiblecancel(e) {
this.setState({
modal2Visible:false
});
},
//点击消失函数
setModal3Visiblecancel(e) {
this.setState({
modal3Visible:false
});
},
rescordlist(deletedIds){
this.setState({
selectedRowKeys:this.state.selectedRowKeys,
});
this.state.data = [];
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/listFollowUpRecord',
data: {
customerId:deletedIds
},
success: function (data) {
let theArr = [];
let theWomanID=[];
let theFollowID=[];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
data.data.map(function (item,index) {
theWomanID.push(data.data[index].contactId);
});
data.data.map(function (item,index) {
theFollowID.push(data.data[index].followId);
});
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
theArr.push({
key:i,
_followDate:thisdata._followDate,//跟进时间
adminName:thisdata.adminName,//跟进人
contactName:thisdata.contactName, //联系人姓名
contactId:thisdata.contactId, //联系人ID
contactInfo:thisdata.contactInfo,//联系信息
_customerStatus:thisdata._customerStatus,//客户状态
_followSituation:thisdata._followSituation,//最新跟进
followResult:thisdata.followResult,//跟进结果
attachment:thisdata.attachment,//附件地址
});
};
};
this.setState({//导出数据
datahistory: theArr,
theWomanID:theWomanID,
theFollowID:theFollowID,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击查看跟进记录,点击最新跟进的第一个按钮(跟进状态)执行的函数,将会出现很多跟进列表
setModal3VisibleOk(e) {
this.setState({ modal3Visible:true });
this.state.data = [];
this.setState({
loading: true
});
this.setState({
selectedRowKeys:this.state.selectedRowKeys,
});
let deletedIds=this.state.recordt;
this.rescordlist(deletedIds)
},
//删除历史记录
onDelete(index){
let deletedIds=this.state.rowId;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
};
};
let deleteID=this.state.theFollowID[index];
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/deleteFollowUpRecord",
data: {
followId:deleteID,//删除的ID
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.rescordlist(deletedIds)
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
//点击消失函数
setModal4Visiblecancel(e) {
this.setState({
modal4Visible:false
});
},
//点击客户的名字,进行详情的查询
setModal4Visible(e,index) {
this.setState({ modal4Visible:true });
let changeIds=this.state.datahistory[index].contactId;
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/findContactDetail',
data: {
contactId:changeIds
},
success: function (data) {
let theArr = [];
let theDate=data.data;
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
theArr.push({
key:i,
name:name,//联系人姓名
sex:sex,//联系人性别
mobile:mobile,//座机号
telNum:telNum,//手机号
email:email,//邮箱
qq:qq,//qq
wechat:wechat,//微信号
depatrment:depatrment,//部门
customerPosition:customerPosition,//职位
});
};
};
this.setState({//导出数据
theDate:theDate,
name:theDate.name,//联系人姓名
sex:theDate.sex,//联系人性别
mobile:theDate.mobile,//座机号
telNum:theDate.telNum,//手机号
email:theDate.email,//邮箱
qq:theDate.qq,//qq
wechat:theDate.wechat,//微信号
depatrment:theDate.depatrment,//部门
customerPosition:theDate.customerPosition,//职位
companyName:theDate.companyName,//公司
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//点击消失函数
setModal5Visiblecancel(e) {
this.setState({
modal5Visible:false
});
},
setModal6Visiblecancel(e) {
this.setState({
modal6Visible:false
});
},
setModal8Visiblecancel(e) {
this.setState({
modal8Visible:false
});
},
//点击名称时获取列表
setModal5VisibleOk(e) {
this.setState({ modal5Visible:true }); //需要一个请求数据
this.Detailload(e.id);
},
//历史记录查看更多,还是历史记录接口
setModal6VisibleOk(e) {
this.setState({
followResults:this.state.datahistory[e].followResult,
modal6Visible:true
}); //需要一个请求数据
},
getPictureUrl(e) {
this.setState({pictureUrl: e });
},
//查看所有的联系人setModal7VisibleOk
contactList(index) {
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findCustomerUserList",
data:{
cid:index
},
success: function (data) {
let theArr = [];
let thedata=data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
thedata={}
};
let cidArr=[];
for (let i = 0; i < data.data.length; i++) {
cidArr.push({
i:thedata[i].cid,
})
}
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
theArr.push({
cid:thisdata.cid,//客户的ID
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,
cidArr:cidArr,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//修改联系人列表数据
setModal8VisibleOk(e) {
this.setState({ modal8Visible:true }); //需要一个请求数据
let deletedIds=this.state.rowId;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
};
};
},
changefollow(e){
e.preventDefault();
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/updateContacter",
data: {
id:this.state.id,//联系人ID
cid:this.state.cid,//客户的ID
name:this.state.name,//客户名
sex:this.state.sex,//性别
mobile:this.state.mobile,//座机号
telNum:this.state.telNum,//手机号
email:this.state.email,//邮箱
qq:this.state.qq,//qq
wechat:this.state.wechat,//微信号
depatrment:this.state.depatrment,//部门
customerPosition:this.state.customerPosition,//职位
primaryFlg:this.state.primaryFlg,//是否是主要联系人
}
}).done(function (data) {
if (!data.error.length) {
message.success('修改成功!');
this.setState({
loading: false,
});
this.setModal8Visiblecancel()
} else {
message.warning(data.error[0].message);
};
this.Detailload(this.state.rowId);
this.contactList(this.state.rowId);
this.loadData();
}.bind(this));
},
informationRowClick(index){
this.setModal8VisibleOk()
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/findContactDetail',
data: {
contactId:index.id
},
success: function (data) {
let theArr = [];
let theDate=data.data;
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
theArr.push({
key:i,
primaryFlg:primaryFlg,
name:name,//联系人姓名
sex:sex,//联系人性别
mobile:mobile,//座机号
telNum:telNum,//手机号
email:email,//邮箱
qq:qq,//qq
wechat:wechat,//微信号
depatrment:depatrment,//部门
customerPosition:customerPosition,//职位
});
};
};
this.setState({//导出数据
primaryFlg:theDate.primaryFlg,
thaDate:theDate,
cid:theDate.cid,//客户ID
id:theDate.id,//联系人ID
name:theDate.name,//联系人姓名
sex:theDate.sex,//联系人性别
mobile:theDate.mobile,//座机号
telNum:theDate.telNum,//手机号
email:theDate.email,//邮箱
qq:theDate.qq,//qq
wechat:theDate.wechat,//微信号
depatrment:theDate.depatrment,//部门
customerPosition:theDate.customerPosition,//职位
companyName:theDate.companyName,//公司
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
componentWillReceiveProps(nextProps) {
if (!this.props.visible && nextProps.visible) {
if (nextProps.data && nextProps.data.id) {
this.loadData(nextProps.data.id, nextProps.detailApiUrl);
};
this.state.technicalPictureUrl = [];
};
},
//添加一条跟进记录,点击保存按钮进行添加
addFollowSubmit(e) {
e.preventDefault();
this.state.data = []
this.setState({
selectedRowKeys: [],
});
let deletedIds=this.state.addId;
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
let custype=values._shareType;
let customerTypechange="";
switch(custype){
case "个人客户":customerTypechange=0;break;
case "公司客户":customerTypechange=1;break;
case "团体客户":customerTypechange=2;break;
}
let customerStatus= getcustomerStatueOn(this.state.customerStatus);
let followSituation= getfllowSituationOn(this.state.followSituation);
//图片转换
let thetechnicalPictureUrl = [];
if (this.state.technicalPictureUrl.length) {
let picArr = [];
this.state.technicalPictureUrl.map(function (item) {
picArr.push(item.response.data);
});
thetechnicalPictureUrl = picArr.join(",");
};
let yearMonth = new Date(this.state.createYear).toLocaleDateString();
let yearString = yearMonth.split('/').join('-');
let pjstringY='';
let days = new Date(this.state.creatMent);
let hours = parseInt(days.getHours())<10 ? "0"+days.getHours():days.getHours();
let minutes =parseInt(days.getMinutes())<10 ? "0"+days.getMinutes():days.getMinutes();
let seconds =parseInt(days.getSeconds())<10 ? "0"+days.getSeconds():days.getSeconds();
if(this.state.creatMent.length==8){
pjstringY=this.state.creatMent
}else{
pjstringY=hours+':'+minutes+':'+seconds
}
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/addFollowUpRecord',
data: {
id: this.state.addCid,//编号id
cuid:this.state.idt,//联系人ID
followDates:yearString+' '+pjstringY,
followResult:this.state.remarkst,//跟进结果
attachment:thetechnicalPictureUrl,//附件地址
customerStatus:this.state.customerStatus,//跟进客户状态
followSituation:this.state.followSituation.length==1?this.state.followSituation:followSituation,//跟进进度
contactInfo:(this.state.conts?this.state.conts:"电话")+"-"+(this.state.nub?this.state.nub:""),
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.setModal1Visiblecancel()
} else {
message.warning(data.error[0].message);
}
this.rescordlist(this.state.rowId);
}.bind(this));
}
})
},
//当选择联系人的列表变化时,则执行
hundleName(e){
let changNub=this.state.telNum[e];
let changEmail=this.state.email[e];
let changWatch=this.state.watch[e];
let changQq=this.state.qq[e];
let kid=this.state.contactIds[e];
this.setState({
kid:kid,
contacts:'电话',
nub:this.state.telNum[e],
lastName: e,
changNub:changNub,
changEmail:changEmail,
changWatch:changWatch,
changQq:changQq
});
},
//所有资料修改保存提交,点击保存按钮进行更新
handleSubmit(e) {
e.preventDefault();
this.state.data=[]
let deletedIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
let custype=values._customerType;
let customerTypechange="";
switch(custype){
case "个人客户":customerTypechange=0;break;
case "公司客户":customerTypechange=1;break;
case "团体客户":customerTypechange=2;break;
}
let companyIntentions= getCompanyIntentionOn(values.companyIntention);
let followSituations= getfllowSituationOn(values.followSituation);
let becompanyIntentions=getCompanyIntentionOn();
let city=getcityArr(values.locationProvince);
//let companyMore = [];
const theDatak = this.state.datak || {};
//意向服务多选
// if (this.state.companyIntention.length) {
// let companyList = [];
// this.state.companyIntention.map(function (item) {
// companyList.push(item);
// });
// companyMore = companyList.join(",");
// };
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/updateCustomer',
data: {
id: this.state.cid,//编号id
customerType:this.state.customerType,//客户信息 1
companyName: this.state.companyName,//公司名称 1
companyIndustry: this.state.companyIndustry,//公司行业
tag: theDatak.tag,
locationProvince:this.state.locationProvince ,//省份1
address: this.state.address,//详细地址1
remarks: values.remarks,//备注1
companyIntention:this.state.companyIntention,//公司意向
followSituation:theDatak.followSituation,//最新跟进1
customerStatus:this.state.customerStatus,//客户状态1
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('修改成功!');
this.setModal5Visiblecancel();
} else {
message.warning(data.error[0].message);
}
this.Detailload(this.state.rowId);
this.loadData()
}.bind(this));
}
})
},
submitcontactman(e){
let deletedIds;
this.state.data=[];
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id
}
};
if(!deletedIds){
deletedIds=this.state.cid
}
this.setState({
selectedRowKeys: [],
});
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
this.setState({
loading: true
});
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customer/addContacter',
data: {
cid: deletedIds,//编号id
sex:this.state.hott,//性别
primaryFlg:this.state.hotst,//是否是主要联系人
name:this.state.paymentIdt,//联系人姓名
mobile:this.state.paymt,//座机
telNum:this.state.payt,//电话
qq:this.state.entIdt,//qq
wechat:this.state.payIdt,//微信
customerPosition:this.state.paentIdt,//职位
depatrment:this.state.paytIdtt,//部门
email:this.state.emailst,//邮箱
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('保存成功!');
this.setModal2Visiblecancel()
} else {
message.warning(data.error[0].message);
}
this.Detailload(this.state.rowId);
this.getNewWoman(this.state.rowId);
this.contactList(this.state.rowId);
//this.loadData();
}.bind(this));
}
});
},
getTechnicalPictureUrl(e) {
this.setState({ technicalPictureUrl: e });
},
//新建联系人modal框显示
showModal(){
this.setState({
visible: true,
});
},
//指定转交人的点击函数
showModa(){
this.setState({
visible: true,
});
this.setState({
selectedRowKeys:[],
});
let changeIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
changeIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findAdmin",
data: {
id: changeIds,//这一行数据的ID
beforeCompanyIntention:companyIntention,//意向服务
beforeCustomerStatus:customerStatus,//客户状态
beforeFollowSituation:followSituation,//最新跟进状态
beforeAdminName:adminName,//跟进人
}
}).done(function (data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
} else {
let theAssigne = [];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
//处理数据 进行循环
theAssigne.push({
name: thisdata.name,
id: thisdata.id,
ids: thisdata.cid,
mobile:thisdata.mobile,
adminName: thisdata.beforeAdminName,
customerStatus: thisdata.beforeCustomerStatus,
companyIntention: thisdata.beforeCompanyIntention,
followSituation: thisdata.beforeFollowSituation,
});
};
};
this.setState({
dataman: theAssigne,
paginations:false
});
}
}.bind(this));
},
//选择了指定人之后的保存点击函数,需要修改函数
changeAssigner() {
this.setState({
visible: false,
});
this.setState({
selectedRowKeys:[],
});
let changeId;
let changeIds;
let adminName;
let beforeAdminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
changeId=rowItem.id;
beforeAdminName=rowItem.adminName;
adminName=rowItem.key;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
changeIds=rowItem.ids;
};
};
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/transferCustomer",
data: {
id: changeIds,//这一行数据的ID
aid:changeId,//指定转交人的ID
// beforeCompanyIntention:companyIntention,//意向服务
// beforeCustomerStatus:customerStatus,//客户状态
// beforeFollowSituation:followSituation,//最新跟进状态
beforeAdminName:beforeAdminName,//之前的跟进人
adminName:adminName,//转交的跟进人
}
}).done(function (data) {
if (!data.error.length) {
message.success('转交成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
handleOk(e){
this.setState({
visible: false,
});
},
handleCancel(e){
this.setState({
visible: false,
});
},
getInitialState() {
return {
technicalPictureUrl: [],
modal1Visible: false,
modal2Visible: false,
visible: false ,
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'
},
],
addFollow:[
{
title: '时间',
dataIndex: '_followDate',
key: '_followDate'
},{
title: '客户',
dataIndex: 'contactName',
key: 'contactName',
},
{
title: '跟进人',
dataIndex: 'adminName',
key: 'adminName'
},{
title: '联系方式',
dataIndex: 'contactInfo',
key: 'contactInfo'
},{
title: '客户状态',
dataIndex: '_customerStatus',
key: '_customerStatus'
},{
title: '跟进结果',
dataIndex: '_followSituation',
key: '_followSituation'
},{
title: '备注',
dataIndex: 'remarks',
key: 'remarks'
},
],
achievement:[
{
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: '所有人名称',
dataIndex: 'qq',
key: 'qq'
},{
title: '审核状态',
dataIndex: 'email11',
key: 'email11'
},{
title: '是否精品',
dataIndex: 'wechat323',
key: 'wechat323'
},{
title: '首页展示',
dataIndex: 'email33',
key: 'email33'
},{
title: '发布时间',
dataIndex: 'wechat211',
key: 'wechat211'
},
],
demand:[
{
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: '关键字',
dataIndex: 'qq',
key: 'qq'
},{
title: '需求类型',
dataIndex: 'email44',
key: 'email44'
},{
title: '信息来源',
dataIndex: 'wechat',
key: 'wechat'
},{
title: '雇主名称',
dataIndex: 'email12',
key: 'email12'
},{
title: '审核状态',
dataIndex: 'wechat33',
key: 'wechat33'
},{
title: '需求状态',
dataIndex: 'email23',
key: 'email23'
},{
title: '有效期限',
dataIndex: 'wechat212',
key: 'wechat212'
},{
title: '发布时间',
dataIndex: 'wechat44',
key: 'wechat44'
},
],
operationLog:[
{
title: '操作员姓名',
dataIndex: 'operatorName',
key: 'operatorName'
},{
title: '操作类型',
dataIndex: 'operatorType',
key: 'operatorType',
},
{
title: '操作时间',
dataIndex: 'operatorTime',
key: 'operatorTime'
},{
title: '修改前客户状态',
dataIndex: 'beforeCustomerStatus',
key: 'beforeCustomerStatus'
},{
title: '修改后客户状态',
dataIndex: 'afterCustomerStatus',
key: 'afterCustomerStatus'
},{
title: '修改前客户意向',
dataIndex: 'beforeCustomerIntention',
key: 'beforeCustomerIntention'
},{
title: '修改后客户意向',
dataIndex: 'afterCustomerIntention',
key: 'afterCustomerIntention'
},{
title: '修改前跟进进度',
dataIndex: 'beforeFollowSituation',
key: 'beforeFollowSituation'
},{
title: '修改后跟进进度',
dataIndex: 'afterFollowSituation',
key: 'afterFollowSituation'
},{
title: '修改前跟进人',
dataIndex: 'beforeAdminName',
key: 'beforeAdminName'
},{
title: '修改后跟进人',
dataIndex: 'afterAdminName',
key: 'afterAdminName'
},
],
columnsman:[{
title: '姓名',
dataIndex: 'name',
key: 'name'
},{
title: '手机号码',
dataIndex: 'mobile',
key: 'mobile'
}
],
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',
},
{
title: '最新跟进',
dataIndex: '_followSituation',
key: '_followSituation',
},
{
title: '跟单人',
dataIndex: 'adminName',
key: 'adminName',
},
{
title: '时间',
dataIndex: 'followDate',
key: 'followDate',
}
],
dataSource: [],
searchTime: [,]
};
},
componentWillMount() {
let theArr = [];
customerStatus.map(function (item) {
theArr.push(
{item.key}
)
});
let auditArr = [];
cityArr.map(function (item) {
auditArr.push(
{item.key}
)
});
let intentionalArr = [];
intentionalService.map(function (item) {
intentionalArr.push(
{item.key}
)
});
let newArr = [];
newFollow.map(function (item) {
newArr.push(
{item.key}
)
});
this.state.customerStatuarr = theArr;
this.state.auditStatusOption = auditArr;
this.state.intentionalOption = intentionalArr;
this.state.newOption = newArr;
this.loadData();
},
tableRowClick(record, index) {
//this.state.RowData = record;
this.setModal5VisibleOk(record);
this.contactList(record.id);
this.rescordlist(record.id);
this.findCustomerHistory(record.id);
this.historyList(record.id);
this.setState({
selectedRowKeys:[],
rowId:record.id ,
before_customerStatus:record._customerStatus,
before_companyIntention:record._companyIntention,
before_followSituation:record._followSituation
})
},
//删除功能,已经完成
delectRow() {
let deletedIds;
let adminName;
let customerStatus;
let companyIntention;
let followSituation;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
adminName=rowItem.adminName;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
};
};
this.state.data = []
this.setState({
selectedRowKeys: [],
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/deleteCustomer",
data: {
id: deletedIds,//删除的ID
// beforeCustomerStatus:customerStatus,
// beforeCompanyIntention:companyIntention,
// beforeFollowSituation:followSituation,
// beforeAdminName:adminName
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
//删除功能
delectRowFollow() {
let deletedIds;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
};
};
this.state.data = []
this.setState({
selectedRowKeys: [],
});
$.ajax({
method: "post",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/deleteContacter",
data: {
contactId: deletedIds,//删除的ID
}
}).done(function (data) {
if (!data.error.length) {
message.success('删除成功!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
//列表历史记录查询不带单选的
findCustomerHistory(cid){
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/findCustomerHistory",
data: {
customerId: cid,//这一行数据的ID
}
}).done(function (data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
} else {
let theAssigne = [];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
}
this.setState({
dataRowhistory: data.data,
});
}
}.bind(this));
},
//历史记录列表查询
historyList(cid){
this.state.data = [];
this.setState({
loading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/listCustomerLog',
data: {
customerId:cid
},
success: function (data) {
let theArr = [];
if (!data.data) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for (let i = 0; i < data.data.length; i++) {
let thisdata = data.data[i];
// let intentionText=thisdata.beforeCustomerIntention.split(",");
// let intentionstring=intentionText.slice("0","2").join('-')
//console.log(intentionstring)
// let afterIntentionText=thisdata.afterCustomerIntention.split(",");
// let afterIntentionstring=afterIntentionText.slice("0","2").join('-')
theArr.push({
key:i,
operatorName:thisdata.operatorName,//操作员姓名
operatorType:thisdata.operatorType,//操作类型
operatorTime:thisdata.operatorTime, //操作时间
beforeCustomerStatus:thisdata.beforeCustomerStatus, //修改前客户状态
afterCustomerStatus:thisdata.afterCustomerStatus,//修改后客户状态
beforeCustomerIntention:thisdata.beforeCustomerIntention,//修改前客户意向
afterCustomerIntention:thisdata.afterCustomerIntention,//修改后客户意向
beforeFollowSituation:thisdata.beforeFollowSituation,//修改前跟进进度
afterFollowSituation:thisdata.afterFollowSituation,//修改后跟进进度
beforeAdminName:thisdata.beforeAdminName,//修改前跟进人
afterAdminName:thisdata.afterAdminName,//修改后跟进人
});
};
};
this.setState({//导出数据
Logrecord: theArr,
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
//详情tab切换数据处理
callback(e){
if(e==1){
this.Detailload(this.state.rowId)
this.getNewWoman(this.state.rowId);
}
if(e==2){
this.rescordlist(this.state.rowId)
}
if(e==3){
this.Detailload(this.state.rowId)
}
if(e==4){
this.findCustomerHistory(this.state.rowId)
this.historyList(this.state.rowId)
}
},
changeRow() {
let deletedIds;
let customerStatus;
let companyIntention;
let followSituation;
let adminName;
for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
let rowItem = this.state.selectedRows[idx];
if (rowItem.id) {
deletedIds=rowItem.id;
customerStatus=rowItem.customerStatus;
companyIntention=rowItem.companyIntention;
followSituation=rowItem.followSituation;
adminName=rowItem.adminName;
};
};
this.setState({
selectedRowKeys: [],
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/transferToPublic",
data: {
//aid:this.state.aid,
id: deletedIds,
// beforeCompanyIntention:companyIntention,//意向服务
// beforeCustomerStatus:customerStatus,//客户状态
// beforeFollowSituation:followSituation,//最新跟进状态
beforeAdminName:adminName,
}
}).done(function (data) {
if (!data.error.length) {
message.success('已转为公共客户!');
this.setState({
loading: false,
});
} else {
message.warning(data.error[0].message);
};
this.loadData();
}.bind(this));
},
addClick() {
this.state.RowData={};
this.setState({
showDesc: true,
});
},
closeDesc(e, s) {
this.state.showDesc = e;
if (s) {
this.loadData();
};
},
search() {
this.loadData();
},
reset() {
this.state.companyNamet='';
this.state.customerTypet = undefined;
this.state.id = undefined;
this.state.shareTypet = undefined;
this.state.companyIntentiont = undefined;
this.state.followSituationt = undefined;
this.state.locationProvincet = undefined;
this.state.customerStatust = undefined;
this.state.contactNamet = undefined;
//this.state.contactTelt = '';
this.state.contactNamet = undefined;
this.state.releaseDatet = [];
this.loadData();
},
searchSwitch() {
this.setState({
searchMore: !this.state.searchMore
});
},
//快速新增联系人
addContant(){
this.setModal2VisibleOk()
this.state.hotst=undefined;
this.state.hott=undefined;
this.state.paymentIdt='';
this.state.entIdt='';
this.state.payt='';
this.state.paymt='';
this.state.paytIdtt='';
this.state.paentIdt='';
this.state.payIdt='';
this.state.emailst='';
},
//添加跟进记录没单选的情况下
addcord(){
var addcord=this.state.rowId
this.setState({modal1Visible:true});
this.state.remarkst='';
this.Detailload(addcord);
this.getNewWoman(addcord)
},
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 hasSelected = this.state.selectedRowKeys.length > 0;
const { RangePicker } = DatePicker;
const theData = this.props.data || {};
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
const theDatak = this.state.datak || {};
const theDatat = this.state.data || {};
const theDatahistory=this.state.dataRowhistory || {};
const contactsOption="";
const formItemLayput = {
labelCol: { span: 10 },
wrapperCol: { span: 14 },
};
return (
我的客户管理
{
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} 文件上传成功!`);
this.loadData();
} else {
message.warning(info.file.response.error[0].message);
return;
};
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败。`);
};
}} >
科技成果
科技需求
{getFieldDecorator('name', {
initialValue: this.state.name
})(
{ this.setState({ name: e.target.value }) }}/>
)}
{getFieldDecorator('sex', {
initialValue: this.state.sex
})(
{ this.setState({ sex: e.target.value }); }}>
男
女
)}
{getFieldDecorator('primaryFlg', {
initialValue: this.state.primaryFlg
})(
{this.setState({primaryFlg: e.target.value });}}>
是
否
)}
{getFieldDecorator('telNum', {
initialValue: this.state.telNum
})(
{ this.setState({ telNum: e.target.value }) }}/>
)}
{getFieldDecorator('mobile', {
initialValue: this.state.mobile
})(
{ this.setState({ mobile: e.target.value }) }}/>
)}
{getFieldDecorator('qq', {
initialValue: this.state.qq
})(
{ this.setState({ qq: e.target.value }) }}/>
)}
{getFieldDecorator('email', {
initialValue: this.state.email
})(
{ this.setState({ email: e.target.value }) }}/>
)}
{getFieldDecorator('wechat', {
initialValue: this.state.wechat
})(
{ this.setState({ wechat: e.target.value }) }}/>
)}
{getFieldDecorator('depatrment', {
initialValue: this.state.depatrment
})(
{ this.setState({ depatrment: e.target.value }) }}/>
)}
{getFieldDecorator('customerPosition', {
initialValue: this.state.customerPosition
})(
{ this.setState({ customerPosition: e.target.value }); }}/>
)}
{this.state.followResults}
{
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
});
}} >
{ this.setState({ previewVisible: false }) }}>
);
}
}));
export default AchievementList;