手持机
This commit is contained in:
@@ -1,19 +1,29 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="input-group">
|
||||
<uni-easyinput
|
||||
v-model="trayCode"
|
||||
:placeholder="$t('outbound.ckMakeSureByTray.trayCodePlaceholder')"
|
||||
:clearable="true"
|
||||
@input="handleInput"
|
||||
@clear="handleClear"
|
||||
ref="trayCodeInput"
|
||||
>
|
||||
<template #right>
|
||||
<text class="scan-icon" @click="handleScan">📷</text>
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
<view class="input-group">
|
||||
<uni-easyinput
|
||||
v-model="trayCode"
|
||||
:placeholder="$t('outbound.ckMakeSureByTray.trayCodePlaceholder')"
|
||||
:clearable="true"
|
||||
@input="handleInput"
|
||||
@clear="handleClear"
|
||||
ref="trayCodeInput"
|
||||
>
|
||||
<template #right>
|
||||
<text class="scan-icon" @click="handleScan">📷</text>
|
||||
</template>
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 条件显示出口下拉框 -->
|
||||
<view class="select-group" v-if="showEntrySelect">
|
||||
<view class="select-label">{{ $t('outbound.ckMakeSureByTray.exit') }}</view>
|
||||
<uni-data-select
|
||||
v-model="selectedEntry"
|
||||
:localdata="entryOptions"
|
||||
:placeholder=" $t('outbound.ckMakeSureByTray.exitPlaceholder')"
|
||||
></uni-data-select>
|
||||
</view>
|
||||
|
||||
<view class="loading-container" v-if="loading">
|
||||
<uni-load-more status="loading" :content-text="{contentdown: $t('outbound.ckMakeSureByTray.loading'),contentrefresh: $t('outbound.ckMakeSureByTray.loading'),contentnomore: $t('outbound.ckMakeSureByTray.noMoreData')}"></uni-load-more>
|
||||
@@ -69,19 +79,48 @@
|
||||
return {
|
||||
trayCode: '',
|
||||
materialList: [],
|
||||
loading: false
|
||||
loading: false,
|
||||
showEntrySelect: false,
|
||||
entryOptions: [],
|
||||
selectedEntry: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理输入事件
|
||||
handleInput(value) {
|
||||
async handleInput(value) {
|
||||
if (value) {
|
||||
this.fetchTrayInfo(value)
|
||||
await this.fetchTrayInfo(value)
|
||||
const first = this.materialList && this.materialList.length > 0 ? this.materialList[0] : null
|
||||
if (first && (first.warehouseId === '02' || first.warehouseId === '13')) {
|
||||
this.showEntrySelect = true
|
||||
if (first.warehouseId === '02') {
|
||||
this.entryOptions = [
|
||||
{ text: 'G1001', value: 'G1001' },
|
||||
{ text: 'G1007', value: 'G1007' }
|
||||
]
|
||||
} else {
|
||||
this.entryOptions = [
|
||||
{ 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.showEntrySelect = false
|
||||
this.entryOptions = []
|
||||
this.selectedEntry = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
// 处理清除事件
|
||||
handleClear() {
|
||||
this.materialList = []
|
||||
this.showEntrySelect = false
|
||||
this.entryOptions = []
|
||||
this.selectedEntry = ''
|
||||
},
|
||||
// 处理扫码事件
|
||||
handleScan() {
|
||||
@@ -131,10 +170,20 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 当入口下拉框显示时,校验是否选择了入口
|
||||
if (this.showEntrySelect && !this.selectedEntry) {
|
||||
uni.showToast({
|
||||
title: this.$t('outbound.ckMakeSureByTray.selectExit'),
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const response=await ckMakeSure({
|
||||
trayCode: this.trayCode
|
||||
trayCode: this.trayCode,
|
||||
exitId: this.selectedEntry
|
||||
|
||||
})
|
||||
if (response.code==200) {
|
||||
@@ -145,14 +194,17 @@
|
||||
// 清空数据
|
||||
this.trayCode = ''
|
||||
this.materialList = []
|
||||
this.showEntrySelect = false
|
||||
this.entryOptions = []
|
||||
this.selectedEntry = ''
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: response.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: this.$t('outbound.ckMakeSureByTray.outboundFailed'),
|
||||
@@ -178,6 +230,19 @@
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user