myReject.jsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. import React from 'react';
  2. import { Radio, Icon, Button, Cascader, Input, Select, Tabs, Spin, Popconfirm, Table, Switch, message, DatePicker, Modal, Upload, Form, Row, Col } 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 QueryCustomer from './myRejectOne.jsx';
  8. import { citySelect, provinceList, areaSelect } from '../../../areaList';
  9. import {getProvinceList} from '../../../addressList';
  10. const { Column, ColumnGroup } = Table;
  11. const TabPane = Tabs.TabPane;
  12. const monthFormat = 'YYYY/MM';
  13. import CustomerDetail from './myClientDesc.jsx';
  14. import { socialAttribute, industry, auditStatusL, newFollow, lvl, currentMember, statuslist, customerStatus, intentionalService } from '../../../dataDic.js';
  15. import { getSocialAttribute, splitUrl,getAuditStatus, getCompanyIntention, getStatuslist, getContactType, getIndustryType, getfllowSituation, beforeUploadFile, getWhether, getcustomerStatue, getfllowSituationOn, getCertification, getcustomerTyp, getLvl, getCurrentMember, getprovince } from '../../../tools.js';
  16. const PublicCustomer = Form.create()(React.createClass({
  17. loadData(pageNo) {
  18. this.state.data = [];
  19. this.setState({
  20. loading: true
  21. });
  22. $.ajax({
  23. method: "post",
  24. dataType: "json",
  25. crossDomain: false,
  26. url: globalConfig.context + '/api/admin/customer/findEnteringAuditIsNo',
  27. data: {
  28. pageNo: pageNo || 1,
  29. pageSize: this.state.pagination.pageSize,
  30. name: this.state.nameSearch,//客户名称
  31. adminName:this.state.adminName,//营销员名称
  32. },
  33. success: function(data) {
  34. let theArr = [];
  35. let thisdata;
  36. if(data.error.length || data.data.list == "") {
  37. if(data.error && data.error.length) {
  38. message.warning(data.error[0].message);
  39. };
  40. } else {
  41. for(let i = 0; i < data.data.list.length; i++) {
  42. thisdata = data.data.list[i];
  43. theArr.push({
  44. key: i,
  45. id: thisdata.uid,
  46. name: thisdata.name,
  47. createTime: thisdata.createTime,
  48. adminName: thisdata.adminName,
  49. contactMobile: thisdata.contactMobile,
  50. auditOpinion:thisdata.auditOpinion,
  51. societyTag:thisdata.societyTag,
  52. });
  53. };
  54. this.state.pagination.current = data.data.pageNo;
  55. this.state.pagination.total = data.data.totalCount;
  56. };
  57. if(data.data&&data.data.list&&!data.data.list.length){
  58. this.state.pagination.current=0;
  59. this.state.pagination.total=0;
  60. }
  61. this.setState({
  62. dataSource: theArr,
  63. pagination: this.state.pagination,
  64. selectedRowKeys:[]
  65. });
  66. }.bind(this),
  67. }).always(function() {
  68. this.setState({
  69. loading: false
  70. });
  71. }.bind(this));
  72. },
  73. //点击出现函数
  74. setModal2VisibleOk(e) {
  75. this.setState({
  76. modal2Visible: true
  77. });
  78. },
  79. //点击消失函数
  80. setModal2Visiblecancel(e) {
  81. this.setState({
  82. modal2Visible: false
  83. });
  84. },
  85. getPictureUrl(e) {
  86. this.setState({ pictureUrl: e });
  87. },
  88. handleOk(e) {
  89. this.setState({
  90. visible: false,
  91. });
  92. },
  93. handleCancel(e) {
  94. this.setState({
  95. visible: false,
  96. });
  97. },
  98. getInitialState() {
  99. return {
  100. addressSearch: [],
  101. orgCodeUrl: [],
  102. companyLogoUrl: [],
  103. visible: false,
  104. searchMore: true,
  105. releaseDate: [],
  106. releaseDate: [],
  107. selectedRowKeys: [],
  108. selectedRowKey: [],
  109. selectedRows: [],
  110. loading: false,
  111. pagination: {
  112. defaultCurrent: 1,
  113. defaultPageSize: 10,
  114. showQuickJumper: true,
  115. pageSize: 10,
  116. onChange: function(page) {
  117. this.loadData(page);
  118. }.bind(this),
  119. showTotal: function(total) {
  120. return '共' + total + '条数据';
  121. }
  122. },
  123. columns: [{
  124. title: '客户名称',
  125. dataIndex: 'name',
  126. key: 'name',
  127. }, {
  128. title: '联系电话',
  129. dataIndex: 'contactMobile',
  130. key: 'contactMobile',
  131. },
  132. {
  133. title: '营销员',
  134. dataIndex: 'adminName',
  135. key: 'adminName',
  136. },
  137. {
  138. title: '创建时间',
  139. dataIndex: 'createTime',
  140. key: 'createTime',
  141. },
  142. {
  143. title: '拒绝原因',
  144. dataIndex: 'auditOpinion',
  145. key: 'auditOpinion',
  146. }
  147. ],
  148. dataSource: [],
  149. };
  150. },
  151. //审核通过
  152. examineCancel(record){
  153. let api=0;
  154. this.examine(api,record);
  155. },
  156. //审核不通过
  157. examineOK(record){
  158. let api=1;
  159. this.examine(api,record);
  160. },
  161. examine(api,record) {
  162. this.setState({
  163. selectedRowKeys: [],
  164. });
  165. $.ajax({
  166. method: "POST",
  167. dataType: "json",
  168. crossDomain: false,
  169. url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
  170. data: {
  171. id:record.id,
  172. auditStatus:api,
  173. auditOpinion:this.state.auditOpinion,
  174. }
  175. }).done(function (data) {
  176. if (!data.error.length) {
  177. message.success('操作成功');
  178. this.setState({
  179. loading: false,
  180. });
  181. } else {
  182. message.warning(data.error[0].message);
  183. };
  184. this.loadData();
  185. }.bind(this));
  186. },
  187. componentWillMount() {
  188. this.loadData();
  189. },
  190. //审核实名认证不通过功能
  191. auditRows(e) {
  192. e.preventDefault();
  193. $.ajax({
  194. url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
  195. method: 'post',
  196. data: {
  197. id:this.state.id,
  198. auditOpinion:this.state.auditOpinion,
  199. auditStatus:2,
  200. }
  201. }).done(function(data) {
  202. this.setState({
  203. loading: false
  204. });
  205. if(!data.error.length) {
  206. message.success('操作成功!');
  207. this.detailsModal()
  208. this.loadData();
  209. } else {
  210. message.warning(data.error[0].message);
  211. }
  212. }.bind(this));
  213. },
  214. //修改信息提交
  215. submit(e) {
  216. e.preventDefault();
  217. this.props.form.validateFields((err, values) => {
  218. if(!this.state.societyTag){
  219. message.warning('社会属性不能为空')
  220. return false;
  221. };
  222. if(this.state.mobile.length>13){
  223. message.warning('电话号码字数不超过13个')
  224. return false;
  225. };
  226. if (!err) {
  227. this.setState({
  228. loading: true
  229. });
  230. $.ajax({
  231. method: "POST",
  232. dataType: "json",
  233. crossDomain: false,
  234. url: globalConfig.context + '/api/admin/customer/updateRefusedCustomer',
  235. data: {
  236. nickname:this.state.nickname,
  237. societyTag:this.state.societyTag,
  238. mobile: this.state.mobile,
  239. id: this.state.id,
  240. }
  241. }).done(function (data) {
  242. this.setState({
  243. loading: false
  244. });
  245. if (!data.error.length) {
  246. message.success('提交成功!');
  247. this.detailsModal();
  248. this.loadData();
  249. } else {
  250. message.warning(data.error[0].message);
  251. }
  252. }.bind(this));
  253. }
  254. });
  255. },
  256. //审核实名认证通过功能
  257. auditRowse(e) {
  258. e.preventDefault();
  259. $.ajax({
  260. url: globalConfig.context + '/api/admin/customer/updateEnteringAudit',
  261. method: 'post',
  262. data: {
  263. id:this.state.id,
  264. auditOpinion:this.state.auditOpinion,
  265. auditStatus:1,
  266. }
  267. }).done(function(data) {
  268. this.setState({
  269. loading: false
  270. });
  271. if(!data.error.length) {
  272. message.success('操作成功!');
  273. this.detailsModal()
  274. this.loadData();
  275. } else {
  276. message.warning(data.error[0].message);
  277. }
  278. }.bind(this));
  279. },
  280. search() {
  281. this.loadData();
  282. },
  283. reset() {
  284. this.state.nameSearch = '';
  285. this.state.adminName=''
  286. this.loadData();
  287. },
  288. searchSwitch() {
  289. this.setState({
  290. searchMore: !this.state.searchMore
  291. });
  292. },
  293. //整行点击
  294. tableRowClick(record, index) {
  295. this.state.RowData = record;
  296. this.detailsModalOk(record);
  297. this.setState({
  298. nickname:record.name,
  299. mobile:record.contactMobile,
  300. societyTag:record.societyTag,
  301. id:record.id,
  302. })
  303. },
  304. detailsModalOk(e) {
  305. this.setState({
  306. modal5Visible: true
  307. }); //需要一个请求数据
  308. },
  309. detailsModal(e){
  310. this.setState({
  311. modal5Visible: false
  312. });
  313. },
  314. componentWillReceiveProps(nextProps) {
  315. if(!this.props.visible && nextProps.visible) {
  316. if(nextProps.data && nextProps.data.id) {
  317. this.loadData(nextProps.data.id, nextProps.detailApiUrl);
  318. };
  319. this.state.data = {};
  320. this.state.companyLogoUrl = [];
  321. this.state.orgCodeUrl = [];
  322. this.loadData(null);
  323. };
  324. },
  325. render() {
  326. const FormItem = Form.Item
  327. const rowSelection = {
  328. selectedRowKeys: this.state.selectedRowKeys,
  329. onChange: (selectedRowKeys, selectedRows) => {
  330. this.setState({
  331. selectedRows: selectedRows.slice(-1),
  332. selectedRowKeys: selectedRowKeys.slice(-1)
  333. });
  334. },
  335. onSelect: (recordt, selected, selectedRows) => {
  336. this.setState({
  337. recordt: recordt.id
  338. })
  339. },
  340. };
  341. const rowSelections = {
  342. selectedRowKeys: this.state.selectedRowKey,
  343. onChange: (selectedRowKey, selectedRow) => {
  344. this.setState({
  345. selectedRow: selectedRow.slice(-1),
  346. selectedRowKey: selectedRowKey.slice(-1)
  347. });
  348. },
  349. onSelect: (records, selected, selectedRow) => {
  350. this.setState({
  351. selectedRow: selectedRow.slice(-1),
  352. records: records.id,
  353. })
  354. },
  355. };
  356. const hasSelected = this.state.selectedRowKeys.length > 0;
  357. const { RangePicker } = DatePicker;
  358. const { getFieldDecorator } = this.props.form;
  359. const formItemLayout = {
  360. labelCol: { span: 6 },
  361. wrapperCol: { span: 14 },
  362. };
  363. //const theDatak = this.state.datak || {};
  364. const theInformation = this.state.dataInformation || {}
  365. const contactsOption = "";
  366. const formItemLayput = {
  367. labelCol: { span: 10 },
  368. wrapperCol: { span: 14 },
  369. };
  370. const contacts = this.state.contacts || '';
  371. return(
  372. <div className="user-content" >
  373. <div className="content-title">
  374. <span>我的被拒绝客户</span>
  375. </div>
  376. <div className="user-search">
  377. <Input placeholder="客户名称"
  378. value={this.state.nameSearch}
  379. onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
  380. <Input placeholder="营销员"
  381. value={this.state.adminName}
  382. onChange={(e) => { this.setState({ adminName: e.target.value }); }} />
  383. <Button type="primary" onClick={this.search}>搜索</Button>
  384. <Button onClick={this.reset}>重置</Button>
  385. </div>
  386. <div className="patent-table">
  387. <Spin spinning={this.state.loading}>
  388. <Table columns={this.state.columns}
  389. dataSource={this.state.dataSource}
  390. rowSelection={rowSelection}
  391. pagination={this.state.pagination}
  392. onRowClick={this.tableRowClick}
  393. />
  394. </Spin>
  395. </div>
  396. <Modal
  397. className="customeDetails"
  398. title="被拒绝客户详情"
  399. width='500px'
  400. visible={this.state.modal5Visible}
  401. onOk={this.detailsModal}
  402. onCancel={this.detailsModal}
  403. footer=''
  404. >
  405. <Form horizontal onSubmit={this.submit} id="add-form">
  406. <Spin spinning={this.state.loading}>
  407. <div className="clearfix">
  408. <FormItem
  409. {...formItemLayout}
  410. label="客户姓名" >
  411. {getFieldDecorator('nickname', {
  412. rules: [{ required: true, message: '此项为必填项!' }],
  413. initialValue: this.state.nickname
  414. })(
  415. <Input placeholder="客户姓名" onChange={(e)=>{this.setState({nickname:e.target.value})}}/>
  416. )}
  417. </FormItem>
  418. </div>
  419. <div className="clearfix">
  420. <FormItem
  421. {...formItemLayout}
  422. label="联系电话" >
  423. {getFieldDecorator('mobile', {
  424. rules: [{ required: true, message: '此项为必填项!' }],
  425. initialValue: this.state.mobile
  426. })(
  427. <Input placeholder="联系电话" onChange={(e)=>{this.setState({mobile:e.target.value})}}/>
  428. )}
  429. </FormItem>
  430. </div>
  431. <div className="clearfix">
  432. <FormItem
  433. {...formItemLayout}
  434. label="社会属性"
  435. >
  436. <Select placeholder="客户社会属性" value={this.state.societyTag}
  437. onChange={(e)=>{this.setState({societyTag:e})}}>
  438. {
  439. socialAttribute.map(function (item) {
  440. return <Select.Option key={item.value} >{item.key}</Select.Option>
  441. })
  442. }
  443. </Select>
  444. </FormItem>
  445. </div>
  446. <FormItem wrapperCol={{ span: 18, offset: 6 }}>
  447. <Button type="primary" htmlType="submit">提交审核</Button>
  448. <Button type="ghost" onClick={this.detailsModal} style={{'marginLeft':'40px'}}>取消</Button>
  449. </FormItem>
  450. </Spin>
  451. </Form >
  452. </Modal>
  453. </div >
  454. );
  455. }
  456. }));
  457. export default PublicCustomer;