personal.jsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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: globalConfig.context + '/open/getVCode'
  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.reloadVCode();
  163. this.setState({
  164. loading: false
  165. });
  166. }
  167. }.bind(this));
  168. };
  169. });
  170. },
  171. checkIdcardnum(rule, value, callback) {
  172. if (!/(^\d{15}$)|(^\d{17}(\d|X)$)/.test(value)) {
  173. callback('请输入正确的身份证号!');
  174. } else {
  175. callback();
  176. }
  177. },
  178. checkPhone(rule, value, callback) {
  179. const form = this.props.form;
  180. const _me = this;
  181. if (!(/^1[34578]\d{9}$/.test(value))) {
  182. callback('请输入正确的手机号码!');
  183. _me.setState({
  184. getCodeButton: true
  185. });
  186. } else {
  187. callback();
  188. _me.setState({
  189. getCodeButton: false
  190. });
  191. }
  192. },
  193. checkNumber(rule, value, callback) {
  194. if (!/(^[a-zA-Z0-9]{0,18}$)/.test(value)) {
  195. callback('请输入正确的营业执照注册号!');
  196. } else {
  197. callback();
  198. }
  199. },
  200. getLicenceScanningUrl(e) {
  201. this.state.licenceScanningUrl = e;
  202. },
  203. getOrgCodeUrl(e) {
  204. this.state.orgCodeUrl = e;
  205. },
  206. getLastYearTaxReportUrl(e) {
  207. this.state.lastYearTaxReportUrl = e;
  208. },
  209. componentWillMount() {
  210. this.getData();
  211. },
  212. reloadVCode() {
  213. this.setState({
  214. vsCodeSrc: globalConfig.context + '/open/getVCode?t=' + Math.random()
  215. });
  216. },
  217. render() {
  218. const FormItem = Form.Item;
  219. const { getFieldDecorator } = this.props.form;
  220. const formItemLayout = {
  221. labelCol: { span: 6 },
  222. wrapperCol: { span: 12 },
  223. };
  224. const _me = this;
  225. return (
  226. <Spin spinning={this.state.loading} className="certify-spin">
  227. <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
  228. <FormItem
  229. {...formItemLayout}
  230. label="用户名"
  231. extra={<span><Icon type="exclamation-circle" /> 建议字母、数字和符号两种以上组合,6-20个字符</span>}
  232. >
  233. {getFieldDecorator('aftUsername', {
  234. initialValue: this.state.aftUsername || null,
  235. rules: [{ required: true, message: '请输入用户名!' }]
  236. })(
  237. <Input />
  238. )}
  239. </FormItem>
  240. <FormItem
  241. {...formItemLayout}
  242. label="企业名称"
  243. >
  244. {getFieldDecorator('unitName', {
  245. initialValue: this.state.unitName || null,
  246. rules: [{ required: true, message: '请输入企业名称!' }]
  247. })(
  248. <Input placeholder="请输入企业名称" />
  249. )}
  250. </FormItem>
  251. <FormItem
  252. {...formItemLayout}
  253. label="注册资金" >
  254. {getFieldDecorator('registeredCapital', {
  255. initialValue: this.state.registeredCapital || null
  256. })(
  257. <Input />
  258. )}
  259. <span className="fromItem-postfix">万元</span>
  260. </FormItem>
  261. <FormItem className="half-item"
  262. {...formItemLayout}
  263. label="领域" >
  264. {getFieldDecorator('field', {
  265. rules: [{ type: 'array', required: true, message: '此项为必填项!' }],
  266. initialValue: this.state.field
  267. })(
  268. <Cascader placeholder="请选择一个领域" options={techFieldList} />
  269. )}
  270. </FormItem>
  271. <FormItem
  272. {...formItemLayout}
  273. label="是否上市"
  274. > {getFieldDecorator('listed', {
  275. initialValue: this.state.listed || "0"
  276. })(
  277. <Radio.Group>
  278. <Radio value="0">否</Radio>
  279. <Radio value="1">是</Radio>
  280. </Radio.Group>
  281. )}
  282. </FormItem>
  283. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  284. {...formItemLayout}
  285. label="上市时间"
  286. >
  287. {getFieldDecorator('listedDate', {
  288. initialValue: this.state.listedDate ? moment(this.state.listedDate) : null
  289. })(
  290. <DatePicker />
  291. )}
  292. </FormItem>
  293. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  294. {...formItemLayout}
  295. label="上市类型"
  296. > {getFieldDecorator('listedType', {
  297. initialValue: this.state.listedType
  298. })(
  299. <Select placeholder="请选择上市类型">
  300. <Select.Option value='0'>股票型上市公司</Select.Option>
  301. <Select.Option value='1'>债券型上市公司</Select.Option>
  302. </Select>
  303. )}
  304. </FormItem>
  305. <FormItem style={{ display: this.props.form.getFieldValue('listed') == 0 ? 'none' : 'block' }}
  306. {...formItemLayout}
  307. label="股票代码"
  308. > {getFieldDecorator('stockCode', {
  309. initialValue: this.state.stockCode
  310. })(
  311. <Input />
  312. )}
  313. </FormItem>
  314. <FormItem
  315. {...formItemLayout}
  316. label="联系人"
  317. >
  318. {getFieldDecorator('firstContacts', {
  319. initialValue: this.state.firstContacts || null,
  320. rules: [{ required: true, message: '请输入联系人姓名!' }]
  321. })(
  322. <Input />
  323. )}
  324. </FormItem>
  325. <FormItem
  326. {...formItemLayout}
  327. label="联系方式"
  328. extra={<span><Icon type="exclamation-circle" /> 请填写联系人手机号码,我们会将重要进度以短信形式通知您</span>}
  329. >
  330. {getFieldDecorator('firstMobile', {
  331. initialValue: this.state.firstMobile || null,
  332. rules: [{ validator: this.checkPhone }]
  333. })(
  334. <Input placeholder="建议使用常用手机" />
  335. )}
  336. </FormItem>
  337. <FormItem
  338. {...formItemLayout}
  339. label="法人姓名"
  340. >
  341. {getFieldDecorator('legalPerson', {
  342. initialValue: this.state.legalPerson || null,
  343. rules: [{ required: true, message: '请输入联系人姓名!' }]
  344. })(
  345. <Input />
  346. )}
  347. </FormItem>
  348. <FormItem
  349. {...formItemLayout}
  350. label="身份证号"
  351. >
  352. {getFieldDecorator('legalPersonIdCard', {
  353. rules: [{
  354. validator: this.checkIdcardnum,
  355. }],
  356. initialValue: this.state.legalPersonIdCard || null
  357. })(
  358. <Input placeholder="请输入真实有效的身份证号码" />
  359. )}
  360. </FormItem>
  361. <FormItem
  362. {...formItemLayout}
  363. label="营业执照注册号"
  364. >
  365. {getFieldDecorator('licenceNumber', {
  366. initialValue: this.state.licenceNumber || null,
  367. rules: [{
  368. validator: this.checkNumber,
  369. }],
  370. })(
  371. <Input />
  372. )}
  373. </FormItem>
  374. <FormItem
  375. labelCol={{ span: 6 }}
  376. wrapperCol={{ span: 18 }}
  377. label="营业执照所在地"
  378. >
  379. {getFieldDecorator('address', {
  380. initialValue: this.state.address || null,
  381. rules: [{ type: 'array', required: true, message: '请选择地址!' }]
  382. })(
  383. <Cascader options={areaSelect()} placeholder="请选择地址" />
  384. )}
  385. </FormItem>
  386. <FormItem
  387. labelCol={{ span: 6 }}
  388. wrapperCol={{ span: 18 }}
  389. label="营业执照副本扫描件"
  390. >
  391. {getFieldDecorator('licenceScanningUrl')(
  392. <Avatar name="licence" urlData={this.getLicenceScanningUrl} />
  393. )}
  394. </FormItem>
  395. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  396. <p>1.企业营业执照副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  397. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  398. </FormItem>
  399. <FormItem
  400. {...formItemLayout}
  401. label="组织机构代码证号码"
  402. extra={<span><Icon type="exclamation-circle" /> 如机构已五证合一,社会统一注册号的第九位至倒数第二位,即为您单位的组织机构代码证号码。</span>}
  403. >
  404. {getFieldDecorator('orgCode', {
  405. initialValue: this.state.orgCode || null,
  406. rules: [{ required: true, message: '请输入组织机构代码证号码!' }]
  407. })(
  408. <Input />
  409. )}
  410. </FormItem>
  411. <FormItem
  412. labelCol={{ span: 6 }}
  413. wrapperCol={{ span: 18 }}
  414. label="组织机构代码证扫描件"
  415. >
  416. {getFieldDecorator('orgCodeUrl')(
  417. <Avatar name="orgCode" urlData={this.getOrgCodeUrl} />
  418. )}
  419. </FormItem>
  420. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  421. <p>1.组织机构代码证副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  422. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  423. </FormItem>
  424. <FormItem
  425. labelCol={{ span: 6 }}
  426. wrapperCol={{ span: 18 }}
  427. label="上年度纳税报表"
  428. >
  429. <div className="hrSituation-roster">
  430. <Upload
  431. name="ratepay"
  432. action={globalConfig.context + "/api/user/cognizance/uploadLastYearRatepay"}
  433. data={{ 'sign': 'ratepay' }}
  434. beforeUpload={beforeUploadFile}
  435. fileList={this.state.fileList}
  436. onChange={(info) => {
  437. if (info.file.status !== 'uploading') {
  438. console.log(info.file, info.fileList);
  439. }
  440. if (info.file.status === 'done') {
  441. if (!info.file.response.error.length) {
  442. message.success(`${info.file.name} 文件上传成功!`);
  443. } else {
  444. message.warning(info.file.response.error[0].message);
  445. return;
  446. };
  447. this.state.lastYearTaxReportUrl = info.file.response.data;
  448. } else if (info.file.status === 'error') {
  449. message.error(`${info.file.name} 文件上传失败。`);
  450. };
  451. this.setState({ fileList: info.fileList.slice(-1) });
  452. }}
  453. >
  454. <Button><Icon type="upload" /> 上传上年度纳税申报表 </Button>
  455. </Upload>
  456. </div>
  457. </FormItem>
  458. <FormItem
  459. {...formItemLayout}
  460. label="验证码"
  461. extra={<span style={{ 'color': '#ea0862' }}><Icon type="exclamation-circle" /> 看不清?点击图片更换验证码</span>}
  462. >
  463. <Row gutter={8}>
  464. <Col span={16}>
  465. {getFieldDecorator('captcha', {
  466. rules: [{ required: true, message: '请输入图片中的验证码' }],
  467. })(
  468. <Input />
  469. )}
  470. </Col>
  471. <Col span={8}>
  472. <div className="getVcode">
  473. <img id="VCode" src={this.state.vsCodeSrc} alt="" onClick={this.reloadVCode} />
  474. </div>
  475. </Col>
  476. </Row>
  477. </FormItem>
  478. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  479. <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
  480. <Button className="exit" type="ghost" onClick={() => {
  481. window.location.href = globalConfig.context + '/user/account/index.html'
  482. }}>退出实名认证</Button>
  483. </FormItem>
  484. </Form >
  485. </Spin >
  486. );
  487. },
  488. }));
  489. export default Content;