Files
FT577-WMS/pda/pages/warehouse/inventory/inventoryConfirm.vue
2026-09-16 11:28:04 +08:00

409 lines
9.3 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="page-container">
<!-- 任务信息 -->
<view class="task-info" v-if="taskNo">
<text class="task-label">出库任务编号</text>
<text class="task-value">{{ taskNo }}</text>
</view>
<!-- 扫码区域 -->
<view class="scan-section">
<view class="scan-header">
<text class="scan-title">扫描盘点出库托盘条码</text>
<view class="scan-btn" @click="startScan">
<uni-icons type="scan" size="18" color="#fa8c16"></uni-icons>
<text class="scan-btn-text orange">扫码</text>
</view>
</view>
<view class="input-wrap">
<input class="scan-input" v-model="barcode" placeholder="请输入或扫描托盘条码"
@confirm="handleBarcode" focus />
</view>
</view>
<!-- 出库信息 -->
<view class="form-section" v-for="(item, index) in outInventoryList" :key="index">
<view class="scan-header">
<text class="scan-title">库存信息</text>
<view class="info-btn">
<button class="scan-btn-text red" @click="confirmStockException(item)">异常标记</button>
</view>
</view>
<view class="info-row">
<text class="info-label">版辊编号</text>
<text class="info-value">{{ item.rollerNumber }}</text>
</view>
<view class="info-row">
<text class="info-label">托盘库存数量</text>
<text class="info-value">{{ item.quantity }}</text>
</view>
<view class="info-row">
<text class="info-label">确认状态</text>
<text class="info-value">{{ productDetailStatusMap[item.productStatus] || '未知状态' }}</text>
</view>
</view>
<!-- 操作按钮 -->
<view class="btn-section" >
<button class="btn btn-orange" v-if="outInventoryList" @click="inventoryComplete">盘点出库确认</button>
<!-- <button class="btn btn-green" v-if="outInventoryList" @click="stockoutCompleteAll">一键确认出库</button> -->
<button class="btn btn-default" @click="resetForm">重置</button>
</view>
</view>
</template>
<script>
import { getInventoryOutTaskList, getTrayCodeDetail, confirmExcetion, inventoryTrayCodeComplete } from '@/api/warehouse/inventory'
export default {
data() {
return {
taskNo: '',
barcode: '',
traCode: '',
outInventoryInfo: null,
outInventoryList: [],
confirmQty: '',
form: {
remark: ''
},
productDetailStatusMap: {
1: '正常',
2: '异常产品',
},
}
},
onLoad(options) {
if (options.taskNo) {
this.taskNo = options.taskNo
}
},
methods: {
startScan() {
var that = this
uni.scanCode({
onlyFromCamera: false,
scanType: ['barCode', 'qrCode'],
success: function(res) {
that.barcode = res.result
that.handleBarcode()
}
})
},
handleBarcode() {
if (!this.barcode) {
this.$modal.msg('请输入托盘条码')
return
}
var that = this
// var params = { taskNo: this.taskNo, barcode: this.barcode }
var params = { barcode: this.barcode }
getTrayCodeDetail(this.barcode).then(function(res) {
if (Array.isArray(res.data)) {
that.outInventoryList = res.data
} else if (res.data) {
that.outInventoryList = [res.data]
} else {
that.outInventoryList = []
}
if (that.outInventoryList.length > 0) {
that.$modal.msgSuccess('获取到 ' + that.outInventoryList.length + ' 条库存信息')
} else {
that.$modal.msg('未找到该托盘信息')
}
}).catch(function() {
that.outInventoryList = []
that.$modal.msg('找不到托盘明细信息,可能是任务类型不符或已确认出库完成')
})
},
// 更新库存的产品状态
confirmStockException(item) {
// 构造你需要的参数
var params = {
barcode: item.rollerNumber,
productStatus: item.productStatus
}
uni.showLoading({ title: '提交中...' })
// TODO: 替换为你实际的后端确认接口
confirmExcetion(params).then(res => {
uni.hideLoading()
this.$modal.msgSuccess('版辊 ' + item.rollerNumber + ' 标记为异常产品')
handleBarcode()
// 可选:出库成功后从列表中移除该项,避免重复点击
this.outInventoryList = this.outInventoryList.filter(i => i.rollerNumber !== item.rollerNumber)
}).catch(err => {
// uni.hideLoading()
// this.$modal.msg('出库失败', err)
})
},
//托盘物料盘点完成确认回流
inventoryComplete() {
if (!this.barcode) {
this.$modal.msg('请输入托盘号')
return
}
var data = {
// taskNo: this.taskNo,
barcode: this.barcode,
}
// console.log(this.barcode)
inventoryTrayCodeComplete(data).then(() => {
this.$modal.msgSuccess(this.barcode + '盘点出库确认成功')
this.resetForm()
}).catch(() => {
// 全局拦截器通常已处理错误弹窗,这里可只处理状态重置
// console.log('出库确认失败')
})
},
resetForm() {
this.barcode = ''
this.outInventoryInfo = null
this.outInventoryList = []
this.confirmQty = ''
this.form = {
remark: ''
}
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #f5f7fa;
min-height: 100%;
}
.page-container {
padding: 24rpx;
}
.task-info {
background: #fff7e6;
border-radius: 12rpx;
padding: 20rpx 24rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.task-label {
font-size: 26rpx;
color: #fa8c16;
}
.task-value {
font-size: 26rpx;
color: #333;
font-weight: 500;
}
.scan-section {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.scan-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.scan-title {
font-size: 30rpx;
font-weight: 500;
color: #333;
}
.scan-btn {
display: flex;
align-items: center;
padding: 8rpx 20rpx;
border: 1rpx solid #fa8c16;
border-radius: 8rpx;
}
.scan-btn-text {
font-size: 24rpx;
margin-left: 8rpx;
}
.scan-btn-text.orange {
color: #fa8c16;
}
.scan-btn-text.green {
color: #fff;
background-color: #00aa00;
}
.scan-btn-text.red {
color: #fff;
background-color: #ef494c;
}
.input-wrap {
border: 1rpx solid #e8e8e8;
border-radius: 8rpx;
padding: 4rpx;
}
.scan-input {
font-size: 28rpx;
padding: 16rpx;
word-break: break-all;
width: 100%;
height: auto;
line-height: 1.4;
}
.form-section {
background: #fff;
border-radius: 16rpx;
padding: 28rpx;
margin-bottom: 24rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.form-title {
font-size: 30rpx;
font-weight: 500;
color: #333;
margin-bottom: 24rpx;
padding-bottom: 16rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.form-section-input {
flex: 1;
font-size: 28rpx; /* ✅ 关键:字体大小必须与 label 一致 */
color: #333;
text-align: right; /* ✅ 关键:内容靠右对齐 */
height: 28rpx; /* ✅ 关键:明确设置高度 */
line-height: 28rpx; /* ✅ 关键:行高必须与 label 完全一致,解决多端对齐差异 */
padding: 0; /* ✅ 关键:清除 input 默认的 padding,防止错位 */
margin: 0; /* 清除默认 margin */
border: none; /* 如果需要无边框效果 */
}
.form-item {
display: flex;
align-items: center;
padding: 16rpx 0;
}
.form-label {
font-size: 28rpx;
color: #666;
width: 160rpx;
flex-shrink: 0;
}
.form-input {
flex: 1;
font-size: 28rpx;
border: 1rpx solid #e8e8e8;
border-radius: 8rpx;
padding: 16rpx;
width: 100%;
height: auto;
line-height: 1.4;
}
.info-row {
display: flex;
justify-content: space-between;
padding: 12rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.info-label {
font-size: 28rpx;
color: #999;
}
.info-value {
font-size: 28rpx;
color: #333;
}
.info-value.highlight {
color: #fa8c16;
font-weight: 500;
}
.btn-section {
padding: 24rpx 0;
}
.btn {
font-size: 30rpx;
border-radius: 12rpx;
margin-bottom: 20rpx;
}
.btn-orange {
background: #fa8c16;
color: #fff;
}
.btn-green {
background: #0cb306;
color: #fff;
}
.btn-default {
background: #fff;
color: #666;
border: 1rpx solid #d9d9d9;
}
/* ✅ 新增:按钮组容器,让两个按钮并排 */
.btn-group {
display: flex;
align-items: center;
margin-left: 16rpx; /* 与输入框的间距 */
margin-top: 10rpx;
}
/* 按钮基础样式(最大按钮) */
.btn-max {
font-size: 22rpx;
color: #fafafa;
background-color: #fa8c16;
border: 1rpx solid #fa8c16;
border-radius: 8rpx;
padding: 0 100rpx;
height: 50rpx;
line-height: 50rpx;
flex-shrink: 0;
}
/* ✅ 新增:重置按钮样式(与最大按钮之间留一点间距) */
.btn-reset {
color: #fa8c16;
margin-right: 12rpx;
background-color: #fff7e6;
}
</style>