publicCustomer.jsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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.fllowSituation)}</Col>
  146. <Col span={2}>客户状态:</Col>
  147. <Col span={10}>{getcustomerStatue(theData.customerStatue)}</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.customerName}</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. const AchievementOrderList = React.createClass({
  198. loadData(pageNo, apiUrl) {
  199. this.state.data = [];
  200. this.setState({
  201. loading: true
  202. });
  203. $.ajax({
  204. method: "get",
  205. dataType: "json",
  206. crossDomain: false,
  207. url:globalConfig.context + '/api/admin/customer/searchCustomerList',
  208. data: {
  209. pageNo: pageNo || 1,
  210. pageSize: this.state.pagination.pageSize,
  211. companyName: this.state.companyName, //名称
  212. customerTyp: this.state.customerTyp, //客户类型
  213. province:this.state.province,//地区
  214. customerStatue:this.state.customerStatue,//客户状态
  215. customerName:this.state.customerName,//联系人姓名
  216. adminName:this.state.adminName,//跟单人
  217. },
  218. success: function (data) {
  219. let theArr = [];
  220. if (!data.data || !data.data.list) {
  221. if (data.error && data.error.length) {
  222. message.warning(data.error[0].message);
  223. };
  224. } else {
  225. for (let i = 0; i < data.data.list.length; i++) {
  226. let thisdata = data.data.list[i];
  227. theArr.push({
  228. key: i,
  229. id: thisdata.id,
  230. companyName:thisdata.companyName,
  231. customerTyp:thisdata.customerTyp,
  232. province:thisdata.province,
  233. customerName:thisdata.customerName,
  234. telNum:thisdata.telNum,
  235. customerStatue:thisdata.customerStatue,
  236. companyIntention:thisdata.companyIntention,
  237. fllowSituation:thisdata.fllowSituation,
  238. adminName:thisdata.adminName
  239. });
  240. };
  241. this.state.pagination.current = data.data.pageNo;
  242. this.state.pagination.total = data.data.totalCount;
  243. };
  244. this.setState({
  245. dataSource: theArr,
  246. pagination: this.state.pagination
  247. });
  248. }.bind(this),
  249. }).always(function () {
  250. this.setState({
  251. loading: false
  252. });
  253. }.bind(this));
  254. },
  255. getInitialState() {
  256. return {
  257. searchMore: true,
  258. searchType: 0,
  259. validityPeriodDate: [],
  260. releaseDate: [],
  261. selectedRowKeys: [],
  262. selectedRows: [],
  263. loading: false,
  264. pagination: {
  265. defaultCurrent: 1,
  266. defaultPageSize: 10,
  267. showQuickJumper: true,
  268. pageSize: 10,
  269. onChange: function (page) {
  270. this.loadData(page);
  271. }.bind(this),
  272. showTotal: function (total) {
  273. return '共' + total + '条数据';
  274. }
  275. },
  276. columns: [
  277. {
  278. title: '公司名称',
  279. dataIndex: 'companyName',
  280. key: 'companyName',
  281. }, {
  282. title: '客户类型',
  283. dataIndex: 'customerTyp',
  284. key: 'customerTyp',
  285. render: text => { return getcustomerTyp(text); }
  286. }, {
  287. title: '地区',
  288. dataIndex: 'province',
  289. key: 'province',
  290. render: text => { return getcityArr(text); }
  291. }, {
  292. title: '联系人姓名',
  293. dataIndex: 'customerName',
  294. key: 'customerName',
  295. },
  296. {
  297. title: '手机号',
  298. dataIndex: 'telNum',
  299. key:'telNum',
  300. },
  301. {
  302. title: '客户状态',
  303. dataIndex: 'customerStatue',
  304. key: 'customerStatue',
  305. render: text => { return getcustomerStatue(text) }
  306. },
  307. {
  308. title: '意向服务',
  309. dataIndex: 'companyIntention',
  310. key: 'companyIntention',
  311. render: text => { return getCompanyIntention(text) }
  312. },
  313. {
  314. title: '最新跟进',
  315. dataIndex: 'fllowSituation',
  316. key: 'fllowSituation',
  317. render: text => { return getfllowSituation(text) }
  318. },
  319. {
  320. title: '跟单人',
  321. dataIndex: 'adminName',
  322. key: 'adminName',
  323. }
  324. ],
  325. dataSource: [],
  326. searchTime: [,]
  327. };
  328. },
  329. componentWillMount() {
  330. let theArr = [];
  331. customerStatus.map(function (item) {
  332. theArr.push(
  333. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  334. )
  335. });
  336. let auditArr = [];
  337. cityArr.map(function (item) {
  338. auditArr.push(
  339. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  340. )
  341. });
  342. this.state.customerStatuarr = theArr;
  343. this.state.auditStatusOption = auditArr;
  344. if (window.location.search) {
  345. let theObj = getSearchUrl(window.location.search);
  346. if (theObj.rid) {
  347. theObj.id = theObj.rid;
  348. if (theObj.rid != 'null') {
  349. this.tableRowClick(theObj);
  350. };
  351. };
  352. };
  353. this.loadData();
  354. },
  355. tableRowClick(record, index) {
  356. this.state.RowData = record;
  357. this.setState({
  358. showDesc: true
  359. });
  360. },
  361. closeDesc(e, s) {
  362. this.state.showDesc = e;
  363. if (s) {
  364. this.loadData();
  365. };
  366. },
  367. search() {
  368. this.loadData();
  369. },
  370. reset() {
  371. this.state.id = undefined;
  372. this.state.companyName = undefined;
  373. this.state.customerTyp = undefined;
  374. this.state.province = undefined;
  375. this.state.ownerType = undefined;
  376. this.state.customerStatue = undefined;
  377. this.state.auditStatus = undefined;
  378. this.state.ownerId = undefined;
  379. this.state.customerName = undefined;
  380. this.state.releaseDate = [];
  381. this.loadData();
  382. },
  383. searchSwitch() {
  384. this.setState({
  385. searchMore: !this.state.searchMore
  386. });
  387. },
  388. render() {
  389. const rowSelection = {
  390. selectedRowKeys: this.state.selectedRowKeys,
  391. onChange: (selectedRowKeys, selectedRows) => {
  392. this.setState({
  393. selectedRows: selectedRows.slice(-1),
  394. selectedRowKeys: selectedRowKeys.slice(-1)
  395. });
  396. }
  397. };
  398. const hasSelected = this.state.selectedRowKeys.length > 0;
  399. const { RangePicker } = DatePicker;
  400. return (
  401. <div className="user-content" >
  402. <div className="content-title">
  403. <span>公共客户管理</span>
  404. </div>
  405. <div className="user-search">
  406. <Input placeholder="公司名称"
  407. value={this.state.companyName}
  408. onChange={(e) => { this.setState({ companyName: e.target.value }); }} />
  409. <Select placeholder="客户类型" style={{ width: 120 }}
  410. value={this.state.customerTyp }
  411. onChange={(e) => { this.setState({ customerTyp : e }) }}>
  412. <Select.Option value="0" >个人客户</Select.Option>
  413. <Select.Option value="1" >公司客户</Select.Option>
  414. </Select>
  415. <Select placeholder="地区"
  416. style={{ width: 160 }}
  417. value={this.state.province}
  418. onChange={(e) => { this.setState({ province: e }) }}>
  419. {this.state.auditStatusOption}
  420. </Select>
  421. <Select placeholder="客户状态" style={{ width: 120 }}
  422. value={this.state.customerStatue}
  423. onChange={(e) => { this.setState({ customerStatue: e }) }}>
  424. {this.state.customerStatuarr}
  425. </Select>
  426. <Button type="primary" onClick={this.search}>搜索</Button>
  427. <Button onClick={this.reset}>重置</Button>
  428. <span>更多搜索<Switch defaultChecked={false} onChange={this.searchSwitch} /></span>
  429. <div className="search-more" style={this.state.searchMore ? { display: 'none' } : {}}>
  430. <Input placeholder="跟单人" style={{width:'140px',marginRight:'10px'}}
  431. value={this.state.ownerId}
  432. onChange={(e) => { this.setState({ ownerId: e.target.value }); }} />
  433. <Input placeholder="联系人姓名" style={{width:'140px',marginRight:'10px'}}
  434. value={this.state.customerName}
  435. onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
  436. <span>发布时间 :</span>
  437. <RangePicker
  438. value={[this.state.releaseDate[0] ? moment(this.state.releaseDate[0]) : null,
  439. this.state.releaseDate[1] ? moment(this.state.releaseDate[1]) : null]}
  440. onChange={(data, dataString) => { this.setState({ releaseDate: dataString }); }} />
  441. </div>
  442. </div>
  443. <div className="patent-table">
  444. <Spin spinning={this.state.loading}>
  445. <Table columns={this.state.columns}
  446. dataSource={this.state.dataSource}
  447. rowSelection={rowSelection}
  448. pagination={this.state.pagination}
  449. onRowClick={this.tableRowClick} />
  450. </Spin>
  451. </div>
  452. <AchievementDetail
  453. data={this.state.RowData}
  454. showDesc={this.state.showDesc}
  455. closeDesc={this.closeDesc} />
  456. </div >
  457. );
  458. }
  459. });
  460. export default AchievementOrderList;