SmartStorage/pages/repairTestInStoreDetail/repairTestInStoreDetail.vue

312 lines
6.1 KiB
Vue
Raw Normal View History

2023-12-20 15:15:23 +08:00
<template>
<view>
2023-12-23 11:54:30 +08:00
<view
class="single-fetch"
v-for="(fetch, index) in fetchList"
:key="index"
>
<checkbox-group
@change="checkClick(fetch)"
v-show="status == '入库进行中'"
>
<checkbox :checked="fetch.checked" />
</checkbox-group>
<view class="slots">
<view>
<span>类型名称</span>
<h4>{{ fetch.typeName2 }}</h4>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.typeName }}</h4>
</view>
<view>
<span>申请数量</span>
<h4>{{ fetch.repairNum }}</h4>
</view>
<view>
<span>设备编号</span>
<h4>{{ fetch.maCode }}</h4>
</view>
<view>
<span>入库时间</span>
2024-03-13 17:55:34 +08:00
<h4>{{ fetch.status == '已入库' ? fetch.updateTime : fetch.status }}</h4>
2023-12-23 11:54:30 +08:00
</view>
</view>
</view>
<!-- <view class="btm-exam">
<view
class="exam"
@click="exam"
>
审核
</view>
</view> -->
<view
class="buy"
v-show="status == '入库进行中'"
>
<view class="checked">
<checkbox-group @tap="checkAll">
<checkbox :checked="allChecked" />
</checkbox-group>
<text>全选</text>
</view>
<view class="total">
<view class="bill" @click="finishCart">
<text>审核</text>
</view>
</view>
</view>
2023-12-20 15:15:23 +08:00
</view>
</template>
<script>
export default {
data() {
return {
2023-12-23 11:54:30 +08:00
fetchList: [
],
allChecked: false,
inStoreList: [],
taskId: '',
status: ''
2023-12-20 15:15:23 +08:00
}
},
methods: {
2023-12-23 11:54:30 +08:00
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false
} else {
// 判断每一个商品是否是被选择的状态
const goods = this.fetchList.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
}
},
//全选、全不选
checkAll() {
this.allChecked = !this.allChecked
if (this.allChecked) {
this.fetchList.map(item => {
item.checked = true
})
} else {
this.fetchList.map(item => {
item.checked = false
})
}
},
finishCart () {
let that = this
that.inStoreList = that.fetchList.filter((item) => {
return item.checked == true
}).map((subItem) => {
return {
taskId: that.taskId,
id: subItem['id'],
type: subItem['manageType'],
maId: subItem['maId'],
typeId: subItem['typeId'],
remark: subItem['remark'],
repairNum: subItem['repairNum']
}
})
if (that.inStoreList.length == 0) {
uni.showToast({
icon: 'none',
title: '未选中审核项!'
})
} else {
uni.showModal({
title: '确认审核',
content: '是否通过审核?',
confirmText: '通过',
2024-03-13 17:55:34 +08:00
// cancelText: '驳回',
2023-12-23 11:54:30 +08:00
success: (res) => {
if (res.confirm) {
that.inStoreList.forEach((item) => {
item.checkType = 1
})
console.log(that.inStoreList);
that.subInStore(that.inStoreList)
2024-03-13 17:55:34 +08:00
}/* else if (res.cancel) {
2023-12-23 11:54:30 +08:00
that.inStoreList.forEach((item) => {
item.checkType = 2
})
console.log(that.inStoreList);
that.subInStore(that.inStoreList)
2024-03-13 17:55:34 +08:00
} */
2023-12-23 11:54:30 +08:00
}
})
}
},
subInStore (obj) {
let that = this
// 通过审核或驳回
that.$api.repairTestInStore.processOrReject({
params: JSON.stringify(obj)
}).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
/* uni.redirectTo({
url: '/pages/repairTestInStore/repairTestInStore'
}) */
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
})
}
},
onLoad(params) {
let that = this
console.log(params);
that.status = params.taskStatus
that.taskId = params.taskId
// 获取修试入库明细
that.$api.repairTestInStore.repairTestInStoreDetail({
taskId: params.taskId
}, null).then(res => {
if (res.data.code == 200) {
for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].checked = false
2024-03-13 17:55:34 +08:00
if (res.data.data[i].maCode == null) {
res.data.data[i].maCode = '暂无'
}
2023-12-23 11:54:30 +08:00
}
that.fetchList = res.data.data
console.log(that.fetchList);
}
}).catch(err => {
})
2023-12-20 15:15:23 +08:00
}
}
</script>
2023-12-23 11:54:30 +08:00
<style lang="scss">
body{
box-sizing: border-box;
padding-bottom: 10vh;
}
.single-fetch{
width: 100%;
box-sizing: border-box;
padding: 20rpx 35rpx;
display: flex;
align-items: center;
border-bottom: 1px solid #DDDDDD;
.slots{
display: flex;
flex-direction: column;
margin-left: 30rpx;
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;
}
}
.buy {
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
left: 50%;
bottom: 0;
width: 95%;
transform: translate(-50%, 0);
}
.buy .checked {
display: flex;
align-items: center;
}
.buy .checked text {
font-size: 25rpx;
color: #000;
padding: 0 12rpx;
}
.buy .total {
display: flex;
align-items: center;
justify-content: space-between;
}
.buy .total .price {
padding-right: 20rpx;
}
.buy .total .price text {
font-size: 27rpx;
color: #C8C7CC;
display: inline-block;
}
.buy .total .price text:last-child {
color: red;
font-weight: bold;
}
.buy .total .bill text {
font-size: 25rpx;
color: #fff;
display: inline-block;
background-color: red;
line-height: 70rpx;
width: 150rpx;
text-align: center;
}
2023-12-20 15:15:23 +08:00
</style>