<!--企业开票信息-->
<template>
  <div class="crm-main">
    <el-form class="blockDiv" label-width="100px">
      <el-form-item :label="item.title" v-for="item in formItem" :key="item.title">
        <el-col :xs="item.col[0]" :sm="item.col[0]" :md="item.col[0]" :lg="item.col[0]" :xl="item.col[0]">
          <el-input v-model="sourceData[item.valueModel]" :disabled="item.disabled" class="dymForm"></el-input>
        </el-col>
        <el-col :xs="item.col[0]" :sm="item.col[0]" :md="item.col[0]" :lg="item.col[0]" :xl="item.col[0]" v-if="item.child" :offset="1">
          <el-input v-model="sourceData[item.childValueModel]" :disabled="item.disabled" class="dymForm"></el-input>
        </el-col>
      </el-form-item>
      <!--   查看履历   -->
      <auth-button v-if="sourceData.keyId" size="small" type="primary" icon="iconfont iconbaoliyewuxinxichaxun" :label="$t('enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.showCurriculumVitae')"
                   @click="showInvoiceResume()" :menuCode="menuId" perms="invoVitae" :openPerms="true"></auth-button>
    </el-form>
    <!--   开票信息履历   -->
    <show-invoice-resume-edit :visible.sync="editDialogVisible" :form="editDialogItem" :editModel="editDialogModel"></show-invoice-resume-edit>
  </div>
</template>

<script>
import { authButton } from 'newepoch-components'
import showInvoiceResumeEdit from '@/pages/enterpriseInfoManage/supplierInfoManage/showInvoiceResumeEdit.vue'
import supplierInfoManageApi from '@/api/enterpriseInfoManage/companyApi'
import storage from '@/utils/storage'
export default {
  name: 'enterpriseInvoiceInfo',
  components: {
    authButton,
    showInvoiceResumeEdit
  },
  data () {
    return {
      editDialogVisible: false,
      editDialogItem: {},
      editDialogModel: 'V',
      sourceData: {},
      formItem: [
        // 供应商信息
        {
          title: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.supplierInfos,
          col: [11],
          disabled: true,
          valueModel: 'enterpriseName'
        },
        // 开票名称
        {
          title: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.invoiceName,
          col: [11],
          disabled: true,
          valueModel: 'invoiceName'
        },
        // 纳税人识别号
        {
          title: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.taxidentify,
          col: [11],
          disabled: true,
          valueModel: 'taxNumber'
        },
        // 地址电话
        {
          title: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.addressTelephone,
          col: [11],
          disabled: true,
          valueModel: 'address',
          child: true,
          childValueModel: 'telephone'
        },
        // 开户行及账号
        {
          title: this.$i18n.messages[this.$i18n.locale].enterpriseInfoManage.supplierInfoManage.enterpriseInvoiceInfo.openingBank,
          col: [11],
          disabled: true,
          valueModel: 'openingBank',
          child: true,
          childValueModel: 'bankNo'
        }
      ]
    }
  },
  computed: {
    menuId () {
      return storage.getLocal('params').menuId
    }
  },
  mounted () {
    let $this = this
    let enterpriseId = storage.getLocal('params').enterpriseId
    $this.loadData({ enterpriseId: enterpriseId })
  },
  activated () {
    let $this = this
    let enterpriseId = storage.getLocal('params').enterpriseId
    $this.loadData({ enterpriseId: enterpriseId })
  },
  methods: {
    // 查看履历
    showInvoiceResume () {
      this.editDialogModel = 'V'
      this.editDialogItem = this.sourceData
      this.editDialogVisible = true
    },
    loadData (params) {
      let $this = this
      supplierInfoManageApi.invoiceListApi.getinvoice(params).then(res => {
        if (res && res.data) {
          $this.sourceData = res.data
        }
      })
    }
  }
}
</script>

<style scoped lang="scss" src="@/styles/enterpriseInfoManage/supplierInfoManage/enterpriseInvoiceInfo.scss">
</style>
