publicCustomer.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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,intentionalService,newFollow} from '../../dataDic.js';
  8. import { beforeUploadFile,getOrderStatus, getSearchUrl,getcustomerTyp,getcityArr,getcustomerStatue,getCompanyIntention,getfllowSituation,getsex} from '../../tools.js';
  9. //查询功能和初始列表
  10. const PublicCustomer = React.createClass({
  11. loadData(pageNumber, detailApiUrl) {
  12. this.state.data = [];
  13. this.setState({
  14. loading: true
  15. });
  16. $.ajax({
  17. method: "post",
  18. dataType: "json",
  19. crossDomain: false,
  20. url:globalConfig.context +'/api/admin/customer/listPublicCustomer',
  21. data: {
  22. pageNumber: pageNumber || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. companyName: this.state.companyName, //名称1
  25. customerType: this.state.customerType, //客户类型1
  26. locationProvince:this.state.locationProvince,//地区
  27. customerStatus:this.state.customerStatus,//客户状态1
  28. contactName:this.state.contactName,//联系人姓名1
  29. contactTel:this.state.contactTel,//联系人手机
  30. companyIntention:this.state.companyIntention,//意向服务
  31. followSituation:this.state.followSituation,//最新跟进进度
  32. //releaseDateStartDate: this.state.releaseDate[0],
  33. //releaseDateEndDate: this.state.releaseDate[1],
  34. },
  35. success: function (data) {
  36. let theArr = [];
  37. if (!data.data || !data.data.list) {
  38. if (data.error && data.error.length) {
  39. message.warning(data.error[0].message);
  40. };
  41. } else {
  42. for (let i = 0; i < data.data.list.length; i++) {
  43. let thisdata = data.data.list[i];
  44. theArr.push({
  45. key: i,
  46. id: thisdata.id,
  47. companyName:thisdata.companyName,//公司名称
  48. customerType:thisdata.customerType,
  49. _customerType:thisdata._customerType,//客户类型
  50. locationProvince:thisdata.locationProvince,//地区
  51. contactName:thisdata.contactName, //联系人姓名
  52. telNum:thisdata.telNum,//手机号
  53. _customerStatus:thisdata._customerStatus,//客户状态
  54. _companyIntention:thisdata._companyIntention,//意向服务
  55. _followSituation:thisdata._followSituation,//最新跟进
  56. customerStatus:thisdata.customerStatus,//客户状态
  57. companyIntention:thisdata.companyIntention,//意向服务
  58. followSituation:thisdata.followSituation,//最新跟进
  59. adminName:thisdata.adminName, //跟进人
  60. followDate:thisdata.followDate,
  61. customerStatus:thisdata.customerStatus,//客户状态
  62. companyIntention:thisdata.companyIntention,//意向服务
  63. });
  64. };
  65. this.state.pagination.current = data.data.pageNumber;
  66. this.state.pagination.total = data.data.totalCount;
  67. };
  68. this.setState({
  69. dataSource: theArr,
  70. pagination: this.state.pagination
  71. });
  72. }.bind(this),
  73. }).always(function () {
  74. this.setState({
  75. loading: false
  76. });
  77. }.bind(this));
  78. },
  79. //领取
  80. handleSubmit (e) {
  81. let uids;
  82. let beforeCustomerStatus;
  83. let beforeFollowSituation;
  84. let beforeCustomerIntention;
  85. for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
  86. let rowItem = this.state.selectedRows[idx];
  87. if (rowItem.id) {
  88. uids=rowItem.id;
  89. beforeCustomerStatus=rowItem.customerStatus;
  90. beforeFollowSituation=rowItem.followSituation;
  91. beforeCustomerIntention=rowItem.companyIntention;
  92. };
  93. };
  94. this.setState({
  95. loading: true
  96. });
  97. $.ajax({
  98. method: "POST",
  99. dataType: "json",
  100. crossDomain: false,
  101. url: globalConfig.context + '/api/admin/customer/receivePublicCustomer',
  102. data: {
  103. id: uids,
  104. beforeCustomerIntention:beforeCustomerIntention,
  105. beforeCustomerStatus:beforeCustomerStatus,
  106. beforeFollowSituation:beforeFollowSituation,
  107. }
  108. }).done(function (data) {
  109. this.setState({
  110. loading: false
  111. });
  112. if (!data.error.length) {
  113. message.success('领取成功!');
  114. this.setcancel();
  115. } else {
  116. message.warning(data.error[0].message);
  117. };
  118. }.bind(this));
  119. },
  120. getInitialState() {
  121. return {
  122. searchMore: true,
  123. searchType: 0,
  124. validityPeriodDate: [],
  125. releaseDate: [],
  126. selectedRowKeys: [],
  127. selectedRows: [],
  128. loading: false,
  129. pagination: {
  130. defaultCurrent: 1,
  131. defaultPageSize: 10,
  132. showQuickJumper: true,
  133. pageSize: 10,
  134. onChange: function (page) {
  135. this.loadData(page);
  136. }.bind(this),
  137. showTotal: function (total) {
  138. return '共' + total + '条数据';
  139. }
  140. },
  141. contactInformation:[
  142. {
  143. title: '姓名',
  144. dataIndex: 'contactName',
  145. key: 'contactName'
  146. },{
  147. title: '性别',
  148. dataIndex: 'sex',
  149. key: 'sex',
  150. render: text => { return getsex(text); }
  151. },
  152. {
  153. title: '手机号码',
  154. dataIndex: 'telNum',
  155. key: 'telNum'
  156. },{
  157. title: '座机号',
  158. dataIndex: 'mobile',
  159. key: 'mobile'
  160. },{
  161. title: 'QQ号码',
  162. dataIndex: 'qq',
  163. key: 'qq'
  164. },{
  165. title: '邮箱号',
  166. dataIndex: 'email',
  167. key: 'email'
  168. },{
  169. title: '微信',
  170. dataIndex: 'wechat',
  171. key: 'wechat'
  172. },{
  173. title: '部门',
  174. dataIndex: 'depatrment',
  175. key: 'depatrment'
  176. },{
  177. title: '职位',
  178. dataIndex: 'customerPosition',
  179. key: 'customerPosition'
  180. },
  181. ],
  182. columns: [
  183. {
  184. title: '公司名称',
  185. dataIndex: 'companyName',
  186. key: 'companyName',
  187. }, {
  188. title: '客户类型',
  189. dataIndex: '_customerType',
  190. key: '_customerType',
  191. //render: text => { return getcustomerTyp(text); }
  192. }, {
  193. title: '地区',
  194. dataIndex: 'locationProvince',
  195. key: 'locationProvince',
  196. render: text => { return getcityArr(text); }
  197. }, {
  198. title: '联系人姓名',
  199. dataIndex: 'contactName',
  200. key: 'contactName',
  201. },
  202. {
  203. title: '手机号',
  204. dataIndex: 'telNum',
  205. key:'telNum',
  206. },
  207. {
  208. title: '客户状态',
  209. dataIndex: '_customerStatus',
  210. key: '_customerStatus',
  211. //render: text => { return getcustomerStatue(text) }
  212. },
  213. {
  214. title: '意向服务',
  215. dataIndex: '_companyIntention',
  216. key: '_companyIntention',
  217. //render: text => { return getCompanyIntention(text) }
  218. },
  219. {
  220. title: '最新跟进',
  221. dataIndex: '_followSituation',
  222. key: '_followSituation',
  223. //render: text => { return getfllowSituation(text) }
  224. },
  225. {
  226. title: '跟单人',
  227. dataIndex: 'adminName',
  228. key: 'adminName',
  229. },
  230. {
  231. title: '时间',
  232. dataIndex: 'followDate',
  233. key: 'followDate',
  234. }
  235. ],
  236. dataSource: [],
  237. searchTime: [],
  238. };
  239. },
  240. componentWillMount() {
  241. let theArr = [];
  242. customerStatus.map(function (item) {
  243. theArr.push(
  244. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  245. )
  246. });
  247. let intentionalArr = [];
  248. intentionalService.map(function (item) {
  249. intentionalArr.push(
  250. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  251. )
  252. });
  253. let newArr = [];
  254. newFollow.map(function (item) {
  255. newArr.push(
  256. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  257. )
  258. });
  259. let auditArr = [];
  260. cityArr.map(function (item) {
  261. auditArr.push(
  262. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  263. )
  264. });
  265. this.state.customerStatuarr = theArr;
  266. this.state.intentionalOption = intentionalArr;
  267. this.state.newOption = newArr;
  268. this.state.auditStatusOption = auditArr;
  269. if (window.location.search) {
  270. let theObj = getSearchUrl(window.location.search);
  271. if (theObj.rid) {
  272. theObj.id = theObj.rid;
  273. if (theObj.rid != 'null') {
  274. this.tableRowClick(theObj);
  275. };
  276. };
  277. };
  278. this.loadData();
  279. },
  280. closeDesc(e, s) {
  281. this.state.showDesc = e;
  282. if (s) {
  283. this.loadData();
  284. };
  285. },
  286. search() {
  287. this.loadData();
  288. },
  289. reset() {
  290. this.state.companyName='';
  291. this.state.customerType = undefined;
  292. this.state.id = undefined;
  293. this.state.shareType = undefined;
  294. this.state.companyIntention = undefined;
  295. this.state.followSituation = undefined;
  296. this.state.locationProvince = undefined;
  297. this.state.customerStatus = undefined;
  298. this.state.contactName = undefined;
  299. this.state.contactTel = undefined;
  300. this.state.contactName = undefined;
  301. this.state.releaseDate = [];
  302. this.loadData();
  303. },
  304. searchSwitch() {
  305. this.setState({
  306. searchMore: !this.state.searchMore
  307. });
  308. },
  309. render() {
  310. const theData = this.state.data || {};
  311. const rowSelection = {
  312. selectedRowKeys: this.state.selectedRowKeys,
  313. onChange: (selectedRowKeys, selectedRows) => {
  314. this.setState({
  315. selectedRows: selectedRows.slice(-1),
  316. selectedRowKeys: selectedRowKeys.slice(-1)
  317. });
  318. }
  319. };
  320. const hasSelected = this.state.selectedRowKeys.length > 0;
  321. const { RangePicker } = DatePicker;
  322. return (
  323. <div className="user-content" >
  324. <div className="content-title">
  325. <span>公共客户管理</span>
  326. </div>
  327. <div className="user-search">
  328. <Input placeholder="公司名称"
  329. value={this.state.companyName}
  330. onChange={(e) => { this.setState({ companyName: e.target.value }); }} />
  331. <Select placeholder="客户类型" style={{ width: 120 }}
  332. value={this.state.customerType }
  333. onChange={(e) => { this.setState({ customerType : e }) }}>
  334. <Select.Option value="0" >个人客户</Select.Option>
  335. <Select.Option value="1" >公司客户</Select.Option>
  336. </Select>
  337. <Select placeholder="地区"
  338. style={{ width: 160 }}
  339. value={this.state.locationProvince}
  340. onChange={(e) => { this.setState({ locationProvince: e }) }}>
  341. {this.state.auditStatusOption}
  342. </Select>
  343. <Button type="primary" onClick={this.search}>搜索</Button>
  344. <Button onClick={this.reset}>重置</Button>
  345. <Button type="primary" onClick={this.handleSubmit} disabled={!hasSelected}>领取</Button>
  346. </div>
  347. <div className="patent-table">
  348. <Spin spinning={this.state.loading}>
  349. <Table columns={this.state.columns}
  350. dataSource={this.state.dataSource}
  351. rowSelection={rowSelection}
  352. pagination={this.state.pagination}
  353. />
  354. </Spin>
  355. </div>
  356. </div >
  357. );
  358. }
  359. });
  360. export default PublicCustomer;