From bca23b5d65257f0ce0a9b06167946e7fc2ed2422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Mon, 20 Apr 2026 13:03:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=85=8D=E9=98=9F=E5=91=98=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=AE=8C=E6=88=90=E4=BA=BA=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/record/index.vue | 83 +++++++++++++++++---------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/src/views/user/record/index.vue b/src/views/user/record/index.vue index f4d2f7e..9c38c19 100644 --- a/src/views/user/record/index.vue +++ b/src/views/user/record/index.vue @@ -520,6 +520,7 @@ import { computed, reactive, ref, watch } from 'vue'; import { ElMessage } from 'element-plus'; import { UploadFilled, ArrowRight, Close, CircleCheck } from '@element-plus/icons-vue'; import ProTable from '/@/components/ProTable/index.vue'; +import { formatDate } from '/@/utils/formatTime'; import { usereventrecordListGet, usereventrecordCancelPost, @@ -649,46 +650,29 @@ const getEventStatusText = (status) => { }; const disableCancel = computed(() => { - if (!currentRow.value) return true; - const payStatus = normalizeToNumber(currentRow.value.payStatus); - // 只有支付状态为已支付(1),才能取消/退款 - return !(payStatus === 1); + if (!currentRow.value) return true; + const payStatus = normalizeToNumber(currentRow.value.payStatus); + const paymentMethod = normalizeToNumber(currentRow.value.paymentMethod); + // 如果是线下支付(1),仅当支付状态为未支付(0)或已支付(1)时允许取消 + // 否则只有支付状态为已支付(1),才能取消/退款 + if (paymentMethod === 1) { + // 线下支付:仅未支付(0)或已支付(1)允许取消 + return !(payStatus === 0 || payStatus === 1); + } + return !(payStatus === 1); }); const isCancelDisabledByRow = (row) => { - if (!row) return true; - const payStatus = normalizeToNumber(row.payStatus); - // 只有支付状态为已支付(1),才能取消/退款 - return !(payStatus === 1); -}; - -// 格式化日期 -const formatDate = (date, fmt) => { - if (!date) return ''; - const d = new Date(date); - if (isNaN(d.getTime())) return ''; - - let result = fmt; - const o = { - 'Y+': d.getFullYear(), - 'm+': d.getMonth() + 1, - 'd+': d.getDate(), - 'H+': d.getHours(), - 'M+': d.getMinutes(), - 'S+': d.getSeconds(), - 'q+': Math.floor((d.getMonth() + 3) / 3), - 's': d.getMilliseconds() - }; - - for (let k in o) { - if (new RegExp('(' + k + ')').test(result)) { - result = result.replace( - RegExp.$1, - (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)) - ); - } - } - return result; + if (!row) return true; + const payStatus = normalizeToNumber(row.payStatus); + const paymentMethod = normalizeToNumber(row.paymentMethod); + // 如果是线下支付(1),仅当支付状态为未支付(0)或已支付(1)时允许取消 + // 否则只有支付状态为已支付(1),才能取消/退款 + if (paymentMethod === 1) { + // 线下支付:仅未支付(0)或已支付(1)允许取消 + return !(payStatus === 0 || payStatus === 1); + } + return !(payStatus === 1); }; // 格式化组别的年龄段(出生日期范围) @@ -696,10 +680,29 @@ const formatGroupDate = (item) => { const start = item?.birthDateStart; const end = item?.birthDateEnd; if (!start && !end) return ''; + + // 修复日期解析,处理两位数年份的情况 + const fixDate = (dateStr) => { + if (!dateStr) return ''; + // 如果是类似 "85-01-01" 这种格式,尝试转换为完整年份 + if (typeof dateStr === 'string' && /^\d{2}-\d{2}-\d{2}$/.test(dateStr)) { + const [year, month, day] = dateStr.split('-'); + const fullYear = parseInt(year, 10) < 50 ? 2000 + parseInt(year, 10) : 1900 + parseInt(year, 10); + return `${fullYear}-${month}-${day}`; + } + return dateStr; + }; + const fmt = (v) => { if (!v) return ''; - try { return formatDate(new Date(v), 'YYYY-mm-dd'); } catch { return String(v); } + try { + const fixedDate = fixDate(v); + return formatDate(new Date(fixedDate), 'YYYY-mm-dd'); + } catch { + return String(v); + } }; + if (start && end) return `${fmt(start)} ~ ${fmt(end)}`; return fmt(start || end); }; @@ -749,8 +752,8 @@ const formatRefundRules = (rules) => { // 格式化项目标题 const formatItemTitle = (item) => { const projectType = item.projectTypeName || ''; - // 使用从后端Project表读取的完成人数 - const completionCount = item.projectCompletionCount ?? 0; + // 使用报名项目人数作为完成人数显示 + const completionCount = item.personCount ?? 0; const projectName = item.projectName || ''; const groupName = item.groupName || ''; const dateRange = formatGroupDate(item);