channel.jsx 44 KB

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