publicCustomer.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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(pageNo, 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. pageNo: pageNo || 1,
  23. pageSize: this.state.pagination.pageSize,
  24. companyName: this.state.companyNamet, //名称1
  25. customerType: this.state.customerTypet, //客户类型1
  26. locationProvince:this.state.locationProvincet,//地区
  27. customerStatus:this.state.customerStatust,//客户状态1
  28. contactName:this.state.contactNamet,//联系人姓名1
  29. contactTel:this.state.contactTelt,//联系人手机
  30. companyIntention:this.state.companyIntentiont,//意向服务
  31. followSituation:this.state.followSituationt,//最新跟进进度
  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.pageNo;
  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. selectedRowKeys:[],
  96. });
  97. this.setState({
  98. loading: true
  99. });
  100. $.ajax({
  101. method: "get",
  102. dataType: "json",
  103. crossDomain: false,
  104. url: globalConfig.context + '/api/admin/customer/receivePublicCustomer',
  105. data: {
  106. id: uids,
  107. beforeCustomerIntention:beforeCustomerIntention,
  108. beforeCustomerStatus:beforeCustomerStatus,
  109. beforeFollowSituation:beforeFollowSituation,
  110. }
  111. }).done(function (data) {
  112. this.setState({
  113. loading: false
  114. });
  115. if (!data.error.length) {
  116. message.success('领取成功!');
  117. this.loadData()
  118. } else {
  119. message.warning(data.error[0].message);
  120. };
  121. }.bind(this));
  122. },
  123. getInitialState() {
  124. return {
  125. searchMore: true,
  126. searchType: 0,
  127. validityPeriodDate: [],
  128. releaseDate: [],
  129. selectedRowKeys: [],
  130. selectedRows: [],
  131. loading: false,
  132. pagination: {
  133. defaultCurrent: 1,
  134. defaultPageSize: 10,
  135. showQuickJumper: true,
  136. pageSize: 10,
  137. onChange: function (page) {
  138. this.loadData(page);
  139. }.bind(this),
  140. showTotal: function (total) {
  141. return '共' + total + '条数据';
  142. }
  143. },
  144. contactInformation:[
  145. {
  146. title: '姓名',
  147. dataIndex: 'contactName',
  148. key: 'contactName'
  149. },{
  150. title: '性别',
  151. dataIndex: 'sex',
  152. key: 'sex',
  153. render: text => { return getsex(text); }
  154. },
  155. {
  156. title: '手机号码',
  157. dataIndex: 'telNum',
  158. key: 'telNum'
  159. },{
  160. title: '座机号',
  161. dataIndex: 'mobile',
  162. key: 'mobile'
  163. },{
  164. title: 'QQ号码',
  165. dataIndex: 'qq',
  166. key: 'qq'
  167. },{
  168. title: '邮箱号',
  169. dataIndex: 'email',
  170. key: 'email'
  171. },{
  172. title: '微信',
  173. dataIndex: 'wechat',
  174. key: 'wechat'
  175. },{
  176. title: '部门',
  177. dataIndex: 'depatrment',
  178. key: 'depatrment'
  179. },{
  180. title: '职位',
  181. dataIndex: 'customerPosition',
  182. key: 'customerPosition'
  183. },
  184. ],
  185. columns: [
  186. {
  187. title: '公司名称',
  188. dataIndex: 'companyName',
  189. key: 'companyName',
  190. }, {
  191. title: '客户类型',
  192. dataIndex: '_customerType',
  193. key: '_customerType',
  194. //render: text => { return getcustomerTyp(text); }
  195. }, {
  196. title: '地区',
  197. dataIndex: 'locationProvince',
  198. key: 'locationProvince',
  199. render: text => { return getcityArr(text); }
  200. }, {
  201. title: '联系人姓名',
  202. dataIndex: 'contactName',
  203. key: 'contactName',
  204. },
  205. {
  206. title: '手机号',
  207. dataIndex: 'telNum',
  208. key:'telNum',
  209. },
  210. {
  211. title: '客户状态',
  212. dataIndex: '_customerStatus',
  213. key: '_customerStatus',
  214. //render: text => { return getcustomerStatue(text) }
  215. },
  216. {
  217. title: '意向服务',
  218. dataIndex: '_companyIntention',
  219. key: '_companyIntention',
  220. //render: text => { return getCompanyIntention(text) }
  221. },
  222. {
  223. title: '最新跟进',
  224. dataIndex: '_followSituation',
  225. key: '_followSituation',
  226. //render: text => { return getfllowSituation(text) }
  227. },
  228. {
  229. title: '跟单人',
  230. dataIndex: 'adminName',
  231. key: 'adminName',
  232. },
  233. {
  234. title: '时间',
  235. dataIndex: 'followDate',
  236. key: 'followDate',
  237. }
  238. ],
  239. dataSource: [],
  240. searchTime: [],
  241. };
  242. },
  243. componentWillMount() {
  244. let theArr = [];
  245. customerStatus.map(function (item) {
  246. theArr.push(
  247. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  248. )
  249. });
  250. let intentionalArr = [];
  251. intentionalService.map(function (item) {
  252. intentionalArr.push(
  253. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  254. )
  255. });
  256. let newArr = [];
  257. newFollow.map(function (item) {
  258. newArr.push(
  259. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  260. )
  261. });
  262. let auditArr = [];
  263. cityArr.map(function (item) {
  264. auditArr.push(
  265. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  266. )
  267. });
  268. this.state.customerStatuarr = theArr;
  269. this.state.intentionalOption = intentionalArr;
  270. this.state.newOption = newArr;
  271. this.state.auditStatusOption = auditArr;
  272. if (window.location.search) {
  273. let theObj = getSearchUrl(window.location.search);
  274. if (theObj.rid) {
  275. theObj.id = theObj.rid;
  276. if (theObj.rid != 'null') {
  277. this.tableRowClick(theObj);
  278. };
  279. };
  280. };
  281. this.loadData();
  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.companyNamet='';
  294. this.state.id = undefined;
  295. this.state.customerTypet = undefined;
  296. this.state.shareTypet = undefined;
  297. this.state.companyIntentiont = undefined;
  298. this.state.followSituationt = undefined;
  299. this.state.locationProvincet = undefined;
  300. this.state.customerStatust = undefined;
  301. this.state.contactNamet = undefined;
  302. this.state.contactTelt = undefined;
  303. this.state.contactNamet = undefined;
  304. this.state.releaseDatet = [];
  305. this.loadData();
  306. },
  307. searchSwitch() {
  308. this.setState({
  309. searchMore: !this.state.searchMore
  310. });
  311. },
  312. render() {
  313. const theData = this.state.data || {};
  314. const rowSelection = {
  315. selectedRowKeys: this.state.selectedRowKeys,
  316. onChange: (selectedRowKeys, selectedRows) => {
  317. this.setState({
  318. selectedRows: selectedRows.slice(-1),
  319. selectedRowKeys: selectedRowKeys.slice(-1)
  320. });
  321. }
  322. };
  323. const hasSelected = this.state.selectedRowKeys.length > 0;
  324. const { RangePicker } = DatePicker;
  325. return (
  326. <div className="user-content" >
  327. <div className="content-title">
  328. <span>公共客户管理</span>
  329. </div>
  330. <div className="user-search">
  331. <Input placeholder="公司名称"
  332. value={this.state.companyNamet}
  333. onChange={(e) => { this.setState({ companyNamet: e.target.value }); }} />
  334. <Select placeholder="客户类型" style={{ width: 120 }}
  335. value={this.state.customerTypet }
  336. onChange={(e) => { this.setState({ customerTypet : e }) }}>
  337. <Select.Option value="0" >个人客户</Select.Option>
  338. <Select.Option value="1" >公司客户</Select.Option>
  339. <Select.Option value="2" >团体单位</Select.Option>
  340. </Select>
  341. <Select placeholder="地区"
  342. style={{ width: 160 }}
  343. value={this.state.locationProvincet}
  344. onChange={(e) => { this.setState({ locationProvincet: e }) }}>
  345. {this.state.auditStatusOption}
  346. </Select>
  347. <Button type="primary" onClick={this.search}>搜索</Button>
  348. <Button onClick={this.reset}>重置</Button>
  349. <Button type="primary" onClick={this.handleSubmit} disabled={!hasSelected}>领取</Button>
  350. </div>
  351. <div className="patent-table">
  352. <Spin spinning={this.state.loading}>
  353. <Table columns={this.state.columns}
  354. dataSource={this.state.dataSource}
  355. rowSelection={rowSelection}
  356. pagination={this.state.pagination}
  357. />
  358. </Spin>
  359. </div>
  360. </div >
  361. );
  362. }
  363. });
  364. export default PublicCustomer;