HW 3 years ago
parent
commit
4dae45042e

+ 32 - 0
js/component/dataDic.js

@@ -1413,6 +1413,10 @@ module.exports = {
       value: "1",
       key: "已签单客户",
     },
+    {
+      value: "2",
+      key: "渠道客户",
+    },
   ],
   //性别
   sex: [
@@ -1525,6 +1529,34 @@ module.exports = {
       key: "其他个人",
     },
   ],
+  //渠道分配状态
+  //0未分配  1已分配 2已存在私有 3已存在公共 4已存在签单 5回退
+  channelAllocationStatus:[
+    {
+      value: "0",
+      key: "未分配",
+    },
+    {
+      value: "1",
+      key: "已分配",
+    },
+    {
+      value: "2",
+      key: "已存在私有",
+    },
+    {
+      value: "3",
+      key: "已存在公共",
+    },
+    {
+      value: "4",
+      key: "已存在签单",
+    },
+    {
+      value: "5",
+      key: "回退",
+    },
+  ],
   //账户状态
   statuslist: [
     {

+ 158 - 114
js/component/manageCenter/customer/NEW/intentionCustomer/channel.jsx

@@ -4,27 +4,31 @@ import {
     Button,
     Cascader,
     DatePicker,
-    Icon,
     Input,
-    message, Modal,
+    message,
     Select,
     Spin,
     Table,
-    Tabs,
+    Tabs, Tooltip,
     Upload
 } from "antd";
 import {ChooseList} from "../../../order/orderNew/chooseList";
 import $ from "jquery/src/ajax";
 import {
     getSocialAttribute,
-    ShowModal
+    ShowModal,
+    getChannelAllocationStatus
 } from "@/tools.js";
+import {
+    channelAllocationStatus
+} from "@/dataDic.js";
 import { citySelect, provinceList } from '@/NewDicProvinceList';
 import moment from "moment";
 import FollowDetail from "./followDetail";
 import IntentionDetail from "./intentionDetail/intentionDetail";
 import TransferRecords from './transferRecords';
 import DuplicateData from './duplicateData';
+import OperationTips from './operationTips';
 
 const {TabPane} = Tabs;
 const { RangePicker } = DatePicker;
@@ -38,6 +42,24 @@ class Channel extends Component{
                     title: "客户名称",
                     dataIndex: "userName",
                     key: "userName",
+                    render: (text,record) => {
+                        return (
+                            <span>
+                                {record.status === 5 ? <div style={{
+                                    background:'#ef7207',
+                                    color:'#FFF',
+                                    padding: '1px 7px',
+                                    borderRadius:'5px',
+                                    fontSize:'12px',
+                                    display: 'inline-block',
+                                    marginRight:'10px'
+                                }}>
+                                    回收
+                                </div> : null}
+                                {text}
+				            </span>
+                        )
+                    },
                 },
                 {
                     title: "地区",
@@ -54,8 +76,8 @@ class Channel extends Component{
                 },
                 {
                     title: "渠道专员",
-                    dataIndex: "aName",
-                    key: "aName",
+                    dataIndex: "channelName",
+                    key: "channelName",
                 },
                 {
                     title: "客户联系人",
@@ -77,12 +99,9 @@ class Channel extends Component{
                     dataIndex: "status",
                     key: "status",
                     render: (text) => (
-                        text === 0 ? '未分配' :
-                            text === 1 ? '已存在' :
-                                text === 2 ? '已分配' : ''
+                        getChannelAllocationStatus(text)
                     )
                 },
-
             ],
             changeList:[],
             dataSource:[],
@@ -143,7 +162,6 @@ class Channel extends Component{
             visitModul: false,
             categoryArr:[],
             tabsKey:'',
-            reasonsTransfer:''
         }
         this.loadData = this.loadData.bind(this);
         this.search = this.search.bind(this);
@@ -181,6 +199,16 @@ class Channel extends Component{
 
         if(this.props.followUp){
             this.state.columns.push({
+                title: "当前跟进人",
+                dataIndex: "adminName",
+                key: "adminName",
+                render: (text, record) => {
+                    return (
+                        record.status !== 0 ? text : ''
+                    )
+                }
+            });
+            this.state.columns.push({
                 title: "跟进操作",
                 dataIndex: "abc",
                 key: "abc",
@@ -209,45 +237,64 @@ class Channel extends Component{
                     );
                 },
             });
-            this.state.columns.push({
-                title: "指导意见",
-                dataIndex: "guidance",
-                key: "guidance",
-                render: (text, record, index) => {
-                    return (
-                        <div style={{
-                            display: 'flex',
-                            flexFlow:'row',
-                            alignItems:'center',
-                        }}>
-                            {/*指导 0无 1未读 2已读*/}
-                            {text === 1 || text === 2 ? <Button
-                                style={text === 1 ? {
-                                    background:'#F00000',
-                                    borderColor:'#F00000'
-                                } : {}}
-                                onClick={(e)=>{
-                                    e.stopPropagation();
-                                    this.guidanceRead(record.uid).then(()=>{
-                                        this.setState({
-                                            tabsKey:"4",
-                                        },()=>{
-                                            this.tableRowClick(record)
+            if(this.props.isEditGuidanceLv){
+                this.state.columns.push({
+                    title: "指导意见",
+                    dataIndex: "guidance",
+                    key: "guidance",
+                    render: (text, record, index) => {
+                        return (
+                            <div style={{
+                                display: 'flex',
+                                flexFlow:'row',
+                                alignItems:'center',
+                            }}>
+                                {/*指导 0无 1未读 2已读*/}
+                                {text === 1 || text === 2 ? <Button
+                                    style={text === 1 ? {
+                                        background:'#F00000',
+                                        borderColor:'#F00000'
+                                    } : {}}
+                                    onClick={(e)=>{
+                                        e.stopPropagation();
+                                        this.guidanceRead(record.uid).then(()=>{
+                                            this.setState({
+                                                tabsKey:"4",
+                                            },()=>{
+                                                this.tableRowClick(record)
+                                            })
                                         })
-                                    })
-                                }}
-                                type="primary"
-                            >
-                                {text === 1 ? '未读' : '查看'}
-                            </Button> : <div>暂无指导</div>}
-                        </div>
-                    );
-                },
-            });
-            this.setState({
-                columns:this.state.columns
-            })
+                                    }}
+                                    type="primary"
+                                >
+                                    {text === 1 ? '未读' : '查看'}
+                                </Button> : <div>暂无指导</div>}
+                            </div>
+                        );
+                    },
+                });
+            }
         }
+        this.state.columns.push({
+            title: "备注",
+            dataIndex: "remarks",
+            key: "remarks",
+            render: (text) => {
+             return (
+                 <Tooltip placement="topLeft" title={text}>
+                     <div style={{
+                         maxWidth:'150px',
+                         overflow:'hidden',
+                         textOverflow: "ellipsis",
+                         whiteSpace:'nowrap',
+                     }}>{text}</div>
+                 </Tooltip>
+             )
+            }
+        });
+        this.setState({
+            columns:this.state.columns
+        })
     }
 
     visit(e) {
@@ -267,6 +314,7 @@ class Channel extends Component{
             crossDomain: false,
             url: globalConfig.context + '/api/admin/customer/listChannelCustomer',
             data: {
+                type:this.props.channel ? 1 : undefined,
                 pageNo: pageNo || 1,
                 pageSize: this.state.pagination.pageSize,
                 name: this.state.nameSearch,
@@ -331,6 +379,8 @@ class Channel extends Component{
             addressSearch:[],
             releaseDate:[],
             statusSearch:undefined,
+        },()=>{
+            this.loadData();
         })
     }
 
@@ -494,18 +544,12 @@ class Channel extends Component{
         });
     }
 
-    showConfirm() {
-        this.setState({
-            visible:true
-        })
-    }
-
-    changeAssigner() {
-        if(!this.state.reasonsTransfer){
-            message.warning("请输入转交原因");
+    changeAssigner(remarks,type,lv) {
+        if(!remarks){
+            message.warning(type === 1 ? "请输入转交原因" : type === 2 ? "请输入回收原因" : type === 0 ? "请输入分配原因" : "");
             return;
         }
-        if (this.state.theTypes) {
+        if (this.state.theTypes || lv) {
             let changeIds  = '';
             let oldAid = '';
             for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
@@ -523,18 +567,19 @@ class Channel extends Component{
                 data: {
                     userIds: changeIds, //这一行数据的ID
                     receiveId: this.state.theTypes, //指定转交人的ID
-                    remarks: this.state.reasonsTransfer,
+                    remarks: remarks,
+                    type,// 0分配 1转交 2回退
                 },
             }).done(
                 function (data) {
                     if (!data.error.length) {
-                        message.success("转交成功!");
+                        message.success(type === 1 ? "转交成功!" : type === 2 ? "回收成功!" : type === 0 ? "分配成功!" : "");
                         this.setState({
                             auto: "",
                             loading: false,
                             selectedRowKeys: [],
-                            reasonsTransfer:'',
-                            visible:false
+                            visible:false,
+                            recoveryVisible: false,
                         },()=>{
                             this.loadData(
                                 Math.min(
@@ -597,24 +642,22 @@ class Channel extends Component{
                                     this.setState({ nameSearch: e.target.value });
                                 }}
                             />
-                            {/*0未分配 1已存在 2已分配*/}
+                            {/*0未分配  1已分配 2已存在私有 3已存在公共 4已存在签单*/}
                             <Select
-                                placeholder="状态"
+                                placeholder="分配状态"
                                 style={{ width: 80 }}
                                 value={this.state.statusSearch}
                                 onChange={(e) => {
                                     this.setState({ statusSearch: e });
                                 }}
                             >
-                                <Select.Option value={0}>
-                                    未分配
-                                </Select.Option>
-                                <Select.Option value={1}>
-                                    已存在
-                                </Select.Option>
-                                <Select.Option value={2}>
-                                    已分配
-                                </Select.Option>
+                                {
+                                    channelAllocationStatus.map((v,key)=>(
+                                        <Select.Option value={v.value} key={key}>
+                                            {v.key}
+                                        </Select.Option>
+                                    ))
+                                }
                             </Select>
                             <Select
                                 placeholder="省"
@@ -683,37 +726,41 @@ class Channel extends Component{
                                     type="primary"
                                     onClick={(e) => {
                                         e.stopPropagation();
-                                        this.showConfirm();
+                                        this.setState({
+                                            visible:true
+                                        })
                                     }}
                                     disabled={!hasSelected}
                                     style={{ marginRight: 10 }}
                                 >
                                     {this.props.deliver === 1 ? '分配' : '转交'}
                                 </Button> : ''}
-                                {this.props.deliver === 2 ? <Button
+                                {this.props.recovery ? <Button
                                     type="primary"
                                     onClick={(e) => {
                                         e.stopPropagation();
                                         this.setState({
-                                            transferVisible:true,
-                                            transferId: this.state.selectedRows[0].uid
+                                            recoveryVisible:true
                                         })
                                     }}
-                                    disabled={!hasSelected || this.state.selectedRows.length > 1}
+                                    disabled={!hasSelected}
                                     style={{ marginRight: 10 }}
                                 >
-                                    转交记录
+                                    回收
                                 </Button> : ''}
-                                {this.props.recovery ? <Button
+                                {this.props.deliver || this.props.recovery ? <Button
                                     type="primary"
                                     onClick={(e) => {
                                         e.stopPropagation();
-
+                                        this.setState({
+                                            transferVisible:true,
+                                            transferId: this.state.selectedRows[0].uid
+                                        })
                                     }}
-                                    disabled={!hasSelected}
+                                    disabled={!hasSelected || this.state.selectedRows.length > 1}
                                     style={{ marginRight: 10 }}
                                 >
-                                    回收
+                                    日志
                                 </Button> : ''}
                                 {this.props.channel ? <Upload {...this.state.upLoad}>
                                     <Button
@@ -780,7 +827,7 @@ class Channel extends Component{
                                     : this.state.columns
                             }
                             dataSource={this.state.dataSource}
-                            rowSelection={this.props.deliver ? rowSelection : ''}
+                            rowSelection={this.props.deliver || this.props.recovery ? rowSelection : ''}
                             pagination={this.state.pagination}
                             onRowDoubleClick={this.tableRowClick}
                         />
@@ -812,54 +859,51 @@ class Channel extends Component{
                         this.setState({
                             duplicateData:[],
                             duplicateDataVisible: false
+                        },()=>{
+                            this.loadData();
                         })
                     }}
                 /> : null}
-                {this.state.transferVisible ? <TransferRecords
+                {this.state.transferVisible || this.state.returnVisible ? <TransferRecords
+                    type={this.state.transferVisible ? (this.props.deliver === 1 ? 0 : 1) : this.state.returnVisible ? 2 : 0}
                     id={this.state.transferId}
-                    visible={this.state.transferVisible}
+                    visible={this.state.transferVisible || this.state.returnVisible}
                     cancel={()=>{
                         this.setState({
                             transferVisible:false,
+                            returnVisible: false,
                             transferId:''
                         })
                     }}
                 /> : '' }
-                <Modal
-                    title="渠道客户转交"
+                {/*渠道客户转交*/}
+                {this.state.visible ? <OperationTips
+                    title={'渠道客户转交'}
+                    selectedRows={this.state.selectedRows}
                     visible={this.state.visible}
-                    onOk={()=>{
-                        this.changeAssigner()
+                    onOk={(value)=>{
+                        // 0分配 1转交 2回退
+                        this.changeAssigner(value,this.props.deliver === 1 ? 0 : this.props.deliver === 2 ? 1 : '')
                     }}
                     onCancel={()=>{
                         this.setState({
-                            reasonsTransfer:'',
                             visible:false
                         })
+                    }}/> : ''}
+                {/*渠道客户回收*/}
+                {this.state.recoveryVisible ? <OperationTips
+                    title={'渠道客户回收'}
+                    selectedRows={this.state.selectedRows}
+                    visible={this.state.recoveryVisible}
+                    onOk={(value)=>{
+                        this.changeAssigner(value,2,true)
+
                     }}
-                >
-                    <span style={{ color: "red" }}>
-                        确定要转交以下客户吗?
-                            {
-                                this.state.selectedRows.map((value,index)=>(
-                                    <div key={index} style={{marginTop:'5px',color: "#000"}}>
-                                        {value.userName}
-                                    </div>
-                                ))
-                            }
-                        <div style={{marginTop:20}}>
-                            <span style={{marginRight:10,color:'#000'}}>转交原因:</span>
-                            <Input
-                                placeholder="转交原因"
-                                value={this.state.reasonsTransfer}
-                                style={{ width: 150 }}
-                                onChange={(e) => {
-                                    this.setState({reasonsTransfer : e.target.value });
-                                }}
-                            />
-                        </div>
-                    </span>
-                </Modal>
+                    onCancel={()=>{
+                        this.setState({
+                            recoveryVisible:false
+                        })
+                    }}/> : ''}
             </div>
         )
     }

+ 20 - 10
js/component/manageCenter/customer/NEW/intentionCustomer/duplicateData.jsx

@@ -1,6 +1,6 @@
 import React,{Component} from "react";
-import {Button, message, Modal, Popconfirm, Spin, Table, Tabs} from "antd";
-import {getSocialAttribute,ShowModal} from "@/tools.js";
+import {Button, message, Modal, Popconfirm, Spin, Table, Tabs, Tooltip} from "antd";
+import {getSocialAttribute,ShowModal,getChannelAllocationStatus} from "@/tools.js";
 import $ from "jquery/src/ajax";
 
 const {TabPane} = Tabs;
@@ -29,11 +29,6 @@ class DuplicateData extends Component{
                     },
                 },
                 {
-                    title: "渠道专员",
-                    dataIndex: "aName",
-                    key: "aName",
-                },
-                {
                     title: "客户联系人",
                     dataIndex: "contacts",
                     key: "contacts",
@@ -50,12 +45,27 @@ class DuplicateData extends Component{
                 },
                 {
                     title: "备注",
+                    dataIndex: "remarks",
+                    key: "remarks",
+                    render: (text) => {
+                        return (
+                            <Tooltip placement="topLeft" title={text}>
+                                <div style={{
+                                    maxWidth:'150px',
+                                    overflow:'hidden',
+                                    textOverflow: "ellipsis",
+                                    whiteSpace:'nowrap',
+                                }}>{text}</div>
+                            </Tooltip>
+                        )
+                    }
+                },
+                {
+                    title: "未导入原因",
                     dataIndex: "status",
                     key: "status",
                     render: (text) => (
-                        text === 0 ? '未分配' :
-                            text === 1 ? '已存在' :
-                                text === 2 ? '已分配' : ''
+                        getChannelAllocationStatus(text)
                     )
                 },
             ],

+ 1 - 1
js/component/manageCenter/customer/NEW/intentionCustomer/intentionDetail/detail/contactPerson.jsx

@@ -282,7 +282,7 @@ const ContactPerson = React.createClass({
               createTimes:thisdata.createTimes,
               fixedTel:thisdata.fixedTel,
               aname:thisdata.aname,
-              cityName:thisdata.provinceName+thisdata.cityName+thisdata.areaName
+              cityName:(thisdata.provinceName || '')+(thisdata.cityName || '')+(thisdata.areaName || '')
             });
           }
         }

+ 50 - 0
js/component/manageCenter/customer/NEW/intentionCustomer/operationTips.jsx

@@ -0,0 +1,50 @@
+import React,{Component} from "react";
+import {Input, Modal} from "antd";
+
+class OperationTips extends Component{
+    constructor(props) {
+        super(props);
+        this.state={
+            reasonsTransfer:''
+        }
+    }
+
+    render() {
+        return (
+            <Modal
+                title={this.props.title}
+                visible={this.props.visible}
+                onOk={()=>{
+                    this.props.onOk(this.state.reasonsTransfer);
+                }}
+                onCancel={()=>{
+                    this.props.onCancel();
+                }}
+            >
+                    <span style={{ color: "red" }}>
+                        确定要操作以下客户吗?
+                        {
+                            this.props.selectedRows.map((value,index)=>(
+                                <div key={index} style={{marginTop:'5px',color: "#000"}}>
+                                    {value.userName}
+                                </div>
+                            ))
+                        }
+                        <div style={{marginTop:20}}>
+                            <span style={{marginRight:10,color:'#000'}}>操作原因:</span>
+                            <Input
+                                placeholder="请输入操作原因"
+                                value={this.state.reasonsTransfer}
+                                style={{ width: 150 }}
+                                onChange={(e) => {
+                                    this.setState({reasonsTransfer : e.target.value });
+                                }}
+                            />
+                        </div>
+                    </span>
+            </Modal>
+        );
+    }
+}
+
+export default OperationTips;

+ 20 - 2
js/component/manageCenter/customer/NEW/intentionCustomer/transferRecords.jsx

@@ -1,5 +1,5 @@
 import React from "react";
-import { Spin, Table, message, Modal } from "antd";
+import {Spin, Table, message, Modal, Tooltip} from "antd";
 import $ from "jquery/src/ajax";
 const TransferRecords = React.createClass({
     getInitialState() {
@@ -63,6 +63,23 @@ const TransferRecords = React.createClass({
                     dataIndex: "createDate",
                     key: "createDate",
                 },
+                {
+                    title: "备注",
+                    dataIndex: "remarks",
+                    key: "remarks",
+                    render: (text) => {
+                        return (
+                            <Tooltip placement="topLeft" title={text}>
+                                <div style={{
+                                    maxWidth:'150px',
+                                    overflow:'hidden',
+                                    textOverflow: "ellipsis",
+                                    whiteSpace:'nowrap',
+                                }}>{text}</div>
+                            </Tooltip>
+                        )
+                    }
+                },
             ]
         };
     },
@@ -105,7 +122,8 @@ const TransferRecords = React.createClass({
         return (
             <Modal
                 style={{ position: "relative" }}
-                title="转交记录"
+                // title={this.props.type === 1 ? '转交记录' : this.props.type === 2 ? '回收记录' : '分配记录'}
+                title='日志'
                 visible={this.props.visible}
                 onCancel={this.props.cancel}
                 footer={null}

+ 1 - 1
js/component/manageCenter/customer/NEW/publicCustomer/publicCustomer.jsx

@@ -52,7 +52,7 @@ const QueryCustomer = React.createClass({
               transferTime:
                 thisdata.transferTime && thisdata.transferTime.split(" ")[0],
               locationProvince: thisdata.province
-                ? thisdata.province + "-" + thisdata.city + "-" + thisdata.area
+                ? (thisdata.province || '')  + (thisdata.city ? "-" + thisdata.city : '') + (thisdata.area ? "-" + thisdata.area : '')
                 : "--",
             });
           }

+ 18 - 1
js/component/manageCenter/customer/content.jsx

@@ -317,6 +317,23 @@ class Content extends Component {
                     });
                 });
                 break;
+            //渠道-(营销经理)
+            case 'channelManage':
+                require.ensure([], () => {
+                    const CompanyIntention = require('./NEW/intentionCustomer/channel').default;
+                    this.setState({
+                        component: <CompanyIntention
+                            channel={false}             //是否能导入渠道
+                            deliver={2}                 //是否能转交或分配  0不能 1分配 2转交
+                            followUp={true}             //是否能跟进
+                            isGuidanceLv={false}         //是否可查看指导  也用于判断是否为跟进管理页面
+                            isEditGuidanceLv={true}    //是否可以编辑指导
+                            recovery={true}             //是否可以回收
+                            detailApi={'/api/admin/customer/findOrganizationCustomerDetail'}
+                        />
+                    });
+                });
+                break;
             //渠道-(营销员)
             case 'channelMarketing':
                 require.ensure([], () => {
@@ -324,7 +341,7 @@ class Content extends Component {
                     this.setState({
                         component: <CompanyIntention
                             channel={false}   //是否能导入渠道
-                            deliver={2}
+                            deliver={0}
                             followUp={true}
                             isGuidanceLv={false}         //是否可查看指导  也用于判断是否为跟进管理页面
                             isEditGuidanceLv={true}     //是否可以编辑指导

+ 20 - 2
js/component/tools.js

@@ -103,7 +103,8 @@ import {
   approvalA,
   processStatusNew,
   contractChangeStatus,
-  typeList
+  typeList,
+  channelAllocationStatus
 } from "./dataDic.js";
 
 import { provinceList } from './NewDicProvinceList.js';
@@ -1081,7 +1082,7 @@ module.exports = {
   },
   //社会属性
   getSocialAttribute: function (e) {
-    if (e) {
+    if (!isNaN(parseInt(e))) {
       let theType = "";
       socialAttribute.map(function (item) {
         if (item.value == e) {
@@ -1089,8 +1090,25 @@ module.exports = {
         }
       });
       return theType;
+    }else{
+      return '未知';
+    }
+  },
+  //获取渠道分配状态名
+  getChannelAllocationStatus: function (e) {
+    if (!isNaN(parseInt(e))) {
+      let theType = "";
+      channelAllocationStatus.map(function (item) {
+        if (item.value == e) {
+          theType = item.key;
+        }
+      });
+      return theType;
+    }else{
+      return '未知';
     }
   },
+
   //行业
   getIndustry: function (e) {
     if (e) {