From 2c86a8bd60deed0dd0e044bad6fb83f75d19a332 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 26 十月 2025 15:05:50 +0800
Subject: [PATCH] Merge branch 'feature-task'

---
 app/pages/index.vue |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/app/pages/index.vue b/app/pages/index.vue
index 62a019b..ea9ae6d 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -163,6 +163,7 @@
   import { getUserProfile } from '@/api/system/user'
   import { getUserBoundVehicle } from '@/api/vehicle'
   import { getUnreadCount } from '@/api/message'
+  import { formatDateTime } from '@/utils/common'
   
   export default {
     data() {
@@ -248,10 +249,26 @@
         getUnreadCount().then(response => {
           if (response.code === 200) {
             this.unreadMessageCount = response.data || 0
+            // 鏇存柊TabBar寰芥爣
+            this.updateTabBarBadge(this.unreadMessageCount)
           }
         }).catch(error => {
           console.error('鑾峰彇鏈娑堟伅鏁伴噺澶辫触:', error)
         })
+      },
+      
+      // 鏇存柊TabBar寰芥爣
+      updateTabBarBadge(count) {
+        if (count > 0) {
+          uni.setTabBarBadge({
+            index: 3, // 娑堟伅椤甸潰鍦╰abBar涓殑绱㈠紩
+            text: count > 99 ? '99+' : count.toString()
+          })
+        } else {
+          uni.removeTabBarBadge({
+            index: 3
+          })
+        }
       },
       
       // 鍔犺浇鐢ㄦ埛淇℃伅锛堜繚鐣欎互鍏煎涔嬪墠鐨勪唬鐮侊級
@@ -315,7 +332,7 @@
                 vehicleList: task.assignedVehicles || [],
                 startLocation: this.formatAddress(task.departureAddress || task.startLocation || '鏈缃�'),
                 endLocation: this.formatAddress(task.destinationAddress || task.endLocation || '鏈缃�'),
-                startTime: task.plannedStartTime ? this.formatDateTime(task.plannedStartTime) : '鏈缃�',
+                startTime: task.plannedStartTime ? formatDateTime(task.plannedStartTime, 'YYYY-MM-DD HH:mm') : '鏈缃�',
                 assignee: task.assigneeName || '鏈垎閰�',
                 taskNo: task.taskCode || '鏈煡缂栧彿',
                 status: this.convertStatus(task.taskStatus) // 杞崲鐘舵�佹牸寮忎互鍏煎鏃I
@@ -324,19 +341,6 @@
         }).catch(error => {
           this.loading = false
           console.error('鍔犺浇浠诲姟鍒楄〃澶辫触:', error)
-        })
-      },
-      
-      // 鏍煎紡鍖栨棩鏈熸椂闂�
-      formatDateTime(dateTime) {
-        if (!dateTime) return ''
-        const date = new Date(dateTime)
-        return date.toLocaleString('zh-CN', {
-          year: 'numeric',
-          month: '2-digit',
-          day: '2-digit',
-          hour: '2-digit',
-          minute: '2-digit'
         })
       },
       
@@ -528,13 +532,13 @@
           'MAINTENANCE': '缁翠慨淇濆吇',
           'FUEL': '鍔犳补',
           'OTHER': '鍏朵粬',
-          'EMERGENCY_TRANSFER': '鎬ユ晳杞繍',
+          'EMERGENCY_TRANSFER': '杞繍浠诲姟',
           'WELFARE': '绂忕杞�',
           // 鏃ф牸寮忥紙UI绫诲瀷锛�
           'maintenance': '缁翠慨淇濆吇',
           'refuel': '鍔犳补',
           'inspection': '宸℃',
-          'emergency': '鎬ユ晳杞繍',
+          'emergency': '杞繍浠诲姟',
           'welfare': '绂忕杞�'
         }
         return typeMap[type] || '鏈煡绫诲瀷'

--
Gitblit v1.9.1