From 04324d5362dbf55a63e45a1d76e0377c3389ab61 Mon Sep 17 00:00:00 2001 From: sangchengzhi <2305486879@qq.com> Date: Mon, 12 Jan 2026 19:30:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=99=90=E9=A2=9D=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C24=E5=B0=8F=E6=97=B6=E5=86=85=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=85=85=E5=80=BC=E7=AD=89=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/request/api.js | 2 +- src/views/ZYCharge.vue | 122 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 111 insertions(+), 13 deletions(-) diff --git a/src/request/api.js b/src/request/api.js index a99ef13..3a3c8b8 100644 --- a/src/request/api.js +++ b/src/request/api.js @@ -194,7 +194,7 @@ export const apiInHosPatientInfoQuery = p => post('/userorder/InHosPatientInfoQu //住院预交记录查询 export const apiInHosChargeRecordQuery = p => post('/userorder/InHosChargeRecordQuery', p); - +export const yjjXeQuery = p => post('/userorder/yjjXeQuery', p); //预存缴费 export const apipay = p => post('/userorder/pay', p); diff --git a/src/views/ZYCharge.vue b/src/views/ZYCharge.vue index b512180..232f33c 100644 --- a/src/views/ZYCharge.vue +++ b/src/views/ZYCharge.vue @@ -24,6 +24,7 @@ 查询预交记录> +
支付金额 @@ -42,12 +43,12 @@

4000元

-
-

6000元

+
+

5000元

-
+
@@ -56,7 +57,7 @@
-
支付
+
支付
@@ -113,18 +114,28 @@ import { apiInHosChargeRecordQuery, apipay, getUserCategory, - apiOpWxQuery + apiOpWxQuery, + yjjXeQuery } from "@/request/api.js"; import Vue from "vue"; -import { Toast, Empty, Calendar, RadioGroup, Radio, Field, ActionSheet } from "vant"; +import { Toast, Empty, Calendar, RadioGroup, Radio, Field, ActionSheet, Dialog } from "vant"; Vue.use(ActionSheet); Vue.use(Calendar); Vue.use(Radio); Vue.use(RadioGroup); Vue.use(Field); +Vue.use(Dialog); export default { mounted() { this.title = this.$route.meta.title; + // 显示住院预交金缴纳须知弹窗 + Dialog.alert({ + title: '住院预交金缴纳须知', + messageAlign: 'left', + message: '尊敬的患者及家属:\n\n现就住院预交金缴纳事宜告知如下:\n\n1、办理住院 24 小时内,暂不支持线上缴预交金,需充值请前往住院收费窗口办理。\n2、24 小时后可通过掌上医院缴费,但每位患者每日最高限 5000 元;超 5000 元需到窗口办理。\n3、窗口办理请携带患者有效身份证件、住院病历号(或押金单);疑问可咨询护士站或收费窗口。\n\n感谢配合,祝您早日康复!' + }).then(() => { + // 弹窗关闭后的回调操作 + }); }, computed: { patientActions() { @@ -145,12 +156,13 @@ export default { radio: "1", chargemoney: 1000, qtchargemoney: "", - zyinfo: {}, + zyinfo: { YJJKC: 0 }, showbox: false, btnclass: "btn", patientIds: [], // 存储多个 PatientId patientId: null, // 选中的 PatientId showPatientSelector: false, + yjjxes :5000 }; }, created() { @@ -189,8 +201,57 @@ export default { }); return; }, + yjjxe(){ + return yjjXeQuery({patientId:this.patientId}).then(res => { + console.log("预交金限额查询",res); + return res.data; + }) + }, onConfirm() { - + if(this.zyinfo.YJJKC < this.chargemoney){ + Toast({ + message: '今日线上剩余可充值额度不足,请调整充值金额或到收费室进行充值!', + duration: 4500 // 设置显示时长为 3 秒 + }); + return; + // Toast({ + // message: '您本日线上预交金充值已限额,如需充值请到收费室充值!', + // duration: 4000 // 设置显示时长为 4秒 + // }); + + } + if(this.patientId != "90134173"){ + Toast({ + message: '因医院原因,暂时不开放线上充值预交金功能,请到门诊缴费窗口充值!', + duration: 3000 // 设置显示时长为 3 秒 +}); +return; + } + + + if(this.zyinfo.HOSDATE ){ + // 计算时间差 + const hosDate = new Date(this.zyinfo.HOSDATE); + const now = new Date(); + const timeDiff = now - hosDate; // 毫秒差 + const hoursDiff = timeDiff / (1000 * 60 * 60); // 转换为小时 + + if (hoursDiff < 24) { + // 计算剩余时间 + const remainingMs = (24 - hoursDiff) * 1000 * 60 * 60; + const remainingHours = Math.floor(remainingMs / (1000 * 60 * 60)); + const remainingMinutes = Math.floor((remainingMs % (1000 * 60 * 60)) / (1000 * 60)); + + // 小于24小时,显示提示 + Toast({ + message: `患者24小时内如需充值需在门诊部1楼收费室进行充值,${remainingHours}小时${remainingMinutes}分钟后才能线上充值预交金!`, + duration: 5000 // 设置显示时长为 5 秒 + }); + return; + } + // 大于24小时,继续执行下面的流程 + } + let _this = this; let formData = { cardno: _this.zyinfo.INHOSPATIENTID, @@ -352,7 +413,37 @@ return; }); }, inputmoney() { - this.chargemoney = this.qtchargemoney; + // 获取原始输入值 + const rawInput = this.qtchargemoney; + + // 确保输入的是数字,且最多两位小数 + // 使用正则表达式验证:只允许数字和小数点后最多两位 + if (!/^\d+(\.\d{0,2})?$/.test(rawInput)) { + // 如果输入不符合格式,截取到最后一个有效字符 + this.qtchargemoney = rawInput.slice(0, -1); + return; + } + + // 确保输入的是数字 + let inputMoney = parseFloat(this.qtchargemoney); + + // 检查是否为有效数字 + if (isNaN(inputMoney)) { + this.qtchargemoney = ""; + this.chargemoney = 1000; + return; + } + + // 限制最大金额为5000 + if (inputMoney > 5000) { + inputMoney = 5000; + this.qtchargemoney = "5000"; + } + + // 更新金额 + this.chargemoney = inputMoney; + + // 如果输入为空,设置默认金额 if (this.qtchargemoney == "") { this.chargemoney = 1000; } @@ -384,14 +475,21 @@ return; if (Array.isArray(dataRows)) { for (var i = 0; i < dataRows.length; i++) { if (dataRows[i].HOSSTATE == "0" || dataRows[i].HOSSTATE == "") { - _this.zyinfo = dataRows[i]; + _this.yjjxe().then(money => { + dataRows[i].YJJKC = _this.yjjxes - money; +_this.zyinfo = dataRows[i]; _this.showbox = true; +}); } } } else { if (dataRows.HOSSTATE == "0" || dataRows.HOSSTATE == "") { - _this.zyinfo = dataRows; + _this.yjjxe().then(money => { + dataRows.YJJKC = _this.yjjxes - money; + _this.zyinfo = dataRows; _this.showbox = true; +}); + } } }