Sfoglia il codice sorgente

[dev]
1、优化tabvar中标题显示
2、下拉上拉时,刷新标题中today数据的length

Neo 1 anno fa
parent
commit
216844ab6a
1 ha cambiato i file con 15 aggiunte e 35 eliminazioni
  1. 15 35
      pages/index/index.vue

+ 15 - 35
pages/index/index.vue

@@ -6,7 +6,7 @@
 				<view class="tab-bar">
 					<view class="tab_item" v-for="(tab, index) in tabList" :key="index"
 						:class="{'active':tabActive==index}" @click="checkIndex(index)">
-						<text class="text">{{tab.title}}{{tabActive===0 && index==0 && orderList.length>0?"("+orderList.length+")":""}}</text>
+						<text class="text">{{tab.title}}</text>
 					</view>
 				</view>
 				<view class="search-bar">
@@ -92,7 +92,7 @@
 							/>
 						</template>
 						<view v-if="isBottom" class="order-bottom">
-							<view class="text">-- 没有更多数据 --</view>
+							<view class="text" style="margin-top: 30rpx;font-size: 20rpx;color: #18C7B0;">-- 没有更多数据 --</view>
 						</view>
 					</scroll-view>
 					<view v-else class="text">
@@ -269,6 +269,9 @@ onLoad(async () => {
 		}
 		if(tabActive.value ==0){
 			tabList.value[0].leng = orderList.value.length
+			if(tabList.value[0].leng>0){
+				tabList.value[0].title = tabName.value + '(' + tabList.value[0].leng + ')'
+			}
 		}
 	}
 })
@@ -412,30 +415,7 @@ const handleRefresh = async()=>{
 		orderList.value[i].selected = false
 	})
 	console.log('yijianshifang >orderList>>forEach', orderList.value)
-	// ccc.value = '完成'
-	// const params = {
-	// 	token: uni.getStorageSync('token'),
-	// 	data:{ids:ids.value.toString()}
-	// }
-	// console.log('handleRefresh >params>>666',params)
-	// const {data:res} = await releaseOrder(params)
-
-	// if (res.code === 200) {
-	// 	if(ids.value.length>0){
-	// 		console.log('ids.value',ids.value)
-	// 		ids.value.forEach(x=>{
-	// 			console.log('orderList',orderList.value)
-	// 			const index = orderList.value.findIndex(y=>y.id == x)
-	// 			console.log('orderList index',index)
-	// 			if(index>-1){
-	// 				console.log('orderList',orderList.value)
-	// 				orderList.value.splice(index,1)
-	// 				console.log('orderList',orderList.value)
-	// 			}
-	// 		})
-	// 		ids.value = []
-	// 	}
-	// }
+	
 }
 
 
@@ -628,7 +608,7 @@ const checkIndex = async(index) => {
 	console.log('index',index)
 	ids.value = []
 	reset()
-	tabName.value = tabList.value[index].title
+	// tabName.value = tabList.value[index].title
 	currentStatus.value = parseInt(tabList.value[index].status)
 	const token = uni.getStorageSync('token')
 	const paramss = {
@@ -640,7 +620,7 @@ const checkIndex = async(index) => {
 			status: tabList.value[tabActive.value].status
 		})
 	}
-	console.log('checkIndex params',paramss)
+	console.log('checkIndex params today》》》',paramss)
 	const {data:res} = await receiveOrderList(paramss)
 	if (res.code === 200) {
 		total.value = res.total
@@ -657,19 +637,18 @@ const checkIndex = async(index) => {
 	if(tabActive.value==1) {
 		const param = {
 			token: uni.getStorageSync('token'),
-			// data:JSON.stringify({
-			// 	currentUserId: parseInt(uni.getStorageSync('userId')),
-			// 	page: page.value,
-			// 	pageSize: pageSize.value,
-			// 	status: tabList.value[tabActive.value].status
-			// })
 		}
-		console.log('checkIndex param',param)
+		console.log('checkIndex param,history》》',param)
 		const {data:res} = await selectDepartment(param)
 		if (res.code === 200) {
 			officeArr.value.push(...res.data)
 			console.log('selectDepartment officeArr.value', officeArr.value)
 		}
+	} else {
+		if(orderList.value.length>0){
+			tabList.value[0].leng = orderList.value.length
+			tabList.value[0].title = tabName.value + '(' + tabList.value[0].leng + ')'
+		}
 	}
 }
 
@@ -721,6 +700,7 @@ const loadMoreList = async()=>{
 		if(tabActive.value ==0){
 			console.log('tabActive===',)
 			tabList.value[0].leng = orderList.value.length
+			tabList.value[0].title = tabName.value + '(' + tabList.value[0].leng + ')'
 		}
 	}
 }