personal.jsx 21 KB

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