<template>
  <el-dialog
    title="查看"
    :visible.sync="dataObj.detailDialog"
    width="800px"
    :close-on-click-modal = "false"
  >
    <div class="content-box">
      <div v-if="firstshow" class="content">
        <el-descriptions style="border:1px solid #ebebeb;padding:30px 20px;" v-if="dataObj.param" :column="1">
          <el-descriptions-item label="专业合作社名称"><div style="width:100%;">{{dataObj.name}}</div></el-descriptions-item>
          <el-descriptions-item label="法人代表"><div>{{dataObj.person}}</div></el-descriptions-item>
          <el-descriptions-item label="联系方式">{{dataObj.param.tel}}</el-descriptions-item>
          <el-descriptions-item label="工商登记注册时间">{{dataObj.param.create}}</el-descriptions-item>
          <el-descriptions-item label="专业合作社详细地址">{{dataObj.param.coopaddr}}</el-descriptions-item>
          <el-descriptions-item label="获得何种奖励/称号">{{dataObj.param.aware}}</el-descriptions-item>
          <el-descriptions-item label="成员数">{{dataObj.param.numberper}} 人</el-descriptions-item>
          <el-descriptions-item label="农民成员数">{{dataObj.param.nongmin}} 人</el-descriptions-item>
          <el-descriptions-item label="主营产品名称">{{dataObj.param.mainpro}}</el-descriptions-item>
          <el-descriptions-item label="商标名称">{{dataObj.param.mark}}</el-descriptions-item>
          <el-descriptions-item label="核心基地种植">{{dataObj.param.plant}}</el-descriptions-item>
          <el-descriptions-item label="联结基地">{{dataObj.param.area}}</el-descriptions-item>
          <el-descriptions-item label="带动非成员衣户数">{{dataObj.param.cloth}} 人</el-descriptions-item>
          <el-descriptions-item label="成员采购供应比">{{dataObj.param.common}} %</el-descriptions-item>
          <el-descriptions-item label="追溯方式">{{dataObj.param.caiyong}}</el-descriptions-item>
          <el-descriptions-item label="基地/产品认证">{{dataObj.param.renzheng}}</el-descriptions-item>
          <el-descriptions-item label="产品质量认证比">{{dataObj.param.zhiliang}} %</el-descriptions-item>
          <el-descriptions-item label="上年度成员培训">{{dataObj.param.peixun}} 人</el-descriptions-item>
          <el-descriptions-item label="上年度固定资产总额">{{dataObj.param.guding}} 万元</el-descriptions-item>
          <el-descriptions-item label="上年度经营收入">{{dataObj.param.jingying}} 万元</el-descriptions-item>
          <el-descriptions-item label="上年度盈余">{{dataObj.param.yingkui}} 万元</el-descriptions-item>
          <el-descriptions-item label="盈余返还总额">{{dataObj.param.fanhuizonge}} 万元</el-descriptions-item>
          <el-descriptions-item label="交易额返还比">{{dataObj.param.jiaoyi}} %</el-descriptions-item>
          <el-descriptions-item label="股金返还比">{{dataObj.param.gujin}} %</el-descriptions-item>
        </el-descriptions>
          <el-table :data="dataObj.fileParam" style="width: 100%">
            <el-table-column prop="name" label="附件" align="center">
            </el-table-column>
            <el-table-column prop="fileName" label="文件名" align="center">
            </el-table-column>
            <el-table-column prop="operate" align="center" label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="success"
                  @click="handleEdit(scope.$index, scope.row)">下载</el-button>
              </template>
            </el-table-column>
          </el-table>
      </div>
      <div class="last">
        <el-button @click="closeFn">返回</el-button>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: ["dataObj"],
  data() {
    return {
      labelPosition:'right',
      size:'',
      // 弹框显示
      // 第一次显示
      firstshow: true,
      // 第三次显示
      threeshow: false,
      applyfiles:[
          '1.专业合作社主要情况说明','2.专业合作社营业执照复印件','3.专业合作社章程','4.成员名册及出资表',
          '5.成员账户','6.上年度资产负债表、盈余及盈余分配表、成员权益变动表','7.产品和基地认证证书复印件','8.注册商标证书复印件或授权使用合同复印件','9.农产品生产记录和农业投入使用记录'],
      };
  },
  methods:{
      // 申报表下载
      handleEdit(sort, row) {
        let _this = this
        this.dataObj.fileParam.forEach((item,index) => {
          if (item.sort == (sort+1)) {
            _this.downLoad(item.fileUrl,item.fileName);
            this.$message({
              message: '下载成功',
              type: 'success'
            });
          }
        });
      },
      downLoad(content, fileName) {
        var aEle = document.createElement("a"); // 创建a标签
        aEle.download = fileName; // 设置下载文件的文件名
        aEle.href = content; // content为后台返回的下载地址
        aEle.click(); // 设置点击事件
      },
      // 取消按钮
      closeFn(){
        this.dataObj.detailDialog=false
        this.threeshow = false
        this.firstshow = true
      },
      // //////////第一次
      // 第一次下一步按钮
      nextstepFn(){
        this.firstshow = false
        this.threeshow = true
      },
      // //////////第三次
      beforethreestepFn(){
        this.threeshow = false
        this.firstshow = true
      },
  },
};
</script>
<style lang="scss" scoped>
.content-box {
  .content{
    height: 100%;
    display: flex;
    flex-direction: column;
    /deep/ .el-descriptions-item__label{
      display: inline-block;
      width: 300px;
    }
  }
  .from{
    flex: 1;
    padding: 50px;
  }
}
/deep/ .el-dialog__header {
  background: #2ab999;
  .el-dialog__title {
    color: white;
  }
}
/deep/ .el-icon-close:before {
  color: white;
}
/* 表项 */
.file{
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  font-size:20px;
  span{
    line-height: 30px;
  }
  i{
    font-size:30px;
    color:#67C23A;
  }
}
.resolve{
  text-align: center;
  width: 150px;
}
/* 弹框滚动条 */
/deep/ .el-dialog__body {
  max-height: 62vh;
  overflow: auto;
}
/* 按钮右下角 */
.last{
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
</style>
