import React from 'react';
import {Form,Button,Spin,message,Table,Popconfirm,Modal} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import {getCompanyIntention,getfllowSituation,getcustomerStatue,getContactType } from '@/tools.js';
const FormItem =Form.Item;
import BusinFollow from './businFollow.jsx'
const BusinessDetail =React.createClass({
getInitialState(){
return {
loading:false,
visitArrList: [],
busData:{},
paginationst: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function(page) {
this.loadVisit(page);
}.bind(this),
showTotal: function(total) {
return '共' + total + '条数据';
}
},
businessFollowList: [{
title: '跟进时间',
dataIndex: 'followTime',
key: 'followTime',
}, {
title: '营销员',
dataIndex: 'adminName',
key: 'adminName',
}, {
title: '业务意向进度',
dataIndex: 'followSituation',
key: 'followSituation',
render: text => { return getfllowSituation(text) }
}, {
title: '客户状态',
dataIndex: 'customerStatus',
key: 'customerStatus',
render: text => { return getcustomerStatue(text) }
},
{
title: '拜访方式',
dataIndex: 'contactType',
key: 'contactType',
render: text => { return getContactType(text) }
}, {
title: '联系人',
dataIndex: 'contacts',
key: 'contacts',
render:(text,record)=>{
return
{
!record.readOnly?
{text}:
***
}
}
},
{
title: '联系电话',
dataIndex: 'contactMobile',
key: 'contactMobile',
render:(text,record)=>{
return
{
!record.readOnly?
{text}:
***
}
}
}, {
title: '操作',
dataIndex: 'ooo',
key: 'ooo',
render: (text, record) => { return() }
}
],
}
},
//业务跟进查看跟多
businessFollowDetails(e) {
this.setState({
busData:e,
businessFollowModul: true
})
},
listFollowUp(e) {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/customer/toUpdateFollowOneBusiness",
data: {
ufbId: e
},
success: function(data) {
let thedata = data.data;
if(!thedata) {
if(data.error && data.error.length) {
message.warning(data.error[0].message);
};
thedata = {};
};
this.setState({
businessProjectName: thedata.businessProjectName,
followSituations: thedata.followSituation,
customerStatuss: thedata.customerStatus,
followTimes: thedata.followTime,
createTimes: thedata.createTime,
identifyNames: thedata.identifyName,
contactTypes: parseInt(thedata.contactType),
results: thedata.result,
remarkss: thedata.remarks,
adminNames: thedata.adminName,
contactss: thedata.contacts,
contactMobiles: thedata.contactMobile,
ufbId: thedata.ufbId,
followIds: thedata.followId,
});
}.bind(this),
}).always(function() {
this.setState({
loading: false
});
}.bind(this));
},
//查看跟进记录列表
loadVisit(pageNo) {
this.setState({
loading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customer/listFollowHistory',
data: {
pageNo: pageNo || 1,
pageSize: this.state.paginationst.pageSize,
uid: this.props.ids, //名称1
businessProjectId:this.props.data.businessProjectId
},
success: function(data) {
let theArr = [];
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++) {
let thisdata = data.data.list[i];
theArr.push({
key:i,
readOnly:thisdata.readOnly,
followId: thisdata.followId,
followTime: thisdata.followTime,
identifyName: thisdata.identifyName,
contacts: thisdata.contacts,
contactMobile: thisdata.contactMobile,
result: thisdata.result,
ufbId: thisdata.ufbId,
adminName: thisdata.adminName,
followSituation: thisdata.followSituation,
customerStatus: thisdata.customerStatus,
contactType: thisdata.contactType
});
};
this.state.paginationst.current = data.data.pageNo;
this.state.paginationst.total = data.data.totalCount;
};
if(data.data.list&&!data.data.list.length){
this.state.paginationst.current = 0;
this.state.paginationst.total = 0;
};
this.setState({
visitArrList: theArr,
paginationst: this.state.paginationst
});
}.bind(this),
}).always(function() {
this.setState({
loading: false
});
}.bind(this));
},
businessIntentionDetails(e) {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/customer/toUpdateBusiness',
data: {
businessId: e.businessId,
},
success: function(data) {
let thisData = data.data;
if(!thisData) {
if(data.error && data.error.length) {
message.warning(data.error[0].message);
};
thisData = {};
};
this.setState({
businessProjectName: thisData.businessProjectName,
identifyName: thisData.identifyName,
uid: thisData.uid,
businessId: thisData.businessId,
followSituation: thisData.followSituation,
customerStatus: thisData.customerStatus,
createTime: thisData.createTime,
followTime: thisData.followTime,
adminName: thisData.adminName,
remarks: thisData.remarks,
result: thisData.result,
});
}.bind(this),
}).always(function() {
this.loadVisit();
this.setState({
loading: false
});
}.bind(this));
this.setState({
businessModul: true
})
},
businessIntentionCancel(){
this.setState({
businessFollowModul:false,
businessModul:false
})
},
closeBusiness(s){
this.state.businessFollowModul=s
},
componentWillReceiveProps(nextProps) {
if(nextProps.data.businessId&&nextProps.businessModul&&nextProps.ids){
this.setState({
businessModul:true
})
this.businessIntentionDetails(nextProps.data);
}
this.setState({
businessFollowModul:false
})
},
render(){
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
return(
)
}
});
export default BusinessDetail;