<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>
            <dataTable :table-data="tableData" :columns="columns" :is-pageobj="false"> </dataTable>
            <h1>待办事项</h1>
            <ul class="flex-between project-list">
                <li class="flex-colunm project-item">
                    <i class="el-icon-edit"></i>
                    <p>待修改项目</p>
                    <div>{{ detail.projectAduitNeedModify }}</div>
                </li>
                <li class="flex-colunm project-item">
                    <i class="el-icon-edit-outline"></i>
                    <p>待修改询价公告</p>
                    <div>{{ detail.inquiryNoticeNeedModify }}</div>
                </li>
                <li class="flex-colunm project-item">
                    <i class="el-icon-folder"></i>
                    <p>待修改招标公告</p>
                    <div>{{ detail.biddingNoticeNeedModify }}</div>
                </li>
                <li class="flex-colunm project-item">
                    <i class="el-icon-tickets"></i>
                    <p>待签署应收账款买断合同</p>
                    <div>{{ detail.payment }}</div>
                </li>
                <li class="flex-colunm project-item">
                    <i class="el-icon-document-remove"></i>
                    <p>待确认供应商凭证</p>
                    <div>{{ detail.credentials }}</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>
.user > h1 {
    font-weight: bold;
    margin-top: 50px;
    margin-bottom: 30px;
}

.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 {
    margin-left: 30px;
}
.project-item {
    font-size: 30px;
}
.project-item > p {
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 18px;
}
</style>
