intentionCustomer.jsx 43 KB

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