


<template>
    <div class="detail-popup">
        <popup ref="popupRef" title="投标审查详情" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
            <el-descriptions title="基本信息" :column="3" border>
                <el-descriptions-item label="标书编号" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_document_no }}</el-descriptions-item>
                <el-descriptions-item label="购买人员" label-align="left" align="left" label-class-name="my-label">{{
                    formData.buyer }}</el-descriptions-item>
                <el-descriptions-item label="客户名称" label-align="left" align="left" label-class-name="my-label">{{
                    formData.custom_name }}</el-descriptions-item>
                <el-descriptions-item label="项目名称" label-align="left" align="left" label-class-name="my-label">{{
                    formData.project_name }}</el-descriptions-item>
                <el-descriptions-item label="招标公司名称" label-align="left" align="left" label-class-name="my-label">{{
                    formData.invite_tenders_company_name }}</el-descriptions-item>
                <el-descriptions-item label="投标公司名称" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_company_name }}</el-descriptions-item>
                <el-descriptions-item label="购买标书金额" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_document_amount }}</el-descriptions-item>
                <el-descriptions-item label="招标项目资金来源" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bidding_project_fund_source }}</el-descriptions-item>
                <el-descriptions-item label="投标时间" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bidding_time }}</el-descriptions-item>
                <el-descriptions-item label="购买标书时间" label-align="left" align="left" label-class-name="my-label">{{
                    formData.buy_date }}</el-descriptions-item>
                <el-descriptions-item label="招标方式" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_type }}</el-descriptions-item>
                <el-descriptions-item label="投标地址" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_address }}</el-descriptions-item>
                <el-descriptions-item label="是否需要保证金" label-align="left" align="left" label-class-name="my-label">{{
                    formData.is_margin }}</el-descriptions-item>
                <el-descriptions-item label="保证金金额" label-align="left" align="left" label-class-name="my-label">{{
                    formData.margin_amount }}</el-descriptions-item>
                <el-descriptions-item label="保证金退还时间" label-align="left" align="left" label-class-name="my-label">{{
                    formData.margin_amount_return_date }}</el-descriptions-item>
                <el-descriptions-item label="开标日期" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_opening_date }}</el-descriptions-item>
                <el-descriptions-item label="招标项目概况" label-align="left" align="left" label-class-name="my-label">{{
                    formData.bid_project_overview }}</el-descriptions-item>
                <el-descriptions-item label="项目简介" label-align="left" align="left" label-class-name="my-label">{{
                    formData.project_desc }}</el-descriptions-item>
                <el-descriptions-item label="附件" label-align="left" align="left" label-class-name="my-label">
                    <div v-if="formData.annex && formData.annex.length > 0">
                        <div v-for="(item, index) in formData.annex" style="margin-left: 5px;display: block;">
                            <el-link style="margin-left: 10px; color: #4a5dff; align-self: flex-start" :href="item"
                                target="_blank">文件{{ index + 1 }}查看</el-link>
                        </div>
                    </div>
                    <div v-else> 暂无附件</div>
                </el-descriptions-item>
            </el-descriptions>
            <el-descriptions title="技术审查" :column="1" border style="margin-top:30px">
                <el-descriptions-item label="技术协议偏差" label-align="left" align="left" label-class-name="my-label">{{
                    formData.technical_protocol_deviation }}</el-descriptions-item>
                <el-descriptions-item label="协议偏差处理方案" label-align="left" align="left" label-class-name="my-label">{{
                    formData.protocol_deviation_handling_plan }}</el-descriptions-item>
                <el-descriptions-item label="附件" label-align="left" align="left" label-class-name="my-label">
                    <div v-if="formData.technical_review_annex && formData.technical_review_annex.length > 0">
                        <div v-for="(item, index) in formData.technical_review_annex"
                            style="margin-left: 5px;display: block;">
                            <el-link style="margin-left: 10px; color: #4a5dff; align-self: flex-start" :href="item"
                                target="_blank">文件{{ index + 1 }}查看</el-link>

                        </div>
                    </div>
                    <div v-else> 暂无附件</div>
                </el-descriptions-item>
            </el-descriptions>
            <el-descriptions title="商务审查" :column="3" border style="margin-top:30px">
                <el-descriptions-item label="总金额" label-align="left" align="left" label-class-name="my-label">{{
                    formData.total_amount }}</el-descriptions-item>
                <el-descriptions-item label="税率" label-align="left" align="left" label-class-name="my-label">{{
                    formData.tax_rate }}</el-descriptions-item>
                <el-descriptions-item label="付款方式" label-align="left" align="left" label-class-name="my-label">{{
                    formData.pay_type }}</el-descriptions-item>
                <el-descriptions-item label="付款比例" label-align="left" align="left" label-class-name="my-label">{{
                    formData.pay_rate }}</el-descriptions-item>
                <el-descriptions-item label="商务合同偏差" label-align="left" align="left" label-class-name="my-label">{{
                    formData.business_contract_deviation }}</el-descriptions-item>
                <el-descriptions-item label="偏差处理方案" label-align="left" align="left" label-class-name="my-label">{{
                    formData.business_contract_deviation_handling_plan }}</el-descriptions-item>

                <el-descriptions-item label="附件" label-align="left" align="left" label-class-name="my-label">
                    <div
                        v-if="formData.business_contract_deviation_annex && formData.business_contract_deviation_annex.length > 0">
                        <div v-for="(item, index) in formData.business_contract_deviation_annex"
                            style="margin-left: 5px;display: block;">
                            <el-link style="margin-left: 10px; color: #4a5dff; align-self: flex-start" :href="item"
                                target="_blank">文件{{ index + 1 }}查看</el-link>

                        </div>
                    </div>
                    <div v-else> 暂无附件</div>
                </el-descriptions-item>

            </el-descriptions>

            <div class="tit" style="margin-top:30px;color:#000;font-size: 16px;">产品明细</div>
            <el-row>
                <el-table :data="productList">
                    <el-table-column label="序号" type="index" width="55" />
                    <el-table-column label="产品名称" prop="product_name" show-overflow-tooltip />
                    <el-table-column label="型号规格" prop="product_specs" show-overflow-tooltip />
                    <el-table-column label="单位" prop="product_unit" show-overflow-tooltip />
                    <el-table-column label="数量" prop="num" show-overflow-tooltip />
                    <el-table-column label="成本单价" prop="cost_price" show-overflow-tooltip />
                    <el-table-column label="金额" prop="cost_amount" show-overflow-tooltip />
                    <el-table-column label="点数" prop="points" show-overflow-tooltip />
                    <el-table-column label="报价单价" prop="sale_price" show-overflow-tooltip />
                    <el-table-column label="报价金额" prop="sale_amount" show-overflow-tooltip />
                </el-table>
            </el-row>
            <!-- <flowProcess></flowProcess> -->
            <!-- <flowDetail :approve_id="formData?.approve_id" /> -->

        </popup>
    </div>
