You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

307 lines
8.2 KiB

2 years ago
<template>
1 year ago
<!-- <page-meta root-font-size="18px"></page-meta> -->
<view class="uni-flex" style="flex-direction: column">
<view class="" style="width: 100%; position: fixed; top: 0; right: 0">
<com-blank-view @goScan="openScanPopup" v-if="locationCode == ''"></com-blank-view>
<location-info :locationDetail="locationDetail" v-if="locationCode"></location-info>
<z-tabs v-if="locationCode" :list="tabList" @change="tabChange" />
</view>
<view style="padding-top: 200rpx; width: 100%">
<view v-if="totalCount > 0" style="margin: 10rpx; font-size: 35rpx; font-weight: bold">总数 : {{ totalCount }} </view>
<view v-for="(item, index) in dataList" style="width: 100%">
<view class="uni-flex uni-row" style="align-items: center; background-color: #fff; border-radius: 10rpx; margin: 10rpx">
<view class="" style="font-size: 35rpx"> ({{ index + 1 }}) </view>
<comLocationDetailCard :isShowPack="false" :dataContent="item" style="margin: 10rpx"> </comLocationDetailCard>
1 year ago
</view>
</view>
<uni-load-more :status="loadingType" v-if="dataList.length > 0" />
</view>
1 year ago
<win-scan-button @goScan="openScanPopup" v-if="locationCode != ''"></win-scan-button>
<winScanLocation ref="scanPopup" title="库位代码" @getLocation="getScanCode"></winScanLocation>
<show-modal ref="modal"></show-modal>
<com-message ref="comMessageRef" />
</view>
2 years ago
</template>
1 year ago
<script setup lang="ts">
import { ref, getCurrentInstance, nextTick, onMounted, watch } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { getBalanceByLocationcode, getBalanceByLocationcodeGroup, getExpectInByLocationCode, getExpectOutByLocationCode } from '@/api/request2.js'
1 year ago
import { maxPageSize, goHome } from '@/common/basic.js'
import { calc } from '@/common/calc.js'
import locationInfo from '@/mycomponents/location/locationInfo.vue'
import comBlankView from '@/mycomponents/common/comBlankView.vue'
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import comLocationDetailCard from '@/pages/query/coms/comLocationDetailCard.vue'
import winScanLocation from '@/mycomponents/scan/winScanLocation.vue'
const { proxy } = getCurrentInstance()
const locationDetail = ref({})
const locationCode = ref('')
const summarys = ref([])
const balances = ref([])
const dataIn = ref([])
const dataOut = ref([])
const pageNo = ref(1)
1 year ago
// 每页数据量
const pageSize = ref(10)
1 year ago
// 当前页
const pageCurrent = ref(1)
// 数据总量
const dataList = ref([])
const tabList = ref(['汇总', '明细', '预计入', '预计出'])
1 year ago
const tabIndex = ref(0)
const loadingType = ref('nomore')
const totalCount = ref(0)
1 year ago
const scanPopup = ref()
const modal = ref()
const paging = ref()
const comMessageRef = ref()
const itemCode = ref()
const summarysList = ref()
const detailList = ref()
onNavigationBarButtonTap((e) => {
if (e.index === 0) {
goHome()
}
})
onMounted(() => {
openScanPopup()
})
onLoad((option) => {
uni.setNavigationBarTitle({
title: option.title
})
})
onPullDownRefresh(() => {
getContentByTab(tabIndex.value, pageNo.value, pageSize.value, 'refresh')
})
onReachBottom(() => {
console.log('底部')
// 避免多次触发
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
return
}
getContentByTab(tabIndex.value, pageNo.value, pageSize.value, 'more')
})
1 year ago
const openScanPopup = (val) => {
scanPopup.value.openScanPopup()
}
const closeScanPopup = () => {
scanPopup.value.closeScanPopup()
}
const getScanCode = (location, code) => {
// locationCode.value = ''
summarys.value = []
balances.value = []
locationCode.value = code
locationDetail.value = location
console.log(22, locationDetail.value)
tabChange(0)
// this.getContentByTab(this.tabIndex);
}
const getSummary = (pageNo, pageSize, type) => {
1 year ago
proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
1 year ago
const params = {
locationCode: locationCode.value,
pageNo: pageNo.value,
1 year ago
pageSize
}
1 year ago
getBalanceByLocationcodeGroup(params)
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
1 year ago
}
const { list } = res.data
totalCount.value = res.data.total
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
}
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
1 year ago
})
.catch((error) => {
paging.value.complete(false)
uni.hideLoading()
showMessage(error)
})
}
const getDetailList = (pageNo, pageSize, type) => {
1 year ago
proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
1 year ago
const params = {
locationCode: locationCode.value,
pageNo: pageNo.value,
1 year ago
pageSize
}
getBalanceByLocationcode(params)
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
const { list } = res.data
totalCount.value = res.data.total
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
1 year ago
}
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
1 year ago
})
.catch((error) => {
paging.value.complete(false)
uni.hideLoading()
showMessage(error)
})
}
const getExpectin = (pageNo, pageSize, type) => {
uni.showLoading({
title: '加载中...',
mask: true
})
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
1 year ago
const params = {
pageNo: pageNo.value,
pageSize,
filters: [
{
column: 'locationCode',
action: '==',
value: locationCode.value
1 year ago
}
]
}
getExpectInByLocationCode(params)
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
1 year ago
}
const { list } = res.data
totalCount.value = res.data.total
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
1 year ago
}
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
})
.catch((error) => {
uni.hideLoading()
showMessage(error)
})
1 year ago
}
const getExpectOut = (pageNo, pageSize, type) => {
uni.showLoading({
title: '加载中...',
mask: true
})
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
const params = {
pageNo: pageNo.value,
pageSize,
filters: [
{
column: 'locationCode',
action: '==',
value: locationCode.value
}
]
}
getExpectOutByLocationCode(params)
.then((res) => {
uni.hideLoading()
if (type === 'refresh') {
uni.stopPullDownRefresh()
}
const { list } = res.data
totalCount.value = res.data.total
loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
}
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
})
.catch((error) => {
uni.hideLoading()
showMessage(error)
})
1 year ago
}
const getContentByTab = (index, pageNo, pageSize, type) => {
1 year ago
if (index === 0) {
getSummary(pageNo, pageSize, type)
1 year ago
} else if (index === 1) {
getDetailList(pageNo, pageSize, type)
1 year ago
} else if (index === 2) {
getExpectin(pageNo, pageSize, type)
1 year ago
} else if (index == 3) {
getExpectin(pageNo, pageSize, type)
1 year ago
}
}
const showMessage = (message) => {
comMessageRef.value.showErrorMessage(message, (res) => {
if (res) {
// afterCloseMessage()
}
})
}
const afterCloseMessage = () => {
if (scanPopup.value != undefined) {
scanPopup.value.getfocus()
}
}
const tabChange = (index) => {
tabIndex.value = index
getContentByTab(index, pageNo.value, pageSize.value, 'refresh')
1 year ago
}
2 years ago
</script>
<style scoped lang="scss">
1 year ago
page {
height: 100%;
}
2 years ago
</style>