Compare commits
2 Commits
070df2478b
...
78bb5006ab
Author | SHA1 | Date | |
---|---|---|---|
|
78bb5006ab | ||
|
7396441361 |
@ -69,15 +69,15 @@
|
||||
</view>
|
||||
|
||||
<view class="order-footer">
|
||||
<template v-if="!queryParams.isBack && isShow">
|
||||
<template v-if="!queryParams.isBack && typeof queryParams.isBack === 'boolean'">
|
||||
<view @click="inOutWareHouse(item,true)" class="order-btn yes">通知领料</view>
|
||||
<!-- <view class="order-btn yes">采购</view>-->
|
||||
</template>
|
||||
<template v-else-if="!queryParams.isBack && !isShow">
|
||||
<template v-else-if="!queryParams.isBack && typeof queryParams.isBack === 'undefined'">
|
||||
<view @click="inOutWareHouse(item,true)" class="order-btn yes">查看申请</view>
|
||||
<!-- <view class="order-btn yes">采购</view>-->
|
||||
</template>
|
||||
<template v-else-if="queryParams.isBack && isShow">
|
||||
<template v-else-if="queryParams.isBack">
|
||||
<view @click="inOutWareHouse(item,false)" class="order-btn yes">通知退料</view>
|
||||
</template>
|
||||
</view>
|
||||
@ -160,6 +160,8 @@ export default {
|
||||
noReadNum: 0,
|
||||
//通知公告数量
|
||||
noticeNum: 0,
|
||||
//是否首次打开页面
|
||||
ifFirstLogin: true,
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -193,7 +195,7 @@ export default {
|
||||
url: '/pages-home/msg/message'
|
||||
})
|
||||
},
|
||||
socketSuccess(){
|
||||
socketSuccess() {
|
||||
this.getNoReadNum()
|
||||
this.onRefresherrefresh()
|
||||
console.log('通知并刷新成功')
|
||||
@ -203,19 +205,33 @@ export default {
|
||||
*/
|
||||
activeTab(index) {
|
||||
this.active = index
|
||||
if (index == 1) {
|
||||
if (index === 0) {
|
||||
this.queryParams.isBack = false
|
||||
this.queryParams.isToBeReviewed = undefined
|
||||
this.isShow = true
|
||||
} else if (index === 1) {
|
||||
this.queryParams.isBack = true
|
||||
this.queryParams.isToBeReviewed = undefined
|
||||
this.isShow = true
|
||||
} else if (index == 2) {
|
||||
} else if (index === 2) {
|
||||
this.isShow = false
|
||||
this.queryParams.isToBeReviewed = true
|
||||
this.queryParams.isBack = undefined
|
||||
} else {
|
||||
this.isShow = true
|
||||
this.queryParams.isBack = undefined
|
||||
this.queryParams.isToBeReviewed = undefined
|
||||
}
|
||||
// this.active = index
|
||||
// if (index == 1) {
|
||||
// this.queryParams.isBack = false
|
||||
// this.queryParams.isToBeReviewed = undefined
|
||||
// this.isShow = true
|
||||
// } else if (index == 2) {
|
||||
// this.isShow = true
|
||||
// this.queryParams.isToBeReviewed = true
|
||||
// this.queryParams.isBack = undefined
|
||||
// } else {
|
||||
// this.isShow = true
|
||||
// this.queryParams.isBack = undefined
|
||||
// this.queryParams.isToBeReviewed = undefined
|
||||
// }
|
||||
this.onRefresherrefresh()
|
||||
},
|
||||
|
||||
@ -377,6 +393,11 @@ export default {
|
||||
if (res.code == 200) {
|
||||
this.noReadNum = res.data > 99 ? 99 : res.data
|
||||
}
|
||||
if (this.ifFirstLogin && this.noReadNum > 0) {
|
||||
console.log("播放")
|
||||
this.$refs.tarBar.dianyidain()
|
||||
this.ifFirstLogin = false
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<VNavigationBar background-color="#fff" title="单据处理" title-color="#333"></VNavigationBar>
|
||||
<!-- <view class="tabs">-->
|
||||
<!-- <view v-for="(item, index) in tabs" :key="index" :class="{'active': item.value === active}" class="tab-item">-->
|
||||
<!-- {{ item.name }}-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="tabs">-->
|
||||
<!-- <view v-for="(item, index) in tabs" :key="index" :class="{'active': item.value === active}" class="tab-item">-->
|
||||
<!-- {{ item.name }}-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<view class="listBox">
|
||||
<view class="list">
|
||||
<view v-for="(item, index) in wares" :key="index" class="listItem">
|
||||
@ -39,7 +39,7 @@
|
||||
<text class="label"></text>
|
||||
<text class="repairNum"></text>
|
||||
<view class="submit" @click="toPart">采购</view>
|
||||
<view class="submit" @click="submit">{{isReceive?'通知领料':'通知退料'}}</view>
|
||||
<view class="submit" @click="submit">{{ isReceive ? '通知领料' : '通知退料' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -48,28 +48,28 @@
|
||||
import VNavigationBar from "@/components/VNavigationBar.vue";
|
||||
import request from '@/utils/request';
|
||||
import {
|
||||
getJSONData,setJSONData
|
||||
getJSONData, setJSONData
|
||||
} from '@/utils/auth'
|
||||
import {getDictTextByCodeAndValue,createUniqueCodeByHead} from "@/utils/utils";
|
||||
import {getDictTextByCodeAndValue, createUniqueCodeByHead} from "@/utils/utils";
|
||||
|
||||
export default {
|
||||
components: {VNavigationBar},
|
||||
data() {
|
||||
return {
|
||||
//配件申请单id
|
||||
twId:'',
|
||||
twId: '',
|
||||
//配件列表
|
||||
wares:[],
|
||||
wares: [],
|
||||
//true 领料 ,false 退料
|
||||
isReceive:true,
|
||||
isReceive: true,
|
||||
//父组件传入的数据
|
||||
formData:{},
|
||||
formData: {},
|
||||
active: '',
|
||||
isToBeReviewed:true
|
||||
isToBeReviewed: true
|
||||
};
|
||||
},
|
||||
onLoad(data) {
|
||||
if(getJSONData("applyWaresForm")){
|
||||
if (getJSONData("applyWaresForm")) {
|
||||
this.formData = getJSONData("applyWaresForm")
|
||||
this.isReceive = this.formData.isReceive
|
||||
this.twId = this.formData.id
|
||||
@ -87,41 +87,63 @@ export default {
|
||||
*/
|
||||
init() {
|
||||
const params = {
|
||||
twId:this.formData.id
|
||||
twId: this.formData.id
|
||||
}
|
||||
request({
|
||||
url: '/admin-api/repair/twi/list',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res)=>{
|
||||
res.data.map((item)=>{
|
||||
if(!item.waresAlreadyCount){
|
||||
item.waresAlreadyCount = 0
|
||||
}).then((res) => {
|
||||
this.wares = res.data
|
||||
if (this.isToBeReviewed){
|
||||
this.wares = this.wares.filter(item => item.waresStatus === '1')
|
||||
this.wares = this.wares.filter(item => this.isReceive ? (item.waresCount > item.waresAlreadyCount) : (item.waresAlreadyCount > 0))
|
||||
}
|
||||
if(!item.wares.stock){
|
||||
item.wares.stock=0
|
||||
this.wares.forEach(item => {
|
||||
if (!item.wares.stock){
|
||||
item.wares.stock = 0
|
||||
}
|
||||
if(this.isReceive){
|
||||
if (this.isReceive) {
|
||||
//领料,最大可领取数量为申请数量-已领取数量,同时不能大于库存数量,默认数量就是最大可领取数量
|
||||
item.maxNum = parseInt(item.waresCount) - parseInt(item.waresAlreadyCount)
|
||||
if(item.maxNum >item.wares.stock){
|
||||
if (item.maxNum > item.wares.stock) {
|
||||
item.maxNum = item.wares.stock
|
||||
}
|
||||
item.thisNum = item.maxNum
|
||||
}else{
|
||||
} else {
|
||||
//退料,最大数量为已领取数量,最小数量为0,默认数量为0
|
||||
item.maxNum = item.waresAlreadyCount
|
||||
item.thisNum = 0
|
||||
}
|
||||
})
|
||||
this.wares = res.data;
|
||||
// res.data.map((item)=>{
|
||||
// if(!item.waresAlreadyCount){
|
||||
// item.waresAlreadyCount = 0
|
||||
// }
|
||||
// if(!item.wares.stock){
|
||||
// item.wares.stock=0
|
||||
// }
|
||||
// if(this.isReceive){
|
||||
// //领料,最大可领取数量为申请数量-已领取数量,同时不能大于库存数量,默认数量就是最大可领取数量
|
||||
// item.maxNum = parseInt(item.waresCount) - parseInt(item.waresAlreadyCount)
|
||||
// if(item.maxNum >item.wares.stock){
|
||||
// item.maxNum = item.wares.stock
|
||||
// }
|
||||
// item.thisNum = item.maxNum
|
||||
// }else{
|
||||
// //退料,最大数量为已领取数量,最小数量为0,默认数量为0
|
||||
// item.maxNum = item.waresAlreadyCount
|
||||
// item.thisNum = 0
|
||||
// }
|
||||
// })
|
||||
// this.wares = res.data;
|
||||
})
|
||||
},
|
||||
/**
|
||||
*
|
||||
*/
|
||||
addNum(repair) {
|
||||
if((repair.thisNum+1) > repair.maxNum){
|
||||
if ((repair.thisNum + 1) > repair.maxNum) {
|
||||
uni.showToast({
|
||||
title: '超过库存数量或最大申请数量!',
|
||||
icon: 'none'
|
||||
@ -129,13 +151,16 @@ export default {
|
||||
return
|
||||
}
|
||||
this.$set(repair, 'thisNum', repair.thisNum + 1)
|
||||
const find = this.wares.find(f => f.id == repair.id)
|
||||
if (find) {
|
||||
find.thisNum = repair.thisNum
|
||||
} else {
|
||||
this.wares.push(JSON.parse(JSON.stringify(repair)))
|
||||
const findIndex = this.wares.findIndex(f => f.id === repair.id);
|
||||
if (findIndex !== -1) {
|
||||
this.$set(this.wares, findIndex, repair);
|
||||
}
|
||||
console.log('repair', repair)
|
||||
// const find = this.wares.find(f => f.id == repair.id)
|
||||
// if (find) {
|
||||
// find.thisNum = repair.thisNum
|
||||
// } else {
|
||||
// this.wares.push(JSON.parse(JSON.stringify(repair)))
|
||||
// }
|
||||
},
|
||||
/**
|
||||
* 减
|
||||
@ -146,32 +171,46 @@ export default {
|
||||
return
|
||||
}
|
||||
this.$set(repair, 'thisNum', repair.thisNum - 1)
|
||||
const find = this.wares.find(f => f.id == repair.id)
|
||||
if (find) {
|
||||
find.thisNum = repair.thisNum
|
||||
} else {
|
||||
this.wares.push(JSON.parse(JSON.stringify(repair)))
|
||||
const findIndex = this.wares.findIndex(f => f.id === repair.id);
|
||||
if (findIndex !== -1) {
|
||||
this.$set(this.wares, findIndex, repair);
|
||||
}
|
||||
// const find = this.wares.find(f => f.id == repair.id)
|
||||
// if (find) {
|
||||
// find.thisNum = repair.thisNum
|
||||
// } else {
|
||||
// this.wares.push(JSON.parse(JSON.stringify(repair)))
|
||||
// }
|
||||
},
|
||||
/**
|
||||
* 出库
|
||||
*/
|
||||
submit() {
|
||||
this.formData.repairSo = {
|
||||
soType:this.isReceive?'02':'04',
|
||||
soNo:createUniqueCodeByHead(this.isReceive?'LL':'TL'),
|
||||
userId:this.formData.repairId,
|
||||
userName:this.formData.repairName,
|
||||
soStatus:this.isReceive?'04':'07'
|
||||
soType: this.isReceive ? '02' : '04',
|
||||
soNo: createUniqueCodeByHead(this.isReceive ? 'LL' : 'TL'),
|
||||
userId: this.formData.repairId,
|
||||
userName: this.formData.repairName,
|
||||
soStatus: this.isReceive ? '04' : '07'
|
||||
}
|
||||
this.formData.repairSois = [...this.wares.map(item =>{
|
||||
// 过滤一下,thisNum不等0才行
|
||||
const flag = this.wares.filter(item => item.thisNum > 0)
|
||||
if (!flag || flag.length === 0){
|
||||
uni.showToast({
|
||||
title: '请设置配件数量!',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.wares = flag
|
||||
this.formData.repairSois = [...this.wares.map(item => {
|
||||
return {
|
||||
soiType: this.isReceive ? '02' : "04",
|
||||
goodsId: item.waresId,
|
||||
goodsCount: item.thisNum,
|
||||
}
|
||||
})]
|
||||
if (this.isReceive){
|
||||
if (this.isReceive) {
|
||||
this.formData.items = [...this.wares.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
@ -181,16 +220,16 @@ export default {
|
||||
request({
|
||||
url: '/admin-api/repair/tw/pass',
|
||||
method: 'post',
|
||||
data:this.formData
|
||||
}).then((res)=>{
|
||||
if (res.code === 200){
|
||||
data: this.formData
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '通知成功!',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
},700)
|
||||
}, 700)
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -198,10 +237,10 @@ export default {
|
||||
/**
|
||||
* 跳转采购页面
|
||||
*/
|
||||
toPart(){
|
||||
toPart() {
|
||||
const formData = this.formData;
|
||||
formData.items = this.wares;
|
||||
setJSONData("applyWaresForm",formData)
|
||||
setJSONData("applyWaresForm", formData)
|
||||
uni.navigateTo({
|
||||
url: '/pages-warehouse/inOutWarehouse/part'
|
||||
})
|
||||
@ -283,9 +322,11 @@ export default {
|
||||
.listItem {
|
||||
padding: 30rpx 0;
|
||||
border-bottom: 2rpx solid #DDDDDD;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.repairName {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
|
Loading…
Reference in New Issue
Block a user