<template>
    <myTable :baseData="baseData"></myTable>
    <myTable :baseData="baseData1"></myTable>
    <myTable :baseData="baseData2"></myTable>
    <myTable :baseData="baseData3"></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'
import EditPopup from '@/views/project_follow_up/edit.vue'

const props = defineProps({
    project_id: Number,
    components: EditPopup
})

const baseData = reactive({
    fetchFun: apiinvoiceapplyLists,
    tit: "开票记录",
    queryParams: { project_id: props.project_id },
    columnList: [
        { label: '开票单号', prop: 'invoicing_code' },
        { label: '合同编号', prop: 'contract_code' },
        { label: '合同名称', prop: 'contract_name' },
        { label: '开票日期', prop: 'invoicing_date' },
        { label: '期次', prop: 'period' },
        { label: '发票类型', prop: 'invoice_type' },
        { label: '发票编号', prop: 'tax' },
        { label: '开票金额(含税)', prop: 'amount_including_tax' },
        { label: '税率', prop: 'tax_rate' },
        { label: '税额', prop: 'tax_amount' },
    ]
})

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>