intentionCustomer.jsx 38 KB

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