intentionCustomer.jsx 42 KB

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