From d70d18039f31942c120f24b43a87f85ce6ba8416 Mon Sep 17 00:00:00 2001 From: huangyuxuan Date: Tue, 3 Dec 2024 18:02:51 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D](dev):=20?= =?UTF-8?q?=20=20=E8=AF=81=E4=BB=B6=E4=BF=A1=E6=81=AF=E5=8D=B3=E5=B0=86?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=98=BE=E7=A4=BA=E6=9C=AA=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=87=8D=E6=96=B0=E6=8E=A8=E9=80=81=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardOverdue/components/corpUserList.vue | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/views/train/cardOverdue/components/corpUserList.vue b/src/views/train/cardOverdue/components/corpUserList.vue index c0d6654..3d1261b 100644 --- a/src/views/train/cardOverdue/components/corpUserList.vue +++ b/src/views/train/cardOverdue/components/corpUserList.vue @@ -184,20 +184,23 @@ export default { this.getList() }, methods: { - getCardStatus(VALIDITY_PERIOD_END){ - const nowDate = new Date() - const nextDate = new Date((new Date).getFullYear() + '-' + ((new Date).getMonth() + 3) + '-' + (new Date).getDate()) - console.log('当前时间 ==>'+nowDate) - console.log('两个月后的时间 ==>'+nextDate) - console.log('证件到期日 ==>'+new Date(VALIDITY_PERIOD_END)) - if (nowDate > new Date(VALIDITY_PERIOD_END)){ - return 1 - }else if (new Date(VALIDITY_PERIOD_END) > nowDate && new Date(VALIDITY_PERIOD_END) < nextDate){ - return 2 - }else { - return 0 - } + getCardStatus(VALIDITY_PERIOD_END) { + const now = new Date(); // 当前时间 + const threeMonthsLater = new Date(now); // 三个月后的时间 + threeMonthsLater.setMonth(threeMonthsLater.getMonth() + 3); // 设置为未来三个月后的时间 + // 将VALIDITY_PERIOD_END转换为Date对象(假设它是一个有效的日期字符串) + const validityPeriodEnd = new Date(VALIDITY_PERIOD_END); + // 比较日期并返回状态 + if (now > validityPeriodEnd) { + // 证件已过期 + return 1; + } else if (validityPeriodEnd > now && validityPeriodEnd <= threeMonthsLater) { + // 证件即将到期 + return 2; + } else { + return 0; + } }, filterNode(value, data) { if (!value) return true