personal.jsx 21 KB

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