import React, { Component } from 'react'
import {
Form,
Spin,
Table,
Modal,
Col,
Tag,
Button,
message,
Tooltip,
Popconfirm,
} from 'antd'
import { getMaterialStatus, getUrgentStatus,getProjectName } from '@/tools'
import ApplyPaymentModal from './applyPaymentModal';
import PayRecord from './payRecord';
import ImgList from '../../../common/imgList/index';
import './index.less'
import $ from "jquery";
import OldInforProject from "../oldInforProject";
const confirm = Modal.confirm
class CheckProject extends Component {
constructor(props) {
super(props)
this.state = {
value: '',
loading: false,
previewImage: '',
previewVisible: false,
payRecordVisible: false,
orderPaymentsId: 0,
previewPayVisible: false,
type: 1,//1 申请付款 2 申请付官费
previewPayInfor: {}, //点击申请付款的第三方信息或者支付节点信息
nodeId: 0,
// 专利
ContactsListsNew: [],
//付款节点表头
PayNodeTableColunms: [],
outsourceLogs: [],//审核日志
selectOrderPayments: [],//支付列表
orderPaymentseColunms: [
{
title: '编号',
dataIndex: 'id',
key: 'id',
},
{
title: '节点编号',
dataIndex: 'nodeId',
key: 'nodeId',
},
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record) => {
return
{text+'-'+record.tpcId}
{
text !== record.tpcName ?
'('+record.tpcName+')' : ''
}
},
},
{
title: '支付类型',
dataIndex: 'chooseType',
key: 'chooseType',
render: (text, record) => {
return
{/*0第三方 1催款 2官费*/}
{text === 0 ? '第三方' : text === 1 ? '催款' : '官费'}
},
},
{
title: '申请支付金额(万元)',
dataIndex: 'applicationAmount',
key: 'applicationAmount',
render: (text, record) => {
return
{isNaN(parseFloat(text)) ? text : parseFloat(text)}
},
},
{
title: '申请支付数量',
dataIndex: 'quantity',
key: 'quantity',
},
{
title: '申请时间',
dataIndex: 'createTimes',
key: 'createTimes',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text, record) => {
return
{
text === 0 ? '审核中' :
text === 1 ? '审核通过' :
text === 2 ? '已驳回' :
text === 3 ? '支付完成' : '已取消'
}
},
},
],//支付记录
outsourcingLogLoading: false,
payRecordsLoading: false,
}
}
componentDidMount() {
if(this.props.tid){
setTimeout(()=>{
this.getSelectOutsourceLog();
this.getSelectOrderPayment();
this.projectTypeTabContent(this.props.projectType);
},500)
}
}
projectTypeTabContent(projectType) {
this.setState({
//付款节点表头
PayNodeTableColunms: [
{
title: '节点编号',
dataIndex: 'id',
key: 'id',
},
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '付款科目',
dataIndex: 'dunType',
key: 'dunType',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '付款时间',
dataIndex: 'partyTimes',
key: 'partyTimes',
render: (text, record) => {
return {text ? text : '/'}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
return
{
isNaN(text) ? text : parseFloat(text)
}
},
},
{
title: '已付',
dataIndex: 'partyAmount',
key: 'partyAmount',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '操作',
dataIndex: 'dels',
key: 'dels',
render: (text, record, index) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{/*this.props.startType 0外包 1供应商(不需要审核)*/}
{/*record.status 0-未支付 1-待全款 ,2已全款 status=2的时候已经全款,按钮可以去掉了*/}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.payNodeConfirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
],
})
//0正常 1专利 2软著 3审计 this.props.startType 0外包 1供应商 外包时当普通单处理 projectType大于3的都用通用表格
if(projectType === 0 || !projectType || this.props.startType === 0 || projectType > 3){
this.setState({
ContactsListsNew: [
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '单价(万元)',
dataIndex: 'unitPrice',
key: 'unitPrice',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
render: (text) => {
return (
{text}
)
}
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
render: (text, record) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{/*this.props.startType 0外包 1供应商(不需要审核)*/}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.confirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
],
})
}else if(projectType === 2){ //2软著
this.setState({
ContactsListsNew: [
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '单价(万元)',
dataIndex: 'unitPrice',
key: 'unitPrice',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '材料',
dataIndex: 'material',
key: 'material',
render: (text, record) => {
return getMaterialStatus(text)
},
},
{
title: '加急',
dataIndex: 'urgent',
key: 'urgent',
render: (text, record) => {
return getUrgentStatus(text)
},
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
render: (text, record) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{
}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.confirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
],
})
}else if(projectType === 1){ //1专利
if(this.props.patentType === 0){ //专利申请
this.setState({
ContactsListsNew: [
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '单价(万元)',
dataIndex: 'unitPrice',
key: 'unitPrice',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
// {
// title: "官费",
// dataIndex: "officialCost",
// key: "officialCost",
// render: (text) => {
// return text === 1 ? '含官费' : '不含官费'
// },
// },
{
title: "费减",
dataIndex: "costReduction",
key: "costReduction",
render: (text) => {
return text === 1 ? '有费减' : '无费减'
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
render: (text) => {
return (
{text}
)
}
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
render: (text, record) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{record.officialCost === 1?
:
}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.confirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
],
})
}else{
this.setState({
ContactsListsNew: [
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '单价(万元)',
dataIndex: 'unitPrice',
key: 'unitPrice',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '备注',
dataIndex: 'remarks',
key: 'remarks',
render: (text) => {
return (
{text}
)
}
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
render: (text, record) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{
}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.confirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
]
})
}
}else if(projectType === 3){ //3审计
this.setState({
ContactsListsNew: [
{
title: '供应商名称',
dataIndex: 'companyName',
key: 'companyName',
render: (text, record, index) => {
if (text) {
return {text}
}
},
},
{
title: '单价(万元)',
dataIndex: 'unitPrice',
key: 'unitPrice',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '数量',
dataIndex: 'quantity',
key: 'quantity',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '总价(万元)',
dataIndex: 'totalAmount',
key: 'totalAmount',
render: (text, record) => {
if (text) {
return
{
isNaN(text) ? text : parseFloat(text)
}
}
},
},
{
title: '审计',
dataIndex: 'audit',
key: 'audit',
render: (text, record) => {
if (text) {
return {text===0?'无审计':text===1?'年审':'专审'}
}
},
},
{
title: '公司资产(万元)',
dataIndex: 'assets',
key: 'assets',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '收入(万元)',
dataIndex: 'income',
key: 'income',
render: (text, record) => {
if (text) {
return {text}
}
},
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
render: (text, record) => {
return (
{/*外包审核通过后,咨询师/咨询经理可申请付款*/}
{/*存在支付节点时不显示第三方的申请付款*/}
{/*0-待审核 ,1-审核通过,2-审核拒绝 true [NULL]*/}
{
}
{this.props.status === 2 && !this.props.isAuditPaymentGLY ?
{
this.confirmDeletNew(record)
}}
okText="删除"
cancelText="不删除"
>
:
}
)
},
},
]
})
}
}
onChange() {
this.setState({
value: e.target.value,
})
}
tableRowClickOne(record) {}
//点击付款节点详情
payNodeTableRowClickOne(record) {}
//外包日志列表
getSelectOutsourceLog(){
this.setState({
outsourcingLogLoading: true
})
$.ajax({
method: 'get',
dataType: 'json',
crossDomain: false,
url: globalConfig.context + '/api/admin/outsourceOrg/selectOutsourceLog',
data: {
tid: 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({
outsourceLogs: data.data
})
}
}.bind(this),
}).always(
function () {
this.setState({
outsourcingLogLoading: false
})
}.bind(this)
)
}
//支付列表
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)
)
}
//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 ? '查看详情' : '查看详情'
}
}
// 删除供应商信息
confirmDeletNew(index) {
this.setState({
loading: true,
ThirdListVisible: false,
})
$.ajax({
url: globalConfig.context + '/api/admin/company/deleteCompany',
method: 'post',
data: {
id: index.id,
},
}).done(
function (data) {
this.setState({
loading: false,
})
if (!data.error.length) {
message.success('删除成功!')
this.props.onRefresh()
} else {
message.warning(data.error[0].message)
}
}.bind(this)
)
}
//超级管理员
superAdminReject() {
let _this = this;
confirm({
title: '提醒',
content: '确定要驳回吗?',
onOk() {
_this.setState({
loading: true,
})
$.ajax({
url: globalConfig.context + '/api/admin/outsourceOrg/superAdminReject',
method: 'post',
data: {
id: _this.props.mid,
},
}).done(
function (data) {
_this.setState({
loading: false,
})
if (!data.error.length) {
message.success('驳回成功!')
_this.props.onRefresh();
_this.getSelectOutsourceLog();
} else {
message.warning(data.error[0].message)
}
}.bind(_this)
)
}
})
}
render() {
return (
{ this.props.oldInfor && Object.keys(this.props.oldInfor).length > 0 ?
:
{
parseInt(this.props.startType) === 0 ?
外包(外包派单,不走总部)
提示高于总部价格,费用个人承担
:
供应商信息(普通单)
}
项目状态:{getProjectName(parseInt(this.props.projectStatus))}
{
this.props.projectType === 1?
专利类型:{this.props.patentType === 0 ? '专利申请/变更/转让' : '专利买卖'}
专利名称:
{
this.props.patentNameType === 0 ? '实用新型专利' :
this.props.patentNameType === 1 ? '发明专利' :
this.props.patentNameType === 2 ? '外观专利' :
this.props.patentNameType === 3 ? this.props.patentName : ''
}
:
}
{/*{*/}
{/* this.props.orderTaskOfficialCost === 1 && this.props.startType !== 0?*/}
{/*
*/}
{/* 官费:{this.props.containOfficialFees === 0 ? '实际已缴费' : '实际未缴费'}*/}
{/*
: null*/}
{/*}*/}
{/*如果是软著类或者专利类的专利申请,隐藏付款节点但当为外包类型时,无需隐藏*/}
{(!((this.props.projectType === 1 && this.props.patentType === 0) || this.props.projectType === 2)) || this.props.startType === 0 ?
:
}
备注
{this.props.outsourceRemarks}
{this.props.fileList && this.props.fileList.length > 0 ?
合同/协议扫描件
{/*
{*/}
{/* this.setState({*/}
{/* previewImage: file.url || file.thumbUrl,*/}
{/* previewVisible: true,*/}
{/* })*/}
{/* }}*/}
{/*/>*/}
{
this.setState({ previewVisible: false })
}}
>
:
}
{parseInt(this.props.startType) !== 1 && this.state.outsourceLogs.length !== 0 ?
外包状态
{
this.state.outsourceLogs && this.state.outsourceLogs.map((value,index)=>(
{value.aname}
{
value.status === 0 ?
发起外包审核 :
value.status === 1 ? 通过 :
驳回
}
{value.remarks}
{value.createTimes}
))
}
: }
{this.state.selectOrderPayments.length !== 0 ?