HuRongxin 3 недель назад
Родитель
Сommit
88524d6b10

+ 7 - 0
src/api/patients/settlement/types.ts

@@ -79,6 +79,13 @@ export interface SettlementVO {
   wardName: string;
 
   remark: string;
+
+  /**
+   * 实收金额
+   */
+  fundsReceived: number;
+
+  settlementId: number| string;
 }
 
 export interface SettlementForm extends BaseEntity {

+ 2 - 2
src/views/settlement/chargeRecord/index.vue

@@ -78,14 +78,14 @@
                         <span>{{ scope.row.orderTime }}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="付款时间" align="center" prop="orderTime" width="180">
+                <el-table-column label="付款时间" align="center" prop="createTime" width="180">
                     <template #default="scope">
                         <span>{{ scope.row.createTime }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="看诊类型" align="center" prop="visitType">
                     <template #default="scope">
-                        <span>{{getDictLabel(treatment_user_type,scope.row.createTime)||'--' }}</span>
+                        <span>{{getDictLabel(treatment_user_type,scope.row.visitType)||'--' }}</span>
                     </template>
                 </el-table-column>
                 <el-table-column label="收费类型" align="center" prop="chargeType">

+ 62 - 44
src/views/settlement/waitCharge/index.vue

@@ -169,7 +169,7 @@
                             <th>用量/次</th>
                             <th>频次</th>
                             <th>使用天数</th>
-                            <th>首日</th> 
+                            <th>首日</th>
                             <th>用量/总</th>
                             <th>应收金额(元)</th>
                             <th>操作人</th>
@@ -180,7 +180,7 @@
                             <td>{{ Number(product.groupNo) + 1 || '--' }}</td>
                             <td>{{ product.nutritionProduct || '--' }}</td>
                             <td>{{ product.specification || '--' }}</td>
-                            <td>{{ product.dosagePerTime || '--' }}</td>
+                            <td>{{ product.salePrice || '--' }}</td>
                             <td>{{ product.dosePerTime || '--' }}</td>
                             <td>{{ product.frequency || '--' }}</td>
                             <td>{{ product.usageDays || '--' }}</td>
@@ -203,7 +203,7 @@
                             <th>应收金额(元)</th>
                             <th>操作人</th>
                         </tr>
-                    </thead> 
+                    </thead>
                     <tbody>
                         <tr v-for="(item, index) in screeningData" :key="index">
                             <td>{{ getDictLabel(fee_type,rowData.chargeType) || '--' }}</td>
@@ -241,8 +241,7 @@
                 </table>
 
                 <!-- 无数据提示 -->
-                <div v-if="recipeDetailData.length === 0 && screeningData.length === 0 && evaluationData.length === 0" 
-                     style="text-align: center; color: #909399; padding: 40px 0;">
+                <div v-if="recipeDetailData.length === 0 && screeningData.length === 0 && evaluationData.length === 0" style="text-align: center; color: #909399; padding: 40px 0;">
                     暂无数据
                 </div>
 
@@ -250,7 +249,7 @@
                 <div style="margin-top:10px;margin-bottom:130px">
                     <el-row>
                         <el-col style="text-align: right;">
-                            <span>(营养配置费:<span>¥0</span>)</span>
+                            <span>(营养配置费:<span>¥{{ prescriptionFee||'0' }}</span>)</span>
                         </el-col>
                     </el-row>
                     <el-row>
@@ -271,7 +270,7 @@
         </el-dialog>
         <!-- 现金收费dialog -->
         <el-dialog :title="moneyDialog.title" v-model="moneyDialog.visible" width="30%" append-to-body>
-            <div>
+            <el-form ref="chrageRecordFormRef" :model="rowData" :rules="rules" label-width="80px">
                 <el-row :gutter="10">
                     <el-col :span="7">
                         <div class="info-item">
@@ -327,11 +326,14 @@
                     </label>
                     <span class="amount-value">{{ changeFund.toFixed(2) }}</span>
                 </div>
+            </el-form>
+            <div>
+
             </div>
             <template #footer>
                 <div class="dialog-footer">
-                    <el-button v-if="showQRCodeButton" :loading="buttonLoading" type="primary" @click="handleRecheck">二维码支付</el-button>
-                    <el-button :loading="buttonLoading" type="primary" @click="handleRecheck">确认</el-button>
+                    <el-button v-if="showQRCodeButton" :loading="buttonLoading" type="primary">二维码支付</el-button>
+                    <el-button :loading="buttonLoading" type="primary" @click="handleAddCharge">确认</el-button>
                     <el-button :loading="buttonLoading" @click="moneyDialogCancel">取消</el-button>
                 </div>
             </template>
@@ -342,6 +344,8 @@
 <script setup name="Settlement" lang="ts">
     import { listSettlement, getSettlement, delSettlement, addSettlement, updateSettlement } from '@/api/patients/settlement';
     import { SettlementVO, SettlementQuery, SettlementForm } from '@/api/patients/settlement/types';
+    import { addRecord } from '@/api/settlement/chargeRecord';
+    import { ChrageRecordVO, ChrageRecordQuery, ChrageRecordForm } from '@/api/settlement/chargeRecord/types';
     import { listDept } from '@/api/system/dept'; // 部门列表
     import { listSet } from '@/api/parameter/chargeSet';
     import { ChargeSetVO } from '@/api/parameter/chargeSet/types';
@@ -362,12 +366,14 @@
     const fundsReceived = ref(0); //定义收到金额
     const changeFund = ref(0); //定义收到金额
     const treeData = ref([]); // 定义 treeData
-    const rowData=ref< SettlementVO >({})
+    const rowData = ref < SettlementVO > ({})
     const currentChargeMode = ref('1'); // 当前选择的收费方式,默认为现金收费
 
     const queryFormRef = ref < ElFormInstance > ();
     const chargeSetInfo = computed(() => useStore.chargeSetInfo as ChargeSetVO || {} as ChargeSetVO);
     const settlementFormRef = ref < ElFormInstance > ();
+    const chrageRecordFormRef = ref < ElFormInstance > ();
+    const prescriptionFee = ref(0)
     // 处方明细数据
     const recipeDetailData = ref([]);
     const evaluationData = ref([]);
@@ -397,6 +403,7 @@
         paymentStatus: undefined,
         paymentMethod: undefined,
         status: undefined,
+
     }
     const data = reactive < PageData < SettlementForm,
         SettlementQuery >> ({
@@ -427,10 +434,10 @@
         children: 'children' // 保持原有的父子结构
     });
 
-        // 过滤收费方式选项
+    // 过滤收费方式选项
     const filteredChargeWay = computed(() => {
         if (!charge_way.value) return [];
-        
+
         return charge_way.value.filter(dict => {
             // 银联支付(值为2)始终显示
             if (dict.value === '2') {
@@ -549,11 +556,13 @@
     const handleDetail = async (row ? : SettlementVO) => {
         reset();
         rowData.value = row || {} as SettlementVO;
+
         const _id = row ?.id || ids.value[0]
         const res = await getSettlement(_id);
         recipeDetailData.value = res.data.enteralNutritionList
         evaluationData.value = res.data.nutritionEvaluationList
         screeningData.value = res.data.nutritionScreeningList
+        prescriptionFee.value = res.data.prescriptionFee
         Object.assign(form.value, res.data);
         dialog.visible = true;
         dialog.title = "收费详情";
@@ -561,6 +570,7 @@
 
     /** 收费 */
     const handleCharge = async (row ? : SettlementVO) => {
+        rowData.value = row || {} as SettlementVO;
         // 设置默认收费方式为现金收费(值为1),如果现金收费可选的话
         const availableOptions = filteredChargeWay.value;
         const cashOption = availableOptions.find(option => option.value === '1');
@@ -570,7 +580,7 @@
             // 如果没有现金收费选项,默认选择第一个可用选项
             currentChargeMode.value = availableOptions[0].value;
         }
-        
+
         moneyDialog.visible = true;
         moneyDialog.title = "收费"
     }
@@ -603,18 +613,27 @@
     }
 
     /** 确认收费 - 添加金额验证 */
-    const handleRecheck = () => {
+    const handleAddCharge = () => {
         const received = parseFloat(String(fundsReceived.value)) || 0;
         const receivable = parseFloat(String(rowData.value.receivableAmount)) || 0;
-        
+
         if (received < receivable) {
-            proxy?.$modal.msgWarning('收到金额小于应收金额,请重新核对!');
+            proxy ?.$modal.msgWarning('收到金额小于应收金额,请重新核对!');
             return;
         }
-        
+        rowData.value.paymentMethod = currentChargeMode.value
+        rowData.value.settlementId = rowData.value.id
+        rowData.value.fundsReceived = rowData.value.receivableAmount
         // 这里可以添加确认收费的逻辑
-        proxy?.$modal.msgSuccess('收费成功');
-        moneyDialog.visible = false;
+        chrageRecordFormRef.value ?.validate(async (valid: boolean) => {
+            if (valid) {
+                await addRecord(rowData.value).finally();
+                proxy ?.$modal.msgSuccess('收费成功');
+                moneyDialog.visible = false;
+                await getList();
+            }
+        });
+
     }
 
     /** 提交按钮 */
@@ -650,7 +669,6 @@
         if (res.rows.length > 0) {
             useStore.setChargeInfo(res.rows[0]);
         }
-        console.log(JSON.stringify(chargeSetInfo.value));
     };
 
     /** 导出按钮操作 */
@@ -756,30 +774,30 @@
         }
     }
 
-        .setting-group {
-                display: flex;
-                align-items: center;
-                margin-bottom: 20px;
-
-                .setting-label {
-                    width: 180px;
-                    color: #606266;
-                    font-size: 14px;
-                    flex-shrink: 0;
-                    text-align: right;
-
-                    .required {
-                        color: #f56c6c;
-                        margin-right: 4px;
-                    }
-                }
+    .setting-group {
+        display: flex;
+        align-items: center;
+        margin-bottom: 20px;
 
-                .amount-value {
-                    color: #303133;
-                    font-size: 14px;
-                    font-weight: 500;
-                    min-width: 80px;
-                    text-align: left;
-                }
+        .setting-label {
+            width: 180px;
+            color: #606266;
+            font-size: 14px;
+            flex-shrink: 0;
+            text-align: right;
+
+            .required {
+                color: #f56c6c;
+                margin-right: 4px;
             }
+        }
+
+        .amount-value {
+            color: #303133;
+            font-size: 14px;
+            font-weight: 500;
+            min-width: 80px;
+            text-align: left;
+        }
+    }
 </style>