import React,{Component} from 'react'; import {Button, Form, Input, message, Modal, Spin} from "antd"; import $ from "jquery/src/ajax"; const layout = { labelCol: { span: 8, }, wrapperCol: { span: 16, }, }; const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; class PayRecord extends Component{ constructor(props) { super(props); this.state={ loading: false, paymentLogs: [], paymentDetails: {}, financialPaymentList: [], } this.examineOperation = this.examineOperation.bind(this); this.noExamineOperation = this.noExamineOperation.bind(this); } componentDidMount() { this.getSelectPaymentLog(); //付款日志 this.getPaymentDetails(); //支付详情 this.getSelectfinancialPayment(); //财务付款列表 } //付款日志 getSelectPaymentLog(){ this.setState({ loading: true }); $.ajax({ type: 'get', cache: false, url: globalConfig.context + "/api/admin/company/selectPaymentLog", dataType: "json", data: { id: this.props.payId }, success: function (data) { this.setState({ loading: false }); if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { this.setState({ paymentLogs: data.data }) }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } //支付详情 getPaymentDetails(){ this.setState({ loading: true }); $.ajax({ type: 'get', cache: false, url: globalConfig.context + "/api/admin/company/OrderPaymentDetails", dataType: "json", data: { id: this.props.payId }, success: function (data) { this.setState({ loading: false }); if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { this.setState({ paymentDetails: data.data }) }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } //财务付款列表 getSelectfinancialPayment(){ this.setState({ loading: true }); $.ajax({ type: 'get', cache: false, url: globalConfig.context + "/api/admin/company/selectfinancialPayment", dataType: "json", data: { id: this.props.payId }, success: function (data) { this.setState({ loading: false }); if (!data.data) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { this.setState({ financialPaymentList: data.data }) }; }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } handleSubmit(e,status = 0){ e.preventDefault(); this.props.form.validateFieldsAndScroll((err, values) => { if (err) { return; } const { paymentDetails } = this.state; this.setState({ loading: true }) let data = { id: this.props.payId, paymentAmount: paymentDetails.paymentAmount, paymentStatus: paymentDetails.paymentStatus, status: status,//0 发起 1通过 2驳回(0重新发起,1通过审核,2驳回) } Object.assign(data,values) $.ajax({ type: 'post', url: globalConfig.context + "/api/admin/company/updateOrderPayment", dataType: "json", data: data, }).done((res) => { if (res.error && res.error.length) { message.error(res.error[0].message); } else { message.success("重新申请成功"); } }).always(() => { this.setState({ loading: false }) }); }) } //新增财务付款 addfinancialPayment(e) { e.preventDefault(); this.props.form.validateFieldsAndScroll((err, values) => { if (err) { return; } const { paymentDetails } = this.state; this.setState({ loading: true }) let data = { pid: this.props.payId, partyAmount: values.partyAmount, paymentTimes: values.paymentTimes } $.ajax({ type: 'post', url: globalConfig.context + "/api/admin/company/addfinancialPayment", dataType: "json", data: data, }).done((res) => { if (res.error && res.error.length) { message.error(res.error[0].message); } else { message.success("新增成功"); } }).always(() => { this.setState({ loading: false }) }); }) } //0审核 1驳回 2待支付 3已支付 4取消 noExamineOperation(){ return ( this.state.paymentDetails.status === 1 ?