<template>
  <div class="eibs-tab">
    <!-- =================顶左====================== -->
    <c-col :span="12" style="padding-right: 20px;">
      <!--line1-->
      <c-col :span="24">
        <el-form-item
          label="票据项下的业务号"
          prop="bpdgrp.rec.pntref"
          style="width: 100%"
        >
          <c-fullbox>
            <c-input
              v-model="model.bpdgrp.rec.pntref"
              maxlength="16"
              placeholder="请输入票据项下的业务号"
              disabled
            ></c-input>
            <template slot="footer">
              <c-button
                style="margin-left: 10px; padding: 0 12px"
                size="small"
                type="primary"
                @click="onSeainf"
              >
                <i class="el-icon-info"></i>
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>
        <!-- <c-col :span="2">
          <el-form-item label="" prop="" style="width: 100%"> </el-form-item>
        </c-col> -->

        <!--line2-->
      <c-col :span="24">
        <el-form-item
          label="融资业务号"
          prop="bpdgrp.rec.ownref"
          style="width: 100%"
        >
          <c-fullbox>
            <c-input
              v-model="model.bpdgrp.rec.ownref"
              maxlength="16"
              placeholder="请输入融资业务号"
              disabled
            ></c-input>
            <template slot="footer">
              <c-button

                style="margin-left: 10px; padding: 0 12px"
                size="small"
                type="primary"
                @click="onSeainf"
              >
                <i class="el-icon-info"></i>
              </c-button>
              <c-button size="small" type="primary" @click="onBptmodButgetref()" :disabled="model.bpdgrp.rec.ownref !== ''">
                获取
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>

        <!--  左        -->
      <c-col :span="24">
          <!-- Type of Advance 预付款类型-->
          <c-col :span="12">
            <el-form-item label="预付款类型" prop="bpdgrp.rec.fintyp">
              <c-select
                v-model="model.bpdgrp.rec.fintyp"
                style="width: 100%"
                placeholder="请选择预付款类型"
                disabled
              >
                <el-option
                  v-for="item in codes.fintyp_bpd"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </c-select>
            </el-form-item>
          </c-col>
          <!-- Advanced Party Ref.  融资业务编号 v-if="bpdgrp.rec.fintyp=='F' || bpdgrp.rec.fintyp=='D'"-->
          <c-col :span="12">
            <c-form-item label="" prop="bptp.distyp" label-width="0px" style="margin-left: 5px;"
            v-if="model.bpdgrp.rec.fintyp=='F' || model.bpdgrp.rec.fintyp=='D'">
              <c-select
                v-model="model.bptp.distyp"
                :code="codes.distyp"
                style="width: 100%; "
                maxlength="17"
                disabled
              ></c-select>
            </c-form-item>
          </c-col>
      </c-col>

      <!-- advance amount -->
      <c-col :span="24">
        <c-col :span="9">
          <c-form-item label="预支款金额" prop="bpdgrp.cbs.max.cur">
            <c-input
              v-model="model.bpdgrp.cbs.max.cur"
              style="text-align: center ;width: 100%;padding: 0px;"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>
        <c-col :span="10">
          <c-form-item prop="bpdgrp.cbs.max.amt" label-width="5px">
            <c-input
              v-model="model.bpdgrp.cbs.max.amt"
              style="width: 100%"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>
        <c-col :span="5">
          <c-form-item  label="" prop="bpdgrp.rec.pctfin"  label-width="5px">
            <c-input
              v-model="model.bpdgrp.rec.pctfin"
              style="width: 80%"
              disabled
            ></c-input>%
          </c-form-item>
        </c-col>
      </c-col>

        <!-- Advance Account 融资账号-->
        <c-col :span="24">
          <c-form-item label="融资账号" prop="bpdgrp.rec.finact">
            <c-input
              v-model="model.bpdgrp.rec.finact"
              maxlength="17"
              :placeholder="$t('other.please_enter') + '融资账号'"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>

        <c-col :span="24">
          <c-col :span="12">
            <el-form-item label="起息日期" prop="bpdgrp.rec.opndat">
              <c-date-picker
                type="date"
                v-model="model.bpdgrp.rec.opndat"
                style="width: 100%"
                placeholder="请选择起息日期"
                disabled
              ></c-date-picker>
            </el-form-item>
          </c-col>
          <c-col :span="12">
            <el-form-item label="到期日" prop="bpdgrp.rec.matdat">
              <c-date-picker
                type="date"
                v-model="model.bpdgrp.rec.matdat"
                style="width: 100%"
                placeholder="请选择到期日"
                disabled
              ></c-date-picker>
            </el-form-item>
          </c-col>
        </c-col>



        <!-- 福费廷转卖类型 ffttyp ffttyp1-->
        <c-col :span="24">
          <c-col :span="12">
            <c-form-item label="福费廷转卖类型" prop="bpdgrp.rec.ffttyp">
              <c-select
                v-model="model.bpdgrp.rec.ffttyp"
                style="width: 100%"
                placeholder="福费廷转卖类型"
                disabled
              >
                <el-option
                  v-for="item in codes.ffttyp1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                />
              </c-select>
            </c-form-item>
          </c-col>
          <!-- 我行借记账户 setact1-->
          <c-col :span="12">
            <c-form-item label="我行借记账户" prop="setact1">
              <c-input
                v-model="model.setact1"
                maxlength="17"
                :placeholder="$t('other.please_enter') + '我行借记账户'"
              ></c-input>
            </c-form-item>
          </c-col>
        </c-col>

        <!-- 下左 -->
        <c-col :span="24">
          <c-col :span="20">
            <c-form-item label="借据号" prop="bpdgrp.rec.fincod">
              <c-input
                v-model="model.bpdgrp.rec.fincod"
                maxlength="17"
                :placeholder="$t('other.please_enter') + '借据号'"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>

          <c-col :span="4">
            <c-checkbox 
              v-model="model.clsflg" 
              :disabled="checkDate(model.bpdgrp.rec.opndat)"
              @change="change(model.clsflg)">抹账</c-checkbox>
          </c-col>
        <!-- <c-col :span="4">
                <c-checkbox
                  v-model="model.clsflg"
                  :disabled="checkDate(model.trdgrp.rec.stttendat)"
                  @change="change(model.clsflg)"
                  >{{ $t("抹账") }}</c-checkbox
                >
            </c-col> -->


          <c-col :span="24">
            <c-form-item label="第一还款账号" prop="setact">
              <c-input
                v-model="model.setact"
                maxlength="21"
                placeholder="请输入第一还款账号"
                disabled
              ></c-input>
            </c-form-item>
          </c-col>

          <!-- --------------------------------- -->
           <!-- SG000119 : 第三方还款方式 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <el-form-item label="第三方还款方式" prop="bptmod.finmod.acttyp">
          <c-input
            v-model="model.bptmod.finmod.acttyp"
            style="width: 100%"
            :placeholder="$t('other.please_enter') + '第三方还款方式'"
            disabled
          >
          </c-input>
        </el-form-item>
      <!-- </c-col> -->

      <!-- SG000099 : 表外欠息利息 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="表外欠息利息" prop="bptmod.finmod.cbs.cbb.intamt1">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.intamt1"
            :placeholder="$t('other.please_enter') + '表外欠息利息'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000100 : 表外欠息 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="表外本年欠息" prop="bptmod.finmod.cbs.cbb.intamty1">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.intamty1"
            :placeholder="$t('other.please_enter') + '表外本年欠息'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000101 : 表内欠息利息 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="表内欠息利息" prop="bptmod.finmod.cbs.cbb.intamt2">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.intamt2"
            :placeholder="$t('other.please_enter') + '表内欠息利息'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000102 : 表内欠息 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="表内欠息" prop="bptmod.finmod.cbs.cbb.intamty2">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.intamty2"
            :placeholder="$t('other.please_enter') + '表内欠息'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000103 : 本金利息 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="本金利息" prop="bptmod.finmod.cbs.cbb.intamt">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.intamt"
            :placeholder="$t('other.please_enter') + '本金利息'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000104 : 本金 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <c-form-item label="本金" prop="bptmod.finmod.cbs.cbb.amt">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbb.amt"
            :placeholder="$t('other.please_enter') + '本金'"
            disabled
          ></c-input>
        </c-form-item>
      <!-- </c-col> -->

      <!-- SG000117 : 融资状态 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <el-form-item label="融资状态" prop="bpdgrp.rec.ovdflg">
          <c-select
            v-model="model.bpdgrp.rec.ovdflg"
            style="width: 100%"
            :code="codes.ovdflg"
            :placeholder="$t('other.please_enter') + '融资状态'"
            disabled
          ></c-select>
        </el-form-item>
      <!-- </c-col> -->

      <!-- SG000124 : 计息周期 -->
      <!-- <c-col :span="12" style="padding-right: 20px;"> -->
        <el-form-item label="计息周期" prop="bptmod.finmod.intprd">
          <c-select
            v-model="model.bptmod.finmod.intprd"
            style="width: 100%"
            :code="codes.intprd"
            :placeholder="$t('other.please_enter') + '计息周期'"
            disabled
          ></c-select>
        </el-form-item>
      <!-- </c-col> -->

      </c-col>

    </c-col>
    <!--顶右  -->
    <c-col :span="12" style="padding-left: 20px;">
      <c-col :span="24">
          <el-form-item
            label="票据项下的名称"
            prop="bpdgrp.rec.pntnam"
            style="width: 100%"
          >
            <c-fullbox>
              <c-input
                v-model="model.bpdgrp.rec.pntnam"
                maxlength="16"
                placeholder=""
                disabled
              ></c-input>
              <template slot="footer"> </template>
            </c-fullbox>
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item
            label="融资名称"
            prop="bpdgrp.rec.nam"
            style="width: 100%"
          >
            <c-fullbox>
              <c-input
                v-model="model.bpdgrp.rec.nam"
                maxlength="16"
                placeholder=""
                disabled
              ></c-input>
              <template slot="footer"> </template>
            </c-fullbox>
          </el-form-item>
        </c-col>

        <!--      中右-->
      <!-- <c-col :span="12" style="padding-left: 20px;"> -->
        <c-col :span="24">
          <c-ptap
            :model="model"
            :argadr="{ title: '融资客户', grp: 'bpdgrp', rol: 'fia' }"
            :isAdrblk="true"
            @onSeainf="onSeainf()"
            @onFiapDet="onFiapDet()"
            disabled
          >
          </c-ptap>
        </c-col>

        <!-- 下中右 -->
        <!-- <c-col :span="24">
          <c-checkbox v-model="model.mtabut.clsflg" maxlength="17" disabled>抹账</c-checkbox>
      </c-col> -->

      <!--           还本金金额-->
      <c-col :span="24">
        <c-col :span="9">
          <c-form-item label="还本金金额" prop="setmod.doccur">
            <c-input
              v-model="model.setmod.doccur"
              style="text-align: center ;width: 100%;"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>
        <c-col :span="11">
          <c-form-item prop="setamt" label-width="5px">
            <c-input
              v-model="model.setamt"
              maxlength="21"
              style="width: 100%"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>
        <c-col :span="4">
          <c-form-item prop="bptmod.finmod.cal" label-width="5px">
            <c-button
                size="small"
                type="primary"
                @click="onFinmodCal"
              >
                计算
              </c-button>
          </c-form-item>
        </c-col>
      </c-col>

      </c-col>

      <!--line3 -空-->
      <!-- <c-col :span="24">
        <c-col :span="1">
          <el-form-item label="" prop="" style="width: 100%"> </el-form-item>
        </c-col>
      </c-col> -->














      <!-- SG000098 : 还款方式 -->
      <c-col :span="12" style="padding-left: 20px;">
        <el-form-item label="还款方式" prop="bptmod.finmod.reptyp">
          <c-select
            v-model="model.bptmod.finmod.reptyp"
            :disabled="model.clsflg == 'X'"
            style="width: 100%"
            @change="selChange(model.bptmod.finmod.reptyp)"
            placeholder="请选择还款方式"
          >
            <el-option
              v-for="item in codes.reptyp"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </c-select>
        </el-form-item>
      </c-col>

      <!-- SG000120 : 第三方还款账号 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="第三方还款账号" prop="bptmod.finmod.act3">
          <c-input
            v-model="model.bptmod.finmod.act3"
            maxlength="21"
            :placeholder="$t('other.please_enter') + '第三方还款账号'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000105 : 偿还表外欠息利息 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item
          label="偿还表外欠息利息"
          prop="bptmod.finmod.cbs.cbe.intamt1"
        >
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.intamt1"
            :placeholder="$t('other.please_enter') + '偿还表外欠息利息'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000106 : 偿还表外欠息 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="偿还表外欠息" prop="bptmod.finmod.cbs.cbe.intamty1">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.intamty1"
            :placeholder="$t('other.please_enter') + '偿还表外欠息'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000107 : 偿还表内欠息利息 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item
          label="偿还表内欠息利息"
          prop="bptmod.finmod.cbs.cbe.intamt2"
        >
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.intamt2"
            :placeholder="$t('other.please_enter') + '偿还表内欠息利息'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000108 : 偿还表内欠息 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="偿还表内欠息" prop="bptmod.finmod.cbs.cbe.intamty2">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.intamty2"
            :placeholder="$t('other.please_enter') + '偿还表内欠息'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000109 : 偿还本金利息 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="偿还本金利息" prop="bptmod.finmod.cbs.cbe.intamt">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.intamt"
            :placeholder="$t('other.please_enter') + '偿还本金利息'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000110 : 偿还本金 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="偿还本金" prop="bptmod.finmod.cbs.cbe.amt">
          <c-input
            v-model="model.bptmod.finmod.cbs.cbe.amt"
            :placeholder="$t('other.please_enter') + '偿还本金'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000116 : 偿还利息总额 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-form-item label="偿还利息总额" prop="bptmod.finmod.cbs.totint">
          <c-input
            v-model="model.bptmod.finmod.cbs.totint"
            :placeholder="$t('other.please_enter') + '偿还利息总额'"
            disabled
          ></c-input>
        </c-form-item>
      </c-col>

      <!-- SG000118 : 执行利率 -->
      <c-col :span="12" style="padding-left: 20px;">
        <c-col :span="20">
          <c-form-item label="执行利率" prop="bpdgrp.rec.tolrat">
            <c-input
              v-model="model.bpdgrp.rec.tolrat"
              :placeholder="$t('other.please_enter') + '执行利率'"
              disabled
            ></c-input>
          </c-form-item>
        </c-col>
        <c-col :span="4">
            <!-- <c-checkbox v-model="model.mtabut.clsflg" maxlength="17" disabled>闭卷</c-checkbox> -->
            <c-checkbox v-model="model.mtabut.clsflg"
              true-label="C" false-label="O"
              :disabled="flag1">{{
                $t("闭卷")
              }}</c-checkbox>
        </c-col>
      </c-col>
    <!-- </c-col> -->



  </div>
