queryCutomer.jsx 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. import React from 'react';
  2. import {
  3. Button, Cascader, Modal, Input, Select, Tag,
  4. Spin, Table, Tabs, Form, Col, message, Tooltip, AutoComplete
  5. } from 'antd';
  6. import $ from 'jquery/src/ajax';
  7. import { ShowModal } from '../../../../tools.js'
  8. import { areaSelect, citySelect, provinceList } from '@/NewDicProvinceList';
  9. import ShowModalDiv from "@/showModal.jsx";
  10. import ZhuanjiaoDetail from "@/zhuanjiaoDetail.jsx";
  11. import Detaile from './detail.jsx';
  12. import { ChooseList } from "../../../order/orderNew/chooseList";
  13. import EnterpriseNameChange from "../../../../common/enterpriseNameChange";
  14. import TextArea from "antd/es/input/TextArea";
  15. import ImgList from '../../../../common/imgList/index.js';
  16. const confirm = Modal.confirm;
  17. const { TabPane } = Tabs
  18. const QueryCustomer = React.createClass({
  19. //
  20. loadData(pageNo, apiUrl) {
  21. if (!this.state.nameSearch) {
  22. return
  23. }
  24. // 新需求 除湖南和内蒙古外 不让其他省操作
  25. if (adminData.province != "21" && adminData.province != "11" && adminData.province != "2") {
  26. return
  27. }
  28. this.setState({
  29. visitModul: false,
  30. loading: true,
  31. modalVisible: false,
  32. });
  33. let api = apiUrl ? apiUrl : this.props.ApiUrl;
  34. $.ajax({
  35. method: "post",
  36. dataType: "json",
  37. crossDomain: false,
  38. url: globalConfig.context + api,
  39. data: {
  40. pageNo: pageNo || 1,
  41. pageSize: this.state.pagination.pageSize,
  42. name: this.state.nameSearch,
  43. departmentId: this.state.departmenttSearch,
  44. aid: this.state.theTypes,
  45. },
  46. success: function (data) {
  47. ShowModal(this);
  48. let theArr = [];
  49. if (data.error.length || data.data.list == "") {
  50. if (data.error && data.error.length) {
  51. message.warning(data.error[0].message);
  52. }
  53. } else {
  54. for (let i = 0; i < data.data.list.length; i++) {
  55. let thisdata = data.data.list[i];
  56. let diqu =
  57. (thisdata.province == null ? "" : thisdata.province) +
  58. (thisdata.city == null ? "" : "-" + thisdata.city) +
  59. (thisdata.area == null ? "" : "-" + thisdata.area);
  60. thisdata.key = i;
  61. thisdata.id = thisdata.uid;
  62. thisdata.signBills = thisdata.signBills;
  63. thisdata.createTime = thisdata.createTime && thisdata.createTime.split(" ")[0];
  64. thisdata.locationProvince = diqu;
  65. thisdata.myUser = thisdata.myUser;
  66. theArr.push(thisdata);
  67. }
  68. this.state.pagination.current = data.data.pageNo;
  69. this.state.pagination.total = data.data.totalCount;
  70. }
  71. if (data.data && data.data.list && !data.data.list.length) {
  72. this.state.pagination.current = 0;
  73. this.state.pagination.total = 0;
  74. }
  75. this.setState({
  76. dataSource: theArr,
  77. pagination: this.state.pagination,
  78. selectedRowKeys: [],
  79. ispage: data.data.pageNo,
  80. });
  81. }.bind(this),
  82. }).always(
  83. function () {
  84. this.setState({
  85. loading: false,
  86. });
  87. }.bind(this)
  88. );
  89. },
  90. //部门
  91. departmentList() {
  92. this.setState({
  93. loading: true,
  94. });
  95. $.ajax({
  96. method: "get",
  97. dataType: "json",
  98. crossDomain: false,
  99. url: globalConfig.context + "/api/admin/organization/selectSuperId",
  100. data: {},
  101. success: function (data) {
  102. let thedata = data.data;
  103. let theArr = [];
  104. if (!thedata) {
  105. if (data.error && data.error.length) {
  106. message.warning(data.error[0].message);
  107. }
  108. thedata = {};
  109. } else {
  110. thedata.map(function (item, index) {
  111. theArr.push({
  112. key: index,
  113. name: item.name,
  114. id: item.id,
  115. });
  116. });
  117. }
  118. this.setState({
  119. departmentArr: theArr,
  120. });
  121. }.bind(this),
  122. }).always(
  123. function () {
  124. this.setState({
  125. loading: false,
  126. });
  127. }.bind(this)
  128. );
  129. },
  130. //
  131. getInitialState() {
  132. return {
  133. verification: false,
  134. businessScope: [],
  135. cooperationProjects: [],
  136. selectCooperationProjects: [],
  137. addressSearch: [],
  138. dataSource: [],
  139. zhuanjiaoVisible: false,
  140. zhuanjiaoData: [],
  141. loading: false,
  142. departmentArr: [],
  143. selectedRowKeys: [],
  144. selectedRowKey: [],
  145. selectedRows: [],
  146. pagination: {
  147. defaultCurrent: 1,
  148. defaultPageSize: 10,
  149. showQuickJumper: true,
  150. pageSize: 10,
  151. onChange: function (page) {
  152. this.loadData(page);
  153. }.bind(this),
  154. showTotal: function (total) {
  155. return "共" + total + "条数据";
  156. },
  157. },
  158. columns: [
  159. {
  160. title: "客户名称",
  161. dataIndex: "name",
  162. key: "name",
  163. render: (text, record) => {
  164. return (
  165. <span style={{ display: 'flex', alignItems: 'flex-start' }}>
  166. {record.channel === 1 ? <div style={{
  167. whiteSpace: 'nowrap',
  168. background: '#ef7207',
  169. color: '#FFF',
  170. padding: '1px 7px',
  171. borderRadius: '5px',
  172. fontSize: '12px',
  173. display: 'inline-block',
  174. marginRight: '10px'
  175. }}>
  176. 外联
  177. </div> : null}
  178. <Tooltip title={text}>
  179. <div>{text}</div>
  180. </Tooltip>
  181. </span>
  182. )
  183. }
  184. },
  185. {
  186. title: "统一社会信用代码",
  187. dataIndex: "orgCode",
  188. key: "orgCode",
  189. },
  190. {
  191. title: "共享类型",
  192. dataIndex: "shareType",
  193. key: "shareType",
  194. //0-私有 1-公共 2 签单
  195. render: (text, record) => {
  196. return (
  197. <span>
  198. {
  199. text === '0' ? '私有' :
  200. text === '1' ? '公共' :
  201. text === '2' ? '签单' :
  202. text === '3' ? '外联' :
  203. text === '4' ? '渠道' :
  204. text === '5' ? '线索' : ''
  205. }
  206. {/* {
  207. record.newChannel == "1"
  208. ? "渠道" : ""
  209. } */}
  210. </span>
  211. )
  212. }
  213. },
  214. {
  215. title: "地区",
  216. dataIndex: "locationProvince",
  217. key: "locationProvince",
  218. },
  219. {
  220. title: "创建时间",
  221. dataIndex: "createTime",
  222. key: "createTime",
  223. width: 80,
  224. },
  225. {
  226. title: "客户所属人",
  227. dataIndex: "adminName",
  228. key: "adminName",
  229. },
  230. {
  231. title: "资料所属人",
  232. dataIndex: "informationMaintainer",
  233. key: "informationMaintainer",
  234. },
  235. {
  236. title: "操作",
  237. dataIndex: "abc",
  238. key: "abc",
  239. render: (text, record) => {
  240. return (
  241. <div>
  242. <Button
  243. disabled={record.signBills === 0}
  244. onClick={(e) => {
  245. e.stopPropagation(), this.seeDetail(record);
  246. }}
  247. // type="primary"
  248. style={{ border: 0, marginRight: 10, color: "#fff", background: record.signBills === 0 ? "#58A3FF" : "green" }}
  249. >
  250. {record.signBills === 0 ? '暂未签单' : '已签,查看详细'}
  251. </Button>
  252. <Button
  253. onClick={(e) => {
  254. e.stopPropagation(), this.zhuanjiaoLog(record);
  255. }}
  256. type="primary"
  257. >
  258. 查看转交记录
  259. </Button>
  260. <EnterpriseNameChange
  261. type='journal'
  262. style={{ marginLeft: 10 }}
  263. data={record}
  264. enterpriseId={record.uid} />
  265. {record.shareType === '1' &&
  266. <Button style={{ marginLeft: 10 }} onClick={(e) => {
  267. e.stopPropagation();
  268. if (record.newChannel == 1) {
  269. this.rTips(record)
  270. } else {
  271. this.receive(record)
  272. }
  273. // let _this = this;
  274. // confirm({
  275. // title: '提醒!',
  276. // content: '确定要领取此客户吗?',
  277. // onOk() {
  278. // _this.receive(record);
  279. // },
  280. // onCancel() { },
  281. // });
  282. }} type="primary">领取</Button>
  283. }
  284. </div>
  285. );
  286. },
  287. },
  288. ],
  289. natureOptions: [{
  290. value: 1,
  291. label: "政府机构"
  292. }, {
  293. value: 2,
  294. label: "科研院所"
  295. }, {
  296. value: 3,
  297. label: "高等院校"
  298. }, {
  299. value: 4,
  300. label: "社会团体"
  301. }, {
  302. value: 5,
  303. label: "企业",
  304. children: [{
  305. value: 1,
  306. label: "国企",
  307. children: [{
  308. value: 1,
  309. label: "上市公司",
  310. }, {
  311. value: 0,
  312. label: "非上市公司",
  313. }]
  314. }, {
  315. value: 2,
  316. label: "央企",
  317. children: [{
  318. value: 1,
  319. label: "上市公司",
  320. }, {
  321. value: 0,
  322. label: "非上市公司",
  323. }]
  324. }, {
  325. value: 3,
  326. label: "私企",
  327. children: [{
  328. value: 1,
  329. label: "上市公司",
  330. }, {
  331. value: 0,
  332. label: "非上市公司",
  333. }]
  334. }, {
  335. value: 4,
  336. label: "合资企业(含港澳台)",
  337. children: [{
  338. value: 1,
  339. label: "上市公司",
  340. }, {
  341. value: 0,
  342. label: "非上市公司",
  343. }]
  344. }, {
  345. value: 5,
  346. label: "外资控股",
  347. children: [{
  348. value: 1,
  349. label: "上市公司",
  350. }, {
  351. value: 0,
  352. label: "非上市公司",
  353. }]
  354. }]
  355. }, {
  356. value: 0,
  357. label: "其他组织"
  358. }],
  359. fileList: []
  360. };
  361. },
  362. handleClose(removedTag) {
  363. let businessScope = this.state.businessScope.filter(tag => { return tag !== removedTag });
  364. this.setState({ businessScope });
  365. },
  366. handleCloseCooperation(removedTag) {
  367. let selectCooperationProjects = this.state.selectCooperationProjects.filter(tag => { return tag.value !== removedTag.value });
  368. this.setState({ selectCooperationProjects });
  369. },
  370. showInput() {
  371. let str = this.state.businessScope.join('/')
  372. this.setState({
  373. inputVisible: true,
  374. inputValue: str
  375. });
  376. },
  377. handleInputConfirm() {
  378. let inputValue = this.state.inputValue;
  379. let arr = inputValue.split('/');
  380. let lv = true;
  381. for (let i of arr) {
  382. if (!i.replace(/\s+/g, '')) {
  383. message.warning("请填写关键词且不为空");
  384. return;
  385. }
  386. if (i.length > 16) {
  387. message.warning('单个标签字数不能超过16个字符')
  388. lv = false;
  389. return;
  390. }
  391. }
  392. if (lv) {
  393. arr = Array.from(new Set(arr));
  394. arr = arr.filter(v => v);
  395. this.setState({
  396. businessScope: arr,
  397. inputVisible: false,
  398. inputValue: '',
  399. });
  400. }
  401. },
  402. //加载(自动补全)
  403. // supervisor(value) {
  404. // console.log(value)
  405. // $.ajax({
  406. // method: "get",
  407. // dataType: "json",
  408. // crossDomain: false,
  409. // url: globalConfig.context + '/api/admin/order/getBusinessProjectByName',
  410. // data: {
  411. // businessName: value
  412. // },
  413. // success: function (data) {
  414. // let thedata = data.data;
  415. // console.log(data)
  416. // if (data.error.length === 0) {
  417. // this.setState({
  418. // cooperationProjects: thedata,
  419. // });
  420. // } else {
  421. // message.warning(data.error[0].message);
  422. // }
  423. // }.bind(this),
  424. // }).always(
  425. // function () {
  426. // }.bind(this)
  427. // );
  428. // },
  429. onSelect(value) {
  430. let arr = this.state.cooperationProjects.filter(v => v.id === value);
  431. let arr1 = this.state.selectCooperationProjects.filter(v => v.value === value);
  432. if (arr.length > 0) {
  433. if (arr1.length > 0) {
  434. message.warning('选项已存在');
  435. } else {
  436. this.state.selectCooperationProjects.push({
  437. label: arr[0].bname,
  438. value: arr[0].id,
  439. })
  440. this.setState({
  441. selectCooperationProjects: this.state.selectCooperationProjects
  442. })
  443. }
  444. }
  445. },
  446. // 查询客户补充完整
  447. receive(e) {
  448. this.setState({
  449. loading: true,
  450. selectedRowKeys: [],
  451. });
  452. $.ajax({
  453. method: "get",
  454. dataType: "json",
  455. crossDomain: false,
  456. url: globalConfig.context + "/api/admin/customer/checkUser",
  457. data: {
  458. id: e.id || e.uid,
  459. }
  460. }).done(function (data) {
  461. if (!data.error.length) {
  462. let obj = data.data
  463. let selectCooperationProjects = !!obj.intendedProject ? obj.intendedProject.split(',') : []
  464. if (selectCooperationProjects.length > 0) {
  465. selectCooperationProjects = selectCooperationProjects.map((item) => {
  466. return { label: item }
  467. })
  468. }
  469. let nature = [];
  470. if (!!obj.nature) {
  471. nature.push(obj.nature);
  472. }
  473. if (!!obj.enterpriseNature) {
  474. nature.push(obj.enterpriseNature);
  475. }
  476. if (!!obj.listedNature) {
  477. nature.push(obj.listedNature);
  478. }
  479. this.setState({
  480. loading: false,
  481. verification: true,
  482. verificationMyUser: e.myUser,
  483. id: obj.id,
  484. name: obj.name,
  485. orgCode: obj.orgCode,
  486. ProvinceCity: [obj.province, obj.city, obj.area],
  487. // content: e.myUser == 1 ? obj.contacts : '',
  488. position: obj.position,
  489. // telnum: e.myUser == 1 ? obj.contactMobile : '',
  490. businessScope: !!obj.businessScope ? obj.businessScope.split(',') : [],
  491. selectCooperationProjects: selectCooperationProjects,
  492. level: obj.level,
  493. nature,
  494. natureOther: obj.natureOther,
  495. fileList: []
  496. });
  497. } else {
  498. message.warning(data.error[0].message);
  499. };
  500. }.bind(this));
  501. },
  502. // 补充客户并领取
  503. handleSubmit(e) {
  504. e.preventDefault();
  505. this.props.form.validateFields((err, values) => {
  506. let re = new RegExp("^[\u4e00-\u9fa5]");
  507. // if (!re.test(values.name)) {
  508. // message.warning('公司名称必须以汉字开头!')
  509. // return
  510. // }
  511. // if (!re.test(values.name.charAt(values.name.length - 1))) {
  512. // message.warning('公司名称必须以汉字结尾!')
  513. // return
  514. // }
  515. if (values.name.length > 64) {
  516. message.warning('公司名称字数不超过64个!')
  517. return false;
  518. };
  519. let regu = /[`~!#$%^&*'_[\]+=<>?:"{}|~!#¥%……&*=-@-!{}|/《》?:“”【】、;;‘’,,.。、\s+]/g;
  520. if (regu.test(values.name)) {
  521. message.warning('公司名称不能存在特殊符号或空格!')
  522. return false;
  523. }
  524. if (!/^[A-Z0-9]{15}$|^[A-Z0-9]{17}$|^[A-Z0-9]{18}$|^[A-Z0-9]{20}$/.test(values.orgCode)) {
  525. message.warning('请输入正确的统一社会信用代码!')
  526. return
  527. }
  528. if (!!values.content && !/.*[\u4e00-\u9fa5]+.*$/.test(values.content)) {
  529. message.error("请填写正确的联系人,且至少包含一个汉字");
  530. return false;
  531. }
  532. if (!!values.position && !/.*[\u4e00-\u9fa5]+.*$/.test(values.position)) {
  533. message.error("请填写正确的职位,且至少包含一个汉字");
  534. return false;
  535. }
  536. if (!values.ProvinceCity[1]) {
  537. message.warning('请选择地区');
  538. return false;
  539. };
  540. if (!!values.content && values.content.length > 32) {
  541. message.warning('联系人字数不超过32个')
  542. return false;
  543. };
  544. if (!!values.telnum && values.telnum.length > 13) {
  545. message.warning('电话号码字数不超过13个')
  546. return false;
  547. };
  548. if (this.state.businessScope.length === 0) {
  549. message.warning('请选择主营产品')
  550. return false;
  551. }
  552. if (this.state.selectCooperationProjects.length === 0) {
  553. message.warning('请选择意向合作项目')
  554. return false;
  555. }
  556. if (!this.state.level && this.state.level != 0) {
  557. message.warning('请选择客户类型')
  558. return false;
  559. }
  560. if (!this.state.nature && this.state.nature != 0) {
  561. message.warning('请选择客户性质')
  562. return false;
  563. }
  564. if (this.state.nature == 0 && !this.state.natureOther) {
  565. message.warning('其他说明不能为空')
  566. return false;
  567. }
  568. if (!this.state.verificationMyUser && !this.state.fileList.length) {
  569. message.warning('请上传佐证资料')
  570. return false;
  571. }
  572. let arr = [];
  573. for (let i of this.state.selectCooperationProjects) {
  574. arr.push(i.label)
  575. }
  576. if (!err) {
  577. this.setState({
  578. loading: true
  579. });
  580. let enterpriseNature = undefined; // 企业性质 0=其他,1=国企,2=央企,3=私企,4=合资企业(含港澳台),5=外资控股
  581. let listedNature = undefined; // 上市 0=否,1=是
  582. if (this.state.nature.length >= 2) {
  583. enterpriseNature = this.state.nature[1];
  584. }
  585. if (this.state.nature.length >= 3) {
  586. listedNature = this.state.nature[2];
  587. }
  588. let fileSuccList = this.state.fileList.filter(item => item.response.data && !item.response.error.length);
  589. let materialUrlList = fileSuccList.map(item => {
  590. return item.response.data;
  591. });
  592. $.ajax({
  593. method: "POST",
  594. dataType: "json",
  595. crossDomain: false,
  596. url: globalConfig.context + '/api/admin/customer/updateAndReceiveCustomer',
  597. data: {
  598. id: this.state.id,
  599. orgCode: values.orgCode,
  600. contacts: values.content,
  601. contactMobile: values.telnum,
  602. societyTag: '0', //社会属性默认为 社会企业
  603. //source:values.customerSource,
  604. province: (values.ProvinceCity)[0],//省
  605. city: (values.ProvinceCity)[1],//市
  606. area: (values.ProvinceCity)[2],//区
  607. type: '1',
  608. intendedProject: arr.join(','),
  609. businessScope: this.state.businessScope.join(','),
  610. position: values.position,
  611. level: this.state.level,
  612. nature: this.state.nature[0],
  613. natureOther: this.state.natureOther,
  614. enterpriseNature,
  615. listedNature,
  616. materialUrl: materialUrlList.join(",")
  617. }
  618. }).done(function (data) {
  619. this.setState({
  620. loading: false
  621. });
  622. if (!data.error.length) {
  623. message.success('领取成功!');
  624. this.loadData(this.state.ispage);
  625. this.handleModalClose();
  626. } else {
  627. message.warning(data.error[0].message);
  628. }
  629. }.bind(this));
  630. }
  631. });
  632. },
  633. handleModalClose() {
  634. this.setState({
  635. verification: false,
  636. id: undefined,
  637. name: undefined,
  638. orgCode: undefined,
  639. ProvinceCity: [],
  640. content: undefined,
  641. position: undefined,
  642. telnum: undefined,
  643. businessScope: [],
  644. selectCooperationProjects: [],
  645. level: undefined,
  646. nature: undefined,
  647. natureOther: undefined,
  648. })
  649. this.props.form.resetFields();
  650. },
  651. rTips(e) {
  652. let _this = this;
  653. Modal.confirm({
  654. title: "温馨提示",
  655. content: "确认要领取此客户吗?",
  656. onOk() {
  657. _this.receiveNew(e)
  658. },
  659. onCancel() { },
  660. });
  661. },
  662. /*领取为私有渠道信息*/
  663. receiveNew(e) {
  664. this.setState({
  665. loading: true,
  666. selectedRowKeys: [],
  667. });
  668. $.ajax({
  669. method: "post",
  670. dataType: "json",
  671. crossDomain: false,
  672. url: globalConfig.context + "/api/admin/customer/receiveAsChannel",
  673. data: {
  674. uid: e.uid,
  675. }
  676. }).done(function (data) {
  677. if (!data.error.length) {
  678. message.success('领取成功!');
  679. this.setState({
  680. loading: false,
  681. })
  682. } else {
  683. message.warning(data.error[0].message);
  684. };
  685. this.loadData(this.state.ispage);
  686. }.bind(this));
  687. },
  688. receives(e) {
  689. this.setState({
  690. loading: true,
  691. });
  692. $.ajax({
  693. method: "get",
  694. dataType: "json",
  695. crossDomain: false,
  696. url: globalConfig.context + "/api/admin/customer/receiveCustomer",
  697. data: {
  698. uid: e.id,
  699. }
  700. }).done(function (data) {
  701. this.setState({
  702. loading: false,
  703. });
  704. if (data.error.length === 0) {
  705. message.success(e.signBills == 1 ? '领取成功,请在【私有客户列表】中查询!' : '领取成功,请在【签单客户列表】中查询!');
  706. this.loadData(this.state.ispage);
  707. } else {
  708. message.warning(data.error[0].message);
  709. };
  710. }.bind(this));
  711. },
  712. //
  713. zhuanjiaoDetailCancel() {
  714. this.setState({
  715. zhuanjiaoVisible: false,
  716. });
  717. },
  718. //
  719. zhuanjiaoLog(record) {
  720. this.setState({
  721. zhuanjiaoVisible: true,
  722. zhuanjiaoId: record.id,
  723. });
  724. },
  725. //
  726. seeDetail(record) {
  727. this.setState({
  728. data: record,
  729. visitModul: true,
  730. });
  731. },
  732. //
  733. closeDesc(e) {
  734. this.state.visitModul = e;
  735. },
  736. //
  737. search() {
  738. this.loadData();
  739. },
  740. //
  741. reset() {
  742. this.setState({
  743. nameSearch: undefined,
  744. departmenttSearch: undefined,
  745. theTypes: undefined,
  746. auto: undefined,
  747. provinceSearch: undefined,
  748. addressSearch: [],
  749. dataSource: []
  750. })
  751. // this.loadData();
  752. },
  753. componentWillReceiveProps(nextProps) {
  754. if (nextProps.ApiUrl != this.props.ApiUrl) {
  755. this.state.nameSearch = "";
  756. this.state.provinceSearch = undefined;
  757. this.state.addressSearch = [];
  758. this.loadData(null, nextProps.ApiUrl);
  759. }
  760. },
  761. componentWillMount() {
  762. // this.departmentList();
  763. //城市
  764. let Province = [];
  765. provinceList.map(function (item) {
  766. var id = String(item.id);
  767. Province.push(
  768. <Select.Option value={id} key={item.name}>
  769. {item.name}
  770. </Select.Option>
  771. );
  772. });
  773. this.state.Provinces = Province;
  774. this.loadData();
  775. },
  776. //指定转交人自动补全
  777. supervisor(e) {
  778. $.ajax({
  779. method: "get",
  780. dataType: "json",
  781. crossDomain: false,
  782. url: globalConfig.context + "/api/admin/order/getBusinessProjectByName",
  783. data: {
  784. businessName: e,
  785. },
  786. }).done((data) => {
  787. console.log(data)
  788. let thedata = data.data || [];
  789. if (!thedata) {
  790. if (data.error && data.error.length) {
  791. message.warning(data.error[0].message);
  792. }
  793. thedata = {};
  794. }
  795. this.setState({
  796. cooperationProjects: thedata,
  797. });
  798. }).always(
  799. function () {
  800. this.setState({
  801. loading: false,
  802. });
  803. }.bind(this)
  804. );
  805. },
  806. //输入转交人输入框失去焦点是判断客户是否存在
  807. selectAuto(value, options) {
  808. this.setState({
  809. auto: value,
  810. });
  811. },
  812. blurChange(e) {
  813. let theType = "";
  814. let contactLists = this.state.customerArr || [];
  815. if (e) {
  816. contactLists.map(function (item) {
  817. if (item.name == e.toString()) {
  818. theType = item.id;
  819. }
  820. });
  821. }
  822. this.setState({
  823. theTypes: theType,
  824. });
  825. },
  826. //值改变时请求客户名称
  827. httpChange(e) {
  828. if (e.length >= 1) {
  829. this.supervisor(e);
  830. }
  831. this.setState({
  832. auto: e,
  833. });
  834. },
  835. changeList(arr) {
  836. const newArr = [];
  837. this.state.columns.forEach(item => {
  838. arr.forEach(val => {
  839. if (val === item.title) {
  840. newArr.push(item);
  841. }
  842. });
  843. });
  844. this.setState({
  845. changeList: newArr
  846. });
  847. },
  848. handleFileChange(info) {
  849. let fileList = info.fileList;
  850. this.setState({ fileList });
  851. },
  852. render() {
  853. let departmentArr = this.state.departmentArr || [];
  854. const intentionState = this.props.intentionState;
  855. const { getFieldDecorator } = this.props.form;
  856. const formItemLayout = {
  857. labelCol: { span: 6 },
  858. wrapperCol: { span: 14 },
  859. };
  860. const FormItem = Form.Item;
  861. const rowSelection = {
  862. selectedRowKeys: this.state.selectedRowKeys,
  863. onChange: (selectedRowKeys, selectedRows) => {
  864. this.setState({
  865. modalVisible: false,
  866. selectedRows: selectedRows.slice(-1),
  867. selectedRowKeys: selectedRowKeys.slice(-1),
  868. });
  869. },
  870. onSelect: (recordt, selected, selectedRows) => {
  871. this.setState({
  872. modalVisible: false,
  873. recordt: recordt.id,
  874. });
  875. },
  876. };
  877. const dataSources = this.state.customerArr || [];
  878. const options = dataSources.map((group) => (
  879. <Select.Option key={group.id} value={group.name}>
  880. {group.name}
  881. </Select.Option>
  882. ));
  883. const hasSelected = this.state.selectedRowKeys.length > 0;
  884. return (
  885. <div className="user-content">
  886. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  887. <div className="content-title" style={{ marginBottom: 10 }}>
  888. <span style={{ fontWeight: 900, fontSize: 16 }}>{!intentionState ? "单位客户查询" : "个人客户查询"}</span>
  889. </div>
  890. <Tabs defaultActiveKey="1" onChange={this.callback} className="test">
  891. <TabPane tab="搜索" key="1">
  892. <div className="user-search">
  893. <Input
  894. style={{ width: 240 }}
  895. placeholder="请输入精确客户全称或统一社会信用代码"
  896. value={this.state.nameSearch}
  897. onChange={(e) => {
  898. this.setState({ nameSearch: e.target.value });
  899. }}
  900. />
  901. {/* <Select placeholder="选择部门"
  902. style={{ width: 150, marginRight: '10px', marginLeft: '10px' }}
  903. value={this.state.departmenttSearch}
  904. onChange={(e) => { this.setState({ departmenttSearch: e }) }}>
  905. {
  906. departmentArr.map(function (item) {
  907. return <Select.Option key={item.id} >{item.name}</Select.Option>
  908. })
  909. }
  910. </Select> */}
  911. {/* <AutoComplete
  912. className="certain-category-search"
  913. dropdownClassName="certain-category-search-dropdown"
  914. dropdownMatchSelectWidth={false}
  915. dropdownStyle={{ width: 120 }}
  916. style={{ width: '120px' }}
  917. dataSource={options}
  918. placeholder="客户所有人姓名"
  919. value={this.state.auto}
  920. onChange={this.httpChange}
  921. filterOption={true}
  922. onBlur={this.blurChange}
  923. onSelect={this.selectAuto}
  924. >
  925. <Input />
  926. </AutoComplete> */}
  927. <Button type="primary" onClick={this.search}>搜索</Button>
  928. <Button onClick={this.reset}>重置</Button>
  929. </div>
  930. </TabPane>
  931. <TabPane tab="更改表格显示数据" key="2">
  932. <div style={{ marginLeft: 10 }}>
  933. <ChooseList
  934. columns={this.state.columns}
  935. changeFn={this.changeList}
  936. changeList={this.state.changeList}
  937. top={55}
  938. margin={11}
  939. />
  940. </div>
  941. </TabPane>
  942. </Tabs>
  943. <div className="patent-table">
  944. <Spin spinning={this.state.loading}>
  945. <Table
  946. size="middle"
  947. columns={
  948. this.state.changeList
  949. ? this.state.changeList
  950. : this.state.columns
  951. }
  952. dataSource={this.state.dataSource}
  953. rowSelection={rowSelection}
  954. pagination={this.state.pagination}
  955. />
  956. </Spin>
  957. </div>
  958. <Detaile
  959. visitModul={this.state.visitModul}
  960. data={this.state.data}
  961. detailApi={this.props.detailApi}
  962. closeDesc={this.closeDesc}
  963. />
  964. {this.state.zhuanjiaoVisible ? (
  965. <ZhuanjiaoDetail
  966. cancel={this.zhuanjiaoDetailCancel}
  967. visible={this.state.zhuanjiaoVisible}
  968. id={this.state.zhuanjiaoId}
  969. />
  970. ) : (
  971. ""
  972. )}
  973. <Modal maskClosable={false}
  974. visible={this.state.verification}
  975. onCancel={this.handleModalClose}
  976. width='600px'
  977. title='客户信息'
  978. footer={null}
  979. className="admin-desc-content">
  980. <Spin spinning={this.state.loading}>
  981. <div>
  982. <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form">
  983. <Spin spinning={this.state.loading}>
  984. <div>
  985. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>注意:请录入真实有效的客户信息</Col>
  986. <div className="clearfix">
  987. <FormItem className="mid-item"
  988. {...formItemLayout}
  989. label="公司名称" >
  990. {getFieldDecorator('name', {
  991. rules: [{ required: true, message: '此项为必填项!' }],
  992. initialValue: this.state.name
  993. })(
  994. <Input placeholder="公司名称" disabled />
  995. // <span style={{ display: 'flex', alignItems: 'center', position: 'relative' }}>
  996. // <Input placeholder="公司名称" value={this.state.name} />
  997. // {this.state.verification && <Icon type="check-circle" style={{
  998. // fontSize: 16,
  999. // color: '#30e031',
  1000. // position: 'absolute',
  1001. // right: '80px',
  1002. // }} />}
  1003. // <Button onClick={this.checkUserName} type="primary" style={{ marginLeft: '10px' }}>验证</Button>
  1004. // </span>
  1005. )}
  1006. </FormItem>
  1007. </div>
  1008. <div className="clearfix">
  1009. <FormItem
  1010. {...formItemLayout}
  1011. label="统一社会信用代码"
  1012. >
  1013. {getFieldDecorator('orgCode', {
  1014. rules: [{ required: true, message: '此项为必填项!' }],
  1015. initialValue: this.state.orgCode
  1016. })(
  1017. <Input placeholder="统一社会信用代码" />
  1018. )}
  1019. </FormItem>
  1020. </div>
  1021. <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>如,科德集团则填写91430105670766451M</Col>
  1022. <div className="clearfix">
  1023. <FormItem
  1024. {...formItemLayout}
  1025. label="省-市-区"
  1026. >
  1027. {getFieldDecorator('ProvinceCity', {
  1028. rules: [{ required: true, message: '此项为必填项!' }],
  1029. initialValue: this.state.ProvinceCity
  1030. })(
  1031. <Cascader options={areaSelect()} placeholder="选择城市" />
  1032. )}
  1033. </FormItem>
  1034. </div>
  1035. <div className="clearfix">
  1036. <FormItem className="mid-item"
  1037. {...formItemLayout}
  1038. label="联系人" >
  1039. {getFieldDecorator('content', {
  1040. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1041. initialValue: this.state.content
  1042. })(
  1043. <Input placeholder="联系人姓名" />
  1044. )}
  1045. </FormItem>
  1046. </div>
  1047. <div className="clearfix">
  1048. <FormItem className="mid-item"
  1049. {...formItemLayout}
  1050. label="职位" >
  1051. {getFieldDecorator('position', {
  1052. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1053. initialValue: this.state.position
  1054. })(
  1055. <Input placeholder="联系人职位" />
  1056. )}
  1057. </FormItem>
  1058. </div>
  1059. <div className="clearfix">
  1060. <FormItem className="mid-item"
  1061. {...formItemLayout}
  1062. label="联系电话" >
  1063. {getFieldDecorator('telnum', {
  1064. rules: [{ required: this.state.verificationMyUser != 1, message: '此项为必填项!' }],
  1065. initialValue: this.state.telnum
  1066. })(
  1067. <Input placeholder="请填写手机号,仅填座机号时,请后续补充手机号" />
  1068. )}
  1069. </FormItem>
  1070. </div>
  1071. <div className="clearfix">
  1072. <FormItem className="mid-item"
  1073. {...formItemLayout}
  1074. required
  1075. label="主营产品" >
  1076. <div>
  1077. {this.state.businessScope.map((tag, index) => {
  1078. const isLongTag = tag.length > 20;
  1079. const tagElem = (
  1080. <Tag closable key={tag} afterClose={() => this.handleClose(tag)}>
  1081. {isLongTag ? `${tag.slice(0, 20)}...` : tag}
  1082. </Tag>
  1083. );
  1084. return isLongTag ? <Tooltip title={tag} key={tag}>{tagElem}</Tooltip> : tagElem;
  1085. })}
  1086. {
  1087. !this.state.inputVisible &&
  1088. <Button
  1089. size="small"
  1090. type="primary"
  1091. onClick={this.showInput}>
  1092. + 新增主营产品
  1093. </Button>
  1094. }
  1095. </div>
  1096. {this.state.inputVisible && (<div>
  1097. <TextArea
  1098. style={{ width: '300px', height: '100px' }}
  1099. value={this.state.inputValue}
  1100. onChange={(e) => {
  1101. this.setState({
  1102. inputValue: e.target.value
  1103. })
  1104. }} />
  1105. <div style={{ color: '#f00' }}>提示:请用 / 符号隔开关键字</div>
  1106. <div>
  1107. <Button
  1108. size="small"
  1109. type="primary"
  1110. onClick={this.handleInputConfirm}>
  1111. 确定
  1112. </Button>
  1113. <Button
  1114. size="small"
  1115. style={{ marginLeft: '5px' }}
  1116. onClick={() => {
  1117. this.setState({
  1118. inputVisible: false,
  1119. inputValue: ''
  1120. })
  1121. }}>
  1122. 取消
  1123. </Button>
  1124. </div>
  1125. </div>)}
  1126. </FormItem>
  1127. </div>
  1128. <div className="clearfix">
  1129. <FormItem
  1130. className="mid-item"
  1131. {...formItemLayout}
  1132. required
  1133. label="意向合作项目" >
  1134. <div>
  1135. <div style={{ paddingBottom: this.state.selectCooperationProjects.length === 0 ? 0 : '10px' }}>
  1136. {this.state.selectCooperationProjects.map((tag, index) => {
  1137. console.log(tag)
  1138. const isLongTag = tag.label.length > 20;
  1139. const tagElem = (
  1140. <Tag closable key={tag.label} afterClose={() => this.handleCloseCooperation(tag)}>
  1141. {isLongTag ? `${tag.label.slice(0, 20)}...` : tag.label}
  1142. </Tag>
  1143. );
  1144. return isLongTag ? <Tooltip title={tag.label} key={tag.label}>{tagElem}</Tooltip> : tagElem;
  1145. })}
  1146. </div>
  1147. <div>
  1148. <AutoComplete
  1149. style={{ width: 200 }}
  1150. onSearch={this.supervisor}
  1151. onSelect={this.onSelect}
  1152. placeholder="请输入关键字"
  1153. >
  1154. {
  1155. this.state.cooperationProjects.map(function (item) {
  1156. return <Select.Option key={item.id} value={item.id}>{item.bname}</Select.Option>
  1157. })
  1158. }
  1159. </AutoComplete>
  1160. </div>
  1161. </div>
  1162. </FormItem>
  1163. </div>
  1164. <div className="clearfix">
  1165. <FormItem
  1166. className="mid-item"
  1167. {...formItemLayout}
  1168. required
  1169. label="客户类型" >
  1170. <Select
  1171. placeholder="请选择客户类型"
  1172. value={this.state.level}
  1173. onChange={(e) => {
  1174. this.setState({ level: e });
  1175. }}
  1176. >
  1177. <Option value={0}>一般客户(一年以上预签)</Option>
  1178. <Option value={1}>意向客户(半年内预签)</Option>
  1179. <Option value={2}>重点客户(一个月内预签)</Option>
  1180. </Select>
  1181. </FormItem>
  1182. </div>
  1183. <div className="clearfix">
  1184. <FormItem
  1185. className="mid-item"
  1186. {...formItemLayout}
  1187. required
  1188. label="客户性质" >
  1189. {/* <Select
  1190. placeholder="请选择客户性质"
  1191. value={this.state.nature}
  1192. onChange={(e) => {
  1193. this.setState({ nature: e });
  1194. }}
  1195. >
  1196. <Option value={1}>政府机构</Option>
  1197. <Option value={2}>科研院所</Option>
  1198. <Option value={3}>高等院校</Option>
  1199. <Option value={4}>国有企业</Option>
  1200. <Option value={5}>民营企业</Option>
  1201. <Option value={6}>社会团体</Option>
  1202. <Option value={0}>其他(请注明)</Option>
  1203. </Select> */}
  1204. <Cascader
  1205. options={this.state.natureOptions}
  1206. placeholder="请选择客户性质"
  1207. value={this.state.nature}
  1208. onChange={e => { this.setState({ nature: e }) }}
  1209. />
  1210. </FormItem>
  1211. </div>
  1212. {
  1213. this.state.nature && this.state.nature.length && this.state.nature[0] === 0 ?
  1214. <div className="clearfix">
  1215. <FormItem
  1216. className="mid-item"
  1217. {...formItemLayout}
  1218. required
  1219. label="其他说明" >
  1220. <Input
  1221. placeholder="其他说明"
  1222. value={this.state.natureOther}
  1223. onChange={e => {
  1224. this.setState({
  1225. natureOther: e.target.value
  1226. })
  1227. }}
  1228. />
  1229. </FormItem>
  1230. </div> : null
  1231. }
  1232. { !this.state.verificationMyUser && (
  1233. <FormItem
  1234. {...formItemLayout}
  1235. required
  1236. help="帮助文档"
  1237. label="佐证资料" >
  1238. <div className="clearfix">
  1239. <ImgList
  1240. uploadConfig={{
  1241. action: globalConfig.context + "/api/user/achievement/uploadTextFile",
  1242. data: { 'sign': 'achievement_maturity_text_file' },
  1243. multiple: true,
  1244. listType: "picture-card",
  1245. }}
  1246. onChange={(infor) => {
  1247. this.handleFileChange(infor)
  1248. }}
  1249. fileList={this.state.fileList}
  1250. />
  1251. </div>
  1252. </FormItem>
  1253. ) }
  1254. { !this.state.verificationMyUser && <Col style={{ color: 'red', marginBottom: '10px' }} span={12} offset={6}>
  1255. 注:请上传客户信息截图、电话记录等录入凭证图片
  1256. </Col> }
  1257. </div>
  1258. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  1259. <Button type="primary" htmlType="submit" style={{}}>领取客户</Button>
  1260. </FormItem>
  1261. </Spin>
  1262. </Form >
  1263. </div>
  1264. </Spin>
  1265. </Modal>
  1266. </div>
  1267. );
  1268. },
  1269. });
  1270. export default Form.create({})(QueryCustomer);