分页
Showing
3 changed files
with
210 additions
and
50 deletions
| ... | @@ -2,10 +2,6 @@ | ... | @@ -2,10 +2,6 @@ |
| 2 | <view> | 2 | <view> |
| 3 | <uni-segmented-control class="whitebg" :current="current" :values="navs" @clickItem="onClickItem" | 3 | <uni-segmented-control class="whitebg" :current="current" :values="navs" @clickItem="onClickItem" |
| 4 | styleType="text" activeColor="#AD181F"></uni-segmented-control> | 4 | styleType="text" activeColor="#AD181F"></uni-segmented-control> |
| 5 | <!-- <view v-show="infoList.length>0" class="stat-row"> | ||
| 6 | <view class="stat-item">费用合计:<text class="red">{{ totalCost.toFixed(2) }}元</text></view> | ||
| 7 | <view class="stat-item">考试人数:<text class="red">{{ totalNum }}人</text></view> | ||
| 8 | </view> --> | ||
| 9 | 5 | ||
| 10 | <view class="appList"> | 6 | <view class="appList"> |
| 11 | <view class="appItem" v-for="item in infoList" :key="item.examId" @click="goDetail(item)"> | 7 | <view class="appItem" v-for="item in infoList" :key="item.examId" @click="goDetail(item)"> |
| ... | @@ -29,11 +25,6 @@ | ... | @@ -29,11 +25,6 @@ |
| 29 | 支付方式 | 25 | 支付方式 |
| 30 | <view> | 26 | <view> |
| 31 | 民生付 | 27 | 民生付 |
| 32 | <!-- <text :class="{ | ||
| 33 | 'text-success': item.examPayStatusStr=='已上传', | ||
| 34 | 'text-danger': item.examPayStatusStr=='未上传', | ||
| 35 | 'text-warning': item.examPayStatusStr=='已结算' | ||
| 36 | }">{{ item.examPayStatusStr || '--' }}</text> --> | ||
| 37 | </view> | 28 | </view> |
| 38 | </view> | 29 | </view> |
| 39 | <view> | 30 | <view> |
| ... | @@ -44,12 +35,19 @@ | ... | @@ -44,12 +35,19 @@ |
| 44 | <view class="pp esp">上报单位:{{ item.memberName }}</view> | 35 | <view class="pp esp">上报单位:{{ item.memberName }}</view> |
| 45 | 36 | ||
| 46 | <view class="func" v-if="item.status=='1'"> | 37 | <view class="func" v-if="item.status=='1'"> |
| 47 | <button @click="goApproval(item)">审批</button> | 38 | <button @click.stop="goApproval(item)">审批</button> |
| 48 | </view> | 39 | </view> |
| 49 | </view> | 40 | </view> |
| 50 | </view> | 41 | </view> |
| 51 | 42 | ||
| 52 | <view class="nodata" v-if="infoList.length==0"> | 43 | <!-- 上滑加载提示 --> |
| 44 | <view class="load-tip" v-if="infoList.length > 0"> | ||
| 45 | <text v-if="loading">加载中...</text> | ||
| 46 | <text v-else-if="noMore">没有更多数据了</text> | ||
| 47 | </view> | ||
| 48 | |||
| 49 | <!-- 空数据 --> | ||
| 50 | <view class="nodata" v-if="infoList.length == 0 && !loading"> | ||
| 53 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> | 51 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> |
| 54 | <text>暂无数据</text> | 52 | <text>暂无数据</text> |
| 55 | </view> | 53 | </view> |
| ... | @@ -59,12 +57,8 @@ | ... | @@ -59,12 +57,8 @@ |
| 59 | <script setup> | 57 | <script setup> |
| 60 | import * as api from '@/common/api.js' | 58 | import * as api from '@/common/api.js' |
| 61 | import config from '@/config.js' | 59 | import config from '@/config.js' |
| 62 | import { | 60 | import { ref } from 'vue' |
| 63 | ref | 61 | import { onShow, onReachBottom } from '@dcloudio/uni-app' |
| 64 | } from 'vue' | ||
| 65 | import { | ||
| 66 | onShow | ||
| 67 | } from '@dcloudio/uni-app' | ||
| 68 | 62 | ||
| 69 | const app = getApp() | 63 | const app = getApp() |
| 70 | 64 | ||
| ... | @@ -85,30 +79,71 @@ | ... | @@ -85,30 +79,71 @@ |
| 85 | const total = ref(0) | 79 | const total = ref(0) |
| 86 | const totalCost = ref(0) | 80 | const totalCost = ref(0) |
| 87 | const totalNum = ref(0) | 81 | const totalNum = ref(0) |
| 82 | const loading = ref(false) | ||
| 83 | const noMore = ref(false) | ||
| 88 | 84 | ||
| 89 | onShow(() => { | 85 | onShow(() => { |
| 90 | if (app.globalData.isLogin) { | 86 | if (app.globalData.isLogin) { |
| 91 | getList() | 87 | refreshList() |
| 92 | } else { | 88 | } else { |
| 93 | app.firstLoadCallback = () => { | 89 | app.firstLoadCallback = () => { |
| 94 | getList() | 90 | refreshList() |
| 95 | } | 91 | } |
| 96 | } | 92 | } |
| 97 | }) | 93 | }) |
| 98 | 94 | ||
| 95 | // 刷新列表(重置第一页) | ||
| 96 | function refreshList() { | ||
| 97 | queryParams.value.pageNum = 1 | ||
| 98 | noMore.value = false | ||
| 99 | infoList.value = [] | ||
| 100 | getList() | ||
| 101 | } | ||
| 102 | |||
| 103 | // 上滑加载下一页 | ||
| 104 | onReachBottom(() => { | ||
| 105 | if (loading.value || noMore.value) return | ||
| 106 | queryParams.value.pageNum++ | ||
| 107 | getList() | ||
| 108 | }) | ||
| 109 | |||
| 99 | function getList() { | 110 | function getList() { |
| 100 | uni.showLoading({ title: '加载中', mask: true }) | 111 | if (loading.value || noMore.value) return |
| 112 | loading.value = true | ||
| 113 | |||
| 114 | if (queryParams.value.pageNum === 1) { | ||
| 115 | uni.showLoading({ title: '加载中', mask: true }) | ||
| 116 | } | ||
| 117 | |||
| 101 | totalCost.value = 0 | 118 | totalCost.value = 0 |
| 102 | totalNum.value = 0 | 119 | totalNum.value = 0 |
| 120 | |||
| 103 | api.examauditList(queryParams.value).then(response => { | 121 | api.examauditList(queryParams.value).then(response => { |
| 122 | loading.value = false | ||
| 104 | uni.hideLoading() | 123 | uni.hideLoading() |
| 105 | infoList.value = response.rows || [] | 124 | |
| 125 | const list = response.rows || [] | ||
| 106 | total.value = response.total || 0 | 126 | total.value = response.total || 0 |
| 127 | |||
| 128 | // 分页追加 | ||
| 129 | if (queryParams.value.pageNum === 1) { | ||
| 130 | infoList.value = list | ||
| 131 | } else { | ||
| 132 | infoList.value = [...infoList.value, ...list] | ||
| 133 | } | ||
| 134 | |||
| 135 | // 判断是否还有更多 | ||
| 136 | if (list.length < queryParams.value.pageSize) { | ||
| 137 | noMore.value = true | ||
| 138 | } | ||
| 139 | |||
| 140 | // 统计 | ||
| 107 | infoList.value.forEach(item => { | 141 | infoList.value.forEach(item => { |
| 108 | totalCost.value += Number(item.price) || 0 | 142 | totalCost.value += Number(item.price) || 0 |
| 109 | totalNum.value += Number(item.totalNum) || 0 | 143 | totalNum.value += Number(item.totalNum) || 0 |
| 110 | }) | 144 | }) |
| 111 | }).catch(() => { | 145 | }).catch(() => { |
| 146 | loading.value = false | ||
| 112 | uni.hideLoading() | 147 | uni.hideLoading() |
| 113 | }) | 148 | }) |
| 114 | } | 149 | } |
| ... | @@ -116,7 +151,7 @@ | ... | @@ -116,7 +151,7 @@ |
| 116 | function onClickItem(e) { | 151 | function onClickItem(e) { |
| 117 | current.value = e.currentIndex | 152 | current.value = e.currentIndex |
| 118 | queryParams.value.status = statusValues[e.currentIndex] | 153 | queryParams.value.status = statusValues[e.currentIndex] |
| 119 | getList() | 154 | refreshList() |
| 120 | } | 155 | } |
| 121 | 156 | ||
| 122 | function goDetail(item) { | 157 | function goDetail(item) { |
| ... | @@ -144,7 +179,6 @@ | ... | @@ -144,7 +179,6 @@ |
| 144 | background: #f3e5e5; | 179 | background: #f3e5e5; |
| 145 | font-size: 26rpx; | 180 | font-size: 26rpx; |
| 146 | color: #666; | 181 | color: #666; |
| 147 | // margin-top: 20rpx; | ||
| 148 | 182 | ||
| 149 | .red { | 183 | .red { |
| 150 | color: #C4121B; | 184 | color: #C4121B; |
| ... | @@ -156,4 +190,12 @@ | ... | @@ -156,4 +190,12 @@ |
| 156 | width: 100%; | 190 | width: 100%; |
| 157 | word-break: break-all; | 191 | word-break: break-all; |
| 158 | } | 192 | } |
| 159 | </style> | 193 | |
| 194 | /* 加载提示样式 */ | ||
| 195 | .load-tip { | ||
| 196 | text-align: center; | ||
| 197 | padding: 20rpx 0; | ||
| 198 | font-size: 26rpx; | ||
| 199 | color: #999; | ||
| 200 | } | ||
| 201 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -41,7 +41,14 @@ | ... | @@ -41,7 +41,14 @@ |
| 41 | </view> | 41 | </view> |
| 42 | </view> | 42 | </view> |
| 43 | </view> | 43 | </view> |
| 44 | <view class="nodata" v-if="infoList.length==0"> | 44 | |
| 45 | <!-- 加载提示 & 无更多数据 --> | ||
| 46 | <view class="load-tip" v-if="infoList.length > 0"> | ||
| 47 | <text v-if="loading">加载中...</text> | ||
| 48 | <text v-else-if="noMore">没有更多数据了</text> | ||
| 49 | </view> | ||
| 50 | |||
| 51 | <view class="nodata" v-if="infoList.length==0 && !loading"> | ||
| 45 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> | 52 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> |
| 46 | <text>暂无数据</text> | 53 | <text>暂无数据</text> |
| 47 | </view> | 54 | </view> |
| ... | @@ -52,7 +59,7 @@ | ... | @@ -52,7 +59,7 @@ |
| 52 | import * as api from '@/common/api.js' | 59 | import * as api from '@/common/api.js' |
| 53 | import config from '@/config.js' | 60 | import config from '@/config.js' |
| 54 | import { ref } from 'vue' | 61 | import { ref } from 'vue' |
| 55 | import { onLoad, onShow } from '@dcloudio/uni-app' | 62 | import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app' |
| 56 | 63 | ||
| 57 | const app = getApp() | 64 | const app = getApp() |
| 58 | 65 | ||
| ... | @@ -60,10 +67,11 @@ | ... | @@ -60,10 +67,11 @@ |
| 60 | const navs = ref(['全部', '审批中', '审批通过', '审批拒绝']) | 67 | const navs = ref(['全部', '审批中', '审批通过', '审批拒绝']) |
| 61 | const current = ref(0) | 68 | const current = ref(0) |
| 62 | 69 | ||
| 70 | // 分页参数 | ||
| 63 | const queryParams = ref({ | 71 | const queryParams = ref({ |
| 64 | auditSelectType: '2', | 72 | auditSelectType: '2', |
| 65 | rankStatus: '0', | 73 | rankStatus: '0', |
| 66 | // status: '', | 74 | status: '', |
| 67 | pageNum: 1, | 75 | pageNum: 1, |
| 68 | pageSize: 10 | 76 | pageSize: 10 |
| 69 | }) | 77 | }) |
| ... | @@ -72,7 +80,10 @@ | ... | @@ -72,7 +80,10 @@ |
| 72 | const total = ref(0) | 80 | const total = ref(0) |
| 73 | const totalCost = ref(0) | 81 | const totalCost = ref(0) |
| 74 | const totalNum = ref(0) | 82 | const totalNum = ref(0) |
| 83 | const loading = ref(false) // 加载状态 | ||
| 84 | const noMore = ref(false) // 是否无更多数据 | ||
| 75 | 85 | ||
| 86 | // 页面加载 | ||
| 76 | onLoad((options) => { | 87 | onLoad((options) => { |
| 77 | queryParams.value.type = options.type | 88 | queryParams.value.type = options.type |
| 78 | queryParams.value.auditSelectType = options.type | 89 | queryParams.value.auditSelectType = options.type |
| ... | @@ -83,43 +94,86 @@ | ... | @@ -83,43 +94,86 @@ |
| 83 | } | 94 | } |
| 84 | }) | 95 | }) |
| 85 | 96 | ||
| 97 | // 页面显示 | ||
| 86 | onShow(() => { | 98 | onShow(() => { |
| 87 | if (app.globalData.isLogin) { | 99 | if (app.globalData.isLogin) { |
| 88 | getList() | 100 | refreshList() |
| 89 | } else { | 101 | } else { |
| 90 | app.firstLoadCallback = () => { getList() } | 102 | app.firstLoadCallback = () => { refreshList() } |
| 91 | } | 103 | } |
| 92 | }) | 104 | }) |
| 93 | 105 | ||
| 106 | // 顶部切换 | ||
| 94 | function onClickItem(e) { | 107 | function onClickItem(e) { |
| 95 | current.value = e.currentIndex | 108 | current.value = e.currentIndex |
| 96 | queryParams.value.status = statusValues[e.currentIndex] | 109 | queryParams.value.status = statusValues[e.currentIndex] |
| 110 | refreshList() | ||
| 111 | } | ||
| 112 | |||
| 113 | // 下拉刷新(重置) | ||
| 114 | function refreshList() { | ||
| 115 | queryParams.value.pageNum = 1 | ||
| 116 | noMore.value = false | ||
| 117 | infoList.value = [] | ||
| 97 | getList() | 118 | getList() |
| 98 | } | 119 | } |
| 99 | 120 | ||
| 121 | // 上滑加载下一页 | ||
| 122 | onReachBottom(() => { | ||
| 123 | if (loading.value || noMore.value) return | ||
| 124 | queryParams.value.pageNum++ | ||
| 125 | getList() | ||
| 126 | }) | ||
| 127 | |||
| 128 | // 获取列表 | ||
| 100 | function getList() { | 129 | function getList() { |
| 101 | uni.showLoading({ title: '加载中', mask: true }) | 130 | // 已无更多数据 或 正在加载,直接返回 |
| 131 | if (noMore.value || loading.value) return | ||
| 132 | loading.value = true | ||
| 133 | |||
| 134 | uni.showLoading({ title: '加载中', mask: queryParams.value.pageNum === 1 }) | ||
| 102 | totalCost.value = 0 | 135 | totalCost.value = 0 |
| 103 | totalNum.value = 0 | 136 | totalNum.value = 0 |
| 137 | |||
| 104 | api.examauditList(queryParams.value).then(res => { | 138 | api.examauditList(queryParams.value).then(res => { |
| 139 | loading.value = false | ||
| 105 | uni.hideLoading() | 140 | uni.hideLoading() |
| 106 | infoList.value = res.rows || [] | 141 | |
| 142 | const list = res.rows || [] | ||
| 107 | total.value = res.total || 0 | 143 | total.value = res.total || 0 |
| 144 | |||
| 145 | // 第一页:直接覆盖 | ||
| 146 | if (queryParams.value.pageNum === 1) { | ||
| 147 | infoList.value = list | ||
| 148 | } else { | ||
| 149 | // 分页:追加 | ||
| 150 | infoList.value = [...infoList.value, ...list] | ||
| 151 | } | ||
| 152 | |||
| 153 | // 判断是否还有下一页 | ||
| 154 | if (list.length < queryParams.value.pageSize) { | ||
| 155 | noMore.value = true | ||
| 156 | } | ||
| 157 | |||
| 158 | // 统计 | ||
| 108 | infoList.value.forEach(item => { | 159 | infoList.value.forEach(item => { |
| 109 | totalCost.value += Number(item.price) || 0 | 160 | totalCost.value += Number(item.price) || 0 |
| 110 | totalNum.value += Number(item.totalNum) || 0 | 161 | totalNum.value += Number(item.totalNum) || 0 |
| 111 | }) | 162 | }) |
| 112 | }).catch(() => { | 163 | }).catch(() => { |
| 164 | loading.value = false | ||
| 113 | uni.hideLoading() | 165 | uni.hideLoading() |
| 114 | }) | 166 | }) |
| 115 | } | 167 | } |
| 116 | 168 | ||
| 169 | // 详情 | ||
| 117 | function goDetail(item) { | 170 | function goDetail(item) { |
| 118 | uni.navigateTo({ | 171 | uni.navigateTo({ |
| 119 | url: `/pages/rank/applyDetail?examId=${item.examId}&type=1` | 172 | url: `/pages/rank/applyDetail?examId=${item.examId}&type=1` |
| 120 | }) | 173 | }) |
| 121 | } | 174 | } |
| 122 | 175 | ||
| 176 | // 审核 | ||
| 123 | function goApproval(item) { | 177 | function goApproval(item) { |
| 124 | uni.navigateTo({ | 178 | uni.navigateTo({ |
| 125 | url: `/pages/rank/scoreAudit?ids=${item.examId}&pageType=2` | 179 | url: `/pages/rank/scoreAudit?ids=${item.examId}&pageType=2` |
| ... | @@ -141,4 +195,12 @@ | ... | @@ -141,4 +195,12 @@ |
| 141 | font-weight: 600; | 195 | font-weight: 600; |
| 142 | } | 196 | } |
| 143 | } | 197 | } |
| 144 | </style> | 198 | |
| 199 | /* 加载提示 */ | ||
| 200 | .load-tip { | ||
| 201 | text-align: center; | ||
| 202 | padding: 20rpx 0; | ||
| 203 | font-size: 26rpx; | ||
| 204 | color: #999; | ||
| 205 | } | ||
| 206 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -3,11 +3,6 @@ | ... | @@ -3,11 +3,6 @@ |
| 3 | <uni-segmented-control class="whitebg" :current="current" :values="navs" @clickItem="onClickItem" | 3 | <uni-segmented-control class="whitebg" :current="current" :values="navs" @clickItem="onClickItem" |
| 4 | styleType="text" activeColor="#AD181F"></uni-segmented-control> | 4 | styleType="text" activeColor="#AD181F"></uni-segmented-control> |
| 5 | 5 | ||
| 6 | <!-- <view v-show="infoList.length>0" class="stat-row"> | ||
| 7 | <view class="stat-item">费用合计:<text class="red">{{ totalCost.toFixed(2) }}元</text></view> | ||
| 8 | <view class="stat-item">考试人数:<text class="red">{{ totalNum }}人</text></view> | ||
| 9 | </view> --> | ||
| 10 | |||
| 11 | <view class="appList"> | 6 | <view class="appList"> |
| 12 | <view class="appItem" v-for="item in infoList" :key="item.examId"> | 7 | <view class="appItem" v-for="item in infoList" :key="item.examId"> |
| 13 | <view @click="goDetail(item)"> | 8 | <view @click="goDetail(item)"> |
| ... | @@ -47,7 +42,14 @@ | ... | @@ -47,7 +42,14 @@ |
| 47 | </view> | 42 | </view> |
| 48 | </view> | 43 | </view> |
| 49 | 44 | ||
| 50 | <view class="nodata" v-if="infoList.length==0"> | 45 | <!-- 加载提示 --> |
| 46 | <view class="load-tip" v-if="infoList.length > 0"> | ||
| 47 | <text v-if="loading">加载中...</text> | ||
| 48 | <text v-else-if="noMore">没有更多数据了</text> | ||
| 49 | </view> | ||
| 50 | |||
| 51 | <!-- 空数据 --> | ||
| 52 | <view class="nodata" v-if="infoList.length == 0 && !loading"> | ||
| 51 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> | 53 | <image mode="aspectFit" :src="config.baseUrl_api + '/fs/static/nodata.png'"></image> |
| 52 | <text>暂无数据</text> | 54 | <text>暂无数据</text> |
| 53 | </view> | 55 | </view> |
| ... | @@ -58,7 +60,7 @@ | ... | @@ -58,7 +60,7 @@ |
| 58 | import * as api from '@/common/api.js' | 60 | import * as api from '@/common/api.js' |
| 59 | import config from '@/config.js' | 61 | import config from '@/config.js' |
| 60 | import { ref } from 'vue' | 62 | import { ref } from 'vue' |
| 61 | import { onLoad, onShow } from '@dcloudio/uni-app' | 63 | import { onLoad, onShow, onReachBottom } from '@dcloudio/uni-app' |
| 62 | 64 | ||
| 63 | const app = getApp() | 65 | const app = getApp() |
| 64 | 66 | ||
| ... | @@ -67,20 +69,23 @@ | ... | @@ -67,20 +69,23 @@ |
| 67 | const current = ref(0) | 69 | const current = ref(0) |
| 68 | const statusArr = ['审批中', '审批通过', '审批拒绝', '审批撤回'] | 70 | const statusArr = ['审批中', '审批通过', '审批拒绝', '审批撤回'] |
| 69 | 71 | ||
| 72 | // 分页参数 | ||
| 70 | const queryParams = ref({ | 73 | const queryParams = ref({ |
| 71 | status: '', | 74 | scoreStatus: '', |
| 72 | pageNum: 1, | 75 | pageNum: 1, |
| 73 | pageSize: 50 | 76 | pageSize: 10 |
| 74 | }) | 77 | }) |
| 75 | 78 | ||
| 76 | const infoList = ref([]) | 79 | const infoList = ref([]) |
| 77 | const total = ref(0) | 80 | const total = ref(0) |
| 78 | const totalCost = ref(0) | 81 | const totalCost = ref(0) |
| 79 | const totalNum = ref(0) | 82 | const totalNum = ref(0) |
| 83 | const loading = ref(false) | ||
| 84 | const noMore = ref(false) | ||
| 80 | 85 | ||
| 81 | onLoad((options) => { | 86 | onLoad((options) => { |
| 82 | queryParams.value.type = options.type | 87 | queryParams.value.type = options.type |
| 83 | queryParams.value.auditSelectType = options.type | 88 | queryParams.value.auditSelectType = options.type |
| 84 | if (options.type == '3') { | 89 | if (options.type == '3') { |
| 85 | uni.setNavigationBarTitle({ title: '段位成绩审核' }) | 90 | uni.setNavigationBarTitle({ title: '段位成绩审核' }) |
| 86 | } else if (options.type == '5') { | 91 | } else if (options.type == '5') { |
| ... | @@ -90,42 +95,85 @@ | ... | @@ -90,42 +95,85 @@ |
| 90 | 95 | ||
| 91 | onShow(() => { | 96 | onShow(() => { |
| 92 | if (app.globalData.isLogin) { | 97 | if (app.globalData.isLogin) { |
| 93 | getList() | 98 | refreshList() |
| 94 | } else { | 99 | } else { |
| 95 | app.firstLoadCallback = () => { getList() } | 100 | app.firstLoadCallback = () => { refreshList() } |
| 96 | } | 101 | } |
| 97 | }) | 102 | }) |
| 98 | 103 | ||
| 104 | // 切换标签 | ||
| 99 | function onClickItem(e) { | 105 | function onClickItem(e) { |
| 100 | current.value = e.currentIndex | 106 | current.value = e.currentIndex |
| 101 | queryParams.value.scoreStatus = statusValues[e.currentIndex] | 107 | queryParams.value.scoreStatus = statusValues[e.currentIndex] |
| 108 | refreshList() | ||
| 109 | } | ||
| 110 | |||
| 111 | // 刷新列表(重置第一页) | ||
| 112 | function refreshList() { | ||
| 113 | queryParams.value.pageNum = 1 | ||
| 114 | noMore.value = false | ||
| 115 | infoList.value = [] | ||
| 102 | getList() | 116 | getList() |
| 103 | } | 117 | } |
| 104 | 118 | ||
| 119 | // 上滑加载下一页 | ||
| 120 | onReachBottom(() => { | ||
| 121 | if (loading.value || noMore.value) return | ||
| 122 | queryParams.value.pageNum++ | ||
| 123 | getList() | ||
| 124 | }) | ||
| 125 | |||
| 126 | // 获取数据 | ||
| 105 | function getList() { | 127 | function getList() { |
| 106 | uni.showLoading({ title: '加载中', mask: true }) | 128 | if (loading.value || noMore.value) return |
| 107 | totalCost.value = 0 | 129 | loading.value = true |
| 108 | totalNum.value = 0 | 130 | |
| 131 | // 第一页显示loading | ||
| 132 | if (queryParams.value.pageNum === 1) { | ||
| 133 | uni.showLoading({ title: '加载中', mask: true }) | ||
| 134 | } | ||
| 135 | |||
| 109 | api.examauditList(queryParams.value).then(res => { | 136 | api.examauditList(queryParams.value).then(res => { |
| 137 | loading.value = false | ||
| 110 | uni.hideLoading() | 138 | uni.hideLoading() |
| 111 | infoList.value = res.rows || [] | 139 | |
| 140 | const list = res.rows || [] | ||
| 112 | total.value = res.total || 0 | 141 | total.value = res.total || 0 |
| 142 | |||
| 143 | // 分页追加数据 | ||
| 144 | if (queryParams.value.pageNum === 1) { | ||
| 145 | infoList.value = list | ||
| 146 | } else { | ||
| 147 | infoList.value = [...infoList.value, ...list] | ||
| 148 | } | ||
| 149 | |||
| 150 | // 判断是否还有更多 | ||
| 151 | if (list.length < queryParams.value.pageSize) { | ||
| 152 | noMore.value = true | ||
| 153 | } | ||
| 154 | |||
| 155 | // 统计合计 | ||
| 156 | totalCost.value = 0 | ||
| 157 | totalNum.value = 0 | ||
| 113 | infoList.value.forEach(item => { | 158 | infoList.value.forEach(item => { |
| 114 | item.statusStr = statusArr[item.auditStatus] || '审批中' | 159 | item.statusStr = statusArr[item.auditStatus] || '审批中' |
| 115 | totalCost.value += Number(item.totalAmount) || 0 | 160 | totalCost.value += Number(item.totalAmount) || 0 |
| 116 | totalNum.value += Number(item.totalNum) || 0 | 161 | totalNum.value += Number(item.totalNum) || 0 |
| 117 | }) | 162 | }) |
| 118 | }).catch(() => { | 163 | }).catch(() => { |
| 164 | loading.value = false | ||
| 119 | uni.hideLoading() | 165 | uni.hideLoading() |
| 120 | }) | 166 | }) |
| 121 | } | 167 | } |
| 122 | 168 | ||
| 169 | // 审核 | ||
| 123 | function goApproval(item) { | 170 | function goApproval(item) { |
| 124 | uni.navigateTo({ | 171 | uni.navigateTo({ |
| 125 | url: `/pages/rank/scoreAudit?ids=${item.examId}&pageType=2` | 172 | url: `/pages/rank/scoreAudit?ids=${item.examId}&pageType=2` |
| 126 | }) | 173 | }) |
| 127 | } | 174 | } |
| 128 | 175 | ||
| 176 | // 详情 | ||
| 129 | function goDetail(item) { | 177 | function goDetail(item) { |
| 130 | uni.navigateTo({ | 178 | uni.navigateTo({ |
| 131 | url: `/pages/rank/scoreDetail?examId=${item.examId}&type=${queryParams.value.type}` | 179 | url: `/pages/rank/scoreDetail?examId=${item.examId}&type=${queryParams.value.type}` |
| ... | @@ -143,8 +191,16 @@ | ... | @@ -143,8 +191,16 @@ |
| 143 | color: #666; | 191 | color: #666; |
| 144 | 192 | ||
| 145 | .red { | 193 | .red { |
| 146 | color: #C4121B; | 194 | color: #C4121F; |
| 147 | font-weight: 600; | 195 | font-weight: 600; |
| 148 | } | 196 | } |
| 149 | } | 197 | } |
| 150 | </style> | 198 | |
| 199 | /* 加载提示 */ | ||
| 200 | .load-tip { | ||
| 201 | text-align: center; | ||
| 202 | padding: 20rpx 0; | ||
| 203 | font-size: 26rpx; | ||
| 204 | color: #999; | ||
| 205 | } | ||
| 206 | </style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment