<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-if="current === 0" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="货位编号">
|
<uni-easyinput type="text" :focus="!bindbarcodefocus" v-model="bindlocationNo" placeholder="请输入货位编号"
|
ref='midInput' @input="bindinputChange" />
|
</uni-forms-item>
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="bindbarcodefocus" v-model="bindbarcode" placeholder="请扫描托盘条码"ref='midInput'/>
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="bindstock" type="primary" size="default" style="margin-top: 2%;">手动绑定</button>
|
</uni-forms-item>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 1" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120" class="customcss">
|
<uni-forms-item label="货位编号">
|
<uni-easyinput type="text" v-model="locationNo" :focus="!barcodefocus" placeholder="请输入货位编号"
|
@input="locationNoinputChange" ref='midInput'/>
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="submit" type="primary" size="default" style="margin-top: 2%;">解除绑定</button>
|
</uni-forms-item>
|
</uni-forms>
|
<uni-list class="footer">
|
<uni-list-item direction="column" v-for="item in stockInfo" :key="item.matCode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<view class="uni-content">
|
<view class="uni-title-sub uni-ellipsis-2">容器编号:{{item.palletCode}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">物料编码:{{item.matCode}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">物料名称:{{item.mater_name}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">数量:{{item.quantity}}</view>
|
<view class="uni-title-sub uni-ellipsis-2">货位编号:{{item.locationCode}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
</uni-list>
|
</view>
|
</view>
|
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
items: ['库存绑定', '库存解绑'],
|
current: 0,
|
|
bindlocationNo: "",
|
bindbarcode: '',
|
bindbarcodefocus: false,
|
|
locationNo: "",
|
barcode: '',
|
barcodefocus: false,
|
stockInfo: []
|
}
|
},
|
onLoad(res) {},
|
methods: {
|
onClickItem(e) {
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
},
|
bindstock() {
|
if (this.bindlocationNo == "") {
|
this.$refs.uToast.show({
|
title: "货位号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
if (this.bindbarcode == "") {
|
this.$refs.uToast.show({
|
title: "托盘号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
var postData = {
|
MainData: {
|
"locationNo": this.bindlocationNo,
|
"barcode": this.bindbarcode
|
},
|
}
|
this.$u.post('/api/StockOperate/BindStock', postData).then((res) => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "success"
|
});
|
this.bindlocationNo = "";
|
this.bindbarcode = "";
|
this.bindbarcodefocus = false;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
});
|
}
|
})
|
},
|
bindinputChange() {
|
this.bindbarcodefocus = false;
|
this.$nextTick(function(x) {
|
if (this.bindlocationNo != '') {
|
this.bindbarcodefocus = true;
|
}
|
})
|
},
|
|
submit() {
|
if (this.locationNo == "") {
|
this.$refs.uToast.show({
|
title: "货位号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
var _this = this;
|
var isDelete = false;
|
uni.showModal({
|
title: "提示",
|
cancelText:'否',
|
confirmText:'是',
|
confirmColor:'blue',
|
content: "是否删除库存?",
|
showCancel: true,
|
success: function(res) {
|
if (res.confirm) {
|
isDelete = true;
|
} else if (res.cancel) {
|
isDelete = false;
|
}
|
_this.releaseStock(isDelete);
|
}
|
});
|
},
|
releaseStock(isDelete) {
|
var postData = {
|
MainData: {
|
"locationNo": this.locationNo,
|
"barcode": this.barcode
|
},
|
Extra: isDelete
|
}
|
this.$u.post('/api/StockOperate/ReleaseStock', postData).then((res) => {
|
if (res.status) {
|
this.stockInfo = [];
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "success"
|
});
|
this.locationNo = "";
|
this.barcode = "";
|
this.barcodefocus = false;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
});
|
}
|
})
|
},
|
locationNoinputChange() {
|
this.$nextTick(function(x) {
|
if (this.locationNo != '') {
|
var postData = {
|
MainData: {
|
"locationCode": this.locationNo
|
},
|
}
|
this.$u.post('/api/VV_StockGroup/GetStockInfoByLocationNo', postData).then((res) => {
|
if (res.status) {
|
this.stockInfo = res.data;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
});
|
}
|
})
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import '@/common/uni-ui.scss';
|
|
.content {
|
display: flex;
|
height: 150px;
|
}
|
|
.content-text {
|
font-size: 14px;
|
color: #666;
|
}
|
|
.itemstyle {
|
margin-top: 20px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|