liting2017 7 年之前
父節點
當前提交
4cb15e851a

+ 42 - 7
js/component/manageCenter/customer/customerData/myClient.jsx

@@ -440,6 +440,14 @@ const MyClient = Form.create()(React.createClass({
 	                  onChange={(e) => { record.position = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{width:'120px'}}/>
 	                  onChange={(e) => { record.position = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{width:'120px'}}/>
 					}
 					}
 				}, {
 				}, {
+                    title: '主要联系人',
+                    dataIndex: 'major',
+                    width:100,
+                    key: 'major',
+                    render:(text) => {
+                    	return text?'是':"否"
+                    }
+                },{
 					title: '手机号码',
 					title: '手机号码',
 					dataIndex: 'mobile',
 					dataIndex: 'mobile',
 					key: 'mobile',
 					key: 'mobile',
@@ -477,11 +485,13 @@ const MyClient = Form.create()(React.createClass({
 					dataIndex: 'dels',
 					dataIndex: 'dels',
 					key: 'dels',
 					key: 'dels',
 					render: (text, record, index) => {
 					render: (text, record, index) => {
-						return <div>
-                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
-							    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
-							</Popconfirm>
-                        </div>
+						return <div>{adminData.isSuperAdmin ? 
+		                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
+									    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
+									</Popconfirm>
+									:''}
+								{record.name?<Button style={{marginRight:'10px',color:'#ffffff',background:'green',border:'none'}} onClick={(e)=>{e.stopPropagation(),this.mainContact(record)}}>设为主要联系人</Button>:''}
+                            </div>
 					}
 					}
 				}
 				}
 			],
 			],
@@ -583,7 +593,32 @@ const MyClient = Form.create()(React.createClass({
 			searchTime: [, ]
 			searchTime: [, ]
 		};
 		};
 	},
 	},
-
+	//选择主要联系人
+	mainContact(record){
+		this.setState({
+			loading: true
+		});
+		$.ajax({
+			method: "get",
+			dataType: "json",
+			crossDomain: false,
+			url: globalConfig.context + "/api/admin/customer/updateMainContact",
+			data: {
+				uid:this.state.rowId,
+				ocbId: record.id 
+			}
+		}).done(function(data) {
+			if(!data.error.length) {
+				message.success('设为主要联系人成功!');
+				this.setState({
+					loading: false,
+				});
+			} else {
+				message.warning(data.error[0].message);
+			};
+			this.contactLists(this.state.rowId);
+		}.bind(this));
+	},
 	//更多操作
 	//更多操作
 	ModalOperation() {
 	ModalOperation() {
 		this.setState({
 		this.setState({
@@ -2190,7 +2225,7 @@ const MyClient = Form.create()(React.createClass({
                 <Modal	
                 <Modal	
 				      className="customeDetails"				      
 				      className="customeDetails"				      
 			          title="单位客户详情"
 			          title="单位客户详情"
-			          width='1200px'
+			          width='1300px'
 			          visible={this.state.modal5Visible}
 			          visible={this.state.modal5Visible}
 			          onOk={this.detailsModal}
 			          onOk={this.detailsModal}
 			          onCancel={this.detailsModal}
 			          onCancel={this.detailsModal}

+ 1 - 0
js/component/manageCenter/customer/customerManagement/organizationManages.jsx

@@ -487,6 +487,7 @@ const PublicCustomer = Form.create()(React.createClass({
 					dataIndex: 'dels',
 					dataIndex: 'dels',
 					key: 'dels',
 					key: 'dels',
 					render: (text, record, index) => {
 					render: (text, record, index) => {
+						console.log(record.name)
 						return <div>{adminData.isSuperAdmin ? 
 						return <div>{adminData.isSuperAdmin ? 
 		                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
 		                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
 									    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
 									    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>

+ 43 - 8
js/component/manageCenter/customer/individualCustomer/individualCustomer.jsx

@@ -447,7 +447,15 @@ const IndividualCustomer = Form.create()(React.createClass({
 						return <Input value={record.position} placeholder="联系人职务" key={record.id}
 						return <Input value={record.position} placeholder="联系人职务" key={record.id}
 	                  onChange={(e) => { record.position = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{width:'120px'}}/>
 	                  onChange={(e) => { record.position = e.target.value; this.setState({ contactList: this.state.contactList }); }} style={{width:'120px'}}/>
 					}
 					}
-				}, {
+				},  {
+                    title: '主要联系人',
+                    dataIndex: 'major',
+                    width:100,
+                    key: 'major',
+                    render:(text) => {
+                    	return text?'是':"否"
+                    }
+                },{
 					title: '手机号码',
 					title: '手机号码',
 					dataIndex: 'mobile',
 					dataIndex: 'mobile',
 					key: 'mobile',
 					key: 'mobile',
@@ -485,11 +493,13 @@ const IndividualCustomer = Form.create()(React.createClass({
 					dataIndex: 'dels',
 					dataIndex: 'dels',
 					key: 'dels',
 					key: 'dels',
 					render: (text, record, index) => {
 					render: (text, record, index) => {
-						return <div>
-                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
-							    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
-							</Popconfirm>
-                        </div>
+						return <div>{adminData.isSuperAdmin ? 
+		                            <Popconfirm title="是否删除?" onConfirm={(e)=>{this.confirmDelet(record)}} okText="删除" cancelText="不删除">
+									    <Button style={{marginRight:'10px',color:'#ffffff',background:'#f00',border:'none'}}>删除</Button>
+									</Popconfirm>
+									:''}
+								{record.name?<Button style={{marginRight:'10px',color:'#ffffff',background:'green',border:'none'}} onClick={(e)=>{e.stopPropagation(),this.mainContact(record)}}>设为主要联系人</Button>:''}
+                            </div>
 					}
 					}
 				}
 				}
 			],
 			],
@@ -600,7 +610,32 @@ const IndividualCustomer = Form.create()(React.createClass({
 			searchTime: [, ]
 			searchTime: [, ]
 		};
 		};
 	},
 	},
-
+	//选择主要联系人
+	mainContact(record){
+		this.setState({
+			loading: true
+		});
+		$.ajax({
+			method: "get",
+			dataType: "json",
+			crossDomain: false,
+			url: globalConfig.context + "/api/admin/customer/updateMainContact",
+			data: {
+				uid:this.state.rowId,
+				ocbId: record.id 
+			}
+		}).done(function(data) {
+			if(!data.error.length) {
+				message.success('设为主要联系人成功!');
+				this.setState({
+					loading: false,
+				});
+			} else {
+				message.warning(data.error[0].message);
+			};
+			this.contactLists(this.state.rowId);
+		}.bind(this));
+	},
 	//更多操作
 	//更多操作
 	ModalOperation() {
 	ModalOperation() {
 		this.setState({
 		this.setState({
@@ -2263,7 +2298,7 @@ const IndividualCustomer = Form.create()(React.createClass({
                 <Modal	
                 <Modal	
 				      className="customeDetails"				      
 				      className="customeDetails"				      
 			          title="个人客户详情"
 			          title="个人客户详情"
-			          width='1200px'
+			          width='1300px'
 			          visible={this.state.modal5Visible}
 			          visible={this.state.modal5Visible}
 			          onOk={this.detailsModal}
 			          onOk={this.detailsModal}
 			          onCancel={this.detailsModal}
 			          onCancel={this.detailsModal}