applyFeeDesc.jsx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import React from 'react';
  2. import { Icon, Modal, message, Spin, Button, Input, Radio } 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/registerApplicationFee",
  27. data: {
  28. cid: this.props.data.cid,
  29. applicationFee: this.state.applicationFee,
  30. trialFee: this.state.applicationFee,
  31. printingFee: this.state.printingFee,
  32. funds: this.state.funds,
  33. reimbursement: this.state.reimbursement,
  34. paymentState:this.state.paymentState
  35. },
  36. success: function (data) {
  37. if (data.error.length) {
  38. message.warning(data.error[0].message);
  39. return;
  40. } else {
  41. message.success('保存成功!');
  42. };
  43. }.bind(this),
  44. }).always(function () {
  45. this.setState({
  46. loading: false,
  47. visible: false,
  48. });
  49. }.bind(this));
  50. this.props.closeDesc(false,true);
  51. },
  52. handleConfirm() {
  53. this.state.paymentState = 1;
  54. this.handleOk();
  55. },
  56. handleCancel(e) {
  57. this.setState({
  58. visible: false,
  59. });
  60. this.props.closeDesc(false);
  61. },
  62. componentWillReceiveProps(nextProps) {
  63. this.state.visible = nextProps.showDesc;
  64. if (nextProps.data) {
  65. this.state.applicationFee = nextProps.data.applicationFee;
  66. this.state.trialFee = nextProps.data.trialFee;
  67. this.state.printingFee = nextProps.data.printingFee;
  68. this.state.funds = nextProps.data.funds;
  69. this.state.reimbursement = nextProps.data.reimbursement;
  70. this.state.paymentState = nextProps.data.paymentState;
  71. };
  72. },
  73. render() {
  74. if (this.props.data) {
  75. return (
  76. <div className="applyFee-desc">
  77. <Spin spinning={this.state.loading} className='spin-box'>
  78. <Modal title="登记申请费用" visible={this.state.visible}
  79. onOk={this.handleOk} onCancel={this.handleCancel}
  80. width='360px'
  81. footer={[
  82. <Button key="submit" type="primary" size="large" onClick={this.handleOk}>保存</Button>,
  83. <Button key="confirm" type="ghost" size="large"
  84. style={this.props.data.paymentState == 1 ? {display:'none'} : {}}
  85. onClick={this.handleConfirm}>确认缴费</Button>,
  86. <Button key="back" type="ghost" size="large" onClick={this.handleCancel}>取消</Button>,
  87. ]}
  88. className="applyFee-desc-content">
  89. <p className="applyFee-title">
  90. <span>专利号 : {this.props.data.patentNumber}</span>
  91. <span>专利名 : {this.props.data.patentName}</span>
  92. </p>
  93. <p className="applyFee-fee">
  94. <span>申请费:</span>
  95. <Input value={this.state.applicationFee} onChange={(e) => { this.setState({ applicationFee: e.target.value }); }} />
  96. </p>
  97. <p className="applyFee-fee">
  98. <span>实审费:</span>
  99. <Input value={this.state.trialFee} onChange={(e) => { this.setState({ trialFee: e.target.value }); }} />
  100. </p>
  101. <p className="applyFee-fee">
  102. <span>文印费:</span>
  103. <Input value={this.state.printingFee} onChange={(e) => { this.setState({ printingFee: e.target.value }); }} />
  104. </p>
  105. <div className="applyFee-fee">
  106. <span>是否申请:</span>
  107. <Radio.Group value={this.state.funds} onChange={(e) => { this.setState({ funds: e.target.value }) }}>
  108. <Radio value="1">是</Radio>
  109. <Radio value="0">否</Radio>
  110. </Radio.Group>
  111. </div>
  112. <div className="applyFee-fee">
  113. <span>是否报销:</span>
  114. <Radio.Group value={this.state.reimbursement} onChange={(e) => { this.setState({ reimbursement: e.target.value }) }}>
  115. <Radio value="1">是</Radio>
  116. <Radio value="0">否</Radio>
  117. </Radio.Group>
  118. </div>
  119. </Modal>
  120. </Spin>
  121. </div>
  122. );
  123. } else {
  124. return <div></div>
  125. }
  126. },
  127. });
  128. export default PatentDesc;