<template>
    <div class="home">
        <div class="user">
            <ul class="user-list flex-between">
                <li class="flex-colunm user-item">
                    <i class="el-icon-user"></i>
                    <p>全部项目</p>
                    <div>{{ detail.projectCount }}</div>
                </li>
                <li class="flex-colunm user-item">
                    <i class="el-icon-user"></i>
                    <p>我的供应商</p>
                    <div>{{ detail.bidderCount }}</div>
                </li>
                <li class="flex-colunm user-item">
                    <i class="el-icon-folder-checked"></i>
                    <p>已定定标项目</p>
                    <div>{{ detail.calibrated }}</div>
                </li>
                <li class="flex-colunm user-item">
                    <i class="el-icon-folder-delete"></i>
                    <p>已流标项目</p>
                    <div>{{ detail.bidFailed }}</div>
                </li>
                <li class="flex-colunm user-item">
                    <i class="el-icon-document-delete"></i>
                    <p>已经终止项目</p>
                    <div>{{ detail.end }}</div>
                </li>
            </ul>
            <h1>项目信息</h1>
            <ul class="flex project-list">
                <li class="flex-center project-item" v-for="(item, index) in tableData" :key="index">
                    <div class="flex-colunm">
                        <div >{{ item.number }}</div>
                        <p class="over">{{ item.state }}</p>
                    </div>
                </li>
            </ul>
            <!-- <dataTable :table-data="tableData" :columns="columns" :is-pageobj="false"> </dataTable> -->
            <h1>待办事项</h1>
            <ul class="flex project-list">
                <li class="flex-center project-item">
                    <div class="flex-colunm">
                        <div >{{ detail.projectAduitNeedModify }}</div>
                        <p class="overflow">待修改项目</p>
                    </div>
                </li>
                <li class="flex-center project-item">
                    <div class="flex-colunm">
                        <div>{{ detail.inquiryNoticeNeedModify }}</div>
                        <p class="flex-colunm">待修改询价公告</p>
                    </div>
                </li>
                <li class="flex-center project-item">
                    <div class="flex-colunm">
                        <div >{{ detail.biddingNoticeNeedModify }}</div>
                        <p class="overflow">待修改招标公告</p>
                    </div>
                </li>
                <li class="flex-center project-item">
                    <div class="flex-colunm">
                        <div >{{ detail.payment }}</div>
                        <p class="overflow">待签署应收账款合同</p>
                    </div>
                </li>
                <li class="flex-center project-item">
                    <div class="flex-colunm">
                        <div >{{ detail.credentials }}</div>
                        <p class="over">待确认供应商凭证</p>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
import { home } from '@api/purchaser/home';
import { getSearchString } from '@utils/common';
import dataTable from '@components/nopageTable.vue';
export default {
    components: {
        dataTable
    },
    data() {
        return {
            detail: '',
            tableData: [
                {
                    state: '审核通过待发布的项目',
                    number: '10',
                    url: ''
                },
                {
                    state: '处于售标&投标阶段的项目',
                    number: '10',
                    url: ''
                },
                {
                    state: '处于投标阶段的项目',
                    number: '10',
                    url: ''
                },
                {
                    state: '今日截标（开标）的项目',
                    number: '10',
                    url: ''
                },
                {
                    state: '处于开标阶段的项目',
                    number: '10',
                    url: ''
                },
                {
                    state: '处于评标阶段的项目',
                    number: '10',
                    url: ''
                }
                // {
                //     state: '处于定标阶段的项目',
                //     number: '10',
                //     url: ''
                // }
            ],
            columns: [
                {
                    label: '当前状态',
                    prop: 'state'
                },
                {
                    label: '数量',
                    prop: 'number'
                },
                {
                    slot: 'operate'
                }
            ], // 操作列
            projectlist: [
                {
                    id: 0,
                    img: require('@static/images/item.png'),
                    project: '待审核项目',
                    number: '100'
                },
                {
                    id: 1,
                    img: require('@static/images/item.png'),
                    project: '待审核项目',
                    number: '100'
                },
                {
                    id: 2,
                    img: require('@static/images/item.png'),
                    project: '待审核项目',
                    number: '100'
                },
                {
                    id: 3,
                    img: require('@static/images/item.png'),
                    project: '待审核项目',
                    number: '100'
                },
                {
                    id: 4,
                    img: require('@static/images/item.png'),
                    project: '待审核项目',
                    number: '100'
                }
            ]
        };
    },
    created() {
        getSearchString('token');
        this.gethome();
    },
    methods: {
        handleSee(row) {
            this.$router.push(row.url);
        },
        async gethome() {
            const { data, code } = await home();
            this.detail = data;
            this.tableData[0].number = data.prePublic;
            this.tableData[1].number = data.sellingBidding;
            this.tableData[2].number = data.bidding;
            this.tableData[3].number = data.open;
            this.tableData[4].number = data.bidOpening;
            this.tableData[5].number = data.bidOevaluating;
        }
    }
};
</script>

<style scoped>
.over{
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.user > h1 {
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 18px;
    padding-left: 20px;
    border-left: 4px solid #ff5203;
}

/* .home {
    box-sizing: border-box;
    padding: 30px;
}

.home > .user {
    box-sizing: border-box;
    padding: 30px;
    background: #fff;
} */

.user > .user-list {
    width: 100%;
    height: 180px;
    background: linear-gradient(180deg, #f3b880 0%, #f66827 100%);
    border-radius: 5px;
    box-sizing: border-box;
    padding: 0 116px;
}

.user-item {
    color: #fff;

    font-size: 30px;
}
.user-item > i {
    color: #fff;
}
.user-item > p {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 18px;
}

.project-list {
    flex-wrap: wrap;
}
.project-item {
    font-size: 26px;
    width: 175px;
    height: 144px;
    background: #ffffff;
    border-radius: 5px;
    box-sizing: border-box;
    padding: 20px 0;
}
.project-item > div {
    width: 100%;
    border-right: 1px solid #dbdcdd;
}
.project-list > .project-item:last-child > div {
    border-right: none;
}
.project-item p {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: center;
}
</style>
