orgDesc.jsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Button, Tabs, Input, Select, Form, DatePicker, Cascader } from 'antd';
  3. import './userList.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. import moment from 'moment';
  7. import { eduLevelList, auditStatusList, certifyStepList } from '../../dataDic.js'
  8. import { provinceSelect } from '../../tools.js';
  9. const OrgCertify = Form.create()(React.createClass({
  10. getInitialState() {
  11. return {
  12. visible: false,
  13. loading: false,
  14. tabKey: "1",
  15. eduLvlOption: [],
  16. auditStatusOption: []
  17. };
  18. },
  19. loadData(uid) {
  20. this.state.data = [];
  21. this.setState({
  22. loading: true
  23. });
  24. $.ajax({
  25. method: "post",
  26. dataType: "json",
  27. crossDomain: false,
  28. url: globalConfig.context + "/api/admin/orgDetail",
  29. data: {
  30. uid: uid
  31. },
  32. success: function (data) {
  33. let thisData = data.data;
  34. if (!thisData) {
  35. if (data.error && data.error.length) {
  36. message.warning(data.error[0].message);
  37. };
  38. thisData = {};
  39. };
  40. this.setState({
  41. id: thisData.id,
  42. licenceAddress: [thisData.licenceProvince, thisData.licenceCity, thisData.licenceArea],
  43. locationAddress: [thisData.locationProvince, thisData.locationCity, thisData.locationArea],
  44. contacts: thisData.contacts,
  45. contactMobile: thisData.contactMobile,
  46. fixedTel: thisData.fixedTel,
  47. qq: thisData.qq,
  48. postalAddress: thisData.postalAddress,
  49. postcode: thisData.postcode,
  50. aftUsername: thisData.aftUsername,
  51. unitName: thisData.unitName,
  52. identityType: thisData.identityType, //组织性质
  53. registeredCapital: thisData.registeredCapital, //注册资金
  54. firstContacts: thisData.firstContacts,
  55. firstMobile: thisData.firstMobile,
  56. secondContacts: thisData.secondContacts,
  57. secondMobile: thisData.secondMobile,
  58. thirdContacts: thisData.thirdContacts,
  59. thirdMobile: thisData.thirdMobile,
  60. legalPerson: thisData.legalPerson,
  61. legalPersonIdCard: thisData.legalPersonIdCard,
  62. licenceNumber: thisData.licenceNumber,
  63. licenceScanningUrl: thisData.licenceScanningUrl,
  64. orgCode: thisData.orgCode,
  65. orgCodeUrl: thisData.orgCodeUrl,
  66. bankAccount: thisData.bankAccount,
  67. banks: thisData.banks,
  68. bankBranch: thisData.bankBranch,
  69. bankCardNumber: thisData.bankCardNumber,
  70. validationAmount: thisData.validationAmount, //打款金额
  71. paymentDate: thisData.paymentDate,
  72. paymentDateFormattedDate: thisData.paymentDateFormattedDate,
  73. lastYearTaxReportUrl: thisData.lastYearTaxReportUrl,
  74. auditStatus: thisData.auditStatus,
  75. });
  76. this.props.form.resetFields();
  77. }.bind(this),
  78. }).always(function () {
  79. this.setState({
  80. loading: false
  81. });
  82. }.bind(this));
  83. },
  84. handleSubmit(e) {
  85. e.preventDefault();
  86. this.props.form.validateFields((err, values) => {
  87. if (!err) {
  88. this.setState({
  89. loading: true
  90. });
  91. //金额判断
  92. if (values.amountMoney && values.amountMoney < 0 && values.amountMoney > 100 && /^\d+(\.\d{2})?$/.test(values.amountMoney)) {
  93. message.warning('请输入0-100以内的金额');
  94. return;
  95. };
  96. $.ajax({
  97. method: "POST",
  98. dataType: "json",
  99. crossDomain: false,
  100. url: globalConfig.context + "/api/admin/updateOrgDetail",
  101. data: {
  102. uid: this.props.uid,
  103. id: this.state.id,
  104. contacts: values.contacts,
  105. contactMobile: values.contactMobile,
  106. postalAddress: values.postalAddress,
  107. postcode: values.postcode,
  108. aftUsername: values.aftUsername,
  109. unitName: values.unitName,
  110. identityType: values.identityType, //组织性质
  111. registeredCapital: values.registeredCapital, //注册资金
  112. legalPerson: values.legalPerson,
  113. legalPersonIdCard: values.legalPersonIdCard,
  114. licenceNumber: values.licenceNumber,
  115. orgCode: values.orgCode,
  116. firstContacts: values.firstContacts,
  117. firstMobile: values.firstMobile,
  118. secondContacts: values.secondContacts,
  119. secondMobile: values.secondMobile,
  120. thirdContacts: values.thirdContacts,
  121. thirdMobile: values.thirdMobile,
  122. bankAccount: values.bankAccount,
  123. banks: values.banks,
  124. bankBranch: values.bankBranch,
  125. bankCardNumber: values.bankCardNumber,
  126. validationAmount: values.validationAmount, //打款金额
  127. paymentDateFormattedDate: values.paymentDateFormattedDate ? values.paymentDateFormattedDate.format("YYYY-MM-DD") : undefined,
  128. auditStatus: values.auditStatus,
  129. //process: this.state.process,
  130. licenceArea: values.licenceAddress[2],
  131. licenceCity: values.licenceAddress[1],
  132. licenceProvince: values.licenceAddress[0],
  133. locationArea: values.locationAddress[2],
  134. locationCity: values.locationAddress[1],
  135. locationProvince: values.locationAddress[0],
  136. }
  137. }).done(function (data) {
  138. if (!data.error.length) {
  139. message.success('保存成功!');
  140. } else {
  141. message.warning(data.error[0].message);
  142. }
  143. }.bind(this)).always(function () {
  144. this.setState({
  145. visible: false,
  146. });
  147. this.props.handleOk();
  148. }.bind(this));
  149. }
  150. });
  151. },
  152. handleCancel() {
  153. this.props.closeDesc(false);
  154. },
  155. componentWillMount() {
  156. let _me = this;
  157. eduLevelList.map(function (item, i) {
  158. _me.state.eduLvlOption.push(
  159. <Select.Option key={item.key} value={item.value} >{item.key}</Select.Option>
  160. );
  161. });
  162. auditStatusList.map(function (item, i) {
  163. _me.state.auditStatusOption.push(
  164. <Select.Option key={item.key} value={item.value} >{item.key}</Select.Option>
  165. );
  166. });
  167. this.loadData(this.props.uid);
  168. },
  169. componentWillReceiveProps(nextProps) {
  170. if (!this.props.visible && nextProps.visible) {
  171. this.loadData(nextProps.uid);
  172. this.state.tabKey = "1";
  173. };
  174. },
  175. render() {
  176. const { getFieldDecorator } = this.props.form;
  177. const FormItem = Form.Item
  178. const formItemLayout = {
  179. labelCol: { span: 6 },
  180. wrapperCol: { span: 12 },
  181. };
  182. return (
  183. <Form horizontal onSubmit={this.handleSubmit} className="person-form">
  184. <Tabs defaultActiveKey="1" activeKey={this.state.tabKey} onChange={(e) => { this.setState({ tabKey: e }); }}>
  185. <Tabs.TabPane tab="基本资料" key="1">
  186. <FormItem
  187. {...formItemLayout}
  188. label="公司名称"
  189. >
  190. {getFieldDecorator('unitName', {
  191. initialValue: this.state.unitName
  192. })(
  193. <Input />
  194. )}
  195. </FormItem>
  196. <FormItem
  197. {...formItemLayout}
  198. label="认证名称"
  199. >
  200. {getFieldDecorator('aftUsername', {
  201. initialValue: this.state.aftUsername
  202. })(
  203. <Input />
  204. )}
  205. </FormItem>
  206. <FormItem
  207. {...formItemLayout}
  208. label="身份类型"
  209. >
  210. {getFieldDecorator('identityType', {
  211. initialValue: this.state.identityType
  212. })(
  213. <Select placeholder="身份类型" style={{ width: 200 }}
  214. onChange={(e) => { this.state.identityType = e }}>
  215. {this.state.eduLvlOption}
  216. </Select>
  217. )}
  218. </FormItem>
  219. <FormItem
  220. {...formItemLayout}
  221. label="第一联系人"
  222. >
  223. {getFieldDecorator('firstContacts', {
  224. initialValue: this.state.firstContacts
  225. })(
  226. <Input />
  227. )}
  228. </FormItem>
  229. <FormItem
  230. {...formItemLayout}
  231. label="第一联系人电话"
  232. >
  233. {getFieldDecorator('firstMobile', {
  234. initialValue: this.state.firstMobile
  235. })(
  236. <Input />
  237. )}
  238. </FormItem>
  239. <FormItem
  240. {...formItemLayout}
  241. label="第二联系人"
  242. >
  243. {getFieldDecorator('secondContacts', {
  244. initialValue: this.state.secondContacts
  245. })(
  246. <Input />
  247. )}
  248. </FormItem>
  249. <FormItem
  250. {...formItemLayout}
  251. label="第二联系人电话"
  252. >
  253. {getFieldDecorator('secondMobile', {
  254. initialValue: this.state.secondMobile
  255. })(
  256. <Input />
  257. )}
  258. </FormItem>
  259. <FormItem
  260. {...formItemLayout}
  261. label="第三联系人"
  262. >
  263. {getFieldDecorator('thirdContacts', {
  264. initialValue: this.state.thirdContacts
  265. })(
  266. <Input />
  267. )}
  268. </FormItem>
  269. <FormItem
  270. {...formItemLayout}
  271. label="第三联系人电话"
  272. >
  273. {getFieldDecorator('thirdMobile', {
  274. initialValue: this.state.thirdMobile
  275. })(
  276. <Input />
  277. )}
  278. </FormItem>
  279. </Tabs.TabPane>
  280. <Tabs.TabPane tab="认证信息" key="2">
  281. <FormItem
  282. {...formItemLayout}
  283. label="法人"
  284. >
  285. {getFieldDecorator('legalPerson', {
  286. initialValue: this.state.legalPerson
  287. })(
  288. <Input />
  289. )}
  290. </FormItem>
  291. <FormItem
  292. {...formItemLayout}
  293. label="法人身份证号"
  294. >
  295. {getFieldDecorator('legalPersonIdCard', {
  296. initialValue: this.state.legalPersonIdCard
  297. })(
  298. <Input />
  299. )}
  300. </FormItem>
  301. <FormItem
  302. {...formItemLayout}
  303. label="注册资金"
  304. >
  305. {getFieldDecorator('registeredCapital', {
  306. initialValue: this.state.registeredCapital
  307. })(
  308. <Input />
  309. )}
  310. </FormItem>
  311. <FormItem
  312. {...formItemLayout}
  313. label="营业执照编号"
  314. >
  315. {getFieldDecorator('licenceNumber', {
  316. initialValue: this.state.licenceNumber
  317. })(
  318. <Input />
  319. )}
  320. </FormItem>
  321. <FormItem
  322. {...formItemLayout}
  323. label="营业执照所在地"
  324. >
  325. {getFieldDecorator('licenceAddress', {
  326. initialValue: this.state.licenceAddress
  327. })(
  328. <Cascader options={provinceSelect()} placeholder="请选择地址" />
  329. )}
  330. </FormItem>
  331. <FormItem
  332. labelCol={{ span: 6 }}
  333. wrapperCol={{ span: 18 }}
  334. label="营业执照图片"
  335. >
  336. <div className="idcard-img clearfix">
  337. {this.state.licenceScanningUrl ? <div>
  338. <div className="idcard-imgbox">
  339. <img src={globalConfig.context + '/open/writeImage?path=' + this.state.licenceScanningUrl} alt="点击查看大图"
  340. onClick={(e) => { window.open(e.target.src) }} />
  341. </div>
  342. </div> : <div><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传</div>}
  343. </div>
  344. </FormItem>
  345. <FormItem
  346. {...formItemLayout}
  347. label="组织机构代码"
  348. >
  349. {getFieldDecorator('orgCode', {
  350. initialValue: this.state.orgCode
  351. })(
  352. <Input />
  353. )}
  354. </FormItem>
  355. <FormItem
  356. labelCol={{ span: 6 }}
  357. wrapperCol={{ span: 18 }}
  358. label="组织机构代码证图片"
  359. >
  360. <div className="idcard-img clearfix">
  361. {this.state.orgCodeUrl ? <div>
  362. <div className="idcard-imgbox">
  363. <img src={globalConfig.context + '/open/writeImage?path=' + this.state.orgCodeUrl} alt="点击查看大图"
  364. onClick={(e) => { window.open(e.target.src) }} />
  365. </div>
  366. </div> : <div><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传</div>}
  367. </div>
  368. </FormItem>
  369. <FormItem
  370. labelCol={{ span: 6 }}
  371. wrapperCol={{ span: 18 }}
  372. label="上年度纳税报表"
  373. >
  374. <div className="idcard-img clearfix">
  375. {this.state.lastYearTaxReportUrl ? <div>
  376. <div className="idcard-imgbox">
  377. <img src={globalConfig.context + '/open/writeImage?path=' + this.state.lastYearTaxReportUrl} alt="点击查看大图"
  378. onClick={(e) => { window.open(e.target.src) }} />
  379. </div>
  380. </div> : <div><Icon type="exclamation-circle" style={{ color: '#ffbf00', marginRight: '6px' }} />未上传</div>}
  381. </div>
  382. </FormItem>
  383. <FormItem
  384. {...formItemLayout}
  385. label="开户银行"
  386. >
  387. {getFieldDecorator('banks', {
  388. initialValue: this.state.banks
  389. })(
  390. <Input />
  391. )}
  392. </FormItem>
  393. <FormItem
  394. {...formItemLayout}
  395. label="开户银行支行"
  396. >
  397. {getFieldDecorator('bankBranch', {
  398. initialValue: this.state.bankBranch
  399. })(
  400. <Input />
  401. )}
  402. </FormItem>
  403. <FormItem
  404. {...formItemLayout}
  405. label="银行卡号"
  406. >
  407. {getFieldDecorator('bankCardNumber', {
  408. initialValue: this.state.bankCardNumber
  409. })(
  410. <Input />
  411. )}
  412. </FormItem>
  413. <FormItem
  414. {...formItemLayout}
  415. label="开户行所在地"
  416. >
  417. {getFieldDecorator('locationAddress', {
  418. initialValue: this.state.locationAddress
  419. })(
  420. <Cascader options={provinceSelect()} placeholder="请选择地址" />
  421. )}
  422. </FormItem>
  423. <FormItem
  424. {...formItemLayout}
  425. label="打款金额"
  426. >
  427. {getFieldDecorator('validationAmount', {
  428. initialValue: this.state.validationAmount
  429. })(
  430. <Input />
  431. )}
  432. </FormItem>
  433. <FormItem
  434. {...formItemLayout}
  435. label="打款日期"
  436. >
  437. {getFieldDecorator('paymentDateFormattedDate', {
  438. initialValue: this.state.paymentDate ? moment(this.state.paymentDate) : null
  439. })(
  440. <DatePicker />
  441. )}
  442. </FormItem>
  443. <FormItem
  444. {...formItemLayout}
  445. label="认证状态"
  446. >
  447. {getFieldDecorator('auditStatus', {
  448. initialValue: this.state.auditStatus
  449. })(
  450. <Select placeholder="选择认证状态" style={{ width: 200 }}
  451. onChange={(e) => { this.state.auditStatus = e }}>
  452. {this.state.auditStatusOption}
  453. </Select>
  454. )}
  455. </FormItem>
  456. </Tabs.TabPane>
  457. </Tabs>
  458. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  459. <Button className="set-submit" type="primary" htmlType="submit">保存</Button>
  460. <Button className="set-submit" type="ghost" onClick={this.handleCancel} >取消</Button>
  461. </FormItem>
  462. </Form >
  463. );
  464. }
  465. }));
  466. const OrgDesc = React.createClass({
  467. getInitialState() {
  468. return {
  469. visible: false,
  470. loading: false
  471. };
  472. },
  473. showModal() {
  474. this.setState({
  475. visible: true,
  476. });
  477. },
  478. handleCancel(e) {
  479. this.setState({
  480. visible: false,
  481. });
  482. this.props.closeDesc(false);
  483. },
  484. handleOk(e) {
  485. this.setState({
  486. visible: false,
  487. });
  488. this.props.closeDesc(false, true);
  489. },
  490. componentWillReceiveProps(nextProps) {
  491. this.state.visible = nextProps.showDesc;
  492. },
  493. render() {
  494. if (this.props.data) {
  495. return (
  496. <div className="patent-desc">
  497. <Spin spinning={this.state.loading} className='spin-box'>
  498. <Modal title="用户详情" visible={this.state.visible}
  499. onCancel={this.handleCancel}
  500. width='600px'
  501. footer=''
  502. className="admin-desc-content">
  503. <OrgCertify
  504. visible={this.state.visible}
  505. uid={this.props.data.id}
  506. closeDesc={this.handleCancel}
  507. handleOk={this.handleOk} />
  508. </Modal>
  509. </Spin>
  510. </div>
  511. );
  512. } else {
  513. return <div></div>
  514. }
  515. },
  516. });
  517. export default OrgDesc;