teamCustomer.jsx 12 KB

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