<template>
<div style="display: inline-block">
  <span @click="visible = true"> <slot></slot></span>
  <el-dialog title="更多联系人" :visible.sync="visible" append-to-body>
    <div v-if="info">
      <div style="text-align: center;margin-bottom: 20px;" v-for="(item, index) in info" :key="index">
        联系人{{index + 1}}:{{$l(item, 'name')}} &ensp;&ensp;&ensp; 联系方式{{index + 1}}:+{{item.areaCode}} {{item.phoneNew}}<br/>
        邮箱:{{item.email}}
      </div>

    </div>
    <div v-else>
      暂无数据
    </div>
  </el-dialog>
</div>
</template>

<script>
import {getCustomerContacts, getCustomerContactsListByCustomer} from "@/api/ecw/customerContacts";

export default {
  name: "contacts",
  props:{
    id:[Number]
  },
   data(){
    return {
      visible:false,
      info:null,
    }
   },
   methods:{
     getCustomerContactsFn() {
       getCustomerContactsListByCustomer({customerId: this.id}).then(r => {
         console.log(r,'rrr')
         this.info = r.data
       })
     }
   },
   watch:{
     visible(val){
       if(val){
         this.getCustomerContactsFn()
       }
     }
   }
}
</script>

<style scoped>

</style>