channel.jsx 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143
  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. dropdownStyle={{ width: 120 }}
  884. style={{ width: "120px" }}
  885. dataSource={options}
  886. placeholder={this.props.deliver === 1 ? '输入分配人姓名' : '输入分配人姓名'}
  887. value={this.state.auto}
  888. onChange={this.httpChange}
  889. filterOption={true}
  890. onBlur={this.blurChange}
  891. onSelect={this.selectAuto}
  892. disabled={!hasSelected}
  893. >
  894. <Input />
  895. </AutoComplete> : ''}
  896. {this.props.deliver ? <Button
  897. type="primary"
  898. onClick={(e) => {
  899. e.stopPropagation();
  900. this.setState({
  901. visible:true
  902. })
  903. }}
  904. disabled={!hasSelected}
  905. style={{ marginRight: 10 }}
  906. >
  907. {this.props.deliver === 1 ? '分配' : '分配'}
  908. </Button> : ''}
  909. {this.props.recovery ? <Button
  910. type="primary"
  911. onClick={(e) => {
  912. e.stopPropagation();
  913. this.setState({
  914. recoveryVisible:true
  915. })
  916. }}
  917. disabled={!hasSelected}
  918. style={{ marginRight: 10 }}
  919. >
  920. 回收
  921. </Button> : ''}
  922. {this.props.deliver || this.props.recovery ? <Button
  923. type="primary"
  924. onClick={(e) => {
  925. e.stopPropagation();
  926. this.setState({
  927. transferVisible:true,
  928. transferId: this.state.selectedRows[0].uid
  929. })
  930. }}
  931. disabled={!hasSelected || this.state.selectedRows.length > 1}
  932. style={{ marginRight: 10 }}
  933. >
  934. 日志
  935. </Button> : ''}
  936. {this.props.channel ? <Upload {...this.state.upLoad} disabled={this.state.upLoadFileLoading}>
  937. <Button
  938. loading={this.state.upLoadFileLoading}
  939. type="primary"
  940. style={{ marginRight: "10px" }}
  941. >
  942. +批量导入渠道客户
  943. </Button>
  944. </Upload> : null}
  945. {this.props.channel ? <Button
  946. onClick={(e) => {
  947. e.stopPropagation();
  948. this.download();
  949. }}
  950. type="primary"
  951. style={{
  952. marginRight: "10px",
  953. background:'#f49f36',
  954. borderColor:'#f49f36'
  955. }}
  956. >
  957. 下载渠道客户模板
  958. </Button> : ''}
  959. {this.props.channel ? <Button
  960. onClick={(e) => {
  961. e.stopPropagation();
  962. this.setState({
  963. duplicateData: [],
  964. duplicateDataVisible: true
  965. })
  966. }}
  967. type="primary"
  968. style={{
  969. marginRight: "10px",
  970. background:'#ff2f00',
  971. borderColor:'#ff2f00'
  972. }}
  973. >
  974. 查看导入失败列表
  975. </Button> : ''}
  976. <EnterpriseNameChange
  977. type='journal'
  978. disabled={!(hasSelected && this.state.selectedRows.length === 1)}
  979. style={{ marginLeft: 10 }}
  980. enterpriseId={this.state.selectedRows[0] && this.state.selectedRows[0].id}/>
  981. </div>
  982. </TabPane>
  983. <TabPane tab="更改表格显示数据" key="3">
  984. <div style={{ marginLeft: 10 }}>
  985. <ChooseList
  986. columns={this.state.columns}
  987. changeFn={this.changeList}
  988. changeList={this.state.changeList}
  989. top={55}
  990. margin={11}
  991. />
  992. </div>
  993. </TabPane>
  994. </Tabs>
  995. </div>
  996. <div className="patent-table">
  997. <Spin spinning={this.state.listLoading}>
  998. <Table
  999. size="middle"
  1000. className={'intentionCustomerTable'}
  1001. columns={
  1002. this.state.changeList.length !== 0
  1003. ? this.state.changeList
  1004. : this.state.columns
  1005. }
  1006. dataSource={this.state.dataSource}
  1007. rowSelection={this.props.deliver || this.props.recovery ? rowSelection : ''}
  1008. pagination={this.state.pagination}
  1009. onRowDoubleClick={this.tableRowClick}
  1010. />
  1011. </Spin>
  1012. </div>
  1013. <FollowDetail
  1014. categoryArr={this.state.categoryArr}
  1015. followData={this.state.followData}
  1016. visitModul={this.state.visitModul}
  1017. closeDesc={this.closeDesc}
  1018. />
  1019. <IntentionDetail
  1020. tabsKey={this.state.tabsKey}
  1021. categoryArr={this.state.categoryArr}
  1022. detailApi={this.props.detailApi}
  1023. IntentionData={this.state.rowData}
  1024. modalVisible={this.state.modalVisible}
  1025. name={this.state.modalName}
  1026. closeDesc={this.detailCloseDesc}
  1027. basicState={this.state.basicState}
  1028. contactState={this.state.contactState}
  1029. isGuidanceLv={this.props.isGuidanceLv || this.state.isGuidance}
  1030. isEditGuidanceLv={this.props.isEditGuidanceLv && this.state.isEditGuidance}
  1031. />
  1032. {this.state.duplicateDataVisible ? <DuplicateData
  1033. duplicateData={this.state.duplicateData || []}
  1034. visible={this.state.duplicateDataVisible}
  1035. onCancel={()=>{
  1036. this.setState({
  1037. duplicateData:[],
  1038. duplicateDataVisible: false
  1039. },()=>{
  1040. this.loadData(this.state.pageNo);
  1041. })
  1042. }}
  1043. /> : null}
  1044. {this.state.transferVisible || this.state.returnVisible ? <TransferRecords
  1045. type={this.state.transferVisible ? (this.props.deliver === 1 ? 0 : 1) : this.state.returnVisible ? 2 : 0}
  1046. id={this.state.transferId}
  1047. visible={this.state.transferVisible || this.state.returnVisible}
  1048. cancel={()=>{
  1049. this.setState({
  1050. transferVisible:false,
  1051. returnVisible: false,
  1052. transferId:''
  1053. })
  1054. }}
  1055. /> : '' }
  1056. {/*渠道客户分配*/}
  1057. {this.state.visible ? <OperationTips
  1058. title={'渠道客户分配'}
  1059. selectedRows={this.state.selectedRows}
  1060. visible={this.state.visible}
  1061. onOk={(value)=>{
  1062. // 0 总监分配 1经理分配 2回收
  1063. this.changeAssigner(value,this.props.deliver === 1 ? 0 : this.props.deliver === 2 ? 1 : '')
  1064. }}
  1065. onCancel={()=>{
  1066. this.setState({
  1067. visible:false
  1068. })
  1069. }}/> : ''}
  1070. {/*渠道客户回收*/}
  1071. {this.state.recoveryVisible ? <OperationTips
  1072. title={'渠道客户回收'}
  1073. selectedRows={this.state.selectedRows}
  1074. visible={this.state.recoveryVisible}
  1075. onOk={(value)=>{
  1076. this.changeAssigner(value,2,true)
  1077. }}
  1078. onCancel={()=>{
  1079. this.setState({
  1080. recoveryVisible:false
  1081. })
  1082. }}/> : ''}
  1083. {this.state.upLoadFileLoading ? <div style={{
  1084. position:'fixed',
  1085. display:'flex',
  1086. flexFlow:'column',
  1087. justifyContent:'center',
  1088. alignItems:'center',
  1089. top:0,
  1090. bottom:0,
  1091. left:0,
  1092. right:0,
  1093. background:'rgba(0,0,0,.7)',
  1094. color:"#58a3ff",
  1095. fontSize:'20px',
  1096. zIndex:99999,
  1097. }}>
  1098. <Spin spinning={this.state.upLoadFileLoading}/>
  1099. <div style={{paddingTop:'10px'}}>客户名称匹配中...</div>
  1100. </div>: null}
  1101. </div>
  1102. )
  1103. }
  1104. }
  1105. export default Channel;