瀏覽代碼

增加消费券规则,修改相应账单文件取值以及计算

xiongxing 2 周之前
父節點
當前提交
9fe8309413

+ 10 - 1
src/store/modules/setting.ts

@@ -9,6 +9,8 @@ export const useSettingStore = defineStore('setting', {
     receivable: false, // 应收(直接截取两位)
     fixed2Num: false,
     admissionBill: -1, // 入院账单(应收1,四舍五入3,向上取整2, 四舍五入取整4)
+    // 消费券规则
+    couponRuleValue: '',
   }),
   getters: {
     getRounding(): boolean{ // 取整
@@ -25,7 +27,10 @@ export const useSettingStore = defineStore('setting', {
     },
     getAdmissionBill(): number{ // 入院账单
       return this.admissionBill
-    }
+    },
+    getCouponRuleValue(): string{ // 消费券规则
+      return this.couponRuleValue
+    },
   },
   actions: {
     async getParamsConfig(){
@@ -40,6 +45,10 @@ export const useSettingStore = defineStore('setting', {
         this.admissionBillRoundUp = item2.value == '2' ? true : false
         this.admissionBill = item2.value
       }
+      const item3 = res.find(item=>item.configName == '消费券抹零设置')
+      if(item3){
+        this.couponRuleValue = item3.value
+      }
     }
   }
 })

+ 23 - 27
src/views/elderly/fee/bill-pay/Form.vue

@@ -65,7 +65,7 @@
           <template #default="scope">
 
               <el-input-number  v-if="isEdit && scope.row.payStatus == 0" @blur="handlePrice(scope.row, 1)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (formatTotalMonth(scope.row) - scope.row.payAmount).toFixed(2) : formatTotalMonth(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : formatTotalMonth(scope.row) }}</span>
 
           </template>
         </el-table-column>
@@ -124,7 +124,7 @@
           <el-table-column prop="totalAmount" label="应收金额(元)" align="center">
             <template #default="scope">
               <el-input-number  v-if="isEdit && scope.row.payStatus == 0" @blur="handlePrice(scope.row, 2)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (tableRowPay(scope.row) - scope.row.payAmount).toFixed(2) : tableRowPay(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : tableRowPay(scope.row) }}</span>
 
           </template>
           </el-table-column>
@@ -208,7 +208,7 @@
           <el-table-column prop="totalAmount" label="应收金额(元)" align="center">
             <template #default="scope">
               <el-input-number  v-if="isEdit" @blur="handlePrice(scope.row, 3)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (tableRowPay(scope.row) - scope.row.payAmount).toFixed(2) : tableRowPay(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : tableRowPay(scope.row) }}</span>
 
             </template>
           </el-table-column>
@@ -261,7 +261,7 @@
           <el-table-column prop="totalAmount" label="应收金额(元)" align="center">
             <template #default="scope">
               <el-input-number  v-if="isEdit && scope.row.payStatus == 0" @blur="handlePrice(scope.row, 5)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (tableRowPay(scope.row) - scope.row.payAmount).toFixed(2) : tableRowPay(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : tableRowPay(scope.row) }}</span>
 
             </template>
           </el-table-column>
@@ -358,7 +358,7 @@
           <el-table-column prop="totalAmount" width="180" label="应收金额(元)" align="center">
             <template #default="scope">
               <el-input-number  v-if="isEdit && scope.row.payStatus == 0" @blur="handlePrice(scope.row, 5)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (tableRowPay(scope.row) - scope.row.payAmount).toFixed(2) : tableRowPay(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : tableRowPay(scope.row) }}</span>
             </template>
           </el-table-column>
           <el-table-column prop="payAmount" label="已缴费用" width="100" align="center" />
@@ -442,7 +442,7 @@
           <el-table-column prop="totalAmount" label="应收金额(元)" align="center">
             <template #default="scope">
               <el-input-number  v-if="isEdit && scope.row.payStatus == 0" @blur="handlePrice(scope.row, 3)" v-model="scope.row.totalAmount" controls-position="right"/>
