123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- import React, { Component } from "react";
- import { Button, Col, Form, message, Spin, Table } from "antd";
- import $ from "jquery";
- import PayRecord from "../../manageCenter/components/checkProject/payRecord";
- class PaymentRecord extends Component {
- constructor(props) {
- super(props);
- this.state = {
- orderPaymentseColunms: [
- {
- title: '编号',
- dataIndex: 'id',
- key: 'id',
- },
- {
- title: '节点编号',
- dataIndex: 'nodeId',
- key: 'nodeId',
- },
- {
- title: '供应商名称',
- dataIndex: 'companyName',
- key: 'companyName',
- render: (text, record) => {
- return <span>
- {
- record.status === 4 ? text : (
- record.chooseType === 2 ? text : (text + '-' + record.tpcId) +
- (text !== record.tpcName && record.tpcName ? '(' + record.tpcName + ')' : '')
- )
- }
- </span>
- },
- },
- {
- title: '支付类型',
- dataIndex: 'chooseType',
- key: 'chooseType',
- render: (text) => {
- return <span>
- {/*0第三方 1催款 2官费*/}
- {text === 0 ? '第三方' : text === 1 ? '催款' : '官费'}
- </span>
- },
- },
- {
- title: '申请支付金额(万元)',
- dataIndex: 'applicationAmount',
- key: 'applicationAmount',
- render: (text, record) => {
- return <span>
- {isNaN(parseFloat(text)) ? text : parseFloat(text)}
- </span>
- },
- },
- {
- title: '申请支付数量',
- dataIndex: 'quantity',
- key: 'quantity',
- },
- {
- title: '申请时间',
- dataIndex: 'createTimes',
- key: 'createTimes',
- },
- {
- title: '状态',
- dataIndex: 'status',
- key: 'status',
- render: (text, record) => {
- return <div style={{
- display: 'flex',
- justifyContent: 'center',
- }}>
- <div style={{
- paddingRight: '15px',
- }}>
- {(!!record.financeName && text === 0) ? record.financeName : ""}
- {
- text === 0 ? '审核中' :
- text === 1 ? '审核通过' :
- text === 2 ? '已驳回' :
- text === 3 ? '支付完成' :
- text === 4 ? '已取消' : ''
- }
- </div>
- <Button type="primary" size='small' onClick={() => {
- this.setState({
- payRecordVisible: true,
- orderPaymentsId: record.id,
- })
- }}>
- {this.operationJudgmentName(text)}
- </Button>
- </div>
- },
- },
- ],//支付记录
- selectOrderPayments: []
- }
- this.operationJudgmentName = this.operationJudgmentName.bind(this);
- this.getSelectOrderPayment = this.getSelectOrderPayment.bind(this);
- }
- componentDidMount() {
- if (this.props.tid) {
- this.getSelectOrderPayment();
- }
- }
- //0审核 1待支付 2驳回 3已支付 4取消
- operationJudgmentName(id) {
- if (this.props.isAuditPayment) { //财务
- return id === 0 ? '待审核' :
- id === 1 ? '待支付' :
- id === 2 ? '查看详情' : '查看详情'
- } else {
- return id === 0 ? '待审核' :
- id === 1 ? '待支付' :
- id === 2 ? '查看详情' : '查看详情'
- }
- }
- //支付列表
- getSelectOrderPayment() {
- this.setState({
- payRecordsLoading: true
- })
- $.ajax({
- method: 'get',
- dataType: 'json',
- crossDomain: false,
- url: globalConfig.context + '/api/admin/company/selectOrderPayment',
- data: {
- id: this.props.tid,
- },
- success: function (data) {
- if (data.error.length) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- }
- } else {
- this.setState({
- selectOrderPayments: data.data
- })
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- payRecordsLoading: false
- })
- }.bind(this)
- )
- }
- //刷新
- refresh() {
- if (this.props.tid) {
- this.getSelectOrderPayment();
- }
- }
- render() {
- return (
- this.state.selectOrderPayments.length > 0 ? <div>
- <div className="title">支付记录</div>
- <Spin spinning={this.state.payRecordsLoading}>
- <Form layout="horizontal">
- <Table
- pagination={false}
- columns={this.state.orderPaymentseColunms}
- dataSource={this.state.selectOrderPayments}
- style={{
- cursor: 'pointer',
- }}
- onRowClick={(record) => {
- this.setState({
- payRecordVisible: true,
- orderPaymentsId: record.id,
- })
- }}
- scroll={{ x: 'max-content', y: 0 }}
- bordered
- size="middle"
- />
- <Col span={24} offset={9} style={{ marginTop: '15px' }} />
- </Form>
- </Spin>
- {/* 支付记录操作弹出 */}
- {this.state.payRecordVisible ? <PayRecord
- {...this.props}
- tid={this.props.tid}
- projectType={this.props.projectType}
- patentType={this.props.patentType}
- payId={this.state.orderPaymentsId}
- visible={this.state.payRecordVisible}
- isAuditPayment={this.props.isAuditPayment}
- isAuditPaymentGLY={this.props.isAuditPaymentGLY}
- onRefresh={() => {
- this.props.onRefresh();
- this.refresh();
- }}
- changeVisible={() => {
- this.refresh();
- this.props.onRefresh && this.props.onRefresh();
- this.setState({
- payRecordVisible: false,
- })
- }}
- /> : <div />}
- </div> : null
- )
- }
- }
- export default PaymentRecord;
|