import commonFunctions from '~/mixin/commonFunctions.js';
import Api from '~/service/Api';
import BigNumber from "bignumber.js";

export default {
    mixins: [commonFunctions],
    methods: {
			 // 获取地区机构号
			 async getOwnExtkeyCondition() {
				const loading = this.loading();
				let res = await Api.post('/business/nitopnRule/getOwnExtkeyCondition');
				loading.close();
				if (res.respCode === SUCCESS) {
					this.ownExtkeyList = res.data;
				}
			},
			chCfaflg(val){
				if (val=='3'){
          this.model.cfagit.dclflg = '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;
            }
          this.model.cfagit.recgrp.dcl[0].wabachandate = this.model.chgdat
          let obj = this.model.gidgrp || this.model.nidgrp
          this.model.cfagit.recgrp.dcl[0].basere = new BigNumber(obj.cbs.max.amt).plus(new BigNumber(this.model.chgamt))
          this.model.cfagit.recgrp.dcl[0].exguarancode = this.model.cfagit.recgrp.bas.exguarancode || ''
          this.model.cfagit.recgrp.dcl[0].actiontype = this.model.cfagit.recgrp.bas.actiontype || ''   
          this.model.cfagit.recgrp.dcl[0].acp = "X"
				}else
				this.model.cfagit.dclflg = ''
			}
    }
        
}