373 lines
6.6 KiB
Vue
373 lines
6.6 KiB
Vue
<template>
|
||
<view class="container">
|
||
<view class="input-group">
|
||
<text class="input-label">仓库</text>
|
||
<uni-data-select
|
||
v-model="formData.warehouseId"
|
||
:localdata="warehouseList"
|
||
:clear="false"
|
||
placeholder="请选择仓库"
|
||
|
||
/>
|
||
</view>
|
||
<view class="input-group">
|
||
<text class="input-label">托盘条码:</text>
|
||
<uni-easyinput
|
||
v-model="formData.trayCode"
|
||
placeholder="请输入或扫码输入托盘条码"
|
||
:clearable="true"
|
||
@clear="handleClear"
|
||
@confirm="handleConfirm"
|
||
ref="trayCodeInput"
|
||
|
||
>
|
||
<template #right>
|
||
<text class="scan-icon" @click="handleScan">📷</text>
|
||
</template>
|
||
</uni-easyinput>
|
||
</view>
|
||
|
||
<view class="button-group">
|
||
<button class="submit-button" @click="handleSubmit">空托盘入库</button>
|
||
</view>
|
||
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { emptyTrayIn } from '@/api/in/ktpin.js'
|
||
import { getBasWarehouList,getCargoSpaceList } from '@/api/bas/bas.js'
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
formData: {
|
||
trayCode: '',
|
||
warehouseId: ''
|
||
|
||
},
|
||
warehouseList: []
|
||
|
||
}
|
||
},
|
||
onReady() {
|
||
setTimeout(() => {
|
||
this.$nextTick(() => {
|
||
this.$refs.trayCodeInput.onFocus()
|
||
})
|
||
}, 100)
|
||
|
||
// 获取仓库列表
|
||
this.getWarehouseList()
|
||
},
|
||
methods: {
|
||
// 获取仓库列表
|
||
async getWarehouseList() {
|
||
try {
|
||
const response = await getBasWarehouList({
|
||
pageNum:1,
|
||
pageSize:100,
|
||
warehouseType:1
|
||
|
||
})
|
||
if (response.code === 200) {
|
||
this.warehouseList = response.rows.map(item => ({
|
||
value: item.warehouseId,
|
||
text: item.warehouseName
|
||
// type: item.warehouseType
|
||
}))
|
||
}
|
||
} catch (error) {
|
||
console.error('获取仓库列表失败:', error)
|
||
uni.showToast({
|
||
title: '获取仓库列表失败',
|
||
icon: 'none'
|
||
})
|
||
}
|
||
},
|
||
|
||
handleClear() {
|
||
this.formData.trayCode = ''
|
||
},
|
||
handleConfirm() {
|
||
// 处理确认事件
|
||
},
|
||
handleScan() {
|
||
// 调用扫码功能
|
||
uni.scanCode({
|
||
success: (res) => {
|
||
this.formData.trayCode = res.result
|
||
}
|
||
})
|
||
},
|
||
|
||
async handleSubmit() {
|
||
if (!this.formData.trayCode) {
|
||
uni.showToast({
|
||
title: '请输入托盘条码',
|
||
icon: 'none'
|
||
})
|
||
return
|
||
}
|
||
// if (!this.formData.warehouseId) {
|
||
// uni.showToast({
|
||
// title: '请选择仓库',
|
||
// icon: 'none'
|
||
// })
|
||
// return
|
||
// }
|
||
|
||
await emptyTrayIn(this.formData).then(response => {
|
||
if (response.code === 200) {
|
||
uni.showToast({
|
||
title: '空托盘入库成功',
|
||
icon: 'success'
|
||
})
|
||
// 清空表单
|
||
this.formData = {
|
||
trayCode: '',
|
||
warehouseId: ''
|
||
|
||
}
|
||
// 重新聚焦到托盘条码输入框
|
||
setTimeout(() => {
|
||
this.$nextTick(() => {
|
||
this.$refs.trayCodeInput.onFocus()
|
||
})
|
||
}, 100)
|
||
} else {
|
||
uni.showToast({
|
||
title: response.msg || '入库操作失败',
|
||
icon: 'none'
|
||
})
|
||
}
|
||
}).catch(error => {
|
||
console.error('入库失败:', error)
|
||
uni.showToast({
|
||
title: '入库失败',
|
||
icon: 'none'
|
||
})
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.container {
|
||
padding: 30rpx;
|
||
background-color: #f8f9fc;
|
||
min-height: 100vh;
|
||
}
|
||
|
||
.input-group {
|
||
margin-bottom: 30rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.input-label {
|
||
font-size: 28rpx;
|
||
color: #333;
|
||
font-weight: 500;
|
||
width: 160rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
:deep(.uni-easyinput__content) {
|
||
background-color: #fff;
|
||
border-radius: 12rpx;
|
||
border: 2rpx solid #e8e8e8;
|
||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||
transition: all 0.3s ease;
|
||
|
||
&:focus-within {
|
||
border-color: #2979ff;
|
||
box-shadow: 0 4rpx 16rpx rgba(41, 121, 255, 0.1);
|
||
transform: translateY(-2rpx);
|
||
}
|
||
}
|
||
|
||
:deep(.uni-easyinput__content-input) {
|
||
height: 88rpx;
|
||
padding: 0 30rpx;
|
||
font-size: 28rpx;
|
||
}
|
||
}
|
||
|
||
.scan-icon {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 88rpx;
|
||
height: 88rpx;
|
||
font-size: 40rpx;
|
||
color: #2979ff;
|
||
transition: all 0.3s ease;
|
||
|
||
&:active {
|
||
transform: scale(0.9);
|
||
}
|
||
}
|
||
|
||
.button-group {
|
||
padding: 30rpx;
|
||
margin-top: 20rpx;
|
||
|
||
.submit-button {
|
||
width: 100%;
|
||
height: 88rpx;
|
||
line-height: 88rpx;
|
||
background-color: #2979ff;
|
||
color: #fff;
|
||
font-size: 32rpx;
|
||
border-radius: 12rpx;
|
||
box-shadow: 0 4rpx 16rpx rgba(41, 121, 255, 0.2);
|
||
transition: all 0.3s ease;
|
||
|
||
&:active {
|
||
transform: scale(0.98);
|
||
box-shadow: 0 2rpx 8rpx rgba(41, 121, 255, 0.2);
|
||
}
|
||
}
|
||
}
|
||
|
||
.cargo-info {
|
||
padding: 0 30rpx;
|
||
margin-top: 20rpx;
|
||
}
|
||
|
||
.cargo-content {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 20rpx;
|
||
}
|
||
|
||
.cargo-label {
|
||
font-size: 28rpx;
|
||
color: #666;
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.cargo-value {
|
||
font-size: 32rpx;
|
||
color: #333;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.table-container {
|
||
margin: 20rpx 30rpx;
|
||
background-color: #fff;
|
||
border-radius: 12rpx;
|
||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.selected-row {
|
||
background-color: #e6f0ff !important;
|
||
}
|
||
|
||
:deep(.uni-table-tr) {
|
||
cursor: pointer;
|
||
transition: all 0.3s ease;
|
||
|
||
&:hover {
|
||
background-color: #f5f7fa;
|
||
}
|
||
}
|
||
|
||
.cargo-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 20rpx;
|
||
padding: 20rpx;
|
||
}
|
||
|
||
.cargo-item {
|
||
background-color: #fff;
|
||
padding: 30rpx 20rpx;
|
||
text-align: center;
|
||
border-radius: 12rpx;
|
||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
||
transition: all 0.3s ease;
|
||
cursor: pointer;
|
||
|
||
&:active {
|
||
transform: scale(0.98);
|
||
}
|
||
}
|
||
|
||
.selected-item {
|
||
background-color: #e6f0ff;
|
||
border: 2rpx solid #2979ff;
|
||
transform: translateY(-2rpx);
|
||
box-shadow: 0 4rpx 16rpx rgba(41, 121, 255, 0.1);
|
||
}
|
||
|
||
.cargo-input-group {
|
||
flex: 1;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 20rpx;
|
||
|
||
:deep(.uni-easyinput__content) {
|
||
flex: 1;
|
||
}
|
||
}
|
||
|
||
.recommend-btn {
|
||
padding: 0 30rpx;
|
||
height: 88rpx;
|
||
line-height: 88rpx;
|
||
background-color: #2979ff;
|
||
color: #fff;
|
||
font-size: 28rpx;
|
||
border-radius: 12rpx;
|
||
box-shadow: 0 2rpx 8rpx rgba(41, 121, 255, 0.2);
|
||
transition: all 0.3s ease;
|
||
|
||
&:active {
|
||
transform: scale(0.98);
|
||
}
|
||
}
|
||
|
||
.popup-content {
|
||
background-color: #fff;
|
||
border-radius: 12rpx;
|
||
width: 600rpx;
|
||
padding: 30rpx;
|
||
}
|
||
|
||
.popup-title {
|
||
font-size: 32rpx;
|
||
font-weight: 500;
|
||
color: #333;
|
||
text-align: center;
|
||
margin-bottom: 30rpx;
|
||
}
|
||
|
||
.popup-footer {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
gap: 20rpx;
|
||
margin-top: 30rpx;
|
||
|
||
button {
|
||
padding: 0 40rpx;
|
||
height: 80rpx;
|
||
line-height: 80rpx;
|
||
font-size: 28rpx;
|
||
border-radius: 8rpx;
|
||
}
|
||
|
||
.cancel-btn {
|
||
background-color: #f5f5f5;
|
||
color: #666;
|
||
}
|
||
|
||
.confirm-btn {
|
||
background-color: #2979ff;
|
||
color: #fff;
|
||
}
|
||
}
|
||
</style>
|