<template>
    <bread-page>
        <div class="main" v-loading="loading">
            <div class="title">{{ info.name }}</div>
            <div class="content">
                <div class="sub-title">需求项</div>
                <div class="info">
                    <div class="info-item">
                        <span class="text1">所属分类：</span>
                        <span class="text2">{{ info.categoryName }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">包含文字：</span>
                        <span class="text2">{{ info.containText }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">包含字母:</span>
                        <span class="text2">{{ info.containLetter }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">包含图形:</span>
                        <span class="text2">{{ info.containGraphic }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">交易方式：</span>
                        <span class="text2">{{ getLabelName(info.mode, tradingMethodOption) }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">预算：</span>
                        <span class="text2" v-if="info.negotiateDirectly">面议 </span>
                        <span class="text2" v-else>{{ info.expectedPrice }}万元 </span>
                    </div>
                    <div class="info-item">
                        <span class="text1">发布时间：</span>
                        <span class="text2">{{ formatTime(info.createdAt, 'YYYY-MM-DD') }}</span>
                    </div>
                    <!-- <div class="info-item">
                        <span class="text1">联系人：</span>
                        <span class="text2">{{ info.contact }}</span>
                    </div>
                    <div class="info-item">
                        <span class="text1">所在地区：</span>
                        <span class="text2">{{ info.address }}</span>
                    </div> -->
                </div>

                <div class="sub-title">需求描述</div>
                <div class="text">
                    {{ info.description }}
                </div>
                <div class="btn">
                    <el-button type="primary" class="icon-button" @click.prevent="connectKefu" size="small">
                        <i class="iconfont iconfont-nav_icon_xiaoxi1"></i>
                        咨询客服
                    </el-button>
                    <el-button @click.prevent="postMessage" type="primary" class="icon-button" size="small">
                        <i class="iconfont iconfont-nav_icon_xiaoxi"></i>提交留言
                    </el-button>
                </div>
            </div>
            <!-- <div class="btn">
                <el-button type="primary" class="icon-button" size="small" plain>
                    <i class="iconfont iconfont-nav_icon_xiaoxi1"></i>
                    咨询客服
                </el-button>
                <el-button type="primary" class="icon-button"  size="small" plain>
                    <i class="iconfont iconfont-nav_icon_xiaoxi"></i>提交留言
                </el-button>
            </div> -->
        </div>
    </bread-page>
</template>

<script>
import BreadPage from '../../components/page/BreadPage.vue';
import comEvent from '../../mixins/comEvent';
import { logoTypeOptions, tradingMethodOption, commissionTypeOptions } from '../../utils/variables';
export default {
    data() {
        return {
            info: {},
            logoTypeOptions,
            tradingMethodOption,
            commissionTypeOptions,
            loading: true
        };
    },
    components: {
        BreadPage
    },
    mixins: [comEvent],
    mounted() {
        this.loading = true;
        this.$http.get('/logoDemand/get/' + this.$route.query.id).then(res => {
            console.log(res);
            this.info = res;
            this.loading = false;
            this.$EventBus.$emit('changePreTitle', {
                name: '商标',
                path: '/logoDemand'
            });
            this.$EventBus.$emit('changeTitle', '商标详情');
            document.title = '商标详情';
        });
    },
    created() {
        let addView = {
            id: this.$route.query.id,
            type: 'LogoDemand'
        };
        // console.log(addView);
        this.loading = true;
        this.$http.get('/all/addView/', addView).then(res => {
            console.log(res);
        });
    }
};
</script>

<style lang="less" scoped>
.main {
    background-color: #fff;
    padding: 0 30px 150px;
    position: relative;
}

.title {
    font-size: 24px;
    font-weight: bold;
    color: @warn;
    line-height: 34px;
    text-align: center;
    padding: 50px 0 20px;
    border-bottom: 1px solid @bg;
    margin: 0 70px;
    border-bottom: 1px solid @bg;
}

.sub-title {
    font-size: 16px;
    font-weight: bold;
    color: @warn;
    line-height: 22px;
    padding: 50px 0 16px;
    .flex();
    &::before {
        content: '';
        width: 5px;
        height: 16px;
        background: @warn;
        border-radius: 3px;
        margin-right: 10px;
    }
}

.info {
    .flex();
    flex-wrap: wrap;
    .info-item {
        width: 45%;
        padding-right: 50px;
        box-sizing: border-box;
        line-height: 32px;
        margin-bottom: 8px;
        .flex();

        .text1 {
            font-size: 14px;
            color: #999999;
            display: inline-block;
            min-width: 80px;
            flex-shrink: 0;
        }

        .text2 {
            font-size: 14px;
            color: #000;
            margin-left: 6px;
            display: inline-block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }
}

.text {
    font-size: 14px;
    color: #000000;
    line-height: 20px;
}

.btn {
    margin-top: 20px;
    text-align: center;
    .icon-button {
        line-height: 42px;
    }
}
</style>
