personal.jsx 22 KB

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