money.jsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. bankAccount: bankAccount,
  19. bankCardNumber: bankCardNumber
  20. });
  21. } else {
  22. message.warning(data.error[0].message);
  23. };
  24. }.bind(this),
  25. }).always(function () {
  26. this.setState({
  27. loading: false
  28. });
  29. }.bind(this));
  30. },
  31. getInitialState() {
  32. return {
  33. loading: false
  34. };
  35. },
  36. handleSubmit(e) {
  37. e.preventDefault();
  38. this.props.form.validateFields((err, values) => {
  39. if (!err) {
  40. this.setState({
  41. loading: true
  42. });
  43. $.ajax({
  44. method: "POST",
  45. dataType: "json",
  46. crossDomain: false,
  47. url: globalConfig.context + "/api/user/userNextPro",
  48. data: {
  49. amountMoney:values.amountMoney,
  50. process:5
  51. }
  52. }).done(function (data) {
  53. if (!data.error.length) {
  54. message.success('保存成功!');
  55. this.props.change(6);
  56. } else {
  57. if ( data.amountError.length ) {
  58. message.warning(data.amountError[0].message);
  59. } else if ( data.error.length) {
  60. message.warning(data.error[0].message);
  61. };
  62. }
  63. }.bind(this)).always(function () {
  64. this.setState({
  65. loading: false
  66. });
  67. }.bind(this));
  68. }
  69. });
  70. },
  71. componentWillMount() {
  72. this.getData();
  73. },
  74. render() {
  75. const FormItem = Form.Item;
  76. const { getFieldDecorator } = this.props.form;
  77. const formItemLayout = {
  78. labelCol: { span: 4 },
  79. wrapperCol: { span: 12 },
  80. };
  81. const _me = this;
  82. return (
  83. <Spin spinning={this.state.loading} className="certify-spin">
  84. <Form horizontal onSubmit={this.handleSubmit} className="certify-form">
  85. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  86. <p className="certify-title">输入打款金额</p>
  87. </FormItem>
  88. <FormItem wrapperCol={{ span: 18, offset: 4 }}>
  89. <span>
  90. 请在下方输入银行卡{this.state.bankCardNumber}收到的认证打款,
  91. 务必在收到打款5日内完成,否则将无法完成
  92. </span>
  93. </FormItem>
  94. <FormItem
  95. {...formItemLayout}
  96. label="开户银行"
  97. >
  98. <span>{this.state.bankAccount}</span>
  99. </FormItem>
  100. <FormItem
  101. {...formItemLayout}
  102. label="银行卡号"
  103. >
  104. <span>{this.state.bankCardNumber}</span>
  105. </FormItem>
  106. <FormItem
  107. {...formItemLayout}
  108. label="打款金额"
  109. extra={<span style={{ 'color': '#ea0862' }}><Icon type="exclamation-circle" /> 仅有3次输入机会,如3次输入有误,需更换银行卡重新认证</span>}
  110. >
  111. {getFieldDecorator('amountMoney', {
  112. rules: [{ required: true, message: '请输入金额!' }]
  113. })(
  114. <Input />
  115. )}
  116. <span className="fromItem-postfix">元</span>
  117. </FormItem>
  118. <FormItem wrapperCol={{ span: 12, offset: 4 }}>
  119. <Button className="set-submit" type="primary" htmlType="submit">确认</Button>
  120. </FormItem>
  121. </Form >
  122. </Spin >
  123. );
  124. },
  125. }));
  126. export default Content;