<template>
|
<view>
|
<form>
|
<view class="cu-form-group margin-top">
|
<view class="title">出库单号:</view>
|
<input v-model="billNo" placeholder="扫码 / 输入" name="input" @input="searchBillNo">
|
</view>
|
<view class="cu-form-group margin-top">
|
|
<view class="title" >出库口:</view>
|
<view class="combox" >
|
<uni-combox :candidates="sites" placeholder="请选择出库站点" v-model="siteId" @click="staNoSelect()"></uni-combox>
|
</view>
|
</view>
|
</form>
|
|
<view style="margin-top: 10px;">
|
<uni-table ref="table" border stripe emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th align="center" width="50">出库数量</uni-th>
|
<uni-th align="center" width="70">产品ID</uni-th>
|
<uni-th align="center" width="80">产品代号</uni-th>
|
<uni-th align="center" width="70">产品名称</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in matData" :key="index">
|
<uni-td align="center">{{item.qty}}</uni-td>
|
<uni-td align="center">{{item.matNo}}</uni-td>
|
<uni-td align="center">{{item.size}}</uni-td>
|
<uni-td align="center">{{item.matName}}</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<view class="cu-bar foot input" style="height: 130rpx;">
|
<view class="flex solid-bottom padding justify-start">
|
<button class="cu-btn bg-yellow main-btn margin-xs" style="width: 430rpx;" @click="outbound()">启动出库</button>
|
<button class="cu-btn bg-grey main-btn margin-xs" @click="reset">重 置</button>
|
</view>
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
billNo: null,
|
matData: [],
|
sites: [],
|
siteId: ''
|
}
|
},
|
mounted(){
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT;
|
this.staNoSelect();
|
},
|
methods: {
|
searchBillNo() {
|
let that = this;
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/waitMatout/list/auth",
|
header: {'token':uni.getStorageSync('token')},
|
data: {
|
curr:1,
|
limit:10,
|
typeCode:1,
|
bill_no:that.billNo
|
},
|
success(result) {
|
let res = result.data
|
if (res.code === 200 ) {
|
that.matData = res.data.records
|
that.staNoSelect()
|
} else if (res.code == 403) {
|
uni.showToast({title: res.msg, icon: "none", position: 'top'})
|
setTimeout(() => {
|
uni.reLaunch({
|
url: '../login/login'
|
});
|
}, 1000);
|
} else {
|
uni.showToast({title: res.msg, icon: "none",position: 'top'})
|
}
|
},
|
})
|
},
|
staNoSelect() {
|
let that = this;
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/available/take/site",
|
header: {'token':uni.getStorageSync('token')},
|
success(result) {
|
let res = result.data
|
if (res.code === 200 ) {
|
that.sites = [];
|
for (var i = 0; i < res.data.length; i++) {
|
that.sites.push(res.data[i].desc)
|
}
|
} else if (res.code == 403) {
|
uni.showToast({title: res.msg, icon: "none", position: 'top'})
|
setTimeout(() => {
|
uni.reLaunch({
|
url: '../login/login'
|
});
|
}, 1000);
|
} else {
|
uni.showToast({title: res.msg, icon: "none",position: 'top'})
|
}
|
}
|
})
|
},
|
outbound() {
|
let that = this
|
if (that.matData.length === 0) {
|
uni.showToast({title: "请先添加产品", icon: "none",position: 'top'})
|
} else {
|
if (that.siteId == '') {
|
uni.showToast({title: "请选择出库口", icon: "none",position: 'top'})
|
return;
|
}
|
};
|
var staNo = that.siteId.substring(0,3)
|
|
var locDetls = [];
|
that.matData.forEach(function(elem) {
|
locDetls.push({billNo:elem.billNo,seqNo:elem.seqNo, matNo: elem.matNo, count: elem.qty,});
|
});
|
let param = {
|
outSite: 173,
|
locDetls: locDetls
|
}
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/mat/out/start",
|
header: {
|
'token':uni.getStorageSync('token')},
|
data: JSON.stringify(param),
|
method:"POST",
|
success(result) {
|
if (result.data.code === 200) {
|
uni.showToast({title: result.data.msg, icon: "none",position: 'top'})
|
that.reset()
|
} else {
|
uni.showToast({title: result.data.msg, icon: "none",position: 'top'})
|
}
|
}
|
})
|
},
|
reset() {
|
this.billNo = '';
|
this.matData = [];
|
this.siteId = '';
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.pda-btn1 {
|
margin-left:260rpx;
|
margin-right: auto;
|
margin-top: 150rpx;
|
width: 200rpx;
|
height: 80rpx;
|
font-size: 30upx;
|
font-weight: bold;
|
}
|
.combox {
|
width: 200px;
|
padding: 12px;
|
}
|
</style>
|