</template>

<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Bptset/Event";
import Ptap from "~/views/Public/Ptap";
export default {
  components: {
    "c-ptap": Ptap,
  },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {
      selectData1: [
        {
          name: "全额偿还本金和利息",
          value: 1,
        },
        {
          name: "部分偿还本金和利息",
          value: 2,
        },
      ],
      codes: {
        ...CodeTable,
      },
      flag1:true,
      flag2:false
    };
  },
  methods: {
    ...Event,
    onSeainf(data) {
      this.$emit("onSeainf", data);
    },
    checkDate(date) {
      var d = new Date().getDate();
      var m = new Date().getMonth();
      var y = new Date().getFullYear();
      var dd = new Date(this.model.bpdgrp.rec.opndat).getDate();
      var mm = new Date(this.model.bpdgrp.rec.opndat).getMonth();
      var yy = new Date(this.model.bpdgrp.rec.opndat).getFullYear();
      if (d != dd || m != mm || y != yy) {
        return true;
      } else {
        return false;
      }
    },
    change(a){
      this.executeRule("clsflg").then((res) => {
        if ((res.respCode == SUCCESS)) {
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
      if (a = 'X'){
        this.model.bptmod.finmod.reptyp = "1"
        if(this.flag1 == true){
          this.flag1 = false
          this.model.mtabut.clsflg = "C"
          }
        }
    },
    selChange(b){
        if(b == '2'||this.flag2 == false){
          this.model.mtabut.clsflg = 'O'
          this.flag1 = true   
      }
    },
  },
  created() {
    // 初始化下拉框
    // this.selValue = this.selectData[1].value
  },
};
</script>
<style>
</style>