money.jsx 5.4 KB

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