<template>
    <div class="tit">投标决策</div>
    <div>
        <el-table :data="tableData6" stripe style="width: 100%">
            <el-table-column label="流程编号" prop='code' width="180" />
            <el-table-column label="项目估算(万元)" prop='project_estimation' width="180" />
            <el-table-column label="资金来源" prop='bidding_project_fund_source' />
            <el-table-column label="投标时间" prop='bidding_time' />
            <el-table-column label="招标方式" prop='bid_type' />
            <el-table-column label="有无保证金" prop='is_margin' />
            <el-table-column label="保证金金额" prop='margin_amount' />
            <el-table-column label="开标日期" prop='bid_opening_date' />
            <el-table-column label="项目把握度" prop='project_assurance' />
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager6.page_no" v-model:page-size="pager6.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total5"
            @size-change="handleSizeChange6" @current-change="handleCurrentChange6" />
    </div>

    <div class="tit">购买标书</div>
    <div>
        <el-table :data="tableData7" stripe style="width: 100%">
            <el-table-column label="流程编号" prop='code' width="180" />
            <el-table-column label="投标公司名称" prop='bid_company_name' width="180" />
            <el-table-column label="招标公司名称" prop='invite_tenders_company_name' />
            <el-table-column label="标书编号" prop='bid_document_no' />
            <el-table-column label="购买人员" prop='buyer' />
            <el-table-column label="购买标书金额" prop='amount' />
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager7.page_no" v-model:page-size="pager7.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total6"
            @size-change="handleSizeChange7" @current-change="handleCurrentChange7" />
    </div>

    <div class="tit">标书审查</div>
    <div>
        <el-table :data="tableData8" stripe style="width: 100%">
            <el-table-column label="流程编号" prop='code' width="180" />
            <el-table-column label="标书编号" prop='bid_document_no' width="180" />
            <el-table-column label="购买人员" prop='buyer' />
            <el-table-column label="投标公司名称" prop='bid_company_name' />
            <el-table-column label="投标时间" prop='bidding_time' />
            <el-table-column label="开标日期" prop='bid_opening_date' />
            <el-table-column label="总金额" prop='total_amount' />
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager8.page_no" v-model:page-size="pager8.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total7"
            @size-change="handleSizeChange8" @current-change="handleCurrentChange8" />
    </div>

    <div class="tit">投标结果</div>
    <div>
        <el-table :data="tableData9" stripe style="width: 100%">
            <el-table-column label="投标编号" prop='bid_document_examination_code' width="180" />
            <el-table-column label="投标时间" prop='bidding_time' width="180" />
            <el-table-column label="开标日期" prop='bid_opening_date' />
            <el-table-column label="是否中标" prop='is_successful_text' width="180" />
            <el-table-column label="中标单位" prop='bidder_company' width="180" />
            <el-table-column label="中标金额" prop='bidder_amount' />

        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager9.page_no" v-model:page-size="pager9.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total8"
            @size-change="handleSizeChang9" @current-change="handleCurrentChange9" />
    </div>

    <div class="tit">投标保证金</div>
    <div>
        <el-table :data="tableData10" stripe style="width: 100%">
            <el-table-column label="流程编号" prop='bidding_decision_code' width="180" />
            <el-table-column label="投标时间" prop='bidding_time' width="180" />
            <el-table-column label="预计退还时间" prop='refund_date' />
            <el-table-column label="申请人" prop='applier' />
            <el-table-column label="保证金金额	" prop='margin_amount' />
            <el-table-column label="已退金额" prop='refund_amount' />
            <el-table-column label="未退金额" prop='not_refund_amount' />
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager10.page_no" v-model:page-size="pager10.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total9"
            @size-change="handleSizeChange10" @current-change="handleCurrentChange10" />
    </div>
    <div class="tit">退投标保证金</div>
    <div>
        <el-table :data="tableData11" stripe style="width: 100%">
            <el-table-column label="投标时间" prop='bidding_time' width="180" />
            <el-table-column label="退款日期" prop='refund_date' width="180" />
            <el-table-column label="账户编码" prop='bank_account_info.account_sn' />
            <el-table-column label="开户银行" prop='bank_account_info.deposit_bank' />
            <el-table-column label="退款金额" prop='refund_amount' />
            <el-table-column label="客户名称" prop='custom_name' />
            <el-table-column label="创建日期" prop='create_time' />
        </el-table>
    </div>
    <div style="margin: 20px 0;">
        <el-pagination v-model:current-page="pager11.page_no" v-model:page-size="pager11.page_size"
            :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" :total="total10"
            @size-change="handleSizeChange11" @current-change="handleCurrentChange11" />
    </div>
