新购入库
This commit is contained in:
		
							parent
							
								
									2851ba0885
								
							
						
					
					
						commit
						5b99b0ed83
					
				| 
						 | 
				
			
			@ -81,7 +81,8 @@
 | 
			
		|||
        {
 | 
			
		||||
            "path": "pages/new-purchase/entry/index",
 | 
			
		||||
            "style": {
 | 
			
		||||
                "navigationBarTitleText": "新购入库"
 | 
			
		||||
                "navigationStyle": "custom"
 | 
			
		||||
                // "navigationBarTitleText": "新购入库"
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -326,7 +326,7 @@ const boxInBound = async () => {
 | 
			
		|||
const confirmBoxInBound = async () => {
 | 
			
		||||
    const res = await appWarehouseApi({
 | 
			
		||||
        // taskId: queryParams.value.taskId,
 | 
			
		||||
        // maTypeId: queryParams.value.typeId,
 | 
			
		||||
        maTypeId: queryParams.value.typeId,
 | 
			
		||||
        boxCode: boxInfo.value.boxCode,
 | 
			
		||||
    })
 | 
			
		||||
    if (res.code === 200) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,12 @@
 | 
			
		|||
<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="complete-btn">
 | 
			
		||||
| 
						 | 
				
			
			@ -85,12 +93,13 @@ import { ref,computed } from 'vue'
 | 
			
		|||
import { onLoad, onShow } from '@dcloudio/uni-app'
 | 
			
		||||
import { debounce } from 'lodash-es'
 | 
			
		||||
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 active = ref(1) //                tap索引
 | 
			
		||||
const tableList = ref([]) //            列表数据源
 | 
			
		||||
const dateArray = ref([]) //            日期范围
 | 
			
		||||
 | 
			
		||||
const scanQrCodeRefBox = ref(null)
 | 
			
		||||
// 查询参数
 | 
			
		||||
const queryParams = ref({
 | 
			
		||||
    startTime: '', //                   开始时间
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +110,8 @@ const queryParams = ref({
 | 
			
		|||
    pageNum: 1,
 | 
			
		||||
    pageSize: 5,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
const boxCode = ref('')
 | 
			
		||||
const boxInfo = ref({})
 | 
			
		||||
// 日期 change 事件
 | 
			
		||||
const onChangeDate = (val) => {
 | 
			
		||||
    const [val_1, val_2] = val
 | 
			
		||||
| 
						 | 
				
			
			@ -109,6 +119,87 @@ const onChangeDate = (val) => {
 | 
			
		|||
    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)=> {
 | 
			
		||||
    if(item.taskStatus==22){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue