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 } from '../../dataDic.js';
import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js';
const data = [{
companyName : '公司名称',
_followSituation : 'John Brown',
_companyIntention: 32,
}, {
companyName: '跟单人',
_followSituation: 'Jim Green',
_companyIntention: 42,
}, {
companyName: '时间',
_followSituation: 'Joe Black',
_companyIntention: 32,
}];
const AchievementDetail = React.createClass({
getInitialState () {
return {
visible: false,
loading: false,
dataSource: [],
};
},
loadLogs (id) {
this.setState({
loading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/portal/order/achievementOrderLog",
data: {
id:id
},
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];
theArr.push({
key: i,
recordTime: thisdata.recordTime,
status: thisdata.status,
comment: thisdata.comment,
operator: thisdata.operator,
recordTimeFormattedDate: thisdata.recordTimeFormattedDate //传回来的值 可能要改
});
};
};
this.setState({
dataSource: theArr
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
handleSubmit (e) {
this.setState({
loading: true
});
$.ajax({
method: "POST",
dataType: "json",
crossDomain: false,
url: globalConfig.context + '/api/admin/portal/order/updateAchievementOrder',
data: {
id: this.props.data.id,
}
}).done(function (data) {
this.setState({
loading: false
});
if (!data.error.length) {
message.success('领取成功!');
this.handleOk();
} else {
message.warning(data.error[0].message);
};
}.bind(this));
},
handleCancel (e) {
this.setState({
visible: false,
});
this.props.closeDesc(false);
},
handleOk (e) {
this.setState({
visible: false,
});
this.props.closeDesc(false, true);
},
componentWillReceiveProps (nextProps) {
if (!this.state.visible && nextProps.showDesc && nextProps.data) {
this.loadLogs(nextProps.data.id);
this.state.paymentId = nextProps.data.paymentId;
this.state.paymentType = nextProps.data.paymentType;
this.state.paymentValue = nextProps.data.paymentValue;
this.state.transferPrice = nextProps.data.transferPrice;
this.state.orderStatus = undefined;
this.state.comment = undefined;
this.state.recordTime = undefined;
};
this.state.visible = nextProps.showDesc;
},
render () {
const theData = this.props.data || {};
return (
客户类型:
{getcustomerTyp(theData.customerTyp)}
编号:
{theData.id}
录入时间:
{theData.createTime}
跟单人:
{theData.ownerId}
基本资料:
公司名称:
{theData.companyName}
公司行业:
{theData.companyIndustry}
意向服务:
{getCompanyIntention(theData.companyIntention)}
地区:
{getcityArr(theData.province)}
最新跟进:
{getfllowSituation(theData.followSituation)}
客户状态:
{getcustomerStatue(theData.customerStatus)}
详细地址:
{theData.adress}
备注:
{theData.remark}
联系资料:
姓名:
{theData.contactName}
性别:
{getsex(theData.sex)}
手机号码:
{theData.telNum}
座机号:
{theData.mobile}
QQ号码:
{theData.qq}
邮箱号:
{theData.email}
微信:
{theData.wechat}
部门:
{theData.department}
职位:
{theData.customerPosition}
);
},
});
//查询功能和初始列表
const AchievementOrderList = React.createClass({
loadData(pageNo, apiUrl) {
this.state.data = [];
this.setState({
loading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url:globalConfig.context + '/api/admin/customer/searchCustomerList',
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
companyName: this.state.companyName, //名称
customerTyp: this.state.customerTyp, //客户类型
province:this.state.province,//地区
customerStatus:this.state.customerStatus,//客户状态1
contactName:this.state.contactName,//联系人姓名1
adminName:this.state.adminName,//跟单人1
companyIntention:this.state.companyIntention,//意向服务1
followSituation:this.state.followSituation,//跟进进度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,
customerTyp:thisdata.customerTyp,
province:thisdata.province,
contactName:thisdata.contactName,
telNum:thisdata.telNum,
customerStatus:thisdata.customerStatus,
companyIntention:thisdata.companyIntention,
followSituation:thisdata.followSituation,
adminName:thisdata.adminName
});
};
this.state.pagination.current = data.data.pageNo;
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));
},
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 + '条数据';
}
},
columns: [
{
title: '公司名称',
dataIndex: 'companyName',
key: 'companyName',
}, {
title: '客户类型',
dataIndex: 'customerTyp',
key: 'customerTyp',
render: text => { return getcustomerTyp(text); }
}, {
title: '地区',
dataIndex: 'province',
key: 'province',
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',
}
],
dataSource: [],
searchTime: [],
};
},
componentWillMount() {
let theArr = [];
customerStatus.map(function (item) {
theArr.push(
{item.key}
)
});
let auditArr = [];
cityArr.map(function (item) {
auditArr.push(
{item.key}
)
});
this.state.customerStatuarr = theArr;
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, index) {
this.state.RowData = record;
this.setState({
showDesc: true
});
},
closeDesc(e, s) {
this.state.showDesc = e;
if (s) {
this.loadData();
};
},
search() {
this.loadData();
},
reset() {
this.state.id = undefined;
this.state.companyName = undefined;
this.state.customerTyp = undefined;
this.state.province = undefined;
this.state.ownerType = undefined;
this.state.customerStatus = undefined;
this.state.auditStatus = undefined;
this.state.ownerId = undefined;
this.state.contactName = undefined;
this.state.releaseDate = [];
this.loadData();
},
searchSwitch() {
this.setState({
searchMore: !this.state.searchMore
});
},
render() {
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 (
);
}
});
export default AchievementOrderList;