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 ? :
) } examineOperation() { const { getFieldDecorator } = this.props.form; return ( this.state.paymentDetails.status === 0 ? {getFieldDecorator('remarks', { rules: [{ required: true, message: '请输入备注!' }], })( )} : this.state.paymentDetails.status === 2 ?
{getFieldDecorator('remarks', { rules: [{ required: true, message: '请输入付款时间!' }], })( )} {getFieldDecorator('remarks', { rules: [{ required: true, message: '请输入付款金额!' }], })( )}
:
) } render() { const { getFieldDecorator } = this.props.form; const { paymentLogs,paymentDetails,financialPaymentList } = this.state; return( { this.props.changeVisible(); }} >
申请支付外包费用
{ this.handleSubmit(e) }} >
{paymentDetails.companyName}
{paymentDetails.nodeUnitPrice}
{getFieldDecorator('quantity', { initialValue: parseInt(paymentDetails.quantity), rules: [{ required: false, message: '请输入數量!' }], })( 1} style={{ width: '200px' }} placeholder="请输入數量" type={'number'}/> )}
{paymentDetails.nodeTotalAmount}
{paymentDetails.nodePartyAmount}
{getFieldDecorator('applicationAmount', { initialValue: paymentDetails.applicationAmount, rules: [{ required: true, message: '请输入本次申请支付金额!' }], })( 1} style={{ width: '200px' }} placeholder="请输入本次申请支付金额" type={'number'}/> )}
{paymentDetails.remarks}
支付状态
{ paymentLogs.map((value,key)=>(
{value.aname+':'} { value.status === 0 ? '(发起)'+value.remarks : value.status === 1 ? '(通过)'+value.remarks : '(驳回)'+value.remarks } { value.createTimes }
)) }
{paymentDetails.status === 2 || paymentDetails.status === 3 || paymentDetails.status === 4 ?
上传付费凭证-财务 实际付款(万元): {paymentDetails.paymentAmount}
{ financialPaymentList.map((value,key)=>(
付款时间: {value.paymentTimes} 付款金额(万元): {value.partyAmount}
)) }
:
} { this.props.isAuditPayment ? this.examineOperation() : this.noExamineOperation() }
) } } const WrappedNormalLoginForm = Form.create()(PayRecord); export default WrappedNormalLoginForm