This commit is contained in:
bb_pan 2025-09-02 01:59:11 +08:00
parent 3f6aa783f6
commit cc5da67628
3 changed files with 40 additions and 8 deletions

View File

@ -293,9 +293,17 @@ const submitNum = () => {
console.log(res)
if(res.code==200){
uni.showToast({ title: '编辑成功', icon: 'none' })
const pages = getCurrentPages()
console.log('🚀 ~ submitNum ~ pages:', pages)
if (pages.length == 5) {
uni.navigateBack({
delta: 2 //
});
delta: 3, //
})
} else {
uni.navigateBack({
delta: 2, //
})
}
}else{
uni.showToast({ title: res.msg, icon: 'none' })
}

View File

@ -55,7 +55,7 @@
</uni-col>
</uni-row>
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
<scroll-view scroll-y :scroll-top="scrollTop" @scroll="onScroll" @scrolltolower="onScrollTolower" class="scroll-container">
<view
class="table-list-item"
:key="index"
@ -138,12 +138,15 @@
</template>
<script setup>
import { ref, reactive, computed } from 'vue'
import { ref, reactive, computed, nextTick } from 'vue'
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { onLoad, onShow, onPageScroll } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es'
import { onBackPress } from '@dcloudio/uni-app'
import { formatDiff } from '@/utils/bnsBase.js'
const scrollTop = ref(0)
const total = ref(0) //
const active = ref(1) // tap
const tableList = ref([]) //
@ -208,6 +211,10 @@ const getTableList = async (isTap = false, isSearch = false) => {
}
console.log('queryParams.value查询参数', queryParams.value)
const res = await getPickingOutboundListAPI(queryParams.value)
setTimeout(() => {
scrollTop.value = uni.getStorageSync('scrollTop') || 0
console.log('🚀 ~ scrollTop.value:', scrollTop.value)
}, 300)
console.log('res列表数据', res)
total.value = res.data.total
if (isTap) {
@ -240,10 +247,14 @@ const getTableList = async (isTap = false, isSearch = false) => {
}
//
onLoad(() => {
onShow(() => {
console.log('🚀 ~ onShow:', uni.getStorageSync('queryParams'))
queryParams.value.pageNum = 1
tableList.value = []
total.value = 0
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
getTableList()
})
@ -263,8 +274,19 @@ const onScrollTolower = debounce(() => {
}
}, 500)
let timer = null
const onScroll = (e) => {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
uni.setStorageSync('scrollTop', e.detail.scrollTop)
uni.setStorageSync('queryParams', JSON.stringify(queryParams.value))
}, 500)
}
// tap
const changeTab = (index) => {
uni.removeStorageSync('scrollTop')
uni.removeStorageSync('queryParams')
active.value = index
console.log('index', index)
if (index == 2) {

View File

@ -153,6 +153,8 @@ import { onShow,onLoad } from '@dcloudio/uni-app'
const urlPermissions = ref([])
onShow((options) => {
urlPermissions.value = uni.getStorageSync('urlPermissions')
uni.removeStorageSync('scrollTop')
uni.removeStorageSync('queryParams')
})