|
|
@@ -6,12 +6,15 @@
|
|
|
|
|
|
<!-- <view class="bg-color"></view> -->
|
|
|
<scroll-view class="page-content">
|
|
|
-
|
|
|
+
|
|
|
<view class="db-view">
|
|
|
- <view class="db-box">
|
|
|
+ <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>
|
|
|
@@ -33,17 +36,17 @@
|
|
|
<text class="db-text">超时工单</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
<!-- 支流出库流量图表 -->
|
|
|
<!-- <view class="chart-section">
|
|
|
<text class="section-title">支流出库流量 (m³/s)</text>
|
|
|
<flow-chart />
|
|
|
</view> -->
|
|
|
-
|
|
|
+
|
|
|
<view>
|
|
|
<button @click="handlePush">通知</button>
|
|
|
</view>
|
|
|
-
|
|
|
+
|
|
|
</scroll-view>
|
|
|
|
|
|
<!-- 底部 TabBar -->
|
|
|
@@ -55,10 +58,42 @@
|
|
|
import { ref, onMounted } from 'vue'
|
|
|
import { getUserInfo } from '../../utils/storage'
|
|
|
import FlowChart from '../../components/index/flow-chart/flow-chart.uvue'
|
|
|
+ import { getOrderList } from '../../api/order/list'
|
|
|
|
|
|
// 用户名
|
|
|
const userName = ref<string>('用户')
|
|
|
-
|
|
|
+
|
|
|
+ // 待接单数量
|
|
|
+ const assignedCount = ref<number>(0)
|
|
|
+
|
|
|
+ // 获取待接单数量
|
|
|
+ const loadAssignedCount = async (): Promise<void> => {
|
|
|
+ try {
|
|
|
+ const result = await getOrderList(1, 1, null, 'assigned')
|
|
|
+ const resultObj = result as UTSJSONObject
|
|
|
+
|
|
|
+ if (resultObj['code'] == 200) {
|
|
|
+ const total = resultObj['total'] as number
|
|
|
+ assignedCount.value = total
|
|
|
+ }
|
|
|
+ } catch (e: any) {
|
|
|
+ console.error('获取待接单数量失败:', e.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 跳转到待接单列表
|
|
|
+ const navigateToAssignedOrders = (): void => {
|
|
|
+ // 使用 redirectTo 而不是 switchTab,因为工单页面不是 tabBar 页面
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/order/index'
|
|
|
+ })
|
|
|
+
|
|
|
+ // 延迟设置状态,确保页面已加载
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.$emit('switchOrderStatus', 'assigned')
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
+
|
|
|
const handleCreateChannel = (showToast : boolean) => {
|
|
|
// #ifdef APP-ANDROID
|
|
|
const manager = uni.getPushChannelManager()
|
|
|
@@ -78,7 +113,7 @@
|
|
|
}
|
|
|
// #endif
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const handleCreateLocalNotification = () => {
|
|
|
if (uni.getAppAuthorizeSetting().notificationAuthorized == "authorized") {
|
|
|
handleCreateChannel(false)
|
|
|
@@ -130,7 +165,7 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
const handlePush = () => {
|
|
|
// uni.navigateTo({
|
|
|
// url: '/pages/push/index',
|
|
|
@@ -148,6 +183,14 @@
|
|
|
const realName = userInfo['nickName'] as string | null
|
|
|
userName.value = realName ?? '用户'
|
|
|
}
|
|
|
+
|
|
|
+ // 加载待接单数量
|
|
|
+ loadAssignedCount()
|
|
|
+
|
|
|
+ // 监听工单状态更新事件
|
|
|
+ uni.$on('refreshAssignedCount', () => {
|
|
|
+ loadAssignedCount()
|
|
|
+ })
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
@@ -189,7 +232,7 @@
|
|
|
.header {
|
|
|
flex-direction: row;
|
|
|
height: 40px;
|
|
|
-
|
|
|
+
|
|
|
&-title {
|
|
|
font-size: 40rpx;
|
|
|
color: #ffffff;
|
|
|
@@ -218,12 +261,12 @@
|
|
|
box-shadow: 0 0 16rpx 0 rgba(0, 0, 0, 0.1);
|
|
|
border-radius: 16rpx;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.db-view{
|
|
|
flex-direction: row;
|
|
|
justify-content: space-between;
|
|
|
margin-bottom: 5px;
|
|
|
-
|
|
|
+
|
|
|
.db-box{
|
|
|
background-color: #fff;
|
|
|
width:80px;
|
|
|
@@ -242,6 +285,7 @@
|
|
|
border-radius: 100px;
|
|
|
width:50px;
|
|
|
height:50px;
|
|
|
+ position: relative;
|
|
|
}
|
|
|
.db-center-2{
|
|
|
justify-content: center;
|
|
|
@@ -265,4 +309,22 @@
|
|
|
height:20px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .badge {
|
|
|
+ z-index: 999;
|
|
|
+ position: absolute;
|
|
|
+ top: 20rpx;
|
|
|
+ right: 10rpx;
|
|
|
+ background-color: #ff4d4f;
|
|
|
+ border-radius: 18rpx;
|
|
|
+ width: 36rpx;
|
|
|
+ height: 36rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+ .count {
|
|
|
+ line-height: 36rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: #ffffff;
|
|
|
+ }
|
|
|
</style>
|