<template>
  <div class="eibs-tab">
    <c-row>
      <!-- 顶端，从左往右 -->
      <!-- <c-col :span="22" :offset="1"> -->
      <c-col :span="12">
        <c-row>
          <c-col :span="15">
            <el-form-item 
            label="信用证参考号" 
            prop="didgrp.rec.ownref">
              <c-input
                :disabled="true"
                v-model="model.didgrp.rec.ownref"
                maxlength="16"
                placeholder="请输入参考号"
                style="width: 95%"
              ></c-input>
            </el-form-item>
          </c-col>

          <c-col :span="9" >
            <el-form-item
              label="到期日"
              prop="didgrp.rec.expdat"
            >
              <c-date-picker
                :disabled="true"
                style="width: 100%"
                type="date"
                v-model="model.didgrp.rec.expdat"
                placeholder="请选择到期日"
              ></c-date-picker>
            </el-form-item>
          </c-col>
        </c-row>
      </c-col>

      <c-col :span="12">
        <c-col :span="13">
          <el-form-item label="信用证余额" prop="didgrp.cbs.opn1.cur">
            <c-select
              disabled
              v-model="model.didgrp.cbs.opn1.cur"
              style="width: 95%"
              placeholder="请选择币种"
            >
              <el-option
                v-for="item in codes.cur"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="11">
          <el-form-item
            style="text-align: left"
            label-width="0"
            prop="didgrp.cbs.opn1.amt"
          >
            <c-input-currency
              disabled
              v-model="model.didgrp.cbs.opn1.amt"
              style="text-align: left; width: 100%"
              placeholder="请输入信用证金额"
            ></c-input-currency>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="12">
        <el-form-item label="单据参考号" prop="bddgrp.rec.ownref">
          <c-input
            :disabled="true"
            v-model="model.bddgrp.rec.ownref"
            maxlength="16"
            placeholder="请输入单据参考号"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="12">
        <el-form-item label="摘要" prop="bddgrp.rec.nam">
          <c-input
            :disabled="true"
            v-model="model.bddgrp.rec.nam"
            maxlength="40"
            placeholder="请输入摘要"
          ></c-input>
        </el-form-item>
      </c-col>
    </c-row>

