index.js 6.2 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
import commonFunctions from '~/mixin/commonFunctions.js';
import moment from 'moment';
import Utils from "~/utils/index";
import Pts from '~/components/business/commonModel/Pts';
import Api from "~/service/Api";
import BigNumber from "bignumber.js";
import { cloneDeep } from "lodash";


export default {
	mixins: [commonFunctions],
	methods: {
    SetModule() {
      if(this.model.dedgrp.rec.rejame=='RJCT'){
        this.model.olddedgrp.rec.rejame='RJCT';
        this.model.olddedgrp.blk.rejamersn='';
        this.model.dedgrp = cloneDeep(this.model.olddedgrp)
        this.model.swiadd.ameamt = 0.00;
        this.model.swiadd.newamt = this.model.olddedgrp.cbs.nom1.amt;
        this.model.swiadd.newnomtopame = this.model.dedgrp.rec.nomtop;
        this.model.swiadd.newnomtoname = this.model.dedgrp.rec.nomton;
        this.model.swiadd.newexpdat = null;
        this.model.swiadd.newshpdat = null;
        this.model.detamep.hwmsupdate ="";
        this.model.detamep.djyqupdate ="";
        this.model.detamep.fjtkupdate ="";
        this.model.detamep.zsupdate ="";
        this.model.swiadd.lcrgod = '';
        this.model.swiadd.lcrdoc = '';
        this.model.swiadd.adlcnd = '';
        this.model.swiadd.insbnk = '';
        this.defaultEngamtAndNewMaxmat();
        this.smallToBig();
        this.newnomtopameChange();
      }
      if(this.model.dedgrp.rec.rejame=='ACPT'){
        this.model.olddedgrp.rec.rejame='ACPT';
        this.model.olddedgrp.blk.rejamersn='';
        this.model.dedgrp = cloneDeep(this.model.olddedgrp)
        this.model.detamep = cloneDeep(this.model.initData.olddetamep)
        this.model.swiadd = cloneDeep(this.model.initData.oldswiadd)
        if (this.model.spt.channel== 'ELC' || this.model.spt.channel == 'YPT') {
        }else{
          this.model.swiadd.newamt = this.model.olddedgrp.cbs.nom1.amt;
        }
        this.newAmtChange();
        this.newnomtopameChange();
      }
  },
    OnAvbby(){
      let modifyList = this.model.dedgrp.blk.modifySet
      if(this.model.dedgrp.rec.avbby =='P'  ){
        this.model.dedgrp.rec.tenmaxday = 0
      }
      if(this.model.dedgrp.rec.avbby !='D'){
        this.model.dedgrp.blk.defdet =""
      }
      if(this.model.dedgrp.rec.avbby =='P' || this.model.dedgrp.rec.avbby =='N'){
        if(this.model.dedgrp.rec.avbby =='P'){
          if (!modifyList || (!!modifyList && !modifyList.includes('dftat'))) {
            this.model.dedgrp.blk.dftat="即期"
          }
        }
      }else{
        this.model.dedgrp.blk.dftat =""
      }
    },
    async OnRejflg(){
      if(this.model.dedgrp.rec.rejflg =="ADRE" && !this.model.detp.dzlhhh){
        let ptainr = this.model.dedgrp.ben.pts.ptainr;
        const loading = this.loading();
        let res = await Api.post(`/Domlc/detopnRule/getDzlhhh?ptainr=${ptainr}`);
        if (res.respCode == SUCCESS) {
          loading.close();
          this.model.detp.dzlhhh = res.data;
        } else {
          loading.close();
        }
      }
      if(this.model.dedgrp.rec.rejflg!="ADRE"){
        this.model.dedgrp.blk.rejadvrsn = ""
        this.model.detp.dzlhhh = ""
      }
    },
    OnIsyifu(){
      if(this.model.dedgrp.rec.isyifu != 'Y' ){
        this.model.dedgrp.rec.avbwth = ""
        this.model.dedgrp.avb.pts.bankno = ""
        this.model.dedgrp.avb.pts.jigomc = ""
        this.model.dedgrp.avb.pts.dizhii = ""
      }
    },
    avbwthChange() {
      switch (this.model.dedgrp.rec.avbwth) {
        case "A":
          Utils.copyValueFromVoData(this.model.dedgrp.avb.pts, this.model.dedgrp.adv.pts);
          this.model.dedgrp.avb.pts.rol = "AVB";
          break;
        case "T":
          Utils.copyValueFromVoData(this.model.dedgrp.avb.pts, this.model.dedgrp.cmb.pts);
          this.model.dedgrp.avb.pts.rol = "AVB";
          break;
        case "I":
          Utils.copyValueFromVoData(this.model.dedgrp.avb.pts, this.model.dedgrp.iss.pts);
          this.model.dedgrp.avb.pts.rol = "AVB";
          break;
        case "C":
          Utils.copyValueFromVoData(this.model.dedgrp.avb.pts, this.model.dedgrp.rmb.pts);
          this.model.dedgrp.avb.pts.rol = "AVB";
          break;
        default:
          this.model.dedgrp.avb.pts = new Pts().data;
          this.model.dedgrp.avb.pts.rol = "AVB";
          break;
      }
    },
    OnBdflg(){
      if(this.model.dedgrp.rec.bdflg != 'Y' ){
        this.model.dedgrp.rmb.pts.bankno = ""
        this.model.dedgrp.rmb.pts.jigomc = ""
        this.model.dedgrp.rmb.pts.dizhii = ""
      }
    },
    OnShppar(){
      if(this.model.dedgrp.rec.shppar!='ALWD' ){
        this.model.dedgrp.rec.fqzytgfw = "";
        this.model.dedgrp.rec.fqtime = ""
      }
    },
    OnFqzytgfw(){
      if(this.model.dedgrp.rec.fqzytgfw!='Y' ){
      this.model.dedgrp.rec.fqtime = ""
      }
    },
    OnTratyp(){
      if(this.model.dedgrp.rec.tratyp=='08' || this.model.dedgrp.rec.mytype=='F' ){
        }else{
          this.model.dedgrp.rec.sdsrfs = ""
        }
    },
    OnMytype(){
      let modifyList = this.model.dedgrp.rec.modifySet
      if(this.model.dedgrp.rec.mytype=='F'){
        if (!modifyList || (!!modifyList && !modifyList.includes('stagod'))) {
          this.model.dedgrp.rec.stagod = '099'
        }
        this.model.dedgrp.rec.shptrs = "";
        this.model.dedgrp.rec.shpfro = "";
        this.model.dedgrp.rec.shpto = "";
        this.model.dedgrp.rec.tratyp = "";
      }else{
        if (!modifyList || (!!modifyList && !modifyList.includes('stagod'))) {
        this.model.dedgrp.rec.stagod = ''
        }
      }
      if(this.model.dedgrp.rec.mytype=='H'){
        this.model.dedgrp.rec.shppro = "";
      }
    },
    ameAmtChange() {
			this.model.swiadd.newamt = new BigNumber(this.model.olddedgrp.cbs.nom1.amt).plus(new BigNumber(this.model.swiadd.ameamt));
      this.model.dedgrp.cbs.nom1.amt = this.model.swiadd.newamt;
      if(new BigNumber(this.model.swiadd.ameamt).comparedTo(new BigNumber(0))!=0){
				this.customAddModify(this.model.swiadd, 'ameamt');
				this.customAddModify(this.model.swiadd, 'newamt');
			}
			if(new BigNumber(this.model.olddedgrp.cbs.nom1.amt).comparedTo(new BigNumber(this.model.dedgrp.cbs.nom1.amt))!=0){
				this.customAddModify(this.model.dedgrp.cbs.nom1, 'amt');
			}
      this.defaultEngamtAndNewMaxmat();
      this.smallToBig();
		},
	}
}