bank.jsx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import React from 'react';
  2. import { Input, Button, Form, Icon, Spin, message, } from 'antd';
  3. import './certify.less';
  4. import ajax from 'jquery/src/ajax/xhr.js'
  5. import $ from 'jquery/src/ajax';
  6. const Content = Form.create()(React.createClass({
  7. getData() {
  8. this.setState({
  9. loading: true
  10. });
  11. $.ajax({
  12. method: "get",
  13. dataType: "json",
  14. url: globalConfig.context + "/api/user/userPro",
  15. success: function (data) {
  16. if (data.data) {
  17. this.setState({
  18. username: data.data.username,
  19. bankName: data.data.bankName,
  20. bankAccount: data.data.bankAccount,
  21. bankCardNumber: data.data.bankCardNumber
  22. })
  23. };
  24. }.bind(this),
  25. }).done(function (data) {
  26. if (data.error.length) {
  27. message.warning(data.error[0].message);
  28. }
  29. }.bind(this)).always(function () {
  30. this.setState({
  31. loading: false
  32. });
  33. }.bind(this));
  34. },
  35. getInitialState() {
  36. return {
  37. loading: false
  38. };
  39. },
  40. handleSubmit(e) {
  41. e.preventDefault();
  42. this.props.form.validateFields((err, values) => {
  43. if (!err) {
  44. this.setState({
  45. loading: true
  46. });
  47. $.ajax({
  48. method: "POST",
  49. dataType: "json",
  50. crossDomain: false,
  51. url: globalConfig.context + "/api/user/userNextPro",
  52. data: {
  53. bankName: this.state.username,
  54. bankAccount: values.bankAccount,
  55. bankCardNumber: values.bankCardNumber,
  56. process: 2
  57. }
  58. }).done(function (data) {
  59. if (!data.error.length) {
  60. message.success('保存成功!');
  61. this.props.changeStep(3);
  62. } else {
  63. message.warning(data.error[0].message);
  64. this.setState({
  65. loading: false
  66. });
  67. }
  68. }.bind(this));
  69. }
  70. });
  71. },
  72. checkBankCardNum(rule, value, callback) {
  73. if (!/(^\d{15,}$)/.test(value)) {
  74. callback('请输入正确的银行卡号!');
  75. } else {
  76. callback();
  77. }
  78. },
  79. getIdCardUrl1(e) {
  80. this.state.idCardUrl1 = e;
  81. },
  82. getIdCardUrl2(e) {
  83. this.state.idCardUrl2 = e;
  84. },
  85. componentDidMount() {
  86. this.getData();
  87. },
  88. changeStep() {
  89. this.props.changeStep(1);
  90. },
  91. render() {
  92. const FormItem = Form.Item;
  93. const { getFieldDecorator } = this.props.form;
  94. const formItemLayout = {
  95. labelCol: { span: 4 },
  96. wrapperCol: { span: 12 },
  97. };
  98. const _me = this;
  99. return (
  100. <Spin spinning={this.state.loading} className="certify-spin">
  101. <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
  102. <FormItem wrapperCol={{ span: 20, offset: 4 }}>
  103. <p className="certify-title">请填写您的银行卡信息,该银行卡仅用于认证您的身份。</p>
  104. </FormItem>
  105. <FormItem
  106. {...formItemLayout}
  107. label="银行开户名"
  108. extra={<span><Icon type="exclamation-circle" /> 必须使用以“{this.state.username}”为开户名的银行卡进行认证</span>}
  109. >
  110. {getFieldDecorator('username')(
  111. <span>{this.state.username}</span>
  112. )}
  113. <a style={{ 'color': '#ea0862', marginLeft: '20px' }} onClick={_me.changeStep}>修改</a>
  114. </FormItem>
  115. <FormItem
  116. {...formItemLayout}
  117. label="开户银行"
  118. extra={<span><Icon type="exclamation-circle" /> 不支持信用卡和存折进行认证</span>}
  119. >
  120. {getFieldDecorator('bankAccount', {
  121. initialValue: this.state.bankAccount || null,
  122. rules: [{ required: true, message: '请输入开户银行名称!' }]
  123. })(
  124. <Input placeholder="请输入开户银行名称" />
  125. )}
  126. </FormItem>
  127. <FormItem
  128. {...formItemLayout}
  129. label="银行卡号"
  130. >
  131. {getFieldDecorator('bankCardNumber', {
  132. initialValue: this.state.bankCardNumber || null,
  133. rules: [{
  134. validator: this.checkIdcardnum,
  135. }],
  136. })(
  137. <Input placeholder="请输入银行卡号" />
  138. )}
  139. </FormItem>
  140. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  141. <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
  142. </FormItem>
  143. </Form >
  144. </Spin >
  145. );
  146. },
  147. }));
  148. export default Content;
  149. // extra={
  150. // <span style={{ 'color': '#ea0862' }}>
  151. // <Icon type="exclamation-circle" />
  152. // 认证系统会给该银行卡打入一笔1元以下的确认金额,您需要通过银行柜台并在
  153. // 步骤4输入该银行卡收到的阿凡提打款金额数目
  154. // </span>}