intentionCustomer.jsx 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325
  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 (!thedata) {
  576. if (data.error && data.error.length) {
  577. message.warning(data.error[0].message);
  578. } else {
  579. if (thedata == 1) {
  580. Modal.warning({
  581. title: '温馨提示',
  582. content: (
  583. <div>
  584. <p>不可添加!您的客户数已达最大值,可移除部分客户后添加!</p>
  585. </div>
  586. ),
  587. onOk() { },
  588. });
  589. return
  590. }
  591. this.state.RowData = {};
  592. this.setState({
  593. detailApi: this.props.detailApi,
  594. showDesc: true,
  595. modalVisible: false,
  596. visitModul: false,
  597. });
  598. }
  599. }
  600. }.bind(this),
  601. }).always(
  602. function () {
  603. this.setState({
  604. loading: false,
  605. });
  606. }.bind(this)
  607. );
  608. },
  609. closeDesc(e, s) {
  610. this.state.basicState = e;
  611. this.state.visitModul = e;
  612. this.state.modalVisible = e;
  613. this.state.showDesc = e;
  614. this.setState({
  615. tabsKey: "",
  616. });
  617. if (s) {
  618. this.loadData(this.state.ispage);
  619. }
  620. },
  621. search() {
  622. this.loadData();
  623. },
  624. reset() {
  625. this.state.nameSearch = "";
  626. this.state.level = undefined;
  627. this.state.addressSearch = [];
  628. this.state.provinceSearch = undefined;
  629. this.state.citySearch = undefined;
  630. this.state.releaseDate[0] = undefined;
  631. this.state.releaseDate[1] = undefined;
  632. this.loadData();
  633. },
  634. searchSwitch() {
  635. this.setState({
  636. visitModul: false,
  637. searchMore: !this.state.searchMore,
  638. });
  639. },
  640. //整行点击
  641. tableRowClick(record, index) {
  642. this.state.visitModul = false;
  643. this.setState({
  644. // selectedRowKeys: [],
  645. modalVisible: true,
  646. basicState: true,
  647. contactState: true,
  648. modalName: record.name,
  649. RowData: record,
  650. });
  651. },
  652. //指定转交人自动补全
  653. supervisor(e) {
  654. $.ajax({
  655. method: "get",
  656. dataType: "json",
  657. crossDomain: false,
  658. url: globalConfig.context + "/api/admin/customer/listAdminByName",
  659. data: {
  660. adminName: e,
  661. },
  662. success: function (data) {
  663. let thedata = data.data;
  664. if (!thedata) {
  665. if (data.error && data.error.length) {
  666. message.warning(data.error[0].message);
  667. }
  668. thedata = {};
  669. }
  670. this.setState({
  671. customerArr: thedata,
  672. });
  673. }.bind(this),
  674. }).always(
  675. function () {
  676. this.setState({
  677. loading: false,
  678. });
  679. }.bind(this)
  680. );
  681. },
  682. //上级主管输入框失去焦点是判断客户是否存在
  683. selectAuto(value, options) {
  684. this.setState({
  685. auto: value,
  686. });
  687. },
  688. blurChange(e) {
  689. let theType = "";
  690. let contactLists = this.state.customerArr || [];
  691. if (e) {
  692. contactLists.map(function (item) {
  693. if (item.name == e.toString()) {
  694. theType = item.id;
  695. }
  696. });
  697. }
  698. this.setState({
  699. theTypes: theType,
  700. });
  701. },
  702. //值改变时请求客户名称
  703. httpChange(e) {
  704. if (e.length >= 1) {
  705. this.supervisor(e);
  706. }
  707. this.setState({
  708. auto: e,
  709. });
  710. },
  711. //转交
  712. changeAssigner(infor) {
  713. let type = infor
  714. if (infor == 1) {
  715. if (this.state.selList.length == 0) {
  716. message.warn("请勾选您需要转交的信息!")
  717. return
  718. } else if (this.state.selList.length == 2) {
  719. type = 3
  720. } else {
  721. type = this.state.selList[0]
  722. }
  723. }
  724. if (this.state.theTypes) {
  725. this.setState({
  726. informationTransferVisible: false,
  727. });
  728. let changeIds = "";
  729. let oldAid = "";
  730. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  731. let rowItem = this.state.selectedRows[idx];
  732. if (rowItem.id) {
  733. oldAid = rowItem.aid;
  734. changeIds =
  735. this.state.selectedRows.length - 1 === idx
  736. ? changeIds + rowItem.id
  737. : changeIds + rowItem.id + ",";
  738. }
  739. }
  740. let loading = message.loading("加载中...");
  741. $.ajax({
  742. method: "get",
  743. dataType: "json",
  744. crossDomain: false,
  745. url: globalConfig.context + "/api/admin/customer/transferToOther",
  746. data: {
  747. uid: changeIds, //这一行数据的ID
  748. aid: this.state.theTypes, //指定转交人的ID
  749. oldAid: oldAid,
  750. operatorType: 3,
  751. data: type,
  752. },
  753. }).done(
  754. function (data) {
  755. loading();
  756. this.setState({
  757. selList: [],
  758. })
  759. if (!data.error.length) {
  760. this.setState({
  761. auto: "",
  762. loading: false,
  763. selectedRowKeys: [],
  764. });
  765. if (data.data.length == 0) {
  766. message.success("转交成功!");
  767. } else {
  768. data.data.forEach(function (e) { message.warning(e) })
  769. }
  770. } else {
  771. message.warning(data.error[0].message);
  772. }
  773. this.loadData(
  774. Math.min(
  775. this.state.ispage == undefined ? 1 : this.state.ispage,
  776. Math.ceil((this.state.pagination.total - 1) / 10)
  777. )
  778. );
  779. }.bind(this)
  780. );
  781. } else {
  782. message.warning("请输入转交人姓名");
  783. }
  784. },
  785. //导出
  786. exportExec() {
  787. let departmentName = "",
  788. depart = this.state.departmentArr || [];
  789. depart.map((item) => {
  790. if (this.state.departmentId == item.id) {
  791. departmentName = item.name;
  792. return;
  793. }
  794. });
  795. let data = {
  796. name: this.state.nameSearch,
  797. province: this.state.provinceSearch,
  798. city: this.state.addressSearch,
  799. level: this.state.level,
  800. startDate: this.state.releaseDate[0],
  801. endDate: this.state.releaseDate[1],
  802. };
  803. window.location.href =
  804. globalConfig.context +
  805. "/api/admin/customer/privateUnitCustomerOutXls?" +
  806. $.param(data);
  807. },
  808. componentWillReceiveProps(nextProps) {
  809. if (nextProps.ApiUrl != this.props.ApiUrl) {
  810. if (!this.state.searchMore) {
  811. this.state.searchMore = true;
  812. }
  813. this.state.nameSearch = "";
  814. this.state.addressSearch = [];
  815. this.state.provinceSearch = undefined;
  816. this.state.citySearch = undefined;
  817. this.state.releaseDate[0] = undefined;
  818. this.state.releaseDate[1] = undefined;
  819. this.loadData(null, nextProps.ApiUrl);
  820. }
  821. },
  822. zhuanjiaoDetail(record) {
  823. this.setState({
  824. zhuanjiaoVisible: true,
  825. zhuanjiaoId: record.id,
  826. });
  827. },
  828. zhuanjiaoDetailCancel() {
  829. this.setState({
  830. zhuanjiaoVisible: false,
  831. });
  832. },
  833. showConfirm() {
  834. let _this = this;
  835. Modal.confirm({
  836. title: "提示",
  837. content: (
  838. <span style={{ color: "red" }}>
  839. 确定要转交以下客户吗?
  840. {this.state.selectedRows.map((value, index) => (
  841. <div key={index} style={{ marginTop: "5px", color: "#000" }}>
  842. {value.name}
  843. </div>
  844. ))}
  845. </span>
  846. ),
  847. onOk() {
  848. _this.setState({
  849. informationTransferVisible: true,
  850. });
  851. },
  852. onCancel() { },
  853. });
  854. },
  855. changeList(arr) {
  856. const newArr = [];
  857. this.state.columns.forEach((item) => {
  858. arr.forEach((val) => {
  859. if (val === item.title) {
  860. newArr.push(item);
  861. }
  862. });
  863. });
  864. this.setState({
  865. changeList: newArr,
  866. });
  867. },
  868. showConfirms(fn, record) {
  869. Modal.confirm({
  870. title: "您确定将以下客户移至公共客户吗?",
  871. content: (
  872. <span style={{ color: "red" }}>
  873. 移除后,以下客户将被别人领取!
  874. {this.state.selectedRows.map((value, index) => (
  875. <div key={index} style={{ marginTop: "5px", color: "#000" }}>
  876. {value.name}
  877. </div>
  878. ))}
  879. </span>
  880. ),
  881. onOk() {
  882. fn(record);
  883. },
  884. onCancel() { },
  885. });
  886. },
  887. release() {
  888. this.setState({
  889. loading: true,
  890. });
  891. let deletedIds = "";
  892. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  893. let rowItem = this.state.selectedRows[idx];
  894. if (rowItem.id) {
  895. deletedIds =
  896. this.state.selectedRows.length - 1 === idx
  897. ? deletedIds + rowItem.id
  898. : deletedIds + rowItem.id + ",";
  899. }
  900. }
  901. $.ajax({
  902. method: "get",
  903. dataType: "json",
  904. crossDomain: false,
  905. url: globalConfig.context + "/api/admin/customer/pushReleaseUser",
  906. data: {
  907. id: deletedIds,
  908. },
  909. success: function (data) {
  910. let thedata = data.data;
  911. if (!thedata) {
  912. if (data.error && data.error.length) {
  913. message.warning(data.error[0].message);
  914. }
  915. thedata = {};
  916. } else {
  917. message.success("移除成功");
  918. this.loadData(
  919. this.state.dataSource.length === 1
  920. ? this.state.ispage === 1
  921. ? 1
  922. : this.state.ispage - 1
  923. : this.state.ispage
  924. );
  925. }
  926. }.bind(this),
  927. }).always(
  928. function () {
  929. this.setState({
  930. loading: false,
  931. });
  932. }.bind(this)
  933. );
  934. },
  935. render() {
  936. const FormItem = Form.Item;
  937. const rowSelection = {
  938. hideDefaultSelections: true,
  939. selectedRowKeys: this.state.selectedRowKeys,
  940. onChange: (selectedRowKeys, selectedRows) => {
  941. this.setState({
  942. modalVisible: false,
  943. selectedRows: selectedRows,
  944. selectedRowKeys: selectedRowKeys,
  945. });
  946. },
  947. onSelect: (recordt, selected, selectedRows) => {
  948. this.setState({
  949. modalVisible: false,
  950. recordt: recordt.id,
  951. });
  952. },
  953. };
  954. const hasSelected = this.state.selectedRowKeys.length > 0;
  955. const { RangePicker } = DatePicker;
  956. const dataSources = this.state.customerArr || [];
  957. const options = dataSources.map((group) => (
  958. <Select.Option key={group.id} value={group.name}>
  959. {group.name}
  960. </Select.Option>
  961. ));
  962. const intentionState = this.props.intentionState || "";
  963. return (
  964. <div className="user-content">
  965. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  966. <div className="content-title" style={{ marginBottom: 10 }}>
  967. <span style={{ fontWeight: 900, fontSize: 16 }}>{!intentionState ? "私有单位客户" : "私有专家客户"}</span>
  968. </div>
  969. <div className="user-search">
  970. <Tabs
  971. defaultActiveKey="1"
  972. onChange={this.callback}
  973. className="test"
  974. >
  975. <TabPane tab="搜索" key="1">
  976. {
  977. // 新需求 除湖南和内蒙古外 不让其他省操作
  978. (adminData.province == "21" || adminData.province == "11") &&
  979. <Button
  980. type="primary"
  981. style={{
  982. float: "right",
  983. marginTop: 10,
  984. marginLeft: 10,
  985. marginRight: 10,
  986. }}
  987. onClick={this.addClick}
  988. >
  989. 新增客户
  990. <Icon type="plus" />
  991. </Button>
  992. }
  993. <Input
  994. placeholder="客户名称"
  995. value={this.state.nameSearch}
  996. style={{ width: 150, marginRight: 10, marginLeft: 10 }}
  997. onChange={(e) => {
  998. this.setState({ nameSearch: e.target.value });
  999. }}
  1000. />
  1001. <Select
  1002. placeholder="省"
  1003. style={{ width: 80 }}
  1004. value={this.state.provinceSearch}
  1005. onChange={(e) => {
  1006. this.setState({ provinceSearch: e });
  1007. }}
  1008. >
  1009. {this.state.Provinces}
  1010. </Select>
  1011. <span style={{ marginRight: "10px" }}>
  1012. <Cascader
  1013. options={citySelect()}
  1014. value={this.state.addressSearch}
  1015. placeholder="选择城市"
  1016. onChange={(e, pre) => {
  1017. this.setState({ addressSearch: e });
  1018. }}
  1019. />
  1020. </span>
  1021. <Select
  1022. style={{ width: 180 }}
  1023. value={this.state.level}
  1024. onChange={(e) => {
  1025. this.setState({ level: e });
  1026. }}
  1027. placeholder="请选择客户等级"
  1028. >
  1029. <Select.Option value="0">一般客户(一年以上预签)</Select.Option>
  1030. <Select.Option value="1">意向客户(半年内预签)</Select.Option>
  1031. <Select.Option value="2">重点客户(一个月内预签)</Select.Option>
  1032. </Select>
  1033. <RangePicker
  1034. value={[
  1035. this.state.releaseDate[0]
  1036. ? moment(this.state.releaseDate[0])
  1037. : null,
  1038. this.state.releaseDate[1]
  1039. ? moment(this.state.releaseDate[1])
  1040. : null,
  1041. ]}
  1042. onChange={(data, dataString) => {
  1043. this.setState({ releaseDate: dataString });
  1044. }}
  1045. />
  1046. <Button
  1047. type="primary"
  1048. style={{ marginLeft: "10px", marginRight: 10 }}
  1049. onClick={this.search}
  1050. >
  1051. 搜索
  1052. </Button>
  1053. <Button onClick={this.reset}>重置</Button>
  1054. </TabPane>
  1055. {/*<Button onClick={() => { window.open(globalConfig.context + '/api/admin/customer/downloadTemplate?type=1') }}>下载批量导入模板</Button>
  1056. <Upload
  1057. name="file"
  1058. action={globalConfig.context + "/api/admin/customer/uploadExcel"}
  1059. beforeUpload={beforeUploadFile}
  1060. showUploadList={false}
  1061. onChange={(info) => {
  1062. if (info.file.status !== 'uploading') {
  1063. console.log(info.file, info.fileList);
  1064. }
  1065. if (info.file.status === 'done') {
  1066. if (!info.file.response.error.length) {
  1067. message.success(`${info.file.name} 文件上传成功!`);
  1068. this.loadData();
  1069. } else {
  1070. message.warning(info.file.response.error[0].message);
  1071. return;
  1072. };
  1073. } else if (info.file.status === 'error') {
  1074. message.error(`${info.file.name} 文件上传失败。`);
  1075. };
  1076. }} >
  1077. <Button>上传批量内容</Button>
  1078. </Upload>
  1079. {adminData.isSuperAdmin?<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
  1080. <Button type="danger" style={{marginLeft:'10px'}}
  1081. disabled={!hasSelected}
  1082. >删除<Icon type="minus" />
  1083. </Button>
  1084. </Popconfirm>:''
  1085. }*/}
  1086. <TabPane tab="操作" key="2">
  1087. <AutoComplete
  1088. className="certain-category-search"
  1089. dropdownClassName="certain-category-search-dropdown"
  1090. dropdownMatchSelectWidth={false}
  1091. style={{ width: "120px" }}
  1092. dataSource={options}
  1093. placeholder="输入转交人姓名"
  1094. value={this.state.auto}
  1095. onChange={this.httpChange}
  1096. filterOption={true}
  1097. onBlur={this.blurChange}
  1098. onSelect={this.selectAuto}
  1099. disabled={!hasSelected}
  1100. >
  1101. <Input />
  1102. </AutoComplete>
  1103. <Button
  1104. type="primary"
  1105. // onClick={this.changeAssigner}
  1106. onClick={(e) => {
  1107. e.stopPropagation();
  1108. this.showConfirm();
  1109. }}
  1110. disabled={!hasSelected}
  1111. style={{ marginRight: 10 }}
  1112. >
  1113. 转交
  1114. </Button>
  1115. {
  1116. // 新需求 除湖南和内蒙古外 不让其他省操作
  1117. (adminData.province == "21" || adminData.province == "11") &&
  1118. <Button
  1119. type="primary"
  1120. style={{
  1121. float: "right",
  1122. marginTop: 10,
  1123. marginLeft: 10,
  1124. marginRight: 10,
  1125. }}
  1126. onClick={this.addClick}
  1127. >
  1128. 新增客户
  1129. <Icon type="plus" />
  1130. </Button>
  1131. }
  1132. {/*<Button type="default" className="addButton" onClick={this.exportExec}>导出excel<Icon type="plus" /></Button>*/}
  1133. {/* <div className="clearfix" style={{ marginTop: "5px" }}> */}
  1134. <Button
  1135. onClick={(e) => {
  1136. e.stopPropagation(), this.rankO(0);
  1137. }}
  1138. type="primary"
  1139. style={{ marginRight: "10px" }}
  1140. disabled={!hasSelected}
  1141. >
  1142. 一般客户
  1143. </Button>
  1144. <Button
  1145. onClick={(e) => {
  1146. e.stopPropagation(), this.rankO(1);
  1147. }}
  1148. type="primary"
  1149. style={{ marginRight: "10px" }}
  1150. disabled={!hasSelected}
  1151. >
  1152. 意向客户
  1153. </Button>
  1154. <Button
  1155. onClick={(e) => {
  1156. e.stopPropagation(), this.rankO(2);
  1157. }}
  1158. type="primary"
  1159. disabled={!hasSelected}
  1160. >
  1161. 重点客户
  1162. </Button>
  1163. <Button
  1164. style={{ marginLeft: 10 }}
  1165. onClick={(e) => {
  1166. e.stopPropagation(),
  1167. this.zhuanjiaoDetail(this.state.selectedRows[0]);
  1168. }}
  1169. type="primary"
  1170. disabled={!hasSelected || this.state.selectedRows.length > 1}
  1171. >
  1172. 客户日志
  1173. </Button>
  1174. <Button
  1175. style={{ marginLeft: 10 }}
  1176. onClick={(e) => {
  1177. e.stopPropagation(), this.showConfirms(this.release);
  1178. }}
  1179. type="primary"
  1180. disabled={!hasSelected}
  1181. >
  1182. 移除客户
  1183. </Button>
  1184. <EnterpriseNameChange
  1185. type="journal"
  1186. disabled={
  1187. !(hasSelected && this.state.selectedRows.length === 1)
  1188. }
  1189. style={{ marginLeft: 10 }}
  1190. data={this.state.selectedRows[0]}
  1191. enterpriseId={
  1192. this.state.selectedRows[0] && this.state.selectedRows[0].id
  1193. }
  1194. />
  1195. </TabPane>
  1196. <TabPane tab="更改表格显示数据" key="3">
  1197. <div style={{ marginLeft: 10 }}>
  1198. <ChooseList
  1199. columns={this.state.columns}
  1200. changeFn={this.changeList}
  1201. changeList={this.state.changeList}
  1202. top={55}
  1203. margin={11}
  1204. />
  1205. </div>
  1206. </TabPane>
  1207. </Tabs>
  1208. </div>
  1209. <div className="patent-table">
  1210. <Spin spinning={this.state.loading}>
  1211. <Table
  1212. size="middle"
  1213. className={"intentionCustomerTable"}
  1214. columns={
  1215. this.state.changeList
  1216. ? this.state.changeList
  1217. : this.state.columns
  1218. }
  1219. dataSource={this.state.dataSource}
  1220. rowSelection={rowSelection}
  1221. pagination={this.state.pagination}
  1222. onRowDoubleClick={this.tableRowClick}
  1223. />
  1224. </Spin>
  1225. </div>
  1226. <AddIntention
  1227. api={this.state.detailApi}
  1228. showDesc={this.state.showDesc}
  1229. closeDesc={this.closeDesc}
  1230. />
  1231. <FollowDetail
  1232. categoryArr={this.state.categoryArr}
  1233. followData={this.state.followData}
  1234. visitModul={this.state.visitModul}
  1235. closeDesc={this.closeDesc}
  1236. />
  1237. <IntentionDetail
  1238. isLimit={this.props.isLimit}
  1239. tabsKey={this.state.tabsKey}
  1240. categoryArr={this.state.categoryArr}
  1241. detailApi={this.props.detailApi}
  1242. IntentionData={this.state.RowData}
  1243. modalVisible={this.state.modalVisible}
  1244. name={this.state.modalName}
  1245. closeDesc={this.closeDesc}
  1246. basicState={this.state.basicState}
  1247. contactState={this.state.contactState}
  1248. />
  1249. {this.state.zhuanjiaoVisible ? (
  1250. <ZhuanjiaoDetail
  1251. cancel={this.zhuanjiaoDetailCancel}
  1252. visible={this.state.zhuanjiaoVisible}
  1253. id={this.state.zhuanjiaoId}
  1254. />
  1255. ) : (
  1256. ""
  1257. )}
  1258. {this.state.informationTransferVisible && (
  1259. <Modal
  1260. visible={this.state.informationTransferVisible}
  1261. title="提醒"
  1262. onCancel={() => {
  1263. this.setState({
  1264. informationTransferVisible: false,
  1265. selList: [],
  1266. });
  1267. }}
  1268. footer={[
  1269. <Button
  1270. key="1"
  1271. size="large"
  1272. type={"primary"}
  1273. onClick={() => {
  1274. this.changeAssigner(1);
  1275. }}
  1276. >
  1277. 需要
  1278. </Button>,
  1279. <Button
  1280. key="2"
  1281. size="large"
  1282. type={"danger"}
  1283. onClick={() => {
  1284. this.changeAssigner(0);
  1285. }}
  1286. >
  1287. 不需要
  1288. </Button>,
  1289. ]}
  1290. >
  1291. <div style={{ padding: "0px 40px 20px" }}>
  1292. 请确定,是否一并转交以下信息,如单个资料无法转交成功,则去掉对应“勾选”项,转交单一信息!
  1293. </div>
  1294. <div style={{ width: "50%", margin: "0 auto" }}>
  1295. <Checkbox.Group onChange={e => { this.setState({ selList: e }); }}>
  1296. <Checkbox value={1}>1.需要转交该客户资料</Checkbox>
  1297. <br />
  1298. <Checkbox value={2}>2.需要转交该客户名下的订单</Checkbox>
  1299. </Checkbox.Group>
  1300. </div>
  1301. </Modal>
  1302. )}
  1303. <textarea id="copyText" style={{ opacity: 0 }} />
  1304. </div>
  1305. );
  1306. },
  1307. })
  1308. );
  1309. export default IntentionCustomer;