<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view class="content">
|
<view v-if="current === 0" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="托盘条码">
|
<uni-easyinput type="text" :focus="barcodeFocus" v-model="barcode" placeholder="请扫描托盘条码"
|
ref='midInput' @input="inputChangebarcode()" />
|
</uni-forms-item>
|
<uni-forms-item label="地址条码">
|
<uni-easyinput type="text" v-model="address" placeholder="请扫描地址条码" ref='midInput'
|
:focus="addressFocus" />
|
</uni-forms-item>
|
<button @click="inbound" type="primary" size="default" style="margin-top: 2%;">申请入库</button>
|
</uni-forms>
|
</view>
|
</view>
|
<view v-if="current === 1" class="headerstyle">
|
<view class="itemstyle">
|
<uni-forms label-width="120">
|
<uni-forms-item label="出库区域">
|
<uni-data-select v-model="outArea" :localdata="outAreas"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item label="所在楼层">
|
<uni-data-select v-model="floor" :localdata="floorrange"></uni-data-select>
|
</uni-forms-item>
|
<uni-forms-item label="出库数量">
|
<uni-easyinput type="text" v-model="num" placeholder="请输入出库数量" ref='midInput'
|
:focus="numFocus" />
|
</uni-forms-item>
|
<button @click="outbound" type="primary" size="default" style="margin-top: 2%;">出库</button>
|
</uni-forms>
|
</view>
|
</view>
|
|
</view>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
import {
|
config
|
} from '../../common/config';
|
export default {
|
data() {
|
return {
|
items: ['空箱入库', '空箱出库'],
|
current: 0,
|
barcodeFocus: true, //空箱入库托盘号光标
|
addressFocus: false, //空箱入库地址光标
|
barcode: '', //空箱托盘号
|
address: "", //空箱入库地址
|
floorFocus: true, //空箱出库楼层光标
|
numFocus: false, //空箱出库数量光标
|
floor: '', //楼层
|
num: "", //空箱出库数量
|
floor: "",
|
floorrange: [],
|
outArea:"",
|
outAreas:[
|
{
|
value: "1",
|
text: "入库区"
|
},{
|
value: "2",
|
text: "出库区"
|
},{
|
value: "6",
|
text: "入库输送线"
|
}
|
]
|
}
|
},
|
mounted() {
|
this.floorrange = config.outboundFloorRange;
|
if (config.outboundFloor) {
|
this.floor = config.outboundFloor;
|
}
|
},
|
onLoad(res) {
|
this.barcodeFocus = true;
|
this.addressFocus = false;
|
this.floorFocus = true;
|
this.numFocus = false;
|
},
|
methods: {
|
onClickItem(e) {
|
this.addressFocus = false;
|
this.floorFocus = true;
|
this.numFocus = false;
|
this.barcodeFocus = true;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
}
|
|
},
|
inbound() {
|
if (this.barcode == '') {
|
this.$refs.uToast.show({
|
title: "托盘号不能为空",
|
type: "error"
|
});
|
return;
|
}
|
if (this.startPoint == '') {
|
this.$refs.uToast.show({
|
title: "地址不能为空",
|
type: "error"
|
});
|
return;
|
}
|
var postData = {
|
MainData: {
|
"barcode": this.barcode,
|
"startPoint": this.address
|
}
|
}
|
this.$u.post('/api/Inbound/EmptyBoxInbound', postData).then(res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
});
|
this.barcode = "";
|
this.address = "";
|
this.barcodeFocus = true;
|
this.addressFocus = false;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
inputChangebarcode() {
|
this.barcodeFocus = false;
|
this.$nextTick(function(x) {
|
if (this.barcode != '') {
|
this.addressFocus = true;
|
}
|
})
|
},
|
outbound() {
|
if (this.floor == '') {
|
this.$refs.uToast.show({
|
title: "楼层不能为空",
|
type: "error"
|
});
|
return;
|
}
|
if (this.num == '') {
|
this.$refs.uToast.show({
|
title: "数量不能为空",
|
type: "error"
|
});
|
return;
|
}
|
var postData = {
|
MainData: {
|
"floor": this.floor,
|
"num": this.num,
|
"area": this.outArea
|
}
|
}
|
this.$u.post('/api/Outbound/EmptyBoxOutbound', postData).then(res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "成功",
|
type: "success"
|
});
|
this.barcode = "";
|
this.address = "";
|
this.barcodeFocus = true;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.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>
|