<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="bfdgrp.blk.docdis">
						<c-mul-row-input :disabled="model.bfdgrp.blk.docdisflg!='X'" type="textarea" v-model="model.bfdgrp.blk.docdis" :cols="50" :rows="70" :autosize="{ minRows: 8, maxRows: 8}"  placeholder="请输入"></c-mul-row-input>
					</el-form-item>
				</c-col>
      <c-col :span="24" v-show="false">
        <el-form-item label="不符点">
          <c-input type="textarea" :rows="8" v-model="docdistxt" maxlength="3500" show-word-limit></c-input>
        </el-form-item>
      </c-col>

				<c-col :span="24">
					<el-form-item label="内部不符点" prop="bfdgrp.blk.intdis">
						<c-mul-row-input type="textarea" v-model="model.bfdgrp.blk.intdis" :cols="65" :rows="20" :autosize="{ minRows: 8, maxRows: 8}" placeholder="请输入"></c-mul-row-input>
					</el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item label="注释和结论" prop="bfdgrp.blk.comcon">
						<c-mul-row-input  type="textarea" v-model="model.bfdgrp.blk.comcon" :cols="65" :rows="20" :autosize="{ minRows: 8, maxRows: 8}" placeholder="请输入"></c-mul-row-input>
					</el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item label="结算指示" prop="bfdgrp.blk.setinsbe">
						<c-mul-row-input type="textarea" v-model="model.bfdgrp.blk.setinsbe" :cols="65" :rows="6" :autosize="{ minRows: 6, maxRows: 6}" placeholder="请输入"></c-mul-row-input>
					</el-form-item>
				</c-col>
			</c-col>

			<!-- ============右边================= -->
			<c-col :span="12" style="padding-left: 20px">
      <c-col :span="24">
				<el-form-item class="checkbox-left">
					<c-checkbox true-label="X" false-label="" v-model="model.bfdgrp.blk.igndisflg" >忽略不符点</c-checkbox>
				</el-form-item>
			</c-col>

				<c-col :span="24">
					<el-form-item class="checkbox-left">
						<c-checkbox true-label="X" false-label="" v-model="model.bfdgrp.blk.docdisflg">录入不符点</c-checkbox>
					</el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item label="寄单状态" prop="bftp.folwupopt">
						<c-select v-model="model.bftp.folwupopt" dbCode="WUPOPT" :filterKey="['C','A','W','B']" style="width:100%" placeholder="请输入">
						</c-select>
					</el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item class="checkbox-left">
						<c-checkbox true-label="X" false-label="" v-model="model.bfdgrp.rec.approvcod">直接不符点寄单</c-checkbox>
					</el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item label="扣减金额" prop="bfdgrp.rec.lescom">
              <c-input-currency  v-model="model.bfdgrp.rec.lescom" placeholder="请输入扣减金额"></c-input-currency>
          </el-form-item>
				</c-col>

				<c-col :span="24">
					<el-form-item label="是否议付" prop="yf">
						<c-select v-model="model.yf"  dbCode="yfcode" style="width:100%" placeholder="请输入"></c-select>
					</el-form-item>
				</c-col>

        <c-col :span="24">
          <el-form-item label="信用证编号" prop="dedgrp.rec.kzref">
            <c-input  v-model="model.dedgrp.rec.kzref" maxlength="35" placeholder="请输入"></c-input>
          </el-form-item>
        </c-col>
			</c-col>
		</c-col>
	</div>
</template>
<script>
import event from "../event";
import moment from "moment";
import BigNumber from "bignumber.js";
export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  data() {
    return {};
  },
  created() {},
  computed: {
    docdistxt: {
      get() {
        let descr = "";
        let cr = "\n";
        if (this.isInDisplay) {
          return this.model.bfdgrp.blk.docdis;
        }
        if (
          this.model.bfdgrp.blk.modifySet &&
          this.model.bfdgrp.blk.modifySet.includes("docdis")
        ) {
          return this.model.bfdgrp.blk.docdis;
        }
        if (
          this.model.bfdgrp.rec.shpdat != null &&
          this.model.bfdgrp.rec.shpdat != "" &&
          this.model.dedgrp.rec.shpdat != null &&
          this.model.dedgrp.rec.shpdat != ""
        ) {
          if (
            moment(this.model.bfdgrp.rec.shpdat).diff(
              moment(this.model.dedgrp.rec.shpdat),
              "days"
            ) > 0
          ) {
            descr = descr + "Late shipment." + cr;
          }
        }
        if (
          this.model.bfdgrp.rec.rcvdat != null &&
          this.model.bfdgrp.rec.rcvdat != "" &&
          this.model.dedgrp.rec.expdat != null &&
          this.model.dedgrp.rec.expdat != ""
        ) {
          if (
            moment(this.model.bfdgrp.rec.rcvdat).diff(
              moment(this.model.dedgrp.rec.expdat),
              "days"
            ) > 0
          ) {
            descr = descr + "Documents received after expiry of the LC." + cr;
          }
        }
        if (new BigNumber(this.model.dedgrp.cbs.opn1.amt)< 0) {
          descr =
            descr +
            "The LC is overdrawn by " +
            this.model.bfdgrp.cbs.max.cur +
            " " +
            new BigNumber(this.model.dedgrp.cbs.opn1.amt) +
            cr;
        }
        if (
          this.model.dedgrp.rec.shppar == "NALW" &&
          this.model.dedgrp.rec.utlnbr >= 1
        ) {
          descr = descr + "Partial shipment effected." + cr;
        }
        if (this.model.bfdgrp.rec.doctypcod == "P") {
          if (
            this.model.dedgrp.rec.avbby == "A" ||
            this.model.dedgrp.rec.avbby == "D"
          ) {
            descr = descr + "Sight draft presented in stead of Usance." + cr;
          }
          if (this.model.dedgrp.rec.avbby == "M") {
            descr =
              descr +
              "Only Sight draft presented instead of mixed payment." +
              cr;
          }
        }
        if (
          this.model.bfdgrp.rec.doctypcod == "A" ||
          this.model.bfdgrp.rec.doctypcod == "D"
        ) {
          if (this.model.dedgrp.rec.avbby == "P") {
            descr = descr + "Usance draft presented instead of Sight." + cr;
          }
          if (this.model.dedgrp.rec.avbby == "M") {
            descr =
              descr +
              "Only Usance drafts presented instead of mixed payment." +
              cr;
          }
        }
        if (this.model.bfdgrp.rec.doctypcod == "M") {
          if (this.model.dedgrp.rec.avbby == "P") {
            descr =
              descr +
              "Mixed payment drafts presented instead of sight." +
              cr;
          }
          if (
            this.model.dedgrp.rec.avbby == "A" ||
            this.model.dedgrp.rec.avbby == "D"
          ) {
            descr =
              descr +
              "Mixed payment drafts presented instead of usance." +
              cr;
          }
        }
        this.model.bfdgrp.blk.docdis = descr;
        return descr;
      },
      set(newVal) {
        return newVal;
      }
    }

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