515 lines
12 KiB
Vue
515 lines
12 KiB
Vue
<template>
|
||
<view>
|
||
<view
|
||
class="single-fetch"
|
||
v-for="(fetch, index) in fetchList"
|
||
:key="index"
|
||
@click="openPopup(fetch)"
|
||
>
|
||
<view>
|
||
<span>类型名称</span>
|
||
<h4>{{ fetch.typeName }}</h4>
|
||
</view>
|
||
<view>
|
||
<span>规格型号</span>
|
||
<h4>{{ fetch.typeModelName }}</h4>
|
||
</view>
|
||
<view>
|
||
<span>待出库数量</span>
|
||
<h4>{{ fetch.outNum }}</h4>
|
||
</view>
|
||
<!-- <view style="
|
||
width: 25%;
|
||
border-radius: 15rpx;
|
||
background-color: #3788FF;
|
||
color: #fff;
|
||
font-size: 14px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
box-sizing: border-box;
|
||
padding: 15rpx 25rpx;
|
||
"
|
||
@click.stop="finishOut(fetch)"
|
||
>
|
||
完成出库
|
||
</view> -->
|
||
</view>
|
||
<uni-popup
|
||
ref="popup1"
|
||
type="center"
|
||
:mask-click="false"
|
||
>
|
||
<view class="popup1">
|
||
<view class="pop-top">
|
||
<h4>领料出库</h4>
|
||
<uni-icons
|
||
style="color: #AAAAAA; font-weight: bold;"
|
||
type="closeempty"
|
||
size="20"
|
||
@click="closePopup1"
|
||
>
|
||
</uni-icons>
|
||
</view>
|
||
<h5 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">请选择出库方式</h5>
|
||
<view class="select-area">
|
||
<view @click="scanCode">二维码</view>
|
||
<view @click="codeOut">编码出库</view>
|
||
<view @click="rfidOut">RFID出库</view>
|
||
</view>
|
||
<!-- <view class="ipt-area">
|
||
<uni-easyinput v-model="codeVal" placeholder="请输入编码"></uni-easyinput>
|
||
</view> -->
|
||
</view>
|
||
</uni-popup>
|
||
<uni-popup
|
||
ref="popup2"
|
||
type="center"
|
||
:mask-click="false"
|
||
>
|
||
<view class="popup2">
|
||
<view class="pop-top">
|
||
<h4>数量出库</h4>
|
||
<uni-icons
|
||
style="color: #AAAAAA; font-weight: bold;"
|
||
type="closeempty"
|
||
size="20"
|
||
@click="closePopup2"
|
||
>
|
||
</uni-icons>
|
||
</view>
|
||
<view class="info-area">
|
||
<view>
|
||
<h4>类型名称</h4>
|
||
<span>{{ infoList.typeName }}</span>
|
||
</view>
|
||
<view>
|
||
<h4>设备名称</h4>
|
||
<span>{{ infoList.typeModelName }}</span>
|
||
</view>
|
||
<view>
|
||
<h4>待出库数量</h4>
|
||
<span>{{ infoList.outNum }}</span>
|
||
</view>
|
||
<view>
|
||
<h4>车牌号</h4>
|
||
<!-- <uni-number-box v-model="multiNum" @change="multiNumChange" :min="0" :max="infoList.outNum"/> -->
|
||
<uni-easyinput
|
||
placeholder="请输入车牌号"
|
||
v-model="carCode"
|
||
>
|
||
</uni-easyinput>
|
||
</view>
|
||
<view>
|
||
<h4>出库数量</h4>
|
||
<!-- <uni-number-box v-model="multiNum" @change="multiNumChange" :min="0" :max="infoList.outNum"/> -->
|
||
<uni-easyinput
|
||
placeholder="请输入出库数量"
|
||
v-model="multiNum"
|
||
type="number"
|
||
>
|
||
</uni-easyinput>
|
||
</view>
|
||
</view>
|
||
<view
|
||
class="sub-btn"
|
||
style="margin-bottom: 15rpx;"
|
||
@click="multiOut"
|
||
>
|
||
数量出库
|
||
</view>
|
||
<view
|
||
class="sub-btn"
|
||
@click="finishOut"
|
||
>
|
||
完成出库
|
||
</view>
|
||
</view>
|
||
</uni-popup>
|
||
<u-loading-page :loading="showLoading" color="#000" loading-text="提交中,请稍后..."></u-loading-page>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
showLoading: false,
|
||
fetchList: [
|
||
|
||
],
|
||
codeVal: '',
|
||
manageType: '',
|
||
infoList: '',
|
||
multiNum: 1,
|
||
carCode: '',
|
||
subList: {},
|
||
taskId:null,
|
||
taskStatus: '',
|
||
id: '',
|
||
rfidNum: '',
|
||
typeId: '',
|
||
transMaCode: ''
|
||
}
|
||
},
|
||
methods: {
|
||
openPopup (list) {
|
||
// if(list.outNum && list.o){
|
||
|
||
// }
|
||
|
||
this.infoList = list
|
||
this.rfidNum = list.outNum
|
||
this.typeId = list.typeId
|
||
// this.transMaCode = list.maCode
|
||
console.log(this.infoList.manageType, this.infoList);
|
||
if (this.taskStatus == 33 || this.taskStatus == 34) {
|
||
if (this.infoList.manageType == 0) {
|
||
if (this.infoList.outNum == 0) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '无法再出库!'
|
||
})
|
||
} else {
|
||
this.$refs.popup1.open()
|
||
}
|
||
} else {
|
||
if (this.infoList.status == 2) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '此机具已完成出库,无法再操作!'
|
||
})
|
||
} else {
|
||
if (this.infoList.outNum == 0) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '无法再出库!'
|
||
})
|
||
} else {
|
||
this.$refs.popup2.open()
|
||
}
|
||
}
|
||
}
|
||
} else {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '此机具已完成出库,无法再操作!'
|
||
})
|
||
}
|
||
},
|
||
closePopup1 () {
|
||
this.$refs.popup1.close()
|
||
},
|
||
closePopup2 () {
|
||
this.$refs.popup2.close()
|
||
},
|
||
scanCode () {
|
||
console.log(this.infoList);
|
||
this.closePopup1()
|
||
uni.scanCode({
|
||
success: (res) => {
|
||
console.log(res);
|
||
const fixedCode = res.result.split('=')[1]
|
||
console.log(fixedCode);
|
||
if (!fixedCode) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '未识别到设备!'
|
||
})
|
||
} else {
|
||
uni.navigateTo({
|
||
url: `/pages/scanOutStore/scanOutStore?code=${fixedCode}&typeId=${this.infoList.typeId}&num=${this.infoList.preCountNum}&parentId=${this.infoList.parentId}`
|
||
})
|
||
}
|
||
}
|
||
})
|
||
/* uni.navigateTo({
|
||
url: `/pages/QROut/QROut?typeId=${this.infoList.typeId}&num=${this.infoList.preCountNum}&parentId=${this.infoList.parentId}`
|
||
}) */
|
||
},
|
||
codeOut () {
|
||
this.closePopup1()
|
||
console.log(this.infoList);
|
||
uni.navigateTo({
|
||
url: `/pages/codeOutStore/codeOutStore?typeId=${this.infoList.typeId}&num=${this.infoList.preCountNum}&parentId=${this.infoList.parentId}&manageType=${this.infoList.manageType}&taskId=${this.infoList.taskId}`
|
||
})
|
||
},
|
||
rfidOut () {
|
||
this.closePopup1()
|
||
uni.navigateTo({
|
||
url: `/pages/rfidOutStore/rfidOutStore?waitOut=${this.rfidNum}&typeId=${this.typeId}&parentId=${this.infoList.parentId}`
|
||
})
|
||
},
|
||
multiOut () {
|
||
let that = this
|
||
let posiIntReg = /^\+?[1-9]\d*$/
|
||
if (!posiIntReg.test(that.multiNum)) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '出库数量输入有误!'
|
||
})
|
||
} else if (that.multiNum > that.infoList.outNum) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '出库数量不可大于待出库数量!'
|
||
})
|
||
} else {
|
||
that.showLoading = true
|
||
that.subList = {
|
||
id: that.infoList.id,
|
||
maId: that.infoList.maId,
|
||
manageType: that.infoList.manageType,
|
||
parentId: that.infoList.parentId,
|
||
typeId: that.infoList.typeId,
|
||
taskId: that.infoList.taskId,
|
||
carCode: that.carCode,
|
||
outNum: that.multiNum,
|
||
companyId: uni.getStorageSync('userInfo').sysUser.companyId
|
||
}
|
||
console.log(that.subList);
|
||
that.$api.fetchMaterialOutStore.subOutStore(that.subList).then(res => {
|
||
console.log(res);
|
||
if (res.data.code == 200) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '出库成功',
|
||
duration:2000,
|
||
success: () => {
|
||
that.showLoading = false
|
||
that.$refs.popup2.close()
|
||
that.init()
|
||
}
|
||
})
|
||
} else {
|
||
that.showLoading = false
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: res.data.msg
|
||
})
|
||
}
|
||
}).catch(err => {
|
||
console.log(err);
|
||
})
|
||
}
|
||
},
|
||
|
||
|
||
|
||
init(){
|
||
const that = this
|
||
console.log(that.taskId, that.id);
|
||
/* const params = {
|
||
taskId:this.taskId
|
||
} */
|
||
// const res = await that.$api.fetchMaterialOutStore.fetchSingleDetail(params)
|
||
that.$api.fetchMaterialOutStore.fetchSingleDetail({
|
||
id: that.id,
|
||
souceBy: 1
|
||
}).then(res => {
|
||
console.log(res);
|
||
that.fetchList = []
|
||
if (res.data.code == 200) {
|
||
/* for (let i = 0; i < res.data.data.rows[0].leaseApplyInfoList.length; i++) {
|
||
for (let k = 0; k < res.data.data.rows[0].leaseApplyInfoList[i].leaseApplyDetails.length; k++) {
|
||
that.fetchList.push(res.data.data.rows[0].leaseApplyInfoList[i].leaseApplyDetails[k])
|
||
}
|
||
} */
|
||
that.fetchList = res.data.data
|
||
console.log('获取详情 ===========================',that.fetchList);
|
||
// that.fetchList[1].manageType = 1
|
||
}
|
||
}).catch(err => {
|
||
console.log(err);
|
||
})
|
||
},
|
||
|
||
|
||
multiNumChange(val){
|
||
console.log('multiNumChange ===============',val);
|
||
},
|
||
finishOut () {
|
||
let that = this
|
||
if (that.infoList.outNum > 0) {
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: '该设备待出库数量不为0!'
|
||
})
|
||
} else {
|
||
uni.showModal({
|
||
title: '完成出库',
|
||
content: '确定将此种机具完成出库吗?',
|
||
confirmText: '出库',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
that.showLoading = true
|
||
console.log(that.infoList);
|
||
that.$api.fetchMaterialOutStore.directOutStore({
|
||
id: that.infoList.parentId,
|
||
typeId: that.infoList.typeId
|
||
}).then(res => {
|
||
console.log(res);
|
||
if (res.data.code == 200) {
|
||
that.showLoading = false
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: res.data.msg,
|
||
success: () => {
|
||
uni.navigateBack()
|
||
}
|
||
})
|
||
} else {
|
||
that.showLoading = false
|
||
uni.showToast({
|
||
icon: 'none',
|
||
title: res.data.msg
|
||
})
|
||
}
|
||
}).catch(err => {
|
||
console.log(err);
|
||
})
|
||
}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
},
|
||
onLoad(params) {
|
||
let that = this
|
||
this.taskId = params.taskId
|
||
this.taskStatus = params.taskStatus
|
||
this.id = params.id
|
||
},
|
||
onShow() {
|
||
this.init()
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.single-fetch{
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 20rpx 35rpx;
|
||
border-bottom: 1px solid #DDDDDD;
|
||
view{
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 25rpx;
|
||
span{
|
||
color: #A7A7A7;
|
||
padding-right: 20rpx;
|
||
}
|
||
h4{
|
||
font-size: 14px;
|
||
font-weight: normal;
|
||
}
|
||
}
|
||
view:last-child{
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
.btm-exam{
|
||
position: fixed;
|
||
left: 0;
|
||
bottom: 0;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
padding: 20rpx 40rpx;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
border-top: 2px solid #F6F8FF;
|
||
.exam{
|
||
box-sizing: border-box;
|
||
padding: 10rpx 50rpx;
|
||
border-radius: 30rpx;
|
||
background-color: #3788FF;
|
||
font-size: 14px;
|
||
color: #fff;
|
||
}
|
||
}
|
||
.popup1{
|
||
width: 80vw;
|
||
height: 20vh;
|
||
background-color: #fff;
|
||
border-radius: 15rpx;
|
||
overflow: hidden;
|
||
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
|
||
.pop-top{
|
||
width: 100%;
|
||
height: 5vh;
|
||
box-sizing: border-box;
|
||
padding: 0 25rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
.select-area{
|
||
width: 85%;
|
||
margin: 40rpx auto;
|
||
display: flex;
|
||
justify-content: space-around;
|
||
align-items: center;
|
||
view{
|
||
box-sizing: border-box;
|
||
font-size: 14px;
|
||
padding: 10rpx 20rpx;
|
||
border: 1px solid #D5D5D4;
|
||
border-radius: 20rpx;
|
||
}
|
||
}
|
||
.ipt-area{
|
||
width: 85%;
|
||
margin: 40rpx auto;
|
||
}
|
||
}
|
||
.popup2{
|
||
width: 80vw;
|
||
height: 60vh;
|
||
background-color: #fff;
|
||
border-radius: 15rpx;
|
||
overflow: hidden;
|
||
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
|
||
.pop-top{
|
||
width: 100%;
|
||
height: 5vh;
|
||
box-sizing: border-box;
|
||
padding: 0 25rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
.info-area{
|
||
width: 85%;
|
||
margin: 30rpx auto;
|
||
display: flex;
|
||
flex-direction: column;
|
||
view{
|
||
margin-bottom: 15rpx;
|
||
display: flex;
|
||
h4{
|
||
font-weight: normal;
|
||
color: #989898;
|
||
font-size: 14px;
|
||
width: 35%;
|
||
}
|
||
span{
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
}
|
||
.sub-btn{
|
||
width: 85%;
|
||
margin: 30rpx auto;
|
||
background-color: #3788FF;
|
||
color: #fff;
|
||
box-sizing: border-box;
|
||
padding: 15rpx 0;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
border-radius: 40rpx;
|
||
font-size: 14px;
|
||
}
|
||
}
|
||
</style>
|