Selaa lähdekoodia

优化缴费通知单,payStatus==2下的计算剩余未缴费金额逻辑问题

xiongxing 7 tuntia sitten
vanhempi
commit
be5c7fc6e3
1 muutettua tiedostoa jossa 17 lisäystä ja 3 poistoa
  1. 17 3
      src/views/elderly/fee/bill-pay/unpay-preview.vue

+ 17 - 3
src/views/elderly/fee/bill-pay/unpay-preview.vue

@@ -138,6 +138,11 @@ const tempResValue = ref({})
 /** 打开弹窗 */
 const open = async (id) => {
   dialogVisible.value = true
+  unPayTotal.value = 0
+  total.value = 0
+  totalDecimal.value = 0
+  longTermAmount.value = 0
+  payTotal.value = 0
   const res = await getExpenseOrderDetail(id)
   tempResValue.value = res
   res.items = res.items.filter(
@@ -149,6 +154,7 @@ const open = async (id) => {
       item.isShow == 1
   )
   let flag = false
+  let hasPartialPay = false
   dataForm.value = res
   res.items.map((item) => {
     if (item.expenseSource == 'long_term_care_insurance') {
@@ -167,6 +173,12 @@ const open = async (id) => {
       })
     }
 
+    if (hasPartialPay) {
+      total.value += item.roundAmount
+      totalDecimal.value += item.roundTwoDecimalAmount
+      return
+    }
+
     if (item.payStatus == 0) {
       // 入院账单且isMonthlyExpense=1且入院向上取整
       if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
@@ -219,10 +231,12 @@ const open = async (id) => {
           payTotal.value += Number(formatNum(item.totalAmount))
         }
       }
-    }else if (item.payStatus == 2) {
+    } else if (item.payStatus == 2) {
+      hasPartialPay = true
       try {
+        payTotal.value = tempResValue.value.payableAmount || 0
         unPayTotal.value = (tempResValue.value.actualAmount - tempResValue.value.payableAmount) || 0
-      }catch (e) {}
+      } catch (e) {}
     }
     total.value += item.roundAmount
     totalDecimal.value += item.roundTwoDecimalAmount
@@ -380,7 +394,7 @@ const billTotalPrice = computed(() => {
     } else if (fixed2Num.value) {
       return formatNum(totalDecimal.value)
     } else {
-      return formatNum(unPayTotal.value)
+      return formatNum(totalDecimal.value)
     }
   }
 })