<!-- ---------------------------------------------------------------------------------------------------------------- -->
    <c-row>
      <c-col :span="12">
        <c-row>
          <c-col :span="24">
            <c-col :span="13">
              <el-form-item label="单据金额" prop="bddgrp.cbs.max.cur">
                <c-select
                  disabled
                  v-model="model.bddgrp.cbs.max.cur"
                  style="width: 95%"
                  placeholder="请选择币种"
                >
                  <el-option
                    v-for="item in codes.cur"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
               </c-select>
              </el-form-item>
            </c-col>
            <c-col :span="11">
              <el-form-item
                style="text-align: left"
                label-width="0"
                prop="bddgrp.cbs.max.amt">
                <c-input-currency
                  disabled
                  v-model="model.bddgrp.cbs.max.amt"
                  style="text-align: left; width: 100%"
                  placeholder="请输入单据金额"
                ></c-input-currency>
              </el-form-item>
            </c-col>
          </c-col>

          <c-col :span="24">
            <c-col :span="13">
              <el-form-item label="单据余额" prop="bddgrp.cbs.opn1.cur">
                <c-select
                  disabled
                  v-model="model.bddgrp.cbs.opn1.cur"
                  style="width: 95%"
                  placeholder="请选择币种"
                >
                  <el-option
                    v-for="item in codes.cur"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </c-select>
              </el-form-item>
            </c-col>
            <c-col :span="11">
              <el-form-item
                style="text-align: left"
                label-width="0"
                prop="bddgrp.cbs.opn1.amt"
              >
                <c-input-currency
                  disabled
                  v-model="model.bddgrp.cbs.opn1.amt"
                  style="text-align: left; width: 100%"
                  placeholder="请输入单据余额"
                ></c-input-currency>
              </el-form-item>
            </c-col>
          </c-col>
          
            
          
      
        </c-row>
      </c-col>
      
      <c-col :span="12">
        <c-col :span="24">
                <el-form-item label="申请人编号" prop="bddgrp.apl.pts.ref">
                <c-input
                    v-model="model.bddgrp.apl.pts.ref"
                    maxlength="16"
                    disabled
                    placeholder="请输入申请人编号"
                ></c-input>
                </el-form-item>
            </c-col>

            <c-col :span="24">
                <el-form-item label="申请人名称" prop="bddgrp.apl.pts.nam">
                <c-input
                    v-model="model.bddgrp.apl.pts.nam"
                    maxlength="40"
                    disabled
                    placeholder="申请人名称"
                ></c-input>
                </el-form-item>
            </c-col>
      </c-col>

      <!-- <c-col :span="12">
        <m-ptsmsg
          :model="model"
          :disabled="true"
          :argadr="{ title: '申请人', url: 'bddgrp.apl.pts' }"
        ></m-ptsmsg>
      </c-col> -->

    </c-row>

    <c-row>
      <c-col :span="12">
        <c-row>
          <c-col :span="12">
            <el-form-item label="到单日期" prop="bddgrp.rec.rcvdat">
              <c-date-picker
                :disabled="true"
                type="date"
                v-model="model.bddgrp.rec.rcvdat"
                style="width: 100%"
                placeholder="请选择到期日"
              ></c-date-picker>
            </el-form-item>
          </c-col>

          <c-col :span="12">
            <el-form-item label="远期起算日" prop="bddgrp.rec.stadat">
              <c-date-picker
                :disabled="true"
                type="date"
                v-model="model.bddgrp.rec.stadat"
                style="width: 100%"
                placeholder=""
              ></c-date-picker>
            </el-form-item>
          </c-col>
        </c-row>

        <c-row>
          <c-col :span="12">
            <el-form-item label="单据到期日" prop="bddgrp.rec.matdat">
              <c-date-picker
                :disabled="true"
                type="date"
                v-model="model.bddgrp.rec.matdat"
                style="width: 100%"
                placeholder="请选择单据到期日"
              ></c-date-picker>
            </el-form-item>
          </c-col>

          <c-col :span="12">
            <el-form-item label="远期期限" prop="bddgrp.rec.tenmaxday">
              <c-input
                :disabled="true"
                v-model.number="model.bddgrp.rec.tenmaxday"
                placeholder="请输入"
                style="width: 100%"
                maxlength="3"
              ></c-input>
            </el-form-item>
          </c-col>
        </c-row>
      </c-col>

      <c-col :span="12">
        <c-col :span="24">
          <el-form-item label="受益人编号" prop="bddgrp.ben.pts.ref">
            <c-input
                v-model="model.bddgrp.ben.pts.ref"
                maxlength="16"
                disabled
                placeholder="请输入受益人编号"
            ></c-input>
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item label="受益人名称" prop="bddgrp.ben.pts.nam">
            <c-input
              v-model="model.bddgrp.ben.pts.nam"
              maxlength="40"
              disabled
              placeholder="受益人名称"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <!-- <c-col :span="12">
        <m-ptsmsg
          :disabled="true"
          :model="model"
          :argadr="{ 
            title: '受益人', 
            rol: 'rec',
            grp: 'bddgrp'
            }"
        ></m-ptsmsg>
      </c-col> -->
    </c-row>

    <c-row>
      <c-col :span="12">
        <c-row>
          <c-col :span="24">
            <el-form-item label="单据类型" prop="bddgrp.rec.docflg">
              <c-select 
                  v-model="model.bddgrp.rec.docflg" 
                  style="width:100%" 
                  placeholder="请选择单据类型"
                  :code="codes.brdtyp"
                  disabled>
                  
              </c-select>
            </el-form-item>
          </c-col>
          <c-col :span="24">
            <el-form-item label="单据状态" prop="bddgrp.rec.docsta">
              <c-select
                :disabled="true"
                v-model="model.bddgrp.rec.docsta"
                style="width: 100%"
                placeholder="请选择单据状态"
                :code="codes.docsta"
              >
                <el-option
                  v-for="item in codes.bdd_docsta"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </c-select>
            </el-form-item>
          </c-col>
        </c-row>
      </c-col>

      <c-col :span="12">
        <c-col :span="24">
          <el-form-item label="交易行编号" prop="bddgrp.prb.pts.ref">
              <c-input
              v-model="model.bddgrp.prb.pts.ref"
              maxlength="40"
              placeholder="请输入交易行编号"
              disabled
              ></c-input>
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item label="交易行名称" prop="bddgrp.prb.pts.nam">
              <c-input
              v-model="model.bddgrp.prb.pts.nam"
              maxlength="40"
              placeholder="请输入交易行名称"
              disabled>
              </c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <!-- <c-col :span="12">
        <m-ptsmsg
          :disabled="true"
          :model="model"
          :argadr="{ title: '交单行', url: 'bddgrp.prb.pts' }"
        ></m-ptsmsg>
      </c-col> -->
    </c-row>



    <c-row>
      <c-col :span="12">
        <c-row>
          <!-- <m-ptsadr
            :model="model"
            :argadr="{
              title: '交单行',
              url: 'bddgrp.prb.pts',
              rol: 'bddgrp.rec.docprbrol',
            }"
          ></m-ptsadr> -->
          <c-col :span="24">
            <el-form-item label="交单行" prop="bddgrp.rec.docprbrol">
                <c-select
                    v-model="model.bddgrp.rec.docprbrol"
                    placeholder="请输入受益人账号"
                    style="width: 100%"
                    :code="codes.docprbrol"
                    disabled
                >
                </c-select>
            </el-form-item>
          </c-col>
          <c-col>
            <el-form-item label="BIC" prop="bddgrp.prb.pts.extkey">
                <c-input
                v-model="model.bddgrp.prb.pts.extkey"
                maxlength="40"
                placeholder="请输入BIC"
            ></c-input>
            </el-form-item>
          </c-col>
            
          <c-ptapdome
            :model="model"
            :disabledJigomc="true"
            :argadr="{
            title: '交易行',
            rol: 'prb',
            grp: 'bddgrp'
            }">
            </c-ptapdome>
        </c-row>
        <br />
        <c-row>
          <!--  有大问题 -->
          <!-- <m-ptsadr        
            :model="model"
            :argadr="{
              title: '付款人',
              url: 'bdtp.oth.pts',
              rol: 'bddgrp.rec.payrol',
            }"
          ></m-ptsadr> -->
          <c-col :span="24">
                <el-form-item label="付款人" prop="bddgrp.rec.payrol">
                    <c-select 
                        v-model="model.bddgrp.rec.payrol" 
                        style="width:100%" 
                        placeholder="请选择Payer"
                        disabled
                        :code="codes.payrol"
                        >
                        
                    </c-select>
                </el-form-item>
            </c-col>

            <c-col :span="20">
                <el-form-item label="External Key of Address" prop="bdtp.oth.pts.extkey">
                    <c-input  
                        v-model="model.bdtp.oth.pts.extkey" 
                        maxlength="16"  
                        style="width: 95%"
                        placeholder="请输入External Key of Address"
                        disabled></c-input>
                </el-form-item>
            </c-col>

            <c-col :span="1">
                <c-button
                    style="margin:0 10px 0 0;padding: 0 10px;"
                    class="searchButton"
                    size="small"
                    type="primary"
                    icon="el-icon-search"
                    @click="onSeainf(`bdtp.oth.pts.extkey`)"
                ></c-button>
            </c-col>
            <c-col :span="3" style="text-align: right">
                <c-button
                    style="margin:0 0"
                    class="detailsButton"
                    size="small"
                    type="primary"
                   
                >
                    详情
                </c-button>
            </c-col>

            <c-col :span="24">
                <el-form-item
                    prop="bdtp.oth.namelc"
                    :label="`付款人名称`"
                    :prop="`bdtp.oth.namelc`">
                    <c-input
                        type="textarea"
                        v-model="model.bdtp.oth.namelc"
                        :placeholder="'请输入付款人名称'"
                        :rows="2"
                        maxlength="35"
                        show-word-limit
                        disabled
                    ></c-input>
                </el-form-item>
            </c-col>

            <c-col :span="24">
                <el-form-item
                    label="付款人地址"
                    :prop="`bdtp.oth.pts.adrblk`"
                >
                    <c-input
                        type="textarea"
                        :rows="4"
                        v-model="model.bdtp.oth.pts.adrblk"
                        maxlength="35"
                        show-word-limit
                        placeholder="请输入付款人地址"
                        disabled
                        
                    ></c-input>
                </el-form-item>
            </c-col>
        </c-row>
      </c-col>

      <c-col :span="12">
        <c-col>
          <el-form-item label="通知日期" prop="bddgrp.rec.orddat" >
            <c-date-picker
              type="date"
              v-model="model.bddgrp.rec.orddat"
              style="width: 100%"
              placeholder=""
              :disabled="model.advrefflg != 'X' "
              
            ></c-date-picker>
          </el-form-item>

          <el-form-item label="SWIFT发送时间" prop="swtdat">
            <c-date-picker
              type="date"
              v-model="model.swtdat"
              style="width: 100%"
              placeholder="请选择SWIFT发送时间"
              :disabled="model.bddgrp.rec.advdocflg !='X' "
              
            ></c-date-picker>
          </el-form-item>

          <el-form-item label="寄单索款编号" prop="bddgrp.rec.sndref">
            <c-input
              v-model="model.bddgrp.rec.sndref"
              maxlength="20"
              placeholder="请输入寄单索款编号"
            ></c-input>
          </el-form-item>

          <c-row>
            <c-col :span="10">
              <el-form-item label="" prop="advrefflg">
                <c-checkbox v-model="model.advrefflg">出具拒付函</c-checkbox>
              </el-form-item>
            </c-col>

            <c-col :span="14">
              <el-form-item label="单据处理类型" prop="bddgrp.rec.bilpro">
                <c-select
                  v-model="model.bddgrp.rec.bilpro"
                  placeholder="请选择单据处理类型"
                >
                  <el-option
                    v-for="item in codes.test"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </c-select>
              </el-form-item>
            </c-col>
          </c-row>

          <c-row>
            <c-col :span="7">
              <el-form-item label="" prop="advbwdflg">
                <c-checkbox style="width: 100%" v-model="model.advbwdflg"
                disabled
                  >是否发送213拒付报文</c-checkbox
                >
              </el-form-item>
            </c-col>
            <c-col :span="6">
              <el-form-item label="" prop="advdisflg">
                <c-checkbox 
                style="width: 100%" 
                v-model="advdisflg"
                  >收到电提不符点</c-checkbox
                >
              </el-form-item>
            </c-col>
            <c-col :span="8">
              <el-form-item label="" prop="mtabut.clsflg">
                <c-checkbox 
                v-model="clsflg" 
                disabled 
                >闭卷</c-checkbox>
              </el-form-item>
            </c-col>
          </c-row>

          <c-row>
            <c-col :span="6">
              <el-form-item label="" prop="bddgrp.rec.advdocflg">
                <c-checkbox
                  style="width: 100%"
                  v-model="advdocflg"
                  >退单</c-checkbox
                >
              </el-form-item>
            </c-col>

            <c-col :span="24 - 6">
              <el-form-item label="退单方式" prop="rejtype">
                <c-select
                  v-model="model.rejtype"
                  style="width: 100%"
                  placeholder="请选择退单方式"
                  :disabled="model.bddgrp.rec.advdocflg!='X'"
                >
                  <el-option
                    v-for="item in codes.rejtype"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </c-select>
              </el-form-item>
            </c-col>
          </c-row>

          <el-form-item label="拒付声明">
            <c-input
              type="textarea"
              :cols="35"
              :rows="3"
              v-model="model.bddgrp.blk.disdoc"
              maxlength="105"
              show-word-limit
              placeholder="请输入拒付声明"
              :disabled = "model.bddgrp.blk.disdocflg!='X'"
            ></c-input>
          </el-form-item>

          <c-row>
            <c-col :span="7">
              <el-form-item label="" prop="bddgrp.blk.disdocflg">
                <c-checkbox
                  style="width: 100%"
                  v-model="model.bddgrp.blk.disdocflg"
                  
                  >拒付声明修改</c-checkbox
                >
              </el-form-item>
            </c-col>
            <c-col :span="6">
              <el-form-item label="" prop="rejpenins">
                <c-checkbox style="width: 100%" v-model="model.rejpenins"
                  >拒付且听候处理</c-checkbox
                >
              </el-form-item>
            </c-col>
          </c-row>
        </c-col>
      </c-col>
    </c-row>
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Bdtdcr/Event";

