Ver Fonte

首页评分工单统计跳转

HD_wangm há 5 meses atrás
pai
commit
4ce9a15d7d
1 ficheiros alterados com 53 adições e 8 exclusões
  1. 53 8
      pages/index/index.uvue

+ 53 - 8
pages/index/index.uvue

@@ -11,15 +11,14 @@
 				<view class="db-box" @click="navigateToAssignedOrders">
 					<view v-if="assignedCount > 0" class="badge"><text class="count">{{ assignedCount }}</text></view>
 					<view class="db-block">
-
 						<view class="db-center-1">
 							<image class="db-image" src="/static/images/map/1.png"></image>
-
 						</view>
 					</view>
 					<text class="db-text">待处理工单</text>
 				</view>
-				<view class="db-box">
+				<view class="db-box" @click="navigateToScoreOrders">
+					<view v-if="selfScoreCount > 0" class="badge"><text class="count">{{ selfScoreCount }}</text></view>
 					<view class="db-block">
 						<view class="db-center-2">
 							<image class="db-image" src="/static/images/map/2.png"></image>
@@ -59,6 +58,7 @@
     import { getUserInfo } from '../../utils/storage'
     import FlowChart from '../../components/index/flow-chart/flow-chart.uvue'
     import { getOrderList } from '../../api/order/list'
+    import { listMobileOrderScores } from '../../api/score/index'
 
     // 用户名
     const userName = ref<string>('用户')
@@ -66,10 +66,13 @@
 	// 待接单数量
 	const assignedCount = ref<number>(0)
 
+	// 待自评工单数量
+	const selfScoreCount = ref<number>(0)
+
 	// 获取待接单数量
 	const loadAssignedCount = async (): Promise<void> => {
 	    try {
-	        const result = await getOrderList(1, 1, null, 'assigned')
+	        const result = await getOrderList(1, 1, null, 'assigned,to_finish,to_approve,suspended')
 	        const resultObj = result as UTSJSONObject
 
 	        if (resultObj['code'] == 200) {
@@ -81,6 +84,27 @@
 	    }
 	}
 
+	// 获取待自评工单数量
+	const loadSelfScoreCount = async (): Promise<void> => {
+	    try {
+	        const params: UTSJSONObject = {
+	            pageNum: 1,
+	            pageSize: 1,
+	            scoringStatus: 'to_self,to_re,to_confirm,to_final'
+	        }
+
+	        const result = await listMobileOrderScores(params)
+	        const resultObj = result as UTSJSONObject
+
+	        if (resultObj['code'] == 200) {
+	            const total = resultObj['total'] as number
+	            selfScoreCount.value = total
+	        }
+	    } catch (e: any) {
+	        console.error('获取待自评工单数量失败:', e.message)
+	    }
+	}
+
 	// 跳转到待接单列表
 	const navigateToAssignedOrders = (): void => {
 		// 使用 redirectTo 而不是 switchTab,因为工单页面不是 tabBar 页面
@@ -89,9 +113,21 @@
 		})
 
 		// 延迟设置状态,确保页面已加载
-		setTimeout(() => {
-			uni.$emit('switchOrderStatus', 'assigned')
-		}, 500)
+		// setTimeout(() => {
+		// 	uni.$emit('switchOrderStatus', 'assigned')
+		// }, 500)
+	}
+
+	// 跳转到评分工单列表
+	const navigateToScoreOrders = (): void => {
+		uni.redirectTo({
+		    url: '/pages/score/index'
+		})
+
+		// 延迟设置状态,确保页面已加载
+		// setTimeout(() => {
+		// 	uni.$emit('switchScoreStatus', 'to_self')
+		// }, 500)
 	}
 
 	const handleCreateChannel = (showToast : boolean) => {
@@ -187,10 +223,18 @@
 		// 加载待接单数量
 		loadAssignedCount()
 
+		// 加载待自评工单数量
+		loadSelfScoreCount()
+
 		// 监听工单状态更新事件
 		uni.$on('refreshAssignedCount', () => {
 			loadAssignedCount()
 		})
+
+		// 监听评分工单状态更新事件
+		uni.$on('refreshSelfScoreCount', () => {
+			loadSelfScoreCount()
+		})
     })
 </script>
 
@@ -294,6 +338,7 @@
 				border-radius: 100px;
 				width:50px;
 				height:50px;
+				position: relative;
 			}
 			.db-center-3{
 				justify-content: center;
@@ -319,7 +364,7 @@
 		border-radius: 18rpx;
 		width: 36rpx;
 		height: 36rpx;
-		
+
 	}
 	.count {
 		line-height: 36rpx;