duy 1 год назад
Родитель
Сommit
b24fb588ca
1 измененных файлов с 6 добавлено и 5 удалено
  1. 6 5
      src/views/debit-pay/admin/components/middlepay/addModal.vue

+ 6 - 5
src/views/debit-pay/admin/components/middlepay/addModal.vue

@@ -474,7 +474,7 @@ const currentMeterTotalBlur = (row) => {
     //计算本期计量金额
     nextTick(() => {
         row.currentMeterTotal = currentMeterTotal
-        row.currentMeterMoney = (BigNumber(currentMeterTotal).multipliedBy(row.currentPrice)).toString()
+        row.currentMeterMoney = (BigNumber(currentMeterTotal).multipliedBy(row.currentPrice)).toFixed(2).toString()
         row.allMeterTotal = (BigNumber(currentMeterTotal).plus(row.otherMeterTotal)).toString()
         //计算总计量金额
         let meterMoney = 0, table = addTableData.value
@@ -484,7 +484,8 @@ const currentMeterTotalBlur = (row) => {
         baseForm.value.meterMoney = meterMoney
         //计算本期支付比例
         //本期支 付比例=本期计量数量/变更后数量
-        row.payRatio = BigNumber(currentMeterTotal).dividedBy(row.changeTotal).toString() * 100
+        row.payRatio = isNaN(BigNumber(currentMeterTotal).dividedBy(row.changeTotal).toString() * 100) ? '0.00' : BigNumber(currentMeterTotal).dividedBy(row.changeTotal).toString() * 100
+        row.payRatio = row.payRatio .toFixed(2) === 'Infinity' ? 0 : row.payRatio .toFixed(2)
         compareRowUnpayRatio(row, 1)
 
     })
@@ -539,9 +540,9 @@ const unPayRatioBlur = (row)=>{
         let payRatio = new BigNumber(row.payRatio )//本期支付比例
         let changeTotal = new BigNumber(row.changeTotal )//变更后数量
         // 本期计量数量=本期支付比例*变更后数量
-        row.currentMeterTotal = (payRatio.dividedBy(100).multipliedBy(changeTotal)).toString()
-        row.currentMeterMoney = (BigNumber(row.currentMeterTotal).multipliedBy(row.currentPrice)).toString()//本期计量金额额
-        row.allMeterTotal = (BigNumber(row.currentMeterTotal).plus(row.otherMeterTotal)).toString()
+        row.currentMeterTotal = (payRatio.dividedBy(100).multipliedBy(changeTotal)).toFixed(2).toString()
+        row.currentMeterMoney = (BigNumber(row.currentMeterTotal).multipliedBy(row.currentPrice)).toFixed(2).toString()//本期计量金额额
+        row.allMeterTotal = (BigNumber(row.currentMeterTotal).plus(row.otherMeterTotal)).toFixed(2).toString()
          // 就去对比:本期支付比例+其他期支付比例
         //   是否大于最大支付比例
         compareRowUnpayRatio(row, 1)