<template>
|
<view>
|
<view class="square-2">
|
<view class="square-title">
|
<view class="title-sign"><view class="sign"></view></view>
|
<view class="title-text"><text>提取商品</text></view>
|
</view>
|
<view class="square-content">
|
<view class="content-input-btn">
|
<input v-model="matnr" type="text" placeholder="扫码 / 输入" @input="findMat()"
|
:focus="focus" placeholder-style="line-height: 85rpx;">
|
<uni-icons type="closeempty" size="20" color="#dadada" @click="remove('matnr')"></uni-icons>
|
</view>
|
<view class="content-btn">
|
<button class="cu-btn bg-blue pda-btn" @click="selectMat()">+提取</button>
|
</view>
|
</view>
|
</view>
|
<!-- <view class="square-2">
|
<view class="square-title">
|
<view class="title-sign"><view class="sign"></view></view>
|
<view class="title-text"><text>库位号码</text></view>
|
</view>
|
<view class="square-content">
|
<view class="content-input">
|
<input type="text" v-model="locNo" placeholder="扫码 / 输入" @input="searchLocNo" placeholder-style="line-height: 85rpx;">
|
<uni-icons type="closeempty" size="20" color="#dadada" @click="removeLocNo"></uni-icons>
|
</view>
|
</view>
|
</view> -->
|
<view class="square-2">
|
<view class="square-title">
|
<view class="title-sign"><view class="sign"></view></view>
|
<view class="title-text"><text>入库口</text></view>
|
|
</view>
|
<view class="content-combox">
|
<uni-combox emptyTips="暂无数据"
|
:candidates="sites" v-model="siteId" @click="staNoSelect()" placeholder="请选择出库站点">
|
</uni-combox>
|
</view>
|
</view>
|
|
<view class="square-1">
|
<view class="square-title">
|
<view class="title-sign"><view class="sign"></view></view>
|
<view class="title-text"><text>商品列表</text></view>
|
</view>
|
|
</view>
|
|
<view class="square-none" v-show="matList.length === 0">
|
<view class="v-show">Нет дополнительных данных...</view>
|
</view>
|
|
<view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" >
|
<view class="data-list-left">
|
<!-- <view>
|
<checkbox :value="item.id+''" :checked="item.checked" style="display: block;" />
|
</view> -->
|
<view class="matnr"><text style="width: 400rpx;">编码:{{item.matnr}}</text></view>
|
<view><text style="width: 400rpx;">品名:{{item.maktx}}</text></view>
|
<view><text style="width: 400rpx;">批号:{{item.batch}}</text></view>
|
<view>
|
<text style="width: 400rpx;">数量:{{item.anfme}}</text>
|
</view>
|
</view>
|
<view class="data-list-right">
|
<label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label>
|
<label><uni-icons type="trash" size="25" color="#a5a5a5" @click="removeMat(item,index)"></uni-icons></label>
|
</view>
|
</view>
|
<!-- 底部按钮 -->
|
<view class="footer flex justify-around">
|
<label class="label-btn" style="width: 150rpx;">
|
<button class="cu-btn" @click="resst()">Сброс</button>
|
</label>
|
<label class="label-btn">
|
<button class="cu-btn bg-blue " @click="comb()">启动入库</button>
|
</label>
|
</view>
|
<!-- 弹窗 -->
|
<!-- 修改数量 -->
|
<uni-popup ref="revise" background-color="#fff">
|
<view class="revise-box">
|
<view class="revise-box-top">
|
<view class="color-block-blue"></view>
|
<text class="title">修改数量</text>
|
</view>
|
<view class="changeBox">
|
<view class="num-box">
|
<uni-number-box :value="count" :max="9999" color="#747474" @change="changeValue"/>
|
</view>
|
</view>
|
<view class="revise-box-buttom">
|
<view>
|
<button class="cu-btn bg-blue" @click="confirm()">确认</button>
|
</view>
|
</view>
|
</view>
|
</uni-popup>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
commonUrl:null,
|
matnr:'',
|
focus: true,
|
matList: [],
|
sites: [],
|
siteId: '',
|
count:0
|
}
|
},
|
mounted(){
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT
|
const PROJ = uni.getStorageSync('UPROJ');
|
this.baseUrl = PROJ
|
this.getUrl()
|
this.getInBound();
|
},
|
methods: {
|
// 获取url
|
getUrl() {
|
this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl
|
},
|
// 清空input
|
remove(e) {
|
this[e] = ''
|
},
|
// 移除物料
|
removeMat(item,index) {
|
this.matList.splice(index,1)
|
},
|
// 搜索物料
|
findMat() {
|
let that = this
|
uni.request({
|
url: that.commonUrl + '/mat/auth',
|
data: {
|
matnr:that.matnr
|
},
|
header: {
|
'token':uni.getStorageSync('token')
|
},
|
success(result) {
|
uni.vibrateShort();
|
let res = result.data
|
if (res.code === 200 && res.data) {
|
that.matData = res.data
|
that.matnr = ''
|
uni.navigateTo({
|
url: "matQuery",
|
events: {
|
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
|
matList: function(data) {
|
that.checkMat(data.data)
|
// that.matList.push(data.data)
|
},
|
},
|
success: function(res) {
|
// 通过eventChannel向被打开页面传送数据
|
res.eventChannel.emit('matData', { data: that.matData })
|
},
|
});
|
} 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'})
|
}
|
|
}
|
});
|
},
|
// 添加商品
|
addMat(mat) {
|
this.matList.unshift(mat)
|
},
|
checkMat(mat) {
|
var len = this.matList.length
|
var add = true
|
for (var i = 0; i < len; i++) {
|
if (mat.matnr == this.matList[i].matnr) {
|
this.matList[i].anfme += mat.anfme
|
this.$forceUpdate() // 强制刷新
|
add = false
|
}
|
}
|
if (add) {
|
this.matList.unshift(mat)
|
}
|
},
|
// 提取商品
|
selectMat() {
|
let that = this
|
uni.navigateTo({
|
url: "matSelect",
|
success: function(res) {
|
// 通过eventChannel向被打开页面传送数据 向另外一个页面传递值的
|
res.eventChannel.emit('commonUrl', {commonUrl:that.commonUrl })
|
},
|
events: {
|
// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据 另外一个页面传过来的
|
acceptDataFromOpenedPage: function(data) {
|
that.matnr = data.data
|
that.findMat(that.matnr)
|
},
|
},
|
});
|
},
|
// 获取可用入库站点
|
getInBound() {
|
let that = this;
|
uni.request({
|
url: that.commonUrl + "/available/put/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])
|
}
|
} 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'})
|
}
|
}
|
})
|
},
|
// 启动入库
|
comb() {
|
let that = this
|
if (that.matList.length === 0) {
|
uni.showToast({title: "请先提取商品", icon: "none",position: 'top'})
|
return;
|
}
|
if (that.siteId == '') {
|
uni.showToast({title: "请选择出库口", icon: "none",position: 'top'})
|
return;
|
}
|
var list = [];
|
let param = {
|
devpNo: that.siteId,
|
list: that.matList
|
}
|
uni.request({
|
url: that.commonUrl + "/full/store/put/start",
|
header: {
|
'token':uni.getStorageSync('token')},
|
data: JSON.stringify(param),
|
method:"POST",
|
success(result) {
|
var res = result.data
|
if (result.data.code === 200) {
|
uni.showToast({title: "入库启动成功,目标库位:" + res.data, icon: "none",position: 'top'})
|
that.resst()
|
} else {
|
uni.showToast({title: result.data.msg, icon: "none",position: 'top'})
|
}
|
}
|
})
|
},
|
resst() {
|
this.matnr = '';
|
this.siteId = '';
|
this.matList = [];
|
},
|
// 修改数量
|
revise(item,index) {
|
this.count = this.matList[index].anfme
|
this.rowNum = index
|
this.eject()
|
},
|
eject(type) {
|
this.type = type
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
|
this.$refs.revise.open(type)
|
},
|
changeValue(value) {
|
this.count = value
|
},
|
confirm() {
|
this.matList[this.rowNum].anfme = this.count
|
this.$refs.revise.close()
|
this.$forceUpdate() // 强制刷新
|
},
|
}
|
}
|
</script>
|
|
<style>
|
.color-block-blue {
|
background-color: #1E9FFF;
|
display: inline-block;
|
float: left;
|
margin: 15rpx 15rpx 0 15rpx;
|
width: 12rpx;
|
height: 40rpx;
|
border: 5rpx solid #1E9FFF;
|
border-radius: 20rpx;
|
}
|
.title {
|
display: inline-block;
|
float: left;
|
font-size: 34rpx;
|
font-weight: 700;
|
height: 50rpx;
|
line-height: 50rpx;
|
margin-top: 10rpx;
|
}
|
.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;
|
}
|
.bg-false {
|
background-color: #FFFFFF;
|
}
|
.bg-true {
|
background-color: #ebebeb;
|
}
|
.data-list {
|
border-bottom: 1px solid #d8d8d8;
|
height: 180rpx;
|
margin: 15rpx;
|
border-radius: 20rpx;
|
}
|
.data-list:first-child {
|
margin-top: 20rpx;
|
}
|
.data-list:last-child {
|
margin-bottom: 120rpx;
|
}
|
/* .data-list-left {
|
display: inline-block;
|
float: left;
|
text-align: center;
|
width: 100rpx;
|
height: 180rpx;
|
line-height: 180rpx;
|
} */
|
.data-list-left {
|
display: inline-block;
|
float: left;
|
margin-left: 6%;
|
height: 180rpx;
|
color: #676767;
|
}
|
.matnr {
|
padding-top: 10rpx;
|
}
|
.data-list-right {
|
display: inline-block;
|
float: right;
|
height: 180rpx;
|
line-height: 180rpx;
|
}
|
/* display: inline-block;
|
float: right;
|
width: 200rpx;
|
height: 180rpx;
|
line-height: 180rpx; */
|
.data-list-right label {
|
display: inline-block;
|
float: left;
|
width: 80rpx;
|
height: 180rpx;
|
}
|
.revise-box {
|
width: 400rpx;
|
height: 300rpx;
|
border-radius: 25px;
|
}
|
.revise-box-top {
|
width: 400rpx;
|
height: 120rpx;
|
border-radius: 25px;
|
}
|
.changeBox {
|
width: 400rpx;
|
height: 100rpx;
|
}
|
.num-box {
|
margin-left: 100rpx;
|
}
|
.revise-box-buttom{
|
margin-left: 130rpx;
|
}
|
</style>
|