orgCertify.jsx 19 KB

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