personal.jsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. import React from 'react';
  2. import { Input, Button, Form, Upload, Icon, Spin, message, Row, Col, DatePicker, Select, Radio } from 'antd';
  3. import './certify.less';
  4. import { addressInit, getBase64, beforeUpload, beforeUploadFile } from '../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. import moment from 'moment';
  8. import card1 from '../../../image/idcard1.jpg';
  9. import card2 from '../../../image/idcard2.jpg';
  10. class Avatar extends React.Component {
  11. constructor(props) {
  12. super(props);
  13. this.state = {
  14. imageUrl: ''
  15. }
  16. }
  17. handleChange(info) {
  18. if (info.file.status === 'done') {
  19. // Get this url from response in real world.
  20. getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
  21. this.props.urlData(info.file.response.data);
  22. }
  23. }
  24. render() {
  25. const imageUrl = this.state.imageUrl;
  26. return (
  27. <Upload
  28. className="avatar-uploader"
  29. name={this.props.name}
  30. showUploadList={false}
  31. action={globalConfig.context + "/api/user/identity/upload"}
  32. data={{ 'sign': this.props.name }}
  33. beforeUpload={beforeUpload}
  34. onChange={this.handleChange.bind(this)}
  35. >
  36. {
  37. imageUrl ?
  38. <img src={imageUrl} role="presentation" id={this.props.name} /> :
  39. <Icon type="plus" className="avatar-uploader-trigger" />
  40. }
  41. </Upload>
  42. );
  43. }
  44. };
  45. const Content = Form.create()(React.createClass({
  46. getData() {
  47. this.setState({
  48. loading: true
  49. });
  50. $.ajax({
  51. method: "get",
  52. dataType: "json",
  53. url: globalConfig.context + "/api/user/orgProcess",
  54. success: function (data) {
  55. if (data.data) {
  56. addressInit('cmbProvince', 'cmbCity', 'cmbArea',
  57. data.data.licenceProvince, data.data.licenceCity, data.data.licenceArea);
  58. this.setState({
  59. contacts: data.data.contacts,
  60. contactMobile: data.data.contactMobile,
  61. aftUsername: data.data.aftUsername,
  62. unitName: data.data.unitName,
  63. registeredCapital: data.data.registeredCapital,
  64. licenceNumber: data.data.licenceNumber,
  65. orgCode: data.data.orgCode,
  66. legalPerson: data.data.legalPerson,
  67. legalPersonIdCard: data.data.legalPersonIdCard,
  68. licenceScanningUrl: data.data.licenceScanningUrl,
  69. orgCodeUrl: data.data.orgCodeUrl,
  70. lastYearTaxReportUrl: data.data.lastYearTaxReportUrl,
  71. listed: data.data.listed,
  72. listedDate: data.data.listedDateFormattedDate,
  73. listedType: data.data.listedType,
  74. stockCode: data.data.stockCode,
  75. auditStatus: data.data.auditStatus
  76. });
  77. };
  78. }.bind(this),
  79. }).done(function (data) {
  80. if (data.error.length) {
  81. message.warning(data.error[0].message);
  82. }
  83. }.bind(this)).always(function () {
  84. this.setState({
  85. loading: false
  86. });
  87. }.bind(this));
  88. },
  89. getInitialState() {
  90. return {
  91. loading: false,
  92. vsCodeSrc: globalConfig.context + '/open/getVCode'
  93. };
  94. },
  95. handleSubmit(e) {
  96. e.preventDefault();
  97. this.props.form.validateFields((err, values) => {
  98. //地址值
  99. let cmbP = document.getElementById('cmbProvince').value;
  100. let cmbC = document.getElementById('cmbCity').value;
  101. let cmbA = document.getElementById('cmbArea').value;
  102. if (!cmbP || !cmbC || !cmbA) {
  103. message.warning("请选择所在地!");
  104. return;
  105. };
  106. if (!this.state.licenceScanningUrl) {
  107. message.warning("请上传营业执照副本!");
  108. return;
  109. };
  110. if (!this.state.orgCodeUrl) {
  111. message.warning("请上传组织机构代码证!");
  112. return;
  113. };
  114. if (!this.state.lastYearTaxReportUrl) {
  115. message.warning("请上传上年度纳税报表!");
  116. return;
  117. };
  118. if (!err) {
  119. this.setState({
  120. loading: true
  121. });
  122. if (values.listed == 1) {
  123. if (!values.listedDate || !values.listedType || !values.stockCode) {
  124. message.warning("请输入上市资料!");
  125. return;
  126. };
  127. };
  128. $.ajax({
  129. method: "POST",
  130. dataType: "json",
  131. crossDomain: false,
  132. url: globalConfig.context + "/api/user/orgNextPro",
  133. data: {
  134. contacts: values.contacts,
  135. contactMobile: values.contactMobile,
  136. aftUsername: values.aftUsername,
  137. unitName: values.unitName,
  138. registeredCapital: values.registeredCapital,
  139. licenceNumber: values.licenceNumber,
  140. licenceProvince: cmbP,
  141. licenceCity: cmbC,
  142. licenceArea: cmbA,
  143. licenceScanningUrl: this.state.licenceScanningUrl,
  144. orgCode: values.orgCode,
  145. orgCodeUrl: this.state.orgCodeUrl,
  146. lastYearTaxReportUrl: this.state.lastYearTaxReportUrl,
  147. legalPerson: values.legalPerson,
  148. legalPersonIdCard: values.legalPersonIdCard,
  149. verificationCode: values.captcha,
  150. listed: values.listed,
  151. listedDateFormattedDate: values.listedDate ? values.listedDate.format("YYYY-MM-DD") : null,
  152. listedType: values.listedType,
  153. stockCode: values.stockCode,
  154. auditStatus: this.state.auditStatus,
  155. process: 1
  156. }
  157. }).done(function (data) {
  158. if (!data.error.length) {
  159. message.success('保存成功!');
  160. this.props.changeStep(2);
  161. } else {
  162. message.warning(data.error[0].message);
  163. this.reloadVCode();
  164. this.setState({
  165. loading: false
  166. });
  167. }
  168. }.bind(this));
  169. }
  170. });
  171. },
  172. checkIdcardnum(rule, value, callback) {
  173. if (!/(^\d{15}$)|(^\d{17}(\d|X)$)/.test(value)) {
  174. callback('请输入正确的身份证号!');
  175. } else {
  176. callback();
  177. }
  178. },
  179. checkPhone(rule, value, callback) {
  180. const form = this.props.form;
  181. const _me = this;
  182. if (!(/^1[34578]\d{9}$/.test(value))) {
  183. callback('请输入正确的手机号码!');
  184. _me.setState({
  185. getCodeButton: true
  186. });
  187. } else {
  188. callback();
  189. _me.setState({
  190. getCodeButton: false
  191. });
  192. }
  193. },
  194. checkNumber(rule, value, callback) {
  195. if (!/(^[a-zA-Z0-9]{0,18}$)/.test(value)) {
  196. callback('请输入正确的营业执照注册号!');
  197. } else {
  198. callback();
  199. }
  200. },
  201. getLicenceScanningUrl(e) {
  202. this.state.licenceScanningUrl = e;
  203. },
  204. getOrgCodeUrl(e) {
  205. this.state.orgCodeUrl = e;
  206. },
  207. getLastYearTaxReportUrl(e) {
  208. this.state.lastYearTaxReportUrl = e;
  209. },
  210. componentDidMount() {
  211. addressInit('cmbProvince', 'cmbCity', 'cmbArea');
  212. this.getData();
  213. },
  214. reloadVCode() {
  215. this.setState({
  216. vsCodeSrc: globalConfig.context + '/open/getVCode?t=' + Math.random()
  217. });
  218. },
  219. render() {
  220. const FormItem = Form.Item;
  221. const { getFieldDecorator } = this.props.form;
  222. const formItemLayout = {
  223. labelCol: { span: 6 },
  224. wrapperCol: { span: 12 },
  225. };
  226. const _me = this;
  227. return (
  228. <Spin spinning={this.state.loading} className="certify-spin">
  229. <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
  230. <FormItem
  231. {...formItemLayout}
  232. label="用户名"
  233. extra={<span><Icon type="exclamation-circle" /> 建议字母、数字和符号两种以上组合,6-20个字符</span>}
  234. >
  235. {getFieldDecorator('aftUsername', {
  236. initialValue: this.state.aftUsername || null,
  237. rules: [{ required: true, message: '请输入用户名!' }]
  238. })(
  239. <Input />
  240. )}
  241. </FormItem>
  242. <FormItem
  243. {...formItemLayout}
  244. label="企业名称"
  245. >
  246. {getFieldDecorator('unitName', {
  247. initialValue: this.state.unitName || null,
  248. rules: [{ required: true, message: '请输入企业名称!' }]
  249. })(
  250. <Input placeholder="请输入企业名称" />
  251. )}
  252. </FormItem>
  253. <FormItem
  254. {...formItemLayout}
  255. label="注册资金"
  256. > {getFieldDecorator('registeredCapital', {
  257. initialValue: this.state.registeredCapital || null
  258. })(
  259. <Input />
  260. )}
  261. <span className="fromItem-postfix">万元</span>
  262. </FormItem>
  263. <FormItem
  264. {...formItemLayout}
  265. label="是否上市"
  266. > {getFieldDecorator('listed', {
  267. initialValue: this.state.listed || "0"
  268. })(
  269. <Radio.Group>
  270. <Radio value="0">否</Radio>
  271. <Radio value="1">是</Radio>
  272. </Radio.Group>
  273. )}
  274. </FormItem>
  275. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  276. {...formItemLayout}
  277. label="上市时间"
  278. >
  279. {getFieldDecorator('listedDate', {
  280. initialValue: this.state.listedDate ? moment(this.state.listedDate) : null
  281. })(
  282. <DatePicker />
  283. )}
  284. </FormItem>
  285. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  286. {...formItemLayout}
  287. label="上市类型"
  288. > {getFieldDecorator('listedType', {
  289. initialValue: this.state.listedType
  290. })(
  291. <Select placeholder="请选择上市类型">
  292. <Select.Option value='0'>股票型上市公司</Select.Option>
  293. <Select.Option value='1'>债券型上市公司</Select.Option>
  294. </Select>
  295. )}
  296. </FormItem>
  297. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  298. {...formItemLayout}
  299. label="股票代码"
  300. > {getFieldDecorator('stockCode', {
  301. initialValue: this.state.stockCode
  302. })(
  303. <Input />
  304. )}
  305. </FormItem>
  306. <FormItem
  307. {...formItemLayout}
  308. label="联系人"
  309. >
  310. {getFieldDecorator('contacts', {
  311. initialValue: this.state.contacts || null,
  312. rules: [{ required: true, message: '请输入联系人姓名!' }]
  313. })(
  314. <Input />
  315. )}
  316. </FormItem>
  317. <FormItem
  318. {...formItemLayout}
  319. label="联系方式"
  320. extra={<span><Icon type="exclamation-circle" /> 请填写联系人手机号码,我们会将重要进度以短信形式通知您</span>}
  321. >
  322. {getFieldDecorator('contactMobile', {
  323. initialValue: this.state.contactMobile || null,
  324. rules: [{ validator: this.checkPhone }]
  325. })(
  326. <Input placeholder="建议使用常用手机" />
  327. )}
  328. </FormItem>
  329. <FormItem
  330. {...formItemLayout}
  331. label="法人姓名"
  332. >
  333. {getFieldDecorator('legalPerson', {
  334. initialValue: this.state.legalPerson || null,
  335. rules: [{ required: true, message: '请输入联系人姓名!' }]
  336. })(
  337. <Input />
  338. )}
  339. </FormItem>
  340. <FormItem
  341. {...formItemLayout}
  342. label="身份证号"
  343. >
  344. {getFieldDecorator('legalPersonIdCard', {
  345. rules: [{
  346. validator: this.checkIdcardnum,
  347. }],
  348. initialValue: this.state.legalPersonIdCard || null
  349. })(
  350. <Input placeholder="请输入真实有效的身份证号码" />
  351. )}
  352. </FormItem>
  353. <FormItem
  354. {...formItemLayout}
  355. label="营业执照注册号"
  356. >
  357. {getFieldDecorator('licenceNumber', {
  358. initialValue: this.state.licenceNumber || null,
  359. rules: [{
  360. validator: this.checkNumber,
  361. }],
  362. })(
  363. <Input />
  364. )}
  365. </FormItem>
  366. <FormItem
  367. labelCol={{ span: 6 }}
  368. wrapperCol={{ span: 18 }}
  369. label="营业执照所在地"
  370. >
  371. {getFieldDecorator('address')(
  372. <div>
  373. <select id="cmbProvince" name="cmbProvince"></select>
  374. <select id="cmbCity" name="cmbCity"></select>
  375. <select id="cmbArea" name="cmbArea"></select>
  376. </div>
  377. )}
  378. </FormItem>
  379. <FormItem
  380. labelCol={{ span: 6 }}
  381. wrapperCol={{ span: 18 }}
  382. label="营业执照副本扫描件"
  383. >
  384. {getFieldDecorator('licenceScanningUrl')(
  385. <Avatar name="licenceScanningUrl" urlData={this.getLicenceScanningUrl} />
  386. )}
  387. </FormItem>
  388. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  389. <p>1.企业营业执照副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  390. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  391. </FormItem>
  392. <FormItem
  393. {...formItemLayout}
  394. label="组织机构代码证号码"
  395. extra={<span><Icon type="exclamation-circle" /> 如机构已五证合一,社会统一注册号的第九位至倒数第二位,即为您单位的组织机构代码证号码。</span>}
  396. >
  397. {getFieldDecorator('orgCode', {
  398. initialValue: this.state.orgCode || null,
  399. rules: [{ required: true, message: '请输入组织机构代码证号码!' }]
  400. })(
  401. <Input />
  402. )}
  403. </FormItem>
  404. <FormItem
  405. labelCol={{ span: 6 }}
  406. wrapperCol={{ span: 18 }}
  407. label="组织机构代码证扫描件"
  408. >
  409. {getFieldDecorator('orgCodeUrl')(
  410. <Avatar name="orgCodeUrl" urlData={this.getOrgCodeUrl} />
  411. )}
  412. </FormItem>
  413. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  414. <p>1.组织机构代码证副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  415. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  416. </FormItem>
  417. <FormItem
  418. labelCol={{ span: 6 }}
  419. wrapperCol={{ span: 18 }}
  420. label="上年度纳税报表"
  421. >
  422. <div className="hrSituation-roster">
  423. <Upload
  424. name="ratepay"
  425. action={globalConfig.context + "/techservice/cognizance/upload"}
  426. data={{ 'sign': 'ratepay_' + (new Date().getFullYear() - 1) }}
  427. beforeUpload={beforeUploadFile}
  428. showUploadList={false}
  429. onChange={(info) => {
  430. if (info.file.status !== 'uploading') {
  431. console.log(info.file, info.fileList);
  432. }
  433. if (info.file.status === 'done') {
  434. if (!info.file.response.error.length) {
  435. message.success(`${info.file.name} 文件上传成功!`);
  436. } else {
  437. message.warning(info.file.response.error[0].message);
  438. return;
  439. };
  440. this.state.lastYearTaxReportUrl = info.file.response.data;
  441. } else if (info.file.status === 'error') {
  442. message.error(`${info.file.name} 文件上传失败。`);
  443. }
  444. }}
  445. >
  446. <Button><Icon type="upload" /> 上传上年度纳税申报表 </Button>
  447. </Upload>
  448. </div>
  449. </FormItem>
  450. <FormItem
  451. {...formItemLayout}
  452. label="验证码"
  453. extra={<span style={{ 'color': '#ea0862' }}><Icon type="exclamation-circle" /> 看不清?点击图片更换验证码</span>}
  454. >
  455. <Row gutter={8}>
  456. <Col span={16}>
  457. {getFieldDecorator('captcha', {
  458. rules: [{ required: true, message: '请输入图片中的验证码' }],
  459. })(
  460. <Input />
  461. )}
  462. </Col>
  463. <Col span={8}>
  464. <div className="getVcode">
  465. <img id="VCode" src={this.state.vsCodeSrc} alt="" onClick={this.reloadVCode} />
  466. </div>
  467. </Col>
  468. </Row>
  469. </FormItem>
  470. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  471. <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
  472. <Button className="exit" type="ghost">退出实名认证</Button>
  473. </FormItem>
  474. </Form >
  475. </Spin >
  476. );
  477. },
  478. }));
  479. export default Content;