| | |
| | | <template> |
| | | <view class="eventTickets"> |
| | | 工单 |
| | | </view> |
| | | <div class="eventTickets" :style="{ paddingTop: topMargin + 'px' }"> |
| | | |
| | | <div class="searchTop"> |
| | | <up-search placeholder="请输入关键字搜索" :animation="true" v-model="listParams.keyword" :show-action="false" @search="handleSearch" @clear="handleClear"></up-search> |
| | | </div> |
| | | <div class="listBox"> |
| | | <div class="tabs-container"> |
| | | <up-tabs :list="tabList" @click="handleClick"></up-tabs> |
| | | </div> |
| | | <!-- @scrolltolower="loadMore" --> |
| | | <scroll-view class="eventBox" scroll-y :lower-threshold="80" > |
| | | <div class="eventList"> |
| | | <div class="eventItem" v-for="(item,index) in dataList" :key="index"> |
| | | <img :src="item.eventImageUrl" alt="" @click="detailHandle(item)" /> |
| | | <div class="informationDisplay"> |
| | | <!-- <div class="itemTitle">{{item.event_name}}</div>--> |
| | | <div class="itemContent">{{formatDate(item.createTime) }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 暂无数据提示 --> |
| | | <div class="noData" v-if="!loading && dataList.length === 0"> |
| | | <text>暂无数据</text> |
| | | </div> |
| | | |
| | | <!-- 加载提示 --> |
| | | <div class="loadingMore"> |
| | | <text v-if="loading">加载中...</text> |
| | | |
| | | </div> |
| | | </scroll-view> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </template> |
| | | |
| | | <script setup> |
| | | |
| | | import { useUserStore } from '@/store/index.js' |
| | | import {getGdList,getstatusCount} from '/src/api/work/index.js' |
| | | import dayjs from 'dayjs'; |
| | | import { getStatusBarHeight } from '@/utils/common'; |
| | | const userStore = useUserStore() |
| | | const userInfo = userStore.userInfo |
| | | const dataList = ref([]) |
| | | const currentTab=ref('all') |
| | | const loading = ref(false) |
| | | const hasMore = ref(true) |
| | | const tabList = ref([ |
| | | { |
| | | name: '全部工单', |
| | | key: 'all', |
| | | badge: { |
| | | value: 0, |
| | | showZero: true |
| | | }, |
| | | |
| | | }, |
| | | { |
| | | name: '我的工单', |
| | | key: 'myTickets', |
| | | badge: { |
| | | value: 0, |
| | | showZero: true |
| | | } |
| | | } |
| | | |
| | | |
| | | ]) |
| | | const formatDate = (dateString) => { |
| | | return dayjs(dateString).format('MM/DD HH:mm'); |
| | | }; |
| | | const listParams = ref({ |
| | | |
| | | current: 1, |
| | | size: 12, |
| | | source: 1, |
| | | department:'', |
| | | keyword:'' |
| | | |
| | | }) |
| | | const getDataList = () => { |
| | | if (loading.value || !hasMore.value) return |
| | | |
| | | loading.value = true |
| | | const params = { |
| | | current: listParams.value.current, |
| | | size: listParams.value.size, |
| | | keyword:listParams.value.keyword, |
| | | onlyMine:currentTab.value=== 'myTickets' ? 1 : 0 |
| | | } |
| | | getGdList(params).then(res => { |
| | | const response = res.data.data |
| | | dataList.value = response |
| | | // 根据当前页码决定是替换还是追加数据 |
| | | // if (listParams.value.current === 1) { |
| | | // dataList.value = response |
| | | // } else { |
| | | // dataList.value = [...dataList.value, ...response] |
| | | // } |
| | | |
| | | // // 判断是否还有更多数据 |
| | | // if (response.length < listParams.value.size || response.current >= response.pages) { |
| | | // hasMore.value = false |
| | | // } else { |
| | | // hasMore.value = true |
| | | // } |
| | | }).finally(() => { |
| | | loading.value = false |
| | | }) |
| | | } |
| | | const getstatusCountData=()=>{ |
| | | const params={ |
| | | keyword:listParams.value.keyword, |
| | | } |
| | | getstatusCount(params).then(res=>{ |
| | | const response = res.data.data |
| | | const { totalCount,myCount } = response |
| | | tabList.value.forEach(tab=>{ |
| | | |
| | | if(tab.key === 'all'){ |
| | | tab.badge.value = totalCount || 0 |
| | | tab.badge.showZero = true |
| | | |
| | | }else if(tab.key === 'myTickets'){ |
| | | tab.badge.value = myCount || 0 |
| | | tab.badge.showZero = true |
| | | } |
| | | }) |
| | | |
| | | }) |
| | | } |
| | | |
| | | const handleClick = (item) => { |
| | | currentTab.value = item.key |
| | | |
| | | listParams.value.current = 1 |
| | | hasMore.value = true |
| | | dataList.value = [] |
| | | getDataList() |
| | | } |
| | | const loadMore = () => { |
| | | if (loading.value || !hasMore.value) return |
| | | listParams.value.current++ |
| | | getDataList() |
| | | } |
| | | |
| | | const detailHandle = (val) => { |
| | | uni.navigateTo({ |
| | | url: `/subPackages/workDetail/index?id=${val.id}`, |
| | | }) |
| | | } |
| | | |
| | | // 搜索功能 |
| | | const handleSearch = () => { |
| | | listParams.value.current = 1 |
| | | hasMore.value = true |
| | | dataList.value = [] |
| | | getDataList() |
| | | getstatusCountData() |
| | | } |
| | | // 清除搜索 |
| | | const handleClear = () => { |
| | | listParams.value.keyword = '' |
| | | listParams.value.current = 1 |
| | | hasMore.value = true |
| | | dataList.value = [] |
| | | getDataList() |
| | | getstatusCountData() |
| | | } |
| | | const topMargin = getStatusBarHeight() |
| | | onShow(() => { |
| | | listParams.value.current = 1 |
| | | hasMore.value = true |
| | | dataList.value = [] |
| | | getDataList() |
| | | getstatusCountData() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .eventTickets { |
| | | width: 100%; |
| | | padding: 0 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100%; |
| | | box-sizing: border-box; |
| | | width: 100%; |
| | | overflow-x: hidden; |
| | | .searchTop { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding-right: 24rpx; |
| | | width: 100%; |
| | | height: 108rpx; |
| | | :deep(){ |
| | | .u-search__content{ |
| | | background: #fff !important; |
| | | } |
| | | .u-search__content__input{ |
| | | background: #fff !important; |
| | | } |
| | | } |
| | | } |
| | | :deep(){ |
| | | |
| | | .u-tabs__wrapper__nav__line{ |
| | | // width: 80rpx !important; |
| | | background: #1D6FE9 !important; |
| | | } |
| | | .u-badge { |
| | | background-color: #1d6fe9 !important; |
| | | margin-top: -17px !important; |
| | | margin-left: -5px !important; |
| | | } |
| | | } |
| | | |
| | | |
| | | .tabs-container{ |
| | | display: flex; |
| | | justify-content: center; |
| | | height: 98rpx; |
| | | } |
| | | .listBox { |
| | | position: relative; |
| | | display: flex; |
| | | flex-direction: column; |
| | | flex: 1; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | } |
| | | .eventBox { |
| | | padding: 20rpx 0; |
| | | overflow-y: auto; |
| | | overflow-x: hidden; |
| | | height: 0; |
| | | flex-grow: 1; |
| | | align-content: flex-start; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .eventList { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | gap: 20rpx; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | justify-content: space-between; |
| | | |
| | | .eventItem { |
| | | width: calc(50% - 10rpx); |
| | | background-color: #fff; |
| | | border-radius: 12rpx; |
| | | overflow: hidden; |
| | | position: relative; |
| | | box-sizing: border-box; |
| | | max-width: 100%; |
| | | |
| | | img { |
| | | width: 100%; |
| | | height: 208rpx; |
| | | border-radius: 12rpx; |
| | | overflow: hidden; |
| | | } |
| | | .informationDisplay{ |
| | | width: 100%; |
| | | position: absolute; |
| | | bottom: 3px; |
| | | background: rgba(11,11,11,0.35); |
| | | border-radius: 0rpx 0rpx 12rpx 12rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | padding: 10rpx 0rpx 10rpx 0rpx; |
| | | .itemTitle { |
| | | width: 144rpx; |
| | | font-family: Source Han Sans CN, Source Han Sans CN; |
| | | font-weight: 500; |
| | | font-size: 28rpx; |
| | | color: #000000; |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | } |
| | | |
| | | .itemContent { |
| | | font-family: Source Han Sans CN, Source Han Sans CN; |
| | | font-weight: 400; |
| | | font-size: 24rpx; |
| | | color: #FFFFFF; |
| | | padding-right: 14rpx; |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .loadingMore { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | height: 80rpx; |
| | | font-size: 28rpx; |
| | | color: #999; |
| | | width: 100%; |
| | | } |
| | | |
| | | .noData { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | height: 300rpx; |
| | | font-size: 28rpx; |
| | | color: #999; |
| | | width: 100%; |
| | | } |
| | | } |
| | | </style> |