paymentRecord.jsx 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. import React, { Component } from "react";
  2. import { Button, Col, Form, message, Spin, Table } from "antd";
  3. import $ from "jquery";
  4. import PayRecord from "../../manageCenter/components/checkProject/payRecord";
  5. class PaymentRecord extends Component {
  6. constructor(props) {
  7. super(props);
  8. this.state = {
  9. orderPaymentseColunms: [
  10. {
  11. title: '编号',
  12. dataIndex: 'id',
  13. key: 'id',
  14. },
  15. {
  16. title: '节点编号',
  17. dataIndex: 'nodeId',
  18. key: 'nodeId',
  19. },
  20. {
  21. title: '供应商名称',
  22. dataIndex: 'companyName',
  23. key: 'companyName',
  24. render: (text, record) => {
  25. return <span>
  26. {
  27. record.status === 4 ? text : (
  28. record.chooseType === 2 ? text : (text + '-' + record.tpcId) +
  29. (text !== record.tpcName && record.tpcName ? '(' + record.tpcName + ')' : '')
  30. )
  31. }
  32. </span>
  33. },
  34. },
  35. {
  36. title: '支付类型',
  37. dataIndex: 'chooseType',
  38. key: 'chooseType',
  39. render: (text) => {
  40. return <span>
  41. {/*0第三方 1催款 2官费*/}
  42. {text === 0 ? '第三方' : text === 1 ? '催款' : '官费'}
  43. </span>
  44. },
  45. },
  46. {
  47. title: '申请支付金额(万元)',
  48. dataIndex: 'applicationAmount',
  49. key: 'applicationAmount',
  50. render: (text, record) => {
  51. return <span>
  52. {isNaN(parseFloat(text)) ? text : parseFloat(text)}
  53. </span>
  54. },
  55. },
  56. {
  57. title: '申请支付数量',
  58. dataIndex: 'quantity',
  59. key: 'quantity',
  60. },
  61. {
  62. title: '申请时间',
  63. dataIndex: 'createTimes',
  64. key: 'createTimes',
  65. },
  66. {
  67. title: '状态',
  68. dataIndex: 'status',
  69. key: 'status',
  70. render: (text, record) => {
  71. return <div style={{
  72. display: 'flex',
  73. justifyContent: 'center',
  74. }}>
  75. <div style={{
  76. paddingRight: '15px',
  77. }}>
  78. {(!!record.financeName && text === 0) ? record.financeName : ""}
  79. {
  80. text === 0 ? '审核中' :
  81. text === 1 ? '审核通过' :
  82. text === 2 ? '已驳回' :
  83. text === 3 ? '支付完成' :
  84. text === 4 ? '已取消' : ''
  85. }
  86. </div>
  87. <Button type="primary" size='small' onClick={() => {
  88. this.setState({
  89. payRecordVisible: true,
  90. orderPaymentsId: record.id,
  91. })
  92. }}>
  93. {this.operationJudgmentName(text)}
  94. </Button>
  95. </div>
  96. },
  97. },
  98. ],//支付记录
  99. selectOrderPayments: []
  100. }
  101. this.operationJudgmentName = this.operationJudgmentName.bind(this);
  102. this.getSelectOrderPayment = this.getSelectOrderPayment.bind(this);
  103. }
  104. componentDidMount() {
  105. if (this.props.tid) {
  106. this.getSelectOrderPayment();
  107. }
  108. }
  109. //0审核 1待支付 2驳回 3已支付 4取消
  110. operationJudgmentName(id) {
  111. if (this.props.isAuditPayment) { //财务
  112. return id === 0 ? '待审核' :
  113. id === 1 ? '待支付' :
  114. id === 2 ? '查看详情' : '查看详情'
  115. } else {
  116. return id === 0 ? '待审核' :
  117. id === 1 ? '待支付' :
  118. id === 2 ? '查看详情' : '查看详情'
  119. }
  120. }
  121. //支付列表
  122. getSelectOrderPayment() {
  123. this.setState({
  124. payRecordsLoading: true
  125. })
  126. $.ajax({
  127. method: 'get',
  128. dataType: 'json',
  129. crossDomain: false,
  130. url: globalConfig.context + '/api/admin/company/selectOrderPayment',
  131. data: {
  132. id: this.props.tid,
  133. },
  134. success: function (data) {
  135. if (data.error.length) {
  136. if (data.error && data.error.length) {
  137. message.warning(data.error[0].message);
  138. }
  139. } else {
  140. this.setState({
  141. selectOrderPayments: data.data
  142. })
  143. }
  144. }.bind(this),
  145. }).always(
  146. function () {
  147. this.setState({
  148. payRecordsLoading: false
  149. })
  150. }.bind(this)
  151. )
  152. }
  153. //刷新
  154. refresh() {
  155. if (this.props.tid) {
  156. this.getSelectOrderPayment();
  157. }
  158. }
  159. render() {
  160. return (
  161. this.state.selectOrderPayments.length > 0 ? <div>
  162. <div className="title">支付记录</div>
  163. <Spin spinning={this.state.payRecordsLoading}>
  164. <Form layout="horizontal">
  165. <Table
  166. pagination={false}
  167. columns={this.state.orderPaymentseColunms}
  168. dataSource={this.state.selectOrderPayments}
  169. style={{
  170. cursor: 'pointer',
  171. }}
  172. onRowClick={(record) => {
  173. this.setState({
  174. payRecordVisible: true,
  175. orderPaymentsId: record.id,
  176. })
  177. }}
  178. scroll={{ x: 'max-content', y: 0 }}
  179. bordered
  180. size="middle"
  181. />
  182. <Col span={24} offset={9} style={{ marginTop: '15px' }} />
  183. </Form>
  184. </Spin>
  185. {/* 支付记录操作弹出 */}
  186. {this.state.payRecordVisible ? <PayRecord
  187. {...this.props}
  188. tid={this.props.tid}
  189. projectType={this.props.projectType}
  190. patentType={this.props.patentType}
  191. payId={this.state.orderPaymentsId}
  192. visible={this.state.payRecordVisible}
  193. isAuditPayment={this.props.isAuditPayment}
  194. isAuditPaymentGLY={this.props.isAuditPaymentGLY}
  195. onRefresh={() => {
  196. this.props.onRefresh();
  197. this.refresh();
  198. }}
  199. changeVisible={() => {
  200. this.refresh();
  201. this.props.onRefresh && this.props.onRefresh();
  202. this.setState({
  203. payRecordVisible: false,
  204. })
  205. }}
  206. /> : <div />}
  207. </div> : null
  208. )
  209. }
  210. }
  211. export default PaymentRecord;