<template>
    <el-dialog  title="联系记录" :visible.sync="dialogVisible" width="50%" :before-close="handleClose">

        <div >
            <el-row :gutter="20"   style="margin-left:50px">
                <el-col :span="6"><div class="grid-content bg-purple">姓名：{{ this.ruleForm.clientName }}</div></el-col>
                <!-- <el-col :span="6"><div class="grid-content bg-purple">手机号：{{ this.ruleForm.clientCell }}</div></el-col> -->
             </el-row>
            <br/>
            <el-table :data="records" stripe style="width: 100%;">
                <el-table-column prop="gmtContact" label="联系时间" :formatter="dateFormat" ></el-table-column>
                <el-table-column prop="desireName" label="客户意愿" ></el-table-column>
                <el-table-column prop="contant" label="联系内容"   ></el-table-column>
                <el-table-column prop="momo" label="备注"  ></el-table-column>
                <el-table-column prop="handlerName" label="跟进人"  ></el-table-column>
            </el-table>
        </div>
    </el-dialog>
</template>

<script>
    import * as moment from "moment";

    export default {
        name: "ByhContactDialog",
        props: {
            dialogVisible: {
                type: Boolean
            },
            clientCell: {
                type: String
            },
            clientName: {
                type: String
            },
        },
        data () {
            return {
                ruleForm: {
                    clientCell:'',
                    clientName:''
                },
                records:[],
            }
        },
        created() {
          this.ruleForm = {
              clientCell: this.clientCell,
              clientName: this.clientName,
          }
        },
        methods: {

            /** 关闭处理 */
            handleClose () {
                this.visible = false
                setTimeout(() => {
                    this.$emit('update:dialogVisible', false)
                }, 100)
            },

            /*日期*/
            dateFormat: function (row, column) {
                var date = row[column.property]
                if (date == undefined) {
                    return ''
                }
                return moment(date).format("YYYY-MM-DD h:m:s")
            },

            submitMarket() {
                var listsData = [];
                this.$$get(`/market/getSubtotalBycell/` + this.ruleForm.clientCell ).then(res => {
                    if (res.data.code < 1) {
                        this.$message.error(res.data.msg);
                        return
                    }

                    this.records = res.data.data;
                   
                }).catch(error => {
                    this.$Message.error(error || '系统异常');
                });
            },

        },
        mounted: function () {
            this.submitMarket();
        },
    }
</script>

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

</style>