SmartStorage/pages/newBuyDetail/newBuyDetail.vue

570 lines
12 KiB
Vue
Raw Normal View History

2023-12-20 15:15:23 +08:00
<template>
<view>
<view class="dataInfo">
<view class="dataList" v-for="(item,index) in list" :key="index">
<view class="info-upper">
2024-03-13 17:55:34 +08:00
<checkbox-group
@change="checkClick(item)"
style="margin-right: 15rpx;"
v-show="item.status == '0'"
>
2023-12-20 15:15:23 +08:00
<checkbox :checked="item.checked" />
</checkbox-group>
<view class="details">
<view class="text">
<text><span style="padding-right: 20rpx; color: #a6a6a6;">类型名称</span>{{item.typeName}}</text>
2024-01-08 17:41:15 +08:00
<text><span style="padding-right: 20rpx; color: #a6a6a6;">规格型号</span>{{item.specificationType}}</text>
<text><span style="padding-right: 20rpx; color: #a6a6a6;">待入库数量</span>{{item.checkNum}}</text>
2024-04-12 14:05:08 +08:00
<text><span style="padding-right: 20rpx; color: #a6a6a6;">机具编号</span>{{item.maCode == null ? '无' : item.maCode}}</text>
2024-04-20 17:39:08 +08:00
<text><span style="padding-right: 20rpx; color: #a6a6a6;">机具状态</span>{{item.CNstatus}}</text>
2023-12-20 15:15:23 +08:00
</view>
</view>
</view>
<view class="lower-btns">
2024-01-08 17:41:15 +08:00
<!-- <view
2023-12-20 15:15:23 +08:00
style="background-color: #3888ff;"
>
<uni-icons style="color: #fff;" type="eye" size="36"></uni-icons>
查看
2024-01-08 17:41:15 +08:00
</view> -->
2024-03-13 17:55:34 +08:00
<!-- <view
2023-12-20 15:15:23 +08:00
style="background-color: #1bd30b;"
@click="openPopup"
>
<uni-icons style="color: #fff;" type="cart" size="36"></uni-icons>
入库
2024-03-13 17:55:34 +08:00
</view> -->
2023-12-20 15:15:23 +08:00
</view>
</view>
</view>
<!-- <button @click="delCart">删除</button> -->
2024-03-13 17:55:34 +08:00
<view
class="buy"
>
2023-12-20 15:15:23 +08:00
<view class="checked">
<checkbox-group @tap="checkAll">
<checkbox :checked="allChecked" />
</checkbox-group>
<text>全选</text>
</view>
2024-03-13 17:55:34 +08:00
<view style="display: flex;">
2024-04-12 14:05:08 +08:00
<!-- <view class="total" style="margin-right: 15rpx;">
2024-03-13 17:55:34 +08:00
<view class="bill" @click="bindCode">
<text>绑定</text>
</view>
2024-04-12 14:05:08 +08:00
</view> -->
2024-03-13 17:55:34 +08:00
<view class="total">
<view class="bill" @click="finishCart">
<text>审核</text>
</view>
2023-12-20 15:15:23 +08:00
</view>
</view>
2024-03-13 17:55:34 +08:00
2023-12-20 15:15:23 +08:00
</view>
<uni-popup
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup">
<view class="pop-top">
2024-04-20 14:35:37 +08:00
<h4>审批</h4>
2023-12-20 15:15:23 +08:00
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
@click="closePopup"
>
</uni-icons>
</view>
2024-04-20 14:35:37 +08:00
<h4 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">是否通过审批</h4>
2023-12-20 15:15:23 +08:00
<view class="select-area">
2024-04-20 14:35:37 +08:00
<view @click="modalConfirm">通过</view>
<view @click="modalReject">驳回</view>
<!-- <uni-forms ref="examForm" :modelValue="examFormData" :rules="rules" label-position="top">
<uni-forms-item name="ifPass" required label="是否通过" label-width="150">
<uni-data-select
v-model="examFormData.ifPass"
:localdata="ifPassRange"
:clear="false"
@change="ifPassChange"
></uni-data-select>
</uni-forms-item>
<uni-forms-item required v-show="examFormData.ifPass == '1'" name="noPassReason" label="不通过原因" label-width="150">
<uni-easyinput type="textarea" v-model="examFormData.noPassReason" placeholder="请输入内容"></uni-easyinput>
</uni-forms-item>
<button class="submit-btn" @click="formSubmit">确认</button>
</uni-forms> -->
2023-12-20 15:15:23 +08:00
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
2024-01-08 17:41:15 +08:00
taskId: '',
2023-12-20 15:15:23 +08:00
allChecked: false,
inputs: "",
2024-01-08 17:41:15 +08:00
list: [
2023-12-20 15:15:23 +08:00
],
totalFine: '',
totalGoods: [],
scanType: '',
scanRange: [
{ text: '二维码', value: '1' },
{ text: 'RFID', value: '2' }
2024-01-08 17:41:15 +08:00
],
2024-03-13 17:55:34 +08:00
subObj: '',
codeList: []
2023-12-20 15:15:23 +08:00
}
},
methods: {
// 单个商品的选择
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false
} else {
// 判断每一个商品是否是被选择的状态
const goods = this.list.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
}
},
//全选、全不选
checkAll() {
this.allChecked = !this.allChecked
2024-03-13 17:55:34 +08:00
console.log(this.list);
2023-12-20 15:15:23 +08:00
if (this.allChecked) {
this.list.map(item => {
2024-03-13 17:55:34 +08:00
if (item.status == '0') {
item.checked = true
}
2023-12-20 15:15:23 +08:00
})
} else {
this.list.map(item => {
2024-03-13 17:55:34 +08:00
if (item.status == '0') {
item.checked = false
}
2023-12-20 15:15:23 +08:00
})
}
},
2024-04-20 14:35:37 +08:00
modalConfirm () {
this.subObj = {
taskId: this.taskId,
checkResult: '1',
inputRecordList: this.totalGoods
}
console.log(this.subObj)
this.subNewBuy(this.subObj)
},
modalReject () {
this.subObj = {
taskId: this.taskId,
checkResult: '2',
inputRecordList: this.totalGoods
}
console.log(this.subObj)
this.subNewBuy(this.subObj)
},
2023-12-20 15:15:23 +08:00
finishCart () {
let that = this
2024-04-20 17:39:08 +08:00
that.totalGoods = that.list.filter(item => {
2023-12-20 15:15:23 +08:00
return item.checked == true
2024-04-20 17:39:08 +08:00
}).map(subItem => {
2024-01-08 17:41:15 +08:00
return {
typeId: subItem['typeId'],
maId: subItem['maId'],
maCode: subItem['maCode'],
inputNum: subItem['checkNum'],
2024-04-20 17:39:08 +08:00
companyId: subItem['companyId'],
manageType: subItem['manageType']
2024-01-08 17:41:15 +08:00
}
2023-12-20 15:15:23 +08:00
})
2024-01-08 17:41:15 +08:00
if (that.totalGoods.length == 0) {
uni.showToast({
icon: 'none',
title: '未选中审核项!'
})
} else {
2024-04-20 17:39:08 +08:00
that.totalGoods.forEach(item => {
console.log(item);
if (item.manageType == 0) {
if (item.maCode == null) {
uni.showToast({
icon: 'none',
title: '该机具编码未绑定,无法审核!'
})
} else {
that.openPopup()
}
} else {
that.openPopup()
}
})
2024-04-20 14:35:37 +08:00
/* uni.showModal({
2024-01-08 17:41:15 +08:00
title: '新购明细审核',
content: '是否确定审核通过?',
confirmText: '通过',
2024-03-13 17:55:34 +08:00
// cancelText: '驳回',
2024-01-08 17:41:15 +08:00
success: (res) => {
if (res.confirm) {
// 通过
that.subObj = {
taskId: that.taskId,
checkResult: '1',
inputRecordList: that.totalGoods
}
console.log(that.subObj);
that.subNewBuy(that.subObj)
2024-04-20 14:35:37 +08:00
} else if (res.cancel) {
2024-01-08 17:41:15 +08:00
// 驳回
that.subObj = {
taskId: that.taskId,
checkResult: '2',
inputRecordList: that.totalGoods
}
2024-04-20 14:35:37 +08:00
console.log(that.subObj);
// that.subNewBuy(that.subObj)
}
2024-01-08 17:41:15 +08:00
}
2024-04-20 14:35:37 +08:00
}) */
2024-01-08 17:41:15 +08:00
}
2023-12-20 15:15:23 +08:00
},
2024-03-13 17:55:34 +08:00
bindCode () {
let that = this
that.codeList = that.list.filter(item => {
return item.checked == true
})
if (that.codeList.length > 1 || that.codeList.length == 0) {
uni.showToast({
icon: 'none',
title: '一次只可选择一种机具进行绑定!'
})
} else {
console.log(that.codeList);
}
},
2023-12-20 15:15:23 +08:00
openPopup () {
this.$refs.popup.open()
},
closePopup () {
this.$refs.popup.close()
},
scanChange (e) {
let that = this
console.log(e);
if (e.detail.value == '1') {
that.closePopup()
that.scanType = ''
uni.scanCode({
success: (res) => {
console.log(res);
uni.navigateTo({
url: `/pages/newInAfterScan/newInAfterScan?result=${res.result}`
})
}
})
} else {
console.log('id');
}
2024-01-08 17:41:15 +08:00
},
subNewBuy (obj) {
let that = this
that.$api.newInStore.subNewBuy(obj).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
2024-04-20 14:35:37 +08:00
that.closePopup()
2024-01-08 17:41:15 +08:00
uni.navigateBack()
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
2023-12-20 15:15:23 +08:00
}
2024-01-08 17:41:15 +08:00
},
onLoad(params) {
let that = this
console.log(params.taskId);
that.taskId = params.taskId
// 初始化请求新购入库详情
that.$api.newInStore.fetchNewBuyDetail({
taskId: params.taskId
}).then(res => {
console.log(res);
if (res.data.code == 200) {
for (let i = 0; i < res.data.data.length; i++) {
2024-03-13 17:55:34 +08:00
if (res.data.data[i].status == '0') {
res.data.data[i].checked = false
}
2024-04-20 17:39:08 +08:00
switch (res.data.data[i].status) {
case '1':
res.data.data[i].CNstatus = '已入库'
break;
case '2':
res.data.data[i].CNstatus = '入库驳回'
break;
case '0':
res.data.data[i].CNstatus = '待审核'
break;
}
2024-01-08 17:41:15 +08:00
}
that.list = res.data.data
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
2023-12-20 15:15:23 +08:00
}
}
</script>
<style lang="scss">
2024-01-08 17:41:15 +08:00
body{
box-sizing: border-box;
2024-03-13 17:55:34 +08:00
padding-bottom: 25%;
2024-01-08 17:41:15 +08:00
}
2023-12-20 15:15:23 +08:00
/deep/uni-checkbox .uni-checkbox-input {
border-radius: 50%;
}
/deep/uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked {
border-color: #ddd;
color: #fff !important;
background-color: #2DCF8C !important;
}
/deep/uni-checkbox .uni-checkbox-input {
border-color: #ddd;
}
/deep/uni-checkbox .uni-checkbox-input:hover {
border-color: #ddd;
}
.search {
padding-top: 20rpx;
}
.search .searchIput {
background-color: #e6e6e6;
width: 95%;
margin: 0 auto;
height: 72rpx;
line-height: 72rpx;
border-radius: 50rpx;
padding: 0 32rpx;
box-sizing: border-box;
display: flex;
align-items: center;
}
.search .searchIput input {
font-size: 26rpx;
width: 100%;
color: grey;
}
.search .searchIput image {
width: 34rpx;
height: 34rpx;
}
.dataInfo {
width: 95%;
margin: 0 auto;
}
.dataInfo .dataList {
display: flex;
flex-direction: column;
align-items: center;
border-bottom: 2px solid #F1F1F1;
padding: 10rpx 0;
}
.info-upper{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.lower-btns{
width: 100%;
box-sizing: border-box;
padding: 20rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.lower-btns>view{
box-sizing: border-box;
padding: 10rpx 20rpx;
border-radius: 15rpx;
color: #fff;
font-size: 14px;
margin-right: 15rpx;
}
.dataInfo .dataList .details {
display: flex;
align-items: center;
flex: 1;
font-size: 0;
}
.dataInfo .dataList .details .img image {
width: 200rpx;
height: 140rpx;
padding: 0 20rpx;
}
.dataInfo .dataList .details .text text {
color: #000;
2024-01-08 17:41:15 +08:00
font-size: 27rpx;
2023-12-20 15:15:23 +08:00
display: block;
padding: 10rpx 0;
}
.dataInfo .dataList .details .text {
color: red;
font-size: 32rpx;
}
.dataInfo .dataList .action text {
font-size: 25rpx;
color: #000;
border: 1px solid #C8C7CC;
display: inline-block;
line-height: 50rpx;
width: 60rpx;
text-align: center;
box-sizing: border-box;
}
.dataInfo .dataList .action text:nth-child(2) {
border-left: none;
border-right: none;
}
.buy {
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
left: 50%;
bottom: 0;
width: 95%;
2024-01-08 17:41:15 +08:00
background-color: #fff;
2023-12-20 15:15:23 +08:00
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;
}
.popup{
width: 80vw;
height: 20vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
}
.popup>.pop-top{
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.popup>.select-area{
width: 85%;
margin: 40rpx auto;
2024-04-20 14:35:37 +08:00
display: flex;
justify-content: space-around;
align-items: center;
}
.popup>.select-area>view{
box-sizing: border-box;
font-size: 30rpx;
padding: 12rpx 24rpx;
background-color: #3788FF;
color: #fff;
border-radius: 20rpx;
2023-12-20 15:15:23 +08:00
}
2024-04-20 14:35:37 +08:00
2023-12-20 15:15:23 +08:00
</style>