|
|
@ -1,31 +1,31 @@ |
|
|
|
<!-- 基于z-paging封装个性化分页组件演示(vue) --> |
|
|
|
<template> |
|
|
|
<view class=""> |
|
|
|
<com-blank-view @goScan='openScanPopup' v-if="itemCode==''"></com-blank-view> |
|
|
|
<!-- 这里就很整洁了,只要设置ref,绑定query事件,绑定list就可以了 --> |
|
|
|
<my-paging v-show="itemCode!=''" ref="paging" v-model="dataList" @query="queryList"> |
|
|
|
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中,如果需要跟着滚动,则不要设置slot="top" --> |
|
|
|
<template #top> |
|
|
|
<view v-if="itemDetail!=undefined"> |
|
|
|
<item-info :itemdetail='itemDetail'></item-info> |
|
|
|
<view class='split_line'></view> |
|
|
|
<z-tabs :list="tabList" @change="tabChange" /> |
|
|
|
<view class="uni-flex" style="flex-direction: column"> |
|
|
|
<itemFilter ref="filter" @onConfirmClick="confirm"> |
|
|
|
</itemFilter> |
|
|
|
<view class="top" style=""> |
|
|
|
<com-blank-view @goScan='openScanPopup' v-if="itemCode==''"></com-blank-view> |
|
|
|
<item-info v-if="itemDetail" :itemdetail='itemDetail'></item-info> |
|
|
|
<z-tabs v-if="itemCode" :list="tabList" @change="tabChange" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view style="padding-top: 230rpx;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%" :key="index"> |
|
|
|
<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> |
|
|
|
<comItemDetailCard :isShowPack="false" :dataContent="item" style='margin: 10rpx;'> |
|
|
|
</comItemDetailCard> |
|
|
|
</view> |
|
|
|
|
|
|
|
</template> |
|
|
|
<view class="" style="padding-bottom: 50rpx;"> |
|
|
|
<comItemDetailCard v-if="tabIndex == 0" :itemList="dataList" :isShowPack="false" style='margin: 10rpx;'> |
|
|
|
</comItemDetailCard> |
|
|
|
<comItemDetailCard v-if="tabIndex == 1" :itemList="dataList" style='margin: 10rpx;'> |
|
|
|
</comItemDetailCard> |
|
|
|
<comItemDetailCard v-if="tabIndex == 2" :itemList="dataList" :isShowLocation="false" |
|
|
|
:isShowBusiness="true"></comItemDetailCard> |
|
|
|
<comItemDetailCard v-if="tabIndex == 3" :itemList="dataList" :isShowLocation="false" |
|
|
|
:isShowBusiness="true"> |
|
|
|
</comItemDetailCard> |
|
|
|
</view> |
|
|
|
<uni-load-more :status="loadingType" v-if="dataList.length>0" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
</my-paging> |
|
|
|
<win-scan-button @goScan='openScanPopup' v-if="itemCode!=''"></win-scan-button> |
|
|
|
<win-scan-item ref="scanPopup" title='物料代码' @getScanResult='getScanCode'> |
|
|
|
</win-scan-item> |
|
|
@ -49,6 +49,9 @@ |
|
|
|
import winScanItem from '@/mycomponents/scan/winScanItem.vue' |
|
|
|
import winScanButton from '@/mycomponents/scan/winScanButton.vue' |
|
|
|
import comItemDetailCard from '@/pages/query/coms/comItemDetailCard.vue' |
|
|
|
import itemFilter from '@/mycomponents/item/itemFilter.vue' |
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
itemInfo, |
|
|
@ -56,6 +59,8 @@ |
|
|
|
winScanItem, |
|
|
|
winScanButton, |
|
|
|
comItemDetailCard, |
|
|
|
itemFilter, |
|
|
|
comEmptyView |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -66,17 +71,37 @@ |
|
|
|
itemDetail: undefined, |
|
|
|
itemCode: '', |
|
|
|
balances: [], |
|
|
|
loadingType: "nomore", |
|
|
|
totalCount: 0, |
|
|
|
locationCode: "", |
|
|
|
inventoryStatus: "", |
|
|
|
pageSize:10 |
|
|
|
} |
|
|
|
}, |
|
|
|
//返回首页 |
|
|
|
onNavigationBarButtonTap(e) { |
|
|
|
if (e.index === 0) { |
|
|
|
goHome(); |
|
|
|
} else if (e.index == 1) { |
|
|
|
this.$refs.filter.openFilter(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
onReachBottom() { |
|
|
|
console.log("底部") |
|
|
|
//避免多次触发 |
|
|
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') { |
|
|
|
return; |
|
|
|
} |
|
|
|
this.getContentByTab(this.tabIndex, this.pageNo, this.pageSize, "more"); |
|
|
|
|
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
|
onPullDownRefresh() { |
|
|
|
this.getContentByTab(this.tabIndex, this.pageNo, this.pageSize, "refresh"); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
openScanPopup() { |
|
|
|
this.$refs.scanPopup.openScanPopup(); |
|
|
@ -117,25 +142,64 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
// 汇总 |
|
|
|
getSummary(pageNo, pageSize) { |
|
|
|
getSummary(pageNo, pageSize, type) { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var filters = []; |
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: this.itemCode |
|
|
|
}) |
|
|
|
if (this.locationCode) { |
|
|
|
filters.push({ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.inventoryStatus) { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.inventoryStatus |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
itemCode: this.itemCode, |
|
|
|
pageNo: pageNo, |
|
|
|
filters: filters, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
console.log("getSummary", pageNo) |
|
|
|
getBalanceSummary(params).then(res => { |
|
|
|
getBalanceByItemCode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
this.$refs.paging.complete(res.data.list); |
|
|
|
} else { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
this.showMessage('未查找到物料【' + this.itemCode + '】'); |
|
|
|
|
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
list.forEach(item=>{ |
|
|
|
item.packingNumber="" |
|
|
|
}) |
|
|
|
|
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
@ -143,95 +207,199 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
//明细 |
|
|
|
getDetailList(pageNo, pageSize) { |
|
|
|
getDetailList(pageNo, pageSize, type) { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var filters = []; |
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: this.itemCode |
|
|
|
}) |
|
|
|
if (this.locationCode) { |
|
|
|
filters.push({ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.inventoryStatus) { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.inventoryStatus |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
itemCode: this.itemCode, |
|
|
|
pageNo: pageNo, |
|
|
|
filters: filters, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
getBalanceByItemCode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.list.length > 0) { |
|
|
|
this.$refs.paging.complete(res.data.list); |
|
|
|
} else { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
this.showMessage('未查找到物料【' + this.itemCode + '】'); |
|
|
|
|
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
ontabtap(e) { |
|
|
|
let index = e.target.dataset.current || e.currentTarget.dataset.current; |
|
|
|
this.tabIndex = index; |
|
|
|
this.getContentByTab(index); |
|
|
|
}, |
|
|
|
|
|
|
|
getContentByTab(index, pageNo, pageSize) { |
|
|
|
if (index === 0) this.getSummary(pageNo, pageSize); |
|
|
|
else if (index === 1) this.getDetailList(pageNo, pageSize); |
|
|
|
getContentByTab(index, pageNo, pageSize, type) { |
|
|
|
if (index === 0) this.getSummary(pageNo, pageSize, type); |
|
|
|
else if (index === 1) this.getDetailList(pageNo, pageSize, type); |
|
|
|
else if (index === 2) { |
|
|
|
this.getExpectin(pageNo, pageSize); |
|
|
|
this.getExpectin(pageNo, pageSize, type); |
|
|
|
} else if (index == 3) { |
|
|
|
this.getExpectout(pageNo, pageSize); |
|
|
|
this.getExpectout(pageNo, pageSize, type); |
|
|
|
} |
|
|
|
}, |
|
|
|
//预计入 |
|
|
|
getExpectin(pageNo, pageSize) { |
|
|
|
getExpectin(pageNo, pageSize, type) { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var filters = []; |
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: this.itemCode |
|
|
|
}) |
|
|
|
if (this.locationCode) { |
|
|
|
filters.push({ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.inventoryStatus) { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.inventoryStatus |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
itemCode: this.itemCode, |
|
|
|
pageNo: pageNo, |
|
|
|
filters: filters, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
getExpectinByItemcode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.total > 0) { |
|
|
|
this.$refs.paging.complete(res.data.list); |
|
|
|
} else { |
|
|
|
this.showMessage('未查找到物料【' + this.itemCode + '】'); |
|
|
|
|
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//预计出 |
|
|
|
getExpectout(pageNo, pageSize) { |
|
|
|
getExpectout(pageNo, pageSize, type) { |
|
|
|
uni.showLoading({ |
|
|
|
title: "加载中...", |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
this.loadingType = "loading"; |
|
|
|
if (type === "refresh") { |
|
|
|
this.pageNo = 1; |
|
|
|
this.dataList = []; |
|
|
|
} |
|
|
|
|
|
|
|
var filters = []; |
|
|
|
filters.push({ |
|
|
|
column: "itemCode", |
|
|
|
action: "==", |
|
|
|
value: this.itemCode |
|
|
|
}) |
|
|
|
if (this.locationCode) { |
|
|
|
filters.push({ |
|
|
|
column: "locationCode", |
|
|
|
action: "==", |
|
|
|
value: this.locationCode |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.inventoryStatus) { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.inventoryStatus |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
itemCode: this.itemCode, |
|
|
|
pageNo: pageNo, |
|
|
|
filters: filters, |
|
|
|
pageNo: this.pageNo, |
|
|
|
pageSize: pageSize |
|
|
|
} |
|
|
|
getExpectoutByItemcode(params).then(res => { |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data.total > 0) { |
|
|
|
this.$refs.paging.complete(res.data.list); |
|
|
|
} else { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
this.showMessage('未查找到物料【' + this.itemCode + '】'); |
|
|
|
if (type === "refresh") { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
} |
|
|
|
var list = res.data.list; |
|
|
|
this.totalCount = res.data.total |
|
|
|
this.loadingType = "loadmore"; |
|
|
|
if (list == null || list.length == 0) { |
|
|
|
this.loadingType = "nomore"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.dataList = type === "refresh" ? list : this.dataList.concat(list); |
|
|
|
this.pageNo++; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.$refs.paging.complete(false); |
|
|
|
uni.hideLoading(); |
|
|
|
this.showMessage(error); |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
showMessage(message) { |
|
|
@ -248,55 +416,38 @@ |
|
|
|
}, |
|
|
|
tabChange(index) { |
|
|
|
this.tabIndex = index; |
|
|
|
this.$refs.paging.reload(true); |
|
|
|
this.getContentByTab(index, this.pageNo, this.pageSize, "refresh") |
|
|
|
}, |
|
|
|
queryList(pageNo, pageSize) { |
|
|
|
console.log("加载", pageNo) |
|
|
|
if (this.itemCode != "") { |
|
|
|
this.getContentByTab(this.tabIndex, pageNo, pageSize) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
itemClick(item) { |
|
|
|
console.log('点击了', item.title); |
|
|
|
confirm(locationCode, status) { |
|
|
|
this.locationCode = locationCode; |
|
|
|
if(status.length>0){ |
|
|
|
var arrayItems = status.join(',') |
|
|
|
this.inventoryStatus = arrayItems |
|
|
|
}else { |
|
|
|
this.inventoryStatus="" |
|
|
|
} |
|
|
|
this.tabChange(this.tabIndex) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style> |
|
|
|
.notice { |
|
|
|
background-color: red; |
|
|
|
color: white; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
padding: 12rpx 20rpx; |
|
|
|
font-size: 24rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.item { |
|
|
|
position: relative; |
|
|
|
height: 150rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: space-between; |
|
|
|
padding: 0rpx 30rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.item-detail { |
|
|
|
padding: 5rpx 15rpx; |
|
|
|
border-radius: 10rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
color: white; |
|
|
|
background-color: #007AFF; |
|
|
|
<style scoped lang="scss"> |
|
|
|
page { |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.item-line { |
|
|
|
position: absolute; |
|
|
|
bottom: 0rpx; |
|
|
|
left: 0rpx; |
|
|
|
height: 1px; |
|
|
|
width: 100%; |
|
|
|
background-color: #eeeeee; |
|
|
|
.top{ |
|
|
|
width: 100%; |
|
|
|
position: fixed; |
|
|
|
/* #ifdef APP */ |
|
|
|
top: 0rpx; |
|
|
|
/* #endif */ |
|
|
|
|
|
|
|
/* #ifdef H5 */ |
|
|
|
top: 80rpx; |
|
|
|
/* #endif */ |
|
|
|
|
|
|
|
right: 0; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |