fundmanagement.jsx 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. import React, { Component } from "react";
  2. import { Tabs, Button, Card, Col, Row, Modal, } from "antd";
  3. import $ from "jquery/src/ajax";
  4. import ShowModalDiv from "@/showModal.jsx";
  5. import { ShowModal } from "@/tools";
  6. import "./index.less"
  7. import LaunchInvest from "../component/launchinvest"; // 发起投资
  8. import InvestmentList from "../component/investmentlist"; // 投资明细
  9. import Payment from "../component/payment"; // 发起付款
  10. const TabPane = Tabs.TabPane;
  11. // 资金管理
  12. class FundManagement extends Component {
  13. constructor(props) {
  14. super(props);
  15. this.state = {
  16. visible: "",
  17. navList: [],
  18. details: {},
  19. type: 0,
  20. };
  21. this.onCancel = this.onCancel.bind(this);
  22. }
  23. componentWillMount() {
  24. this.getData()
  25. }
  26. onCancel(e) {
  27. if (e) {
  28. this.getData()
  29. }
  30. this.setState({
  31. visible: "",
  32. })
  33. }
  34. getData() {
  35. const { type } = this.state
  36. $.ajax({
  37. method: "get",
  38. dataType: "json",
  39. crossDomain: false,
  40. url: globalConfig.context + "/api/admin/amb/getMyambDtails",
  41. data: {},
  42. success: function (data) {
  43. ShowModal(this);
  44. if (!data.data) {
  45. if (data.error && data.error.length) {
  46. message.warning(data.error[0].message);
  47. }
  48. } else {
  49. this.setState({
  50. navList: data.data,
  51. details: data.data[type] || {},
  52. });
  53. }
  54. }.bind(this),
  55. }).always(
  56. function () {
  57. }.bind(this)
  58. );
  59. }
  60. render() {
  61. const { visible, navList, details } = this.state
  62. const gridStyle1 = {
  63. height: '80px',
  64. background: 'green',
  65. fontSize: '20px',
  66. fontWeight: 'bold',
  67. color: '#fff',
  68. display: 'flex',
  69. flexDirection: 'column',
  70. alignItems: 'center',
  71. justifyContent: 'center',
  72. textAlign: 'center',
  73. };
  74. const gridStyle2 = {
  75. height: '80px',
  76. background: 'green',
  77. fontSize: '20px',
  78. color: '#fff',
  79. display: 'flex',
  80. flexDirection: 'column',
  81. alignItems: 'center',
  82. justifyContent: 'center',
  83. textAlign: 'center',
  84. };
  85. const gridStyle3 = {
  86. height: '170px',
  87. background: 'rgba(255,102,0,1)',
  88. fontSize: '20px',
  89. color: '#fff',
  90. display: 'flex',
  91. flexDirection: 'column',
  92. alignItems: 'center',
  93. justifyContent: 'center',
  94. textAlign: 'center',
  95. };
  96. const buttonstyle = {
  97. fontSize: '18px',
  98. display: 'block',
  99. margin: ' 0 auto',
  100. }
  101. return (
  102. <div className="user-content">
  103. <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
  104. <div className="card-container">
  105. <Tabs type="card"
  106. onChange={(e) => {
  107. this.setState({
  108. type: e,
  109. details: navList[e]
  110. }, () => {
  111. this.getData()
  112. })
  113. }}>
  114. {
  115. navList.map((item, index) =>
  116. <TabPane tab={item.name} key={index}>
  117. </TabPane>
  118. )
  119. }
  120. </Tabs>
  121. </div>
  122. <Row gutter={8}>
  123. <Col span={3}>
  124. <Card style={gridStyle1}>核算单位</Card>
  125. <div style={{ height: 10 }}></div>
  126. <Card style={gridStyle2}>{details.name}</Card>
  127. </Col>
  128. <Col span={6}>
  129. <Card style={gridStyle2}>实收投资款(万元)<br />{details.received}</Card>
  130. <div style={{ height: 10 }}></div>
  131. <Row gutter={8}>
  132. <Col span={12}>
  133. <Card style={gridStyle2}>对外投资款(万元)<br />{details.foreign}</Card>
  134. </Col>
  135. <Col span={12}>
  136. <Card style={gridStyle2}>剩余投资款(万元)<br />{details.surplus}</Card>
  137. </Col>
  138. </Row>
  139. </Col>
  140. <Col span={6}>
  141. <Card bordered={false} style={gridStyle3}>当前资金池(万元)<br />{details.totalAmount}</Card>
  142. </Col>
  143. </Row>
  144. <div style={{ marginTop: 20 }}>
  145. <Row gutter={8}>
  146. <Col span={3} offset={3}>
  147. <Button
  148. type="primary"
  149. size="large"
  150. style={buttonstyle}
  151. onClick={() => { this.setState({ visible: "investdetails" }) }}
  152. >投资明细</Button>
  153. </Col>
  154. <Col span={3}>
  155. <Button
  156. type="primary"
  157. size="large"
  158. style={buttonstyle}
  159. onClick={() => { this.setState({ visible: "invest" }) }}
  160. >发起投资</Button>
  161. </Col>
  162. <Col span={3}>
  163. <Button
  164. type="primary"
  165. size="large"
  166. style={buttonstyle}
  167. >收支明细</Button>
  168. </Col>
  169. <Col span={3}>
  170. <Button
  171. type="primary"
  172. size="large"
  173. style={buttonstyle}
  174. onClick={() => { this.setState({ visible: "pay" }) }}
  175. >发起付款</Button>
  176. </Col>
  177. </Row>
  178. </div>
  179. {
  180. // 发起投资
  181. visible == "invest" &&
  182. <LaunchInvest
  183. myAmbId={details.id}
  184. visible={visible}
  185. onCancel={this.onCancel}
  186. />
  187. }
  188. {
  189. // 投资明细
  190. visible == "investdetails" &&
  191. <Modal
  192. maskClosable={false}
  193. visible={visible == "investdetails"}
  194. title="投资明细"
  195. footer=""
  196. width="70%"
  197. onCancel={() => { this.onCancel(false) }}
  198. >
  199. <InvestmentList
  200. myAmbId={details.id}
  201. />
  202. </Modal>
  203. }
  204. {
  205. // 发起付款
  206. visible == "pay" &&
  207. <Payment
  208. myAmbId={details.id}
  209. visible={visible}
  210. onCancel={this.onCancel}
  211. />
  212. }
  213. </div>
  214. );
  215. }
  216. }
  217. export default FundManagement;