<script setup>
import {codeAuthStore} from "~/stores-collect-code/auth/index.js";
import {signOffline} from "~/api/goods/index.js";

const router = useRouter();
definePageMeta({
title:'签署'
})
const activeNames = ref(['1']);
const {formData,number,auctionArtworkUuid,qrData}=codeAuthStore()

const confirm=async ()=>{
  if (formData.value.countryCode==='86'&&formData.value.cardType===1){
    const res=await signOffline({
      userInfo:formData.value,
      auctionArtworkUuid:qrData.value.auctionArtworkUuid,
      signOrder:Number(number.value),
    })
    if (res.status===0){
      window.location.href=res.data.fddVerifyUrl
    }
  }else {
    router.push('/collectCode/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">支付前需同意以下内容并签字</div>
  <van-collapse v-model="activeNames" class="grow-1">
    <van-collapse-item  name="1" class="mb-6px">
      <template #title>
        <div class="text-#2B53AC text-14px">《拍卖规则》</div>
      </template>
      代码是写出来给人看的,附带能在机器上运行。
    </van-collapse-item>
    <van-collapse-item  name="2" class="mb-6px">
      <template #title>
        <div class="text-#2B53AC text-14px">《拍卖规则》</div>
      </template>
      代码是写出来给人看的,附带能在机器上运行。
    </van-collapse-item>
    <van-collapse-item  name="3" class="mb-6px">
      <template #title>
        <div class="text-#2B53AC text-14px">《拍卖规则》</div>
      </template>
      代码是写出来给人看的,附带能在机器上运行。
    </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="confirm">同意并签字</van-button>
  </div>
</div>
</template>

<style scoped>
:deep(.van-cell__right-icon){
  color: #ACACAC;
  font-size: 12px;
}
</style>