paymentDesc.jsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Button } from 'antd';
  3. import './comprehensive.less';
  4. import ajax from 'jquery/src/ajax/xhr.js';
  5. import $ from 'jquery/src/ajax';
  6. const PatentDesc = React.createClass({
  7. getInitialState() {
  8. return {
  9. visible: false,
  10. loading: false,
  11. };
  12. },
  13. showModal() {
  14. this.setState({
  15. visible: true,
  16. });
  17. },
  18. handleOk() {
  19. this.setState({
  20. loading: true
  21. });
  22. $.ajax({
  23. method: "post",
  24. dataType: "json",
  25. crossDomain: false,
  26. url: globalConfig.context + "/api/admin/patent/confirmPayment",
  27. data: {
  28. cid: this.props.data.cid,
  29. uid: this.props.data.uid
  30. },
  31. success: function (data) {
  32. if (data.error && data.error.length) {
  33. message.warning(data.error[0].message);
  34. return;
  35. } else {
  36. message.success('保存成功!');
  37. this.props.closeDesc(false, true);
  38. };
  39. }.bind(this),
  40. }).always(function () {
  41. this.setState({
  42. loading: false,
  43. visible: false,
  44. });
  45. }.bind(this));
  46. },
  47. handleCancel(e) {
  48. this.setState({
  49. visible: false,
  50. });
  51. this.props.closeDesc(false);
  52. },
  53. componentWillReceiveProps(nextProps) {
  54. this.state.visible = nextProps.showDesc
  55. },
  56. render() {
  57. if (this.props.data) {
  58. return (
  59. <div className="payment-desc">
  60. <Spin spinning={this.state.loading} className='spin-box'>
  61. <Modal maskClosable={false} title="缴费确认" visible={this.state.visible}
  62. onOk={this.handleOk} onCancel={this.handleCancel}
  63. width='500px'
  64. footer={[
  65. <Button key="submit" type="primary" size="large" onClick={this.handleOk}>确认缴费</Button>,
  66. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  67. ]}
  68. className="patent-desc-content">
  69. <p style={{ fontSize: '16px' }}>
  70. <span>确认已经缴纳 </span> {this.props.data.unitName}
  71. <span> 公司专利 </span> {this.props.data.patentName}
  72. <span> 的年登印费用?</span>
  73. </p>
  74. </Modal>
  75. </Spin>
  76. </div>
  77. );
  78. } else {
  79. return <div></div>
  80. }
  81. },
  82. });
  83. export default PatentDesc;