<template>
  <div class="eibs-tab">
    <c-col :span="24">
      <!-- ==================左边================ -->
      <c-col :span="12" style="padding-right: 20px">
        <c-col :span="24">
          <el-form-item label="业务编号" prop="jsdgrp.rec.ownref" style="width: 100%">
            <c-fullbox>
              <c-input v-model="model.jsdgrp.rec.ownref" maxlength="16" placeholder="请输入业务编号" disabled>
              </c-input>
              <template slot="footer">
                <c-button style="margin: 0 10px 0 10px; padding: 0 12px; height: 32px" size="small" type="primary"
                  icon="el-icon-search">
                </c-button>
                <c-button style="margin: 0 0" size="small" type="primary" :disabled="model.jsdgrp.apl.pts.ptainr == ''"
                  @click="getOwnref()">
                  获取
                </c-button>
              </template>
            </c-fullbox>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="处理标志" prop="jsdgrp.rec.chlibz">
            <c-select v-model="model.jsdgrp.rec.chlibz" dbCode="CHLIBZ" disabled style="width:100%">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="交易日期" prop="jsdgrp.rec.opndat">
            <c-date-picker type="date" v-model="model.jsdgrp.rec.opndat" style="width:100%" disabled>
            </c-date-picker>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="买卖品种" prop="jsdgrp.rec.maimpz">
            <c-select v-model="model.jsdgrp.rec.maimpz" dbCode="MAIMPZ" style="width:100%" :filterKey="['4','5']"
              uil="EN" sort="SRT" placeholder="请选择买卖品种" @change="maimpzChange()">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="买卖方向" prop="jsdgrp.rec.pngcfx">
            <c-select v-model="model.jsdgrp.rec.pngcfx" dbCode="PNGCFX" uil="EN" sort="SRT" style="width:100%"
              placeholder="请选择买卖方向" @change="pngcfxChange()">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <c-col :span="24" class="custom-box-wrap">
            <div style="width: 200px;">
              <el-form-item label="银行买入金额" prop="jsdgrp.cbs.max1.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == ''">
                <c-select-cur v-model="model.jsdgrp.cbs.max1.cur" dbCode="curtxt" style="width: 100%"
                  placeholder="请选择买入币种" :isShowKeyAndLabel="true">
                </c-select-cur>
              </el-form-item>
              <el-form-item label="银行买入金额" prop="jsdgrp.cbs.max1.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == '4'">
                <c-select-cur v-model="model.jsdgrp.cbs.max1.cur" dbCode="curtxt" style="width: 100%"
                  placeholder="请选择买入币种" :isShowKeyAndLabel="true" :expKey="['CNY']" @change="max1CurChange()">
                </c-select-cur>
              </el-form-item>
              <el-form-item label="银行买入金额" prop="jsdgrp.cbs.max1.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == '5'">
                <c-select-cur v-model="model.jsdgrp.cbs.max1.cur" dbCode="curtxt" style="width: 100%" disabled
                  :isShowKeyAndLabel="true" :filterKey="['CNY']"></c-select-cur>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 200px);">
              <el-form-item previewLabel="银行买入金额" label-width="5px" prop="jsdgrp.cbs.max1.amt">
                <c-input-currency :currency="model.jsdgrp.cbs.max1.cur" v-model="model.jsdgrp.cbs.max1.amt"
                  :maxlength="18" style="width:100%;" placeholder="请输入银行买入金额" @blur="max1AmtBlur()"
                  :disabled="model.jsdgrp.rec.pngcfx == '1'"></c-input-currency>
              </el-form-item>
            </div>
          </c-col>
        </c-col>
        <c-col :span="24">
          <c-col :span="24" class="custom-box-wrap">
            <div style="width: 300px;">
              <el-form-item label="银行买入账号" prop="jsdgrp.rec.rzhtyp">
                <c-select v-model="model.jsdgrp.rec.rzhtyp" maxlength="21" placeholder="请选择账户类型" dbCode="ACTTYP"
                  uil="EN" sort="SRT" :filterKey="['AR','SP','TP','LO']" @change="rzhtypChange()"></c-select>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 355px);">
              <el-form-item prop="jsdgrp.rec.zha1zh" label-width="5px">
                <c-select v-model="model.jsdgrp.rec.zha1zh" maxlength="21" placeholder="请选择银行买入账号"
                  @change="zha1zhChange()">
                  <el-option v-for="item in zha1zhList" :key="item" :label="item" :value="item">
                  </el-option>
                </c-select>
              </el-form-item>
            </div>
            <div style="width: 55px;">
              <el-form-item label-width="10px">
                <c-button style="margin: 0 0" size="small" type="primary"
                  @click="getCoreAccountInfo(model.jsdgrp.rec.zha1zh,model.jsdgrp.cbs.max1.cur)">
                  详情
                </c-button>
              </el-form-item>
            </div>
          </c-col>
        </c-col>
        <c-col :span="24">
          <c-col :span="24" class="custom-box-wrap" v-if="model.jsdgrp.rec.shfobz == '0'">
            <div style="width: 300px;">
              <el-form-item label="优惠类型" prop="jsdgrp.rec.yohulx" previewLabel="优惠类型">
                <c-select v-model="model.jsdgrp.rec.yohulx" maxlength="1" placeholder="请选择优惠类型" dbCode="YOHULX" uil="EN"
                  sort="SRT" :filterKey="['0','1','2']" @change="yohulxChange()"></c-select>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 300px);" v-if="model.jsdgrp.rec.yohulx !='2'">
              <el-form-item previewLabel="交易行优惠值" label-width="5px">
                <c-input-currency :currency="model.jsdgrp.cbs.max1.cur" v-model="model.jsdgrp.rec.zdngll"
                  :disabled="model.jsdgrp.rec.yohulx == '0'" :maxlength="18" style="width:100%;" placeholder="请输入交易行优惠值"
                  @blur="zdngllBlur()"></c-input-currency>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 320px);" v-if="model.jsdgrp.rec.yohulx =='2'">
              <el-form-item previewLabel="交易行优惠值" label-width="5px">
                <c-input-currency :currency="model.jsdgrp.cbs.max1.cur" v-model="model.jsdgrp.rec.zdngll"
                  :disabled="model.jsdgrp.rec.yohulx == '0'" :maxlength="18" style="width:100%;" placeholder="请输入交易行优惠值"
                  @blur="zdngllBlur()"></c-input-currency>
              </el-form-item>
            </div>
            <div style="width: 10px;" v-if="model.jsdgrp.rec.yohulx==='2'">
              <el-form-item label-width="10px">
                <c-col :span="1" style="float: right; text-align: right">
                  <span>%</span>
                </c-col>
              </el-form-item>
            </div>
          </c-col>
          <el-form-item label="交易行优惠值" prop="jsdgrp.rec.zdngll" v-if="model.jsdgrp.rec.shfobz == '1'">
            <c-input-currency :currency="model.jsdgrp.cbs.max1.cur" v-model="model.jsdgrp.rec.zdngll" :maxlength="18"
              style="width:100%;" placeholder="请输入交易行优惠值"></c-input-currency>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="结售汇性质" prop="jsdgrp.rec.waityp">
            <c-select v-model="model.jsdgrp.rec.waityp" dbCode="WAITYP" uil="EN" sort="SRT" style="width:100%"
              :isShowKeyAndLabel="true" placeholder="请选择结售汇性质" @change="waitypChange()">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="结售汇统计代码" prop="jsdgrp.rec.waitjm" v-if="model.jsdgrp.rec.maimpz != '5'">
            <c-select v-model="model.jsdgrp.rec.waitjm" dbCode="TJMINT" uil="EN" sort="SRT" style="width:100%"
              placeholder="请选择结售汇统计代码" :filterKey="waitjmFilterKey" @change="waitjmChange()">
            </c-select>
          </el-form-item>
          <el-form-item label="结售汇统计代码" prop="jsdgrp.rec.waitjm" v-if="model.jsdgrp.rec.maimpz == '5'">
            <c-select v-model="model.jsdgrp.rec.waitjm" dbCode="TJMOUT" uil="EN" sort="SRT" style="width:100%"
              placeholder="请选择结售汇统计代码" :filterKey="waitjmFilterKey" @change="waitjmChange()">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="国际收支申报交易编码" prop="jsdgrp.rec.txcode">
            <c-select v-model="model.jsdgrp.rec.txcode" maxlength="21" placeholder="请选择国际收支申报交易编码"
              :isShowKeyAndLabel="true" @change="txcodeChange()">
              <el-option v-for="item in model.gjszcdList" :key="item.cod" :label="formatLabel(item)" :value="item.cod">
              </el-option>
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="外汇局批件号/备案表号/业务编号" prop="jsdgrp.rec.regno" :rules="[{required: regnoRequired == 'Y'}]">
            <c-input v-model="model.jsdgrp.rec.regno" maxlength="20" placeholder="请输入外汇局批件号/备案表号/业务编号"></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="适用业务类型" prop="jsdgrp.appbt">
            <c-select v-model="model.jsdgrp.appbt" style="width:100%" placeholder="请输入适用业务类型" dbCode="CTRTYE" uil="CN" sort="SRT" :filterKey="['01','02','03','04','05','06','07','08','09','10']">
            </c-select>
          </el-form-item>
        </c-col>
        
      </c-col>

      <!-- ============右边================= -->
      <c-col :span="12" style="padding-left: 20px">
        <c-col :span="24">
          <el-card class="box-card">
            <c-ptap :model="model" :disabledExtkey="false" :disabled="false" :isAdrblk="true" :haveAdrLabel="true"
              :isShowCard="false" :argadr="{title: '申请人',grp: 'jsdgrp', rol: 'apl',}"
              :label="{labelExtkey:'申请人',labelNam:'名称',labelAdrblk:'地址'}" :requiredExtkey="true" :requiredNam="true"
              @handleChange="aplChange()" ptytyp="C">
            </c-ptap>
          </el-card>
        </c-col>
        <c-col :span="24" style="margin-top:-6px;">
          <el-form-item label="客户选择" prop="jsdgrp.rec.khwtxz">
            <c-select v-model="model.jsdgrp.rec.khwtxz" dbCode="KHWTXZ" uil="EN" sort="SRT" style="width:100%"
              placeholder="请选择客户选择" @change="khwtxzChange()" :disabled="model.jsdgrp.rec.shfobz == '0'">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <c-col :span="24" class="custom-box-wrap">
            <div style="width: 200px;">
              <el-form-item label="银行卖出金额" prop="jsdgrp.cbs.max2.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == ''">
                <c-select-cur v-model="model.jsdgrp.cbs.max2.cur" dbCode="curtxt" style="width: 100%"
                  :isShowKeyAndLabel="true" placeholder="请选择卖出币种"></c-select-cur>
              </el-form-item>
              <el-form-item label="银行卖出金额" prop="jsdgrp.cbs.max2.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == '4'">
                <c-select-cur v-model="model.jsdgrp.cbs.max2.cur" dbCode="curtxt" style="width: 100%" disabled
                  :isShowKeyAndLabel="true" :filterKey="['CNY']" placeholder="请选择卖出币种"></c-select-cur>
              </el-form-item>
              <el-form-item label="银行卖出金额" prop="jsdgrp.cbs.max2.cur" previewLabel="币种"
                v-if="model.jsdgrp.rec.maimpz == '5'">
                <c-select-cur v-model="model.jsdgrp.cbs.max2.cur" dbCode="curtxt" style="width: 100%"
                  placeholder="请选择卖出币种" :isShowKeyAndLabel="true" :expKey="['CNY']" @change="max2CurChange()">
                </c-select-cur>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 200px);">
              <el-form-item previewLabel="银行卖出金额" label-width="5px" prop="jsdgrp.cbs.max2.amt">
                <c-input-currency :currency="model.jsdgrp.cbs.max2.cur" v-model="model.jsdgrp.cbs.max2.amt"
                  :maxlength="18" style="width:100%;" placeholder="请输入银行卖出金额" @blur="max2AmtBlur()"
                  :disabled="model.jsdgrp.rec.pngcfx == '0'"></c-input-currency>
              </el-form-item>
            </div>
          </c-col>
        </c-col>
        <c-col :span="24">
          <c-col :span="24" class="custom-box-wrap">
            <div style="width: 300px;">
              <el-form-item label="银行卖出账号" prop="jsdgrp.rec.czhtyp">
                <c-select v-model="model.jsdgrp.rec.czhtyp" maxlength="21" placeholder="请选择账户类型" dbCode="ACTTYP"
                  uil="EN" sort="SRT" :filterKey="['AR','SP','TP','LO']" @change="czhtypChange()"></c-select>
              </el-form-item>
            </div>
            <div style="width: calc(100% - 355px);">
              <el-form-item prop="jsdgrp.rec.zhangh" label-width="5px">
                <c-select v-model="model.jsdgrp.rec.zhangh" maxlength="21" placeholder="请选择银行卖出账号"
                  @change="zhanghChange()">
                  <el-option v-for="item in zhanghList" :key="item" :label="item" :value="item">
                  </el-option>
                </c-select>
              </el-form-item>
            </div>
            <div style="width: 55px;">
              <el-form-item label-width="10px">
                <c-button style="margin: 0 0" size="small" type="primary"
                  @click="getCoreAccountInfo(model.jsdgrp.rec.zhangh,model.jsdgrp.cbs.max2.cur)">
                  详情
                </c-button>
              </el-form-item>
            </div>
          </c-col>
        </c-col>
        <c-col :span="24">
          <el-form-item label="当前牌价" prop="jsdgrp.rec.weithl" style="width: 100%" v-if="model.jsdgrp.rec.shfobz == '0'">
            <c-fullbox>
              <c-input-currency :precision='6' v-model="model.jsdgrp.rec.weithl" placeholder="请输入当前牌价"
                :disabled="model.jsdgrp.rec.khwtxz != '2'" @blur="weithlBlur()"></c-input-currency>
              <template slot="footer">
                <c-button style="margin-left:10px; padding: 0 12px; height: 32px" size="small" type="primary"
                  @click="getRelRate()">更新牌价
                </c-button>
              </template>
            </c-fullbox>
          </el-form-item>
          <el-form-item label="当前牌价" prop="jsdgrp.rec.weithl" v-if="model.jsdgrp.rec.shfobz == '1'">
            <c-input-currency :precision='6' v-model="model.jsdgrp.rec.weithl" placeholder="请输入当前牌价"
              :disabled="model.jsdgrp.rec.khwtxz != '2'" @blur="weithlBlur()"></c-input-currency>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="交易成交汇率" prop="jsdgrp.rec.jqmrhl">
            <c-fullbox>
              <c-input-currency :precision='6' v-model="model.jsdgrp.rec.jqmrhl" disabled></c-input-currency>
              <template slot="footer">
                <el-tooltip effect="dark" content="交易成交汇率=参考买入价+优惠基点" placement="top" size="large"
                  v-if="model.jsdgrp.rec.yohulx == '1' && model.jsdgrp.rec.maimpz == '4'">
                  <i class="el-icon-info" />
                </el-tooltip>
                <el-tooltip effect="dark" content="交易成交汇率=买入价+((中间价-买入价)*买入优惠比例)/100" placement="top" size="large"
                  v-if="model.jsdgrp.rec.yohulx == '2' && model.jsdgrp.rec.maimpz == '4'">
                  <i class="el-icon-info" />
                </el-tooltip>
                <el-tooltip effect="dark" content="交易成交汇率=参考卖出价-优惠基点" placement="top" size="large"
                  v-if="model.jsdgrp.rec.yohulx == '1' && model.jsdgrp.rec.maimpz == '5'">
                  <i class="el-icon-info" />
                </el-tooltip>
                <el-tooltip effect="dark" content="交易成交汇率=卖出价-((卖出价-中间价)*卖出优惠比例)/100" placement="top" size="large"
                  v-if="model.jsdgrp.rec.yohulx == '2' && model.jsdgrp.rec.maimpz == '5'">
                  <i class="el-icon-info" />
                </el-tooltip>
              </template>
            </c-fullbox>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="对方客户类别" prop="jsdgrp.rec.dfkhlb">
            <c-select v-model="model.jsdgrp.rec.dfkhlb" dbCode="TRNMAN" uil="EN" sort="SRT" :disabled="dfkhlbDisabled()"
              :filterKey="['01','02','03','04','05','06']" style="width:100%" placeholder="请选择对方客户类别">
            </c-select>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="收益机构" prop="jsdgrp.rec.ruzhjg">
            <c-input v-model="model.jsdgrp.rec.ruzhjg" maxlength="4" disabled></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="分行经办联系电话" prop="jsdgrp.rec.dianhh">
            <c-input v-model="model.jsdgrp.rec.dianhh" maxlength="20" placeholder="请输入分行经办联系电话"></c-input>
          </el-form-item>
        </c-col>

      </c-col>
    </c-col>
  </div>
</template>
<script>
  import event from "../event";
  import Default from "../model/default";
  export default {
    inject: ["root"],
    props: ["model", "codes"],
    mixins: [event, Default],
    data() {
      return {
        waitjmFilterKey: [],
        gjszcdFilterKey: [],
        zha1zhList: [],
        zhanghList: [],
        regnoRequired: '',
      };
    },
    created() {

    },
    mounted() {

    },

  };
</script>
<style>
</style>