<template>
  <div class="eibs">
    <!-- ====================左边======================= -->
    <c-col :span="12" style="padding-right: 20px;">
      <c-col :span="24">
        <el-form-item
          label="进口代收业务编号"
          prop="bcdgrp.rec.ownref"
          style="width: 100%"
        >
          <c-fullbox>
            <c-input
              v-model="model.bcdgrp.rec.ownref"
              maxlength="16"
              placeholder="请输入进口代收业务编号"
              style="width: 100%"
              disabled
            ></c-input>
            <template slot="footer">
              <c-button
                style="margin: 0 10px 0 10px; padding: 0 12px"
                size="small"
                type="primary"
              >
                <i class="el-icon-info"></i>
              </c-button>
              <c-button
                style="margin: 0 0"
                size="small"
                type="primary"
                :disabled="this.model.bcdgrp.dre.pts.extkey !== '' && model.bcdgrp.rec.ownref == ''? false:true"
                @click="queryOwnref"
              >
                获取编号
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>
      <c-col :span="18">
        <el-form-item
          label="客户经理编号"
          prop="bctp.usr.extkey"
          style="width: 100%"
        >
          <c-input
            style="width: 100%"
            v-model="model.bctp.usr.extkey"
            maxlength="16"
            placeholder="请输入客户经理编号"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="6" class="centerLable">
        <c-checkbox
    
          v-model="model.bcdgrp.rec.dftgarflg"
          >待担保汇票</c-checkbox
        >
      </c-col>

      <c-col :span="14">
        <el-form-item label="代收币种及金额" prop="bcdgrp.cbs.max.cur">
          <c-select
            v-model="model.bcdgrp.cbs.max.cur"
            style="width: 100%"
            placeholder="请选择代收币种"
            :code="codes.infled_Cur"
          >
          </c-select>
        </el-form-item>
      </c-col>
      <c-col :span="10">
        <el-form-item
          style="text-align: left"
          label-width="0"
          prop="bcdgrp.cbs.max.amt"
        >
          <c-input-currency
            v-model="model.bcdgrp.cbs.max.amt"
            style="text-align: left; width: 100%"
            placeholder="请输入代收金额"
          ></c-input-currency>
        </el-form-item>
      </c-col>

      <c-col :span="14">
        <el-form-item label="代收币种及余额" prop="bcdgrp.cbs.opn1.cur">
          <c-select
            disabled
            v-model="opn1.cur"
            style="width: 100%"
            placeholder="请选择代收币种"
          >
          </c-select>
        </el-form-item>
      </c-col>
      <c-col :span="10">
        <el-form-item
          style="text-align: left"
          label-width="0"
          prop="bcdgrp.cbs.opn1.amt"
        >
          <c-input-currency
            disabled
            v-model="opn1.amt"
            style="text-align: left; width: 100%"
            placeholder="请输入代收余额"
          ></c-input-currency>
        </el-form-item>
      </c-col>
      <c-col :span="12">
        <el-form-item label="收单日期" prop="bcdgrp.rec.rcvdat">
          <c-date-picker
            type="date"
            v-model="model.bcdgrp.rec.rcvdat"
            style="width: 100%"
            placeholder="请选择收单日期"
          ></c-date-picker>
        </el-form-item>
      </c-col>
      <c-col :span="12">
        <el-form-item label="托收行寄单日" prop="bcdgrp.rec.predat">
          <c-date-picker
            type="date"
            v-model="model.bcdgrp.rec.predat"
            style="width: 100%"
            placeholder="请选择托收行寄单日"
          ></c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="通知日期" prop="bcdgrp.rec.advdat">
          <c-date-picker
            disabled
            type="date"
            v-model="model.bcdgrp.rec.advdat"
            style="width: 100%"
            placeholder="请选择通知日期"
          ></c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="交单条件" prop="bcdgrp.rec.doctypcod">
          <c-select
            v-model="model.bcdgrp.rec.doctypcod"
            style="width: 100%"
            placeholder="请选择交单条件"
            :code="codes.doctypcod"
            @change="getColins('bcdgrp.rec.doctypcod')"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="单据到期日" prop="bcdgrp.rec.matdat">
          <c-date-picker
            type="date"
            v-model="model.bcdgrp.rec.matdat"
            value-format="yyyy-MM-dd"
            style="width: 100%"
            placeholder="请选择单据到期日"
            :disabled="model.bcdgrp.rec.doctypcod === 'P'"
          ></c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="12">
        <el-form-item label="单据期限" prop="bcdgrp.rec.matpercnt">
          <c-input
            v-model.number="model.bcdgrp.rec.matpercnt"
            placeholder="请输入单据期限"
            :disabled="model.bcdgrp.rec.doctypcod === 'P'"
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="12">
        <el-form-item label="" label-width="10px" prop="bcdgrp.rec.matpertyp">
          <c-select
            v-model="model.bcdgrp.rec.matpertyp"
            style="width: 100%"
            placeholder="请选择"
            :code="codes.matpertyp"
            :disabled="model.bcdgrp.rec.doctypcod === 'P'"
          ></c-select>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="发票类型" prop="bcdgrp.rec.invtyp">
          <c-select
            v-model="model.bcdgrp.rec.invtyp"
            style="width: 100%"
            placeholder="请选择发票类型"
            :code="codes.invtyp"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="单据期限起算日" prop="bcdgrp.rec.matperbeg">
          <c-select
            v-model="model.bcdgrp.rec.matperbeg"
            style="width: 100%"
            placeholder="请选择单据期限起算日"
            :code="codes.matperbeg"
            :disabled="model.bcdgrp.rec.doctypcod === 'P'"
          >
          </c-select>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="到期文本" prop="bcdgrp.blk.bcgdet">
          <c-input
            :disabled="!this.model.bcdgrp.blk.bcgdetflg"
            type="textarea"
            v-model="model.bcdgrp.blk.bcgdet"
            maxlength="45"
            show-word-limit
            placeholder="请输入到期文本"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24" class="bctdav_bctp_bctovw_cheak">
        <c-checkbox v-model="model.bcdgrp.blk.bcgdetflg" style="margin-right:148px;"
          >到期文本修改</c-checkbox
        >
      </c-col>
    </c-col>

    <!-- ========================右边======================= -->
    <c-col :span="12" style="padding-left: 20px;">
      <c-col :span="24">
        <el-form-item label="简略信息" prop="bcdgrp.rec.nam" v-model="totalnam">
          <c-input
            align="middle"
            disabled
            v-model="model.bcdgrp.rec.nam"
            maxlength="40"
            placeholder="请输入简略信息"
          ></c-input>
        </el-form-item>
      </c-col>
      <!-- <c-col :span="24">
        <el-form-item label="付款人参考号" prop="bcdgrp.dre.pts.ref">
          <c-input
            v-model="model.bcdgrp.dre.pts.ref"
            maxlength="16"
            style="width: 100%"
            placeholder="请输入付款人参考号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="付款人名称" prop="bcdgrp.dre.pts.extkey">
          <c-fullbox>
            <c-input
              v-model="model.bcdgrp.dre.pts.extkey"
              maxlength="150"
              placeholder="请输入付款人名称"
              @keyup.enter.native="queryGridEtyPromptDialogData('DRE', 'C')"
            ></c-input>
            <template slot="footer">
              <c-button
                style="margin: 0 10px 0 10px; padding: 0 12px"
                size="small"
                type="primary"
              >
                <i class="el-icon-info"></i>
              </c-button>
              <c-button
                style="margin: 0 0"
                size="small"
                type="primary"
                disabled
              >
                详情
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col> -->

      <c-col :span="24">
        <c-ptap :model="model" :argadr="{
          title: '付款人',
          grp: 'bcdgrp',
          rol: 'dre',
        }" :isAdrblk="true" :disabled="this.flag1"
        @keyup.enter.native="queryGridEtyPromptDialogData('DRE', 'C')">
        </c-ptap>
      </c-col>

      <!-- <c-col :span="24">
        <el-form-item label="地址信息" prop="bcdgrp.dre.pts.adrblk">
          <c-input
            type="textarea"
            :rows="4"
            v-model="model.bcdgrp.dre.pts.adrblk"
            maxlength="150"
            disabled
            show-word-limit
            placeholder="请输入地址信息"
          ></c-input>
        </el-form-item>
      </c-col> -->
      <!-- <c-col :span="24">
        <el-form-item label="托收行参考号" prop="bcdgrp.rmi.pts.ref">
          <c-input
            v-model="model.bcdgrp.rmi.pts.ref"
            maxlength="16"
            style="width: 100%"
            placeholder=""
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="托收行名称" prop="bcdgrp.rmi.pts.extkey">
          <c-fullbox>
            <c-input
              v-model="model.bcdgrp.rmi.pts.extkey"
              maxlength="120"
              placeholder="请输入托收行名称"
              @keyup.enter.native="queryGridEtyPromptDialogData('RMI', 'C')"
            >
            </c-input>
            <template slot="footer">
              <c-button
                style="margin: 0 10px 0 10px; padding: 0 12px"
                size="small"
                type="primary"
              >
                <i class="el-icon-info"></i>
              </c-button>
              <c-button style="margin: 0 0" size="small" type="primary">
                详情
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="地址信息" prop="bcdgrp.rmi.pts.adrblk">
          <c-input
            type="textarea"
            :rows="4"
            v-model="model.bcdgrp.rmi.pts.adrblk"
            maxlength="150"
            show-word-limit
            placeholder="请输入地址信息"
          ></c-input>
        </el-form-item>
      </c-col> -->

      <c-col :span="24">
        <c-ptap :model="model" :argadr="{
          title: '托收行',
          grp: 'bcdgrp',
          rol: 'rmi',
        }" :isAdrblk="true" :disabled="this.flag1"
        @keyup.enter.native="queryGridEtyPromptDialogData('RMI', 'B')">
        </c-ptap>
      </c-col>

      <!-- <c-col :span="24">
        <el-form-item label="收款人参考号" prop="bcdgrp.drr.pts.ref">
          <c-input
            v-model="model.bcdgrp.drr.pts.ref"
            maxlength="16"
            style="width: 100%"
            placeholder=""
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="收款人名称" prop="bcdgrp.drr.pts.extkey">
          <c-fullbox>
            <c-input
              v-model="model.bcdgrp.drr.pts.extkey"
              maxlength="50"
              placeholder="请输入收款人名称"
              @keyup.enter.native="queryGridEtyPromptDialogData('DRR', 'C')">
            ></c-input>
            <template slot="footer">
              <c-button
                style="margin: 0 10px 0 10px; padding: 0 12px"
                size="small"
                type="primary"
              >
                <i class="el-icon-info"></i>
              </c-button>
              <c-button style="margin: 0 0" size="small" type="primary">
                详情
              </c-button>
            </template>
          </c-fullbox>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="地址信息" prop="bcdgrp.drr.pts.adrblk">
          <c-input
            type="textarea"
            :rows="4"
            v-model="model.bcdgrp.drr.pts.adrblk"
            maxlength="150"
            show-word-limit
            placeholder="请输入地址信息"
          ></c-input>
        </el-form-item>
      </c-col> -->

      <c-col :span="24">
        <c-ptap :model="model" :argadr="{
          title: '收款人',
          grp: 'bcdgrp',
          rol: 'drr',
        }" :isAdrblk="true" :disabled="this.flag1"
        @keyup.enter.native="queryGridEtyPromptDialogData('DRR', 'C')">
        </c-ptap>
      </c-col>

      <c-col :span="24">
        <el-form-item label="国家或地区编码" prop="bcdgrp.rec.stacty">
          <c-select
            v-model="model.bcdgrp.rec.stacty"
            style="width: 100%"
            placeholder="请选择国家或地区编码(风险国家)"
            :code="codes.stacty"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="12">
        <el-form-item label="申报类型" prop="outlen.szflg">
          <c-select
            v-model="model.outlen.szflg"
            style="width: 100%"
            placeholder="请选择申报类型"
            :code="codes.szflg"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="12">
        <el-form-item label="款项去向" prop="bctp.acttyp">
          <c-select
            :disabled="this.flag1"
            v-model="model.bctp.acttyp"
            style="width: 100%"
            placeholder="请选择款项去向"
            :code="codes.acttyp"
          >
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>
    <c-col :span="24">
      <c-docpre
        :model="model"
        :argadr="{
          path: 'SEMFLG',
          grp: 'bctp',
          code: 'docpre',
        }"
      ></c-docpre>
    </c-col>
  </div>
