myReject.jsx 15 KB

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