更改ios适配时间,更改页面挂号顺序
This commit is contained in:
@@ -133,7 +133,8 @@ beforeDestroy() {
|
||||
this.list = res.DiagnosticInfos || [];
|
||||
// 按签到时间倒序排列(最新的在前面)
|
||||
this.list.sort((a, b) => {
|
||||
return new Date(`2025-10-29 ${b.DiagnosticOrderTime}`) - new Date(`2025-10-29 ${a.DiagnosticOrderTime}`);
|
||||
// 修复iOS日期兼容性问题
|
||||
return new Date(`2025/10/29 ${b.DiagnosticOrderTime}`) - new Date(`2025/10/29 ${a.DiagnosticOrderTime}`);
|
||||
});
|
||||
this.finished = true;
|
||||
} else {
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<p>{{ item.DOCTORNAME }}</p>
|
||||
<p>
|
||||
就诊时间:{{
|
||||
item.REGISTERDATE.split(" ")[0] + " " + item.TIMEINTERVAL
|
||||
item.REGISTERDATE.split(" ")[0] + " " + getTime(item.TIMEINTERVAL)
|
||||
}}
|
||||
</p>
|
||||
<!--em>{{item.OrderNo}}</em-->
|
||||
@@ -171,6 +171,17 @@ let that = this;
|
||||
that.getList();
|
||||
}
|
||||
},
|
||||
// 解析日期,兼容iOS
|
||||
parseDate(dateStr) {
|
||||
if (!dateStr) return new Date();
|
||||
|
||||
// 替换掉"-"分隔符为"/",以兼容iOS
|
||||
if (dateStr.indexOf('-') > -1 && dateStr.indexOf('T') === -1) {
|
||||
dateStr = dateStr.replace(/-/g, '/');
|
||||
}
|
||||
|
||||
return new Date(dateStr);
|
||||
},
|
||||
getTime(time) {
|
||||
switch (time) {
|
||||
case "AM":
|
||||
@@ -240,6 +251,10 @@ let that = this;
|
||||
console.log(res);
|
||||
if (res.data != null) {
|
||||
_this.list = res.data;
|
||||
// 添加排序:按就诊时间从近到远(距离最近的排最上面)
|
||||
_this.list.sort((a, b) => {
|
||||
return _this.parseDate(b.REGISTERDATE) - _this.parseDate(a.REGISTERDATE);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -263,6 +278,28 @@ let that = this;
|
||||
} else {
|
||||
_this.list.push(jsonObj2.response.data.data_row);
|
||||
}
|
||||
|
||||
// 添加排序:按就诊时间从近到远(距离最近的排最上面)
|
||||
_this.list.sort((a, b) => {
|
||||
// 将日期和时间段组合成可比较的日期对象
|
||||
const timeWeight = {
|
||||
'AM': 0,
|
||||
'PM': 1,
|
||||
'AL': 0.5,
|
||||
'NT': 2
|
||||
};
|
||||
|
||||
const dateA = _this.parseDate(a.REGISTERDATE);
|
||||
const dateB = _this.parseDate(b.REGISTERDATE);
|
||||
|
||||
// 先比较日期(最近的排在前面)
|
||||
if (dateA.getTime() !== dateB.getTime()) {
|
||||
return dateB - dateA;
|
||||
}
|
||||
|
||||
// 日期相同时,比较时间段(上午在前,下午在后)
|
||||
return (timeWeight[a.TIMEINTERVAL] || 0) - (timeWeight[b.TIMEINTERVAL] || 0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ export default {
|
||||
statusText: item.appStatus === 4 ? '已支付' : item.appStatus === 1 ? '已退号' : '未知状态'
|
||||
}))
|
||||
.filter(item => item.status === 4) // 只显示可退号的记录(已支付状态)
|
||||
.sort((a, b) => new Date(b.registerdate) - new Date(a.registerdate)); // 按照日期降序排序,最新日期在前
|
||||
.sort((a, b) => this.parseDate(b.registerdate) - this.parseDate(a.registerdate)); // 按照日期降序排序,最新日期在前
|
||||
|
||||
// 如果有挂号记录,默认选中第一条
|
||||
if (this.registrationList.length > 0) {
|
||||
@@ -402,6 +402,17 @@ export default {
|
||||
// 将YYYYMMDD转换为YYYY-MM-DD
|
||||
return `${dateStr.substring(0, 4)}-${dateStr.substring(4, 6)}-${dateStr.substring(6, 8)}`;
|
||||
},
|
||||
// 解析日期,兼容iOS
|
||||
parseDate(dateStr) {
|
||||
if (!dateStr) return new Date();
|
||||
|
||||
// 替换掉"-"分隔符为"/",以兼容iOS
|
||||
if (dateStr.indexOf('-') > -1 && dateStr.indexOf('T') === -1) {
|
||||
dateStr = dateStr.replace(/-/g, '/');
|
||||
}
|
||||
|
||||
return new Date(dateStr);
|
||||
},
|
||||
|
||||
//门诊医保查询退费
|
||||
searchRegistrationInfo2(){
|
||||
@@ -506,7 +517,7 @@ export default {
|
||||
originalData: item
|
||||
};
|
||||
})
|
||||
.sort((a, b) => new Date(b.payTime) - new Date(a.payTime)); // 按支付时间降序排序
|
||||
.sort((a, b) => this.parseDate(b.payTime) - this.parseDate(a.payTime)); // 按支付时间降序排序
|
||||
|
||||
// 显示门诊自费退费记录弹窗
|
||||
if (this.selfPaymentList.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user