diff --git a/web/src/views/pisadmin/dashboard/BuyerDashboard.vue b/web/src/views/pisadmin/dashboard/BuyerDashboard.vue index 1df8c25..74486db 100644 --- a/web/src/views/pisadmin/dashboard/BuyerDashboard.vue +++ b/web/src/views/pisadmin/dashboard/BuyerDashboard.vue @@ -43,20 +43,29 @@ 询价单号 + 采购方式 物料名称 当前状态 - 截止时间 + 截止时间 / 剩余时间 操作 {{ task.inquiry_no }} + + {{ getMethodText(task.method) }} + {{ task.title }} {{ task.status }} - {{ task.created_at ? formatDate(task.created_at) : '-' }} + +
+ {{ getDeadlineText(task) }} + {{ getRemainingTimeText(task) }} +
+ @@ -177,16 +185,30 @@ function getQuoteStatusText(status: number) { return '待报价'; } -function isUrgent(deadline: string) { - if (!deadline) return false; +function getMethodClass(method: string) { + if (method === '招标') return 'method-tender'; + return 'method-inquiry'; +} + +function getMethodText(method: string) { + return method || '询价'; +} + +function getDeadlineClass(quote: any): string { + const deadline = quote.method === '招标' ? quote.bid_end_time : quote.quote_deadline; + if (!deadline) return ''; const now = new Date(); const deadlineDate = new Date(deadline); const diffHours = (deadlineDate.getTime() - now.getTime()) / (1000 * 60 * 60); - return diffHours < 24; + if (diffHours < 0) return 'deadline-expired'; + if (diffHours < 24) return 'deadline-urgent'; + if (diffHours < 48) return 'deadline-warning'; + return ''; } -function getRemainingTime(deadline: string) { - if (!deadline) return '-'; +function getRemainingTimeText(quote: any): string { + const deadline = quote.method === '招标' ? quote.bid_end_time : quote.quote_deadline; + if (!deadline) return ''; const now = new Date(); const deadlineDate = new Date(deadline); const diffMs = deadlineDate.getTime() - now.getTime(); @@ -195,9 +217,9 @@ function getRemainingTime(deadline: string) { const days = Math.floor(diffHours / 24); const hours = diffHours % 24; if (days > 0) { - return `${days}天${hours}小时`; + return `剩余 ${days}天${hours}小时`; } - return `${hours}小时`; + return `剩余 ${hours}小时`; } function formatDate(date: string) { @@ -206,6 +228,14 @@ function formatDate(date: string) { return `${d.getMonth() + 1}/${d.getDate()} ${d.getHours().toString().padStart(2, '0')}:${d.getMinutes().toString().padStart(2, '0')}`; } +function formatDateRange(start: string, end: string) { + if (!start || !end) return '-'; + const s = new Date(start); + const e = new Date(end); + const formatShort = (d: Date) => `${d.getMonth() + 1}/${d.getDate()}`; + return `${formatShort(s)}-${formatShort(e)}`; +} + function initChart() { if (!chartRef.value) return; const chart = echarts.getInstanceByDom(chartRef.value) || echarts.init(chartRef.value); @@ -578,6 +608,39 @@ tr:last-child td { border: 1px solid #d1d5db; } +/* 采购方式badge */ +.method-badge { + padding: 2px 8px; + border-radius: 4px; + font-size: 12px; + font-weight: 500; + display: inline-block; +} +.method-inquiry { + background-color: #f0fdf4; + color: #16a34a; + border: 1px solid #bbf7d0; +} +.method-tender { + background-color: #faf5ff; + color: #9333ea; + border: 1px solid #e9d5ff; +} + +/* 截止时间样式 */ +.deadline-urgent { + color: var(--danger) !important; + font-weight: 700; +} +.deadline-warning { + color: var(--warning) !important; + font-weight: 700; +} +.deadline-expired { + color: #9ca3af !important; + text-decoration: line-through; +} + .quote-countdown { display: flex; align-items: center;