myReject.jsx 14 KB

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