teamCustomer.jsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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 Teamcustomer = 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/listTeamCustomer',
  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. getInitialState() {
  80. return {
  81. searchMore: true,
  82. searchType: 0,
  83. validityPeriodDate: [],
  84. releaseDate: [],
  85. selectedRowKeys: [],
  86. selectedRows: [],
  87. loading: false,
  88. pagination: {
  89. defaultCurrent: 1,
  90. defaultPageSize: 10,
  91. showQuickJumper: true,
  92. pageSize: 10,
  93. onChange: function (page) {
  94. this.loadData(page);
  95. }.bind(this),
  96. showTotal: function (total) {
  97. return '共' + total + '条数据';
  98. }
  99. },
  100. columns: [
  101. {
  102. title: '公司名称',
  103. dataIndex: 'companyName',
  104. key: 'companyName',
  105. }, {
  106. title: '客户类型',
  107. dataIndex: '_customerType',
  108. key: '_customerType',
  109. //render: text => { return getcustomerTyp(text); }
  110. }, {
  111. title: '地区',
  112. dataIndex: 'locationProvince',
  113. key: 'locationProvince',
  114. render: text => { return getcityArr(text); }
  115. }, {
  116. title: '联系人姓名',
  117. dataIndex: 'contactName',
  118. key: 'contactName',
  119. },
  120. {
  121. title: '手机号',
  122. dataIndex: 'telNum',
  123. key:'telNum',
  124. },
  125. {
  126. title: '客户状态',
  127. dataIndex: '_customerStatus',
  128. key: '_customerStatus',
  129. //render: text => { return getcustomerStatue(text) }
  130. },
  131. {
  132. title: '意向服务',
  133. dataIndex: '_companyIntention',
  134. key: '_companyIntention',
  135. //render: text => { return getCompanyIntention(text) }
  136. },
  137. {
  138. title: '最新跟进',
  139. dataIndex: '_followSituation',
  140. key: '_followSituation',
  141. //render: text => { return getfllowSituation(text) }
  142. },
  143. {
  144. title: '跟单人',
  145. dataIndex: 'adminName',
  146. key: 'adminName',
  147. },
  148. {
  149. title: '时间',
  150. dataIndex: 'followDate',
  151. key: 'followDate',
  152. }
  153. ],
  154. dataSource: [],
  155. searchTime: [],
  156. };
  157. },
  158. componentWillMount() {
  159. let theArr = [];
  160. customerStatus.map(function (item) {
  161. theArr.push(
  162. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  163. )
  164. });
  165. let intentionalArr = [];
  166. intentionalService.map(function (item) {
  167. intentionalArr.push(
  168. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  169. )
  170. });
  171. let newArr = [];
  172. newFollow.map(function (item) {
  173. newArr.push(
  174. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  175. )
  176. });
  177. let auditArr = [];
  178. cityArr.map(function (item) {
  179. auditArr.push(
  180. <Select.Option value={item.value} key={item.key}>{item.key}</Select.Option>
  181. )
  182. });
  183. this.state.customerStatuarr = theArr;
  184. this.state.intentionalOption = intentionalArr;
  185. this.state.newOption = newArr;
  186. this.state.auditStatusOption = auditArr;
  187. if (window.location.search) {
  188. let theObj = getSearchUrl(window.location.search);
  189. if (theObj.rid) {
  190. theObj.id = theObj.rid;
  191. if (theObj.rid != 'null') {
  192. this.tableRowClick(theObj);
  193. };
  194. };
  195. };
  196. this.loadData();
  197. },
  198. closeDesc(e, s) {
  199. this.state.showDesc = e;
  200. if (s) {
  201. this.loadData();
  202. };
  203. },
  204. search() {
  205. this.loadData();
  206. },
  207. reset() {
  208. this.state.customerTypet=undefined;
  209. this.state.companyNamet='';
  210. this.state.id = undefined;
  211. this.state.shareTypet = undefined;
  212. this.state.companyIntentiont = undefined;
  213. this.state.followSituationt = undefined;
  214. this.state.locationProvincet = undefined;
  215. this.state.customerStatust = undefined;
  216. this.state.contactNamet = undefined;
  217. this.state.contactTelt = undefined;
  218. this.state.contactNamet = undefined;
  219. this.state.releaseDatet = [];
  220. this.loadData();
  221. },
  222. searchSwitch() {
  223. this.setState({
  224. searchMore: !this.state.searchMore
  225. });
  226. },
  227. render() {
  228. const theData = this.state.data || {};
  229. const rowSelection = {
  230. selectedRowKeys: this.state.selectedRowKeys,
  231. onChange: (selectedRowKeys, selectedRows) => {
  232. this.setState({
  233. selectedRows: selectedRows.slice(-1),
  234. selectedRowKeys: selectedRowKeys.slice(-1)
  235. });
  236. }
  237. };
  238. const hasSelected = this.state.selectedRowKeys.length > 0;
  239. const { RangePicker } = DatePicker;
  240. return (
  241. <div className="user-content" >
  242. <div className="content-title">
  243. <span>团队客户管理</span>
  244. </div>
  245. <div className="user-search">
  246. <Input placeholder="公司名称"
  247. value={this.state.companyNamet}
  248. onChange={(e) => { this.setState({ companyNamet: e.target.value }); }} />
  249. <Select placeholder="客户类型" style={{ width: 120 }}
  250. value={this.state.customerTypet }
  251. onChange={(e) => { this.setState({ customerTypet : e }) }}>
  252. <Select.Option value="0" >个人客户</Select.Option>
  253. <Select.Option value="1" >公司客户</Select.Option>
  254. <Select.Option value="2" >团体单位</Select.Option>
  255. </Select>
  256. <Select placeholder="地区"
  257. style={{ width: 160 }}
  258. value={this.state.locationProvincet}
  259. onChange={(e) => { this.setState({ locationProvincet: e }) }}>
  260. {this.state.auditStatusOption}
  261. </Select>
  262. <Button type="primary" onClick={this.search}>搜索</Button>
  263. <Button onClick={this.reset}>重置</Button>
  264. </div>
  265. <div className="patent-table">
  266. <Spin spinning={this.state.loading}>
  267. <Table columns={this.state.columns}
  268. dataSource={this.state.dataSource}
  269. rowSelection={rowSelection}
  270. pagination={this.state.pagination}
  271. />
  272. </Spin>
  273. </div>
  274. </div >
  275. );
  276. }
  277. });
  278. export default Teamcustomer;