publicCustomer.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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. import { orderStatusList,cityArr,customerStatus } from '../../dataDic.js';
  8. import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js';
  9. const AchievementDetail = React.createClass({
  10. getInitialState () {
  11. return {
  12. visible: false,
  13. loading: false,
  14. dataSource: [],
  15. };
  16. },
  17. loadLogs (id) {
  18. this.setState({
  19. loading: true
  20. });
  21. $.ajax({
  22. method: "get",
  23. dataType: "json",
  24. crossDomain: false,
  25. url: globalConfig.context + "/api/admin/portal/order/achievementOrderLog",
  26. data: {
  27. id:id
  28. },
  29. success: function (data) {
  30. let theArr = [];
  31. if (!data.data) {
  32. if (data.error && data.error.length) {
  33. message.warning(data.error[0].message);
  34. };
  35. } else {
  36. for (let i = 0; i < data.data.length; i++) {
  37. let thisdata = data.data[i];
  38. theArr.push({
  39. key: i,
  40. recordTime: thisdata.recordTime,
  41. status: thisdata.status,
  42. comment: thisdata.comment,
  43. operator: thisdata.operator,
  44. recordTimeFormattedDate: thisdata.recordTimeFormattedDate //传回来的值 可能要改
  45. });
  46. };
  47. };
  48. this.setState({
  49. dataSource: theArr
  50. });
  51. }.bind(this),
  52. }).always(function () {
  53. this.setState({
  54. loading: false
  55. });
  56. }.bind(this));
  57. },
  58. handleSubmit (e) {
  59. this.setState({
  60. loading: true
  61. });
  62. $.ajax({
  63. method: "POST",
  64. dataType: "json",
  65. crossDomain: false,
  66. url: globalConfig.context + '/api/admin/portal/order/updateAchievementOrder',
  67. data: {
  68. id: this.props.data.id,
  69. }
  70. }).done(function (data) {
  71. this.setState({
  72. loading: false
  73. });
  74. if (!data.error.length) {
  75. message.success('领取成功!');
  76. this.handleOk();
  77. } else {
  78. message.warning(data.error[0].message);
  79. };
  80. }.bind(this));
  81. },
  82. handleCancel (e) {
  83. this.setState({
  84. visible: false,
  85. });
  86. this.props.closeDesc(false);
  87. },
  88. handleOk (e) {
  89. this.setState({
  90. visible: false,
  91. });
  92. this.props.closeDesc(false, true);
  93. },
  94. componentWillReceiveProps (nextProps) {
  95. if (!this.state.visible && nextProps.showDesc && nextProps.data) {
  96. this.loadLogs(nextProps.data.id);
  97. this.state.paymentId = nextProps.data.paymentId;
  98. this.state.paymentType = nextProps.data.paymentType;
  99. this.state.paymentValue = nextProps.data.paymentValue;
  100. this.state.transferPrice = nextProps.data.transferPrice;
  101. this.state.orderStatus = undefined;
  102. this.state.comment = undefined;
  103. this.state.recordTime = undefined;
  104. };
  105. this.state.visible = nextProps.showDesc;
  106. },
  107. render () {
  108. const theData = this.props.data || {};
  109. return (
  110. <div className="patent-desc">
  111. <Modal maskClosable={false} visible={this.state.visible}
  112. onOk={this.checkPatentProcess} onCancel={this.handleCancel}
  113. width='800px'
  114. footer={null}
  115. title="客户详情"
  116. className="demand-order-content">
  117. <Spin spinning={this.state.loading}>
  118. <Row>
  119. <Col span={2}>客户类型:</Col>
  120. <Col span={10}>{getcustomerTyp(theData.customerTyp)}</Col>
  121. <Col span={2}>编号:</Col>
  122. <Col span={10}>{theData.id}</Col>
  123. </Row>
  124. <Row>
  125. <Col span={2}>录入时间:</Col>
  126. <Col span={10}>{theData.createTime}</Col>
  127. <Col span={2}>跟单人:</Col>
  128. <Col span={10}>{theData.ownerId}</Col>
  129. </Row>
  130. <Row>基本资料:</Row>
  131. <Row>
  132. <Col span={2}>公司名称:</Col>
  133. <Col span={10}>{theData.companyName}</Col>
  134. <Col span={2}>公司行业:</Col>
  135. <Col span={10}>{theData.companyIndustry}</Col>
  136. </Row>
  137. <Row>
  138. <Col span={2}>意向服务:</Col>
  139. <Col span={10}>{getCompanyIntention(theData.companyIntention)}</Col>
  140. <Col span={2}>地区:</Col>
  141. <Col span={10}>{getcityArr(theData.province)}</Col>
  142. </Row>
  143. <Row>
  144. <Col span={2}>最新跟进:</Col>
  145. <Col span={10}>{getfllowSituation(theData.followSituation)}</Col>
  146. <Col span={2}>客户状态:</Col>
  147. <Col span={10}>{getcustomerStatue(theData.customerStatus)}</Col>
  148. </Row>
  149. <Row>
  150. <Col span={2}>详细地址:</Col>
  151. <Col span={10}>{theData.adress}</Col>
  152. <Col span={2}>备注:</Col>
  153. <Col span={10}>{theData.remark}</Col>
  154. </Row>
  155. <Row>联系资料:</Row>
  156. <Row>
  157. <Col span={2}>姓名:</Col>
  158. <Col span={10}>{theData.contactName}</Col>
  159. <Col span={2}>性别:</Col>
  160. <Col span={10}>{getsex(theData.sex)}</Col>
  161. </Row>
  162. <Row>
  163. <Col span={2}>手机号码:</Col>
  164. <Col span={10}>{theData.telNum}</Col>
  165. <Col span={2}>座机号:</Col>
  166. <Col span={10}>{theData.mobile}</Col>
  167. </Row>
  168. <Row>
  169. <Col span={2}>QQ号码:</Col>
  170. <Col span={10}>{theData.qq}</Col>
  171. <Col span={2}>邮箱号:</Col>
  172. <Col span={10}>{theData.email}</Col>
  173. </Row>
  174. <Row>
  175. <Col span={2}>微信:</Col>
  176. <Col span={10}>{theData.wechat}</Col>
  177. <Col span={2}>部门:</Col>
  178. <Col span={10}>{theData.department}</Col>
  179. </Row>
  180. <Row>
  181. <Col span={2}>职位:</Col>
  182. <Col span={10}>{theData.customerPosition}</Col>
  183. </Row>
  184. <Row>
  185. <Col span={2}></Col>
  186. <Col span={20}>
  187. <Button style={{ marginRight: '20px' }} type="primary" onClick={this.handleSubmit}>领取</Button>
  188. <Button className="set-submit" type="ghost" onClick={this.handleCancel}>取消</Button>
  189. </Col>
  190. </Row>
  191. </Spin>
  192. </Modal>
  193. </div>
  194. );
  195. },
  196. });
  197. //查询功能和初始列表
  198. const AchievementOrderList = React.createClass({
  199. loadData(pageNo, apiUrl) {
  200. this.state.data = [];
  201. this.setState({
  202. loading: true
  203. });
  204. $.ajax({
  205. method: "get",
  206. dataType: "json",
  207. crossDomain: false,
  208. url:globalConfig.context + '/api/admin/customer/searchCustomerList',
  209. data: {
  210. pageNo: pageNo || 1,
  211. pageSize: this.state.pagination.pageSize,
  212. companyName: this.state.companyName, //名称
  213. customerTyp: this.state.customerTyp, //客户类型
  214. province:this.state.province,//地区
  215. customerStatus:this.state.customerStatus,//客户状态1
  216. contactName:this.state.contactName,//联系人姓名1
  217. adminName:this.state.adminName,//跟单人1
  218. companyIntention:this.state.companyIntention,//意向服务1
  219. followSituation:this.state.followSituation,//跟进进度1
  220. },
  221. success: function (data) {
  222. let theArr = [];
  223. if (!data.data || !data.data.list) {
  224. if (data.error && data.error.length) {
  225. message.warning(data.error[0].message);
  226. };
  227. } else {
  228. for (let i = 0; i < data.data.list.length; i++) {
  229. let thisdata = data.data.list[i];
  230. theArr.push({
  231. key: i,
  232. id: thisdata.id,
  233. companyName:thisdata.companyName,
  234. customerTyp:thisdata.customerTyp,
  235. province:thisdata.province,
  236. contactName:thisdata.contactName,
  237. telNum:thisdata.telNum,
  238. customerStatus:thisdata.customerStatus,
  239. companyIntention:thisdata.companyIntention,
  240. followSituation:thisdata.followSituation,
  241. adminName:thisdata.adminName
  242. });
  243. };
  244. this.state.pagination.current = data.data.pageNo;
  245. this.state.pagination.total = data.data.totalCount;
  246. };
  247. this.setState({
  248. dataSource: theArr,
  249. pagination: this.state.pagination
  250. });
  251. }.bind(this),
  252. }).always(function () {
  253. this.setState({
  254. loading: false
  255. });
  256. }.bind(this));
  257. },
  258. getInitialState() {
  259. return {
  260. searchMore: true,
  261. searchType: 0,
  262. validityPeriodDate: [],
  263. releaseDate: [],
  264. selectedRowKeys: [],
  265. selectedRows: [],
  266. loading: false,
  267. pagination: {
  268. defaultCurrent: 1,
  269. defaultPageSize: 10,
  270. showQuickJumper: true,
  271. pageSize: 10,
  272. onChange: function (page) {
  273. this.loadData(page);
  274. }.bind(this),
  275. showTotal: function (total) {
  276. return '共' + total + '条数据';
  277. }
  278. },
  279. columns: [
  280. {
  281. title: '公司名称',
  282. dataIndex: 'companyName',
  283. key: 'companyName',
  284. }, {
  285. title: '客户类型',
  286. dataIndex: 'customerTyp',
  287. key: 'customerTyp',
  288. render: text => { return getcustomerTyp(text); }
  289. }, {
  290. title: '地区',
  291. dataIndex: 'province',
  292. key: 'province',
  293. render: text => { return getcityArr(text); }
  294. }, {
  295. title: '联系人姓名',
  296. dataIndex: 'contactName',
  297. key: 'contactName',
  298. },
  299. {
  300. title: '手机号',
  301. dataIndex: 'telNum',
  302. key:'telNum',
  303. },
  304. {
  305. title: '客户状态',
  306. dataIndex: 'customerStatus',
  307. key: 'customerStatus',
  308. render: text => { return getcustomerStatue(text) }
  309. },
  310. {
  311. title: '意向服务',
  312. dataIndex: 'companyIntention',
  313. key: 'companyIntention',
  314. render: text => { return getCompanyIntention(text) }
  315. },
  316. {
  317. title: '最新跟进',
  318. dataIndex: 'followSituation',
  319. key: 'followSituation',
  320. render: text => { return getfllowSituation(text) }
  321. },
  322. {
  323. title: '跟单人',
  324. dataIndex: 'adminName',
  325. key: 'adminName',
  326. }
  327. ],
  328. dataSource: [],
  329. searchTime: [],
  330. };
  331. },
  332. componentWillMount() {
  333. let theArr = [];
  334. customerStatus.map(function (item) {
  335. theArr.push(
  336. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  337. )
  338. });
  339. let auditArr = [];
  340. cityArr.map(function (item) {
  341. auditArr.push(
  342. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  343. )
  344. });
  345. this.state.customerStatuarr = theArr;
  346. this.state.auditStatusOption = auditArr;
  347. if (window.location.search) {
  348. let theObj = getSearchUrl(window.location.search);
  349. if (theObj.rid) {
  350. theObj.id = theObj.rid;
  351. if (theObj.rid != 'null') {
  352. this.tableRowClick(theObj);
  353. };
  354. };
  355. };
  356. this.loadData();
  357. },
  358. tableRowClick(record, index) {
  359. this.state.RowData = record;
  360. this.setState({
  361. showDesc: true
  362. });
  363. },
  364. closeDesc(e, s) {
  365. this.state.showDesc = e;
  366. if (s) {
  367. this.loadData();
  368. };
  369. },
  370. search() {
  371. this.loadData();
  372. },
  373. reset() {
  374. this.state.id = undefined;
  375. this.state.companyName = undefined;
  376. this.state.customerTyp = undefined;
  377. this.state.province = undefined;
  378. this.state.ownerType = undefined;
  379. this.state.customerStatus = undefined;
  380. this.state.auditStatus = undefined;
  381. this.state.ownerId = undefined;
  382. this.state.contactName = undefined;
  383. this.state.releaseDate = [];
  384. this.loadData();
  385. },
  386. searchSwitch() {
  387. this.setState({
  388. searchMore: !this.state.searchMore
  389. });
  390. },
  391. render() {
  392. const rowSelection = {
  393. selectedRowKeys: this.state.selectedRowKeys,
  394. onChange: (selectedRowKeys, selectedRows) => {
  395. this.setState({
  396. selectedRows: selectedRows.slice(-1),
  397. selectedRowKeys: selectedRowKeys.slice(-1)
  398. });
  399. }
  400. };
  401. const hasSelected = this.state.selectedRowKeys.length > 0;
  402. const { RangePicker } = DatePicker;
  403. return (
  404. <div className="user-content" >
  405. <div className="content-title">
  406. <span>公共客户管理</span>
  407. </div>
  408. <div className="user-search">
  409. <Input placeholder="公司名称"
  410. value={this.state.companyName}
  411. onChange={(e) => { this.setState({ companyName: e.target.value }); }} />
  412. <Select placeholder="客户类型" style={{ width: 120 }}
  413. value={this.state.customerTyp }
  414. onChange={(e) => { this.setState({ customerTyp : e }) }}>
  415. <Select.Option value="0" >个人客户</Select.Option>
  416. <Select.Option value="1" >公司客户</Select.Option>
  417. </Select>
  418. <Select placeholder="地区"
  419. style={{ width: 160 }}
  420. value={this.state.province}
  421. onChange={(e) => { this.setState({ province: e }) }}>
  422. {this.state.auditStatusOption}
  423. </Select>
  424. <Select placeholder="客户状态" style={{ width: 120 }}
  425. value={this.state.customerStatus}
  426. onChange={(e) => { this.setState({ customerStatus: e }) }}>
  427. {this.state.customerStatuarr}
  428. </Select>
  429. <Button type="primary" onClick={this.search}>搜索</Button>
  430. <Button onClick={this.reset}>重置</Button>
  431. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  432. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  433. <Input placeholder="跟单人" style={{width:'140px',marginRight:'10px'}}
  434. value={this.state.ownerId}
  435. onChange={(e) => { this.setState({ ownerId: e.target.value }); }} />
  436. <Input placeholder="联系人姓名" style={{width:'140px',marginRight:'10px'}}
  437. value={this.state.contactName}
  438. onChange={(e) => { this.setState({ contactName: e.target.value }); }} />
  439. <span>发布时间 :</span>
  440. <RangePicker
  441. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  442. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  443. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  444. </div>
  445. </div>
  446. <div className="patent-table">
  447. <Spin spinning={this.state.loading}>
  448. <Table columns={this.state.columns}
  449. dataSource={this.state.dataSource}
  450. rowSelection={rowSelection}
  451. pagination={this.state.pagination}
  452. onRowClick={this.tableRowClick} />
  453. </Spin>
  454. </div>
  455. <AchievementDetail
  456. data={this.state.RowData}
  457. showDesc={this.state.showDesc}
  458. closeDesc={this.closeDesc} />
  459. </div >
  460. );
  461. }
  462. });
  463. export default AchievementOrderList;