<template>
|
<view>
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem">
|
</uni-segmented-control>
|
<view v-show="current === 0">
|
<uni-list-item direction="column" v-for="item in orderDetail" :key="item.palletCode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<checkbox @click="click(item)" style="margin-right: 20px;"></checkbox>
|
<view class="uni-content">
|
<view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
|
<view style="font-size: 18px;">物料名称:{{item.materielName}}</view>
|
<view style="font-size: 18px;">托盘编码:{{item.palletCode}}</view>
|
<view style="font-size: 18px;">货位编码:{{item.locationCode}}</view>
|
<view style="font-size: 18px;">可用数量:{{item.useableQuantity}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
<button @click="OutBound" type="primary" size="default" style="margin-top: 2%;">出库</button>
|
<u-toast ref="uToasts" />
|
</view>
|
<view v-show="current === 1">
|
<uni-list-item direction="column" v-for="item in orderDetail" :key="item.palletCode">
|
<template v-slot:body>
|
<view class="uni-list-box">
|
<checkbox @click="clicks(item)" style="margin-right: 20px;"></checkbox>
|
<view class="uni-content">
|
<view style="font-size: 18px;">物料编码:{{item.materielCode}}</view>
|
<view style="font-size: 18px;">物料名称:{{item.materielName}}</view>
|
<view style="font-size: 18px;">托盘编码:{{item.palletCode}}</view>
|
<view style="font-size: 18px;">货位编码:{{item.locationCode}}</view>
|
<view style="font-size: 18px;">可用数量:{{item.useableQuantity}}</view>
|
</view>
|
</view>
|
</template>
|
</uni-list-item>
|
<button @click="LockOutboundStock" type="primary" size="default" style="margin-top: 2%;">锁定</button>
|
<u-toast ref="uToast" />
|
</view>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
const innerAudioContext = uni.createInnerAudioContext();
|
export default {
|
data() {
|
return {
|
items: ['指定出库', "锁定库存"],
|
current: 0,
|
materielCode: "",
|
label: "",
|
orderDetail: [],
|
focus: false,
|
key: [],
|
keys: [],
|
id:"",
|
}
|
},
|
onShow() {},
|
onLoad(res) {
|
this.focus = false;
|
this.addressFocus = false;
|
this.materielCode = res.materielCode;
|
this.id = res.id;
|
this.getData();
|
},
|
methods: {
|
voiceSpeech(src) {
|
innerAudioContext.src = src;
|
innerAudioContext.play();
|
},
|
getData() {
|
var postData = this.materielCode;
|
this.$u.post('/api/StockInfo/GetStockSelectViews', postData).then((res) => {
|
this.orderDetail = res;
|
|
})
|
},
|
OutBound() {
|
var postData = this.key;
|
this.$u.post('/api/Task/GenerateOutboundTask?id='+this.id, postData).then(res => {
|
if (res.status) {
|
this.items = [];
|
this.$refs.uToasts.show({
|
title: res.message,
|
type: "error"
|
})
|
} else {
|
this.$refs.uToasts.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
LockOutboundStock() {
|
var postData = this.keys;
|
this.$u.post('/api/OutboundOrderDetail/LockOutboundStock?id='+this.id, postData).then(res => {
|
if (res.status) {
|
this.items = [];
|
uni.$showMsg(res.message);
|
setTimeout(() => {
|
this.addressFocus = false;
|
}, 200);
|
} else {
|
this.$refs.uToast.show({
|
title: res.message,
|
type: "error"
|
})
|
}
|
}).catch(err => {
|
this.$refs.uToast.show({
|
title: err.message,
|
type: "error"
|
})
|
})
|
},
|
click(e) {
|
if (this.key.find(x => x.palletCode == e.palletCode)) {
|
this.key.map((item, index) => {
|
if (item.palletCode == e.palletCode) {
|
this.key.splice(index, 1);
|
}
|
})
|
} else {
|
this.key.push(e);
|
}
|
},
|
clicks(e) {
|
if (this.keys.find(x => x.palletCode == e.palletCode)) {
|
this.keys.map((item, index) => {
|
if (item.palletCode == e.palletCode) {
|
this.keys.splice(index, 1);
|
}
|
})
|
} else {
|
this.keys.push(e);
|
}
|
},
|
onClickItem(e) {
|
this.focus = false;
|
this.addressFocus = false;
|
if (this.current !== e.currentIndex) {
|
this.current = e.currentIndex;
|
if (this.current == 2) {
|
this.getData();
|
}
|
}
|
},
|
}
|
}
|
</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>
|