<template>
|
<view>
|
<!-- 搜索框 -->
|
<view class="search-box">
|
<view class="search-area">
|
<view class="search-icon"><uni-icons type="search" size="25" color="#a5a5a5"></uni-icons></view>
|
<input type="text" v-model="zpallet" placeholder=" 托盘条码"/>
|
<view class="close-icon" v-show="zpallet" @click="remove('zpallet')"><uni-icons type="closeempty" size="25" color="#a5a5a5"></uni-icons></view>
|
</view>
|
<view class="search-btn"><button @click="getList(zpallet)" class="cu-btn bg-blue">搜索</button></view>
|
</view>
|
|
<!-- list列表 -->
|
<checkbox-group >
|
<view v-for="(item,index) in listData" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
|
<view class="data-list-left">{{index + 1 }}</view>
|
<view class="data-list-right">
|
<view>托盘条码:<text class="context zpallet">{{item.zpallet}}</text></view>
|
<view>托盘名称:<text class="context">{{item.maktx}}</text></view>
|
<view>商品编码:<text class="context">{{item.matnr}}-{{item.batch}}</text></view>
|
<view>仓库号:<text class="context">{{item.origin}}</text></view>
|
</view>
|
</view>
|
</checkbox-group>
|
|
|
|
<!-- 底部按钮 -->
|
<view class="footer flex justify-around">
|
<view>
|
<button class="cu-btn lg" @click="resst()">重置</button>
|
</view>
|
<view>
|
<button class="cu-btn lg pakin-btn bg-red" @click="deleteData()">删除</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
commonUrl:null,
|
zpallet:'',
|
listData: [],
|
reload: false,
|
status: 'more',
|
contentText: {
|
contentdown: '上拉加载更多',
|
contentrefresh: '加载中',
|
contentnomore: '没有更多'
|
}
|
};
|
},
|
onLoad() {
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT
|
const PROJ = uni.getStorageSync('UPROJ');
|
this.baseUrl = PROJ
|
this.getUrl()
|
},
|
onPullDownRefresh() {
|
// this.reload = true;
|
// this.getList()
|
},
|
methods: {
|
// 获取url
|
getUrl() {
|
this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
|
},
|
remove(e) {
|
this[e] = ''
|
},
|
getList(barcode) {
|
let that = this
|
if (barcode == '') {
|
that.listData = []
|
uni.showToast({title: '请输入托盘码', icon: "none",position: 'center'})
|
return
|
}
|
uni.request({
|
url: that.commonUrl + '/waitPakin/list/auth',
|
data:{
|
curr:1,
|
limit:16,
|
zpallet:barcode
|
},
|
header: {'token':uni.getStorageSync('token')},
|
method:'GET',
|
success: result =>{
|
let res = result.data
|
if (res.code === 200) {
|
if (res.data.records.length>0) {
|
that.listData = res.data.records
|
} else {
|
that.listData = []
|
uni.showToast({title: '托盘码:' + barcode + ' 无数据!', icon: "none",position: 'center'})
|
}
|
} else if(res.code === 403) {
|
uni.showToast({title: res.msg, icon: "none", position: 'center'})
|
that.returnIndex();
|
} else {
|
uni.showToast({title: res.msg, icon: "none",position: 'center'})
|
}
|
}
|
})
|
},
|
// 重置
|
resst() {
|
this.listData = []
|
this.zpallet = ''
|
// 80049089
|
},
|
// 删除
|
deleteData() {
|
let that = this
|
console.log((JSON.stringify(that.listData)));
|
uni.request({
|
url: that.commonUrl + "/waitPakin/delete/auth",
|
data: {param:JSON.stringify(that.listData)},
|
header: {
|
'token':uni.getStorageSync('token'),
|
'content-type' : 'application/x-www-form-urlencoded'
|
},
|
method:'POST',
|
success(result) {
|
let res = result.data
|
if (res.code === 200) {
|
uni.showToast({title: res.msg, icon: "none",position: 'center'})
|
that.resst();
|
} else if(res.code === 403) {
|
uni.showToast({title: res.msg, icon: "none", position: 'center'})
|
that.returnIndex();
|
} else {
|
uni.showToast({title: res.msg, icon: "none",position: 'center'})
|
}
|
}
|
})
|
},
|
// 403跳转登录页
|
returnIndex() {
|
setTimeout(() => {
|
uni.reLaunch({
|
url: '../login/login'
|
});
|
}, 1000);
|
},
|
}
|
|
}
|
</script>
|
|
<style>
|
.search-box {
|
position: fixed;
|
left: 0;
|
top: 0;
|
width: 100%;
|
height: 100rpx;
|
background-color: #FFF;
|
border-bottom: 1px solid #d8d8d8;
|
border-radius: 0 0 20rpx 20rpx;
|
z-index: 1;
|
}
|
/*#ifdef H5 */
|
.search-box {
|
position: fixed;
|
left: 0;
|
top: 89rpx;
|
width: 100%;
|
height: 100rpx;
|
background-color: #ffffff;
|
border-bottom: 1px solid #d8d8d8;
|
border-radius: 0 0 20rpx 20rpx;
|
z-index: 1;
|
}
|
/* #endif */
|
.search-area {
|
display: inline-block;
|
background-color: #F1F1F1;
|
width: 75%;
|
height: 70%;
|
margin: 15rpx;
|
border-radius: 15rpx;
|
}
|
.search-area input {
|
display: inline-block;
|
height: 70rpx;
|
width: 70%;
|
line-height: 70rpx;
|
font-size: 25rpx;
|
font-weight: 400;
|
}
|
.search-btn {
|
display: inline-block;
|
float: right;
|
margin-right: 30rpx;
|
margin-top: 15rpx;
|
}
|
.search-icon {
|
display: inline-block;
|
float: left;
|
width: 70rpx;
|
height: 70rpx;
|
text-align: center;
|
line-height: 70rpx;
|
|
}
|
.close-icon {
|
display: inline-block;
|
float: right;
|
width: 70rpx;
|
height: 70rpx;
|
text-align: center;
|
line-height: 70rpx;
|
}
|
|
|
|
|
.bg-false {
|
background-color: #FFFFFF;
|
}
|
.bg-true {
|
background-color: #ebebeb;
|
}
|
|
.data-list {
|
border-bottom: 1px solid #d8d8d8;
|
height: 180rpx;
|
margin: 15rpx;
|
border-radius: 20rpx;
|
}
|
.data-list:first-child {
|
margin-top: 120rpx;
|
}
|
.data-list:last-child {
|
margin-bottom: 160rpx;
|
}
|
.data-list-left {
|
display: inline-block;
|
float: left;
|
width: 10%;
|
height: 180rpx;
|
text-align: center;
|
line-height: 180rpx;
|
font-size: 40rpx;
|
color: #666;
|
}
|
|
.data-list-right {
|
display: inline-block;
|
float: left;
|
width: 90%;
|
height: 180rpx;
|
font-size: 32rpx;
|
color: #666;
|
}
|
.context {
|
color: #999;
|
font-size: 30rpx;
|
}
|
.zpallet {
|
color: #666;
|
font-size: 36rpx;
|
}
|
</style>
|