Merge branch 'master' of http://192.168.30.2:3000/bonus/bonus-material-app
This commit is contained in:
commit
7803f67d12
|
|
@ -50,12 +50,13 @@
|
|||
</uni-row>
|
||||
</view>
|
||||
<view class="table-list-item">
|
||||
<scroll-view class="scroll-view" scroll-y="true" style="height: 300rpx;">
|
||||
<uni-forms :model="codeData" label-width="100" :border="true">
|
||||
<uni-forms-item label="物资类型:" name="materialName">
|
||||
<span class="form-view">{{ codeData.materialName }}</span>
|
||||
<uni-forms-item label="物资类型:" name="typeName">
|
||||
<span class="form-view">{{ codeData.typeName }}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="规格型号:" name="materialModel">
|
||||
<span class="form-view">{{ codeData.materialModel }}</span>
|
||||
<uni-forms-item label="规格型号:" name="typeModelName">
|
||||
<span class="form-view">{{ codeData.typeModelName }}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备状态:" name="statusName">
|
||||
<span class="form-view">{{ codeData.statusName }}</span>
|
||||
|
|
@ -64,6 +65,7 @@
|
|||
<span class="form-view">1</span>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
|
||||
|
|
@ -72,7 +74,7 @@
|
|||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { getCodeDeviceListAPI, setOutboundNumAPI } from '@/services/picking/outbound.js'
|
||||
import { getCodeScanAPI, setOutboundNumAPI } from '@/services/picking/outbound.js'
|
||||
import { onBackPress } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
|
|
@ -90,31 +92,42 @@ const queryCodeParams = ref({
|
|||
typeId: '',
|
||||
maStatus: 1,
|
||||
maCode: '',
|
||||
qrCode: '',
|
||||
})
|
||||
|
||||
const qrCodeScan = ref('')
|
||||
|
||||
onLoad((options) => {
|
||||
console.log('options', options)
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
queryCodeParams.value.typeId = queryParams.value.typeId
|
||||
})
|
||||
// 计算出库最大数量
|
||||
const maxNum = computed(() => {
|
||||
// 通过预领数量和已领数量计算剩余待出库数量
|
||||
const waitNum = queryParams.value.preNum - queryParams.value.alNum - codeNum.value
|
||||
const waitNum = queryParams.value.preNum - queryParams.value.alNum
|
||||
return waitNum
|
||||
})
|
||||
// 扫码识别按钮
|
||||
const scanStart = () => {
|
||||
console.log('编码识别--')
|
||||
// 只允许通过相机扫码
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ['qrCode', 'pdf417'],
|
||||
success: (res) => {
|
||||
console.log('扫码结果:' + res.result)
|
||||
queryCodeParams.value.maCode = res.result.split("qrcode=")[1]
|
||||
},
|
||||
fail: (err) => {},
|
||||
})
|
||||
// uni.scanCode({
|
||||
// onlyFromCamera: true,
|
||||
// scanType: ['qrCode', 'pdf417'],
|
||||
// success: (res) => {
|
||||
// console.log('扫码结果:' + res.result)
|
||||
// qrCodeScan.value = res.result.split("qrcode=")[1]
|
||||
// queryCodeParams.value.maCode = res.result.split("qrcode=")[1]
|
||||
// if (qrCodeScan.value=="") {
|
||||
// uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
// }else{
|
||||
// getMaInfoScan()
|
||||
// }
|
||||
// },
|
||||
// fail: (err) => {},
|
||||
// })
|
||||
|
||||
|
||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
mpaasScanModule.mpaasScan({
|
||||
|
|
@ -132,8 +145,21 @@ const scanStart = () => {
|
|||
if(ret.resp_code==10){
|
||||
uni.showToast({ title: '用户取消', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==11){
|
||||
uni.showToast({ title: '扫码失败', icon: 'none' })
|
||||
}
|
||||
if(ret.resp_code==1000){
|
||||
uni.showToast({ title: '成功', icon: 'none' })
|
||||
console.log('1111',ret.resp_result)
|
||||
qrCodeScan.value = ret.resp_result.split("qrcode=")[1]
|
||||
// queryCodeParams.value.maCode = ret.resp_result.split("qrcode=")[1]
|
||||
queryCodeParams.value.qrCode = ret.resp_result.split("qrcode=")[1]
|
||||
if (qrCodeScan.value=="") {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none'})
|
||||
}else{
|
||||
getMaInfoScan()
|
||||
// 停止扫描
|
||||
}
|
||||
}
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
|
|
@ -148,34 +174,68 @@ const scanStart = () => {
|
|||
|
||||
}
|
||||
|
||||
//根据编码获取设备类型
|
||||
const getMaInfo = async () => {
|
||||
console.log('queryCodeParams', queryCodeParams.value)
|
||||
const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
//查看是否是该规格型号
|
||||
const getMaInfoScan = async () => {
|
||||
const res = await getCodeScanAPI(queryCodeParams.value)
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
if (res.rows && res.rows.length > 0) {
|
||||
codeData.value = res.rows[0]
|
||||
if (res.data && res.data.recordList.length > 0) {
|
||||
// codeData.value = res.rows[0]
|
||||
queryCodeParams.value.maCode = res.data.recordList[0].maCode
|
||||
codeData.value = res.data.recordList[0]
|
||||
uni.showToast({ title: res.data.msg, icon: 'none'})
|
||||
}else{
|
||||
uni.showToast({ title: res.data.msg, icon: 'none'})
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: '未查询到该编码', icon: 'none' })
|
||||
uni.showToast({ title: res.data.msg, icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// //根据编码获取设备类型
|
||||
// const getMaInfo = async () => {
|
||||
// console.log('queryCodeParams', queryCodeParams.value)
|
||||
// const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
// console.log(res)
|
||||
// if (res.code == 200) {
|
||||
// if (res.rows && res.rows.length > 0) {
|
||||
// codeData.value = res.rows[0]
|
||||
// } else {
|
||||
// uni.showToast({ title: '未查询到该编码', icon: 'none' })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 出库按钮
|
||||
const onHandleOutbound = async () => {
|
||||
// 组装出库参数
|
||||
const paramsList = [codeData.value]
|
||||
let paramsList = []
|
||||
paramsList.push({
|
||||
maCode: codeData.value.maCode,
|
||||
maId: codeData.value.maId,
|
||||
leaseType:0,
|
||||
outType:2,
|
||||
outNum:1,
|
||||
typeId:codeData.value.typeId,
|
||||
manageType: codeData.value.manageType,
|
||||
parentId: queryParams.value.parentId,
|
||||
typeName: codeData.value.typeName,
|
||||
typeModelName: codeData.value.typeModelName,
|
||||
})
|
||||
|
||||
console.log('333333333', paramsList)
|
||||
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '出库成功!',
|
||||
icon: 'none',
|
||||
})
|
||||
queryParams.value.alNum = queryParams.value.alNum + 1
|
||||
queryCodeParams.value.maCode = ''
|
||||
codeData.value = {}
|
||||
codeNum.value = codeNum.value + 1
|
||||
uni.$emit('onUpdate', codeNun.value)
|
||||
// codeNum.value = codeNum.value + 1
|
||||
// uni.$emit('onUpdate', codeNun.value)
|
||||
}
|
||||
}
|
||||
// 页面加载完毕
|
||||
|
|
@ -184,6 +244,21 @@ onShow(() => {
|
|||
// scanStart()
|
||||
}, 500)
|
||||
})
|
||||
|
||||
// 监听返回事件
|
||||
// onBackPress(() => {
|
||||
// // 跳转到固定页面
|
||||
// // uni.redirectTo({
|
||||
// // url: '/pages/fixed-page/fixed-page' // 替换为你要跳转的固定页面路径
|
||||
// // });
|
||||
// console.log('2222222222222222222',queryParams.value.id)
|
||||
// uni.redirectTo({
|
||||
// url: `/pages/picking/outbound/code-outbound?queryParams=${JSON.stringify(queryParams.value)}`
|
||||
// });
|
||||
// // 返回 true 表示阻止默认返回行为
|
||||
// return true;
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<!-- 编码出库-->
|
||||
<view class="page-container">
|
||||
<!-- 表单信息区域 -->
|
||||
<scroll-view scroll-y style="height: 100vh;">
|
||||
<view class="form-section">
|
||||
<view class="section-header" @tap="toggleForm">
|
||||
<text class="title">表单信息</text>
|
||||
|
|
@ -62,6 +63,7 @@
|
|||
</uni-row>
|
||||
</view>
|
||||
|
||||
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" style="padding-bottom: 90rpx">
|
||||
<view class="table-list-item" v-for="item in codeDeviceList" :key="item.maId">
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -114,17 +116,16 @@
|
|||
{{ finish ? '没有更多数据了~' : '正在加载...' }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</scroll-view>
|
||||
<view class="outbound-btn" @tap="onHandleOutbound"> 出库 </view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow, } from '@dcloudio/uni-app'
|
||||
import { getCodeDeviceListAPI, setOutboundNumAPI } from '@/services/picking/outbound.js'
|
||||
import { getBoxBindByCode } from '@/services/standard.js'
|
||||
import { onBackPress } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
// const query = defineProps() // 获取上级页面传递的路由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
|
|
@ -250,8 +251,10 @@ const maxNum = ref(0)
|
|||
const getCodeDeviceListData = async () => {
|
||||
console.log('queryCodeParams', queryCodeParams.value)
|
||||
const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
console.log('xxxxxxxxxxxxxxx', )
|
||||
console.log('333132133', res)
|
||||
codeDeviceList.value.push(...res.rows)
|
||||
|
||||
console.log('21313131',codeDeviceList.value)
|
||||
if (codeDeviceList.value.length > 0) {
|
||||
codeDeviceList.value = codeDeviceList.value.map((e) => {
|
||||
return { ...e, checked: false }
|
||||
|
|
@ -346,7 +349,7 @@ const onHandleOutbound = async () => {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
console.log()
|
||||
const res = await setOutboundNumAPI({ leaseOutDetailsList: paramsList })
|
||||
|
||||
if (res.code === 200) {
|
||||
|
|
@ -376,10 +379,17 @@ onLoad((options) => {
|
|||
|
||||
})
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
console.log('111111111111111111111',queryParams.value.id)
|
||||
maxNum.value = queryParams.value.preNum - queryParams.value.alNum
|
||||
queryCodeParams.value.typeId = queryParams.value.typeId
|
||||
getCodeDeviceListData()
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
// 重新计算 maxNum 的值
|
||||
maxNum.value = queryParams.value.preNum - queryParams.value.alNum
|
||||
})
|
||||
|
||||
// 页面销毁时移除事件监听
|
||||
onUnmounted(() => {
|
||||
uni.$off('onUpdate') // 移除事件监听
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ import { ref, computed } from 'vue'
|
|||
import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
|
||||
import { onBackPress } from '@dcloudio/uni-app';
|
||||
const total = ref(0) // 数据总量
|
||||
const active = ref(1) // tap索引
|
||||
const tableList = ref([]) // 列表数据源
|
||||
|
|
|
|||
|
|
@ -39,3 +39,10 @@ export const getCodeDeviceListAPI = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
export const getCodeScanAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/lease_apply_info/getInfoByQrcode',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue