新购入库

This commit is contained in:
hongchao 2025-06-18 16:51:39 +08:00
parent 2851ba0885
commit 5b99b0ed83
3 changed files with 97 additions and 5 deletions

View File

@ -81,7 +81,8 @@
{ {
"path": "pages/new-purchase/entry/index", "path": "pages/new-purchase/entry/index",
"style": { "style": {
"navigationBarTitleText": "新购入库" "navigationStyle": "custom"
// "navigationBarTitleText": "新购入库"
} }
}, },

View File

@ -326,7 +326,7 @@ const boxInBound = async () => {
const confirmBoxInBound = async () => { const confirmBoxInBound = async () => {
const res = await appWarehouseApi({ const res = await appWarehouseApi({
// taskId: queryParams.value.taskId, // taskId: queryParams.value.taskId,
// maTypeId: queryParams.value.typeId, maTypeId: queryParams.value.typeId,
boxCode: boxInfo.value.boxCode, boxCode: boxInfo.value.boxCode,
}) })
if (res.code === 200) { if (res.code === 200) {

View File

@ -1,4 +1,12 @@
<template> <template>
<view style="padding-top: 4vh;background-color: rgb(220, 244, 255);">
<uni-nav-bar left-icon="left" @clickLeft="leftClick" right-icon="scan" @clickRight="rightClick" title="新购入库" title-style="font-weight: bolder;" backgroundColor="rgb(220, 244, 255)" :border="false" />
</view>
<ScanQrCodeBox
ref="scanQrCodeRefBox"
@scanSuccessBox="handleScanSuccessBox"
@scanErrorBox="handleScanErrorBox"
/>
<!-- 新购入库 --> <!-- 新购入库 -->
<view class="page-container"> <view class="page-container">
<view class="complete-btn"> <view class="complete-btn">
@ -85,12 +93,13 @@ import { ref,computed } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { getPurchaseList } from '@/services/purchase.js' import { getPurchaseList } from '@/services/purchase.js'
import ScanQrCodeBox from '@/pages/devicesSearch/ScanQrCodeBox.vue'
import { getInfoBindByCode, appWarehouseApi } from '@/services/standard.js'
const total = ref(0) // const total = ref(0) //
const active = ref(1) // tap const active = ref(1) // tap
const tableList = ref([]) // const tableList = ref([]) //
const dateArray = ref([]) // const dateArray = ref([]) //
const scanQrCodeRefBox = ref(null)
// //
const queryParams = ref({ const queryParams = ref({
startTime: '', // startTime: '', //
@ -101,7 +110,8 @@ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 5, pageSize: 5,
}) })
const boxCode = ref('')
const boxInfo = ref({})
// change // change
const onChangeDate = (val) => { const onChangeDate = (val) => {
const [val_1, val_2] = val const [val_1, val_2] = val
@ -109,6 +119,87 @@ const onChangeDate = (val) => {
queryParams.value.endTime = val_2 queryParams.value.endTime = val_2
} }
const leftClick = () => {
console.log(1)
uni.navigateBack({
delta: 1 //
});
}
const rightClick = () => {
boxCode.value = ''
if (scanQrCodeRefBox.value) {
scanQrCodeRefBox.value.scanQrCode()
}
}
//
const handleScanSuccessBox = (result) => {
boxCode.value = result?.text || ''
if (boxCode.value === '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
boxInBound()
}
}
//
const boxInBound = async () => {
if (boxCode.value == '') {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
} else {
let param = {
boxCode: boxCode.value,
// maTypeId: queryParams.value.typeId,
}
const res = await getInfoBindByCode(param)
uni.showToast({ title: JSON.stringify(res, null, 2), icon: 'none' })
if (res.code == 200) {
boxInfo.value = res.data
uni.showModal({
title: '提示',
content: `监测到${boxInfo.value.boxCode}标准箱中有${boxInfo.value.bindMaTotal}台设备,符合入库条件设备${boxInfo.value.successMaTotal}台,是否确定入库?`,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (boxInfo.value.successMaTotal > 0) {
confirmBoxInBound()
}
},
})
} else {
uni.showToast({ title: '扫码识别失败', icon: 'none' })
}
}
}
//
const confirmBoxInBound = async () => {
const res = await appWarehouseApi({
// taskId: queryParams.value.taskId,
// maTypeId: queryParams.value.typeId,
boxCode: boxInfo.value.boxCode,
})
if (res.code === 200) {
uni.showToast({
title: '入库成功!',
icon: 'none',
})
getTableList(true)
} else {
uni.showToast({ title: '入库失败', icon: 'none' })
}
}
//
const handleScanErrorBox = (error) => {
console.error('扫描出错:', error.message)
uni.showToast({ title: error.message, icon: 'none' })
}
// //
const onClick=(e,item)=> { const onClick=(e,item)=> {
if(item.taskStatus==22){ if(item.taskStatus==22){