|
|
@@ -11,8 +11,11 @@
|
|
|
|
|
|
<view class="status-bar">
|
|
|
<view class="status-box">
|
|
|
- <text class="status-txt" :class="{'stauts-sel':ix == 0}">全部</text>
|
|
|
- <text class="status-txt" :class="{'stauts-sel':ix == 1}">待接单</text>
|
|
|
+ <text class="status-txt" :class="{'stauts-sel': currentStatus === ''}" @click="switchStatus('')">全部</text>
|
|
|
+ <text class="status-txt" :class="{'stauts-sel': currentStatus === 'assigned'}" @click="switchStatus('assigned')">待接单</text>
|
|
|
+ <text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_finish'}" @click="switchStatus('to_finish')">待结单</text>
|
|
|
+ <text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_approve'}" @click="switchStatus('to_approve')">待审批</text>
|
|
|
+ <text class="status-txt" :class="{'stauts-sel': currentStatus === 'completed'}" @click="switchStatus('completed')">已完成</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<!-- 列表内容 -->
|
|
|
@@ -78,7 +81,7 @@
|
|
|
const loading = ref<boolean>(false)
|
|
|
const refreshing = ref<boolean>(false)
|
|
|
const total = ref<number>(0)
|
|
|
- const ix = ref<number>(1)
|
|
|
+ const currentStatus = ref<string>('') // 添加状态管理
|
|
|
|
|
|
// 辅助函数:从 any 类型提取属性
|
|
|
const getOrderType = (item: any | null): string => {
|
|
|
@@ -117,6 +120,13 @@
|
|
|
return orderInfoItem.assignTime
|
|
|
}
|
|
|
|
|
|
+ // 切换状态
|
|
|
+ const switchStatus = (status: string): void => {
|
|
|
+ currentStatus.value = status
|
|
|
+ page.value = 1
|
|
|
+ loadData(true)
|
|
|
+ }
|
|
|
+
|
|
|
// 加载列表数据
|
|
|
const loadData = async (isRefresh: boolean | null): Promise<void> => {
|
|
|
if (loading.value) {
|
|
|
@@ -135,9 +145,9 @@
|
|
|
page.value = 1
|
|
|
}
|
|
|
|
|
|
- // 调用 API
|
|
|
+ // 调用 API,传递状态参数
|
|
|
const searchKeyword = keyword.value.length > 0 ? keyword.value : null
|
|
|
- const result = await getOrderList(page.value, pageSize, searchKeyword)
|
|
|
+ const result = await getOrderList(page.value, pageSize, searchKeyword, currentStatus.value || null)
|
|
|
|
|
|
// 提取响应数据
|
|
|
const resultObj = result as UTSJSONObject
|
|
|
@@ -153,8 +163,8 @@
|
|
|
const orderItem: orderInfo = {
|
|
|
orderType: item['orderType'] as Number,
|
|
|
id: item['id'] as Number,
|
|
|
- teamLeaderName: item['teamLeaderName'] as string | '',
|
|
|
- acceptUserName: item['acceptUserName'] as string | '',
|
|
|
+ teamLeaderName: item['teamLeaderName'] as string | null,
|
|
|
+ acceptUserName: item['acceptUserName'] as string | null,
|
|
|
acceptTime: item['acceptTime'] as string | null,
|
|
|
assignTime: item['assignTime'] as string | null,
|
|
|
assignUserName: item['assignUserName'] as string | null,
|
|
|
@@ -173,6 +183,7 @@
|
|
|
newData.push(orderItem)
|
|
|
}
|
|
|
|
|
|
+ // 不再在前端过滤,直接使用API返回的数据
|
|
|
if (shouldRefresh) {
|
|
|
dataList.value = newData
|
|
|
} else {
|
|
|
@@ -239,9 +250,9 @@
|
|
|
// 点击列表项
|
|
|
const handleItemClick = (item: any | null, index: number): void => {
|
|
|
if (item == null) return
|
|
|
- const contractorItem = item as ContractorInfo
|
|
|
+ const orderItem = item as orderInfo
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/workbench/detail/index?id=${contractorItem.id}`
|
|
|
+ url: `/pages/workbench/detail/index?id=${orderItem.id}`
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -300,17 +311,17 @@
|
|
|
flex: 1;
|
|
|
|
|
|
.status-txt{
|
|
|
- padding: 8px;
|
|
|
- width: 70px;
|
|
|
+ padding: 8px 12px;
|
|
|
text-align: center;
|
|
|
margin-right: 12rpx;
|
|
|
border-radius: 36rpx;
|
|
|
background-color: #fff;
|
|
|
font-size: 28rpx;
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
|
|
|
.stauts-sel{
|
|
|
- background-color: blue;
|
|
|
+ background-color: #007AFF;
|
|
|
color: #fff;
|
|
|
}
|
|
|
}
|
|
|
@@ -390,4 +401,4 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|