<template>
    <myTable :baseData="baseData" :project="project" editPath="finance_receipt_record"></myTable>
    <myTable :baseData="baseData1" :project="project" editPath="finance_payment_plan"></myTable>
    <myTable :baseData="baseData2" :project="project" editPath="procurement_contract"></myTable>
    <myTable :baseData="baseData3" :project="project" editPath="procurement_contract"></myTable>
</template>

<script setup>

import { ref, reactive, defineProps } from "vue"
import myTable from "./myTable.vue"
import { apifinancereceiptLists } from '@/api/receiptrecord'
import { paymentplanLists } from '@/api/paymentplan'
import { paymentapplyLists } from '@/api/paymentrequest'
import { apiFinancerefundLists } from '@/api/refundrecord'

const props = defineProps({
    project: Object
})

const baseData = reactive({
    fetchFun: apifinancereceiptLists,
    tit: "收票记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '开票日期', prop: 'invoicing_date' },
        { label: '提交人', prop: 'commitor' },
        { label: '发票类型', prop: 'invoice_type' },
        { label: '发票编号', prop: 'invoice_no' },
        { label: '发票税率(%)', prop: 'invoice_tax_rate' },
        { label: '发票金额', prop: 'invoice_amount' },
        { label: '不含税金额', prop: 'amount_excluding_tax' },
        { label: '税额', prop: 'tax_amount' },
    ]
})

const baseData1 = reactive({
    fetchFun: paymentplanLists,
    tit: "付款计划",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '供应商名称', prop: 'supplier_name' },
        { label: '项目名称', prop: 'project_name' },
        { label: '合同编号', prop: 'contract_no' },
        { label: '计划付款日期', prop: 'pay_date' },
        { label: '金额', prop: 'amount' },
        { label: '期次', prop: 'pay_period_text' },
        { label: '状态', prop: 'pay_status_text' },
        { label: '已付款', prop: 'has_payment_amount' },
        { label: '未付款', prop: 'not_payment_amount' },
        { label: '备注', prop: 'remark' },
    ],
})

const baseData2 = reactive({
    fetchFun: paymentapplyLists,
    tit: "付款记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '付款单号', prop: 'competitor_name' },
        { label: '合同编号', prop: 'contract_no' },
        { label: '供应商名称', prop: 'supplier_name' },
        { label: '合同类型', prop: 'contract_type' },
        { label: '期次', prop: 'period' },
        { label: '付款日期', prop: 'pay_date' },
        { label: '付款性质', prop: 'payment_natrue' },
        { label: '付款方式', prop: 'pay_type' },
        { label: '付款金额', prop: 'amount' },
    ]
})


const baseData3 = reactive({
    fetchFun: apiFinancerefundLists,
    tit: "退款记录",
    queryParams: { project_id: props.project.id },
    columnList: [
        { label: '合同编号', prop: 'contract_no' },
        { label: '合同名称', prop: 'contract_name' },
        { label: '供应商名称', prop: 'supplier_name' },
        { label: '合同类型', prop: 'contract_type' },
        { label: '期次', prop: 'period' },
        { label: '退款日期', prop: 'refund_date' },
        { label: '退款原因', prop: 'reason' },
        { label: '退款方式', prop: 'refund_type' },
        { label: '退款金额', prop: 'refund_amount' },
    ]
})
</script>