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.
 
 
 
 
cy_pda/pages/checkAccept/index22.vue

266 lines
7.8 KiB

<template>
<view class="sh-content">
<view class="sh-search">
<u-form labelPosition="left" :model="dataForm" class="sh-form">
<!-- <u-form-item label="容器" prop="containerCode" labelWidth="150rpx">
<u-input v-model="dataForm.containerCode" border style="background-color: #ffffff;"
placeholder="请输入或扫描容器号" @input="changeCode()"></u-input>
</u-form-item> -->
<u-form-item label="商品条码" prop="barCode" labelWidth="150rpx">
<u-input v-model="dataForm.barCode" border style="background-color: #ffffff;"
placeholder="请输入或扫描条码" @input="changeCode()"></u-input>
</u-form-item>
</u-form>
<!-- <view class="sh-sub-search">
<u-button class="sh-search-button" @click="searchClick()" >查询</u-button>
</view> -->
</view>
<!-- {{data}} -->
<!-- <view class="sh-card" v-for="(item, index) in dataList" :key="item.id" :index="item.id"
v-if="dataList.length > 0" @click="goodDetail(item.sid, item.id)">
<view class="sh-card-title" >
<view class="receipt-number">
<text class="receipt-number-title">收货单号</text>
<text class="receipt-number-value">{{item.orderNo}}</text>
</view>
<view class="card-content">
<view class="card-content-item">
<text class="item-title">商品编码</text>
<text class="item-value">{{item.batchNo}}</text>
</view>
</view>
<view class="card-content"><view class="card-content-item">
<text class="item-title">商品名称</text>
<text class="item-value">{{item.bgGoodName}}</text>
</view></view>
<view class="card-content">
<view class="card-content-item">
<text class="item-title">收货数量</text>
<text class="item-value">{{item.qty}}</text>
</view>
<view class="card-content-item">
<text class="item-title">未验数量</text>
<text class="item-value">{{item.ableQty}}</text>
</view>
</view>
</view> -->
<!-- <view class="all-card">
<view class="sh-card" >
<view class="sh-card-content" v-for="(item2, index2) in dataList" :key="item2.id"
:index="item2.id" @click="goodDetail(item.id, item2.id)">
<view class="pad-content"
:class="{'sh-card-title-border':(index2 + 1) < dataList.length}">
<checkbox v-if="" class="pad-checked" :checked="item2.isChcked" @click="handleData(item2)" />
<view class="goods-card-content">
<view class="goods-card-content-item">
<text class="goods-title">商品名称</text>
<text class="goods-value">{{item2.goodName}}</text>
</view>
</view>
<view class="detail-icon">
<u-icon size="40" name="../../static/icon/bg-right.png"></u-icon>
</view>
<view class="goods-card-content">
<view class="goods-card-content-item">
<text class="goods-title">商品批号</text>
<text class="goods-value">{{item2.goodNo}}</text>
</view>
</view>
<view class="goods-card-content">
<view class="goods-card-content-item">
<text class="goods-title">收货单号</text>
<text class="goods-value">{{item2.orderNo}}</text>
</view>
</view> -->
<!-- <view class="goods-card-content">
<view class="goods-card-content-item">
<text class="goods-title">件装量</text><text class="goods-value">{{item2.bpPackageQty}}</text>
</view>
<view class="goods-card-content-item">
<text class="goods-title">单位</text><text class="goods-value">{{transUnit(item2.bpUnit)}}</text>
</view>
</view> -->
<!-- <view class="goods-card-content">
<view class="goods-card-content-item">
<text class="goods-title">收货数量</text><text class="goods-value">{{item2.actualQty}}</text>
</view>
<view class="goods-card-content-item">
<text class="goods-title">未验收数量</text><text class="goods-value">{{item2.ableQty}}</text>
</view>
</view>
</view>
</view>
</view>
</view> -->
<!-- </view> -->
<!-- <u-empty class="no-list" mode="list" v-else>
</u-empty> -->
<view class="loadmore-data">
<u-loadmore :status="loadStatus"></u-loadmore>
</view>
</view>
</template>
<script>
export default {
data() {
return {
dataForm: {
// containerCode: "",
barCode: "" // 商品条码
},
dataList: [],
refreshIfNeeded: false,
query: {
pageNum: 1,
pageSize: 10
},
loadStatus: 'loadmore',
// barCode: '',
// containerCode: '', // 容器编号
dicOptions: []
}
},
onPullDownRefresh() {
this.query.pageNum = 1
this.getDataList();
},
onLoad() {
this.getDataList();
this.getDic()
},
//上拉刷新(当数据距离底部100时触发,距离在pages.json配置)
onReachBottom() {
this.loadStatus = "loading";
setTimeout(() => {
//当前页 +1
this.query.pageNum += 1;
this.getDataList();
}, 100);
},
onShow() {
var pages = getCurrentPages(); // 获取当前页面栈
var currentPage = pages[pages.length - 1]; // 当前页面
// console.log(this.refreshIfNeeded)
if ( currentPage._data.refreshIfNeeded) {
currentPage._data.refreshIfNeeded = false;
this.query.pageNum = 1
this.getDataList();; // 调用列表重置刷新页面
// this.mescroll.scrollTo(0,0); // 滚动页面置顶
}
},
methods: {
//处理接收
handleData(item){
item.isChcked=!item.isChcked
// console.log(item.isChcked);
if(item.isChcked){
if(this.bgGoodNoList.length==0){
this.detailIds=[]
this.allableQty=0
this.bgGoodNoList.push(item.bgGoodNo)
this.bgSpecificationsList.push(item.bgSpecifications)
this.sid=item.sid
this.detailIds.push(item.id)
this.allableQty+=item.ableQty
this.allactualQty+=item.actualQty
}else{
if(item.bgGoodNo!=this.bgGoodNoList[0] || item.bgSpecifications!=this.bgSpecificationsList[0]){
// item.isChcked=!item.isChcked
this.$u.toast('所选非同品牌或规格')
}else{
this.detailIds.push(item.id)
this.allableQty+=item.ableQty
this.allactualQty+=item.actualQty
}
}
}else{
let len=0
this.dataList.forEach(item1=>{
item1.businInOrderDVos.forEach(item2=>{
if(item2.isChcked==true){
len++
}
})
})
this.detailIds.forEach((item1,index1)=>{
if(item1==item.id){
this.detailIds.splice(index1,1)
this.allableQty-=item.ableQty
this.allactualQty-=item.actualQty
}
})
if(len==0){
this.bgGoodNoList=[]
this.bgSpecificationsList=[]
}
}
},
getDic() {
this.$u.api.getByDicType().then(res => {
this.dicOptions = res.data;
});
},
transUnit(unit) {
for (let dic in this.dicOptions) {
if (this.dicOptions[dic].dictValue === unit) {
return this.dicOptions[dic].dictLabel;
}
}
},
changeCode() {
this.query = {
pageNum: 1,
pageSize: 10
}
this.getDataList()
},
//初始化数据
getDataList() {
uni.stopPullDownRefresh();
this.loadStatus = "loadmore";
this.$u.api.acceptance.pageReceiving({
...this.query,
...this.dataForm
}).then(res => {
console.log(res)
if (res.code === 200) {
// this.dataList = this.dataList.concat(res.rows)
this.dataList = [...res.rows]
}
});
this.$u.toast("数据列表已刷新");
},
goodDetail(sid, did) {
// this.$u.toast("你点击了商品详情");
this.$u.route({
url: 'pages/checkAccept/checkHomework',
type: 'navigateTo',
params: {
sid,
did
}
})
},
searchClick() {
// this.$u.toast("你点击了搜索");
this.$u.route({
url: 'pages/checkAccept/taskView',
type: 'navigateTo'
})
},
}
}
</script>
<style lang="scss">
@import "./index1.scss";
</style>