Browse Source

跟进管理列表

mentoswzq 4 years ago
parent
commit
6b5b67e8c4

+ 40 - 1
js/component/manageCenter/customer/NEW/intentionCustomer/intentionCustomer.jsx

@@ -241,7 +241,11 @@ const IntentionCustomer = Form.create()(
             key: "abc",
             render: (text, record, index) => {
               return (
-                <div>
+                <div style={{
+                  display: 'flex',
+                  flexFlow:'row',
+                  alignItems:'center',
+                }}>
                   <Button
                     onClick={(e) => {
                       e.stopPropagation(), this.visit(record);
@@ -250,11 +254,42 @@ const IntentionCustomer = Form.create()(
                   >
                     客户跟进
                   </Button>
+                  <div
+                      onClick={(e)=>{
+                        e.stopPropagation();
+                        this.setState({
+                          tabsKey:"4",
+                        },()=>{
+                          this.tableRowClick(record)
+                        })
+                      }}
+                      style={{
+                        marginLeft:'10px',
+                        width:'60px',
+                        height:'60px',
+                        borderRadio:'50px',
+                        background:'#58a3ff',
+                        display: 'flex',
+                        padding: '3px',
+                        flexFlow: 'column',
+                        alignItems: 'center',
+                        borderRadius: '60px',
+                        backgroundClip: 'content-box',
+                        justifyContent: 'center',
+                        boxShadow: '2px 1px 6px -1px rgba(0,0,0,.6)',
+                        fontSize: '16px',
+                        color: '#FFFFFF',
+                        cursor: 'pointer',
+                      }}>
+                    <div>指导</div>
+                    <div>意见</div>
+                  </div>
                 </div>
               );
             },
           },
         ],
+        tabsKey:'',
         data: [],
         dataman: [],
         dataSource: [],
@@ -397,6 +432,9 @@ const IntentionCustomer = Form.create()(
       this.state.visitModul = e;
       this.state.modalVisible = e;
       this.state.showDesc = e;
+      this.setState({
+        tabsKey: '',
+      })
       if (s) {
         this.loadData(this.state.ispage);
       }
@@ -904,6 +942,7 @@ const IntentionCustomer = Form.create()(
             closeDesc={this.closeDesc}
           />
           <IntentionDetail
+            tabsKey={this.state.tabsKey}
             categoryArr={this.state.categoryArr}
             detailApi={this.props.detailApi}
             IntentionData={this.state.RowData}

+ 13 - 4
js/component/manageCenter/customer/NEW/intentionCustomer/intentionDetail/detail/account.jsx

@@ -99,6 +99,7 @@ const Account =React.createClass({
 			labelCol: { span: 8 },
 			wrapperCol: { span: 14 },
 		};
+		//this.props.isGuidanceLv  //也用于判断是否为跟进管理页面
 		return(
 			<div className="clearfix">
     			<Form layout="horizontal" id="demand-form" onSubmit={this.accountSave} >
@@ -111,12 +112,20 @@ const Account =React.createClass({
 	                    <FormItem className="half-item"
 	                            {...formItemLayout}
 	                            label="注册用户名" >
-	                         <Input value={this.state.nickname}  onChange={(e) => { this.setState({ nickname: e.target.value }); }} />        
+							{
+								this.props.isGuidanceLv ?
+								<span>{this.state.nickname}</span>:
+								<Input value={this.state.nickname}  onChange={(e) => { this.setState({ nickname: e.target.value }); }} />
+							}
 	                    </FormItem>
 	                    <FormItem className="half-item"
 	                            {...formItemLayout}
 	                            label="注册邮箱" >
-	                         <Input value={this.state.email}  onChange={(e) => { this.setState({ email: e.target.value }); }} />        
+							{
+								this.props.isGuidanceLv ?
+									<span>{this.state.email}</span>:
+									<Input value={this.state.email}  onChange={(e) => { this.setState({ email: e.target.value }); }} />
+							}
 	                    </FormItem>
 	                    <div className="clearfix">
 		                    <FormItem className="half-item"
@@ -142,10 +151,10 @@ const Account =React.createClass({
                             {/*  </Select>*/}
 	                   		{/*</FormItem>*/}
 	                   	</div>
-			            <div className="clearfix">
+						{!this.props.isGuidanceLv ? <div className="clearfix">
 			                <Button className='saveBtn' type="primary" htmlType="submit">保存</Button>  
                             <Button  type="ghost" onClick={this.detailsModal}>取消</Button>
-			            </div>
+			            </div> : <div/>}
     				</Spin>
     			</Form>	
     		</div>

+ 165 - 51
js/component/manageCenter/customer/NEW/intentionCustomer/intentionDetail/detail/visit.jsx

@@ -1,11 +1,13 @@
 import React from 'react';
-import {Form, Button, Spin, message, Table, Popconfirm, Input, Modal} from 'antd';
+import {Form, Button, Spin, message, Table, Tooltip, Input, Modal} from 'antd';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
 import FollowDetail from '../../followDetail.jsx'
 import {getContactType} from '@/tools.js';
 import VisitDetail from './visitDetail.jsx';
 
+const confirm = Modal.confirm;
+
 const Visit = React.createClass({
 	getInitialState(){
 		return {
@@ -13,6 +15,8 @@ const Visit = React.createClass({
       loading: false,
       visitModul: false,
       visitModuls: false,
+	  followId:0,
+	  ispage:1,
       paginations: {
         defaultCurrent: 1,
         defaultPageSize: 10,
@@ -88,7 +92,65 @@ const Visit = React.createClass({
           title: "跟进时间",
           dataIndex: "followTime",
           key: "followTime",
-        }
+        },
+		{
+		  title: "指导意见",
+		  dataIndex: "abc",
+		  key: "abc",
+		  render: (text, record) => {
+			  return (
+				  <div>
+					  {record.guidance ?
+						  <div style={{
+							  cursor:"pointer",
+							  width: '150px',
+							  whiteSpace: 'nowrap',
+							  overflow: 'hidden',
+							  textOverflow: 'ellipsis',
+						  }}
+						  onClick={(e)=>{
+							e.stopPropagation();
+							  Modal.info({
+								  title: '指导意见',
+								  content: (
+									  <div style={{
+									  	wordWrap:"break-word"
+									  }}>
+										  {record.guidance}
+									  </div>
+								  ),
+								  onOk() {},
+							  });
+						  }}>
+							  <span>
+								{record.guidance}
+							  </span>
+					  </div> : (this.props.isEditGuidanceLv ? <Button
+						  onClick={(e) => {
+							  e.stopPropagation();
+							  this.setState({
+								  guidanceVisible: true,
+								  followId: record.followId
+							  })
+						  }}
+						  type="primary"
+					  >
+						  立即指导
+					  </Button> : <span>暂未指导</span>)}
+				  </div>
+			  );
+		  },
+		},
+		{
+		  title: "指导时间",
+		  dataIndex: "guidanceTime",
+		  key: "guidanceTime",
+		  render: (text, record) => {
+			  return (
+				  <span>{text ? text : '无'}</span>
+			  )
+		  }
+		}
       ],
 	  guidanceVisible: false,
 	  guidance: ''
@@ -144,22 +206,13 @@ const Visit = React.createClass({
 				} else {
 					for(let i = 0; i < data.data.list.length; i++) {
 						let thisdata = data.data.list[i];
-						theArr.push({
-							readOnly:thisdata.readOnly,
-							followId: thisdata.followId,
-							followTime: thisdata.followTime,
-							identifyName: thisdata.identifyName,
-							contacts: thisdata.contacts,
-							contactMobile: thisdata.contactMobile,
-							result: thisdata.result,
-							adminName: thisdata.adminName,
-							followSituation: thisdata.followSituation,
-							customerStatus: thisdata.customerStatus,
-							contactType: thisdata.contactType
-						});
+						theArr.push(thisdata);
 					};
 					this.state.paginations.current = data.data.pageNo;
 					this.state.paginations.total = data.data.totalCount;
+					this.setState({
+						ispage: data.data.pageNo
+					})
 				};
 				if(data.data.list&&!data.data.list.length){
 					this.state.paginations.current =0;
@@ -178,37 +231,6 @@ const Visit = React.createClass({
 	},
 	componentWillMount(){
 		this.loadVisit();
-		if(this.props.isGuidanceLv){								//是否可指导
-			let arr = this.state.visitsList.concat();
-			arr.push({
-				title: "指导意见",
-				dataIndex: "abc",
-				key: "abc",
-				render: (text, record) => {
-					return (
-						<div>
-							{/*<div style={{width:'200px'}}>*/}
-							{/*	<span style={{wordWrap:"break-word"}}>*/}
-							{/*		11*/}
-							{/*	</span>*/}
-							{/*</div>*/}
-							<Button
-								onClick={(e) => {
-									e.stopPropagation();
-
-								}}
-								type="primary"
-							>
-								立即指导
-							</Button>
-						</div>
-					);
-				},
-			})
-			this.setState({
-				visitsList: arr
-			});
-		}
 	},
 	detailsModal(){
 		this.props.closeDetail(false, false)
@@ -237,6 +259,38 @@ const Visit = React.createClass({
 			this.loadVisit()
 		}
 	},
+	//发布指导意见
+	releaseGuidance(e){
+		e.stopPropagation();
+		if(!this.state.guidance){
+			message.info('指导意见不能为空')
+			return;
+		}
+		this.setState({
+			loading: true,
+		});
+		$.ajax({
+			method: "post",
+			dataType: "json",
+			crossDomain: false,
+			url: globalConfig.context + "/api/admin/customer/addGuidance",
+			data: {
+				guidance: this.state.guidance,
+				followId: this.state.followId,
+			},
+		}).done(function(data) {
+			if(!data.error.length) {
+				message.success("发布成功");
+				this.loadVisit(this.state.ispage);
+				this.setState({
+					loading: false,
+					guidanceVisible: false,
+				});
+			} else {
+				message.warning(data.error[0].message);
+			}
+		}.bind(this));
+	},
 	componentWillReceiveProps(nextProps) {
 		if(nextProps.data.id&&nextProps.visitState){
 			this.loadVisit()
@@ -248,18 +302,19 @@ const Visit = React.createClass({
 	render(){
 		return(
 			<div className="clearfix">
-				<Button
+				{!this.props.isGuidanceLv ? <Button
                     onClick={(e) => {
-                      e.stopPropagation(), this.visit();
+                      e.stopPropagation();
+                      this.visit();
                     }}
 					type="primary"
 					style={{marginTop:'10px',float: 'right'}}
                   >
                     客户跟进
-                  </Button>
+                  </Button> : <div/>}
 			    <Spin spinning={this.state.loading}>
-				  <Table 
-				     style={{marginTop:'60px'}}
+				  <Table
+				     style={{marginTop:this.props.isGuidanceLv ? '0px' : '60px'}}
 	            	 pagination={this.state.paginations}
 	            	 columns={this.state.visitsList} 
 	            	 dataSource={this.state.visitArrList}
@@ -280,6 +335,65 @@ const Visit = React.createClass({
 					closeDesc={this.closeDesc}
 					loadData={this.loadVisit}
 				/>
+				{/*指导意见*/}
+				{this.state.guidanceVisible ? <Modal
+					className="customeDetails"
+					title="指导意见"
+					width='500px'
+					visible={this.state.guidanceVisible}
+					onOk={()=>{
+						this.setState({
+							guidanceVisible: false,
+							guidance: '',
+						},()=>{
+							this.loadVisit();
+						})
+					}}
+					onCancel={()=>{
+						this.setState({
+							guidanceVisible: false,
+							guidance: '',
+						},()=>{
+							this.loadVisit();
+						})
+					}}
+					footer=''
+				>
+					<Spin spinning={this.state.loading}>
+						<div style={{
+							display:'flex',
+							flexFlow:'column',
+						}}>
+							<Input
+								style={{ width: '400px',height:'50px' }}
+								placeholder="请输入指导意见"
+								type={'textarea'}
+								onChange={(e)=>{
+									this.setState({
+										guidance: e.target.value,
+									})
+								}}
+							/>
+							<Button
+								type="primary"
+								style={{ marginTop: "10px", marginBottom: '10px' }}
+								onClick={(e)=>{
+									let _this = this;
+									confirm({
+										title: '确定要提交本次指导意见吗?',
+										content: '指导意见提交成功后无法修改',
+										onOk() {
+											_this.releaseGuidance(e);
+										},
+										onCancel() {},
+									});
+								}}
+							>
+								保存
+							</Button>
+						</div>
+					</Spin>
+				</Modal> : <div/>}
 			</div>	
 		)
 	}

+ 9 - 7
js/component/manageCenter/customer/NEW/intentionCustomer/intentionDetail/intentionDetail.jsx

@@ -101,7 +101,7 @@ const IntentionDetail = React.createClass({
 		if(nextProps.modalVisible && nextProps.IntentionData.id) {
 			this.setState({
 				modalVisible:true,
-				callnub:(this.props.detailApi.indexOf('Organization'))>0?"2":'1',
+				callnub:this.props.isGuidanceLv ? (this.props.tabsKey ? this.props.tabsKey : "3") : (this.props.tabsKey ? this.props.tabsKey : (this.props.detailApi.indexOf('Organization'))>0?"2":'1'),
 			})
 		};
 		this.setState({
@@ -112,7 +112,7 @@ const IntentionDetail = React.createClass({
 	render(){
 		return(
 			<div>
-				 <Modal	
+				{this.state.modalVisible ? <Modal
 				      className="customeDetails"				      
 			          title="意向客户详情"
 			          width='1300px'
@@ -122,7 +122,7 @@ const IntentionDetail = React.createClass({
 			          footer=''
 			        >				    
 					     <Tabs onChange={this.callback} activeKey={this.state.callnub}>
-						    {this.props.detailApi.indexOf('Organization')>0?"":
+						    {this.props.isGuidanceLv || this.props.detailApi.indexOf('Organization')>0?"":
 						    <TabPane tab="基本信息" key="1">
 						        <BasicPerson 
 						        	detailApi={this.props.detailApi}
@@ -133,16 +133,17 @@ const IntentionDetail = React.createClass({
 						        />
 						       
 							</TabPane>}
-						    <TabPane tab="联系人信息" key="2">
+							 {!this.props.isGuidanceLv ? <TabPane tab="联系人信息" key="2">
 						        <ContactPerson 
 									closeDetail={this.closeDetail}
 									name={this.props.name}
 							        data={this.props.IntentionData}
 							        contactState={this.state.contactState}
 							    />
-						    </TabPane>
+						    </TabPane> : ""}
 						    <TabPane tab="账户信息" key="3">
-					    		<Account 
+					    		<Account
+									 isGuidanceLv={this.props.isGuidanceLv}  //用于判断是否为跟进管理页面
 					    			 closeDetail={this.closeDetail}
 							         data={this.props.IntentionData}
 							         accountState={this.state.accountState}
@@ -151,6 +152,7 @@ const IntentionDetail = React.createClass({
 							<TabPane tab="客户跟进" key="4">
 							    <Visit
 									isGuidanceLv={this.props.isGuidanceLv}
+									isEditGuidanceLv={this.props.isEditGuidanceLv}
 						     		categoryArr={this.props.categoryArr}
 						     		closeDetail={this.closeDetail}
 							        data={this.props.IntentionData}
@@ -165,7 +167,7 @@ const IntentionDetail = React.createClass({
 							    />
 							</TabPane>
 						</Tabs>
-    			</Modal>
+    			</Modal> : <div/>}
 			</div>
 		)
 	}

+ 15 - 4
js/component/manageCenter/customer/content.jsx

@@ -313,15 +313,26 @@ class Content extends Component {
                     });
                 });
                 break;
-            //跟进管理
+            //跟进管理   营销经理
             case 'customerFollow':
                 require.ensure([], () => {
                     const CustomerFollow = require('./managementFollow/customerFollow/index').default;
                     this.setState({
                         component: <CustomerFollow
-                            isGuidanceLv={true}//是否可指导
-                            ApiUrl={'/api/admin/customer/listPrivateOrganizationCustomer'}
-                            detailApi={'/api/admin/customer/findOrganizationCustomerDetail'}
+                            isGuidanceLv={true}         //是否可查看指导  也用于判断是否为跟进管理页面
+                            isEditGuidanceLv={true}     //是否可以编辑指导
+                        />
+                    });
+                });
+                break;
+            //跟进管理   营销总监 和 总裁
+            case 'readOnlyCustomerFollow':
+                require.ensure([], () => {
+                    const CustomerFollow = require('./managementFollow/customerFollow/index').default;
+                    this.setState({
+                        component: <CustomerFollow
+                            isGuidanceLv={true}         //是否可查看指导  也用于判断是否为跟进管理页面
+                            isEditGuidanceLv={false}     //是否可以编辑指导
                         />
                     });
                 });

+ 44 - 9
js/component/manageCenter/customer/managementFollow/customerFollow/index.jsx

@@ -33,6 +33,7 @@ class CustomerFollow extends Component{
             level: '',
             releaseDate: [],
             selectedRowKeys: [],
+            sortType: 0,
 
             provinces: [],
             dataSource: [],
@@ -102,6 +103,8 @@ class CustomerFollow extends Component{
                     title: "最新跟进时间",
                     dataIndex: "lastFollowTime",
                     key: "lastFollowTime",
+                    //0无 1转换倒序 2转换正序
+                    sorter: true,
                 },
                 {
                     title: "客户等级",
@@ -121,8 +124,8 @@ class CustomerFollow extends Component{
                 },
                 {
                     title: "跟进人",
-                    dataIndex: "null",
-                    key: "null",
+                    dataIndex: "aName",
+                    key: "aName",
                 },
                 {
                     title: "跟进操作",
@@ -135,8 +138,10 @@ class CustomerFollow extends Component{
                                     onClick={(e) => {
                                         e.stopPropagation();
                                         this.setState({
-                                            guidanceVisible: true
-                                        });
+                                            tabsKey:"4",
+                                        },()=>{
+                                            this.tableRowClick(record)
+                                        })
                                     }}
                                     type="primary"
                                 >
@@ -150,6 +155,7 @@ class CustomerFollow extends Component{
             loading: false,
             ispage: 1,
             guidance: '',
+            tabsKey:'',
         };
         this.callback = this.callback.bind(this);
         this.loadData = this.loadData.bind(this);
@@ -185,9 +191,9 @@ class CustomerFollow extends Component{
         this.setState({
             loading: true,
         });
-        let api = '/api/admin/customer/listPrivateOrganizationCustomer';
+        let api = '/api/admin/customer/listFollowManagement';
         $.ajax({
-            method: "post",
+            method: "get",
             dataType: "json",
             crossDomain: false,
             url: globalConfig.context + api,
@@ -204,10 +210,11 @@ class CustomerFollow extends Component{
                     : this.state.addressSearch[1],
                 startDate: this.state.releaseDate[0],
                 endDate: this.state.releaseDate[1],
+                sortType:this.state.sortType,
             },
             success: function (data) {
                 let theArr = [];
-                if (data.error.length || data.data.list == "") {
+                if (data.error.length !== 0) {
                     if (data.error && data.error.length) {
                         message.warning(data.error[0].message);
                     }
@@ -257,6 +264,7 @@ class CustomerFollow extends Component{
             level: '',
             releaseDate: [],
             selectedRowKeys: [],
+            sortType: 0,
         },()=>{
             this.loadData();
         });
@@ -292,7 +300,7 @@ class CustomerFollow extends Component{
         });
     }
 
-    tableRowClick(record){
+    tableRowClick(record){      //key 控制弹窗初始显示第几级
         this.setState({
             selectedRowKeys: [],
             modalVisible: true,
@@ -309,6 +317,7 @@ class CustomerFollow extends Component{
             visitModul: e,
             modalVisible: e,
             showDesc: e,
+            tabsKey: '',
         })
         if (s) {
             this.loadData(this.state.ispage);
@@ -358,7 +367,7 @@ class CustomerFollow extends Component{
         return(
             <div className="user-content">
                 <div className="content-title">
-                    <span>客戶跟进管理</span>
+                    <span>指导意见</span>
                 </div>
                 <div className="user-search">
                     <Tabs
@@ -441,15 +450,41 @@ class CustomerFollow extends Component{
                             // rowSelection={rowSelection}
                             pagination={this.state.pagination}
                             onRowClick={this.tableRowClick}
+                            onChange={(pagination, filters, sorter)=>{
+                                //0 正序 1倒序
+                                if(sorter.order === 'ascend'){              //倒序
+                                    this.setState({
+                                        sortType: 1
+                                    },()=>{
+                                        this.loadData(pagination.current)
+                                    });
+                                }else if (sorter.order === 'descend'){      //正序
+                                    this.setState({
+                                        sortType: 0
+                                    },()=>{
+                                        this.loadData(pagination.current)
+                                    });
+                                }else if (typeof sorter.order === 'undefined'){       //正常
+                                    this.setState({
+                                        sortType: 0
+                                    },()=>{
+                                        this.loadData(pagination.current)
+                                    });
+                                }
+
+                            }
+                            }
                         />
                     </Spin>
                 </div>
                 <IntentionDetail
                     isGuidanceLv={this.props.isGuidanceLv}
+                    isEditGuidanceLv={this.props.isEditGuidanceLv}
                     categoryArr={this.state.categoryArr}
                     detailApi={this.props.detailApi}
                     IntentionData={this.state.rowData}
                     modalVisible={this.state.modalVisible}
+                    tabsKey={this.state.tabsKey}
                     name={this.state.modalName}
                     closeDesc={this.closeDesc}
                     basicState={this.state.basicState}