<script setup> import pdfView from './pdfView' import { contractView } from "~/api/goods/index.js" import { authStore } from "~/stores/auth/index.js" definePageMeta({ layout: 'default', title: '签署内容' }) const { userInfo, payment } = authStore() const activeNames = ref([]) const router = useRouter() const pmblUrl = ref('') // 存储拍卖笔录的URL // 协议列表数据 const protocolList = computed(() => [ { id: '1', title: '《拍卖公告》', pdfName: 'pmgg', type: 'local' }, { id: '2', title: '《拍卖规则》', pdfName: 'pmgz', type: 'local' }, { id: '3', title: '《竞买须知》', pdfName: 'jmxz', type: 'local' }, { id: '4', title: '《竞买协议》', pdfName: 'jmxy', type: 'local' }, { id: '5', title: '《拍卖笔录成交确认书》', pdfName: pmblUrl.value, type: 'remote' }, { id: '6', title: '《拍卖移交确认书》', pdfName: 'pmyjqrs', type: 'local' } ]) // 获取拍卖笔录PDF const fetchPmblPdf = async () => { try { const res = await contractView({ auctionArtworkUuid: payment.value.auctionArtworkUuid, }) pmblUrl.value = res.data?.viewUrl // 假设接口返回的PDF URL在data字段中 } catch (error) { console.error('获取拍卖笔录失败:', error) } } // 监听折叠面板变化 const handleCollapseChange = (name) => { activeNames.value = name // 当打开拍卖笔录时获取PDF if (name === '5' && !pmblUrl.value) { fetchPmblPdf() } } const goSignature = () => { router.push({ path: '/signature/panel' }) } </script> <template> <div class="bg-#EBEBEB h-screen-nav flex flex-col"> <div class="h-50px text-14px text-#191919 bg-#fff flex items-center px-21px mb-6px shrink-0"> 支付前需同意以下内容并签字 </div> <van-collapse accordion v-model="activeNames" class="grow-1" @change="handleCollapseChange" > <van-collapse-item v-for="item in protocolList" :key="item.id" :name="item.id" class="mb-6px" > <template #title> <div class="text-#2B53AC text-14px">{{ item.title }}</div> </template> <pdfView :pdf-name="item.pdfName" :type="item.type" :is-active="activeNames === item.id" /> </van-collapse-item> </van-collapse> <div class="h-81px bg-#fff flex justify-center pt-7px border-t"> <van-button color="#2B53AC" class="w-213px van-btn-h-38px" @click="goSignature" > 同意并签字 </van-button> </div> </div> </template>