Utlp.vue 12.6 KB
<template>
  <div class="eibs">
    <c-row>
      <!-- ====================左边======================= -->
      <c-col :span="12" style="padding-right: 20px">
        <c-col :span="24" class="custom-box-wrap">
          <el-form-item label="Amount Settled" prop="setmod.doccur">
            <c-select-cur disabled v-model="model.setmod.doccur" style="width: 115px" dbCode="curtxt"> </c-select-cur>
          </el-form-item>
          <div class="box-3">
            <el-form-item label-width="5px" prop="setmod.docamt">
              <c-input-currency
                :currency="model.setmod.doccur"
                v-model="model.setmod.docamt"
                @change="onDocamtChange"></c-input-currency>
            </el-form-item>
          </div>
        </c-col>

        <c-col :span="24" class="custom-box-wrap">
          <el-form-item label="Reduction Amt." prop="setmod.doccur">
            <c-select-cur disabled v-model="model.setmod.doccur" style="width: 115px" dbCode="curtxt"> </c-select-cur>
          </el-form-item>
          <div class="box-3">
            <el-form-item label-width="5px" prop="setmod.redamt">
              <c-input-currency
                :disabled="this.model.brdgrp.rec.frepayflg != null && this.model.brdgrp.rec.frepayflg != ''"
                :currency="model.setmod.doccur"
                v-model="model.setmod.redamt"
                @change="onDocamtChange"></c-input-currency>
            </el-form-item>
          </div>
        </c-col>
        <c-col :span="24" class="custom-box-wrap">
          <el-form-item label="Reduced Amt. Settled" prop="setmod.doccur">
            <c-select-cur disabled v-model="model.setmod.doccur" style="width: 115px" dbCode="curtxt"> </c-select-cur>
          </el-form-item>
          <div class="box-3">
            <el-form-item label-width="5px" prop="setmod.setamt">
              <c-input-currency
                disabled
                :currency="model.setmod.doccur"
                v-model="model.setmod.setamt"></c-input-currency>
            </el-form-item>
          </div>
        </c-col>

        <c-col :span="24" class="custom-box-wrap">
          <el-form-item label="Doc. Amount Part" prop="setmod.doccur">
            <c-select-cur disabled v-model="model.setmod.doccur" style="width: 115px" dbCode="curtxt"> </c-select-cur>
          </el-form-item>
          <div class="box-3">
            <el-form-item label-width="5px" prop="aamset.utlamt">
              <c-input-currency
                :disabled="this.model.brdgrp.cbs.opn2.amt == null || this.model.brdgrp.cbs.opn2.amt == 0"
                :currency="model.setmod.doccur"
                v-model="model.aamset.utlamt"
                @change="onUtlamtChange"></c-input-currency>
            </el-form-item>
          </div>
        </c-col>

        <c-col :span="24" class="custom-box-wrap">
          <el-form-item label="Add. Amount Part" prop="setmod.doccur">
            <c-select-cur disabled v-model="model.setmod.doccur" style="width: 115px" dbCode="curtxt"> </c-select-cur>
          </el-form-item>
          <div class="box-3">
            <el-form-item label-width="5px" prop="aamset.utlamt2">
              <c-input-currency
                :disabled="
                  (this.model.brdgrp.cbs.opn2.amt == null || this.model.brdgrp.cbs.opn2.amt == 0) &&
                  (this.model.aamset.amt2okflg == null || this.model.aamset.amt2okflg == '')
                "
                :currency="model.setmod.doccur"
                v-model="model.aamset.utlamt2"
                @change="onUtlamt2Change"></c-input-currency>
            </el-form-item>
          </div>
        </c-col>
      </c-col>
      <!-- ====================右边======================= -->
      <c-col :span="12" style="padding-left: 20px">
        <c-col :span="12">
          <el-form-item>
            <c-checkbox
              v-model="model.trtcre.crefinflg"
              true-label="X"
              false-label=""
              class="checkbox-left"
              :disabled="model.paypsb != '' || model.brdgrp.rec.frepayflg != '' ? true : false"
              @change="onCrefinflgChange"
              >Create Financing</c-checkbox
            >
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item>
            <c-checkbox
              v-model="model.dftcre.dfflag"
              true-label="X"
              false-label=""
              class="checkbox-left"
              :disabled="model.trtcre.crefinflg !== 'X'"
              >委托方代付</c-checkbox
            >
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item>
            <c-checkbox
              true-label="X"
              false-label=""
              v-model="model.paypsb"
              class="checkbox-left"
              :disabled="this.model.brdgrp.rec.frepayflg != null && this.model.brdgrp.rec.frepayflg != ''"
              @change="onPaypsbChange"
              >Unpaid by Applicant</c-checkbox
            >
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item>
            <c-checkbox
              true-label="X"
              false-label=""
              v-model="model.brdgrp.rec.frepayflg"
              class="checkbox-left"
              @change="onFrepayflgChange"
              >Free of Payment</c-checkbox
            >
          </el-form-item>
        </c-col>
        <c-col :span="12" class="">
          <el-form-item label=" " prop="clsflg" label-width="180px" style="float: left">
            <c-checkbox
              :disabled="this.model.disabledClsflg === 'Y'"
              v-model="model.clsflg"
              true-label="C"
              false-label="O"
              >Close Contract</c-checkbox
            >
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item label="Contract No." prop="brdgrp.rec.rptref">
            <c-input v-model="model.brdgrp.rec.rptref" maxlength="25" placeholder="请输入合同号"></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="Invoice No." prop="brdgrp.rec.invref">
            <c-input v-model="model.brdgrp.rec.invref" maxlength="35" placeholder="请输入发票号"></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="24">
          <el-form-item label="是否需要核验" prop="brtp.ischktyp">
            <c-select v-model="model.brtp.ischktyp" style="width: 100%" placeholder="" dbCode="RMB17"> </c-select>
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item
            label="预计核验日期"
            prop="brtp.prechkdat"
            :rules="[{ required: this.model.brtp.ischktyp == 'Y', message: '必输项' }]">
            <c-date-picker
              type="date"
              v-model="model.brtp.prechkdat"
              style="width: 100%"
              placeholder="请选择预计核验日期"
              :disabled="model.brtp.ischktyp != 'Y'"></c-date-picker>
          </el-form-item>
        </c-col>

        <c-col :span="24">
          <el-form-item label="Narrative of incoming MT754, tag :77A:" prop="nar754">
            <c-input
              type="textarea"
              v-model="model.nar754"
              maxlength="700"
              show-word-limit
              placeholder="请输入77A字段内容"></c-input>
          </el-form-item>
        </c-col>
      </c-col>
    </c-row>
  </div>