-              <span v-else>{{ scope.row.expenseSource == 'consumer_voucher' ? scope.row.totalAmount : (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (tableRowPay(scope.row) - scope.row.payAmount).toFixed(2) : tableRowPay(scope.row) }}</span>
+              <span v-else>{{ (scope.row.payStatus == 1 || scope.row.payStatus == 2) ? (getReceivableAmount(scope.row) - (scope.row.payAmount || 0)).toFixed(2) : tableRowPay(scope.row) }}</span>
               <!-- <span class="underline" v-if="!settingStore.getRceivable||settingStore.getAdmissionBillRoundUp">{{ formatNum(scope.row.totalAmount) }}</span> -->
             </template>
           </el-table-column>
@@ -514,7 +514,7 @@
 <script setup lang="ts">
 import { DICT_TYPE, getDictLabel, getDictOptions } from '@/utils/dict'
 import { getExpenseOrderDetail, exportExpenseOrderItemExcel, editExpenseOrder } from '@/api/elderly/fee/bill-pay'
-import { formatDecimal, formatNum, formatRid, formatCeil } from '@/utils/formatter'
+import { formatDecimal, formatNum, formatRid, formatCeil, formatRound } from '@/utils/formatter'
 import { useSettingStore } from '@/store/modules/setting'
 import download from '@/utils/download'
 import { tableHeaderColor } from '@/utils/table'
@@ -583,6 +583,11 @@ const fixed2Num = computed(()=>{
   return settingStore.getFix2Num
 })
 
+// 消费券规则
+const couponRuleValue = computed(()=>{
+  return settingStore.getCouponRuleValue
+})
+
 const tTitle = computed(() => {
   const arr = dataForm.value.billingMonth ? dataForm.value.billingMonth.split('-') : ''
   if (arr.length) {
@@ -624,7 +629,11 @@ const stageExpandSubtotalAmount = stageSubtotalAmount
 
 const getReceivableAmount = (item) => {
   if (item?.expenseSource == 'consumer_voucher') {
-    return Number(item.totalAmount || 0)
+    const ruleValue = couponRuleValue.value
+    if (ruleValue == 2 || ruleValue == '2') {
+      return Number(formatRound(item.totalAmount || 0))
+    }
+    return Number(formatNum(item.totalAmount || 0))
   }
   if (item?.expenseSource == 'long_term_care_insurance') {
     return Number(item.totalAmount || 0)
@@ -678,9 +687,6 @@ const billTotalAmount = computed(() => {
 
 // 固定费用
 const formatTotalMonth = (item) => {
-  if (item?.expenseSource == 'consumer_voucher') {
-    return item.totalAmount
-  }
   return formatNum(getReceivableAmount(item))
 }
 
@@ -716,17 +722,7 @@ const totalPayActualAmount = computed(() => {
 
 // 表格中的应收金额
 const tableRowPay = (row) => {
-  if(row.expenseSource == 'long_term_care_insurance'){
-    return formatNum(row.totalAmount)
-  }else if(row.expenseSource == 'consumer_voucher'){
-    return row.totalAmount
-  }else if(rounding.value){
-    return formatNum(row.roundAmount)
-  }else if(fixed2Num.value){
-    return formatNum(row.roundTwoDecimalAmount)
-  }else{
-    return formatNum(row.totalAmount)
-  }
+  return formatNum(getReceivableAmount(row))
 }
 
 // 下载excel
@@ -793,7 +789,7 @@ const handleMonthSelectionChange = (val) => {
     if(item.isShow){
       if(dataForm.value.type == '1'){
         if(item.expenseSource == 'consumer_voucher'){
-          total += formatDecimal(getReceivableAmount(item)) as number
+          total += formatDecimal(getReceivableAmount(item) - (item.payAmount || 0)) as number
         }else if(settingStore.getAdmissionBill == 2){ // 向上取整
           total += formatDecimal(Number(formatCeil(item.totalAmount - (item.payAmount || 0)))) as number
         }else if(settingStore.getAdmissionBill == 3){ // 四舍五入保留两位
@@ -805,7 +801,7 @@ const handleMonthSelectionChange = (val) => {
         }
       }else{
         if(item.expenseSource == 'consumer_voucher'){
-          total += formatDecimal(getReceivableAmount(item)) as number
+          total += formatDecimal(getReceivableAmount(item) - (item.payAmount || 0)) as number
         }else if(rounding.value){ // 账单取整
           total += formatDecimal(formatNum(item.roundAmount - (item.payAmount || 0))) as number
         } else if(fixed2Num.value){ // 四舍五入保留两位
@@ -828,7 +824,7 @@ const handleDepositSelectionChange = (val) => {
   val.map((item) => {
     if(item.isShow){
       if(item.expenseSource == 'consumer_voucher'){
-        total += formatDecimal(getReceivableAmount(item)) as number
+        total += formatDecimal(getReceivableAmount(item) - (item.payAmount || 0)) as number
       }else if(rounding.value){ // 账单取整
         total += formatDecimal(formatNum(item.roundAmount - (item.payAmount || 0))) as number
       } else if(fixed2Num.value){ // 四舍五入保留两位
@@ -850,7 +846,7 @@ const handleOneTimeSelectionChange = (val) => {
   val.map((item) => {
     if(item.isShow){
       if(item.expenseSource == 'consumer_voucher'){
-        total += formatDecimal(getReceivableAmount(item)) as number
+        total += formatDecimal(getReceivableAmount(item) - (item.payAmount || 0)) as number
       }else if(rounding.value){ // 账单取整
         total += formatDecimal(formatNum(item.roundAmount - (item.payAmount || 0))) as number
       } else if(fixed2Num.value){ // 四舍五入保留两位
@@ -872,7 +868,7 @@ const handleStageExpandSelectionChange = (val) => {
     val.map((item) => {
       if(item.isShow){
         if(item.expenseSource == 'consumer_voucher'){
-          total += formatDecimal(getReceivableAmount(item)) as number
+          total += formatDecimal(getReceivableAmount(item) - (item.payAmount || 0)) as number
         }else if(rounding.value){ // 账单取整
           total += formatDecimal(formatNum(item.roundAmount - (item.payAmount || 0))) as number
         } else if(fixed2Num.value){ // 四舍五入保留两位

+ 116 - 35
src/views/elderly/fee/bill-pay/preview.vue

@@ -298,26 +298,44 @@ const handleClick = (val) => {
       if (item.isMonthlyExpense == 1) {
         if (rounding.value) {
           // 取整
-          monthNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+          monthNum +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundAmount)
         } else if (fixed2Num.value) {
           // 四舍五入
-          monthNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+          monthNum +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundTwoDecimalAmount)
         } else {
           // 应收
-          monthNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : formatNum(item.totalAmount))
+          monthNum +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(formatNum(item.totalAmount))
         }
       } else {
         if (item.itemName != '长护险护理补贴费用') {
           otherName += item.itemName + ';'
           if (rounding.value) {
             // 取整
-            otherNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+            otherNum +=
+              item.expenseSource == 'consumer_voucher'
+                ? getConsumerVoucherAmountNumber(item)
+                : Number(item.roundAmount)
           } else if (fixed2Num.value) {
             // 四舍五入
-            otherNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+            otherNum +=
+              item.expenseSource == 'consumer_voucher'
+                ? getConsumerVoucherAmountNumber(item)
+                : Number(item.roundTwoDecimalAmount)
           } else {
             // 应收
-            otherNum += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : formatNum(item.totalAmount))
+            otherNum +=
+              item.expenseSource == 'consumer_voucher'
+                ? getConsumerVoucherAmountNumber(item)
+                : Number(formatNum(item.totalAmount))
           }
         }
       }
@@ -345,6 +363,24 @@ const fixed2Num = computed(() => {
   return settingStore.getFix2Num
 })
 
+const getConsumerVoucherAmountNumber = (item) => {
+  const ruleValue = settingStore.getCouponRuleValue
+  const rawAmount = item?.totalAmount ?? 0
+  if (ruleValue == 2 || ruleValue == '2') {
+    return Number(formatRound(rawAmount))
+  }
+  return Number(formatNum(rawAmount))
+}
+
+const getConsumerVoucherAmountText = (item) => {
+  const ruleValue = settingStore.getCouponRuleValue
+  const rawAmount = item?.totalAmount ?? 0
+  if (ruleValue == 2 || ruleValue == '2') {
+    return formatRound(rawAmount)
+  }
+  return formatNum(rawAmount)
+}
+
 // 账单总额
 const totalPayAmount = computed(() => {
   let num1 = 0,
@@ -353,28 +389,55 @@ const totalPayAmount = computed(() => {
   // 遍历里面的所有数据得到数据
   dataForm.value.items.map((item) => {
     if (item.itemName != '长护险护理补贴费用') {
-      num1 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
-      num2 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+      num1 +=
+        item.expenseSource == 'consumer_voucher'
+          ? getConsumerVoucherAmountNumber(item)
+          : Number(item.roundAmount)
+      num2 +=
+        item.expenseSource == 'consumer_voucher'
+          ? getConsumerVoucherAmountNumber(item)
+          : Number(item.roundTwoDecimalAmount)
       if (item.isMonthlyExpense == 1 && dataForm.value.type == 1) {
         if (settingStore.getAdmissionBill == 2) {
           // 向上取整
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : formatCeil(item.totalAmount))
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(formatCeil(item.totalAmount))
         } else if (settingStore.getAdmissionBill == 3) {
           // 四舍五入保留两位
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundTwoDecimalAmount)
         } else if (settingStore.getAdmissionBill == 4) {
           // 四舍五入取整
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundAmount)
         } else {
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.totalAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.totalAmount)
         }
       } else {
         if (rounding.value) {
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundAmount)
         } else if (fixed2Num.value) {
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.roundTwoDecimalAmount)
         } else {
-          num3 += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.totalAmount)
+          num3 +=
+            item.expenseSource == 'consumer_voucher'
+              ? getConsumerVoucherAmountNumber(item)
+              : Number(item.totalAmount)
         }
       }
     }
@@ -411,32 +474,29 @@ const tableRowPrice = (row) => {
 
 // 表格1总额单项小计
 const tableRowPay = (row) => {
+  if (row.expenseSource == 'consumer_voucher') {
+    return getConsumerVoucherAmountText(row)
+  }
   if (dataForm.value.type == '1' && row.isMonthlyExpense == 1) {
     if (settingStore.getAdmissionBill == 2) {
       // 向上取整
-      return formatNum(row.expenseSource == 'consumer_voucher' ? row.totalAmount : formatCeil(row.totalAmount))
+      return formatNum(formatCeil(row.totalAmount))
     } else if (settingStore.getAdmissionBill == 3) {
       // 四舍五入保留两位
-      return formatNum(row.expenseSource == 'consumer_voucher' ? row.totalAmount : row.roundTwoDecimalAmount)
+      return formatNum(row.roundTwoDecimalAmount)
     } else if (settingStore.getAdmissionBill == 4) {
       // 四舍五入取整
-      return formatNum(row.expenseSource == 'consumer_voucher' ? row.totalAmount : row.roundAmount)
+      return formatNum(row.roundAmount)
     } else {
-      return formatNum(row.expenseSource == 'consumer_voucher' ? row.totalAmount : row.totalAmount)
+      return formatNum(row.totalAmount)
     }
   } else {
     if (rounding.value) {
-      return row.expenseSource == 'consumer_voucher'
-        ? formatNum(row.totalAmount)
-        : formatNum(row.roundAmount)
+      return formatNum(row.roundAmount)
     } else if (fixed2Num.value) {
-      return row.expenseSource == 'consumer_voucher'
-        ? formatNum(row.totalAmount)
-        : formatNum(row.roundTwoDecimalAmount)
+      return formatNum(row.roundTwoDecimalAmount)
     } else {
-      return row.expenseSource == 'consumer_voucher'
-        ? formatNum(row.totalAmount)
-        : formatNum(row.totalAmount)
+      return formatNum(row.totalAmount)
     }
   }
 }
@@ -448,24 +508,45 @@ const tableSubtotal = computed(() => {
     if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
       if (settingStore.getAdmissionBill == 2) {
         // 向上取整
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : formatCeil(item.totalAmount))
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(formatCeil(item.totalAmount))
       } else if (settingStore.getAdmissionBill == 3) {
         // 四舍五入保留两位
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.roundTwoDecimalAmount)
       } else if (settingStore.getAdmissionBill == 4) {
         // 四舍五入取整
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.roundAmount)
       } else {
         // 应收
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.totalAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.totalAmount)
       }
     } else {
       if (rounding.value) {
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.roundAmount)
       } else if (fixed2Num.value) {
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.roundTwoDecimalAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.roundTwoDecimalAmount)
       } else {
-        num += Number(item.expenseSource == 'consumer_voucher' ? item.totalAmount : item.totalAmount)
+        num +=
+          item.expenseSource == 'consumer_voucher'
+            ? getConsumerVoucherAmountNumber(item)
+            : Number(item.totalAmount)
       }
     }
   })

+ 56 - 149
src/views/elderly/fee/bill-pay/unpay-preview.vue

@@ -20,17 +20,6 @@
           <span><b>性别:</b> {{ getDictLabel(DICT_TYPE.SYSTEM_USER_SEX, dataForm.elderSex) }}</span>
           <span><b>经手人:</b> {{ dataForm.createdBy }}</span>
         </div>
-        <!--        <div class="info-wrap">-->
-        <!--          <span><b>账单月:</b> {{ dataForm.billingMonth }}</span>-->
-        <!-- <span><b>账单总额:</b> {{ billTotalPrice }}元</span> -->
-        <!-- <span><b>长护险:</b> {{ formatNum(longTermAmount) }}元</span> -->
-        <!--          <span><b>应缴:</b> {{ formatNum(unPayTotal) }}元</span>-->
-        <!--          <span><b>发票号:</b> {{ dataForm.invoiceNumber }}</span>-->
-        <!--        </div>-->
-        <!--        <div class="info-wrap">-->
-        <!-- <span><b>已缴费用:</b> {{ formatNum(payTotal) }}元</span> -->
-        <!--          <span><b>打印时间:</b> {{ dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss') }}</span>-->
-        <!--        </div>-->
       </div>
       <el-divider style="margin-top: 0px" />
       <div class="content">
@@ -47,28 +36,20 @@
             <td>序号</td>
             <td>费用分类</td>
             <td>费用名称</td>
-            <!-- <td>单价(元/月)</td>
-            <td>数量</td> -->
             <td>金额(元)</td>
             <td>缴费状态</td>
             <td>已缴金额(元)</td>
             <td>费用发生时间</td>
-            <!--            <td>缴费时间</td>-->
-            <!--            <td>缴费状态</td>-->
             <td>备注</td>
           </tr>
           <tr v-for="(item, index) in dataForm.items" :key="index" align="center">
             <td>{{ index + 1 }}</td>
             <td>{{ item.itemCategoryName }}</td>
             <td>{{ item.itemName }}</td>
-            <!-- <td>{{ calcActualPrice(item) }}</td>
-            <td>{{ item.count }}</td> -->
             <td>{{ calcTotalPrice(item) }}</td>
             <td>{{ getDictLabel(DICT_TYPE.PAY_TYPE, item.payStatus) }}</td>
             <td>{{ item.payAmount ?? 0 }}元</td>
             <td>{{ formatStartDate(item) }}</td>
-            <!--            <td>{{ formatTime(item.payTime, 'yyyy-MM-dd HH:mm:ss') }}</td>-->
-            <!--            <td>{{ getDictLabel(DICT_TYPE.PAY_TYPE, item.payStatus) }}</td>-->
             <td>{{ item.description }}</td>
           </tr>
           <tr align="center">
@@ -76,8 +57,6 @@
             <td :colspan="8">
               金额:{{ billTotalPrice }}元;已缴费&nbsp;{{ formatNum(payTotal) }}&nbsp;元;剩余未缴费&nbsp;{{ formatNum(unPayTotal) }}&nbsp;元
             </td>
-            <!-- <td>合计未缴总额</td>
-            <td :colspan="8">{{ formatNum(unPayTotal) }}元</td> -->
           </tr>
         </table>
       </div>
@@ -90,10 +69,8 @@
 </template>
 <script setup lang="ts">
 import { getExpenseOrderDetail } from '@/api/elderly/fee/bill-pay'
-import dayjs from 'dayjs'
 import { useUserStore } from '@/store/modules/user'
 import { formatNum, formatCeil, formatRound } from '@/utils/formatter'
-import { formatTime } from '@/utils'
 import { DICT_TYPE, getDictLabel } from '@/utils/dict'
 import { useSettingStore } from '@/store/modules/setting'
 defineOptions({ name: 'BillPayPreview' })
@@ -135,6 +112,36 @@ const fixed2Num = computed(() => {
 
 const tempResValue = ref({})
 
+const getItemPreviewAmount = (item) => {
+  if (item.expenseSource == 'consumer_voucher') {
+    const ruleValue = settingStore.getCouponRuleValue
+    if (ruleValue == 2 || ruleValue == '2') {
+      return Number(formatRound(item.totalAmount))
+    }
+    return Number(formatNum(item.totalAmount))
+  }
+
+  if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
+    if (settingStore.getAdmissionBill == 2) {
+      return Number(formatCeil(item.totalAmount))
+    } else if (settingStore.getAdmissionBill == 3) {
+      return Number(item.roundTwoDecimalAmount)
+    } else if (settingStore.getAdmissionBill == 4) {
+      return Number(item.roundAmount)
+    } else {
+      return Number(formatNum(item.totalAmount))
+    }
+  } else if (item.expenseSource == 'long_term_care_insurance') {
+    return Number(formatNum(item.totalAmount))
+  } else if (rounding.value) {
+    return Number(item.roundAmount)
+  } else if (fixed2Num.value) {
+    return Number(item.roundTwoDecimalAmount)
+  } else {
+    return Number(formatNum(item.totalAmount))
+  }
+}
+
 /** 打开弹窗 */
 const open = async (id) => {
   dialogVisible.value = true
@@ -174,63 +181,21 @@ const open = async (id) => {
     }
 
     if (hasPartialPay) {
-      total.value += item.roundAmount
-      totalDecimal.value += item.roundTwoDecimalAmount
+      total.value +=
+        item.expenseSource == 'consumer_voucher'
+          ? getItemPreviewAmount(item)
+          : item.roundAmount
+      totalDecimal.value +=
+        item.expenseSource == 'consumer_voucher'
+          ? getItemPreviewAmount(item)
+          : item.roundTwoDecimalAmount
       return
     }
 
     if (item.payStatus == 0) {
-      // 入院账单且isMonthlyExpense=1且入院向上取整
-      if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
-        if (settingStore.getAdmissionBill == 2) {
-          // 向上取整
-          unPayTotal.value += Number(formatCeil(item.totalAmount))
-        } else if (settingStore.getAdmissionBill == 3) {
-          // 四舍五入保留两位
-          unPayTotal.value += Number(item.roundTwoDecimalAmount)
-        } else if (settingStore.getAdmissionBill == 4) {
-          // 四舍五入保留整数
-          unPayTotal.value += Number(item.roundAmount)
-        } else {
-          // 应收
-          unPayTotal.value += Number(formatNum(item.totalAmount))
-        }
-      } else {
-        if (rounding.value) {
-          // 取整
-          unPayTotal.value += item.roundAmount
-        } else if (fixed2Num.value) {
-          unPayTotal.value += item.roundTwoDecimalAmount
-        } else {
-          unPayTotal.value += Number(formatNum(item.totalAmount))
-        }
-      }
+      unPayTotal.value += getItemPreviewAmount(item)
     } else if (item.payStatus == 1) {
-      // 判断入院账单且isMonthlyExpense=1且是否有做其他设置
-      if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
-        if (settingStore.getAdmissionBill == 2) {
-          // 向上取整
-          payTotal.value += Number(formatCeil(item.totalAmount))
-        } else if (settingStore.getAdmissionBill == 3) {
-          // 四舍五入保留两位
-          payTotal.value += Number(item.roundTwoDecimalAmount)
-        } else if (settingStore.getAdmissionBill == 4) {
-          // 四舍五入取整
-          payTotal.value += Number(item.roundAmount)
-        } else {
-          // 应收
-          payTotal.value += Number(formatNum(item.totalAmount))
-        }
-      } else {
-        if (rounding.value) {
-          // 取整
-          payTotal.value += item.roundAmount
-        } else if (fixed2Num.value) {
-          payTotal.value += item.roundTwoDecimalAmount
-        } else {
-          payTotal.value += Number(formatNum(item.totalAmount))
-        }
-      }
+      payTotal.value += getItemPreviewAmount(item)
     } else if (item.payStatus == 2) {
       hasPartialPay = true
       try {
@@ -238,8 +203,14 @@ const open = async (id) => {
         unPayTotal.value = (tempResValue.value.actualAmount - tempResValue.value.payableAmount) || 0
       } catch (e) {}
     }
-    total.value += item.roundAmount
-    totalDecimal.value += item.roundTwoDecimalAmount
+    total.value +=
+      item.expenseSource == 'consumer_voucher'
+        ? getItemPreviewAmount(item)
+        : item.roundAmount
+    totalDecimal.value +=
+      item.expenseSource == 'consumer_voucher'
+        ? getItemPreviewAmount(item)
+        : item.roundTwoDecimalAmount
   })
 
   // 有长护险
@@ -289,20 +260,6 @@ const tTitle = computed(() => {
   return ''
 })
 
-const getLastDayOfMonth = (monthStr) => {
-  // 将输入的字符串分割为年和月
-  const [year, month] = monthStr.split('-').map(Number)
-
-  // 创建下个月的第一天(月份从0开始计数,所以+1)
-  const nextMonthFirstDay = new Date(year, month, 1)
-
-  // 减去一天,得到当前月的最后一天
-  const lastDay = new Date(nextMonthFirstDay - 24 * 60 * 60 * 1000)
-
-  // 格式化返回结果为 'YYYY-MM-DD' 格式
-  return lastDay.toISOString().split('T')[0]
-}
-
 const bTitle = computed(() => {
   const arr = dataForm.value.billingMonth ? dataForm.value.billingMonth.split('-') : ''
   if (arr.length) {
@@ -313,53 +270,24 @@ const bTitle = computed(() => {
   return ''
 })
 
-// 单价(元/月)
-const calcActualPrice = (item) => {
-  if (
-    dataForm.value.type == '1' &&
-    item.isMonthlyExpense == 1 &&
-    settingStore.getAdmissionBillRoundUp
-  ) {
-    return formatCeil(item.actualAmount)
-  } else {
-    return formatNum(item.actualPrice)
-  }
-}
-
 // 入院账单费用计算
 const caclAdminssionTotalPrice = computed(() => {
   let num = 0
   dataForm.value.items.map((item) => {
-    if (item.isMonthlyExpense == 1) {
-      if (settingStore.getAdmissionBill == 2) {
-        // 向上取整
-        num += Number(formatCeil(item.totalAmount))
-      } else if (settingStore.getAdmissionBill == 3) {
-        // 四舍五入保留两位
-        num += Number(formatNum(item.roundTwoDecimalAmount))
-      } else if (settingStore.getAdmissionBill == 4) {
-        // 四舍五入去哼
-        num += Number(formatNum(item.roundAmount))
-      } else {
-        // 应收
-        num += Number(formatNum(item.totalAmount))
-      }
-    } else {
-      if (rounding.value) {
-        num += Number(formatNum(item.roundAmount))
-      } else if (fixed2Num.value) {
-        num += Number(formatNum(item.roundTwoDecimalAmount))
-      } else {
-        num += Number(formatNum(item.totalAmount))
-      }
-    }
+    num += getItemPreviewAmount(item)
   })
   return num + longTermAmount.value
 })
 
 // 总额
 const calcTotalPrice = (item) => {
-  if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
+  if (item.expenseSource == 'consumer_voucher') {
+    const ruleValue = settingStore.getCouponRuleValue
+    if (ruleValue == 2 || ruleValue == '2') {
+      return formatRound(item.totalAmount)
+    }
+    return formatNum(item.totalAmount)
+  } else if (dataForm.value.type == '1' && item.isMonthlyExpense == 1) {
     if (settingStore.getAdmissionBill == 2) {
       // 向上取整
       return formatCeil(item.totalAmount)
@@ -403,17 +331,7 @@ const formatStartDate = (item) => {
   if (item.itemName == '长护险护理补贴费用' || item.expenseSource == 'long_term_care_insurance') {
     // 长护险
     return item.createdTime
-    // let dataStr = item.startDate??"--"
-    // if(dataStr.length>=10){
-    //   dataStr = dataStr.substring(0,7)
-    // }
-    // return dataStr
   } else if (item.expenseSource == 'expense_item') {
-    // if(dataForm.value.description){
-    //   return dataForm.value.description
-    // }else{
-    //   return bTitle
-    // }
     if (item.description && item.description.includes('的')) {
       return item.description.split('的')[0]
     } else if (item.startDate != null && item.endDate != null) {
@@ -432,17 +350,6 @@ const formatStartDate = (item) => {
   }
 }
 
-const formatStr = (dateStr) => {
-  if (dateStr) {
-    // 2. 按 "-" 拆分字符串,得到 [年, 月, 日] 数组
-    const [year, month, day] = dateStr.split('-')
-
-    // 3. 按目标格式拼接
-    return `${year}年${month}月${day}日`
-  }
-  return ''
-}
-
 // 打印
 const printTab = {
   id: 'printTab1',