<template>
    <div>
        <div class="content">
            <changeNav :navs="navs"></changeNav>
            <div class="message">
                <div class="div1">
                    <div>项目编号：{{ projectCode }}</div>
                    <div>项目名称：{{ projectName }}</div>
                </div>
                <div class="div1">
                    <div>日期：{{ date }}</div>
                    <div>中标金额：{{ detail.money }}元</div>
                </div>
                <div class="div1">中标通知书编号：{{ detail.number }}</div>
                <div class="flex-item">
                    <div style="margin-right: 20px">附件：</div>
                    <ul v-if="detail.fileList">
                        <li v-for="(item, i) in detail.fileList" :key="i">
                            <div @click="open(item.fileUrl)" class="link">{{ item.fileName }}</div>
                        </li>
                    </ul>
                    <div v-else>无</div>
                </div>
                <div class="flex-colunm notice">
                    <h1>您已中标，若您选择了应收账款买断服务，请及时与平台签署相关合同。</h1>
                    <h3>咨询电话：{{phone}}</h3>
                    <el-button type="primary" @click="jump">查看详情</el-button>
                </div>
                <div class="centerButton">
                    <el-button @click="back">返回</el-button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { getMessagephone} from '@api/common/list'
import { winBookdetail } from '@api/supply/bid';
import changeNav from '@components/changeNav.vue';
export default {
    components: {
        changeNav
    },
    data() {
        return {
            projectCode: '',
            projectName: '',

            navs: ['中标通知书'],
            projectCode: '',
            projectName: '',
            detail: '',
            date:"",
            phone:""
        };
    },
    methods: {
        open(url) {
            window.open(url);
        },
        back() {
            this.$router.go(-1);
        },
        async getwinBookdetail() {
            let projectId = localStorage.getItem('projectId');
            const { data, code } = await winBookdetail(projectId);
            if (code == 200) {
                this.detail = data;
                this.date = data.winDate.substring(0, 10);
            }
        },
        jump() {
            this.$router.push('/supply/buyOut/buyoutList');
        },
          /* 获取客服电话 */
        async getMessagephone(){
            const {data} = await getMessagephone()
            console.log(data)
            this.phone = data.phone
        }
    },
    created() {
        this.projectCode = localStorage.getItem('projectCode');
        this.projectName = localStorage.getItem('projectName');
        this.getwinBookdetail();
        this.getMessagephone()
    }
};
</script>

	
<style scoped>
.content > h1 {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
    font-weight: bold;
}
.content > .img {
    width: 600px;
    margin: 0 auto;
}
.enclosure {
    margin: 20px 0;
}
.message {
    width: 60%;
    margin: 0 auto;
}
.message > .centerButton {
    justify-content: center;
}
.message > .div1 {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}
/* .message > div > div:first-child {
    margin-right: 300px;
} */
.notice {
    width: 80%;
    border: 1px solid #000;
}
.notice {
    margin: 200px auto 30px;
    padding: 20px;
}
.notice > h3 {
    margin: 20px 0;
}
</style>