</template>



<script setup>

import { ref, reactive, defineProps } from "vue"
import { apiBidBiddingDecisionLists } from '@/api/bid_bidding_decision'
import { apiBidBuyBiddingDocumentLists } from '@/api/bid_buy_bidding_document'
import { apiBidDocumentExaminationLists } from '@/api/bid_document_examination'
import { apiBidResultLists } from '@/api/bid_result'
import { bidapplyLists } from '@/api/bidbbond'
import { bidrefundLists } from '@/api/refundbidDeposit'

const props = defineProps({
    project_id: Number
})


const total5 = ref(0)
const total6 = ref(0)
const total7 = ref(0)
const total8 = ref(0)
const total9 = ref(0)
const total10 = ref(0)
const total11 = ref(0)

const tableData6 = ref([])
const tableData7 = ref([])
const tableData8 = ref([])
const tableData9 = ref([])
const tableData10 = ref([])
const tableData11 = ref([])

const pager6 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})
const pager7 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})
const pager8 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})
const pager9 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})
const pager10 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})
const pager11 = reactive({
    page_size: 10,
    page_no: 1,
    project_id: props.project_id
})



// const handleSizeChange6 = (val: number) => {
//     pager6.page_size = val
//     decisionLists()
// }

// const handleSizeChange7 = (val: number) => {

//     pager7.page_size = val
//     buydocumentLists()
// }
// const handleSizeChange8 = (val: number) => {

//     pager8.page_size = val
//     examinationLists()
// }
// const handleSizeChange9 = (val: number) => {

//     pager9.page_size = val
//     bidResultLists()
// }
// const handleSizeChange10 = (val: number) => {

//     pager10.page_size = val
//     applyLists()
// }

// const handleSizeChange11 = (val: number) => {

//     pager11.page_size = val

//     refundLists()
// }

//获取投标决策列表
const decisionLists = () => {
    apiBidBiddingDecisionLists(pager6).then((res) => {
        tableData6.value = res.lists
        total5.value = res.count
    })
}


//获取购买标书列表
const buydocumentLists = () => {
    apiBidBuyBiddingDocumentLists(pager7).then((res) => {
        tableData7.value = res.lists
        total6.value = res.count
    })
}


//获取标书审查列表
const examinationLists = () => {
    apiBidDocumentExaminationLists(pager8).then((res) => {
        tableData8.value = res.lists
        total7.value = res.count
    })
}

//获取投标结果列表
const bidResultLists = () => {
    apiBidResultLists(pager9).then((res) => {
        tableData9.value = res.lists
        total8.value = res.count
    })
}
//获取投标保证金列表
const applyLists = () => {
    bidapplyLists(pager10).then((res) => {
        tableData10.value = res.lists
        total9.value = res.count
    })
}
//获取退投标保证金列表
const refundLists = () => {
    bidrefundLists(pager11).then((res) => {
        tableData11.value = res.lists
        total10.value = res.count
    })
}
decisionLists()
buydocumentLists()
examinationLists()
applyLists()
bidResultLists()
refundLists()
</script>
<style >
.tit {
    font-size: 1.2em;
    margin-bottom: 10px;
}
</style>