<template>
  <div id="contractDetail">
    <div  style="padding:0 0 30px 10px;">
      <span>采购合同</span>
      <el-form :model="basicForm" :rules="basicRules" ref="basic" label-position="left" label-width="100" :show-message="false">
        <el-row :gutter="10">
          <el-col :span="11">
            <el-form-item label="采购组织" prop="orgIdName">
              <el-input readonly size="mini" v-model="basicForm.orgIdName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同编码" prop="code">
              <el-input readonly size="mini" v-model="basicForm.code">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="供应商" prop="supplierSupName">
              <el-input readonly size="mini" v-model="basicForm.supplierSupName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="年度采购额" prop="definesDefine13">
              <el-input readonly size="mini" v-model="basicForm.definesDefine13">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="采购员" prop="purPersonName">
              <el-input readonly size="mini" v-model="basicForm.purPersonName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="采购是否甲方" prop="definesDefine26">
              <!-- <el-input readonly size="mini" v-model="basicForm.definesDefine26"> -->
              <el-input readonly size="mini" :value="basicForm.definesDefine26 == 'Y'? '是' : basicForm.definesDefine26 == 'N' ? '否' : ''">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同类型" prop="billtype">
              <el-input readonly size="mini" v-model="basicForm.billtype">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同总金额" prop="definesDefine31">
              <el-input readonly size="mini" v-model="basicForm.definesDefine31">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="采购部门" prop="deptName">
              <el-input readonly size="mini" v-model="basicForm.deptName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同名称" prop="subject">
              <el-input readonly size="mini" v-model="basicForm.subject">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="平均毛利率" prop="definesDefine14">
              <el-input readonly size="mini" v-model="basicForm.definesDefine14">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="审批流程" prop="ctPurContentName">
              <el-input readonly size="mini" v-model="basicForm.ctPurContentName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="供应商层级" prop="definesDefine21">
              <el-input readonly size="mini" v-model="basicForm.definesDefine21">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同生效日期" prop="actualvalidate">
              <el-input readonly size="mini" v-model="basicForm.actualvalidate">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="同类品牌及毛利率" prop="definesDefine24">
              <el-input readonly size="mini" v-model="basicForm.definesDefine24">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同格式" prop="definesDefine16">
              <el-input readonly size="mini" v-model="basicForm.definesDefine16">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="耗材类别" prop="definesDefine3">
              <el-input readonly size="mini" v-model="basicForm.definesDefine3">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同终止日期" prop="actualinvalidate">
              <el-input readonly size="mini" v-model="basicForm.actualinvalidate">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="发票税率" prop="definesDefine20Name">
              <el-input readonly size="mini" v-model="basicForm.definesDefine20Name">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="紧急程度" prop="definesDefine23">
              <el-input readonly size="mini" v-model="basicForm.definesDefine23">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="产品类别&名称" prop="definesDefine22">
              <el-input readonly size="mini" v-model="basicForm.definesDefine22">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同签订日期" prop="subscribedate">
              <el-input readonly size="mini" v-model="basicForm.subscribedate">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="交货方式" prop="definesDefine5">
              <el-input readonly size="mini" v-model="basicForm.definesDefine5">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同来源" prop="sourceType">
              <el-input readonly size="mini" v-model="basicForm.sourceType">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="主要厂家" prop="definesDefine36">
              <el-input readonly size="mini" v-model="basicForm.definesDefine36">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="质保期限" prop="definesDefine10">
              <el-input readonly size="mini" v-model="basicForm.definesDefine10">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="承担运费方式" prop="definesDefine11">
              <el-input readonly size="mini" v-model="basicForm.definesDefine11">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同丙方" prop="definesDefine2Name">
              <el-input readonly size="mini" v-model="basicForm.definesDefine2Name">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="包邮条件" prop="definesDefine25">
              <el-input readonly size="mini" v-model="basicForm.definesDefine25">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="是否有指标" prop="definesDefine8">
              <!-- <el-input readonly size="mini" v-model="basicForm.definesDefine8"> -->
              <el-input readonly size="mini" :value="basicForm.definesDefine8 == 'Y'? '是' : basicForm.definesDefine8 == 'N' ? '否' : ''">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="合同指标" prop="definesDefine19">
              <el-input readonly size="mini" v-model="basicForm.definesDefine19">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="返利政策" prop="definesDefine18">
              <el-input readonly size="mini" v-model="basicForm.definesDefine18">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="是否有返利" prop="definesDefine4">
              <!-- <el-input readonly size="mini" v-model="basicForm.definesDefine4"> -->
              <el-input readonly size="mini" :value="basicForm.definesDefine4 == 'Y'? '是' : basicForm.definesDefine4 == 'N' ? '否' : ''">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="付款协议" prop="payAgreement">
              <el-input readonly size="mini" v-model="basicForm.payAgreement">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="价税合计" prop="taxMoney">
              <el-input readonly size="mini" v-model="basicForm.taxMoney">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="币种" prop="currencyName">
              <el-input readonly size="mini" v-model="basicForm.currencyName">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="质保期" prop="shelfPeriod">
              <el-input readonly size="mini" v-model="basicForm.shelfPeriod">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="单据状态" prop="verifyState">
              <el-input readonly size="mini" v-model="basicForm.verifyState">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="11">
            <el-form-item label="来源单据号" prop="firstCode">
              <el-input readonly size="mini" v-model="basicForm.firstCode">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="23">
            <el-form-item label="项目医院" prop="definesDefine15">
              <el-input readonly style="width: 100%" type="textarea" autosize size="mini" v-model="basicForm.definesDefine15">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="23">
            <el-form-item label="退换货政策" prop="definesDefine17">
              <el-input readonly type="textarea" autosize size="mini" v-model="basicForm.definesDefine17">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="23">
            <el-form-item label="合同主要内容" prop="memo">
              <el-input readonly type="textarea" autosize size="mini" v-model="basicForm.memo">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div style="position: fixed;bottom: 10px; right: 0;">
        <el-button size="mini" type="primary" v-if="verifystate == '1'" @click="auditData">审核</el-button>
      </div>
      </div>
  </div>
