channel.jsx 45 KB

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