<template>
    <el-dialog class="common-dialog"
               title="客户通讯录" :visible.sync="dialogVisible" width="60%" :before-close="handleClose">

        <div id="tableBody" class="content-table">
            <el-table :data="records" stripe style="width: 100%">
                <el-table-column prop="name" sortable label="联系人"></el-table-column>
                <el-table-column prop="phone" sortable label="联系号码"></el-table-column>
            </el-table>
        </div>

        <div slot="footer">
            <el-button @click="handleClose">关 闭</el-button>
        </div>
    </el-dialog>
</template>

<script>
    export default {
        name: "ByhContactDialog",
        props: {
            dialogVisible: {
                type: Boolean
            },
            certNo: {
                type: String
            },
            clientCell: {
                type: String
            },
            clientName: {
                type: String
            }
        },
        data () {
            return {
                client: {},
                records: [],
            }
        },
        mounted: function () {
            this.$$get(`/repayRemind/clientContact/${this.certNo}/${this.clientCell}/${this.clientName}`)
                .then(res => {
                    if (res.data.code < 1) {
                        throw res.data.msg
                    }
                    this.records = res.data.data
                })
                .catch(err => this.$$msg.err(err))

            this.$nextTick(() => {
                const bg = localStorage.getItem('bg')
                document.getElementById('tableBody').style.background = 'url("' + bg + '") 0 0 repeat';
            });



        },
        methods: {

            /** 关闭处理 */
            handleClose () {
                this.visible = false
                setTimeout(() => {
                    this.$emit('update:dialogVisible', false)
                }, 100)
            },
            cellFormat: function (row, column) {
                var cellFormat = row[column]
                return cellFormat.substring(0, 3) + '-' + cellFormat.substring(3, 7) + '-' + cellFormat.substring(7, 11)
            },

        }
    }
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">

    .contact-list table th {
        color: #64656f;
        text-align: center;
        font-size: 16px;
    }

    .contact-list table td {
        color: #64656f;
        text-align: center;
        font-size: 16px;
    }

    .content-table {
        height 550px;
        overflow auto;
    }
    /*表格*/
    .el-table, .el-table__expanded-cell {
        background transparent;
    }

    .el-table th, .el-table tr {
        background transparent;
    }

    .el-table--striped .el-table__body tr.el-table__row--striped td {
        background transparent;
    }

    .el-table--enable-row-hover .el-table__body tr:hover > td {
        background transparent;
    }
</style>