channel.jsx 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. import React,{Component} from "react";
  2. import {
  3. AutoComplete,
  4. Button,
  5. Cascader,
  6. DatePicker,
  7. Input,
  8. message,
  9. Select,
  10. Spin,
  11. Table,
  12. Tabs,
  13. Tooltip,
  14. Upload,
  15. Modal, Tag
  16. } from "antd";
  17. import {ChooseList} from "../../../order/orderNew/chooseList";
  18. import $ from "jquery/src/ajax";
  19. import {
  20. getSocialAttribute,
  21. ShowModal,
  22. getChannelAllocationStatus
  23. } from "@/tools.js";
  24. import {
  25. channelAllocationStatus
  26. } from "@/dataDic.js";
  27. import { citySelect, provinceList } from '@/NewDicProvinceList';
  28. import moment from "moment";
  29. import FollowDetail from "./followDetail";
  30. import IntentionDetail from "./intentionDetail/intentionDetail";
  31. import TransferRecords from './transferRecords';
  32. import DuplicateData from './duplicateData';
  33. import OperationTips from './operationTips';
  34. import ShowModalDiv from "@/showModal.jsx";
  35. import './channel.less';
  36. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  37. const {TabPane} = Tabs;
  38. const { RangePicker } = DatePicker;
  39. const Option = Select.Option;
  40. class Channel extends Component{
  41. constructor(props) {
  42. super(props);
  43. this.state={
  44. isGuidance:false,
  45. isEditGuidance: true,
  46. upLoadFileLoading:false,
  47. channelAllocationStatusList : channelAllocationStatus.slice(0,channelAllocationStatus.length-2),
  48. columns: [
  49. {
  50. title: "客户名称",
  51. dataIndex: "userName",
  52. key: "userName",
  53. width:150,
  54. render: (text,record) => {
  55. return (
  56. <span>
  57. {record.recovery === 1 ? <div style={{
  58. background:'#ef7207',
  59. color:'#FFF',
  60. padding: '1px 7px',
  61. borderRadius:'5px',
  62. fontSize:'12px',
  63. display: 'inline-block',
  64. marginRight:'10px'
  65. }}>
  66. 回收
  67. </div> : null}
  68. <Tooltip title={text}>
  69. <div style={{
  70. maxWidth:'120px',
  71. overflow:'hidden',
  72. textOverflow: "ellipsis",
  73. whiteSpace:'nowrap',
  74. }}>{text}</div>
  75. </Tooltip>
  76. </span>
  77. )
  78. },
  79. },
  80. {
  81. title: "地区",
  82. dataIndex: "locationProvince",
  83. key: "locationProvince",
  84. },
  85. {
  86. title: "社会性质",
  87. dataIndex: "societyTag",
  88. key: "societyTag",
  89. render: (text) => {
  90. return getSocialAttribute(text);
  91. },
  92. },
  93. {
  94. title: "渠道专员",
  95. dataIndex: "channelName",
  96. key: "channelName",
  97. },
  98. {
  99. title: "客户联系人",
  100. dataIndex: "contacts",
  101. key: "contacts",
  102. },
  103. {
  104. title: "联系电话",
  105. dataIndex: "contactMobile",
  106. key: "contactMobile",
  107. },
  108. {
  109. title: "渠道初始时间",
  110. dataIndex: "createTimes",
  111. key: "createTimes",
  112. },
  113. {
  114. title: "分配状态",
  115. dataIndex: "status",
  116. key: "status",
  117. render: (text) => (
  118. getChannelAllocationStatus(text,true)
  119. )
  120. },
  121. ],
  122. changeList:[],
  123. dataSource:[],
  124. pagination: {
  125. defaultCurrent: 1,
  126. defaultPageSize: 10,
  127. showQuickJumper: true,
  128. pageSize: 10,
  129. onChange: function (page) {
  130. this.loadData(page);
  131. }.bind(this),
  132. showTotal: function (total) {
  133. return "共" + total + "条数据";
  134. },
  135. },
  136. pageNo:1,
  137. listLoading:false,
  138. selectedRowKeys:[],
  139. selectedRows:[],
  140. modalVisible:false,
  141. nameSearch:'',
  142. statusSearch:undefined,
  143. provinceSearch:undefined,
  144. addressSearch:[],
  145. releaseDate:[],
  146. upLoad: {
  147. customRequest: (options) => {
  148. this.setState({
  149. upLoadFileLoading: true,
  150. })
  151. let params = new FormData();
  152. params.append("file", options.file);
  153. $.ajax({
  154. method: "post",
  155. url: globalConfig.context + "/api/user/channel/import",
  156. async: true,
  157. cache: false,
  158. contentType: false,
  159. processData: false,
  160. data:params
  161. }).done(
  162. function (data) {
  163. this.setState({
  164. upLoadFileLoading: false,
  165. })
  166. if (data.error.length === 0) {
  167. if(data.data === 1){
  168. message.success("导入成功!");
  169. }else if(data.data.list.length > 0){
  170. message.warning('已成功导入!错误/重复客户无法导入,请查看错误渠道数据!');
  171. this.setState({
  172. duplicateData: [],
  173. duplicateDataVisible: true
  174. })
  175. }
  176. this.loadData();
  177. } else {
  178. message.warning(data.error[0].message);
  179. this.loadData();
  180. }
  181. }.bind(this)
  182. ).always(
  183. function () {
  184. this.loadData();
  185. this.setState({
  186. upLoadFileLoading: false,
  187. });
  188. }.bind(this)
  189. );
  190. },
  191. name: "file",
  192. action: globalConfig.context + "/api/user/channel/import",
  193. },
  194. followData: '',
  195. visitModul: false,
  196. categoryArr:[],
  197. tabsKey:'',
  198. adminList:[],
  199. }
  200. this.loadData = this.loadData.bind(this);
  201. this.search = this.search.bind(this);
  202. this.reset = this.reset.bind(this);
  203. this.changeList = this.changeList.bind(this);
  204. this.download = this.download.bind(this);
  205. this.category = this.category.bind(this);
  206. this.closeDesc = this.closeDesc.bind(this);
  207. this.guidanceRead = this.guidanceRead.bind(this);
  208. this.tableRowClick = this.tableRowClick.bind(this);
  209. this.detailCloseDesc = this.detailCloseDesc.bind(this);
  210. this.supervisor = this.supervisor.bind(this);
  211. this.httpChange = this.httpChange.bind(this);
  212. this.blurChange = this.blurChange.bind(this);
  213. this.selectAuto = this.selectAuto.bind(this);
  214. this.changeAssigner = this.changeAssigner.bind(this);
  215. this.getAdminList = this.getAdminList.bind(this);
  216. }
  217. componentWillReceiveProps (nextProps) {
  218. let next = JSON.stringify(nextProps);
  219. let props = JSON.stringify(this.props);
  220. if(next !== props){
  221. location.reload();
  222. }
  223. }
  224. componentDidMount() {
  225. this.initialization();
  226. }
  227. //获取渠道专员列表
  228. getAdminList(value = '') {
  229. this.setState({
  230. adminListLoading:true
  231. })
  232. $.ajax({
  233. method: "get",
  234. dataType: "json",
  235. crossDomain: false,
  236. url: globalConfig.context + "/api/admin/superviser/adminList",
  237. data: {
  238. pageNo: 1,
  239. pageSize: 99,
  240. name: value,
  241. roleName: '渠道专员',
  242. },
  243. success: function (data) {
  244. let thedata = data.data.list;
  245. let theArr = [];
  246. if (data.error && data.error.length) {
  247. message.warning(data.error[0].message);
  248. }else{
  249. thedata.map(function (item, _) {
  250. theArr.push({
  251. value: item.id,
  252. label: item.name,
  253. });
  254. });
  255. }
  256. this.setState({
  257. adminList: theArr,
  258. });
  259. }.bind(this),
  260. }).always(
  261. function () {
  262. this.setState({
  263. adminListLoading:false
  264. })
  265. }.bind(this)
  266. );
  267. }
  268. initialization(){
  269. //城市
  270. let provinces = [];
  271. provinceList.map(function (item) {
  272. var id = String(item.id);
  273. provinces.push(
  274. <Select.Option value={id} key={item.name}>
  275. {item.name}
  276. </Select.Option>
  277. );
  278. });
  279. this.setState({
  280. provinces
  281. })
  282. this.loadData();
  283. this.category();
  284. if(this.props.type === 0 || this.props.type === 3){
  285. this.state.columns.push({
  286. title: "分配时间",
  287. dataIndex: "distributionTimes",
  288. key: "distributionTimes",
  289. });
  290. this.state.columns.push({
  291. title: "剩余签单(天)",
  292. dataIndex: "days",
  293. key: "days",
  294. render: (text,record) => (
  295. record.status !== 7 ? <Tag color='#f00'>{text}天</Tag> : ''
  296. )
  297. });
  298. }
  299. if(this.props.followUp){
  300. this.state.columns.push({
  301. title: "当前跟进人",
  302. dataIndex: "adminName",
  303. key: "adminName",
  304. render: (text, record) => {
  305. return (
  306. record.status !== 0 ? text : ''
  307. )
  308. }
  309. });
  310. this.state.columns.push({
  311. title: "跟进操作",
  312. dataIndex: "abc",
  313. key: "abc",
  314. render: (text, record, index) => {
  315. return (
  316. <div style={{
  317. display: 'flex',
  318. flexFlow:'row',
  319. alignItems:'center',
  320. }}>
  321. <Button
  322. disabled={this.props.deliver === 2 && record.status === 2 && this.props.isEditGuidanceLv}
  323. onClick={(e) => {
  324. e.stopPropagation();
  325. if(this.props.isEditGuidanceLv){
  326. this.visit(record);
  327. }else{
  328. this.tableRowClick(record);
  329. }
  330. }}
  331. type="primary"
  332. >
  333. {this.props.isEditGuidanceLv ? '客户跟进' : '查看指导'}
  334. </Button>
  335. </div>
  336. );
  337. },
  338. });
  339. if(this.props.isEditGuidanceLv){
  340. this.state.columns.push({
  341. title: "指导意见",
  342. dataIndex: "guidance",
  343. key: "guidance",
  344. render: (text, record, index) => {
  345. return (
  346. <div style={{
  347. display: 'flex',
  348. flexFlow:'row',
  349. alignItems:'center',
  350. }}>
  351. {/*指导 0无 1未读 2已读*/}
  352. {text === 1 || text === 2 ? <Button
  353. style={text === 1 ? {
  354. background:'#F00000',
  355. borderColor:'#F00000'
  356. } : {}}
  357. onClick={(e)=>{
  358. e.stopPropagation();
  359. this.guidanceRead(record.uid).then(()=>{
  360. this.setState({
  361. tabsKey:"4",
  362. },()=>{
  363. this.tableRowClick(record)
  364. })
  365. })
  366. }}
  367. type="primary"
  368. >
  369. {text === 1 ? '未读' : '查看'}
  370. </Button> : <div>暂无指导</div>}
  371. </div>
  372. );
  373. },
  374. });
  375. }
  376. }
  377. this.state.columns.push({
  378. title: "备注",
  379. dataIndex: "remarks",
  380. key: "remarks",
  381. render: (text) => {
  382. return (
  383. <Tooltip placement="topLeft" title={text}>
  384. <div style={{
  385. maxWidth:'150px',
  386. overflow:'hidden',
  387. textOverflow: "ellipsis",
  388. whiteSpace:'nowrap',
  389. }}>{text}</div>
  390. </Tooltip>
  391. )
  392. }
  393. });
  394. this.setState({
  395. columns:this.state.columns
  396. })
  397. }
  398. visit(e) {
  399. this.setState({
  400. followData: e,
  401. visitModul: true,
  402. });
  403. }
  404. loadData(pageNo = 1) {
  405. this.setState({
  406. listLoading: true,
  407. selectedRows: [],
  408. selectedRowKeys: [],
  409. });
  410. $.ajax({
  411. method: "post",
  412. dataType: "json",
  413. crossDomain: false,
  414. url: globalConfig.context + '/api/admin/customer/listChannelCustomer',
  415. data: {
  416. type:this.props.type,
  417. pageNo: pageNo || 1,
  418. pageSize: this.state.pagination.pageSize,
  419. name: this.state.nameSearch,
  420. status:this.state.statusSearch,
  421. province: !this.state.addressSearch.length
  422. ? this.state.provinceSearch
  423. : this.state.addressSearch[0],
  424. city: !this.state.addressSearch.length
  425. ? ""
  426. : this.state.addressSearch[1],
  427. startTime: this.state.releaseDate[0],
  428. endTime: this.state.releaseDate[1],
  429. aid:this.state.adminValue,
  430. },
  431. success: function (data) {
  432. ShowModal(this);
  433. let theArr = [];
  434. if (data.error.length > 0) {
  435. message.warning(data.error[0].message);
  436. } else {
  437. if(data.data.list.length === 0 && pageNo !== 1){
  438. this.loadData(pageNo - 1)
  439. }else{
  440. for (let i = 0; i < data.data.list.length; i++) {
  441. let thisdata = data.data.list[i];
  442. let diqu =
  443. (thisdata.province == null ? "" : thisdata.province) +
  444. (thisdata.city == null ? "" : "-" + thisdata.city) +
  445. (thisdata.area == null ? "" : "-" + thisdata.area);
  446. thisdata.key = i;
  447. thisdata.id = thisdata.uid;
  448. thisdata.lastFollowTime = thisdata.lastFollowTime &&
  449. thisdata.lastFollowTime.split(" ")[0];
  450. thisdata.transferTime= thisdata.transferTime && thisdata.transferTime.split(" ")[0];
  451. thisdata.surplusFollowTime = thisdata.surplusFollowTime && thisdata.surplusFollowTime.split(" ")[0];
  452. thisdata.surplusSignTime = thisdata.surplusSignTime && thisdata.surplusSignTime.split(" ")[0];
  453. thisdata.locationProvince = diqu;
  454. theArr.push(thisdata);
  455. }
  456. this.state.pagination.current = data.data.pageNo;
  457. this.state.pagination.total = data.data.totalCount;
  458. this.setState({
  459. pageNo: data.data.pageNo,
  460. dataSource: theArr,
  461. pagination: this.state.pagination,
  462. })
  463. }
  464. }
  465. }.bind(this),
  466. }).always(
  467. function () {
  468. this.setState({
  469. listLoading: false,
  470. });
  471. }.bind(this)
  472. );
  473. }
  474. search(){
  475. this.loadData();
  476. }
  477. reset(){
  478. this.setState({
  479. nameSearch:'',
  480. provinceSearch:undefined,
  481. addressSearch:[],
  482. releaseDate:[],
  483. statusSearch:undefined,
  484. adminValue:undefined,
  485. },()=>{
  486. this.loadData();
  487. })
  488. }
  489. download() {
  490. window.location.href =
  491. globalConfig.context +
  492. "/api/user/channel/downloadTemplate?" +
  493. "sign=user_channel";
  494. }
  495. changeList(arr) {
  496. const newArr = [];
  497. this.state.columns.forEach(item => {
  498. arr.forEach(val => {
  499. if (val === item.title) {
  500. newArr.push(item);
  501. }
  502. });
  503. });
  504. this.setState({
  505. changeList: newArr
  506. });
  507. }
  508. category() {
  509. $.ajax({
  510. method: "get",
  511. dataType: "json",
  512. crossDomain: false,
  513. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  514. data: {},
  515. success: function (data) {
  516. let thedata = data.data;
  517. let theArr = [];
  518. if (!thedata) {
  519. if (data.error && data.error.length) {
  520. message.warning(data.error[0].message);
  521. }
  522. thedata = {};
  523. } else {
  524. thedata.map(function (item, index) {
  525. theArr.push({
  526. value: item.id,
  527. key: item.cname,
  528. });
  529. });
  530. }
  531. this.setState({
  532. categoryArr: theArr,
  533. });
  534. }.bind(this),
  535. });
  536. }
  537. closeDesc(){
  538. this.setState({
  539. followData:'',
  540. visitModul:false
  541. })
  542. }
  543. //已读指导记录
  544. guidanceRead(id) {
  545. return new Promise((resolve,reject)=>{
  546. $.ajax({
  547. method: "post",
  548. dataType: "json",
  549. crossDomain: false,
  550. url: globalConfig.context + "/api/admin/customer/pushGuidance",
  551. data: {
  552. uid: id,
  553. }
  554. }).done(function(data) {
  555. if(!data.error.length) {
  556. resolve();
  557. } else {
  558. message.warning(data.error[0].message);
  559. reject();
  560. };
  561. }.bind(this));
  562. })
  563. }
  564. tableRowClick(record) {
  565. if(this.props.deliver === 2 && record.status === 2 && this.props.isEditGuidanceLv){
  566. this.setState({
  567. isGuidance: true,
  568. tabsKey:"4",
  569. })
  570. }
  571. //营销经理人员 取消指导自己的操作
  572. if(this.props.deliver === 2 && record.status === 1 && this.props.isEditGuidanceLv){
  573. this.setState({
  574. isEditGuidance: false,
  575. })
  576. }
  577. //营销人员 取消指导的操作
  578. if(this.props.deliver === 0 && record.status === 2 && this.props.isEditGuidanceLv){
  579. this.setState({
  580. isEditGuidance: false,
  581. })
  582. }
  583. this.setState({
  584. rowData:record,
  585. modalVisible: true,
  586. basicState: true,
  587. contactState: true,
  588. modalName: record.userName
  589. })
  590. }
  591. detailCloseDesc(){
  592. this.setState({
  593. rowData:'',
  594. modalVisible: false,
  595. basicState: false,
  596. contactState: false,
  597. modalName: '',
  598. isGuidance: false,
  599. isEditGuidance: true,
  600. tabsKey: '',
  601. },()=>{
  602. this.loadData(this.state.pageNo);
  603. })
  604. }
  605. supervisor(e) {
  606. $.ajax({
  607. method: "get",
  608. dataType: "json",
  609. crossDomain: false,
  610. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  611. data: {
  612. adminName: e,
  613. },
  614. success: function (data) {
  615. let thedata = data.data;
  616. if (!thedata) {
  617. if (data.error && data.error.length) {
  618. message.warning(data.error[0].message);
  619. }
  620. thedata = {};
  621. }
  622. this.setState({
  623. customerArr: thedata,
  624. });
  625. }.bind(this),
  626. }).always(
  627. function () {
  628. }.bind(this)
  629. );
  630. }
  631. httpChange(e) {
  632. if (e.length >= 1) {
  633. this.supervisor(e);
  634. }
  635. this.setState({
  636. auto: e,
  637. });
  638. }
  639. blurChange(e) {
  640. let theType = "";
  641. let contactLists = this.state.customerArr || [];
  642. if (e) {
  643. contactLists.map(function (item) {
  644. if (item.name == e.toString()) {
  645. theType = item.id;
  646. }
  647. });
  648. }
  649. this.setState({
  650. theTypes: theType,
  651. });
  652. }
  653. selectAuto(value, options) {
  654. this.setState({
  655. auto: value,
  656. });
  657. }
  658. changeAssigner(remarks,type,lv) {
  659. //type 0 总监分配 1经理分配 2回收
  660. let arr = this.state.selectedRows.filter(v=>v.status === 1);
  661. let arr1 = this.state.selectedRows.filter(v=>v.status === 2);
  662. let arr2 = this.state.selectedRows.filter(v=>v.status === 7);
  663. let arr3 = this.state.selectedRows.filter(v=>v.status === 6);
  664. if(type === 0 && (arr.length>0 || arr1.length>0)){
  665. message.warning('选中的信息中存在“已分配”数据,请取消这些选项后重新提交')
  666. return;
  667. }
  668. if(type === 1 && arr1.length>0){
  669. message.warning('选中的信息中存在“经理已分配”数据,请取消这些选项后重新提交')
  670. return;
  671. }
  672. //处于回收状态的客户经理和营销员不能点击回收
  673. if(this.props.deliver !== 1 && arr3.length>0){
  674. message.warning('渠道客户已回收!待营销总监,重新分配')
  675. return;
  676. }
  677. //this.props.deliver && this.props.recovery 用于判断是否为经理
  678. if(this.props.deliver === 2 && this.props.recovery && type === 2 && arr1.length>0){
  679. message.warning('操作失败,存在客户已被分配营销员')
  680. return;
  681. }
  682. if(arr2.length>0){
  683. message.warning('不能操作已签单客户')
  684. return;
  685. }
  686. if(!remarks){
  687. message.warning(type === 1 ? "请输入分配原因" : type === 2 ? "请输入回收原因" : type === 0 ? "请输入分配原因" : "");
  688. return;
  689. }
  690. if (this.state.theTypes || lv) {
  691. this.setState({
  692. listLoading: true,
  693. })
  694. let changeIds = '';
  695. let oldAid = '';
  696. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  697. let rowItem = this.state.selectedRows[idx];
  698. if(rowItem.recovery === 1 && type === 2){
  699. let arr = this.state.selectedRows.filter(v => v.recovery === 1)
  700. Modal.info({
  701. title: '以下数据属于回收再分配资源,无法再次回收',
  702. content: (
  703. <div>
  704. {
  705. arr.map(i=>(
  706. <div style={{paddingBottom:'7px'}}>{i.userName}</div>
  707. ))
  708. }
  709. </div>
  710. ),
  711. onOk() {},
  712. });
  713. return ;
  714. }
  715. if (rowItem.id) {
  716. oldAid = rowItem.aid;
  717. changeIds = this.state.selectedRows.length-1 === idx ? changeIds +rowItem.id : changeIds + rowItem.id + ',' ;
  718. }
  719. }
  720. $.ajax({
  721. method: "post",
  722. dataType: "json",
  723. crossDomain: false,
  724. url: globalConfig.context + "/api/admin/customer/channelCustomerDeliver",
  725. data: {
  726. userIds: changeIds, //这一行数据的ID
  727. receiveId: this.state.theTypes, //指定分配人的ID
  728. remarks: remarks,
  729. type, //0总监分配 1经理分配 2回收
  730. },
  731. }).done(
  732. function (data) {
  733. this.setState({
  734. listLoading: false,
  735. })
  736. if (!data.error.length) {
  737. message.success(type === 1 ? "分配成功!" : type === 2 ? "回收成功!" : type === 0 ? "分配成功!" : "");
  738. this.setState({
  739. auto: "",
  740. loading: false,
  741. selectedRowKeys: [],
  742. visible:false,
  743. recoveryVisible: false,
  744. },()=>{
  745. this.loadData(this.state.pageNo);
  746. });
  747. } else {
  748. message.warning(data.error[0].message);
  749. }
  750. }.bind(this)
  751. );
  752. } else {
  753. message.warning("请输入分配人姓名");
  754. }
  755. }
  756. render() {
  757. const rowSelection = {
  758. hideDefaultSelections: true,
  759. selectedRowKeys: this.state.selectedRowKeys,
  760. onChange: (selectedRowKeys, selectedRows) => {
  761. this.setState({
  762. modalVisible: false,
  763. selectedRows: selectedRows,
  764. selectedRowKeys: selectedRowKeys,
  765. });
  766. },
  767. onSelect: (recordt, selected, selectedRows) => {
  768. this.setState({
  769. modalVisible: false,
  770. });
  771. },
  772. };
  773. const dataSources = this.state.customerArr || [];
  774. const options = dataSources.map((group) => (
  775. <Select.Option key={group.id} value={group.name}>
  776. {group.name}
  777. </Select.Option>
  778. ));
  779. const hasSelected = this.state.selectedRowKeys.length > 0;
  780. return (
  781. <div className="user-content">
  782. <ShowModalDiv ShowModal={this.state.showModal} />
  783. <div className="content-title">
  784. <span>渠道客户</span>
  785. </div>
  786. <div className="user-search">
  787. <Tabs
  788. defaultActiveKey="1"
  789. className="test"
  790. >
  791. <TabPane tab="搜索" key="1">
  792. <Input
  793. placeholder="请输入客户名称"
  794. value={this.state.nameSearch}
  795. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  796. onChange={(e) => {
  797. this.setState({ nameSearch: e.target.value });
  798. }}
  799. />
  800. <Select
  801. placeholder="分配状态"
  802. style={{ width: 170 }}
  803. value={this.state.statusSearch}
  804. onChange={(e) => {
  805. this.setState({ statusSearch: e });
  806. }}
  807. >
  808. {
  809. this.state.channelAllocationStatusList.map((v,key)=>(
  810. <Select.Option value={v.value} key={key}>
  811. {v.key}
  812. </Select.Option>
  813. ))
  814. }
  815. </Select>
  816. <Select
  817. placeholder="省"
  818. style={{ width: 80 }}
  819. value={this.state.provinceSearch}
  820. onChange={(e) => {
  821. this.setState({ provinceSearch: e });
  822. }}
  823. >
  824. {this.state.provinces}
  825. </Select>
  826. <span style={{ marginRight: "10px" }}>
  827. <Cascader
  828. options={citySelect()}
  829. value={this.state.addressSearch}
  830. placeholder="选择城市"
  831. onChange={(e, pre) => {
  832. this.setState({ addressSearch: e });
  833. }}
  834. />
  835. </span>
  836. <RangePicker
  837. value={[
  838. this.state.releaseDate[0]
  839. ? moment(this.state.releaseDate[0])
  840. : null,
  841. this.state.releaseDate[1]
  842. ? moment(this.state.releaseDate[1])
  843. : null,
  844. ]}
  845. onChange={(data, dataString) => {
  846. this.setState({ releaseDate: dataString });
  847. }}
  848. />
  849. {this.props.type !== 1 ? <Select
  850. showSearch
  851. value={this.state.adminValue}
  852. style={{ width: 150,marginLeft:'10px' }}
  853. onSearch={this.getAdminList}
  854. onSelect={(v)=>{
  855. this.setState({
  856. adminValue:v
  857. })
  858. }}
  859. onFocus={this.getAdminList}
  860. filterOption={false}
  861. placeholder="请输入渠道专员名称"
  862. >
  863. {this.state.adminList.map((v,k)=>(
  864. <Option key={k} value={v.value}>{v.label}</Option>
  865. ))}
  866. </Select> : null}
  867. <Button
  868. type="primary"
  869. style={{ marginLeft: "10px", marginRight: 10 }}
  870. onClick={this.search}
  871. >
  872. 搜索
  873. </Button>
  874. <Button onClick={this.reset}>重置</Button>
  875. </TabPane>
  876. <TabPane tab="操作" key="2">
  877. <div style={{
  878. marginTop: 10,
  879. }}>
  880. {this.props.deliver ? <AutoComplete
  881. className="certain-category-search"
  882. dropdownClassName="certain-category-search-dropdown"
  883. dropdownMatchSelectWidth={false}
  884. dropdownStyle={{ width: 120 }}
  885. style={{ width: "120px" }}
  886. dataSource={options}
  887. placeholder={this.props.deliver === 1 ? '输入分配人姓名' : '输入分配人姓名'}
  888. value={this.state.auto}
  889. onChange={this.httpChange}
  890. filterOption={true}
  891. onBlur={this.blurChange}
  892. onSelect={this.selectAuto}
  893. disabled={!hasSelected}
  894. >
  895. <Input />
  896. </AutoComplete> : ''}
  897. {this.props.deliver ? <Button
  898. type="primary"
  899. onClick={(e) => {
  900. e.stopPropagation();
  901. this.setState({
  902. visible:true
  903. })
  904. }}
  905. disabled={!hasSelected}
  906. style={{ marginRight: 10 }}
  907. >
  908. {this.props.deliver === 1 ? '分配' : '分配'}
  909. </Button> : ''}
  910. {this.props.recovery ? <Button
  911. type="primary"
  912. onClick={(e) => {
  913. e.stopPropagation();
  914. this.setState({
  915. recoveryVisible:true
  916. })
  917. }}
  918. disabled={!hasSelected}
  919. style={{ marginRight: 10 }}
  920. >
  921. 回收
  922. </Button> : ''}
  923. {this.props.deliver || this.props.recovery ? <Button
  924. type="primary"
  925. onClick={(e) => {
  926. e.stopPropagation();
  927. this.setState({
  928. transferVisible:true,
  929. transferId: this.state.selectedRows[0].uid
  930. })
  931. }}
  932. disabled={!hasSelected || this.state.selectedRows.length > 1}
  933. style={{ marginRight: 10 }}
  934. >
  935. 日志
  936. </Button> : ''}
  937. {this.props.channel ? <Upload {...this.state.upLoad} disabled={this.state.upLoadFileLoading}>
  938. <Button
  939. loading={this.state.upLoadFileLoading}
  940. type="primary"
  941. style={{ marginRight: "10px" }}
  942. >
  943. +批量导入渠道客户
  944. </Button>
  945. </Upload> : null}
  946. {this.props.channel ? <Button
  947. onClick={(e) => {
  948. e.stopPropagation();
  949. this.download();
  950. }}
  951. type="primary"
  952. style={{
  953. marginRight: "10px",
  954. background:'#f49f36',
  955. borderColor:'#f49f36'
  956. }}
  957. >
  958. 下载渠道客户模板
  959. </Button> : ''}
  960. {this.props.channel ? <Button
  961. onClick={(e) => {
  962. e.stopPropagation();
  963. this.setState({
  964. duplicateData: [],
  965. duplicateDataVisible: true
  966. })
  967. }}
  968. type="primary"
  969. style={{
  970. marginRight: "10px",
  971. background:'#ff2f00',
  972. borderColor:'#ff2f00'
  973. }}
  974. >
  975. 查看导入失败列表
  976. </Button> : ''}
  977. <EnterpriseNameChange
  978. type='journal'
  979. disabled={!(hasSelected && this.state.selectedRows.length === 1)}
  980. style={{ marginLeft: 10 }}
  981. enterpriseId={this.state.selectedRows[0] && this.state.selectedRows[0].id}/>
  982. </div>
  983. </TabPane>
  984. <TabPane tab="更改表格显示数据" key="3">
  985. <div style={{ marginLeft: 10 }}>
  986. <ChooseList
  987. columns={this.state.columns}
  988. changeFn={this.changeList}
  989. changeList={this.state.changeList}
  990. top={55}
  991. margin={11}
  992. />
  993. </div>
  994. </TabPane>
  995. </Tabs>
  996. </div>
  997. <div className="patent-table">
  998. <Spin spinning={this.state.listLoading}>
  999. <Table
  1000. size="middle"
  1001. className={'intentionCustomerTable'}
  1002. columns={
  1003. this.state.changeList.length !== 0
  1004. ? this.state.changeList
  1005. : this.state.columns
  1006. }
  1007. dataSource={this.state.dataSource}
  1008. rowSelection={this.props.deliver || this.props.recovery ? rowSelection : ''}
  1009. pagination={this.state.pagination}
  1010. onRowDoubleClick={this.tableRowClick}
  1011. />
  1012. </Spin>
  1013. </div>
  1014. <FollowDetail
  1015. categoryArr={this.state.categoryArr}
  1016. followData={this.state.followData}
  1017. visitModul={this.state.visitModul}
  1018. closeDesc={this.closeDesc}
  1019. />
  1020. <IntentionDetail
  1021. tabsKey={this.state.tabsKey}
  1022. categoryArr={this.state.categoryArr}
  1023. detailApi={this.props.detailApi}
  1024. IntentionData={this.state.rowData}
  1025. modalVisible={this.state.modalVisible}
  1026. name={this.state.modalName}
  1027. closeDesc={this.detailCloseDesc}
  1028. basicState={this.state.basicState}
  1029. contactState={this.state.contactState}
  1030. isGuidanceLv={this.props.isGuidanceLv || this.state.isGuidance}
  1031. isEditGuidanceLv={this.props.isEditGuidanceLv && this.state.isEditGuidance}
  1032. />
  1033. {this.state.duplicateDataVisible ? <DuplicateData
  1034. duplicateData={this.state.duplicateData || []}
  1035. visible={this.state.duplicateDataVisible}
  1036. onCancel={()=>{
  1037. this.setState({
  1038. duplicateData:[],
  1039. duplicateDataVisible: false
  1040. },()=>{
  1041. this.loadData(this.state.pageNo);
  1042. })
  1043. }}
  1044. /> : null}
  1045. {this.state.transferVisible || this.state.returnVisible ? <TransferRecords
  1046. type={this.state.transferVisible ? (this.props.deliver === 1 ? 0 : 1) : this.state.returnVisible ? 2 : 0}
  1047. id={this.state.transferId}
  1048. visible={this.state.transferVisible || this.state.returnVisible}
  1049. cancel={()=>{
  1050. this.setState({
  1051. transferVisible:false,
  1052. returnVisible: false,
  1053. transferId:''
  1054. })
  1055. }}
  1056. /> : '' }
  1057. {/*渠道客户分配*/}
  1058. {this.state.visible ? <OperationTips
  1059. title={'渠道客户分配'}
  1060. selectedRows={this.state.selectedRows}
  1061. visible={this.state.visible}
  1062. onOk={(value)=>{
  1063. // 0 总监分配 1经理分配 2回收
  1064. this.changeAssigner(value,this.props.deliver === 1 ? 0 : this.props.deliver === 2 ? 1 : '')
  1065. }}
  1066. onCancel={()=>{
  1067. this.setState({
  1068. visible:false
  1069. })
  1070. }}/> : ''}
  1071. {/*渠道客户回收*/}
  1072. {this.state.recoveryVisible ? <OperationTips
  1073. title={'渠道客户回收'}
  1074. selectedRows={this.state.selectedRows}
  1075. visible={this.state.recoveryVisible}
  1076. onOk={(value)=>{
  1077. this.changeAssigner(value,2,true)
  1078. }}
  1079. onCancel={()=>{
  1080. this.setState({
  1081. recoveryVisible:false
  1082. })
  1083. }}/> : ''}
  1084. {this.state.upLoadFileLoading ? <div style={{
  1085. position:'fixed',
  1086. display:'flex',
  1087. flexFlow:'column',
  1088. justifyContent:'center',
  1089. alignItems:'center',
  1090. top:0,
  1091. bottom:0,
  1092. left:0,
  1093. right:0,
  1094. background:'rgba(0,0,0,.7)',
  1095. color:"#58a3ff",
  1096. fontSize:'20px',
  1097. zIndex:99999,
  1098. }}>
  1099. <Spin spinning={this.state.upLoadFileLoading}/>
  1100. <div style={{paddingTop:'10px'}}>客户名称匹配中...</div>
  1101. </div>: null}
  1102. </div>
  1103. )
  1104. }
  1105. }
  1106. export default Channel;