personal.jsx 21 KB

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