companyCustomer.jsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. import React from 'react';
  2. import { AutoComplete, Icon, Button, Input, InputNumber, Select, Spin, Table, message, Modal, Row, Col, DatePicker,Switch,Upload} from 'antd';
  3. import ajax from 'jquery/src/ajax/xhr.js';
  4. import $ from 'jquery/src/ajax';
  5. import moment from 'moment';
  6. import './myClient.less';
  7. const { Column, ColumnGroup } = Table;
  8. import { orderStatusList,cityArr,customerStatus,intentionalService,newFollow} from '../../dataDic.js';
  9. import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js';
  10. //查询功能和初始列表
  11. const PublicCustomer = React.createClass({
  12. loadData(pageNo, detailApiUrl) {
  13. this.state.data = [];
  14. this.setState({
  15. loading: true
  16. });
  17. $.ajax({
  18. method: "post",
  19. dataType: "json",
  20. crossDomain: false,
  21. url:globalConfig.context +'/api/admin/customer/listCompanyCustomer',
  22. data: {
  23. pageNo: pageNo || 1,
  24. pageSize: this.state.pagination.pageSize,
  25. companyName: this.state.companyName, //名称1
  26. customerType: this.state.customerType, //客户类型1
  27. locationProvince:this.state.locationProvince,//地区
  28. customerStatus:this.state.customerStatust,//客户状态1
  29. contactName:this.state.contactName,//联系人姓名1
  30. contactTel:this.state.contactTel,//联系人手机
  31. companyIntention:this.state.companyIntention,//意向服务
  32. followSituation:this.state.followSituationt,//最新跟进进度
  33. //releaseDateStartDate: this.state.releaseDate[0],
  34. //releaseDateEndDate: this.state.releaseDate[1],
  35. },
  36. success: function (data) {
  37. let theArr = [];
  38. if (!data.data || !data.data.list) {
  39. if (data.error && data.error.length) {
  40. message.warning(data.error[0].message);
  41. };
  42. } else {
  43. for (let i = 0; i < data.data.list.length; i++) {
  44. let thisdata = data.data.list[i];
  45. theArr.push({
  46. key: i,
  47. id: thisdata.id,
  48. companyName:thisdata.companyName,//公司名称
  49. customerType:thisdata.customerType,
  50. _customerType:thisdata._customerType,//客户类型
  51. locationProvince:thisdata.locationProvince,//地区
  52. contactName:thisdata.contactName, //联系人姓名
  53. telNum:thisdata.telNum,//手机号
  54. _customerStatus:thisdata._customerStatus,//客户状态
  55. _companyIntention:thisdata._companyIntention,//意向服务
  56. _followSituation:thisdata._followSituation,//最新跟进
  57. customerStatus:thisdata.customerStatus,//客户状态
  58. companyIntention:thisdata.companyIntention,//意向服务
  59. followSituation:thisdata.followSituation,//最新跟进
  60. adminName:thisdata.adminName, //跟进人
  61. followDate:thisdata.followDate,
  62. customerStatus:thisdata.customerStatus,//客户状态
  63. companyIntention:thisdata.companyIntention,//意向服务
  64. });
  65. };
  66. this.state.pagination.current = data.data.pageNo;
  67. this.state.pagination.total = data.data.totalCount;
  68. };
  69. this.setState({
  70. dataSource: theArr,
  71. pagination: this.state.pagination
  72. });
  73. }.bind(this),
  74. }).always(function () {
  75. this.setState({
  76. loading: false
  77. });
  78. }.bind(this));
  79. },
  80. //查看详情
  81. Detailload(deletedIds){
  82. $.ajax({
  83. method: "post",
  84. dataType: "json",
  85. crossDomain: false,
  86. url: globalConfig.context + '/api/admin/customer/findAllCustomerDetails',
  87. data: {
  88. id: deletedIds
  89. },
  90. success: function (data) {
  91. let thisData = data.data;
  92. if (!thisData) {
  93. if (data.error && data.error.length) {
  94. message.warning(data.error[0].message);
  95. };
  96. thisData = {};
  97. };
  98. this.setState({
  99. data: thisData,
  100. followSituation:thisData.followSituation,
  101. customerStatus:thisData.customerStatus,
  102. });
  103. }.bind(this),
  104. }).always(function () {
  105. this.setState({
  106. loading: false
  107. });
  108. }.bind(this));
  109. },
  110. getInitialState() {
  111. return {
  112. searchMore: true,
  113. searchType: 0,
  114. validityPeriodDate: [],
  115. releaseDate: [],
  116. selectedRowKeys: [],
  117. selectedRows: [],
  118. loading: false,
  119. pagination: {
  120. defaultCurrent: 1,
  121. defaultPageSize: 10,
  122. showQuickJumper: true,
  123. pageSize: 10,
  124. onChange: function (page) {
  125. this.loadData(page);
  126. }.bind(this),
  127. showTotal: function (total) {
  128. return '共' + total + '条数据';
  129. }
  130. },
  131. contactInformation:[
  132. {
  133. title: '姓名',
  134. dataIndex: 'contactName',
  135. key: 'contactName'
  136. },{
  137. title: '性别',
  138. dataIndex: 'sex',
  139. key: 'sex',
  140. render: text => { return getsex(text); }
  141. },
  142. {
  143. title: '手机号码',
  144. dataIndex: 'telNum',
  145. key: 'telNum'
  146. },{
  147. title: '座机号',
  148. dataIndex: 'mobile',
  149. key: 'mobile'
  150. },{
  151. title: 'QQ号码',
  152. dataIndex: 'qq',
  153. key: 'qq'
  154. },{
  155. title: '邮箱号',
  156. dataIndex: 'email',
  157. key: 'email'
  158. },{
  159. title: '微信',
  160. dataIndex: 'wechat',
  161. key: 'wechat'
  162. },{
  163. title: '部门',
  164. dataIndex: 'depatrment',
  165. key: 'depatrment'
  166. },{
  167. title: '职位',
  168. dataIndex: 'customerPosition',
  169. key: 'customerPosition'
  170. },
  171. ],
  172. columns: [
  173. {
  174. title: '公司名称',
  175. dataIndex: 'companyName',
  176. key: 'companyName',
  177. }, {
  178. title: '客户类型',
  179. dataIndex: '_customerType',
  180. key: '_customerType',
  181. //render: text => { return getcustomerTyp(text); }
  182. }, {
  183. title: '地区',
  184. dataIndex: 'locationProvince',
  185. key: 'locationProvince',
  186. render: text => { return getcityArr(text); }
  187. }, {
  188. title: '联系人姓名',
  189. dataIndex: 'contactName',
  190. key: 'contactName',
  191. },
  192. {
  193. title: '手机号',
  194. dataIndex: 'telNum',
  195. key:'telNum',
  196. },
  197. {
  198. title: '客户状态',
  199. dataIndex: '_customerStatus',
  200. key: '_customerStatus',
  201. //render: text => { return getcustomerStatue(text) }
  202. },
  203. {
  204. title: '意向服务',
  205. dataIndex: '_companyIntention',
  206. key: '_companyIntention',
  207. //render: text => { return getCompanyIntention(text) }
  208. },
  209. {
  210. title: '最新跟进',
  211. dataIndex: '_followSituation',
  212. key: '_followSituation',
  213. //render: text => { return getfllowSituation(text) }
  214. },
  215. {
  216. title: '跟单人',
  217. dataIndex: 'adminName',
  218. key: 'adminName',
  219. },
  220. {
  221. title: '时间',
  222. dataIndex: 'followDate',
  223. key: 'followDate',
  224. }
  225. ],
  226. dataSource: [],
  227. searchTime: [],
  228. };
  229. },
  230. componentWillMount() {
  231. let theArr = [];
  232. customerStatus.map(function (item) {
  233. theArr.push(
  234. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  235. )
  236. });
  237. let intentionalArr = [];
  238. intentionalService.map(function (item) {
  239. intentionalArr.push(
  240. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  241. )
  242. });
  243. let newArr = [];
  244. newFollow.map(function (item) {
  245. newArr.push(
  246. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  247. )
  248. });
  249. let auditArr = [];
  250. cityArr.map(function (item) {
  251. auditArr.push(
  252. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  253. )
  254. });
  255. this.state.customerStatuarr = theArr;
  256. this.state.intentionalOption = intentionalArr;
  257. this.state.newOption = newArr;
  258. this.state.auditStatusOption = auditArr;
  259. if (window.location.search) {
  260. let theObj = getSearchUrl(window.location.search);
  261. if (theObj.rid) {
  262. theObj.id = theObj.rid;
  263. if (theObj.rid != 'null') {
  264. this.tableRowClick(theObj);
  265. };
  266. };
  267. };
  268. this.loadData();
  269. },
  270. tableRowClick(record) {
  271. this.state.RowData = record;
  272. this.setok(record.id);
  273. this.setState({
  274. hids:record.id
  275. })
  276. },
  277. //点击消失函数
  278. setModal3Visiblecancel(e) {
  279. this.setState({
  280. modal3Visible:false
  281. });
  282. },
  283. closeDesc(e, s) {
  284. this.state.showDesc = e;
  285. if (s) {
  286. this.loadData();
  287. };
  288. },
  289. search() {
  290. this.loadData();
  291. },
  292. reset() {
  293. this.state.companyName='';
  294. this.state.customerType=undefined;
  295. this.state.id = undefined;
  296. this.state.shareType = undefined;
  297. this.state.companyIntention = undefined;
  298. this.state.followSituation = undefined;
  299. this.state.locationProvince = undefined;
  300. this.state.customerStatus = undefined;
  301. this.state.contactName = undefined;
  302. this.state.contactTel = undefined;
  303. this.state.contactName = undefined;
  304. this.state.releaseDate = [];
  305. this.loadData();
  306. },
  307. searchSwitch() {
  308. this.setState({
  309. searchMore: !this.state.searchMore
  310. });
  311. },
  312. //点击消失函数
  313. setok(e) {
  314. this.setState({
  315. visible:true
  316. });
  317. this.Detailload(e)
  318. },
  319. setcancel(e) {
  320. this.setState({
  321. visible:false
  322. });
  323. },
  324. setoks(index) {
  325. this.setState({
  326. visible1:true
  327. });
  328. this.setState({
  329. loading: true
  330. });
  331. $.ajax({
  332. method: "post",
  333. dataType: "json",
  334. crossDomain: false,
  335. url: globalConfig.context + "/api/admin/customer/findCustomerUserList",
  336. data:{
  337. cid:this.state.hids
  338. },
  339. success: function (data) {
  340. let theArr = [];
  341. let thedata=data.data;
  342. for (let i = 0; i < data.data.length; i++) {
  343. let thisdata = data.data[i];
  344. theArr.push({
  345. id:thisdata.id,//联系人ID
  346. contactName:thisdata.name,//联系人姓名
  347. sex:thisdata.sex,//联系人性别
  348. mobile:thisdata.mobile,//座机号
  349. telNum:thisdata.telNum,//手机号
  350. email:thisdata.email,//邮箱
  351. qq:thisdata.qq,//qq
  352. wechat:thisdata.wechat,//微信号
  353. depatrment:thisdata.depatrment,//部门
  354. customerPosition:thisdata.customerPosition,//职位
  355. });
  356. };
  357. this.setState({
  358. information: theArr,
  359. });
  360. }.bind(this),
  361. }).always(function () {
  362. this.setState({
  363. loading: false
  364. });
  365. }.bind(this));
  366. },
  367. setcancels(e) {
  368. this.setState({
  369. visible1:false
  370. });
  371. },
  372. //点击查看跟进记录,点击最新跟进的第一个按钮(跟进状态)执行的函数,将会出现很多跟进列表
  373. setModal3VisibleOk(e) {
  374. this.setState({ modal3Visible:true });
  375. this.state.data = [];
  376. this.setState({
  377. loading: true
  378. });
  379. let deletedIds=this.state.rowId;
  380. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  381. let rowItem = this.state.selectedRows[idx];
  382. if (rowItem.id) {
  383. deletedIds=rowItem.id;
  384. };
  385. };
  386. $.ajax({
  387. method: "get",
  388. dataType: "json",
  389. crossDomain: false,
  390. url:globalConfig.context + '/api/admin/customer/listAllFollowUpRecord',
  391. data: {
  392. customerId:deletedIds
  393. },
  394. success: function (data) {
  395. let theArr = [];
  396. let theWomanID=[];
  397. let theFollowID=[];
  398. if (!data.data) {
  399. if (data.error && data.error.length) {
  400. message.warning(data.error[0].message);
  401. };
  402. } else {
  403. data.data.map(function (item,index) {
  404. theWomanID.push(data.data[index].contactId);
  405. });
  406. data.data.map(function (item,index) {
  407. theFollowID.push(data.data[index].followId);
  408. });
  409. for (let i = 0; i < data.data.length; i++) {
  410. let thisdata = data.data[i];
  411. theArr.push({
  412. key:i,
  413. _followDate:thisdata._followDate,//跟进时间
  414. adminName:thisdata.adminName,//跟进人
  415. contactName:thisdata.contactName, //联系人姓名
  416. contactId:thisdata.contactId, //联系人ID
  417. contactInfo:thisdata.contactInfo,//联系信息
  418. _customerStatus:thisdata._customerStatus,//客户状态
  419. _followSituation:thisdata._followSituation,//最新跟进
  420. followResult:thisdata.followResult,//跟进结果
  421. attachment:thisdata.attachment,//附件地址
  422. });
  423. };
  424. };
  425. this.setState({//导出数据
  426. datahistory: theArr,
  427. theWomanID:theWomanID,
  428. theFollowID:theFollowID,
  429. });
  430. }.bind(this),
  431. }).always(function () {
  432. this.setState({
  433. loading: false
  434. });
  435. }.bind(this));
  436. },
  437. render() {
  438. const theData = this.state.data || {};
  439. const rowSelection = {
  440. selectedRowKeys: this.state.selectedRowKeys,
  441. onChange: (selectedRowKeys, selectedRows) => {
  442. this.setState({
  443. selectedRows: selectedRows.slice(-1),
  444. selectedRowKeys: selectedRowKeys.slice(-1)
  445. });
  446. }
  447. };
  448. const hasSelected = this.state.selectedRowKeys.length > 0;
  449. const { RangePicker } = DatePicker;
  450. return (
  451. <div className="user-content" >
  452. <div className="content-title">
  453. <span>公共客户管理</span>
  454. </div>
  455. <div className="user-search">
  456. <Input placeholder="公司名称"
  457. value={this.state.companyName}
  458. onChange={(e) => { this.setState({ companyName: e.target.value }); }} />
  459. <Select placeholder="客户类型" style={{ width: 120 }}
  460. value={this.state.customerType }
  461. onChange={(e) => { this.setState({ customerType : e }) }}>
  462. <Select.Option value="0" >个人客户</Select.Option>
  463. <Select.Option value="1" >公司客户</Select.Option>
  464. </Select>
  465. <Select placeholder="意向服务"
  466. style={{ width: 160 }}
  467. value={this.state.companyIntention}
  468. onChange={(e) => { this.setState({ companyIntention: e }) }}>
  469. {this.state.intentionalOption}
  470. </Select>
  471. <Select placeholder="跟进进度"
  472. style={{ width: 160 }}
  473. value={this.state.followSituationt}
  474. onChange={(e) => { this.setState({ followSituationt: e }) }}>
  475. {this.state.newOption}
  476. </Select>
  477. <Select placeholder="地区"
  478. style={{ width: 160 }}
  479. value={this.state.locationProvince}
  480. onChange={(e) => { this.setState({ locationProvince: e }) }}>
  481. {this.state.auditStatusOption}
  482. </Select>
  483. <Select placeholder="客户状态" style={{ width: 120 }}
  484. value={this.state.customerStatust}
  485. onChange={(e) => { this.setState({customerStatust: e }) }}>
  486. {this.state.customerStatuarr}
  487. </Select>
  488. <Button type="primary" onClick={this.search}>搜索</Button>
  489. <Button onClick={this.reset}>重置</Button>
  490. <Button onClick={this.setModal3VisibleOk} style={{marginRight:'10px'}} disabled={!hasSelected}>查看跟进记录</Button>
  491. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  492. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  493. <Input placeholder="联系人姓名" style={{width:'140px',marginRight:'10px'}}
  494. value={this.state.contactName}
  495. onChange={(e) => { this.setState({ contactName: e.target.value }); }} />
  496. <Input placeholder="手机号码" style={{width:'140px',marginRight:'10px'}}
  497. value={this.state.contactTel }
  498. onChange={(e) => { this.setState({ contactTel: e.target.value }); }} />
  499. </div>
  500. </div>
  501. <div className="patent-table">
  502. <Spin spinning={this.state.loading}>
  503. <Table columns={this.state.columns}
  504. dataSource={this.state.dataSource}
  505. rowSelection={rowSelection}
  506. pagination={this.state.pagination}
  507. onRowClick={this.tableRowClick} />
  508. </Spin>
  509. </div>
  510. <Modal maskClosable={false}
  511. visible={this.state.visible}
  512. onOk={this.setcancel}
  513. onCancel={this.setcancel}
  514. width='800px'
  515. footer={null}
  516. title="客户详情"
  517. className="demand-order-content">
  518. <Spin spinning={this.state.loading}>
  519. <Row style={{marginLeft:'100px'}}>
  520. <Col span={3}>客户类型:</Col>
  521. <Col span={6}>{theData._customerType}</Col>
  522. </Row>
  523. <Row style={{marginLeft:'100px'}}>
  524. <Col span={3}>录入时间:</Col>
  525. <Col span={6}>{theData.createTime}</Col>
  526. <Col span={3}>跟单人:</Col>
  527. <Col span={6}>{theData.adminName}</Col>
  528. </Row>
  529. <Row style={{marginLeft:'50px'}}>基本资料:</Row>
  530. <Row style={{marginLeft:'100px'}}>
  531. <Col span={3}>公司名称:</Col>
  532. <Col span={6}>{theData.companyName}</Col>
  533. <Col span={3}>公司行业:</Col>
  534. <Col span={6}>{theData.companyIndustry}</Col>
  535. </Row>
  536. <Row style={{marginLeft:'100px'}}>
  537. <Col span={3}>意向服务:</Col>
  538. <Col span={6}>{getCompanyIntention(theData.companyIntention)}</Col>
  539. <Col span={3}>地区:</Col>
  540. <Col span={6}>{getcityArr(theData.locationProvince)}</Col>
  541. </Row>
  542. <Row style={{marginLeft:'100px'}}>
  543. <Col span={3}>最新跟进:</Col>
  544. <Col span={6}>{theData._followSituation}</Col>
  545. <Col span={3}>客户状态:</Col>
  546. <Col span={6}>{theData._customerStatus}</Col>
  547. </Row>
  548. <Row style={{marginLeft:'100px'}}>
  549. <Col span={3}>详细地址:</Col>
  550. <Col span={6}>{theData.adress}</Col>
  551. </Row>
  552. <Row style={{marginLeft:'100px'}}>
  553. <Col span={3}>备注:</Col>
  554. <Col span={6}>{theData.remarks}</Col>
  555. </Row>
  556. </Spin>
  557. </Modal>
  558. <Modal
  559. footer=''
  560. title="历史记录列表"
  561. width='800px'
  562. visible={this.state.modal3Visible}
  563. onOk={this.setModal3Visiblecancel}
  564. onCancel={this.setModal3Visiblecancel}
  565. >
  566. <Spin spinning={this.state.loading}>
  567. <Table dataSource={this.state.datahistory} >
  568. <Column
  569. title="时间"
  570. dataIndex="_followDate"
  571. key="_followDate"
  572. />
  573. <Column
  574. title="客户"
  575. dataIndex="contactName"
  576. key="contactName"
  577. />
  578. <Column
  579. title="跟进人"
  580. dataIndex="adminName"
  581. key="adminName"
  582. />
  583. <Column
  584. title="联系方式"
  585. dataIndex="contactInfo"
  586. key="contactInfo"
  587. />
  588. <Column
  589. title="最新跟进状态"
  590. dataIndex="_followSituation"
  591. key="_followSituation"
  592. />
  593. <Column
  594. title="跟进结果"
  595. dataIndex="followResult"
  596. key="followResult"
  597. />
  598. </Table>
  599. </Spin>
  600. </Modal>
  601. </div >
  602. );
  603. }
  604. });
  605. export default PublicCustomer;