intentionCustomer.jsx 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199
  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. <Input
  889. placeholder="客户名称"
  890. value={this.state.nameSearch}
  891. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  892. onChange={(e) => {
  893. this.setState({ nameSearch: e.target.value });
  894. }}
  895. />
  896. <Select
  897. placeholder="省"
  898. style={{ width: 80 }}
  899. value={this.state.provinceSearch}
  900. onChange={(e) => {
  901. this.setState({ provinceSearch: e });
  902. }}
  903. >
  904. {this.state.Provinces}
  905. </Select>
  906. <span style={{ marginRight: "10px" }}>
  907. <Cascader
  908. options={citySelect()}
  909. value={this.state.addressSearch}
  910. placeholder="选择城市"
  911. onChange={(e, pre) => {
  912. this.setState({ addressSearch: e });
  913. }}
  914. />
  915. </span>
  916. <Select
  917. style={{ width: 120 }}
  918. value={this.state.level}
  919. onChange={(e) => {
  920. this.setState({ level: e });
  921. }}
  922. placeholder="请选择客户等级"
  923. >
  924. <Select.Option value="0">一般客户</Select.Option>
  925. <Select.Option value="1">意向客户</Select.Option>
  926. <Select.Option value="2">重点客户</Select.Option>
  927. </Select>
  928. <RangePicker
  929. value={[
  930. this.state.releaseDate[0]
  931. ? moment(this.state.releaseDate[0])
  932. : null,
  933. this.state.releaseDate[1]
  934. ? moment(this.state.releaseDate[1])
  935. : null,
  936. ]}
  937. onChange={(data, dataString) => {
  938. this.setState({ releaseDate: dataString });
  939. }}
  940. />
  941. <Button
  942. type="primary"
  943. style={{ marginLeft: "10px", marginRight: 10 }}
  944. onClick={this.search}
  945. >
  946. 搜索
  947. </Button>
  948. <Button onClick={this.reset}>重置</Button>
  949. </TabPane>
  950. {/*<Button onClick={() => { window.open(globalConfig.context + '/api/admin/customer/downloadTemplate?type=1') }}>下载批量导入模板</Button>
  951. <Upload
  952. name="file"
  953. action={globalConfig.context + "/api/admin/customer/uploadExcel"}
  954. beforeUpload={beforeUploadFile}
  955. showUploadList={false}
  956. onChange={(info) => {
  957. if (info.file.status !== 'uploading') {
  958. console.log(info.file, info.fileList);
  959. }
  960. if (info.file.status === 'done') {
  961. if (!info.file.response.error.length) {
  962. message.success(`${info.file.name} 文件上传成功!`);
  963. this.loadData();
  964. } else {
  965. message.warning(info.file.response.error[0].message);
  966. return;
  967. };
  968. } else if (info.file.status === 'error') {
  969. message.error(`${info.file.name} 文件上传失败。`);
  970. };
  971. }} >
  972. <Button>上传批量内容</Button>
  973. </Upload>
  974. {adminData.isSuperAdmin?<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  975. <Button type="danger" style={{marginLeft:'10px'}}
  976. disabled={!hasSelected}
  977. >删除<Icon type="minus" />
  978. </Button>
  979. </Popconfirm>:''
  980. }*/}
  981. <TabPane tab="操作" key="2">
  982. <AutoComplete
  983. className="certain-category-search"
  984. dropdownClassName="certain-category-search-dropdown"
  985. dropdownMatchSelectWidth={false}
  986. style={{ width: "120px" }}
  987. dataSource={options}
  988. placeholder="输入转交人姓名"
  989. value={this.state.auto}
  990. onChange={this.httpChange}
  991. filterOption={true}
  992. onBlur={this.blurChange}
  993. onSelect={this.selectAuto}
  994. disabled={!hasSelected}
  995. >
  996. <Input />
  997. </AutoComplete>
  998. <Button
  999. type="primary"
  1000. // onClick={this.changeAssigner}
  1001. onClick={(e) => {
  1002. e.stopPropagation();
  1003. this.showConfirm();
  1004. }}
  1005. disabled={!hasSelected}
  1006. style={{ marginRight: 10 }}
  1007. >
  1008. 转交
  1009. </Button>
  1010. <Button
  1011. type="primary"
  1012. style={{
  1013. float: "right",
  1014. marginTop: 10,
  1015. marginLeft: 10,
  1016. marginRight: 10,
  1017. }}
  1018. onClick={this.addClick}
  1019. >
  1020. 新增客户
  1021. <Icon type="plus" />
  1022. </Button>
  1023. {/*<Button type="default" className="addButton" onClick={this.exportExec}>导出excel<Icon type="plus" /></Button>*/}
  1024. {/* <div className="clearfix" style={{ marginTop: "5px" }}> */}
  1025. <Button
  1026. onClick={(e) => {
  1027. e.stopPropagation(), this.rankO(0);
  1028. }}
  1029. type="primary"
  1030. style={{ marginRight: "10px" }}
  1031. disabled={!hasSelected}
  1032. >
  1033. 一般客户
  1034. </Button>
  1035. <Button
  1036. onClick={(e) => {
  1037. e.stopPropagation(), this.rankO(1);
  1038. }}
  1039. type="primary"
  1040. style={{ marginRight: "10px" }}
  1041. disabled={!hasSelected}
  1042. >
  1043. 意向客户
  1044. </Button>
  1045. <Button
  1046. onClick={(e) => {
  1047. e.stopPropagation(), this.rankO(2);
  1048. }}
  1049. type="primary"
  1050. disabled={!hasSelected}
  1051. >
  1052. 重点客户
  1053. </Button>
  1054. <Button
  1055. style={{ marginLeft: 10 }}
  1056. onClick={(e) => {
  1057. e.stopPropagation(),
  1058. this.zhuanjiaoDetail(this.state.selectedRows[0]);
  1059. }}
  1060. type="primary"
  1061. disabled={!hasSelected || this.state.selectedRows.length > 1}
  1062. >
  1063. 客户日志
  1064. </Button>
  1065. <Button
  1066. style={{ marginLeft: 10 }}
  1067. onClick={(e) => {
  1068. e.stopPropagation(), this.showConfirms(this.release);
  1069. }}
  1070. type="primary"
  1071. disabled={!hasSelected}
  1072. >
  1073. 移除客户
  1074. </Button>
  1075. <EnterpriseNameChange
  1076. type="journal"
  1077. disabled={
  1078. !(hasSelected && this.state.selectedRows.length === 1)
  1079. }
  1080. style={{ marginLeft: 10 }}
  1081. enterpriseId={
  1082. this.state.selectedRows[0] && this.state.selectedRows[0].id
  1083. }
  1084. />
  1085. </TabPane>
  1086. <TabPane tab="更改表格显示数据" key="3">
  1087. <div style={{ marginLeft: 10 }}>
  1088. <ChooseList
  1089. columns={this.state.columns}
  1090. changeFn={this.changeList}
  1091. changeList={this.state.changeList}
  1092. top={55}
  1093. margin={11}
  1094. />
  1095. </div>
  1096. </TabPane>
  1097. </Tabs>
  1098. </div>
  1099. <div className="patent-table">
  1100. <Spin spinning={this.state.loading}>
  1101. <Table
  1102. size="middle"
  1103. className={"intentionCustomerTable"}
  1104. columns={
  1105. this.state.changeList
  1106. ? this.state.changeList
  1107. : this.state.columns
  1108. }
  1109. dataSource={this.state.dataSource}
  1110. rowSelection={rowSelection}
  1111. pagination={this.state.pagination}
  1112. onRowDoubleClick={this.tableRowClick}
  1113. />
  1114. </Spin>
  1115. </div>
  1116. <AddIntention
  1117. api={this.state.detailApi}
  1118. showDesc={this.state.showDesc}
  1119. closeDesc={this.closeDesc}
  1120. />
  1121. <FollowDetail
  1122. categoryArr={this.state.categoryArr}
  1123. followData={this.state.followData}
  1124. visitModul={this.state.visitModul}
  1125. closeDesc={this.closeDesc}
  1126. />
  1127. <IntentionDetail
  1128. tabsKey={this.state.tabsKey}
  1129. categoryArr={this.state.categoryArr}
  1130. detailApi={this.props.detailApi}
  1131. IntentionData={this.state.RowData}
  1132. modalVisible={this.state.modalVisible}
  1133. name={this.state.modalName}
  1134. closeDesc={this.closeDesc}
  1135. basicState={this.state.basicState}
  1136. contactState={this.state.contactState}
  1137. />
  1138. {this.state.zhuanjiaoVisible ? (
  1139. <ZhuanjiaoDetail
  1140. cancel={this.zhuanjiaoDetailCancel}
  1141. visible={this.state.zhuanjiaoVisible}
  1142. id={this.state.zhuanjiaoId}
  1143. />
  1144. ) : (
  1145. ""
  1146. )}
  1147. {this.state.informationTransferVisible && (
  1148. <Modal
  1149. visible={this.state.informationTransferVisible}
  1150. title="提醒"
  1151. onCancel={() => {
  1152. this.setState({
  1153. informationTransferVisible: false,
  1154. });
  1155. }}
  1156. footer={[
  1157. <Button
  1158. key="1"
  1159. size="large"
  1160. type={"primary"}
  1161. onClick={() => {
  1162. this.changeAssigner(1);
  1163. }}
  1164. >
  1165. 需要
  1166. </Button>,
  1167. <Button
  1168. key="2"
  1169. size="large"
  1170. type={"danger"}
  1171. onClick={() => {
  1172. this.changeAssigner(0);
  1173. }}
  1174. >
  1175. 不需要
  1176. </Button>,
  1177. ]}
  1178. >
  1179. 请确定,是否将客户资料一并转交!选择“需要”,系统将全部客户资料一并转交!选择“不需要”,原客户资料保存您的客户资料中,请注意客户资料的更新维护,谢谢
  1180. </Modal>
  1181. )}
  1182. <textarea id="copyText" style={{ opacity: 0 }} />
  1183. </div>
  1184. );
  1185. },
  1186. })
  1187. );
  1188. export default IntentionCustomer;