<template>
  <div class="home_wrapper">
    <div class="header_main" >
      发包方授权
      <div class="return_btn" @click="onClickLeft"></div>
    </div>
    <div class="list_main">
      <div class="titBox">
        <img src="../../assets/images/sunVillage_info/list_employer_process_icon_02.png" style="width:22PX;height:22PX;margin-right: 10px;"/>
        <p class="tit">发包方授权</p>
      </div>
      <van-field v-model="form.fbfbm" label="发包方代码" placeholder="发包方代码" input-align="right" :border="false" />
      <van-field v-model="form.fbfmc" label="发包方名称" placeholder="发包方名称" input-align="right" :border="false" />
      <van-field v-model="form.fbffzrxm" label="负责人名称" placeholder="负责人名称" input-align="right" :border="false" />
      <van-field v-model="form.fzrzjlx" label="证件类型" placeholder="证件类型" input-align="right" :border="false" />
      <van-field v-model="form.fzrzjhm" label="证件号码" placeholder="证件号码" input-align="right" :border="false" />
      <van-field v-model="form.lxdh" label="联系电话" placeholder="联系电话" input-align="right" :border="false" />
      <van-field v-model="form.organType" label="企业证件类型" placeholder="企业证件类型" input-align="right" :border="false" />
      <van-field v-model="form.organCode" label="企业证件号码" placeholder="企业证件号码" input-align="right" :border="false" />
      <van-field v-model="form.fbfdz" label="发包方地址" placeholder="发包方地址" input-align="right" :border="false" />
      <van-field v-model="form.yzbm" label="邮政编码" placeholder="	邮政编码" input-align="right" :border="false" />
      <van-field v-model="form.fbfdcy" label="发包方调查员" placeholder="发包方调查员" input-align="right" :border="false" />
      <van-field v-model="form.fbfdcrq" label="发包方调查日期" placeholder="发包方调查日期" input-align="right" :border="false" />
      <van-field v-model="form.fbfdcjs" label="发包方调查记事" placeholder="发包方调查记事" input-align="right" :border="false" />
      <van-field readonly label="发包方调查签字" input-align="right" :border="false" />
      <img :src="'/api'+form.fbfdcqz" width="100%" alt="" v-if="form.fbfdcqz" />
      <van-field v-model="form.shyj" label="审核意见" placeholder="审核意见" input-align="right" :border="false" />
      <van-field v-model="form.shrq" label="审核日期" placeholder="审核日期" input-align="right" :border="false" />
      <van-field readonly label="审核人签字" input-align="right" :border="false" />
      <img :src="'/api'+form.shrqz" width="100%" alt="" v-if="form.shrqz" />
      <div style="margin: 30px auto 0;width: 50%;">
        <van-button round block type="primary" native-type="submit" @click="handleAuthorization(form.id)" v-if="!form.personAccountId && !form.companyAccountId" >
          授权
        </van-button>
      </div>
    </div>
  </div>
</template>

<script>
  // import { getList} from "@/api/sunVillage_info/sysCbf";
  import { listFbf, authorizeSignature } from "@/api/contracted/fbf";
  import $ from "jquery";
  export default {
    name: "certificateList",
    data() {
      return {
        // 发包方信息表单
        form:{},
      };
    },
    created() {
      this.getFbfList();
    },
    methods: {
      getFbfList() {
        listFbf({deptId: this.$store.state.user.loginDeptId, translate_dict: 1}).then(response => {
          if (response.rows.length > 0) {
            this.form = response.rows[0];
          }
        });
      },
      handleAuthorization(id) {
        authorizeSignature(id).then(response => {
          if (response.code === 200) {
            this.$toast({
              icon: 'success',
              message: '授权成功',
              duration: '1000',
              onClose: () => {
                this.getFbfList();
              }
            })
          }
        });
      }
    },
  }
</script>

<style scoped lang="scss">
  /deep/ .van-button--primary {
    background: url("../../assets/images/sunVillage_info/btn_bg.png") no-repeat;
    background-size: 100% 100%;
    border: none;
  }

  .van-cell::after {
    position: absolute;
    box-sizing: border-box;
    content: ' ';
    pointer-events: none;
    right: 0.426667rem;
    bottom: 0;
    left: 0.426667rem;
    border: none;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
  }

  .home_wrapper {
    background: #e9e9e9;
    min-height: 100vh;
    width: 100vw;

    .header_main {
      height: 116px;
      background: url('../../assets/images/sunVillage_info/list_head.png') no-repeat;
      background-size: 100% 100%;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      font-size: 36px;
      line-height: 116px;
      text-align: center;
      color: #fff;
      position: relative;

      .return_btn {
        width: 24px;
        height: 43.2px;
        background: url('../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
        background-size: 20px 36px;
        position: absolute;
        left: 38px;
        top: 36px;
      }
    }

    .list_main {
      padding: 25px;
      background: #ffffff;
      width: 94%;
      margin: 25px auto 0;
      border-radius: 15PX;
      box-shadow: 4px 6px 5px rgba(63, 68, 75, 0.1);
    }

    .titBox {
      display: flex;
      align-items: center;
    }

    .tit {
      font-size: 36px;
      font-weight: bold;
    }

    /deep/ .van-cell {
      padding-left: 0 !important;
      padding-right: 0 !important;
      padding-bottom: 0 !important;
    }

    /deep/ .van-field__label {
      /*padding-left: 10PX;*/
      width: auto;
      display: flex;
      align-items: center;
    }

    /deep/ .van-cell--required::before {
      left: 85PX;
    }
  }
</style>