</template>
<script>
import event from "../event";
import BigNumber from "bignumber.js";
export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  data() {
    return {
      flag4: true,
      flag3: true,
      cmtflg: [
        { label: "代理行模式", value: "C" },
        { label: "其他", value: "O" },
        { label: "CIPS系统", value: "P" },
      ],
      table1: [],
      columns: [
        '1 1 "类型" 80',
        '2 2 "债务方" 100',
        '3 3 "债券方" 100',
        '4 4 "币种" 80',
        '5 5 "金额" 85 2 8 1 4',
        '6 6 "到期日" 105 4 7 1',
      ],
      trnData: {
        columns: [
          '0 1 "" 100',
          '1 2 "Type" 100',
          '2 3 "Dbt" 100',
          '3 4 "Cdt" 100',
          '4 5 "Cur" 100',
          '5 6 "Amt" 100',
          '6 7 "Mat.Dat." 350',
        ],
      },
    };
  },
  methods: {
    initUtlp() {
      this.onDocamtChange();
      this.onFrepayflgChange();
    },
    onPaypsbChange() {
      if (this.model.paypsb === "X") {
        this.model.trtcre.crefinflg = "";
      }
    },
    onCrefinflgChange() {
      if (this.model.trtcre.crefinflg !== "X") {
        this.model.dftcre.dfflag = "";
      }
    },
    onFrepayflgChange() {
      if (this.model.brdgrp.rec.frepayflg != null && this.model.brdgrp.rec.frepayflg != "") {
        this.model.paypsb = "";
        this.model.trtcre.crefinflg = "";
        this.model.setmod.redamt = this.model.setmod.docamt;
        this.onDocamtChange();
        // 清空清算模式字段
        this.model.cmtflg = "";
        this.model.swftyp = "";
        this.model.brdgrp.rec.docsta = "N";
      } else {
        this.model.setmod.redamt = 0;
        this.onDocamtChange();
        if (this.model.brdgrp.cbs.max.cur == "CNY") {
          this.model.cmtflg = "P";
          this.model.swftyp = "CIV";
        } else {
          this.model.cmtflg = "C";
          this.model.swftyp = "";
        }
      }
    },
    getBigNumber() {
      // 配置BigNumber计算规则为保留两位小数,并四舍五入
      var BN = BigNumber.clone();
      BN.config({ DECIMAL_PLACES: 2, ROUNDING_MODE: 4 });
      return BN;
    },
    onUtlamt2Change() {
      var BN = this.getBigNumber();
      this.model.aamset.utlamt = BN(this.model.setmod.docamt).minus(this.model.aamset.utlamt2).toFixed(2);
    },
    onUtlamtChange() {
      var BN = this.getBigNumber();
      this.model.aamset.utlamt2 = BN(this.model.setmod.docamt).minus(this.model.aamset.utlamt).toFixed(2);
    },

    onDocamtChange() {
      var BN = this.getBigNumber();
      this.model.setmod.setamt = BN(this.model.setmod.docamt).minus(this.model.setmod.redamt).toFixed(2);
      if (Number(this.model.brdgrp.cbs.opn2.amt) === 0) {
        if (this.model.aamset.amt2okflg === null || this.model.aamset.amt2okflg === "") {
          this.model.aamset.utlamt2 = "0.00";
        }
        this.model.aamset.utlamt = BN(this.model.setmod.setamt).minus(this.model.aamset.utlamt2).toFixed(2);
      } else {
        let totamt = BN(this.model.brdgrp.cbs.opn1.amt).plus(this.model.brdgrp.cbs.opn2.amt).toFixed(2);
        this.model.aamset.utlamt2 = BN(this.model.setmod.setamt)
          .multipliedBy(this.model.brdgrp.cbs.opn2.amt)
          .div(totamt)
          .toFixed(2);
        this.model.aamset.utlamt = BN(this.model.setmod.setamt).minus(this.model.aamset.utlamt2).toFixed(2);
      }
      // 试算表外,判断clsflg标志
      let tmpclsflg = true;
      if (this.model.brdgrp.rec.rcvdat !== "") {
        this.root.$refs.engps.initEngp(this.root.buildCommonData(this.model, this.root.trnName)).then(async () => {
          this.model.liaall.liaallg.forEach((vo) => {
            if (vo.bussec === "BR" && Number(vo.amt) !== -Number(vo.oldamt)) {
              tmpclsflg = false;
            }
          });
          if (tmpclsflg) {
            this.model.clsflg = "C";
            this.model.disabledClsflg = "N";
          } else {
            this.model.clsflg = "O";
            this.model.disabledClsflg = "Y";
          }
        });
      } else {
        this.model.clsflg = "O";
        this.model.disabledClsflg = "Y";
      }
    },
    onDocamtChangeForWatch() {
      var BN = this.getBigNumber();
      this.model.setmod.setamt = BN(this.model.setmod.docamt).minus(this.model.setmod.redamt).toFixed(2);
      if (Number(this.model.brdgrp.cbs.opn2.amt) === 0) {
        if (this.model.aamset.amt2okflg === null || this.model.aamset.amt2okflg === "") {
          this.model.aamset.utlamt2 = "0.00";
        }
        this.model.aamset.utlamt = BN(this.model.setmod.setamt).minus(this.model.aamset.utlamt2).toFixed(2);
      } else {
        let totamt = BN(this.model.brdgrp.cbs.opn1.amt).plus(this.model.brdgrp.cbs.opn2.amt).toFixed(2);
        this.model.aamset.utlamt2 = BN(this.model.setmod.setamt)
          .multipliedBy(this.model.brdgrp.cbs.opn2.amt)
          .div(totamt)
          .toFixed(2);
        this.model.aamset.utlamt = BN(this.model.setmod.setamt).minus(this.model.aamset.utlamt2).toFixed(2);
      }
    },
  },
  computed: {},
  created: function () {},
  watch: {
    "model.setmod.docamt": {
      immediate: false,
      handler(val, oldval) {
        this.onDocamtChangeForWatch();
      },
    },
  },
};
</script>
<style></style>