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) console.log(res)
if(res.code==200){ if(res.code==200){
uni.showToast({ title: '编辑成功', icon: 'none' }) uni.showToast({ title: '编辑成功', icon: 'none' })
uni.navigateBack({ const pages = getCurrentPages()
delta: 2 // console.log('🚀 ~ submitNum ~ pages:', pages)
}); if (pages.length == 5) {
uni.navigateBack({
delta: 3, //
})
} else {
uni.navigateBack({
delta: 2, //
})
}
}else{ }else{
uni.showToast({ title: res.msg, icon: 'none' }) uni.showToast({ title: res.msg, icon: 'none' })
} }

View File

@ -55,7 +55,7 @@
</uni-col> </uni-col>
</uni-row> </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 <view
class="table-list-item" class="table-list-item"
:key="index" :key="index"
@ -138,12 +138,15 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, computed } from 'vue' import { ref, reactive, computed, nextTick } from 'vue'
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js' 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 { debounce } from 'lodash-es'
import { onBackPress } from '@dcloudio/uni-app' import { onBackPress } from '@dcloudio/uni-app'
import { formatDiff } from '@/utils/bnsBase.js' import { formatDiff } from '@/utils/bnsBase.js'
const scrollTop = ref(0)
const total = ref(0) // const total = ref(0) //
const active = ref(1) // tap const active = ref(1) // tap
const tableList = ref([]) // const tableList = ref([]) //
@ -208,6 +211,10 @@ const getTableList = async (isTap = false, isSearch = false) => {
} }
console.log('queryParams.value查询参数', queryParams.value) console.log('queryParams.value查询参数', queryParams.value)
const res = await getPickingOutboundListAPI(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) console.log('res列表数据', res)
total.value = res.data.total total.value = res.data.total
if (isTap) { 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 queryParams.value.pageNum = 1
tableList.value = [] tableList.value = []
total.value = 0 total.value = 0
if (uni.getStorageSync('queryParams')) {
queryParams.value = JSON.parse(uni.getStorageSync('queryParams'))
}
getTableList() getTableList()
}) })
@ -263,8 +274,19 @@ const onScrollTolower = debounce(() => {
} }
}, 500) }, 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 // tap
const changeTab = (index) => { const changeTab = (index) => {
uni.removeStorageSync('scrollTop')
uni.removeStorageSync('queryParams')
active.value = index active.value = index
console.log('index', index) console.log('index', index)
if (index == 2) { if (index == 2) {

View File

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