</template>
<script>
import event from "../event"
import Ptap from "~/views/Public/Ptap";
import Docpre from "~/views/Public/Docpre";

export default {
  components: {
    "c-ptap": Ptap,
    "c-docpre": Docpre,
  },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  watch: {
    "model.outlen.szflg": {
      immediate: true,
      handler(val, oldVal) {
        if (this.model.outlen.szflg == "1") {
          this.flag1 = false;
        } else {
          this.flag1 = true;
        }
      },
    },
  },

  data() {
    return {
      flag1: true,
      docgrd: {
        columns: [
          {
            title: "lst1",
            width: "80px",
            dataIndex: "cmail1",
            show: "input",
          },
          {
            title: "2nd",
            width: "80px",
            dataIndex: "cmail2",
            show: "input",
          },
          {
            title: "单据",
            width: "320px",
            dataIndex: "docnam",
            show: "select",
          },
        ],
        urls: "bctp.docgrdm.docgrd",
      },
    };
  },
  methods: { ...event },
  computed: {
    totalnam(){
      const cur = this.model.bcdgrp.cbs.max.cur + ' '
      const amt = this.model.bcdgrp.cbs.max.amt + ' '
      const preNam = this.model.bcdgrp.drr.pts.nam + ''
      this.model.bcdgrp.rec.nam =(cur + amt + preNam).substring(0,40)
      return this.model.bcdgrp.rec.nam
    },
    opn1(){
      this.model.bcdgrp.cbs.opn1.amt = this.model.bcdgrp.cbs.max.amt
      this.model.bcdgrp.cbs.opn1.cur = this.model.bcdgrp.cbs.max.cur
      return this.model.bcdgrp.cbs.opn1
    },

  },
  created: function () {},
};
</script>
<style>
/* .centerLable {
  height: 32px;
  line-height: 32px;
  padding-bottom: 2px;
} */
.marginLable {
  padding-left: 150px;
}
.bctdav_bctp_bctovw_cheak {
  margin: 0px 0 10px 150px;
}
</style>