</template>

<script lang="ts" setup name="customdetail">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiCustomDetail } from '@/api/custom'
import { timeFormat } from '@/utils/util'
import { apiBidDocumentExaminationDetailLists } from '@/api/bid_document_examination_detail'
import type { PropType } from 'vue'
defineProps({
    dictData: {
        type: Object as PropType<Record<string, any[]>>,
        default: () => ({})
    }
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const productList = ref([])
const total = ref('')
const datas = reactive({
    provinceOptions: [],
    cityOptions: [],
    areaOptions: [],
});
const pager1 = reactive({
    page_size: 10,
    page_no: 1,
    bid_document_examination_id: ""
})
//条数
const handleSizeChange1 = (val: number) => {

    pager1.page_size = val
    productLists()
}

//分页
const handleCurrentChange1 = (val: number) => {

    pager1.page_no = val
    productLists()
}

// 解决方案列表
const productLists = () => {
    apiBidDocumentExaminationDetailLists(pager1).then((res) => {
        productList.value = res.lists
        total.value = res.count

    })
}

// 表单数据
const formData = reactive({


})


// 获取详情
const setFormData = async (data: Record<any, any>) => {
    // for (const key in formData) {
    //     if (data[key] != null && data[key] != undefined) {
    //         //@ts-ignore
    //         formData[key] = data[key]

    //     }

    // }
    pager1.bid_document_examination_id = data.id
    Object.assign(formData, data)
    productLists()
    // console.log(formData, '2222222222')


}

const getDetail = async (row: Record<string, any>) => {
    const data = await apiCustomDetail({
        id: row.id
    })
    setFormData(data)
}


// 提交按钮
const handleSubmit = async () => {
    popupRef.value?.close()

}

//打开弹窗
const open = () => {
    console.log('1111111')
    popupRef.value?.open()
}

// 关闭回调
const handleClose = () => {
    emit('close')
}








defineExpose({
    open,
    setFormData,
    getDetail
})
</script>
<style lang="scss" scoped>
.tit {
    font-size: 1.2em;
    margin-bottom: 10px;
}

:deep(.my-label) {
    width: 150px;
}
</style>
