<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-show="current === 0">
|
<view class="itemstyle">
|
<uni-forms label-width="180">
|
<uni-forms-item label="原托盘码:">
|
<uni-easyinput type="text" placeholder="请输入托盘码" ref='midInput' :focus="!focus" v-model="barcode" />
|
</uni-forms-item>
|
<uni-forms-item label="新托盘码:">
|
<uni-easyinput type="text" placeholder="请扫描托盘码" ref='midInput' :focus="focus" v-model="newBarcode" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="Modify" type="primary" size="default" style="margin-top: 2%;">提交修改</button>
|
</uni-forms-item>
|
</uni-forms>
|
<u-toast ref="uToast" />
|
</view>
|
</view>
|
<view v-show="current === 1">
|
<view class="itemstyle">
|
<uni-forms label-width="180">
|
<uni-forms-item label="托盘码:">
|
<uni-easyinput type="text" placeholder="请输入托盘码" ref='midInput' :focus="!focus1" v-model="palletCode" />
|
</uni-forms-item>
|
<uni-forms-item label="袋数:">
|
<uni-easyinput type="text" placeholder="请输入袋数" ref='midInput' :focus="focus1" v-model="qty" />
|
</uni-forms-item>
|
<uni-forms-item>
|
<button @click="ModifyQty" type="primary" size="default" style="margin-top: 2%;">提交修改</button>
|
</uni-forms-item>
|
</uni-forms>
|
<u-toast ref="uToast1" />
|
</view>
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
focus: false,
|
focus1: false,
|
items: ['改托盘号','改托盘袋数'],
|
current: 0,
|
barcode: "",
|
newBarcode: "",
|
palletCode: "",
|
qty: ""
|
}
|
},
|
onShow() {},
|
onLoad(res) {
|
this.focus = false;
|
},
|
methods: {
|
voiceSpeech(src) {
|
innerAudioContext.src = src; // '../../static/success.mp3';
|
innerAudioContext.play();
|
},
|
onClickItem(e) {
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
if (this.current == 0) {
|
this.focus = false;
|
this.barcode="";
|
this.newBarcode = ""
|
}else{
|
this.focus1 = false;
|
this.qty="";
|
this.palletCode="";
|
}
|
}
|
},
|
Modify() {
|
if (this.barcode == "") {
|
this.$refs.uToast.show({
|
title: "请输入原托盘码",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.newBarcode == "") {
|
this.$refs.uToast.show({
|
title: "请扫描新托盘码",
|
type: 'error'
|
})
|
return;
|
}
|
this.$u.post('/api/PDA/ModifyBarcode?barcode=' + this.barcode + '&newBarcode=' + this.newBarcode).then(
|
res => {
|
if (res.status) {
|
this.$refs.uToast.show({
|
title: "托盘号修改成功",
|
type: "success"
|
})
|
this.newBarcode = "";
|
this.barcode = "";
|
this.focus = false;
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
})
|
},
|
ModifyQty() {
|
if (this.palletCode == "") {
|
this.$refs.uToast1.show({
|
title: "请输入托盘码",
|
type: 'error'
|
})
|
return;
|
}
|
if (this.qty == "") {
|
this.$refs.uToast1.show({
|
title: "请输入袋数",
|
type: 'error'
|
})
|
return;
|
}
|
this.$u.post('/api/PDA/ModifyQty?palletCode=' + this.palletCode + '&qty=' + this.qty).then(
|
res => {
|
if (res.status) {
|
this.$refs.uToast1.show({
|
title: "修改成功",
|
type: "success"
|
})
|
this.palletCode = "";
|
this.qty = "";
|
this.focus = false;
|
} else {
|
this.$refs.uToast1.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: 30px;
|
margin-left: 5%;
|
}
|
|
.headerstyle {
|
width: 90%;
|
}
|
</style>
|