accAdd(arg1, arg2) { var r1 = this.deal(arg1); var r2 = this.deal(arg2); var m = Math.pow(10, Math.max(r1, r2)) return (this.accMul(arg1, m) + this.accMul(arg2, m)) / m }, accSub(arg1, arg2) { var r1 = this.deal(arg1); var r2 = this.deal(arg2); var m = Math.pow(10, Math.max(r1, r2)) return (this.accMul(arg1, m) - this.accMul(arg2, m)) / m }, accMul(arg1, arg2) { var m = 0; m += this.deal(arg1); m += this.deal(arg2); var r1 = Number(arg1.toString().replace(".", "")); var r2 = Number(arg2.toString().replace(".", "")); return (r1 * r2) / Math.pow(10, m) }, deal(arg) { var t = 0; try { t = arg.toString().split(".")[1].length } catch (e) {} return t; },
changchecked(item, index) { let obj = { idExamFeeItem: item.idExamFeeItem } this.orderInfo.itemInfoList.push(obj) item.checked = !item.checked if (item.checked) { this.price = this.accAdd(this.price, item.feePrice) console.log(this.orderInfo.itemInfoList) } else { //取消选择 this.price = this.accSub(this.price, item.feePrice) this.orderInfo.itemInfoList = this.orderInfo.itemInfoList.filter((item) => { return !(JSON.stringify(item)==JSON.stringify(obj)) }) console.log(this.orderInfo.itemInfoList) } },