<!--
  @description: 京能代理机构-（采购单位注册、招标代理机构注册）注册基本信息详情
  @author: 张慢慢
  @routerPath:
  @date： 2020-11-13 16:50
-->
<template>
  <div class="p0-16">
    <div>
      <el-form ref="form" :model="formData" :inline-message="true">
        <p class="page-title">
          1.基本信息
        </p>
        <table class="tableData mb16">
          <tr>
            <td>
              注册类型
            </td>
            <td colspan="3">
              {{ filterDictText(departRoleNameList,auditInfoParam.rolCode) }}
            </td>
          </tr>
          <tr>
            <td>
              机构名称
            </td>
            <td colspan="3">
              {{ formData.departName }}
            </td>
          </tr>
          <tr>
            <td>
              统一社会信用代码
            </td>
            <td>
              {{ formData.orgCode }}
            </td>
            <td>
              企业性质
            </td>
            <td>
              {{ filterDictText(entPrptList,formData.entPrpt) }}
            </td>
          </tr>
          <tr>
            <td>
              联系人
            </td>
            <td>
              {{ formData.linker.linkname }}
            </td>
            <td>
              联系电话
            </td>
            <td>
              {{ formData.linker.linktel }}
            </td>
          </tr>
          <tr>
            <td>
              联系地址
            </td>
            <td colspan="3">
              {{ formData.areaValue+' '+formData.address }}
            </td>
          </tr>
          <tr>
            <td>
              营业执照扫描件
            </td>
            <td colspan="3">
              <downloadFile v-if="businessUpLoadData.bizId" :data="businessUpLoadData" />
            </td>
            <!--<td />
            <td />-->
          </tr>
          <p class="page-title">
            2.财务信息
          </p>
          <tr>
            <td>
              开户银行
            </td>
            <td>
              {{ formData.finance.bankname }}
            </td>
            <td>
              账户
            </td>
            <td>
              {{ formData.finance.bankaccount }}
            </td>
          </tr>
          <tr>
            <td>
              注册资本(万元)
            </td>
            <td>
              {{ moneyFormat(Number(formData.finance.regcapital).toFixed(6)) }}
            </td>
            <td>
              币种
            </td>
            <td>
              {{ filterDictText(currenciesList,formData.finance.currencies) }}
            </td>
          </tr>
        </table>
      </el-form>
    </div>
  </div>
</template>

<script>
/* api接口*/
import {
  getPurchaseInfo, // 获取采购基本信息
  getAgencyInfo // 获取机构基本信息
} from '@/api/common/user'
/* 公用方法*/
import { filterDictText, moneyFormat } from '@/assets/js/utils'// 常用方法
/* 公共组件 */
import downloadFile from '@comp/common/updownload/downloadFile' // 附件下载
/* 混合方法 */
import { organizationGroupMixin } from '../mixins/organizationGroupMixin'
import { organizationCommonMixin } from '../mixins/organizationCommonMixin'
export default {
  name: 'OrgRegisterInfo',
  components: {
    downloadFile
  },
  mixins: [organizationGroupMixin, organizationCommonMixin],
  props: {
    auditInfoParam: {
      type: Object,
      default: function() {
        return {
          rolCode: '', // 注册类型
          departId: '' // 机构ID
        }
      }
    }
  },
  data() {
    return {
      formData: {
        status: '', // 00保存 01提交
        userid: '', // 用户ID
        departId: '', // 部门id
        departName: '', // 机构名称
        orgCode: '', // 统一信用代码
        entPrpt: '', // 企业性质
        linker: {
          linkname: '', // 联系人
          linktel: '' // 联系电话
        },
        areaValue: '', // 联系地址
        address: '', // 详细地址
        finance: {
          bankname: '', // 开户银行
          bankaccount: '', // 银行帐号
          regcapital: '', // 注册资本
          currencies: '' // 币种
        }
      }
    }
  },
  watch: {
  },
  created() {
    // 获取字典
    this.getGroup(['entPrpt', 'currencies', 'departRoleName'])
    // 初始化数据
    this.initData()
  },
  methods: {
    filterDictText,
    moneyFormat,
    // 初始化数据
    initData() {
      const params = {
        departId: this.auditInfoParam.departId
      }
      this.businessUpLoadData.bizId = this.auditInfoParam.departId
      if (this.auditInfoParam.rolCode === 'TEMP_PURCHASING') {
        // 采购单位详情
        this.getPurchaseInfo(params)
      } else {
        // 代理机构详情
        this.getAgencyInfo(params)
      }
    },
    // 获取采购基本信息
    getPurchaseInfo(params) {
      getPurchaseInfo(params).then((res) => {
        this.formData = res.data
      })
    },
    // 获取代理机构信息详情
    getAgencyInfo(params) {
      getAgencyInfo(params).then((res) => {
        this.formData = res.data
        if (this.formData.tbauditOpinionList) {
          this.auditInfoParam.auditOpinion = res.data.tbauditOpinionList[0].auditOpinion
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
@import url("~@/assets/style/common/public.less");
.offerInfo{
  .tip-size;
}
.deliveryDate {
  display: flex;
  justify-content: center;
}
.orange-color{
  color: @orange;
}
</style>

