personal.jsx 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. import React from 'react';
  2. import { Input, Button, Form, Upload, Icon, Spin, message, Row, Col } from 'antd';
  3. import './certify.less';
  4. import { addressInit, getBase64, beforeUpload, beforeUploadFile } from '../tools.js';
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. import card1 from '../../../image/idcard1.jpg';
  8. import card2 from '../../../image/idcard2.jpg';
  9. class Avatar extends React.Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. imageUrl: ''
  14. }
  15. }
  16. handleChange(info) {
  17. if (info.file.status === 'done') {
  18. // Get this url from response in real world.
  19. getBase64(info.file.originFileObj, imageUrl => this.setState({ imageUrl }));
  20. this.props.urlData(info.file.response.data);
  21. }
  22. }
  23. render() {
  24. const imageUrl = this.state.imageUrl;
  25. return (
  26. <Upload
  27. className="avatar-uploader"
  28. name={this.props.name}
  29. showUploadList={false}
  30. action={globalConfig.context + "/api/user/identity/upload"}
  31. data={{ 'sign': this.props.name }}
  32. beforeUpload={beforeUpload}
  33. onChange={this.handleChange.bind(this)}
  34. >
  35. {
  36. imageUrl ?
  37. <img src={imageUrl} role="presentation" id={this.props.name} /> :
  38. <Icon type="plus" className="avatar-uploader-trigger" />
  39. }
  40. </Upload>
  41. );
  42. }
  43. };
  44. class UploadFile extends React.Component {
  45. constructor(props) {
  46. super(props);
  47. }
  48. handleChange(info) {
  49. if (info.file.status === 'done') {
  50. this.props.urlData(info.file.response.data);
  51. }
  52. }
  53. render() {
  54. return (
  55. <Upload
  56. name={this.props.name}
  57. showUploadList={false}
  58. action={globalConfig.context + "/api/user/identity/upload"}
  59. data={{ 'sign': this.props.name }}
  60. beforeUpload={beforeUploadFile}
  61. onChange={this.handleChange.bind(this)}
  62. >
  63. <Button><Icon type="upload" />上传</Button>
  64. </Upload>
  65. );
  66. }
  67. };
  68. const Content = Form.create()(React.createClass({
  69. getData() {
  70. this.setState({
  71. loading: true
  72. });
  73. $.ajax({
  74. method: "get",
  75. dataType: "json",
  76. url: globalConfig.context + "/api/user/orgProcess",
  77. success: function (data) {
  78. if (data.data) {
  79. addressInit('cmbProvince', 'cmbCity', 'cmbArea',
  80. data.data.licenceProvince, data.data.licenceCity, data.data.licenceArea);
  81. this.setState({
  82. contactMobile: data.data.contactMobile,
  83. aftUsername: data.data.aft,
  84. unitName: data.data.unitName,
  85. registeredCapital: data.data.registeredCapital,
  86. licenceNumber: data.data.licenceNumber,
  87. orgCode: data.data.orgCode,
  88. legalPerson:data.data.legalPerson,
  89. legalPersonIdNumber:data.data.legalPersonIdNumber
  90. });
  91. } else {
  92. message.warning(data.error[0].message);
  93. };
  94. }.bind(this),
  95. }).always(function () {
  96. this.setState({
  97. loading: false
  98. });
  99. }.bind(this));
  100. },
  101. getInitialState() {
  102. return {
  103. loading: false
  104. };
  105. },
  106. handleSubmit(e) {
  107. e.preventDefault();
  108. this.props.form.validateFields((err, values) => {
  109. //地址值
  110. let cmbP = document.getElementById('cmbProvince').value;
  111. let cmbC = document.getElementById('cmbCity').value;
  112. let cmbA = document.getElementById('cmbArea').value;
  113. if (cmbP || cmbC || cmbA) {
  114. message.warning("请选择所在地!");
  115. return;
  116. };
  117. if (this.state.licenceScanningUrl) {
  118. message.warning("请上传营业执照副本!");
  119. return;
  120. };
  121. if (this.state.orgCodeUrl) {
  122. message.warning("请上传组织机构代码证!");
  123. return;
  124. };
  125. if (this.state.lastYearTaxReportUrl) {
  126. message.warning("请上传上年度纳税报表!");
  127. return;
  128. };
  129. if (!err) {
  130. this.setState({
  131. loading: true
  132. });
  133. $.ajax({
  134. method: "POST",
  135. dataType: "json",
  136. crossDomain: false,
  137. url: globalConfig.context + "/api/user/orgNextPro",
  138. data: {
  139. contacts:values.contacts,
  140. contactMobile: values.contactMobile,
  141. aftUsername: values.aft,
  142. unitName: values.unitName,
  143. registeredCapital: values.registeredCapital,
  144. licenceNumber: values.licenceNumber,
  145. licenceProvince: cmbP,
  146. licenceCity: cmbC,
  147. licenceArea: cmbA,
  148. licenceScanningUrl: this.state.licenceScanningUrl,
  149. orgCode: values.orgCode,
  150. orgCodeUrl: this.state.orgCodeUrl,
  151. lastYearTaxReportUrl: this.state.lastYearTaxReportUrl,
  152. legalPerson:values.legalPerson,
  153. legalPersonIdNumber:values.legalPersonIdNumber,
  154. captcha:values.captcha,
  155. process: 1
  156. }
  157. }).done(function (data) {
  158. if (!data.error.length) {
  159. message.success('保存成功!');
  160. this.props.changeStep(2);
  161. } else {
  162. message.warning(data.error[0].message);
  163. }
  164. }.bind(this)).always(function () {
  165. this.setState({
  166. loading: false
  167. });
  168. }.bind(this));
  169. }
  170. });
  171. },
  172. checkIdcardnum(rule, value, callback) {
  173. if (!/(^\d{15}$)|(^\d{17}(\d|X)$)/.test(value)) {
  174. callback('请输入正确的身份证号!');
  175. } else {
  176. callback();
  177. }
  178. },
  179. checkPhone(rule, value, callback) {
  180. const form = this.props.form;
  181. const _me = this;
  182. if (!(/^1[34578]\d{9}$/.test(value))) {
  183. callback('请输入正确的手机号码!');
  184. _me.setState({
  185. getCodeButton: true
  186. });
  187. } else {
  188. callback();
  189. _me.setState({
  190. getCodeButton: false
  191. });
  192. }
  193. },
  194. checkNumber(rule, value, callback) {
  195. if (!/(^\d{15}$)/.test(value)) {
  196. callback('请输入正确的营业执照注册号!');
  197. } else {
  198. callback();
  199. }
  200. },
  201. getLicenceScanningUrl(e) {
  202. this.state.licenceScanningUrl = e;
  203. },
  204. getOrgCodeUrl(e) {
  205. this.state.orgCodeUrl = e;
  206. },
  207. getLastYearTaxReportUrl(e) {
  208. this.state.lastYearTaxReportUrl = e;
  209. },
  210. componentDidMount() {
  211. addressInit('cmbProvince', 'cmbCity', 'cmbArea');
  212. this.getData();
  213. },
  214. reloadVCode(e) {
  215. e.target.src = globalConfig.context + '/open/getVCode?t=' + Math.random();
  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. >
  255. {getFieldDecorator('registeredCapital', {
  256. initialValue: this.state.registeredCapital || null,
  257. rules: [{ required: true, message: '请输入注册资金!' }]
  258. })(
  259. <Input />
  260. )}
  261. <span className="fromItem-postfix">万元</span>
  262. </FormItem>
  263. <FormItem
  264. {...formItemLayout}
  265. label="联系人"
  266. >
  267. {getFieldDecorator('contacts', {
  268. initialValue: this.state.contacts || null,
  269. rules: [{ required: true, message: '请输入联系人姓名!' }]
  270. })(
  271. <Input />
  272. )}
  273. </FormItem>
  274. <FormItem
  275. {...formItemLayout}
  276. label="联系方式"
  277. extra={<span><Icon type="exclamation-circle" /> 请填写联系人手机号码,我们会将重要进度以短信形式通知您</span>}
  278. >
  279. {getFieldDecorator('contactMobile', {
  280. initialValue: this.state.contactMobile || null,
  281. rules: [{ validator: this.checkPhone }]
  282. })(
  283. <Input placeholder="建议使用常用手机" />
  284. )}
  285. </FormItem>
  286. <FormItem
  287. {...formItemLayout}
  288. label="法人姓名"
  289. >
  290. {getFieldDecorator('contacts', {
  291. initialValue: this.state.contacts || null,
  292. rules: [{ required: true, message: '请输入联系人姓名!' }]
  293. })(
  294. <Input />
  295. )}
  296. </FormItem>
  297. <FormItem
  298. {...formItemLayout}
  299. label="身份证号"
  300. >
  301. {getFieldDecorator('idNumber', {
  302. rules: [{
  303. validator: this.checkIdcardnum,
  304. }],
  305. initialValue: this.state.idNumber || null
  306. })(
  307. <Input placeholder="请输入真实有效的身份证号码" />
  308. )}
  309. </FormItem>
  310. <FormItem
  311. {...formItemLayout}
  312. label="营业执照注册号"
  313. >
  314. {getFieldDecorator('licenceNumber', {
  315. initialValue: this.state.licenceNumber || null,
  316. rules: [{
  317. validator: this.checkNumber,
  318. }],
  319. })(
  320. <Input />
  321. )}
  322. </FormItem>
  323. <FormItem
  324. {...formItemLayout}
  325. label="营业执照所在地"
  326. >
  327. {getFieldDecorator('address')(
  328. <div>
  329. <select id="cmbProvince" name="cmbProvince"></select>
  330. <select id="cmbCity" name="cmbCity"></select>
  331. <select id="cmbArea" name="cmbArea"></select>
  332. </div>
  333. )}
  334. </FormItem>
  335. <FormItem
  336. labelCol={{ span: 6 }}
  337. wrapperCol={{ span: 18 }}
  338. label="营业执照副本扫描件"
  339. >
  340. {getFieldDecorator('licenceScanningUrl')(
  341. <Avatar name="licenceScanningUrl" urlData={this.getLicenceScanningUrl} />
  342. )}
  343. </FormItem>
  344. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  345. <p>1.企业营业执照副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  346. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  347. </FormItem>
  348. <FormItem
  349. {...formItemLayout}
  350. label="组织机构代码证号码"
  351. extra={<span><Icon type="exclamation-circle" /> 如机构已五证合一,社会统一注册号的第九位至倒数第二位,即为您单位的组织机构代码证号码。</span>}
  352. >
  353. {getFieldDecorator('orgCode', {
  354. initialValue: this.state.orgCode || null,
  355. rules: [{ required: true, message: '请输入组织机构代码证号码!' }]
  356. })(
  357. <Input />
  358. )}
  359. </FormItem>
  360. <FormItem
  361. labelCol={{ span: 6 }}
  362. wrapperCol={{ span: 18 }}
  363. label="组织机构代码证扫描件"
  364. >
  365. {getFieldDecorator('orgCodeUrl')(
  366. <Avatar name="orgCodeUrl" urlData={this.getOrgCodeUrl} />
  367. )}
  368. </FormItem>
  369. <FormItem wrapperCol={{ span: 21, offset: 6 }}>
  370. <p>1.组织机构代码证副本复印件加盖企业公章后,扫描或拍照上传,图片大小不超过2M以内,仅支持jpg格式。</p>
  371. <p>2.若已办理三证合一,请输入统一社会信用代码并上传营业执照副本复印件(加盖企业公章)。</p>
  372. </FormItem>
  373. <FormItem
  374. labelCol={{ span: 6 }}
  375. wrapperCol={{ span: 18 }}
  376. label="上年度纳税报表"
  377. >
  378. {getFieldDecorator('lastYearTaxReportUrl')(
  379. <UploadFile name="lastYearTaxReportUrl" urlData={this.getLastYearTaxReportUrl} />
  380. )}
  381. </FormItem>
  382. <FormItem
  383. {...formItemLayout}
  384. label="验证码"
  385. extra={<span style={{ 'color': '#ea0862' }}><Icon type="exclamation-circle" /> 看不清?点击图片更换验证码</span>}
  386. >
  387. <Row gutter={8}>
  388. <Col span={16}>
  389. {getFieldDecorator('captcha', {
  390. rules: [{ required: true, message: '请输入图片中的验证码' }],
  391. })(
  392. <Input />
  393. )}
  394. </Col>
  395. <Col span={8}>
  396. <div className="getVcode">
  397. <img id="VCode" src={globalConfig.context + '/open/getVCode'} alt="" onClick={this.reloadVCode} />
  398. </div>
  399. </Col>
  400. </Row>
  401. </FormItem>
  402. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  403. <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
  404. <Button className="exit" type="ghost">退出实名认证</Button>
  405. </FormItem>
  406. </Form >
  407. </Spin >
  408. );
  409. },
  410. }));
  411. export default Content;