手持机

This commit is contained in:
张怡蓉
2025-10-09 09:57:55 +08:00
parent b4a8569e36
commit 3581436d6c
3 changed files with 170 additions and 29 deletions

View File

@@ -126,6 +126,29 @@
</view>
</view>
</uni-popup>
<!-- 入口选择弹出框 -->
<uni-popup ref="entrancePopup" type="center">
<view class="popup-content">
<view class="popup-title">选择入口</view>
<view class="popup-body">
<view class="input-group">
<text class="input-label">入口</text>
<picker @change="handleEntranceChange" :value="selectedEntranceIndex" :range="entranceList" range-key="name">
<view class="picker-input">
<text v-if="selectedEntrance">{{ selectedEntrance }}</text>
<text v-else class="placeholder-text">请选择入口</text>
<text class="picker-arrow">▼</text>
</view>
</picker>
</view>
</view>
<view class="popup-buttons">
<button class="popup-btn confirm-btn" @click="handleConfirmEntrance" :disabled="!selectedEntrance" :class="{'disabled-btn': !selectedEntrance}">确认</button>
<button class="popup-btn cancel-btn" @click="handleCancelEntrance">取消</button>
</view>
</view>
</uni-popup>
</view>
</template>
@@ -146,6 +169,11 @@
cargoSpaceName: '',
cargoSpaceList: [],
cargoSpaceHeight: null,
// 入口选择相关
entranceList: [],
selectedEntrance: '',
selectedEntranceId: '',
selectedEntranceIndex: 0,
}
},
@@ -159,6 +187,25 @@
},
methods: {
// 根据仓库ID获取入口列表
getEntranceListByWarehouseId(warehouseId) {
this.entranceList = []
this.selectedEntrance = ''
this.selectedEntranceId = ''
this.selectedEntranceIndex = 0
if (warehouseId === '02') {
this.entranceList = [
{ id: 'G1001', name: 'G1001' },
{ id: 'G1007', name: 'G1007' }
]
} else if (warehouseId === '13') {
this.entranceList = [
{ id: 'G3006', name: 'G3006' },
{ id: 'G1001', name: 'G1001' }
]
}
},
// 处理货位选择
async handleRecommendCargoSpace() {
@@ -310,40 +357,20 @@
}
const warehouseType = this.materialList[0].warehouseType
const warehouseId = this.materialList[0].warehouseId
if (warehouseType === '1') {
// 显示货位选择弹出框
this.$refs.cargoSpacePopup.open()
} else {
// 非货位类型仓库,直接调用入库接口
try {
const response = await addInJob({
trayCode: this.trayCode,
warehouseId: this.materialList[0].warehouseId
})
if (response.code === 200) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundSuccess'),
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.stockinDetailId=''
// this.cargoSpaceId = ''
} else {
uni.showToast({
title: response.msg || this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
// 非货位类型仓库,显示入口选择弹出框
this.getEntranceListByWarehouseId(warehouseId)
if (this.entranceList.length > 0) {
this.$refs.entrancePopup.open()
} else {
// 如果没有配置入口,直接调用入库接口
this.submitWithoutCargoSpace()
}
}
},
@@ -366,6 +393,98 @@
this.cargoSpaceName = ''
this.cargoSpaceHeight=''
},
// 处理入口选择变化
handleEntranceChange(e) {
const index = e.detail.value
this.selectedEntranceIndex = index
if (this.entranceList[index]) {
this.selectedEntrance = this.entranceList[index].name
this.selectedEntranceId = this.entranceList[index].id
}
},
// 处理确认入口选择
async handleConfirmEntrance() {
if (!this.selectedEntranceId) {
uni.showToast({
title: '请选择入口',
icon: 'none'
})
return
}
this.$refs.entrancePopup.close()
this.submitWithEntrance()
},
// 处理取消入口选择
handleCancelEntrance() {
this.$refs.entrancePopup.close()
this.selectedEntrance = ''
this.selectedEntranceId = ''
this.selectedEntranceIndex = 0
},
// 不带货位信息提交入库
async submitWithoutCargoSpace() {
try {
const response = await addInJob({
trayCode: this.trayCode,
warehouseId: this.materialList[0].warehouseId
})
if (response.code === 200) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundSuccess'),
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.stockinDetailId = ''
} else {
uni.showToast({
title: response.msg || this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
}
},
// 带入口信息提交入库
async submitWithEntrance() {
try {
const response = await addInJob({
trayCode: this.trayCode,
warehouseId: this.materialList[0].warehouseId,
entranceId: this.selectedEntranceId
})
if (response.code === 200) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundSuccess'),
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
this.stockinDetailId = ''
this.selectedEntrance = ''
this.selectedEntranceId = ''
this.selectedEntranceIndex = 0
} else {
uni.showToast({
title: response.msg || this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('inbound.bindMsg.inboundFailed'),
icon: 'none'
})
}
},
// 处理子单据输入事件
async handleSubOrderInput(value) {
if (value) {
@@ -724,4 +843,25 @@
color: #999;
font-size: 28rpx;
}
.picker-input {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx;
border: 1px solid #ddd;
border-radius: 6rpx;
background-color: #fff;
min-height: 60rpx;
}
.placeholder-text {
color: #999;
font-size: 28rpx;
}
.picker-arrow {
color: #666;
font-size: 24rpx;
}
</style>