<template>
  <el-dialog
    title="查看"
    width="70%"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <div style="margin-left: 20px;margin-right: 20px">
      <e-desc title="基本信息" column="3">
        <e-desc-item label="公司名称">{{dataForm.customerName}}</e-desc-item>
        <e-desc-item label="客户级别">{{dataForm.levelValue}}</e-desc-item>
        <e-desc-item label="所在区域">{{dataForm.regionCode}}</e-desc-item>
        <e-desc-item label="详细地址">{{dataForm.address}}</e-desc-item>
        <e-desc-item label="邮编">{{dataForm.zipCode}}</e-desc-item>
        <e-desc-item label="电话">{{dataForm.tel}}</e-desc-item>
        <e-desc-item label="传真">{{dataForm.fax}}</e-desc-item>
        <e-desc-item label="网址" span="2">
          <a type="primary" :href="dataForm.url" target="_blank">{{ dataForm.url }}</a>
        </e-desc-item>
        <e-desc-item label="公司简介" span="3">{{dataForm.introduction}}</e-desc-item>
      </e-desc>
      <e-desc title="业务联系人" column="3">
        <e-desc-item label="联系人">{{dataForm.contact}}</e-desc-item>
        <e-desc-item label="职位">{{dataForm.contactPosition}}</e-desc-item>
        <e-desc-item label="手机号码">{{dataForm.contactTel}}</e-desc-item>
        <e-desc-item label="邮箱">{{dataForm.contactEmail}}</e-desc-item>
        <e-desc-item label="对接业务员">{{dataForm.bizManagerName}}</e-desc-item>
      </e-desc>
      <e-desc title="财务信息" column="3">
        <e-desc-item label="企业税号">{{dataForm.taxNumber}}</e-desc-item>
        <e-desc-item label="发票抬头">{{dataForm.invoiceTitle}}</e-desc-item>
        <e-desc-item label="开户银行">{{dataForm.bank}}</e-desc-item>
        <e-desc-item label="银行账号">{{dataForm.account}}</e-desc-item>
        <e-desc-item label="单位地址">{{dataForm.billingAddr}}</e-desc-item>
      </e-desc>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">返回</el-button>
    </span>
  </el-dialog>
</template>

<script>
  import EDesc from '../common/e-desc'
  import EDescItem from '../common/e-desc-item'
  export default {
    name: 'customer-detail',
    components: {
      EDesc, EDescItem
    },
    data () {
      return {
        visible: false,
        id: 0,
        dataForm: {}
      }
    },
    methods: {
      async init (id) {
        this.visible = true
        this.id = id || 0
        this.dataForm = {}
        this.getDetails()
      },
      getDetails () {
        this.$http({
          url: this.$http.adornUrl(`/biz-service/cusCustomer/info/${this.id}`),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({data}) => {
          if (data && data.code === '200') {
            this.dataForm = data.data
          }
        })
      }
    }
  }
</script>

<style scoped>
.my-line{
  border-bottom: 1px solid #c0c4cc;
  margin-bottom: 10px;
}
.title{
  padding: 10px 0 ;
}
</style>
