Files
FT501-WMS/RuoYi-App-master/pages/out/errorout.vue
张怡蓉 3beb3aeb44 手持机
2025-08-11 17:30:56 +08:00

196 lines
4.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="container">
<view class="input-group">
<uni-easyinput
v-model="trayCode"
:placeholder="$t('outbound.exception.trayCodePlaceholder')"
:clearable="true"
@input="handleInput"
@clear="handleClear"
ref="trayCodeInput"
>
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
<view class="table-container" v-if="materialList.length > 0">
<uni-card v-for="(item, index) in materialList" :key="index" class="material-card">
<view class="card-content">
<view class="info-row">
<text class="label">{{ $t('outbound.exception.materialCode') }}:</text>
<text class="value">{{ item.productId }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('outbound.exception.materialName') }}:</text>
<text class="value">{{ item.extraField.materialDesc }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('outbound.exception.outQuantity') }}:</text>
<text class="value">{{ item.outQuantity }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('outbound.exception.pickQuantity') }}:</text>
<text class="value">{{ item.pickQuantity }}</text>
</view>
</view>
</uni-card>
</view>
<view class="button-group" v-if="materialList.length > 0">
<button class="submit-button" @click="handleSubmit">{{ $t('outbound.exception.submit') }}</button>
</view>
</view>
</template>
<script>
import { getTaskDetail,submitError} from '@/api/out/productOut.js'
export default {
onReady() {
setTimeout(() => {
this.$nextTick(() => {
this.$refs.trayCodeInput.onFocus()
})
}, 100)
},
data() {
return {
trayCode: '',
materialList: []
}
},
methods: {
// 处理输入事件
async handleInput(value) {
if (value) {
try {
const response = await getTaskDetail({trayCode: value,inOut:'2'})
if (response.code === 200) {
this.materialList = response.data || []
} else {
uni.showToast({
title: response.msg || this.$t('common.noData'),
icon: 'none'
})
}
} catch (error) {
console.error(this.$t('outbound.exception.getTrayInfoFailed'), error)
uni.showToast({
title: this.$t('outbound.exception.getTrayInfoFailed'),
icon: 'none'
})
}
}
},
// 处理清除事件
handleClear() {
this.materialList = []
},
// 处理扫码事件
handleScan() {
uni.scanCode({
success: (res) => {
this.trayCode = res.result
this.handleInput(res.result)
}
})
},
// 处理提交事件
async handleSubmit() {
if (!this.materialList.length) {
uni.showToast({
title: this.$t('outbound.exception.scanTrayFirst'),
icon: 'none'
})
return
}
try {
const response = await submitError({
trayCode: this.trayCode
})
if (response.code === 200) {
uni.showToast({
title: this.$t('outbound.exception.submitSuccess'),
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
} else {
uni.showToast({
title: response.msg || this.$t('outbound.exception.submitFailed'),
icon: 'none'
})
}
} catch (error) {
console.error(this.$t('outbound.exception.submitFailed'), error)
uni.showToast({
title: this.$t('outbound.exception.submitFailed'),
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss">
.container {
padding: 20rpx;
}
.input-group {
margin-bottom: 20rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;
}
.table-container {
margin-top: 20rpx;
}
.material-card {
margin-bottom: 20rpx;
}
.card-content {
.info-row {
display: flex;
margin-bottom: 10rpx;
.label {
color: #666;
width: 160rpx;
}
.value {
color: #333;
flex: 1;
}
}
}
.button-group {
margin-top: 40rpx;
padding: 0 20rpx;
}
.submit-button {
background-color: #007aff;
color: #fff;
border-radius: 8rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 32rpx;
}
.submit-button:active {
background-color: #0056b3;
}
</style>