bank.jsx 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import React from 'react';
  2. import { Input, Button, Form, Icon, Spin, message, Cascader } from 'antd';
  3. import { areaSelect } from '../NewDicProvinceList';
  4. import './certify.less';
  5. import ajax from 'jquery/src/ajax/xhr.js'
  6. import $ from 'jquery/src/ajax';
  7. const Content = Form.create()(React.createClass({
  8. getData() {
  9. this.setState({
  10. loading: true
  11. });
  12. $.ajax({
  13. method: "get",
  14. dataType: "json",
  15. url: globalConfig.context + "/api/user/orgProcess",
  16. success: function (data) {
  17. if (data.data) {
  18. this.setState({
  19. firstContacts: data.data.firstContacts,
  20. firstMobile: data.data.firstMobile,
  21. bankAccount: data.data.bankAccount,
  22. address: [data.data.locationProvince, data.data.locationCity, data.data.locationArea],
  23. banks: data.data.banks,
  24. bankBranch: data.data.bankBranch,
  25. bankCardNumber: data.data.bankCardNumber,
  26. });
  27. };
  28. }.bind(this),
  29. }).done(function (data) {
  30. if (data.error.length) {
  31. message.warning(data.error[0].message);
  32. }
  33. }.bind(this)).always(function () {
  34. this.setState({
  35. loading: false
  36. });
  37. }.bind(this));
  38. },
  39. getInitialState() {
  40. return {
  41. loading: false
  42. };
  43. },
  44. handleSubmit(e) {
  45. e.preventDefault();
  46. this.props.form.validateFields((err, values) => {
  47. if (!err) {
  48. this.setState({
  49. loading: true
  50. });
  51. $.ajax({
  52. method: "POST",
  53. dataType: "json",
  54. crossDomain: false,
  55. url: globalConfig.context + "/api/user/orgNextPro",
  56. data: {
  57. bankAccount: values.bankAccount,
  58. banks: values.banks,
  59. bankBranch: values.bankBranch,
  60. bankCardNumber: values.bankCardNumber,
  61. locationProvince: values.address[0],
  62. locationCity: values.address[1],
  63. locationArea: values.address[2],
  64. process: 2
  65. }
  66. }).done(function (data) {
  67. if (!data.error.length) {
  68. message.success('保存成功!');
  69. this.props.changeStep(3);
  70. } else {
  71. message.warning(data.error[0].message);
  72. this.setState({
  73. loading: false
  74. });
  75. }
  76. }.bind(this));
  77. }
  78. });
  79. },
  80. checkBankCardNum(rule, value, callback) {
  81. if (!/(^\d{15,}$)/.test(value)) {
  82. callback('请输入正确的银行卡号!');
  83. } else {
  84. callback();
  85. }
  86. },
  87. componentWillMount() {
  88. this.getData();
  89. },
  90. changeStep() {
  91. this.props.changeStep(1);
  92. },
  93. render() {
  94. const FormItem = Form.Item;
  95. const { getFieldDecorator } = this.props.form;
  96. const formItemLayout = {
  97. labelCol: { span: 6 },
  98. wrapperCol: { span: 12 },
  99. };
  100. const _me = this;
  101. return (
  102. <Spin spinning={this.state.loading} className="certify-spin">
  103. <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
  104. <FormItem wrapperCol={{ span: 20, offset: 6 }}>
  105. <p className="certify-title">请填写您的银行卡信息,该银行卡仅用于认证您的身份。</p>
  106. </FormItem>
  107. <FormItem
  108. {...formItemLayout}
  109. label="银行开户名"
  110. extra={<span><Icon type="exclamation-circle" /> 必须使用以该名称为开户名的银行卡进行认证</span>}
  111. >
  112. {getFieldDecorator('bankAccount', {
  113. initialValue: this.state.bankAccount || null,
  114. rules: [{ required: true, message: '请输入开户银行开户名!' }]
  115. })(
  116. <Input placeholder="请输入开户银行开户名" />
  117. )}
  118. </FormItem>
  119. <FormItem
  120. {...formItemLayout}
  121. label="开户银行"
  122. extra={<span><Icon type="exclamation-circle" /> 不支持信用卡和存折进行认证</span>}
  123. >
  124. {getFieldDecorator('banks', {
  125. initialValue: this.state.banks || null,
  126. rules: [{ required: true, message: '请输入开户银行名称!' }]
  127. })(
  128. <Input placeholder="请输入开户银行名称" />
  129. )}
  130. </FormItem>
  131. <FormItem
  132. {...formItemLayout}
  133. label="开户银行所在地"
  134. >
  135. {getFieldDecorator('address', {
  136. initialValue: this.state.address || null,
  137. rules: [{ type: 'array', required: true, message: '请选择地址!' }]
  138. })(
  139. <Cascader options={areaSelect()} placeholder="请选择地址" />
  140. )}
  141. </FormItem>
  142. <FormItem
  143. {...formItemLayout}
  144. label="银行开户支行名称"
  145. >
  146. {getFieldDecorator('bankBranch', {
  147. initialValue: this.state.bankBranch || null,
  148. rules: [{ required: true, message: '请输入银行开户支行名称!' }]
  149. })(
  150. <Input placeholder="请输入银行开户支行名称" />
  151. )}
  152. </FormItem>
  153. <FormItem
  154. {...formItemLayout}
  155. label="银行卡号" >
  156. {getFieldDecorator('bankCardNumber', {
  157. initialValue: this.state.bankCardNumber || null,
  158. rules: [{
  159. validator: this.checkIdcardnum,
  160. }],
  161. })(
  162. <Input placeholder="请输入银行卡号" />
  163. )}
  164. </FormItem>
  165. <FormItem
  166. {...formItemLayout}
  167. label="联系方式"
  168. extra={
  169. <span style={{ 'color': '#ea0862' }}>
  170. <Icon type="exclamation-circle" />
  171. 我们会将重要进度以短信形式通知您
  172. </span>}
  173. >
  174. {getFieldDecorator('contactMobile')(
  175. <span>{(this.state.firstContacts || '') + ' ' + (this.state.firstMobile || '')}</span>
  176. )}
  177. </FormItem>
  178. <FormItem wrapperCol={{ span: 12, offset: 6 }}>
  179. <Button className="set-submit" type="primary" htmlType="submit">下一步</Button>
  180. <Button className="exit" type="ghost" onClick={_me.changeStep}>返回修改</Button>
  181. </FormItem>
  182. </Form >
  183. </Spin >
  184. );
  185. },
  186. }));
  187. export default Content;