Browse Source

fix(表格-现金退款): 修复退款详情表格翻页后滚动位置未重置的问题

在退款管理的四个详情页面中,为表格添加引用并实现滚动到顶部的功能。
当获取新数据并渲染后,自动将表格滚动条重置到顶部,避免用户翻页时停留在之前的滚动位置。
milestone-20260212-日常优化2.0
zhangrenyuan 3 weeks ago
parent
commit
c345da7f75
  1. 10
      src/views/moneyManage/refundDetail/refundCharge.vue
  2. 10
      src/views/moneyManage/refundDetail/refundFinance.vue
  3. 10
      src/views/moneyManage/refundDetail/refundHeader.vue
  4. 10
      src/views/moneyManage/refundDetail/refundService.vue

10
src/views/moneyManage/refundDetail/refundCharge.vue

@ -44,7 +44,7 @@
</el-card> </el-card>
<el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);"> <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
<el-table :data="tableData" style="height:73vh;width:82vw">
<el-table ref="tableRef" :data="tableData" style="height:73vh;width:82vw">
<el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left"> <el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left">
<template #default="scope"> <template #default="scope">
{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
@ -352,7 +352,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted, computed, nextTick } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -394,6 +394,10 @@ const pagination = ref({
const market = ref([]) const market = ref([])
const showAudit2 = ref(false) const showAudit2 = ref(false)
const tableData = ref([]) const tableData = ref([])
const tableRef = ref(null)
const scrollTableTop = () => {
tableRef.value?.setScrollTop?.(0)
}
const showSteps = ref(false) const showSteps = ref(false)
const submitter = ref('')// const submitter = ref('')//
const areaFinance = ref('')// const areaFinance = ref('')//
@ -513,6 +517,8 @@ const getRefund = async function () {
}) })
tableData.value = result.data.list || [] tableData.value = result.data.list || []
await nextTick()
scrollTableTop()
pagination.value.total = result.data.total || 0 pagination.value.total = result.data.total || 0
} catch (error) { } catch (error) {
ElMessage.error(error.message || t('elmessage.searchFailed')) ElMessage.error(error.message || t('elmessage.searchFailed'))

10
src/views/moneyManage/refundDetail/refundFinance.vue

@ -41,7 +41,7 @@
</el-card> </el-card>
<el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);"> <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
<el-table :data="tableData" style="height:73vh;width:82vw">
<el-table :ref="tableRef" :data="tableData" style="height:73vh;width:82vw">
<el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left"> <el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left">
<template #default="scope"> <template #default="scope">
{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
@ -330,7 +330,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted, computed, nextTick } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -372,6 +372,10 @@ const pagination = ref({
}) })
const market = ref([]) const market = ref([])
const tableData = ref([]) const tableData = ref([])
const tableRef = ref(null)
const scrollTableTop = () => {
tableRef.value?.setScrollTop?.(0)
}
const showAudit = ref(false) const showAudit = ref(false)
const auditRow = ref({})// const auditRow = ref({})//
const showSteps = ref(false) const showSteps = ref(false)
@ -487,6 +491,8 @@ const getRefund = async function () {
}) })
tableData.value = result.data.list || [] tableData.value = result.data.list || []
await nextTick()
scrollTableTop()
pagination.value.total = result.data.total || 0 pagination.value.total = result.data.total || 0
} catch (error) { } catch (error) {
ElMessage.error(error.message || t('elmessage.searchFailed')) ElMessage.error(error.message || t('elmessage.searchFailed'))

10
src/views/moneyManage/refundDetail/refundHeader.vue

@ -41,7 +41,7 @@
</el-card> </el-card>
<el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);"> <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
<el-table :data="tableData" style="height:73vh;width:82vw">
<el-table :ref="tableRef" :data="tableData" style="height:73vh;width:82vw">
<el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left"> <el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left">
<template #default="scope"> <template #default="scope">
{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
@ -341,7 +341,7 @@
</template> </template>
<script setup> <script setup>
import BackgroundSvg from '@/assets/images/refund-progress.png' import BackgroundSvg from '@/assets/images/refund-progress.png'
import { ref, onMounted } from 'vue'
import { ref, onMounted, nextTick } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -388,6 +388,10 @@ const pagination = ref({
}) })
const showAudit2 = ref(false) const showAudit2 = ref(false)
const tableData = ref([]) const tableData = ref([])
const tableRef = ref(null)
const scrollTableTop = () => {
tableRef.value?.setScrollTop?.(0)
}
const showSteps = ref(false) const showSteps = ref(false)
const uploadRef = ref(null) const uploadRef = ref(null)
const submitter = ref('')// const submitter = ref('')//
@ -539,6 +543,8 @@ const getRefund = async function () {
}) })
tableData.value = result.data.list || [] tableData.value = result.data.list || []
await nextTick()
scrollTableTop()
pagination.value.total = result.data.total || 0 pagination.value.total = result.data.total || 0
} catch (error) { } catch (error) {
ElMessage.error(error.message || t('elmessage.searchFailed')) ElMessage.error(error.message || t('elmessage.searchFailed'))

10
src/views/moneyManage/refundDetail/refundService.vue

@ -57,7 +57,7 @@
</el-card> </el-card>
<el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);"> <el-card style="margin-top: 0.5vh;background-color: rgb(231,244,253);">
<el-table :data="tableData" style="height:73vh;width:82vw;background-color: rgb(243,250,254);">
<el-table :ref="tableRef" :data="tableData" style="height:73vh;width:82vw;background-color: rgb(243,250,254);">
<el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left"> <el-table-column type="index" :label="t('common_list.id')" width="60" fixed="left">
<template #default="scope"> <template #default="scope">
{{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }} {{ scope.$index + 1 + (pagination.pageNum - 1) * pagination.pageSize }}
@ -248,7 +248,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script setup> <script setup>
import { ref, onMounted, computed } from 'vue'
import { ref, onMounted, computed, nextTick } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import API from '@/util/http.js' import API from '@/util/http.js'
const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload' const uploadUrl = 'https://api.homilychart.com/hljw/api/aws/upload'
@ -296,6 +296,10 @@ const pagination = ref({
total: 0 total: 0
}) })
const tableData = ref([]) const tableData = ref([])
const tableRef = ref(null)
const scrollTableTop = () => {
tableRef.value?.setScrollTop?.(0)
}
const showEdit = ref(false) const showEdit = ref(false)
const uploadRef = ref(null) const uploadRef = ref(null)
const showBack = ref(false) const showBack = ref(false)
@ -373,6 +377,8 @@ const getRefund = async function () {
}) })
tableData.value = result.data.list || [] tableData.value = result.data.list || []
await nextTick()
scrollTableTop()
pagination.value.total = result.data.total || 0 pagination.value.total = result.data.total || 0
} catch (error) { } catch (error) {
ElMessage.error(error.message || t('elmessage.searchFailed')) ElMessage.error(error.message || t('elmessage.searchFailed'))

Loading…
Cancel
Save