
<style scoped>
.user-panel {
  margin: 10px auto;
}
</style>
<template>
  <el-dialog
    :visible.sync="showDialog"
    :title="title"
    :modal-append-to-body="false"
    style="text-align: left"
    @close="closeDialog"
    :close-on-click-modal="false"
  >
    <div class="user-panel">
      <el-form
        ref="form"
        :model="formModel"
        :label-width="'100px'"
      >
      <el-row>
        <el-col :span="8">
          <el-form-item label="企业名称：" prop="name">
            {{formModel.name}}
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="信用代码：" prop="creditCode">
            {{formModel.creditCode}}
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="法人代表：" prop="legalPerson">
            {{formModel.legalPerson}}
          </el-form-item>
        </el-col>
      </el-row>
      <div style="width:100%; text-align:center;">
          <img :src="formModel.businessLicenseUrl" class="avatar" style="width:96%;"/>
      </div>
      </el-form>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="closeDialog">关 闭</el-button>
    </span>
  </el-dialog>
</template>
<script>
import Constant from "@/constant";
import companyApi from "@/api/base/company";

export default {
  props: ["businessKey", "title"],
  data() {
    return {
      formModel: {},
      showDialog: true,
    };
  },
  methods: {
    closeDialog() {
      this.$emit("close", false);
    }
  },
  mounted: function () {
    var self = this;

    (function () {
        return companyApi.edit(self.businessKey);
    })()
      .then((response) => {
        var jsonData = response.data;

        if (jsonData.result) {
          self.formModel = jsonData.data;
          // self.fileUrl = self.formModel.logo + "?x-oss-process=image/resize,m_lfit,h_100,w_100"
        } else {
          self.$message.error(jsonData.message + "");
        }
      })
      .catch((error) => {
        self.$message.error(error + "");
      });
  },
};
</script>