intentionCustomer.jsx 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. import React from "react";
  2. import {
  3. Icon,
  4. Button,
  5. AutoComplete,
  6. Cascader,
  7. Input,
  8. Select,
  9. Spin,
  10. Table,
  11. message,
  12. DatePicker,
  13. Tooltip,
  14. Form,
  15. Tabs,
  16. Modal,
  17. Tag,
  18. Checkbox,
  19. } from "antd";
  20. import $ from "jquery/src/ajax";
  21. import moment from "moment";
  22. import { citySelect, provinceList } from "@/NewDicProvinceList";
  23. import AddIntention from "./addIntention.jsx";
  24. import { industry, lvl, currentMember } from "@/dataDic.js";
  25. import ZhuanjiaoDetail from "@/zhuanjiaoDetail.jsx";
  26. import { getSocialAttribute, ShowModal } from "@/tools.js";
  27. import FollowDetail from "./followDetail.jsx";
  28. import IntentionDetail from "./intentionDetail/intentionDetail";
  29. import ShowModalDiv from "@/showModal.jsx";
  30. import "./customer.less";
  31. import { ChooseList } from "../../../order/orderNew/chooseList";
  32. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  33. const { TabPane } = Tabs;
  34. const confirm = Modal.confirm;
  35. const IntentionCustomer = Form.create()(
  36. React.createClass({
  37. loadData(pageNo, apiUrl) {
  38. this.setState({
  39. visitModul: false,
  40. loading: true,
  41. modalVisible: false,
  42. });
  43. let api = apiUrl ? apiUrl : this.props.ApiUrl;
  44. $.ajax({
  45. method: "post",
  46. dataType: "json",
  47. crossDomain: false,
  48. url: globalConfig.context + api,
  49. data: {
  50. pageNo: pageNo || 1,
  51. pageSize: this.state.pagination.pageSize,
  52. level: this.state.level ? this.state.level : undefined,
  53. name: this.state.nameSearch,
  54. province: !this.state.addressSearch.length
  55. ? this.state.provinceSearch
  56. : this.state.addressSearch[0],
  57. city: !this.state.addressSearch.length
  58. ? undefined
  59. : this.state.addressSearch[1],
  60. startDate: this.state.releaseDate[0],
  61. endDate: this.state.releaseDate[1],
  62. },
  63. success: function (data) {
  64. ShowModal(this);
  65. let theArr = [];
  66. if (data.error.length || data.data.list == "") {
  67. if (data.error && data.error.length) {
  68. message.warning(data.error[0].message);
  69. }
  70. } else {
  71. for (let i = 0; i < data.data.list.length; i++) {
  72. let thisdata = data.data.list[i];
  73. let diqu =
  74. (thisdata.province == null ? "" : thisdata.province) +
  75. (thisdata.city == null ? "" : "-" + thisdata.city) +
  76. (thisdata.area == null ? "" : "-" + thisdata.area);
  77. thisdata.key = i;
  78. thisdata.id = thisdata.uid;
  79. thisdata.lastFollowTime =
  80. thisdata.lastFollowTime &&
  81. thisdata.lastFollowTime.split(" ")[0];
  82. thisdata.transferTime =
  83. thisdata.transferTime && thisdata.transferTime.split(" ")[0];
  84. thisdata.surplusFollowTime =
  85. thisdata.surplusFollowTime &&
  86. thisdata.surplusFollowTime.split(" ")[0];
  87. thisdata.surplusSignTime =
  88. thisdata.surplusSignTime &&
  89. thisdata.surplusSignTime.split(" ")[0];
  90. thisdata.locationProvince = diqu;
  91. theArr.push(thisdata);
  92. }
  93. this.state.pagination.current = data.data.pageNo;
  94. this.state.pagination.total = data.data.totalCount;
  95. this.setState({
  96. ispage: data.data.pageNo,
  97. });
  98. }
  99. if (data.data && data.data.list && !data.data.list.length) {
  100. this.state.pagination.current = 0;
  101. this.state.pagination.total = 0;
  102. }
  103. if (
  104. JSON.stringify(theArr) !== JSON.stringify(this.state.dataSource)
  105. ) {
  106. this.setState({
  107. selectedRowKeys: [],
  108. });
  109. }
  110. this.setState({
  111. dataSource: theArr,
  112. pagination: this.state.pagination,
  113. });
  114. }.bind(this),
  115. }).always(
  116. function () {
  117. this.setState({
  118. loading: false,
  119. });
  120. }.bind(this)
  121. );
  122. },
  123. //品类数据获取
  124. category() {
  125. $.ajax({
  126. method: "get",
  127. dataType: "json",
  128. crossDomain: false,
  129. url: globalConfig.context + "/api/admin/Varieties/getSuperList",
  130. data: {},
  131. success: function (data) {
  132. let thedata = data.data;
  133. let theArr = [];
  134. if (!thedata) {
  135. if (data.error && data.error.length) {
  136. message.warning(data.error[0].message);
  137. }
  138. thedata = {};
  139. } else {
  140. thedata.map(function (item, index) {
  141. theArr.push({
  142. value: item.id,
  143. key: item.cname,
  144. });
  145. });
  146. }
  147. this.setState({
  148. categoryArr: theArr,
  149. });
  150. }.bind(this),
  151. });
  152. },
  153. getInitialState() {
  154. return {
  155. addressSearch: [],
  156. orgCodeUrl: [],
  157. companyLogoUrl: [],
  158. visible: false,
  159. zhuanjiaoVisible: false,
  160. searchMore: true,
  161. releaseDate: [],
  162. categoryArr: [],
  163. visitModul: false,
  164. keys: false,
  165. detailApi: "",
  166. followData: {},
  167. selectedRowKeys: [],
  168. selectedRowKey: [],
  169. selectedRows: [],
  170. loading: false,
  171. modalVisible: false,
  172. pagination: {
  173. defaultCurrent: 1,
  174. defaultPageSize: 10,
  175. showQuickJumper: true,
  176. pageSize: 10,
  177. onChange: function (page) {
  178. this.loadData(page);
  179. }.bind(this),
  180. showTotal: function (total) {
  181. return "共" + total + "条数据";
  182. },
  183. },
  184. columns: [
  185. {
  186. title: "客户名称",
  187. dataIndex: "name",
  188. key: "name",
  189. width: 150,
  190. render: (text) => {
  191. return (
  192. <Tooltip title={text}>
  193. <div
  194. onClick={(e) => {
  195. e.stopPropagation();
  196. let input = document.getElementById("copyText");
  197. input.value = text;
  198. input.select();
  199. document.execCommand("copy");
  200. message.success("复制成功");
  201. }}
  202. // style={{
  203. // maxWidth: "150px",
  204. // overflow: "hidden",
  205. // textOverflow: "ellipsis",
  206. // whiteSpace: "nowrap",
  207. // cursor: "pointer",
  208. // }}
  209. >
  210. {text}
  211. </div>
  212. </Tooltip>
  213. );
  214. },
  215. },
  216. {
  217. title: "统一社会信用代码",
  218. dataIndex: "orgCode",
  219. key: "orgCode",
  220. render: (text) => {
  221. return <div style={{ color: !text ? "red" : "#000000A6" }}>
  222. {!text ? "待补充" : text}
  223. </div>;
  224. },
  225. },
  226. {
  227. title: "地区",
  228. dataIndex: "locationProvince",
  229. key: "locationProvince",
  230. },
  231. // {
  232. // title: "联系人",
  233. // dataIndex: "contacts",
  234. // key: "contacts",
  235. // },
  236. // {
  237. // title: "联系电话",
  238. // dataIndex: "contactMobile",
  239. // key: "contactMobile",
  240. // },
  241. {
  242. title: "社会性质",
  243. dataIndex: "societyTag",
  244. key: "societyTag",
  245. render: (text) => {
  246. return getSocialAttribute(text);
  247. },
  248. },
  249. {
  250. title: "客户初始时间",
  251. dataIndex: "transferTime",
  252. key: "transferTime",
  253. },
  254. {
  255. title: "剩余私有天数",
  256. dataIndex: "surplusFollowTime",
  257. key: "surplusFollowTime",
  258. },
  259. {
  260. title: "剩余签单天数",
  261. dataIndex: "surplusSignTime",
  262. key: "surplusSignTime",
  263. },
  264. {
  265. title: "最新跟进时间",
  266. dataIndex: "lastFollowTime",
  267. key: "lastFollowTime",
  268. },
  269. {
  270. title: "客户等级",
  271. dataIndex: "level",
  272. key: "level",
  273. render: (text) => {
  274. if (text == 0) {
  275. return <Tag color="#87d068">一般客户</Tag>;
  276. } else if (text == 1) {
  277. return <Tag color="#D2691E">意向客户</Tag>;
  278. } else if (text == 2) {
  279. return <Tag color="#FF0000">重点客户</Tag>;
  280. } else {
  281. return "";
  282. }
  283. },
  284. },
  285. {
  286. title: "跟进操作",
  287. dataIndex: "abc",
  288. key: "abc",
  289. render: (text, record, index) => {
  290. return (
  291. <div
  292. style={{
  293. display: "flex",
  294. flexFlow: "row",
  295. alignItems: "center",
  296. }}
  297. >
  298. <Button
  299. onClick={(e) => {
  300. const _this = this
  301. e.stopPropagation()
  302. if (!record.orgCode) {
  303. confirm({
  304. title: '您暂时不可以跟进客户',
  305. content: `请先完善"企业统一社会信用代码"`,
  306. cancelText: '取消',
  307. okText: '去完善',
  308. onOk() {
  309. _this.tableRowClick(record)
  310. },
  311. onCancel() { },
  312. });
  313. } else {
  314. this.visit(record);
  315. }
  316. }}
  317. type="primary"
  318. >
  319. 客户跟进
  320. </Button>
  321. </div>
  322. );
  323. },
  324. },
  325. {
  326. title: "指导意见",
  327. dataIndex: "guidance",
  328. key: "guidance",
  329. render: (text, record, index) => {
  330. return (
  331. <div
  332. style={{
  333. display: "flex",
  334. flexFlow: "row",
  335. alignItems: "center",
  336. }}
  337. >
  338. {/*指导 0无 1未读 2已读*/}
  339. {text === 1 || text === 2 ? (
  340. <Button
  341. style={
  342. text === 1
  343. ? {
  344. background: "#F00000",
  345. borderColor: "#F00000",
  346. }
  347. : {}
  348. }
  349. onClick={(e) => {
  350. e.stopPropagation();
  351. this.guidanceRead(record.uid).then(() => {
  352. this.setState(
  353. {
  354. tabsKey: "4",
  355. },
  356. () => {
  357. this.tableRowClick(record);
  358. }
  359. );
  360. });
  361. }}
  362. type="primary"
  363. >
  364. {text === 1 ? "未读" : "查看"}
  365. </Button>
  366. ) : (
  367. <div>暂无指导</div>
  368. )}
  369. </div>
  370. );
  371. },
  372. },
  373. ],
  374. tabsKey: "",
  375. data: [],
  376. dataman: [],
  377. dataSource: [],
  378. visitArrList: [],
  379. searchTime: [,],
  380. selList: [],
  381. };
  382. },
  383. //已读指导记录
  384. guidanceRead(id) {
  385. return new Promise((resolve, reject) => {
  386. $.ajax({
  387. method: "post",
  388. dataType: "json",
  389. crossDomain: false,
  390. url: globalConfig.context + "/api/admin/customer/pushGuidance",
  391. data: {
  392. uid: id,
  393. },
  394. }).done(
  395. function (data) {
  396. if (!data.error.length) {
  397. resolve();
  398. } else {
  399. message.warning(data.error[0].message);
  400. reject();
  401. }
  402. }.bind(this)
  403. );
  404. });
  405. },
  406. rankO(rank) {
  407. let deletedIds = "";
  408. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  409. let rowItem = this.state.selectedRows[idx];
  410. if (rowItem.id) {
  411. deletedIds =
  412. this.state.selectedRows.length - 1 === idx
  413. ? deletedIds + rowItem.id
  414. : deletedIds + rowItem.id + ",";
  415. }
  416. }
  417. $.ajax({
  418. method: "get",
  419. dataType: "json",
  420. crossDomain: false,
  421. url: globalConfig.context + "/api/admin/customer/updateUserLevel",
  422. data: {
  423. id: deletedIds, //客户的ID
  424. level: rank,
  425. },
  426. }).done(
  427. function (data) {
  428. if (!data.error.length && data.data !== 0) {
  429. message.success("操作成功!");
  430. this.setState({
  431. loading: false,
  432. });
  433. this.loadData(this.state.ispage);
  434. } else {
  435. message.warning(
  436. data.data === 0 ? "操作失败,请联系管理员!" : data.error[0].message
  437. );
  438. }
  439. }.bind(this)
  440. );
  441. },
  442. //进入新增拜访记录
  443. visit(e) {
  444. this.setState({
  445. followData: e,
  446. visitModul: true,
  447. modalVisible: false,
  448. });
  449. },
  450. //列表删除功能
  451. delectRow() {
  452. let deletedIds = "";
  453. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  454. let rowItem = this.state.selectedRows[idx];
  455. if (rowItem.id) {
  456. deletedIds =
  457. this.state.selectedRows.length - 1 === idx
  458. ? deletedIds + rowItem.id
  459. : deletedIds + rowItem.id + ",";
  460. }
  461. }
  462. this.setState({
  463. loading: true,
  464. selectedRowKeys: [],
  465. });
  466. $.ajax({
  467. method: "get",
  468. dataType: "json",
  469. crossDomain: false,
  470. url: globalConfig.context + "/api/admin/customer/deleteCustomer",
  471. data: {
  472. uid: deletedIds, //删除的ID
  473. },
  474. }).done(
  475. function (data) {
  476. if (!data.error.length) {
  477. message.success("删除成功!");
  478. this.setState({
  479. loading: false,
  480. });
  481. } else {
  482. message.warning(data.error[0].message);
  483. }
  484. this.loadData(this.state.ispage);
  485. }.bind(this)
  486. );
  487. },
  488. componentWillMount() {
  489. //城市
  490. let Province = [];
  491. provinceList.map(function (item) {
  492. var id = String(item.id);
  493. Province.push(
  494. <Select.Option value={id} key={item.name}>
  495. {item.name}
  496. </Select.Option>
  497. );
  498. });
  499. //行业
  500. let intentionalArr = [];
  501. industry.map(function (item) {
  502. intentionalArr.push(
  503. <Select.Option value={item.value} key={item.key}>
  504. {item.key}
  505. </Select.Option>
  506. );
  507. });
  508. //会员等级
  509. let lvlArr = [];
  510. lvl.map(function (item) {
  511. lvlArr.push(
  512. <Select.Option value={item.value} key={item.key}>
  513. {item.key}
  514. </Select.Option>
  515. );
  516. });
  517. //会员状态customerStatus
  518. let currentMemberArr = [];
  519. currentMember.map(function (item) {
  520. currentMemberArr.push(
  521. <Select.Option value={item.value} key={item.key}>
  522. {item.key}
  523. </Select.Option>
  524. );
  525. });
  526. this.state.Provinces = Province;
  527. this.state.intentionalOption = intentionalArr;
  528. this.state.lvlArrOption = lvlArr;
  529. this.state.currentMemberArrOption = currentMemberArr;
  530. this.loadData();
  531. this.category();
  532. },
  533. addClick() {
  534. this.setState({
  535. loading: true,
  536. });
  537. $.ajax({
  538. method: "get",
  539. dataType: "json",
  540. crossDomain: false,
  541. url: globalConfig.context + "/api/admin/customer/queryUserMax",
  542. data: {},
  543. success: function (data) {
  544. let thedata = data.data;
  545. if (!thedata) {
  546. if (data.error && data.error.length) {
  547. message.warning(data.error[0].message);
  548. } else {
  549. if (thedata == 1) {
  550. Modal.warning({
  551. title: '温馨提示',
  552. content: (
  553. <div>
  554. <p>不可添加!您的客户数已达最大值,可移除部分客户后添加!</p>
  555. </div>
  556. ),
  557. onOk() { },
  558. });
  559. return
  560. }
  561. this.state.RowData = {};
  562. this.setState({
  563. detailApi: this.props.detailApi,
  564. showDesc: true,
  565. modalVisible: false,
  566. visitModul: false,
  567. });
  568. }
  569. }
  570. }.bind(this),
  571. }).always(
  572. function () {
  573. this.setState({
  574. loading: false,
  575. });
  576. }.bind(this)
  577. );
  578. },
  579. closeDesc(e, s) {
  580. this.state.basicState = e;
  581. this.state.visitModul = e;
  582. this.state.modalVisible = e;
  583. this.state.showDesc = e;
  584. this.setState({
  585. tabsKey: "",
  586. });
  587. if (s) {
  588. this.loadData(this.state.ispage);
  589. }
  590. },
  591. search() {
  592. this.loadData();
  593. },
  594. reset() {
  595. this.state.nameSearch = "";
  596. this.state.level = undefined;
  597. this.state.addressSearch = [];
  598. this.state.provinceSearch = undefined;
  599. this.state.citySearch = undefined;
  600. this.state.releaseDate[0] = undefined;
  601. this.state.releaseDate[1] = undefined;
  602. this.loadData();
  603. },
  604. searchSwitch() {
  605. this.setState({
  606. visitModul: false,
  607. searchMore: !this.state.searchMore,
  608. });
  609. },
  610. //整行点击
  611. tableRowClick(record, index) {
  612. this.state.visitModul = false;
  613. this.setState({
  614. // selectedRowKeys: [],
  615. modalVisible: true,
  616. basicState: true,
  617. contactState: true,
  618. modalName: record.name,
  619. RowData: record,
  620. });
  621. },
  622. //指定转交人自动补全
  623. supervisor(e) {
  624. $.ajax({
  625. method: "get",
  626. dataType: "json",
  627. crossDomain: false,
  628. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  629. data: {
  630. adminName: e,
  631. },
  632. success: function (data) {
  633. let thedata = data.data;
  634. if (!thedata) {
  635. if (data.error && data.error.length) {
  636. message.warning(data.error[0].message);
  637. }
  638. thedata = {};
  639. }
  640. this.setState({
  641. customerArr: thedata,
  642. });
  643. }.bind(this),
  644. }).always(
  645. function () {
  646. this.setState({
  647. loading: false,
  648. });
  649. }.bind(this)
  650. );
  651. },
  652. //上级主管输入框失去焦点是判断客户是否存在
  653. selectAuto(value, options) {
  654. this.setState({
  655. auto: value,
  656. });
  657. },
  658. blurChange(e) {
  659. let theType = "";
  660. let contactLists = this.state.customerArr || [];
  661. if (e) {
  662. contactLists.map(function (item) {
  663. if (item.name == e.toString()) {
  664. theType = item.id;
  665. }
  666. });
  667. }
  668. this.setState({
  669. theTypes: theType,
  670. });
  671. },
  672. //值改变时请求客户名称
  673. httpChange(e) {
  674. if (e.length >= 1) {
  675. this.supervisor(e);
  676. }
  677. this.setState({
  678. auto: e,
  679. });
  680. },
  681. //转交
  682. changeAssigner(infor) {
  683. let type = infor
  684. if (infor == 1) {
  685. if (this.state.selList.length == 0) {
  686. message.warn("请勾选您需要转交的信息!")
  687. return
  688. } else if (this.state.selList.length == 2) {
  689. type = 3
  690. } else {
  691. type = this.state.selList[0]
  692. }
  693. }
  694. if (this.state.theTypes) {
  695. this.setState({
  696. informationTransferVisible: false,
  697. });
  698. let changeIds = "";
  699. let oldAid = "";
  700. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  701. let rowItem = this.state.selectedRows[idx];
  702. if (rowItem.id) {
  703. oldAid = rowItem.aid;
  704. changeIds =
  705. this.state.selectedRows.length - 1 === idx
  706. ? changeIds + rowItem.id
  707. : changeIds + rowItem.id + ",";
  708. }
  709. }
  710. let loading = message.loading("加载中...");
  711. $.ajax({
  712. method: "get",
  713. dataType: "json",
  714. crossDomain: false,
  715. url: globalConfig.context + "/api/admin/customer/transferToOther",
  716. data: {
  717. uid: changeIds, //这一行数据的ID
  718. aid: this.state.theTypes, //指定转交人的ID
  719. oldAid: oldAid,
  720. operatorType: 3,
  721. data: type,
  722. },
  723. }).done(
  724. function (data) {
  725. loading();
  726. this.setState({
  727. selList: [],
  728. })
  729. if (!data.error.length) {
  730. this.setState({
  731. auto: "",
  732. loading: false,
  733. selectedRowKeys: [],
  734. });
  735. if (data.data.length == 0) {
  736. message.success("转交成功!");
  737. } else {
  738. data.data.forEach(function (e) { message.warning(e) })
  739. }
  740. } else {
  741. message.warning(data.error[0].message);
  742. }
  743. this.loadData(
  744. Math.min(
  745. this.state.ispage == undefined ? 1 : this.state.ispage,
  746. Math.ceil((this.state.pagination.total - 1) / 10)
  747. )
  748. );
  749. }.bind(this)
  750. );
  751. } else {
  752. message.warning("请输入转交人姓名");
  753. }
  754. },
  755. //导出
  756. exportExec() {
  757. let departmentName = "",
  758. depart = this.state.departmentArr || [];
  759. depart.map((item) => {
  760. if (this.state.departmentId == item.id) {
  761. departmentName = item.name;
  762. return;
  763. }
  764. });
  765. let data = {
  766. name: this.state.nameSearch,
  767. province: this.state.provinceSearch,
  768. city: this.state.addressSearch,
  769. level: this.state.level,
  770. startDate: this.state.releaseDate[0],
  771. endDate: this.state.releaseDate[1],
  772. };
  773. window.location.href =
  774. globalConfig.context +
  775. "/api/admin/customer/privateUnitCustomerOutXls?" +
  776. $.param(data);
  777. },
  778. componentWillReceiveProps(nextProps) {
  779. if (nextProps.ApiUrl != this.props.ApiUrl) {
  780. if (!this.state.searchMore) {
  781. this.state.searchMore = true;
  782. }
  783. this.state.nameSearch = "";
  784. this.state.addressSearch = [];
  785. this.state.provinceSearch = undefined;
  786. this.state.citySearch = undefined;
  787. this.state.releaseDate[0] = undefined;
  788. this.state.releaseDate[1] = undefined;
  789. this.loadData(null, nextProps.ApiUrl);
  790. }
  791. },
  792. zhuanjiaoDetail(record) {
  793. this.setState({
  794. zhuanjiaoVisible: true,
  795. zhuanjiaoId: record.id,
  796. });
  797. },
  798. zhuanjiaoDetailCancel() {
  799. this.setState({
  800. zhuanjiaoVisible: false,
  801. });
  802. },
  803. showConfirm() {
  804. let _this = this;
  805. Modal.confirm({
  806. title: "提示",
  807. content: (
  808. <span style={{ color: "red" }}>
  809. 确定要转交以下客户吗?
  810. {this.state.selectedRows.map((value, index) => (
  811. <div key={index} style={{ marginTop: "5px", color: "#000" }}>
  812. {value.name}
  813. </div>
  814. ))}
  815. </span>
  816. ),
  817. onOk() {
  818. _this.setState({
  819. informationTransferVisible: true,
  820. });
  821. },
  822. onCancel() { },
  823. });
  824. },
  825. changeList(arr) {
  826. const newArr = [];
  827. this.state.columns.forEach((item) => {
  828. arr.forEach((val) => {
  829. if (val === item.title) {
  830. newArr.push(item);
  831. }
  832. });
  833. });
  834. this.setState({
  835. changeList: newArr,
  836. });
  837. },
  838. showConfirms(fn, record) {
  839. Modal.confirm({
  840. title: "您确定将以下客户移至公共客户吗?",
  841. content: (
  842. <span style={{ color: "red" }}>
  843. 移除后,以下客户将被别人领取!
  844. {this.state.selectedRows.map((value, index) => (
  845. <div key={index} style={{ marginTop: "5px", color: "#000" }}>
  846. {value.name}
  847. </div>
  848. ))}
  849. </span>
  850. ),
  851. onOk() {
  852. fn(record);
  853. },
  854. onCancel() { },
  855. });
  856. },
  857. release() {
  858. this.setState({
  859. loading: true,
  860. });
  861. let deletedIds = "";
  862. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  863. let rowItem = this.state.selectedRows[idx];
  864. if (rowItem.id) {
  865. deletedIds =
  866. this.state.selectedRows.length - 1 === idx
  867. ? deletedIds + rowItem.id
  868. : deletedIds + rowItem.id + ",";
  869. }
  870. }
  871. $.ajax({
  872. method: "get",
  873. dataType: "json",
  874. crossDomain: false,
  875. url: globalConfig.context + "/api/admin/customer/pushReleaseUser",
  876. data: {
  877. id: deletedIds,
  878. },
  879. success: function (data) {
  880. let thedata = data.data;
  881. if (!thedata) {
  882. if (data.error && data.error.length) {
  883. message.warning(data.error[0].message);
  884. }
  885. thedata = {};
  886. } else {
  887. message.success("移除成功");
  888. this.loadData(
  889. this.state.dataSource.length === 1
  890. ? this.state.ispage === 1
  891. ? 1
  892. : this.state.ispage - 1
  893. : this.state.ispage
  894. );
  895. }
  896. }.bind(this),
  897. }).always(
  898. function () {
  899. this.setState({
  900. loading: false,
  901. });
  902. }.bind(this)
  903. );
  904. },
  905. render() {
  906. const FormItem = Form.Item;
  907. const rowSelection = {
  908. hideDefaultSelections: true,
  909. selectedRowKeys: this.state.selectedRowKeys,
  910. onChange: (selectedRowKeys, selectedRows) => {
  911. this.setState({
  912. modalVisible: false,
  913. selectedRows: selectedRows,
  914. selectedRowKeys: selectedRowKeys,
  915. });
  916. },
  917. onSelect: (recordt, selected, selectedRows) => {
  918. this.setState({
  919. modalVisible: false,
  920. recordt: recordt.id,
  921. });
  922. },
  923. };
  924. const hasSelected = this.state.selectedRowKeys.length > 0;
  925. const { RangePicker } = DatePicker;
  926. const dataSources = this.state.customerArr || [];
  927. const options = dataSources.map((group) => (
  928. <Select.Option key={group.id} value={group.name}>
  929. {group.name}
  930. </Select.Option>
  931. ));
  932. const intentionState = this.props.intentionState || "";
  933. return (
  934. <div className="user-content">
  935. <ShowModalDiv ShowModal={this.state.showModal} />
  936. <div className="content-title" style={{ marginBottom: 10 }}>
  937. <span style={{ fontWeight: 900, fontSize: 16 }}>{!intentionState ? "私有单位客户" : "私有专家客户"}</span>
  938. </div>
  939. <div className="user-search">
  940. <Tabs
  941. defaultActiveKey="1"
  942. onChange={this.callback}
  943. className="test"
  944. >
  945. <TabPane tab="搜索" key="1">
  946. {
  947. // 新需求 除湖南和内蒙古外 不让其他省操作
  948. (adminData.province == "21" || adminData.province == "11") &&
  949. <Button
  950. type="primary"
  951. style={{
  952. float: "right",
  953. marginTop: 10,
  954. marginLeft: 10,
  955. marginRight: 10,
  956. }}
  957. onClick={this.addClick}
  958. >
  959. 新增客户
  960. <Icon type="plus" />
  961. </Button>
  962. }
  963. <Input
  964. placeholder="客户名称"
  965. value={this.state.nameSearch}
  966. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  967. onChange={(e) => {
  968. this.setState({ nameSearch: e.target.value });
  969. }}
  970. />
  971. <Select
  972. placeholder="省"
  973. style={{ width: 80 }}
  974. value={this.state.provinceSearch}
  975. onChange={(e) => {
  976. this.setState({ provinceSearch: e });
  977. }}
  978. >
  979. {this.state.Provinces}
  980. </Select>
  981. <span style={{ marginRight: "10px" }}>
  982. <Cascader
  983. options={citySelect()}
  984. value={this.state.addressSearch}
  985. placeholder="选择城市"
  986. onChange={(e, pre) => {
  987. this.setState({ addressSearch: e });
  988. }}
  989. />
  990. </span>
  991. <Select
  992. style={{ width: 120 }}
  993. value={this.state.level}
  994. onChange={(e) => {
  995. this.setState({ level: e });
  996. }}
  997. placeholder="请选择客户等级"
  998. >
  999. <Select.Option value="0">一般客户</Select.Option>
  1000. <Select.Option value="1">意向客户</Select.Option>
  1001. <Select.Option value="2">重点客户</Select.Option>
  1002. </Select>
  1003. <RangePicker
  1004. value={[
  1005. this.state.releaseDate[0]
  1006. ? moment(this.state.releaseDate[0])
  1007. : null,
  1008. this.state.releaseDate[1]
  1009. ? moment(this.state.releaseDate[1])
  1010. : null,
  1011. ]}
  1012. onChange={(data, dataString) => {
  1013. this.setState({ releaseDate: dataString });
  1014. }}
  1015. />
  1016. <Button
  1017. type="primary"
  1018. style={{ marginLeft: "10px", marginRight: 10 }}
  1019. onClick={this.search}
  1020. >
  1021. 搜索
  1022. </Button>
  1023. <Button onClick={this.reset}>重置</Button>
  1024. </TabPane>
  1025. {/*<Button onClick={() => { window.open(globalConfig.context + '/api/admin/customer/downloadTemplate?type=1') }}>下载批量导入模板</Button>
  1026. <Upload
  1027. name="file"
  1028. action={globalConfig.context + "/api/admin/customer/uploadExcel"}
  1029. beforeUpload={beforeUploadFile}
  1030. showUploadList={false}
  1031. onChange={(info) => {
  1032. if (info.file.status !== 'uploading') {
  1033. console.log(info.file, info.fileList);
  1034. }
  1035. if (info.file.status === 'done') {
  1036. if (!info.file.response.error.length) {
  1037. message.success(`${info.file.name} 文件上传成功!`);
  1038. this.loadData();
  1039. } else {
  1040. message.warning(info.file.response.error[0].message);
  1041. return;
  1042. };
  1043. } else if (info.file.status === 'error') {
  1044. message.error(`${info.file.name} 文件上传失败。`);
  1045. };
  1046. }} >
  1047. <Button>上传批量内容</Button>
  1048. </Upload>
  1049. {adminData.isSuperAdmin?<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  1050. <Button type="danger" style={{marginLeft:'10px'}}
  1051. disabled={!hasSelected}
  1052. >删除<Icon type="minus" />
  1053. </Button>
  1054. </Popconfirm>:''
  1055. }*/}
  1056. <TabPane tab="操作" key="2">
  1057. <AutoComplete
  1058. className="certain-category-search"
  1059. dropdownClassName="certain-category-search-dropdown"
  1060. dropdownMatchSelectWidth={false}
  1061. style={{ width: "120px" }}
  1062. dataSource={options}
  1063. placeholder="输入转交人姓名"
  1064. value={this.state.auto}
  1065. onChange={this.httpChange}
  1066. filterOption={true}
  1067. onBlur={this.blurChange}
  1068. onSelect={this.selectAuto}
  1069. disabled={!hasSelected}
  1070. >
  1071. <Input />
  1072. </AutoComplete>
  1073. <Button
  1074. type="primary"
  1075. // onClick={this.changeAssigner}
  1076. onClick={(e) => {
  1077. e.stopPropagation();
  1078. this.showConfirm();
  1079. }}
  1080. disabled={!hasSelected}
  1081. style={{ marginRight: 10 }}
  1082. >
  1083. 转交
  1084. </Button>
  1085. {
  1086. // 新需求 除湖南和内蒙古外 不让其他省操作
  1087. (adminData.province == "21" || adminData.province == "11") &&
  1088. <Button
  1089. type="primary"
  1090. style={{
  1091. float: "right",
  1092. marginTop: 10,
  1093. marginLeft: 10,
  1094. marginRight: 10,
  1095. }}
  1096. onClick={this.addClick}
  1097. >
  1098. 新增客户
  1099. <Icon type="plus" />
  1100. </Button>
  1101. }
  1102. {/*<Button type="default" className="addButton" onClick={this.exportExec}>导出excel<Icon type="plus" /></Button>*/}
  1103. {/* <div className="clearfix" style={{ marginTop: "5px" }}> */}
  1104. <Button
  1105. onClick={(e) => {
  1106. e.stopPropagation(), this.rankO(0);
  1107. }}
  1108. type="primary"
  1109. style={{ marginRight: "10px" }}
  1110. disabled={!hasSelected}
  1111. >
  1112. 一般客户
  1113. </Button>
  1114. <Button
  1115. onClick={(e) => {
  1116. e.stopPropagation(), this.rankO(1);
  1117. }}
  1118. type="primary"
  1119. style={{ marginRight: "10px" }}
  1120. disabled={!hasSelected}
  1121. >
  1122. 意向客户
  1123. </Button>
  1124. <Button
  1125. onClick={(e) => {
  1126. e.stopPropagation(), this.rankO(2);
  1127. }}
  1128. type="primary"
  1129. disabled={!hasSelected}
  1130. >
  1131. 重点客户
  1132. </Button>
  1133. <Button
  1134. style={{ marginLeft: 10 }}
  1135. onClick={(e) => {
  1136. e.stopPropagation(),
  1137. this.zhuanjiaoDetail(this.state.selectedRows[0]);
  1138. }}
  1139. type="primary"
  1140. disabled={!hasSelected || this.state.selectedRows.length > 1}
  1141. >
  1142. 客户日志
  1143. </Button>
  1144. <Button
  1145. style={{ marginLeft: 10 }}
  1146. onClick={(e) => {
  1147. e.stopPropagation(), this.showConfirms(this.release);
  1148. }}
  1149. type="primary"
  1150. disabled={!hasSelected}
  1151. >
  1152. 移除客户
  1153. </Button>
  1154. <EnterpriseNameChange
  1155. type="journal"
  1156. disabled={
  1157. !(hasSelected && this.state.selectedRows.length === 1)
  1158. }
  1159. style={{ marginLeft: 10 }}
  1160. enterpriseId={
  1161. this.state.selectedRows[0] && this.state.selectedRows[0].id
  1162. }
  1163. />
  1164. </TabPane>
  1165. <TabPane tab="更改表格显示数据" key="3">
  1166. <div style={{ marginLeft: 10 }}>
  1167. <ChooseList
  1168. columns={this.state.columns}
  1169. changeFn={this.changeList}
  1170. changeList={this.state.changeList}
  1171. top={55}
  1172. margin={11}
  1173. />
  1174. </div>
  1175. </TabPane>
  1176. </Tabs>
  1177. </div>
  1178. <div className="patent-table">
  1179. <Spin spinning={this.state.loading}>
  1180. <Table
  1181. size="middle"
  1182. className={"intentionCustomerTable"}
  1183. columns={
  1184. this.state.changeList
  1185. ? this.state.changeList
  1186. : this.state.columns
  1187. }
  1188. dataSource={this.state.dataSource}
  1189. rowSelection={rowSelection}
  1190. pagination={this.state.pagination}
  1191. onRowDoubleClick={this.tableRowClick}
  1192. />
  1193. </Spin>
  1194. </div>
  1195. <AddIntention
  1196. api={this.state.detailApi}
  1197. showDesc={this.state.showDesc}
  1198. closeDesc={this.closeDesc}
  1199. />
  1200. <FollowDetail
  1201. categoryArr={this.state.categoryArr}
  1202. followData={this.state.followData}
  1203. visitModul={this.state.visitModul}
  1204. closeDesc={this.closeDesc}
  1205. />
  1206. <IntentionDetail
  1207. tabsKey={this.state.tabsKey}
  1208. categoryArr={this.state.categoryArr}
  1209. detailApi={this.props.detailApi}
  1210. IntentionData={this.state.RowData}
  1211. modalVisible={this.state.modalVisible}
  1212. name={this.state.modalName}
  1213. closeDesc={this.closeDesc}
  1214. basicState={this.state.basicState}
  1215. contactState={this.state.contactState}
  1216. />
  1217. {this.state.zhuanjiaoVisible ? (
  1218. <ZhuanjiaoDetail
  1219. cancel={this.zhuanjiaoDetailCancel}
  1220. visible={this.state.zhuanjiaoVisible}
  1221. id={this.state.zhuanjiaoId}
  1222. />
  1223. ) : (
  1224. ""
  1225. )}
  1226. {this.state.informationTransferVisible && (
  1227. <Modal
  1228. visible={this.state.informationTransferVisible}
  1229. title="提醒"
  1230. onCancel={() => {
  1231. this.setState({
  1232. informationTransferVisible: false,
  1233. selList: [],
  1234. });
  1235. }}
  1236. footer={[
  1237. <Button
  1238. key="1"
  1239. size="large"
  1240. type={"primary"}
  1241. onClick={() => {
  1242. this.changeAssigner(1);
  1243. }}
  1244. >
  1245. 需要
  1246. </Button>,
  1247. <Button
  1248. key="2"
  1249. size="large"
  1250. type={"danger"}
  1251. onClick={() => {
  1252. this.changeAssigner(0);
  1253. }}
  1254. >
  1255. 不需要
  1256. </Button>,
  1257. ]}
  1258. >
  1259. <div style={{ padding: "0px 40px 20px" }}>
  1260. 请确定,是否一并转交以下信息,如单个资料无法转交成功,则去掉对应“勾选”项,转交单一信息!
  1261. </div>
  1262. <div style={{ width: "50%", margin: "0 auto" }}>
  1263. <Checkbox.Group onChange={e => { this.setState({ selList: e }); }}>
  1264. <Checkbox value={1}>1.需要转交该客户资料</Checkbox>
  1265. <br />
  1266. <Checkbox value={2}>2.需要转交该客户名下的订单</Checkbox>
  1267. </Checkbox.Group>
  1268. </div>
  1269. </Modal>
  1270. )}
  1271. <textarea id="copyText" style={{ opacity: 0 }} />
  1272. </div>
  1273. );
  1274. },
  1275. })
  1276. );
  1277. export default IntentionCustomer;