paymentRecord.jsx 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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. {
  79. text === 0 ? '审核中' :
  80. text === 1 ? '审核通过' :
  81. text === 2 ? '已驳回' :
  82. text === 3 ? '支付完成' :
  83. text === 4 ? '已取消' : ''
  84. }
  85. </div>
  86. <Button type="primary" size='small' onClick={() => {
  87. this.setState({
  88. payRecordVisible: true,
  89. orderPaymentsId: record.id,
  90. })
  91. }}>
  92. {this.operationJudgmentName(text)}
  93. </Button>
  94. </div>
  95. },
  96. },
  97. ],//支付记录
  98. selectOrderPayments:[]
  99. }
  100. this.operationJudgmentName = this.operationJudgmentName.bind(this);
  101. this.getSelectOrderPayment = this.getSelectOrderPayment.bind(this);
  102. }
  103. componentDidMount() {
  104. if(this.props.tid){
  105. this.getSelectOrderPayment();
  106. }
  107. }
  108. //0审核 1待支付 2驳回 3已支付 4取消
  109. operationJudgmentName(id) {
  110. if(this.props.isAuditPayment){ //财务
  111. return id === 0 ? '待审核' :
  112. id === 1 ? '待支付' :
  113. id === 2 ? '查看详情' : '查看详情'
  114. }else{
  115. return id === 0 ? '待审核' :
  116. id === 1 ? '待支付' :
  117. id === 2 ? '查看详情' : '查看详情'
  118. }
  119. }
  120. //支付列表
  121. getSelectOrderPayment() {
  122. this.setState({
  123. payRecordsLoading: true
  124. })
  125. $.ajax({
  126. method: 'get',
  127. dataType: 'json',
  128. crossDomain: false,
  129. url: globalConfig.context + '/api/admin/company/selectOrderPayment',
  130. data: {
  131. id: this.props.tid,
  132. },
  133. success: function (data) {
  134. if (data.error.length) {
  135. if (data.error && data.error.length) {
  136. message.warning(data.error[0].message);
  137. }
  138. } else {
  139. this.setState({
  140. selectOrderPayments: data.data
  141. })
  142. }
  143. }.bind(this),
  144. }).always(
  145. function () {
  146. this.setState({
  147. payRecordsLoading: false
  148. })
  149. }.bind(this)
  150. )
  151. }
  152. //刷新
  153. refresh(){
  154. if(this.props.tid){
  155. this.getSelectOrderPayment();
  156. }
  157. }
  158. render() {
  159. return (
  160. this.state.selectOrderPayments.length > 0 ? <div>
  161. <div className="title">支付记录</div>
  162. <Spin spinning={this.state.payRecordsLoading}>
  163. <Form layout="horizontal">
  164. <Table
  165. pagination={false}
  166. columns={this.state.orderPaymentseColunms}
  167. dataSource={this.state.selectOrderPayments}
  168. style={{
  169. cursor: 'pointer',
  170. }}
  171. onRowClick={(record) => {
  172. this.setState({
  173. payRecordVisible: true,
  174. orderPaymentsId: record.id,
  175. })
  176. }}
  177. scroll={{x: 'max-content', y: 0}}
  178. bordered
  179. size="middle"
  180. />
  181. <Col span={24} offset={9} style={{marginTop: '15px'}}/>
  182. </Form>
  183. </Spin>
  184. {/* 支付记录操作弹出 */}
  185. {this.state.payRecordVisible ? <PayRecord
  186. {...this.props}
  187. tid={this.props.tid}
  188. projectType={this.props.projectType}
  189. patentType={this.props.patentType}
  190. payId={this.state.orderPaymentsId}
  191. visible={this.state.payRecordVisible}
  192. isAuditPayment={this.props.isAuditPayment}
  193. isAuditPaymentGLY={this.props.isAuditPaymentGLY}
  194. onRefresh={()=>{
  195. this.props.onRefresh();
  196. this.refresh();
  197. }}
  198. changeVisible={()=>{
  199. this.refresh();
  200. this.props.onRefresh && this.props.onRefresh();
  201. this.setState({
  202. payRecordVisible: false,
  203. })
  204. }}
  205. /> : <div/>}
  206. </div> : null
  207. )
  208. }
  209. }
  210. export default PaymentRecord;