</template>

<script>
import { getDetail, audit } from '@/api/contractDetail/basic.js'
export default {
  data () {
    return {
      basicForm: {
        code: '',
        orgIdName: '',
        supplierSupName: '',
        definesDefine13: '',
        purPersonName: '',
        definesDefine26: '',
        billtype: '',
        definesDefine31: '',
        deptName: '',
        subject: '',
        definesDefine14: '',
        ctPurContentName: '',
        definesDefine21: '',
        actualvalidate: '',
        definesDefine24: '',
        definesDefine16: '',
        definesDefine3: '',
        actualinvalidate: '',
        definesDefine20Name: '',
        definesDefine23: '',
        definesDefine22: '',
        subscribedate: '',
        definesDefine5: '',
        sourceType: '',
        definesDefine36: '',
        definesDefine10: '',
        definesDefine11: '',
        definesDefine15: '',
        definesDefine2Name: '',
        definesDefine25: '',
        definesDefine8: '',
        definesDefine19: '',
        definesDefine17: '',
        definesDefine18: '',
        definesDefine4: '',
        memo: '',
        payAgreement: '',
        taxMoney: '',
        currencyName: '',
        shelfPeriod: '',
        verifyState: '',
        firstCode: '',

        commonName: '',
      },
      basicRules: {},
      params: {
        u8cFormId: '',
        taskId: ''
      },
      verifystate: '1'
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      this.params.u8cFormId = this.GetQueryString('u8cFormId')
      this.params.taskId = this.GetQueryString('taskId')
      console.log(this.params.u8cFormId)
      console.log(this.params.taskId)
      console.log(this.params)
      getDetail(this.params).then(res => {
        if(res.code === 200) {
          this.basicForm = res.data
          this.verifystate = res.data.verifystate
        }
      })
    },
    auditData() {
      let datas = {}
      datas.taskId = this.params.taskId
      audit(datas).then(res => {
        if (res.code === 200) {
          // this.$modal.alertSuccess("成功提示");
          this.$modal.notifySuccess(res.msg)
          this.getData()
        }
      })
    },
    GetQueryString(name) {
      var  reg = new  RegExp( "(^|&)" + name + "=([^&]*)(&|$)" );
      var  r = window.location.search.substr(1).match(reg);
      if (r!= null ) return   unescape(r[2]); return  null ;
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep .el-form-item__label {
  font-size: 12px;
}
::v-deep .el-form-item {
  margin-bottom: 0px;
}
.btn_grooup {
  margin-bottom: 10px;
  display: flex;
  justify-content: flex-end;
}
</style>