<template>
    <myTable :baseData="baseData" :project="project" editPath="InvoicingRequests"></myTable>
    <myTable :baseData="baseData1" :project="project" editPath="remittance"></myTable>
    <myTable :baseData="baseData2" :project="project" editPath="recordsPayment"></myTable>
    <myTable :baseData="baseData3" :project="project" editPath="refund"></myTable>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import myTable from "./myTable.vue"
import { apiinvoiceapplyLists } from '@/api/InvoicingRequests'
import { apireturnedLists } from '@/api/remittance'
import { apireturnedrecordLists } from '@/api/recordsPayment'
import { apirefundapplyLists } from '@/api/refund'

const props = defineProps({
    project: Object,
})

const baseData = reactive({
    fetchFun: apiinvoiceapplyLists,
    tit: "开票记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '客户', prop: 'custom_name' },
        { label: '项目编码', prop: 'project_code' },
        { label: '项目名称', prop: 'project_name' },
        { label: '开票日期', prop: 'invoicing_date' },
        { label: '期次', prop: 'period' },
        { label: '发票类型', prop: 'invoice_type' },
        { label: '开票金额(含税)', prop: 'invoicing_amount' },
        { label: '税率', prop: 'tax_rate' },
    ]
})
const baseData1 = reactive({
    fetchFun: apireturnedLists,
    tit: "回款计划",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '合同编号', prop: 'contract_code' },
        { label: '合同名称', prop: 'contract_name' },
        { label: '期次', prop: 'period' },
        { label: '计划日期', prop: 'return_date' },
        { label: '状态', prop: 'return_status' },
        { label: '金额', prop: 'amount' },
        { label: '已回款', prop: 'has_return_amount' },
        { label: '未回款', prop: 'not_return_amount' },


    ]
})

const baseData2 = reactive({
    fetchFun: apireturnedrecordLists,
    tit: "回款记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '合同名称', prop: 'contract_name' },
        { label: '合同编号', prop: 'contract_code' },
        { label: '期次', prop: 'period' },
        { label: '日期', prop: 'return_date' },
        { label: '金额', prop: 'amount' },
        { label: '收款人', prop: 'receiver' },
    ]
})

const baseData3 = reactive({
    fetchFun: apirefundapplyLists,
    tit: "退款记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '退款单号', prop: 'refund_code' },
        { label: '合同编号', prop: 'contract_code' },
        { label: '合同名称', prop: 'contract_name' },
        { label: '退款日期', prop: 'refund_date' },
        { label: '退款原因', prop: 'reason' },
        { label: '退款方式', prop: 'refund_type' },
        { label: '退款金额', prop: 'amount' },
        { label: '备注', prop: 'remark' },
    ]
})

</script>