societyHome.vue 4.2 KB
<template>
	<view class="company_container">
		<up-navbar placeholder :leftIconSize="0" bgColor="transparent" />
		<!-- 头部筛选 -->
		<view class="nav_header">
			<view class="nav_item" :class="{ active: queryParams.type === 0 }" @click="changeList(0)">个人车险</view>
			<view class="colLine"></view>
			<view class="nav_item" :class="{ active: queryParams.type === 1 }" @click="changeList(1)">企业车险</view>
		</view>
		<view class="work_box">
			<view class="work_list">
				<carCard v-for="carItem in List" :key="carItem.taskId" tipContent="待办" :carInfo="carItem">
					<template #header>
						<navTop :carNum="carItem.licensePlateNumber" />
					</template>
					<template #center>
						<wordInfo v-if="carItem.type ==='个人'" :phone="carItem.phone" :userName="carItem.name" :company="carItem.sysDeptName" />
						<businessWordIndo v-else :phone="carItem.businessPhone" :userName="carItem.businessName" :company="carItem.sysDeptName" />
					</template>
					<template #footer>
						<operateList :carInfo="carItem" @refreshList="getList" />
					</template>
				</carCard>
				<up-empty
					:show="List.length == 0"
					mode="list"
					text="暂无待办事项"
				/>
			</view>
			<!-- 分页器 -->
			<view v-show="List.length > 0">
				<uni-pagination  :total="allTotal" v-model="queryParams.pageNum" :pageSize="queryParams.pageSize" @change="getList"	/>
			</view>
		</view>
		
		<!-- 底部导航栏 -->
		<up-tabbar
			:value="useTabbar.societyCurrent"
			activeColor="#3680FE"
			inactiveColor="#707070"
		>
			<up-tabbar-item text="主页" icon="home" :badge="useTabbar.societyTotal"></up-tabbar-item>
			<up-tabbar-item text="我的" icon="account" @click="goRouter">
				<template #active-icon>
					<image style="width: 48rpx;" class="u-page__item__slot-icon" src="@/static/tabbarIcon/my-active.png" mode="widthFix"></image>
				</template>
				<template #inactive-icon>
					<image style="width: 48rpx;" class="u-page__item__slot-icon" src="@/static/tabbarIcon/my.png" mode="widthFix"></image>
				</template>
			</up-tabbar-item>
		</up-tabbar>
		
	</view>
</template>

<script setup>
	import { ref, reactive } from 'vue';
	import { onPullDownRefresh } from '@dcloudio/uni-app'
	import { queryMyList } from '@/api/work.js'
	import carCard from '@/components/carCard.vue';
	import navTop from '@/components/navTop.vue';
	import wordInfo from '@/components/wordInfo.vue';
	import businessWordIndo from '@/components/businessWordIndo.vue';
	import operateList from '@/components/operateList.vue';
	import useTabbarStore from '@/store/modules/tabbar.js'
	const useTabbar = useTabbarStore()
	const List = ref([])
	const allTotal = ref(0)
	const titleStyle = {
		fontSize: '36rpx',
		color: '#fff',
		fontWeight: 500
	}
	const queryParams = reactive({
	  pageNum: 1,
	  pageSize: 10,
		type: 0
	});
	// 获取待办任务
	const getList = async () => {
		const { data } = await queryMyList(queryParams);
		List.value = data.rows;
		allTotal.value = data.total;
		useTabbar.societyTotal = data.total;
	}
	// 用户下拉刷新
	onPullDownRefresh(async () => {
		queryParams.pageNum = 1
		List.value = []
		await getList()
		uni.stopPullDownRefresh()
	})
	const goRouter = (index) => {
		useTabbar.societyCurrent = index
		uni.redirectTo({
			url: '/pages/societyMy/societyMy'
		})
	}
	const changeList = (index) => {
		queryParams.type = index
		getList()
	}
	getList()
</script>

<style lang="scss" scoped>
.company_container{
	width: 100%;
	height: 100vh;
	background: url('http://bxhd.crgx.net/profile/avatar/2024/09/25/bg-index_20240925113012A004.png') no-repeat;
	background-size: 100% 100%;
	overflow: hidden;
	.work_box{
		padding: 20rpx 30rpx 250rpx;
		height: calc(100vh - 88rpx);
		background-color: #F8F9FF;
		overflow-y: scroll;
		.work_list{
			display: flex;
			flex-direction: column;
			gap: 20rpx;
			margin-bottom: 30rpx;
		}
	}
}

// 头部筛选
.nav_header{
	display: flex;
	align-items: center;
	width: 100%;
	height: 80rpx;
	background: #FFFFFF;
	.nav_item{
		flex: 1;
		text-align: center;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 28rpx;
		color: #999;
		&.active{
			font-weight: 500;
			color: #333;
		}
	}
	.colLine{
		width: 2rpx;
		height: 40rpx;
		background: #D8D8D8;
	}
}
</style>