| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708 |
- <template>
- <view class="container">
- <!-- 日期范围和筛选 -->
- <view class="date-filter-bar mb16">
- <view class="date-range" @click="showDatePicker = true">
- <image class="w32 h32" src="@/static/image/icon_time.png" mode=""></image>
- <text class="date-text">{{ dateRangeText }}</text>
- <text class="arrow-down">▼</text>
- </view>
- <view class="filter-btn" @click="showFilter = true">
- <image class="w32 h32" src="@/static/image/icon_select.png" mode=""></image>
- <text>筛选</text>
- </view>
- </view>
-
- <!-- 内容区域 -->
- <scroll-view class="content" scroll-y>
- <!-- 数据汇总 -->
- <view class="summary-section x-bc">
- <view class="summary-header">
- <view class="summary-indicator"></view>
- <text class="summary-title">数据汇总</text>
- </view>
- <view class="summary-stats">
- <view class="stat-item">
- <text class="stat-label">任务数</text>
- <text class="stat-value">{{ summaryData.taskCount }}</text>
- </view>
- <view class="stat-item">
- <text class="stat-label">总积分</text>
- <text class="stat-value">{{ summaryData.totalPoints }}</text>
- </view>
- </view>
- </view>
-
- <!-- 数据表格 -->
- <view class="table-section">
- <view class="table-header">
- <view class="table-col" style="width: 20%;">任务类型</view>
- <view class="table-col" style="width: 15%;">积分</view>
- <view class="table-col" style="width: 20%;">申请人员</view>
- <view class="table-col" style="width: 20%;">任务状态</view>
- <view class="table-col" style="width: 25%;">接收时间</view>
- </view>
- <view class="table-body">
- <view class="table-row" v-for="(item, index) in tableData" :key="index">
- <view class="table-col" style="width: 20%;">{{ item.taskType }}</view>
- <view class="table-col" style="width: 15%;">{{ item.points }}</view>
- <view class="table-col" style="width: 20%;">{{ item.applicant }}</view>
- <view class="table-col" style="width: 20%;">
- <text class="status-tag" :class="item.status">{{ item.statusText }}</text>
- </view>
- <view class="table-col" style="width: 25%;">{{ item.receiveTime }}</view>
- </view>
- </view>
- </view>
-
- <!-- 底部提示 -->
- <view class="no-more">没有更多了~</view>
- </scroll-view>
-
- <!-- 日期选择弹窗 -->
- <view class="date-picker-popup" v-if="showDatePicker" @click="showDatePicker = false">
- <view class="date-picker-content" @click.stop>
- <view class="picker-header">
- <view class="picker-cancel" @click="showDatePicker = false">取消</view>
- <view class="picker-title">选择日期范围</view>
- <view class="picker-confirm" @click="confirmDateRange">确定</view>
- </view>
- <view class="picker-body">
- <view class="date-item">
- <text class="date-label">开始日期</text>
- <picker mode="date" :value="tempDateRange.startDate" @change="onStartDateChange">
- <view class="date-value">{{ tempDateRange.startDate || '请选择' }}</view>
- </picker>
- </view>
- <view class="date-item">
- <text class="date-label">结束日期</text>
- <picker mode="date" :value="tempDateRange.endDate" @change="onEndDateChange">
- <view class="date-value">{{ tempDateRange.endDate || '请选择' }}</view>
- </picker>
- </view>
- </view>
- </view>
- </view>
-
- <!-- 筛选弹窗 -->
- <view class="filter-popup" v-if="showFilter" @click="closeFilter">
- <view class="filter-content" @click.stop>
- <view class="filter-header">
- <view class="filter-title">筛选</view>
- <view class="filter-close-btn" @click="closeFilter">×</view>
- </view>
-
- <!-- 任务类型筛选 -->
- <view class="filter-group">
- <view class="group-label">任务类型</view>
- <view class="filter-tags">
- <view
- class="filter-tag"
- :class="{ active: tempSelectedTaskType === item.value }"
- v-for="(item, index) in taskTypeOptions"
- :key="index"
- @click="selectTaskType(item.value)">
- {{ item.label }}
- </view>
- </view>
- </view>
-
- <!-- 任务状态筛选 -->
- <view class="filter-group">
- <view class="group-label">任务状态</view>
- <view class="filter-tags">
- <view
- class="filter-tag"
- :class="{ active: tempSelectedTaskStatus === item.value }"
- v-for="(item, index) in taskStatusOptions"
- :key="index"
- @click="selectTaskStatus(item.value)">
- {{ item.label }}
- </view>
- </view>
- </view>
-
- <!-- 操作按钮 -->
- <view class="filter-actions">
- <view class="reset-btn" @click="resetFilters">重置</view>
- <view class="confirm-btn" @click="confirmFilters">确定</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- // import { getStatisticsData } from '@/api-js/statistics'
- export default {
- data() {
- return {
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
- showDatePicker: false,
- showFilter: false,
- dateRange: {
- startDate: '2025-12-01',
- endDate: '2025-12-25'
- },
- tempDateRange: {
- startDate: '2025-12-01',
- endDate: '2025-12-25'
- },
- selectedTaskType: 'academicLecture', // 默认选中学术讲座
- selectedTaskStatus: '',
- taskTypeOptions: [
- { label: '医生坐诊', value: 'doctorConsultation' },
- { label: '科普讲座', value: 'popularScienceLecture' },
- { label: '学术讲座', value: 'academicLecture' },
- { label: '科普文章', value: 'popularScienceArticle' },
- { label: '科普短视频', value: 'popularScienceShortVideo' },
- { label: '科普长视频', value: 'popularScienceLongVideo' },
- { label: '空中课堂', value: 'airClassroom' },
- { label: '用药调研', value: 'medicationSurvey' },
- { label: '问卷调研', value: 'questionnaireSurvey' },
- { label: '社群咨询', value: 'communityConsultation' },
- { label: '健康问答', value: 'healthQA' }
- ],
- taskStatusOptions: [
- { label: '未完成', value: 'uncompleted' },
- { label: '待审核', value: 'pendingReview' },
- { label: '已驳回', value: 'rejected' },
- { label: '已完成', value: 'completed' },
- { label: '已完结', value: 'finished' }
- ],
- tempSelectedTaskType: 'academicLecture',
- tempSelectedTaskStatus: '',
- summaryData: {
- taskCount: 6,
- totalPoints: 300
- },
- tableData: [
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '100', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' }
- ]
- }
- },
- computed: {
- dateRangeText() {
- return `${this.dateRange.startDate} 至 ${this.dateRange.endDate}`
- }
- },
- watch: {
- showFilter(newVal) {
- if (newVal) {
- // 打开弹窗时,同步临时选择值
- this.tempSelectedTaskType = this.selectedTaskType
- this.tempSelectedTaskStatus = this.selectedTaskStatus
- }
- }
- },
- onLoad() {
- this.tempSelectedTaskType = this.selectedTaskType
- this.tempSelectedTaskStatus = this.selectedTaskStatus
- //this.loadData()
- },
- onReachBottom() {
- this.loadMore()
- },
- methods: {
- goBack() {
- uni.navigateBack()
- },
- onStartDateChange(e) {
- this.tempDateRange.startDate = e.detail.value
- },
- onEndDateChange(e) {
- this.tempDateRange.endDate = e.detail.value
- },
- confirmDateRange() {
- if (!this.tempDateRange.startDate || !this.tempDateRange.endDate) {
- uni.showToast({ icon: 'none', title: '请选择完整的日期范围' })
- return
- }
- if (new Date(this.tempDateRange.startDate) > new Date(this.tempDateRange.endDate)) {
- uni.showToast({ icon: 'none', title: '开始日期不能大于结束日期' })
- return
- }
- this.dateRange = { ...this.tempDateRange }
- this.showDatePicker = false
- this.loadData()
- },
- closeFilter() {
- // 关闭弹窗时,恢复临时选择值为当前选择值
- this.tempSelectedTaskType = this.selectedTaskType
- this.tempSelectedTaskStatus = this.selectedTaskStatus
- this.showFilter = false
- },
- selectTaskType(value) {
- // 如果点击的是已选中的,则取消选择
- if (this.tempSelectedTaskType === value) {
- this.tempSelectedTaskType = ''
- } else {
- this.tempSelectedTaskType = value
- }
- },
- selectTaskStatus(value) {
- // 如果点击的是已选中的,则取消选择
- if (this.tempSelectedTaskStatus === value) {
- this.tempSelectedTaskStatus = ''
- } else {
- this.tempSelectedTaskStatus = value
- }
- },
- resetFilters() {
- this.tempSelectedTaskType = ''
- this.tempSelectedTaskStatus = ''
- },
- confirmFilters() {
- this.selectedTaskType = this.tempSelectedTaskType
- this.selectedTaskStatus = this.tempSelectedTaskStatus
- this.showFilter = false
- //this.loadData()
- },
- async loadData() {
- try {
- uni.showLoading({ title: '加载中...' })
- const res = await getStatisticsData({
- startDate: this.dateRange.startDate,
- endDate: this.dateRange.endDate,
- taskType: this.selectedTaskType,
- taskStatus: this.selectedTaskStatus
- })
- uni.hideLoading()
- if (res.code === 200 && res.data) {
- this.summaryData = {
- taskCount: res.data.taskCount || 6,
- totalPoints: res.data.totalPoints || 300
- }
- this.tableData = res.data.list || this.getDefaultData()
- } else {
- this.tableData = this.getDefaultData()
- }
- } catch (e) {
- uni.hideLoading()
- console.error('加载数据失败', e)
- this.tableData = this.getDefaultData()
- }
- },
- async loadMore() {
- // 加载更多数据
- },
- getDefaultData() {
- // 默认数据,根据图片中的示例
- return [
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '100', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '用药调研', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' },
- { taskType: '科普短视频', points: '20', applicant: '王*明', status: 'uncompleted', statusText: '未完成', receiveTime: '2025-09-25' }
- ]
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- }
- .status-bar {
- width: 100%;
- background: #fff;
- }
- .header {
- position: relative;
- height: 88rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: #fff;
- border-bottom: 1rpx solid #f0f0f0;
-
- .back-btn {
- position: absolute;
- left: 24rpx;
- width: 40rpx;
- height: 40rpx;
-
- image {
- width: 100%;
- height: 100%;
- }
- }
-
- .title {
- font-size: 36rpx;
- font-weight: bold;
- color: #333;
- }
-
- .header-right {
- position: absolute;
- right: 24rpx;
- display: flex;
- align-items: center;
- gap: 16rpx;
-
- .more-icon {
- font-size: 32rpx;
- color: #333;
- }
- }
- }
- .date-filter-bar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx;
- background: #fff;
- // border-bottom: 1rpx solid #f0f0f0;
-
- .date-range {
- display: flex;
- align-items: center;
- gap: 8rpx;
-
- .clock-icon {
- font-size: 28rpx;
- }
-
- .date-text {
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 28rpx;
- color: #333333;
- }
-
- .arrow-down {
- font-size: 20rpx;
- color: #333333;
- }
- }
-
- .filter-btn {
- display: flex;
- align-items: center;
- gap: 8rpx;
- font-size: 28rpx;
- color: #333;
-
- .filter-icon {
- font-size: 24rpx;
- }
- }
- }
- .content {
- flex: 1;
- background: #fff;
- }
- .summary-section {
- background: #fff;
- padding: 24rpx;
- margin-bottom: 32rpx;
-
- .summary-header {
- display: flex;
- align-items: center;
- // margin-bottom: 24rpx;
-
- .summary-indicator {
- width: 6rpx;
- height: 32rpx;
- background: #388BFF;
- border-radius: 3rpx;
- margin-right: 16rpx;
- }
-
- .summary-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
- }
-
- .summary-stats {
- display: flex;
- gap: 48rpx;
-
- .stat-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- gap: 16rpx;
-
- .stat-label {
- font-size: 24rpx;
- color: #999;
- }
-
- .stat-value {
- font-size: 36rpx;
- font-weight: bold;
- color: #388BFF;
- }
- }
- }
- }
- .table-section {
- background: #fff;
- padding: 0 24rpx;
- .table-header {
- display: flex;
- background: #E3EFFF;
- padding: 24rpx 16rpx;
-
- .table-col {
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 26rpx;
- color: #333333;
- line-height: 40rpx;
- text-align: left;
- }
- }
-
- .table-body {
- .table-row {
- display: flex;
- padding: 24rpx 16rpx;
-
- &:nth-child(2n) {
- background: #F7F8FA;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- }
-
- .table-col {
- font-size: 26rpx;
- color: #333;
- display: flex;
- align-items: center;
- text-align: left;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 26rpx;
- line-height: 40rpx;
- // .status-tag {
- // padding: 4rpx 12rpx;
- // border-radius: 4rpx;
- // font-size: 24rpx;
-
- // &.uncompleted {
- // background: #FFF3E0;
- // color: #FF9800;
- // }
-
- // &.completed {
- // background: #E8F5E9;
- // color: #4CAF50;
- // }
- // }
- }
- }
- }
- }
- .no-more {
- text-align: center;
- padding: 48rpx 0;
- font-size: 24rpx;
- color: #999;
- }
- .date-picker-popup {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- z-index: 999;
- display: flex;
- align-items: flex-end;
- }
- .date-picker-content {
- width: 100%;
- background: #fff;
- border-radius: 24rpx 24rpx 0 0;
-
- .picker-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx;
- border-bottom: 1rpx solid #f0f0f0;
-
- .picker-cancel {
- font-size: 30rpx;
- color: #666;
- }
-
- .picker-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
-
- .picker-confirm {
- font-size: 30rpx;
- color: #388BFF;
- }
- }
-
- .picker-body {
- padding: 24rpx;
-
- .date-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 24rpx 0;
- border-bottom: 1rpx solid #f0f0f0;
-
- &:last-child {
- border-bottom: none;
- }
-
- .date-label {
- font-size: 30rpx;
- color: #333;
- }
-
- .date-value {
- font-size: 30rpx;
- color: #388BFF;
- }
- }
- }
- }
- .filter-popup {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.5);
- z-index: 999;
- display: flex;
- align-items: flex-end;
- }
- .filter-content {
- width: 100%;
- background: #fff;
- border-radius: 24rpx 24rpx 0 0;
- padding: 24rpx;
- max-height: 80vh;
- overflow-y: auto;
-
- .filter-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 32rpx;
-
- .filter-title {
- font-size: 32rpx;
- font-weight: bold;
- color: #333;
- }
-
- .filter-close-btn {
- width: 48rpx;
- height: 48rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 40rpx;
- color: #999;
- }
- }
-
- .filter-group {
- margin-bottom: 40rpx;
-
- &:last-of-type {
- margin-bottom: 0;
- }
-
- .group-label {
- font-size: 28rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 20rpx;
- }
-
- .filter-tags {
- display: flex;
- flex-wrap: wrap;
- gap: 16rpx;
-
- .filter-tag {
- padding: 12rpx 24rpx;
- background: #f5f5f5;
- border-radius: 8rpx;
- font-size: 26rpx;
- color: #666;
- border: 1rpx solid transparent;
-
- &.active {
- background: #E6F7FF;
- color: #388BFF;
- border-color: #388BFF;
- }
- }
- }
- }
-
- .filter-actions {
- display: flex;
- gap: 24rpx;
- margin-top: 40rpx;
- padding-top: 24rpx;
- border-top: 1rpx solid #f0f0f0;
-
- .reset-btn,
- .confirm-btn {
- flex: 1;
- height: 88rpx;
- line-height: 88rpx;
- text-align: center;
- border-radius: 8rpx;
- font-size: 30rpx;
- }
-
- .reset-btn {
- background: #fff;
- color: #666;
- border: 1rpx solid #e0e0e0;
- }
-
- .confirm-btn {
- background: #388BFF;
- color: #fff;
- }
- }
- }
- </style>
|