liting2017 7 years ago
parent
commit
244aab5c88
1 changed files with 135 additions and 62 deletions
  1. 135 62
      js/component/manageCenter/customer/companyCustomer.jsx

+ 135 - 62
js/component/manageCenter/customer/companyCustomer.jsx

@@ -4,6 +4,7 @@ import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import moment from 'moment';
 import './myClient.less';
+const { Column, ColumnGroup } = Table;
 import { orderStatusList,cityArr,customerStatus,intentionalService,newFollow} from '../../dataDic.js';
 import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js';
 
@@ -16,7 +17,7 @@ const PublicCustomer = React.createClass({
         this.state.data = [];
         this.setState({
             loading: true
-        });
+        });        
         $.ajax({
             method: "post",
             dataType: "json",
@@ -26,13 +27,13 @@ const PublicCustomer = React.createClass({
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,               
                 companyName: this.state.companyName, //名称1                
-								customerType: this.state.customerType, //客户类型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,//最新跟进进度
+				customerStatus:this.state.customerStatust,//客户状态1
+				contactName:this.state.contactName,//联系人姓名1							
+				contactTel:this.state.contactTel,//联系人手机
+				companyIntention:this.state.companyIntention,//意向服务
+                followSituation:this.state.followSituationt,//最新跟进进度
 				//releaseDateStartDate: this.state.releaseDate[0],
                 //releaseDateEndDate: this.state.releaseDate[1],			
             },
@@ -69,7 +70,8 @@ const PublicCustomer = React.createClass({
                    
                     this.state.pagination.current = data.data.pageNo;
                     this.state.pagination.total = data.data.totalCount;
-                };               
+                };   
+                
                 this.setState({
                     dataSource: theArr,
                     pagination: this.state.pagination
@@ -80,55 +82,14 @@ const PublicCustomer = React.createClass({
                 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',
+            url: globalConfig.context + '/api/admin/customer/findAllCustomerDetails',
             data: {
                 id: deletedIds
             },
@@ -317,15 +278,17 @@ const PublicCustomer = React.createClass({
     },
     tableRowClick(record) {
         this.state.RowData = record;
-        this.setok(record.id);
-        this.handleSubmit(record.id) 
+        this.setok(record.id);       
         this.setState({
         	hids:record.id
         })
     },
-    tableRow(record) {            
-        console.log(record)         
-    },
+    //点击消失函数
+	setModal3Visiblecancel(e) {
+	    this.setState({ 
+	    	modal3Visible:false
+	    });	   	    
+	},   
     closeDesc(e, s) {
         this.state.showDesc = e;
         if (s) {
@@ -416,6 +379,72 @@ const PublicCustomer = React.createClass({
 	    	 visible1:false
 	    });	   	    
 	},
+	//点击查看跟进记录,点击最新跟进的第一个按钮(跟进状态)执行的函数,将会出现很多跟进列表
+	setModal3VisibleOk(e) {		
+		this.setState({ modal3Visible:true });			  
+        this.state.data = [];
+        this.setState({
+            loading: 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;               
+            };            
+        };       
+        $.ajax({
+            method: "get",
+            dataType: "json",
+            crossDomain: false,          
+            url:globalConfig.context + '/api/admin/customer/listAllFollowUpRecord',
+            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));
+    }, 
+    
     render() {
     	  const theData = this.state.data || {}; 
         const rowSelection = {
@@ -452,8 +481,8 @@ const PublicCustomer = React.createClass({
                     </Select>
                     <Select placeholder="跟进进度"
                             style={{ width: 160 }}
-                            value={this.state.followSituation}
-                            onChange={(e) => { this.setState({ followSituation: e }) }}>
+                            value={this.state.followSituationt}
+                            onChange={(e) => { this.setState({ followSituationt: e }) }}>
                             {this.state.newOption}
                     </Select>
                     <Select placeholder="地区"
@@ -463,12 +492,13 @@ const PublicCustomer = React.createClass({
                             {this.state.auditStatusOption}
                     </Select>
                     <Select placeholder="客户状态" style={{ width: 120 }}
-                            value={this.state.customerStatus}
-                            onChange={(e) => { this.setState({customerStatus: e }) }}>                           
+                            value={this.state.customerStatust}
+                            onChange={(e) => { this.setState({customerStatust: e }) }}>                           
                             {this.state.customerStatuarr}
                     </Select>
                     <Button type="primary" onClick={this.search}>搜索</Button>
-                    <Button onClick={this.reset}>重置</Button>                                                                                          
+                    <Button onClick={this.reset}>重置</Button> 
+                    <Button onClick={this.setModal3VisibleOk} style={{marginRight:'10px'}}  disabled={!hasSelected}>查看跟进记录</Button>
                     <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
                     <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>                    			                  
 		                <Input placeholder="联系人姓名" style={{width:'140px',marginRight:'10px'}}
@@ -553,7 +583,50 @@ const PublicCustomer = React.createClass({
 	                            pagination={this.state.pagination}
 	                            />
 	                    </Spin>            
-                    </Modal>
+                </Modal>
+                <Modal
+				      footer=''
+			          title="历史记录列表"
+			          width='800px'
+			          visible={this.state.modal3Visible}
+			          onOk={this.setModal3Visiblecancel}
+			          onCancel={this.setModal3Visiblecancel}							          							          
+			        >	
+			          <Spin spinning={this.state.loading}>	
+						    <Table dataSource={this.state.datahistory} >												    
+						      <Column
+						        title="时间"
+						        dataIndex="_followDate"
+						        key="_followDate"
+						      />
+						      <Column
+						        title="客户"
+						        dataIndex="contactName"
+						        key="contactName"						       						        							       
+						      />													    
+						    <Column
+						      title="跟进人"
+						      dataIndex="adminName"
+						      key="adminName"
+						    />
+						    <Column
+						      title="联系方式"
+						      dataIndex="contactInfo"
+						      key="contactInfo"
+						    />
+						    <Column
+						      title="最新跟进状态"
+						      dataIndex="_followSituation"
+						      key="_followSituation"
+						    />
+						   <Column
+						      title="跟进结果"
+						      dataIndex="followResult"
+						      key="followResult"							     									      
+							/>									  
+						</Table>
+			        </Spin>	
+				</Modal>
             </div >
         );
     }