手持机

This commit is contained in:
张怡蓉
2025-10-15 08:45:28 +08:00
parent b884a7164e
commit 38ab04cc79
10 changed files with 233 additions and 204 deletions

View File

@@ -12,8 +12,18 @@
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
</uni-easyinput>
</view>
<!-- 条件显示出口下拉框 -->
<view class="select-group" v-if="showExitSelect">
<view class="select-label">出口</view>
<uni-data-select
v-model="selectedExit"
:localdata="exitOptions"
placeholder="请选择出口"
></uni-data-select>
</view>
<view class="materials-list" v-if="materialList.length > 0">
<button class="add-button" @click="showAddMaterialPopup">{{ $t('stocktaking.confirm.addMaterial') }}</button>
@@ -79,7 +89,11 @@
newMaterial: {
productId: '',
inQuantity: ''
}
},
// 出口选择
showExitSelect: false,
exitOptions: [],
selectedExit: ''
}
},
methods: {
@@ -92,6 +106,9 @@
// 处理清除事件
handleClear() {
this.materialList = []
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
},
// 处理扫码事件
handleScan() {
@@ -110,6 +127,31 @@
...item,
countQuantity: item.outQuantity
}))
// 根据首条物料的仓库,决定是否显示出口选择
const first = this.materialList && this.materialList.length > 0 ? this.materialList[0] : null
if (first && (first.warehouseId === '02' || first.warehouseId === '13')) {
this.showExitSelect = true
if (first.warehouseId === '02') {
this.exitOptions = [
{ text: 'G1001', value: 'G1001' },
{ text: 'G1007', value: 'G1007' }
]
} else {
this.exitOptions = [
{ text: 'G4004', value: 'G4004' },
{ text: 'G4005', value: 'G4005' },
{ text: 'G4006', value: 'G4006' },
{ text: 'G5004', value: 'G5004' },
{ text: 'G5005', value: 'G5005' },
{ text: 'G5006', value: 'G5006' }
]
}
} else {
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
}
} catch (error) {
uni.showToast({
title: this.$t('stocktaking.confirm.getTrayInfoFailed'),
@@ -158,8 +200,17 @@
// 确认盘点
async handleConfirm() {
try {
// 出口显示时必须选择
if (this.showExitSelect && !this.selectedExit) {
uni.showToast({
title: '请选择出口',
icon: 'none'
})
return
}
const data = {
trayCode: this.trayCode,
exitId: this.selectedExit,
materials: this.materialList.map(item => ({
stockId: item.stockId,
productId:item.productId,
@@ -173,10 +224,13 @@
uni.showToast({
title: this.$t('stocktaking.confirm.stocktakingSuccess'),
icon: 'success'
})
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.showExitSelect = false
this.exitOptions = []
this.selectedExit = ''
}
@@ -213,6 +267,19 @@
}
}
.select-group {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
}
.select-label {
font-size: 28rpx;
color: #666;
margin-bottom: 16rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;