<template>
  <div class="app-container clearfix" style=" width: 700px;margin: 0 auto;">
    <div class="app-header-top" style="width: 100%;float: right;margin-bottom: 10px;">
      <el-button type="primary" style="float: right;" @click="backToList">返回</el-button>
    </div>
    <el-form ref="dataForm" :model="form" label-position="left" label-width="130px">
      <el-form-item label="机构名称:" prop="name" style="width: 500px;text-align: right;">
        <el-input v-model="form.name" :disabled="true" type="text" />
      </el-form-item>
      <el-form-item label="联系人:" prop="linkMan" style="width: 500px; text-align: right;">
        <el-input v-model="form.linkMan" :disabled="true" type="text" />
      </el-form-item>
      <el-form-item label="手机号:" prop="contractMobile" style="width: 500px; text-align: right;">
        <el-input v-model="form.contractMobile" :disabled="true" />
      </el-form-item>
      <el-form-item label="机构地址:" prop="address" style="width: 500px; text-align: right;float:left;">
        <el-input v-model="form.address" :disabled="true" />
      </el-form-item>
      <el-form-item v-if="form.businessLicenseImage" label="营业执照:" prop="businessLicenseImage" style="width:450px;text-align: right;float:left;">
        <div class="form-el-upload">
          <div class="avatar">
            <a :href="form.businessLicenseImage" target="_blank" rel="noopener noreferrer"><img :src="form.businessLicenseImage"></a>
          </div>
        </div>
      </el-form-item>
      <el-form-item v-if="form.medicalPracticeLicenseImg" label="医疗执业许可证:" prop="medicalPracticeLicenseImg" style="width:450px; text-align: right;float:left;">
        <div class="form-el-upload">
          <div class="avatar">
            <a :href="form.medicalPracticeLicenseImg" target="_blank" rel="noopener noreferrer"><img :src="form.medicalPracticeLicenseImg"></a>
          </div>
        </div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { getClubDetail } from '@/api/club'
export default {
  data() {
    return {
      clubId: this.$route.query.clubId * 1,
      form: {}
    }
  },
  computed: {

  },
  created() {
    this.getClubDetail()
  },
  methods: {
    async getClubDetail() {
      try {
        const res = await getClubDetail(this.clubId)
        console.log('res', res)
        this.form = { ...this.form, ...res.data }
      } catch (error) {
        console.log('error', error)
      }
    },
    backToList() {
      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
        this.$nextTick(() => {
          this.$router.replace({
            path: '/club/list'
          })
        })
      })
    }
  }
}
</script>
<style lang="scss">
.el-input.is-disabled .el-input__inner{
  color: #333;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  float: left;
}
.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 148px;
  height: 148px;
  line-height: 148px;
  text-align: center;
}
.avatar {
  width: 148px;
  height: 148px;
  display: block;
}
.avatar a{
  width: 148px;
  height: 148px;
  display: block;
}
.avatar img {
  width: 148px;
  height: 148px;
  display: block;
}
.el-form-item__label{
    text-align: right !important;
}
.form-el-upload{
  width: 150px;
}
.el-upload__tip_club{
  margin-top: 0;
  line-height: 20px;
  color: red;
  text-align: left;
  position: absolute;
  right: -45%;
  bottom: 0;
}
.address .el-form-item__content{
  margin-left: 0 !important;
}
/*清除浮动*/
.clearfix:before,.clearfix:after {
  content: "";
  display: block;
  clear: both;
}
.clearfix {
  zoom: 1;
}
</style>
