default.js 10.3 KB
import event from "../event/index";
import Api from "~/service/Api";
import buildFn from '../event/buildCommons.js';

export default {
	mixins: [event],
	methods: {
		defaultFunc () {
			// 根据max2的值是否大于0判断是否勾选附加金额字段
			let oldMax2Amt = this.model.gidgrp.cbs.max2.amt
			if (oldMax2Amt && Number(oldMax2Amt) > 0) {
				this.model.adaflg = 'X'
			}
		},
		// gcdgrp.cbs.max.cur
		// gcdgrp.cbs.max.amt 
		// gcdgrp.apl.pts.nam
		calcName() {
			this.model.gcdgrp.rec.nam =  this.model.gcdgrp.apl.pts.nam;
			this.model.gcdgrp.rec.nam = this.model.gcdgrp.rec.nam.slice(0, 40);
		},
		setAdaflg(){
			if(!isNaN(parseInt(this.model.gidgrp.cbs.max2.amt))&&!isNaN(parseInt(this.model.gidgrp.cbs.opn2.amt))){
				if(parseInt(this.model.gidgrp.cbs.max2.amt)==0&&parseInt(this.model.gidgrp.cbs.opn2.amt)==0){
					this.model.adaflg=false;
				}
				else{
					this.model.adaflg=true;
				}
			}
		},
		// defaultFunc () {
		// 	// 根据max2的值是否大于0判断是否勾选附加金额字段
		// 	let oldMax2Amt = this.model.gidgrp.cbs.max2.amt
		// 	if (oldMax2Amt && Number(oldMax2Amt) > 0) {
		// 		this.model.gitp0.aamgid.addamtflg = 'X'
		// 	}
		// },
		changePridsp(isInit) {
			if (this.isInDisplay) {
				return;
			}
			if (isInit) {
				this.model.dnfmodVo.zhruzh = '';
			}
			this.zhruzhList = [];
			if (!this.model.dnfmodVo.pridsp || !this.model.dnfmodVo.kehuzh) {
				return;
			}
			let params = {
				ptyinr: this.model.gidgrp.apl.pts.ptyinr,
				cur: this.model.dnfmodVo.cur,
				pridsp: this.model.dnfmodVo.pridsp,
				wrkbchinr: this.model.gidgrp.rec.branchinr,
				transName: "giteng"
			};
			const loading = this.loading('正在请求数据');
			Api.post(`/business/giteng/rulePridspN1000`, params).then(res => {
				if (res.respCode == SUCCESS) {
          console.log(res.data);
          if (res.data.length == 1 && res.data[0].indexOf('\r\n') !== -1) {
            let tempList = res.data[0].split('\r\n')
            for (let i = 0; i < tempList.length; i++) {
              this.zhruzhList.push({
                value: tempList[i],
                label: tempList[i]
              });
            }
          } else {
						for (let i = 0; i < res.data.length; i++) {
							this.zhruzhList.push({ value: res.data[i], label: res.data[i] });
						}
					}
					if (this.zhruzhList.length > 0 && !this.model.dnfmodVo.zhruzh) {
						this.model.dnfmodVo.zhruzh = this.zhruzhList[0].value;
					}
				} else {
					this.$message.error("本金转入账户查询异常:" + res.respMsg);
				}
				loading.close();
			});
		},
		changeIntdsp(isInit) {
			if (this.isInDisplay) {
				return;
			}
			if (isInit) {
				this.model.dnfmodVo.lxzyzh = '';
			}
			this.lxzyzhList = [];
			if (!this.model.dnfmodVo.intdsp || !this.model.dnfmodVo.kehuzh) {
				return;
			}
			let params = {
				ptyinr: this.model.gidgrp.apl.pts.ptyinr,
				cur: this.model.dnfmodVo.cur,
				intdsp: this.model.dnfmodVo.intdsp,
				wrkbchinr: this.model.gidgrp.rec.branchinr,
				transName: "giteng"
			};
			const loading = this.loading('正在请求数据');
			Api.post(`/business/giteng/ruleIntdspN1000`, params).then(res => {
				if (res.respCode == SUCCESS) {
          console.log(res.data);
          if (res.data.length == 1 && res.data[0].indexOf('\r\n') !== -1) {
            let tempList = res.data[0].split('\r\n')
            for (let i = 0; i < tempList.length; i++) {
              this.lxzyzhList.push({
                value: tempList[i],
                label: tempList[i]
              });
            }
          } else {
						for (let i = 0; i < res.data.length; i++) {
							this.lxzyzhList.push({ value: res.data[i], label: res.data[i] });
						}
					}
					if (this.lxzyzhList.length > 0 && !this.model.dnfmodVo.lxzyzh) {
						this.model.dnfmodVo.lxzyzh = this.lxzyzhList[0].value;
					}
				} else {
					this.$message.error("利息转入账户查询异常:" + res.respMsg);
				}
				loading.close();
			});
		},
		changeKehuzh(isInit) { //根据保证金账户下拉框改变操作类型
			if (this.isInDisplay || !isInit) {
				return;
			}
			this.model.dnfmodVo.ccvtyp = '';
			this.changeCcvtyp(isInit);
			this.operationsList = [];
			this.tableDataList = [];
			if (this.model.dnfmodVo.kehuzh) {
				for (var i = 0; i < this.accountList.length; i++) {
					if (this.accountList[i].value == this.model.dnfmodVo.kehuzh) {
						this.model.dnfmodVo.cur = this.accountList[i].cur;
					}
				}
				let dflg = this.calcDflg(this.model.dnfmodVo.kehuzh);
				this.operationsList.push({ label: "保证金账户冻结", value: "A" });
				this.operationsList.push({ label: "保证金账户解冻", value: "B" });
				if ('81' == dflg) {
					this.operationsList.push({ label: "定期转活期", value: "C" });
				}
			}
		},
		changeZhqtyp(isInit) {
			if (this.isInDisplay || !isInit) {
				return;
			}
			if (!this.model.dnfmodVo.zhqtyp) {
				this.model.dnfmodVo.pridsp = '';
				this.model.dnfmodVo.zhruzh = '';
				this.model.dnfmodVo.intdsp = '';
				this.model.dnfmodVo.lxzyzh = '';
			} else if (this.model.dnfmodVo.zhqtyp != 'B') {
				this.model.dnfmodVo.tizamt = '';
			}
			if (this.model.dnfmodVo.zhqtyp == 'B') {
				if (Number(this.model.dnfmodVo.zhqucs) != 0) {
					this.model.dnfmodVo.zhqtyp = '';
					this.$message.error("该定期保证金账户已经办理过一次部分提支,不能再次办理,请选择“存款销户”");
				}
				if (!this.model.dnfmodVo.qicuje) {
					this.$message.warning("起存金额为空,请点Get获取!");
				}
			}
		},
		changeCcvtyp(isInit) {
			if (this.isInDisplay || !isInit) {
				return;
			}
			if (!this.model.dnfmodVo.ccvtyp) {
				this.model.dnfmodVo.zhqtyp = '';
				this.model.dnfmodVo.tizamt = '';
				this.model.dnfmodVo.zhqucs = '';
				this.model.dnfmodVo.qicuje = '';
				this.model.dnfmodVo.qixirq = '';
				this.model.dnfmodVo.zhhuye = '';
				this.model.dnfmodVo.yewudh = '';
				this.model.dnfmodVo.intdsp = '';
				this.model.dnfmodVo.lxzyzh = '';
				this.model.dnfmodVo.zhruzh = '';
				this.model.dnfmodVo.pridsp = '';
			} else if (this.model.dnfmodVo.ccvtyp != 'C') {
				this.model.dnfmodVo.zhqtyp = '';
				this.model.dnfmodVo.tizamt = '';
        this.changeZhqtyp(isInit);
        // this.model.liaccv.gleflg ='Y';
			}
			if (this.model.dnfmodVo.ccvtyp == 'C') {
				if (!this.model.dnfmodVo.zhqucs) {
					this.onDnfencGet();
				}
				if (this.model.dnfmodVo.jiluzt == '1') {
					this.$message.error("当前账号已经在核心销户,国结不允许进行操作!");
					this.model.dnfmodVo.ccvtyp = '';
        }
        this.model.liaccv.gleflg ='N';
			}
		},
		changeTizamt(isInit) {
			if (this.isInDisplay || !isInit) {
				return;
			}
			if (!this.model.dnfmodVo.tizamt) {
				this.model.dnfmodVo.tizamt = '0.00';
				return;
			}
			var tizamt = Number(this.model.dnfmodVo.tizamt);
			var sum = Number(this.model.dnfmodVo.zhhuye) - Number(this.model.dnfmodVo.qicuje);
			if (tizamt > 0 && tizamt > sum) {
				this.model.dnfmodVo.tizamt = '0.00';
				this.$message.error('金额输入有误!错误原因:部分提支金额<=(账户余额-起存金额)');
			}
    },
    defaultDnfDataList() {
      let dataList = [];
      if (this.model.dnfmodVo.kehzwm !== '') {
          dataList.push(this.transTableData(this.model.dnfmodVo));
      }
      this.$set(this.codes, 'tableDataList', dataList);
    },
    defaultDnfOperationList(){
      let dflg;
      let len = this.model.dnfmodVo.kehuzh.trim().length;
      if (len == 17) {
        dflg = this.model.dnfmodVo.kehuzh.slice(6, 8)
      }
      if (len == 21) {
        dflg = this.model.dnfmodVo.kehuzh.slice(10, 12)
      }
      if (this.model.dnfmodVo.kehuzh.slice(0, 3) == "ZMQ" || this.model.dnfmodVo.kehuzh.slice(0, 3) == "NRA") {
        dflg = this.model.dnfmodVo.kehuzh.slice(9, 11)
      }
      let operationsList = [];
      switch (dflg) {
        case "81":
          operationsList.push({
            label: "保证金账户冻结",
            value: "A"
          });
          operationsList.push({
            label: "保证金账户解冻",
            value: "B"
          });
          operationsList.push({
            label: "定期转活期",
            value: "C"
          });
          break;
        default:
          operationsList.push({
            label: "保证金账户冻结",
            value: "A"
          });
          operationsList.push({
            label: "保证金账户解冻",
            value: "B"
          });
      }
      this.$set(this.codes, 'operationsList', operationsList);
    }
		// initKehuzh() {
		// 	if (this.model.dnfmodVo.kehuzh) {
		// 		var obj = this.transTableData(this.model.dnfmodVo);
		// 		this.tableData.push(obj);
		// 	}
		// 	if (this.isInDisplay) { //复核进入
		// 		let dflg = this.calcDflg(this.model.dnfmodVo.kehuzh);
		// 		this.operations.push({ label: "保证金账户冻结", value: "A" });
		// 		this.operations.push({ label: "保证金账户解冻", value: "B" });
		// 		if ('81' == dflg) {
		// 			this.operations.push({ label: "定期转活期", value: "C" });
		// 		}
		// 		return;
		// 	}
		// 	this.accountList = [];
		// 	this.operations = [];
		// 	const loading = this.loading('正在请求数据');
		// 	let liaccvRequest = buildFn.buildCcvpan(this.model, this.trnName);
		// 	let objtyp = liaccvRequest.rec.objtyp;
		// 	Api.post(`/business/${objtyp.toLowerCase()}/liaccv/assertLiaccv`, liaccvRequest).then(rtnmsg => {

		// 		if (rtnmsg.respCode == SUCCESS) {
		// 			for (let i = 0; i < rtnmsg.data.liaccvg.length; i++) {
		// 				let accObj = rtnmsg.data.liaccvg[i];
		// 				this.accountList.push({ value: accObj.acc.trim(), label: accObj.acc.trim(), cur: accObj.cur });
		// 			}
		// 			if (this.accountList.length > 0 && !this.model.dnfmodVo.kehuzh) {
		// 				this.model.dnfmodVo.kehuzh = this.accountList[0].value;
		// 				this.model.dnfmodVo.cur = this.accountList[0].cur;
		// 			}
		// 			if (this.model.dnfmodVo.kehuzh) {
		// 				let dflg = this.calcDflg(this.model.dnfmodVo.kehuzh);
		// 				this.operations.push({ label: "保证金账户冻结", value: "A" });
		// 				this.operations.push({ label: "保证金账户解冻", value: "B" });
		// 				if ('81' == dflg) {
		// 					this.operations.push({ label: "定期转活期", value: "C" });
		// 				}
		// 			}
		// 		} else {
		// 			this.$message.error("保证金账户初始化异常:" + rtnmsg.respMsg);
		// 		}
		// 		loading.close();
		// 	});
		// },
	},
}
//你可以添加自动default处理