money.jsx 5.4 KB

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