442 lines
9.2 KiB
Vue
442 lines
9.2 KiB
Vue
<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="#1890ff"></uni-icons>
|
||
<text class="scan-btn-text">扫码</text>
|
||
</view>
|
||
</view>
|
||
<view class="input-wrap">
|
||
<input class="scan-input" v-model="barcode" placeholder="请输入或扫描版辊编号"
|
||
@confirm="handleBarcode" />
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 当前扫码物料信息(待添加) -->
|
||
<view class="form-section" v-if="currentMaterial">
|
||
<text class="form-title">物料信息</text>
|
||
<!-- <view class="info-row">
|
||
<text class="info-label">物料编码</text>
|
||
<text class="info-value">{{ currentMaterial.productId }}</text>
|
||
</view>
|
||
<view class="info-row">
|
||
<text class="info-label">物料名称</text>
|
||
<text class="info-value">{{ currentMaterial.productName }}</text>
|
||
</view> -->
|
||
<view class="info-row">
|
||
<text class="info-label">辊号</text>
|
||
<text class="info-value">{{ currentMaterial.rollerNumber }}</text>
|
||
</view>
|
||
<view class="info-row">
|
||
<text class="info-label">托盘号</text>
|
||
<text class="info-value">{{ currentMaterial.trayCode }}</text>
|
||
</view>
|
||
|
||
<view class="form-item">
|
||
<text class="form-label">绑定数量</text>
|
||
<input class="form-input" v-model="currentQty" disabled type="number" placeholder="请输入绑定数量" />
|
||
</view>
|
||
|
||
</view>
|
||
|
||
|
||
<!-- 操作按钮 -->
|
||
<view class="btn-section">
|
||
<button class="btn btn-danger" :disabled="!this.barcode || this.barcode.trim() === ''" @click="submitCancelTrayAction">
|
||
确认取消绑定<!-- ({{ items.length }} 种物料) -->
|
||
</button>
|
||
|
||
<button class="btn btn-default" @click="resetAll">全部重置</button>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { getMaterialByDetailId, getTrayMsgByRollerNumber, submitCancelTray, submitCancelTrayMsg } from '@/api/warehouse/inbound'
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
taskNo: '',
|
||
trayCode: '',
|
||
// 当前扫码
|
||
barcode: '',
|
||
currentMaterial: null,
|
||
currentQty: '',
|
||
// 已加入列表的物料
|
||
items: []
|
||
}
|
||
},
|
||
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()
|
||
}
|
||
})
|
||
},
|
||
|
||
// 根据入库明细ID查询物料
|
||
handleBarcode() {
|
||
if (!this.barcode) {
|
||
// this.$modal.msg('请输入入库子单号')
|
||
this.$modal.msg('请输入版辊信息')
|
||
return
|
||
}
|
||
var that = this
|
||
getTrayMsgByRollerNumber(this.barcode).then(function(res) {
|
||
that.currentMaterial = res.data
|
||
that.currentQty = res.data.quantity ? String(res.data.quantity) : ''
|
||
that.$modal.msgSuccess('物料信息获取成功')
|
||
}).catch(function() {
|
||
that.currentMaterial = null
|
||
that.currentQty = ''
|
||
|
||
})
|
||
},
|
||
|
||
|
||
// 从列表中移除某条物料
|
||
removeItem(index) {
|
||
this.items.splice(index, 1)
|
||
},
|
||
|
||
// 提交绑盘
|
||
submitCancelTrayAction() {
|
||
if (!this.barcode || this.barcode.trim() === "") {
|
||
this.$modal.msg('请输入辊号')
|
||
return
|
||
}
|
||
var data = {
|
||
barcode: this.barcode,
|
||
items: this.items.map(function(i) {
|
||
return {
|
||
stockinDetailId: i.stockinDetailId,
|
||
productId: i.rollerNumber,
|
||
rollerNumber: i.rollerNumber,
|
||
colorSequence: i.colorSequence,
|
||
color: i.color,
|
||
spec: i.spec,
|
||
quantity: i.quantity
|
||
}
|
||
})
|
||
}
|
||
var that = this
|
||
// submitBindTray(data).then(function(res) {
|
||
submitCancelTrayMsg(this.barcode).then(function(res) {
|
||
that.$modal.msgSuccess(res.msg || '入库绑盘信息已作废')
|
||
that.resetAll()
|
||
}).catch(function() {})
|
||
},
|
||
|
||
// 全部重置
|
||
resetAll() {
|
||
this.trayCode = ''
|
||
this.barcode = ''
|
||
this.currentMaterial = null
|
||
this.currentQty = ''
|
||
this.items = []
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
page {
|
||
background-color: #f5f7fa;
|
||
min-height: 100%;
|
||
}
|
||
|
||
.page-container {
|
||
padding: 24rpx;
|
||
padding-bottom: 60rpx;
|
||
}
|
||
|
||
/* 任务信息 */
|
||
.task-info {
|
||
background: #e6f7ff;
|
||
border-radius: 12rpx;
|
||
padding: 20rpx 24rpx;
|
||
margin-bottom: 24rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.task-label {
|
||
font-size: 26rpx;
|
||
color: #1890ff;
|
||
}
|
||
|
||
.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 #1890ff;
|
||
border-radius: 8rpx;
|
||
}
|
||
|
||
.scan-btn-text {
|
||
font-size: 24rpx;
|
||
color: #1890ff;
|
||
margin-left: 8rpx;
|
||
}
|
||
|
||
.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 */
|
||
.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;
|
||
display: block;
|
||
}
|
||
|
||
.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;
|
||
word-break: break-all;
|
||
min-width: 0;
|
||
height: auto;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
.info-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 16rpx 0;
|
||
border-bottom: 1rpx solid #f5f5f5;
|
||
}
|
||
|
||
.info-label {
|
||
font-size: 28rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.info-value {
|
||
font-size: 28rpx;
|
||
color: #333;
|
||
}
|
||
|
||
/* 加入列表按钮 */
|
||
.btn-add {
|
||
margin-top: 24rpx;
|
||
background: #1890ff;
|
||
color: #fff;
|
||
border-radius: 12rpx;
|
||
font-size: 28rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 20rpx 0;
|
||
border: none;
|
||
}
|
||
|
||
.btn-add-text {
|
||
font-size: 28rpx;
|
||
color: #fff;
|
||
margin-left: 8rpx;
|
||
}
|
||
|
||
/* 已添加物料列表 */
|
||
.list-section {
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.section-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 30rpx;
|
||
font-weight: 500;
|
||
color: #333;
|
||
}
|
||
|
||
.item-card {
|
||
background: #fff;
|
||
border-radius: 16rpx;
|
||
padding: 24rpx 28rpx;
|
||
margin-bottom: 16rpx;
|
||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.item-body {
|
||
flex: 1;
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.item-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 8rpx 0;
|
||
}
|
||
|
||
.item-label {
|
||
font-size: 26rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.item-value {
|
||
font-size: 26rpx;
|
||
color: #333;
|
||
}
|
||
|
||
.item-value.highlight {
|
||
color: #1890ff;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.item-delete {
|
||
padding: 8rpx;
|
||
}
|
||
|
||
/* 空状态 */
|
||
.empty-state {
|
||
background: #fff;
|
||
border-radius: 16rpx;
|
||
padding: 60rpx 0;
|
||
margin-bottom: 24rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.empty-text {
|
||
font-size: 28rpx;
|
||
color: #ccc;
|
||
}
|
||
|
||
/* 底部按钮 */
|
||
.btn-section {
|
||
padding: 8rpx 0 24rpx;
|
||
}
|
||
|
||
.btn {
|
||
font-size: 30rpx;
|
||
border-radius: 12rpx;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.btn-primary {
|
||
background: #1890ff;
|
||
color: #fff;
|
||
}
|
||
|
||
.btn-danger {
|
||
background: #d42427;
|
||
color: #fff;
|
||
}
|
||
|
||
.btn-success {
|
||
background: #0fe825;
|
||
color: #fff;
|
||
}
|
||
|
||
.btn-primary[disabled] {
|
||
background: #b0d4f5;
|
||
color: #fff;
|
||
}
|
||
|
||
.btn-default {
|
||
background: #fff;
|
||
color: #666;
|
||
border: 1rpx solid #d9d9d9;
|
||
}
|
||
</style>
|