index.js 3.43 KB
import commonFunctions from '~/mixin/commonFunctions.js';
export default {
	mixins: [commonFunctions],
	methods: {
		// 业务信息=》基本信息=》保函编号-----获取保函编号
		queryOwnref () {
      let params = this.model.nidgrp.rec
      if (!this.model.nidgrp.apl.pts.ptainr) {
        return
      }
      let ptainr = this.model.nidgrp.apl.pts.ptainr;
      const loading = this.loading();
      Api.post(`/business/ref/nid?ptaInr=${ptainr}`, params).then(res => {
				loading.close();
        if (res.respCode == SUCCESS) {
          this.model.nidgrp.rec.ownref = res.data;
        }
      }).catch(() => {
        loading.close();
      });
		},
		defaultNidgrpRecExpdatN1002(val){
			if(val == 'N'){
				this.model.nidgrp.rec.expdat = this.model.nidgrp.rec.olddat;
			}
    },
    // 减额接受
		changeAccp(date) {
      if(this.isInDisplay){
        return;
      }
			if(this.model.nidgrp.rec.fingua=='Y') {
				// 对外担保
				if(this.model.cfagit.recgrp != null && this.model.cfagit.recgrp.bas.exguarancode != null || this.model.cfagit.recgrp.bas.exguarancode != '') {
					if(this.model.cfagit.recgrp.bas.exguarancode) {
						this.model.cfagit.cfaflg = '2';
						if(this.model.nidgrp.rec.expdat) {
							this.model.cfagit.recgrp.bas.maturity = this.model.nidgrp.rec.expdat;
						} else {
              this.model.cfagit.recgrp.bas.maturity = moment(this.model.cfagit.recgrp.bas.contractdate).add(20, "years").format("YYYY-MM-DD");
            }			
						this.model.cfagit.recgrp.bas.actiontype = 'C';
            this.model.cfagit.basflg = 'X';
            if(this.model.cfagit.recgrp.dcl == null || this.model.cfagit.recgrp.dcl.length == 0) {
              var a = [{
                exguarancode: "",
                actiontype: "",
                wabachandate: "",
                basere: "",
                remark: "",
                actiondesc: "",
                acp: "",
              }];
              this.model.cfagit.recgrp.dcl = a;
            }
						if(this.model.ameamt) {
              this.model.cfagit.dclflg = 'X';
              this.model.cfagit.recgrp.dcl[0].actiontype = 'A';
              this.model.cfagit.recgrp.dcl[0].wabachandate = moment(new Date()).format('YYYY-MM-DD');
              this.model.cfagit.recgrp.bas.guaranamount = Number(this.model.nidgrp.cbs.max.amt) + Number(this.model.ameamt);
              this.model.cfagit.recgrp.dcl[0].basere = Number(this.model.nidgrp.cbs.max.amt) + Number(this.model.ameamt);
              this.model.cfagit.recgrp.dcl[0].exguarancode = this.model.cfagit.recgrp.bas.exguarancode;
              this.model.cfagit.recgrp.dcl[0].acp = 'X';
						} else {
							this.model.cfagit.dclflg = '';
            }
					}
				}
				// 人民币
				if(this.model.rmbbop.rmb2122.recgrp.ads.levyno != null && this.model.rmbbop.rmb2122.recgrp.ads.levyno != "") {
					if(this.model.rmbbop.rmb2122.recgrp.ads.levyno) {
            this.model.rmbbop.rmb2122.rmbflg = '1';
						this.model.rmbbop.rmb2122.recgrp.ads.opertype = '2';
						this.model.rmbbop.rmb2122.recgrp.ads.vouchamt = Number(this.model.nidgrp.cbs.max.amt) + Number(this.model.ameamt);
						if(this.model.nidgrp.rec.expdat) {
							this.model.rmbbop.rmb2122.recgrp.ads.vouchenddate = this.model.nidgrp.rec.expdat;
						} else {
              this.model.rmbbop.rmb2122.recgrp.ads.vouchenddate = moment(this.model.rmbbop.rmb2122.recgrp.ads.vouchefficientdate).add(20, "years").format("YYYY-MM-DD");
            }
					}
				}
			}
		},
	},
};