<template>
    <BasePage />
    <div class="service">
        <div class="title">
            <b>联系客服</b>
            <p>尊敬的客户，我们竭诚为您服务</p>
        </div>

        <div class="list" v-for="item in data">
            <img :src="$file(item.img) || '/img/avatar.png'">
            <div class="text">
                <b>{{ item.nickname }}</b>
                <p>{{ item.description }}</p>
            </div>
            <div class="btn">
                <a :href="`tel:${item.phone}`" v-if="item.phone">
                    <img src="/img/service-i1.png">
                </a>
                <a @click="showService(item)">
                    <img src="/img/service-i2.png">
                </a>
            </div>
        </div>
    </div>

    <van-popup v-model:show="show" class="servicePopup">
        <div class="content">
            <img class="QRCode" :src="$file(qrcode)">
            <p>扫码添加客服微信</p>
        </div>
    </van-popup>
</template>

<script>
export default {
    name: 'Service',
    mounted() {
        this.$get('/v1/client/CCustomerservicesClient').then(data => {
            this.data = data.data.items;
            this.loading = false;
        });
    },
    data() {
        return {
            data: {},
            show: false,
            qrcode: '',
            loading: true,
        }
    },
    methods: {
        showService(e) {
            if (e.Link) {
                location.href = e.Link;
            }
            else {
                this.qrcode = this.$file(e.qrcode);
                this.show = true;
            }
        }
    }
}
</script>