default.js 1.07 KB
import BigNumber from "bignumber.js";
export default {
	mixins: [],
	methods: {

		calculateMaxamt(){
			if(this.model.ledgrp.rec.nomtop==null || this.model.ledgrp.rec.nomtop===''){
				this.model.ledgrp.rec.nomtop = 0;
			}

			if(this.model.ledgrp.rec.nomtop==null || this.model.ledgrp.rec.nomtop===''){
				this.model.ledgrp.rec.nomtop = 0;
			}
			let _maxamt =new BigNumber(this.model.ledgrp.cbs.nom1.amt).multipliedBy(new BigNumber(1).plus(new BigNumber(this.model.ledgrp.rec.nomtop).dividedBy(new BigNumber(100))) ) ;
			let _currency = this.model.ledgrp.cbs.max.cur;
			// 如果是 韩元或者日元,小数位不保留,其它保留两位小数
			// TD上,nom1:611.23,tolerance-top:2,maxamt 623.4546,letnot最后是623.46,letopn 最后是623.45,暂时以letopn为准
			if (_currency === "KRW" || _currency === "JPY") {
				_maxamt = _maxamt.toFixed(0);
			}else {
				_maxamt = _maxamt.toFixed(2);
			}
			this.model.ledgrp.cbs.max.amt = _maxamt;

			// 默认将将max的值赋值给opn1
			this.model.ledgrp.cbs.opn1.amt = this.model.ledgrp.cbs.max.amt;
		},
	},
}