import Ptsmsg from "~/views/Public/Ptsmsg";
import Ptsadr from "~/views/Public/Ptsadr";
import Amtpanl from "~/views/Public/Amtpanl";
//import Utils from "~/utils";
import Ptap from "~/views/Public/Ptap";
import PtapDome from "~/views/Public/PtapDome";

export default {
  components: {
    "c-ptap": Ptap,
    "m-ptsmsg": Ptsmsg,
    "m-ptsadr": Ptsadr,
    "c-amtpanl": Amtpanl,
    "c-ptapdome": PtapDome,
  },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {};
  },
  computed: {
    //advdocflg,advdisflg互斥，但不会动态同时改变
    advdocflg: {
      get() {
        return this.model.bddgrp.rec.advdocflg === "X";
      },
      set(val) {
        this.model.bddgrp.rec.advdocflg = val ? "X" : "";
      },
    },
    advdisflg: {
      get(){
        if(
          this.model.bddgrp.rec.advdocflg==="X"){
          return false;
        }else {
          return this.model.advdisflg === "X";
        }
      },
      set(val){
        this.model.advdisflg = val ? "X" : "";
      },
    },
    rejpenins:{
      get() {
        return this.model.rejpenins === "X";
      },
      set(val) {
        this.model.rejpenins = val ? "X" : "";
      },
    },
    clsflg: {
      get() {
        return !(this.model.rejpenins === "X");
      }
    },
  },
  methods: {
    ...Event,
    opn1CurEvent() {
      this.executeDefault("didgrp.cbs.opn1.cur").then((res) => {
        if ((res.respCode == SUCCESS)) {
          Utils.copyValueFromVO(this.model, res.data);
        }
      });
    },

    changed(e) {},
  },
  created: function () {},
};
</script>
<style>
</style>
