项目初始化

This commit is contained in:
liuhanqing
2025-10-16 14:37:22 +08:00
commit 69c2dc5cd5
1636 changed files with 306197 additions and 0 deletions

View File

@@ -0,0 +1,643 @@
<template>
<view class="container">
<view class="header">
<text class="title">{{ $t('outbound.bindShelf.materialInfo') }}</text>
</view>
<view class="warehouse-select">
<uni-data-select
v-model="selectedWarehouse"
:localdata="warehouseList"
:clear="false"
:placeholder="$t('outbound.bindShelf.selectWarehouse')"
@change="handleWarehouseChange"
/>
</view>
<view class="exit-select" v-if="showExitSelect">
<uni-data-select
v-model="selectedExit"
:localdata="exitList"
:clear="false"
:placeholder="$t('outbound.bindShelf.selectExit')"
@change="handleExitChange"
/>
</view>
<view class="loading-container" v-if="loading">
<text class="loading-text">{{ $t('outbound.bindShelf.loading') }}</text>
</view>
<view class="materials-list" v-else-if="materialList.length > 0">
<view v-for="(item, index) in materialList" :key="index" class="material-card">
<view class="material-header">
<view class="select-container">
<checkbox :checked="item.selected" @click="toggleSelect(index)" />
</view>
<view class="material-info">
<view class="material-title">{{ item.productName }}</view>
<view class="material-code">{{ $t('outbound.bindShelf.materialInfo') }}: {{ item.productId }}</view>
</view>
</view>
<view class="material-content">
<view class="quantity-control">
<text class="quantity-label">{{ $t('outbound.bindShelf.bindQuantity') }}</text>
<input
type="number"
v-model="item.bindQuantity"
@input="handleQuantityChange(index)"
class="quantity-input"
/>
</view>
</view>
</view>
</view>
<view v-else class="no-data">
<text>{{ $t('outbound.bindShelf.noMaterialInfo') }}</text>
</view>
<view class="button-group">
<button class="bind-button" @click="openBindShelfPopup">{{ $t('outbound.bindShelf.bindShelf') }}</button>
</view>
<!-- 绑定料架弹窗 -->
<uni-popup ref="bindShelfPopup" type="center">
<view class="popup-content">
<view class="popup-header">
<text class="popup-title">{{ $t('outbound.bindShelf.bindShelfTitle') }}</text>
<text class="popup-close" @click="closeBindShelfPopup">×</text>
</view>
<view class="scan-container">
<view class="input-group">
<input
type="text"
v-model="shelfCode"
:placeholder="$t('outbound.bindShelf.scanShelfCode')"
class="scan-input"
@input="fetchShelfInfo"
@clear="handleClear"
/>
</view>
</view>
<view class="shelf-info" v-if="shelfInfo.length > 0">
<view v-for="(item, index) in shelfInfo" :key="index" class="shelf-item">
<text class="shelf-name">{{ item.productName || $t('outbound.bindShelf.unknownMaterial') }}</text>
<text class="shelf-code">{{ item.productId || $t('outbound.bindShelf.noCode') }}</text>
<text class="shelf-quantity">{{ item.quantity || $t('outbound.bindShelf.noQuantity') }}</text>
</view>
</view>
<view class="popup-footer">
<button class="submit-button" @click="submitBindShelf">{{ $t('outbound.bindShelf.submit') }}</button>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { sunbmitDeatil, bindDetail,bindShelf } from '@/api/out/productOut.js'
import { getBasWarehouList } from '@/api/bas/bas.js'
export default {
data() {
return {
materialList: [],
loading: false,
shelfCode: '',
shelfInfo: [],
warehouseList: [],
exitListMap: {
'02': [
{ value: "G1004", text: 'G1004' },
{ value: 'G1010', text: 'G1010' },
{ value: 'fluent1', text: 'fluent1' },
{ value: 'fluent2', text: 'fluent2' },
],
'13': [
{ value: 'G2001', text: 'G2001' },
{ value: 'G3001', text: 'G3001' },
{ value: 'G3010', text: 'G3010' },
{ value: 'G4001', text: 'G4001' },
{ value: 'G4010', text: 'G4010' },
{ value: 'G5001', text: 'G5001' },
{ value: 'G5010', text: 'G5010' },
]
},
exitList: [],
selectedWarehouse: '',
selectedExit: '',
showExitSelect: false,
warehouseType: ''
}
},
onLoad() {
// 页面加载时获取仓库列表
this.getWarehouseList()
},
methods: {
// 获取仓库列表
async getWarehouseList() {
try {
const response = await getBasWarehouList({
pageNum: 1,
pageSize: 100
})
if (response.code === 200) {
this.warehouseList = response.rows.map(item => ({
value: item.warehouseId,
text: item.warehouseName,
type: item.warehouseType
}))
// 如果有仓库,默认选择第一个
if (this.warehouseList.length > 0) {
this.selectedWarehouse = this.warehouseList[0].value
this.warehouseType = this.warehouseList[0].type
// 根据仓库类型决定是否显示出口选择
this.showExitSelect = this.warehouseType === '2'
// 根据仓库ID获取对应的出口列表
this.exitList = this.exitListMap[this.selectedWarehouse] || []
// 如果是类型1,直接查询物料信息
if (this.warehouseType === '1') {
this.fetchMaterialData()
} else if (this.warehouseType === '2' && this.exitList.length > 0) {
// 如果是类型2,默认选择第一个出口
this.selectedExit = this.exitList[0].value
this.fetchMaterialData()
}
}
}
} catch (error) {
console.error('获取仓库列表失败:', error)
uni.showToast({
title: '获取仓库列表失败',
icon: 'none'
})
}
},
// 处理仓库选择变更
handleWarehouseChange(value) {
if (!value) return
// 查找选中的仓库信息
const selectedWarehouseInfo = this.warehouseList.find(item => item.value === value)
if (selectedWarehouseInfo) {
this.warehouseType = selectedWarehouseInfo.type
// 根据仓库类型决定是否显示出口选择
this.showExitSelect = this.warehouseType === '2'
// 根据仓库ID获取对应的出口列表
this.exitList = this.exitListMap[value] || []
// 如果是类型1,直接查询物料信息
if (this.warehouseType === '1') {
this.fetchMaterialData()
} else if (this.warehouseType === '2' && this.exitList.length > 0) {
// 如果是类型2,默认选择第一个出口
this.selectedExit = this.exitList[0].value
this.fetchMaterialData()
} else {
// 清空物料列表
this.materialList = []
}
}
},
// 处理出口选择变更
handleExitChange(value) {
if (!value) return
// 当出口选择变更时,重新查询物料信息
this.fetchMaterialData()
},
// 获取物料信息数据
async fetchMaterialData() {
try {
this.loading = true
// 构建查询参数
const params = {
pageSize: 100,
pageNum: 1,
warehouseId: this.selectedWarehouse
}
// 如果是类型2,添加出口参数
if (this.warehouseType === '2' && this.selectedExit) {
params.exitId = this.selectedExit
}
const response = await sunbmitDeatil(params)
if (response && response.code === 200) {
this.materialList = (response.rows || []).map(item => ({
...item,
selected: false,
bindQuantity: item.quantity
}))
} else {
uni.showToast({
title: response.msg || '获取物料信息失败',
icon: 'none'
})
this.materialList = []
}
} catch (error) {
console.error('获取物料信息失败:', error)
uni.showToast({
title: this.$t('outbound.bindShelf.noMaterialInfo'),
icon: 'none'
})
this.materialList = []
} finally {
this.loading = false
}
},
// 切换选择状态
toggleSelect(index) {
this.materialList[index].selected = !this.materialList[index].selected
},
// 处理数量变更
handleQuantityChange(index) {
// 确保输入的是有效数字
const value = this.materialList[index].bindQuantity
if (value === '' || isNaN(Number(value))) {
this.materialList[index].bindQuantity = '0'
} else if (Number(value) < 0) {
this.materialList[index].bindQuantity = '0'
uni.showToast({
title: '绑定数量不能小于0',
icon: 'none'
})
} else if (Number(value) > Number(this.materialList[index].quantit)) {
this.materialList[index].bindQuantity = this.materialList[index].quantit
uni.showToast({
title: '绑定数量不能大于可用数量',
icon: 'none'
})
}
},
// 打开绑定料架弹窗
openBindShelfPopup() {
const selectedItems = this.materialList.filter(item => item.selected)
if (selectedItems.length === 0) {
uni.showToast({
title: '请先选择需要绑定的物料',
icon: 'none'
})
return
}
// 检查绑定数量是否为0或空
const invalidQuantityItem = selectedItems.find(item => {
return !item.bindQuantity || item.bindQuantity === 0
})
if (invalidQuantityItem) {
uni.showToast({
title: '绑定数量不能为0或空',
icon: 'none'
})
return
}
this.$refs.bindShelfPopup.open()
},
// 关闭绑定料架弹窗
closeBindShelfPopup() {
this.$refs.bindShelfPopup.close()
// 清空弹窗数据
this.shelfCode = ''
this.shelfInfo = []
},
handleInput(value) {
if (value) {
this.fetchShelfInfo(value)
}
},
// 处理清除事件
handleClear() {
this.shelfInfo = []
},
// 获取料架信息
async fetchShelfInfo() {
try {
const response = await bindDetail({
containerId: this.shelfCode,
pageSize:100,
pageNum:1
})
uni.hideLoading()
if (response && response.code === 200) {
this.shelfInfo = response.rows || []
if (this.shelfInfo.length === 0) {
uni.showToast({
title: '未找到料架信息',
icon: 'none'
})
}
} else {
uni.showToast({
title: response.msg || '获取料架信息失败',
icon: 'none'
})
}
} catch (error) {
console.error('获取料架信息失败:', error)
uni.hideLoading()
uni.showToast({
title: '获取料架信息失败',
icon: 'none'
})
}
},
// 提交绑定料架
async submitBindShelf() {
if (!this.shelfCode) {
uni.showToast({
title: this.$t('outbound.bindShelf.pleaseScanShelfCode'),
icon: 'none'
})
return
}
const selectedItems = this.materialList.filter(item => item.selected)
if (selectedItems.length === 0) {
uni.showToast({
title: this.$t('outbound.bindShelf.pleaseSelectMaterial'),
icon: 'none'
})
return
}
// 检查绑定数量是否为0或空
const invalidQuantityItem = selectedItems.find(item => {
return !item.bindQuantity || item.bindQuantity === 0
})
if (invalidQuantityItem) {
uni.showToast({
title: '绑定数量不能为0或空',
icon: 'none'
})
return
}
// 这里可以根据实际需求调用相应的API进行提交
// 示例:构建提交数据
const submitData = {
containerCode: this.shelfCode,
warehouseId:this.selectedWarehouse,
exitId:this.selectedExit,
mydoJobDetailList: selectedItems.map(item => ({
productId: item.productId,
extraField:{
materialDesc: item.productName
},
pickBindQuantity: item.bindQuantity
}))
}
const response = await bindShelf(submitData)
if (response && response.code === 200) {
uni.showToast({
title: '绑定成功',
icon: 'success'
})
this.closeBindShelfPopup()
this.fetchMaterialData()
} else {
uni.showToast({
title: response.msg || '绑定失败',
icon: 'none'
})
}
}
}
}
</script>
<style>
.container {
padding: 20rpx;
}
.header {
margin-bottom: 20rpx;
}
.title {
font-size: 36rpx;
font-weight: bold;
}
.warehouse-select,
.exit-select {
margin-bottom: 20rpx;
}
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 200rpx;
}
.loading-text {
font-size: 28rpx;
color: #666;
}
.materials-list {
margin-top: 20rpx;
}
.material-card {
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1);
margin-bottom: 20rpx;
padding: 20rpx;
}
.material-header {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.select-container {
margin-right: 20rpx;
}
.material-info {
flex: 1;
}
.material-title {
font-size: 30rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.material-code {
font-size: 26rpx;
color: #666;
}
.material-content {
padding: 10rpx 0;
}
.quantity-control {
display: flex;
align-items: center;
}
.quantity-label {
font-size: 28rpx;
margin-right: 20rpx;
}
.quantity-input {
width: 120rpx;
height: 60rpx;
border: 1px solid #ddd;
border-radius: 6rpx;
text-align: center;
font-size: 28rpx;
}
.no-data {
display: flex;
justify-content: center;
align-items: center;
height: 200rpx;
color: #999;
font-size: 28rpx;
}
.button-group {
margin-top: 30rpx;
display: flex;
justify-content: center;
}
.bind-button {
background-color: #007aff;
color: #fff;
font-size: 30rpx;
padding: 20rpx 60rpx;
border-radius: 8rpx;
}
.popup-content {
background-color: #fff;
border-radius: 12rpx;
width: 600rpx;
padding: 30rpx;
}
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.popup-title {
font-size: 32rpx;
font-weight: bold;
}
.popup-close {
font-size: 40rpx;
color: #999;
}
.scan-container {
margin-bottom: 30rpx;
}
.input-group {
display: flex;
align-items: center;
}
.scan-input {
flex: 1;
height: 80rpx;
border: 1px solid #ddd;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
}
.scan-button {
margin-left: 20rpx;
background-color: #007aff;
color: #fff;
font-size: 28rpx;
padding: 0 30rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: 8rpx;
}
.shelf-info {
margin-bottom: 30rpx;
max-height: 300rpx;
overflow-y: auto;
}
.shelf-item {
padding: 20rpx;
border-bottom: 1px solid #eee;
}
.shelf-name {
font-size: 28rpx;
font-weight: bold;
display: block;
margin-bottom: 10rpx;
}
.shelf-code {
font-size: 24rpx;
color: #666;
display: block;
}
.popup-footer {
display: flex;
justify-content: center;
}
.submit-button {
background-color: #007aff;
color: #fff;
font-size: 30rpx;
padding: 20rpx 60rpx;
border-radius: 8rpx;
}
</style>

View File

@@ -0,0 +1,324 @@
<template>
<view class="container">
<view class="input-group">
<uni-easyinput
v-model="trayCode"
placeholder="请输入或扫码输入托盘条码"
: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">
<view class="table">
<view class="table-header">
<view class="table-cell checkbox-cell">
<checkbox :checked="isAllSelected" @click="toggleSelectAll" />
</view>
<view class="table-cell">物资编码</view>
<view class="table-cell">物料名称</view>
<view class="table-cell">出库数量</view>
<view class="table-cell">绑定数量</view>
</view>
<view v-for="(item, index) in materialList" :key="index" class="table-row">
<view class="table-cell checkbox-cell">
<checkbox :checked="item.selected" @click="toggleSelect(index)" />
</view>
<view class="table-cell">{{ item.productId }}</view>
<view class="table-cell">{{ item.extraField.materialDesc }}</view>
<view class="table-cell">{{ item.outQuantity }}</view>
<view class="table-cell">
<input type="number" v-model.number="item.bindQuantity" @input="handleBindQuantityInput($event, index)" class="quantity-input" />
</view>
</view>
</view>
<view class="rack-code-input" v-if="materialList.length > 0 && (!materialList[0].spare2 || materialList[0].spare2 !== '2')">
<uni-easyinput
v-model="rackCode"
placeholder="请输入料架码"
:clearable="true"
>
</uni-easyinput>
</view>
</view>
<view class="button-group" v-if="materialList.length > 0">
<button class="confirm-button" @click="handleConfirm">确认出库</button>
</view>
</view>
</template>
<script>
import { getTaskDetail, ckMakeSure } from '@/api/out/productOut.js'
export default {
onLoad(options) {
if (options.trayCode) {
this.trayCode = options.trayCode
this.fetchTrayInfo(options.trayCode)
}
},
onReady() {
setTimeout(() => {
this.$nextTick(() => {
// console.log(this.$refs.trayCodeInput)
this.$refs.trayCodeInput.onFocus()
})
}, 100)
},
data() {
return {
trayCode: '',
materialList: [],
isAllSelected: false,
rackCode: ''
}
},
methods: {
// 处理输入事件
handleInput(value) {
if (value) {
this.fetchTrayInfo(value)
}
},
// 处理清除事件
handleClear() {
this.materialList = []
},
// 处理扫码事件
handleScan() {
uni.scanCode({
success: (res) => {
this.trayCode = res.result
this.fetchTrayInfo(res.result)
}
})
},
// 获取托盘信息
async fetchTrayInfo(trayCode) {
try {
const response = await getTaskDetail({trayCode:trayCode,status:'3'})
// 为每个物料添加选择状态和绑定数量
this.materialList = response.data.map(item => ({
...item,
selected: false,
bindQuantity: item.pickQuantityReal
}))
} catch (error) {
uni.showToast({
title: '获取托盘信息失败',
icon: 'none'
})
}
},
// 确认出库
async handleConfirm() {
const selectedItems = this.materialList.filter(item => item.selected)
if (this.materialList[0].spare2 === '2') {
try {
await ckMakeSure({
trayCode: this.trayCode,
containerCode: 'MOCK_CONTAINER',
mydoJobDetailList: [{
jobDetailId: 'MOCK_JOB_DETAIL_ID',
pickQuantity: 1
}]
})
uni.showToast({
title: '出库确认成功',
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.rackCode = ''
this.materialList = []
return
} catch (error) {
uni.showToast({
title: '出库确认失败',
icon: 'none'
})
return
}
}
if (selectedItems.length === 0) {
uni.showToast({
title: '请选择要出库的物料',
icon: 'none'
})
return
}
if (!this.rackCode) {
uni.showToast({
title: '请输入料架码',
icon: 'none'
})
return
}
for (const item of selectedItems) {
if (item.bindQuantity <= 0 || item.bindQuantity > item.outQuantity) {
uni.showToast({
title: '绑定数量必须大于0且不能超过出库数量',
icon: 'none'
})
return
}
}
try {
await ckMakeSure({
trayCode: this.trayCode,
containerCode: this.rackCode,
mydoJobDetailList: selectedItems.map(item => ({
jobDetailId: item.jobDetailId,
pickQuantity: item.bindQuantity
}))
})
uni.showToast({
title: '出库确认成功',
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.rackCode = ''
this.materialList = []
} catch (error) {
uni.showToast({
title: '出库确认失败',
icon: 'none'
})
}
},
// 切换全选状态
toggleSelectAll() {
this.isAllSelected = !this.isAllSelected
this.materialList.forEach(item => {
item.selected = this.isAllSelected
})
},
// 切换单个选择状态
toggleSelect(index) {
this.materialList[index].selected = !this.materialList[index].selected
this.isAllSelected = this.materialList.every(item => item.selected)
},
// 处理绑定数量输入
handleBindQuantityInput(event, index) {
const value = Number(event.target.value)
if (!isNaN(value)) {
this.materialList[index].bindQuantity = value
}
},
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.input-group {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
:deep(.uni-easyinput__content) {
background-color: #f8f8f8;
border-radius: 8rpx;
height: 80rpx;
padding: 0 24rpx;
}
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;
}
.table-container {
background-color: #fff;
border-radius: 16rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
margin-bottom: 120rpx;
}
.table {
width: 100%;
border-collapse: collapse;
}
.table-header {
display: flex;
background-color: #f8f8f8;
border-top-left-radius: 16rpx;
border-top-right-radius: 16rpx;
}
.table-row {
display: flex;
border-bottom: 1rpx solid #eee;
}
.table-cell {
padding: 20rpx;
flex: 1;
font-size: 28rpx;
color: #333;
display: flex;
align-items: center;
}
.checkbox-cell {
flex: 0 0 80rpx;
justify-content: center;
}
.quantity-input {
width: 120rpx;
height: 60rpx;
border: 1rpx solid #ddd;
border-radius: 8rpx;
padding: 0 16rpx;
font-size: 28rpx;
}
.button-group {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx;
background-color: #fff;
box-shadow: 0 -2rpx 12rpx rgba(0, 0, 0, 0.08);
}
.confirm-button {
width: 100%;
background-color: #3B7FFF;
color: #fff;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
border-radius: 44rpx;
}
.rack-code-input {
padding: 20rpx;
background-color: #fff;
border-bottom-left-radius: 16rpx;
border-bottom-right-radius: 16rpx;
}
</style>

View File

@@ -0,0 +1,258 @@
<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="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>
</view>
<view class="materials-list" v-if="materialList.length > 0">
<view v-for="(item, index) in materialList" :key="index" class="material-card">
<view class="material-header">
<text class="material-title">{{ item.extraField.materialDesc || item.productId }}</text>
<text class="material-code">{{ item.productId }} | {{ $t('outbound.ckMakeSureByTray.quantity') }}: {{ item.outQuantity }}{{ $t('outbound.ckMakeSureByTray.unit') }}</text>
</view>
<!-- <view class="material-content">
<view class="material-info">
<text class="info-label">{{ $t('outbound.ckMakeSureByTray.batchNo') }}:</text>
<text class="info-value">{{ item.batchNo || '无' }}</text>
</view>
<view class="material-info">
<text class="info-label">{{ $t('outbound.ckMakeSureByTray.spec') }}:</text>
<text class="info-value">{{ item.extraField.spec || '无' }}</text>
</view>
<view class="material-info">
<text class="info-label">{{ $t('outbound.ckMakeSureByTray.unit') }}:</text>
<text class="info-value">{{ item.extraField.unit || '件' }}</text>
</view>
</view> -->
</view>
</view>
<view class="button-group" v-if="materialList.length > 0">
<button class="submit-button" @click="handleSubmit">{{ $t('outbound.ckMakeSureByTray.confirmOutbound') }}</button>
</view>
</view>
</template>
<script>
import { getTaskDetail, ckMakeSure } from '@/api/out/productOut.js'
export default {
onLoad(options) {
if (options.trayCode) {
this.trayCode = options.trayCode
this.fetchTrayInfo(options.trayCode)
}
},
onReady() {
setTimeout(() => {
this.$nextTick(() => {
this.$refs.trayCodeInput.onFocus()
})
}, 100)
},
data() {
return {
trayCode: '',
materialList: [],
loading: false
}
},
methods: {
// 处理输入事件
handleInput(value) {
if (value) {
this.fetchTrayInfo(value)
}
},
// 处理清除事件
handleClear() {
this.materialList = []
},
// 处理扫码事件
handleScan() {
uni.scanCode({
success: (res) => {
this.trayCode = res.result
this.fetchTrayInfo(res.result)
}
})
},
// 获取托盘信息
async fetchTrayInfo(trayCode) {
this.loading = true
try {
const response = await getTaskDetail({trayCode: trayCode,inOut:'2'})
if (response.data && response.data.length > 0) {
this.materialList = response.data
} else {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.trayInfoNotFound'),
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.getTrayInfoFailed'),
icon: 'none'
})
} finally {
this.loading = false
}
},
// 提交出库确认
async handleSubmit() {
if (!this.trayCode) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.enterTrayCode'),
icon: 'none'
})
return
}
if (this.materialList.length === 0) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.noOutboundMaterial'),
icon: 'none'
})
return
}
try {
const response=await ckMakeSure({
trayCode: this.trayCode
})
if (response.code==200) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.outboundSuccess'),
icon: 'success'
})
// 清空数据
this.trayCode = ''
this.materialList = []
}else{
uni.showToast({
title: response.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: this.$t('outbound.ckMakeSureByTray.outboundFailed'),
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.input-group {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 30rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;
}
.loading-container {
margin: 40rpx 0;
display: flex;
justify-content: center;
}
.materials-list {
margin-top: 20rpx;
}
.material-card {
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.material-header {
border-bottom: 1px solid #eee;
padding-bottom: 15rpx;
margin-bottom: 15rpx;
}
.material-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
display: block;
margin-bottom: 10rpx;
}
.material-code {
font-size: 28rpx;
color: #666;
display: block;
}
.material-content {
padding: 10rpx 0;
}
.material-info {
display: flex;
margin-bottom: 10rpx;
}
.info-label {
width: 120rpx;
font-size: 28rpx;
color: #666;
}
.info-value {
font-size: 28rpx;
color: #333;
flex: 1;
}
.button-group {
margin-top: 40rpx;
padding: 20rpx 0;
}
.submit-button {
background-color: #007aff;
color: #fff;
border-radius: 10rpx;
height: 90rpx;
line-height: 90rpx;
font-size: 32rpx;
}
</style>

View File

@@ -0,0 +1,285 @@
<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>
<uni-easyinput v-model="item.pickQuantity" type="number" :placeholder="$t('outbound.exception.enterPickQuantity')" style="flex: 1;" @input="validatePickQuantity(item)"></uni-easyinput>
</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) {
// 设置materialList并初始化pickQuantity为outQuantity的值
this.materialList = (response.data || []).map(item => {
return {
...item,
pickQuantity: item.outQuantity
}
})
} 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 = []
},
// 验证拣货数量不超过出库数量且不为负数
validatePickQuantity(item) {
// 转换为数字
let pickQty = Number(item.pickQuantity)
let outQty = Number(item.outQuantity)
// 检查是否为有效数字
if (isNaN(pickQty) || pickQty === '') {
item.pickQuantity = outQty
return
}
// 检查是否为负数
if (pickQty < 0) {
uni.showToast({
title: this.$t('outbound.exception.pickQuantityNegative'),
icon: 'none'
})
item.pickQuantity = 0
return
}
// 检查是否超过出库数量
if (pickQty > outQty) {
uni.showToast({
title: this.$t('outbound.exception.pickQuantityExceed'),
icon: 'none'
})
item.pickQuantity = outQty
}
},
// 处理扫码事件
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
}
// 提交前再次验证所有物料的pickQuantity
let isValid = true
this.materialList.forEach(item => {
// 转换为数字
let pickQty = Number(item.pickQuantity)
let outQty = Number(item.outQuantity)
// 检查是否为有效数字
if (isNaN(pickQty) || pickQty === '') {
isValid = false
uni.showToast({
title: this.$t('outbound.exception.invalidPickQuantity'),
icon: 'none'
})
item.pickQuantity = outQty
return
}
// 检查是否为负数
if (pickQty < 0) {
isValid = false
uni.showToast({
title: this.$t('outbound.exception.pickQuantityNegative'),
icon: 'none'
})
item.pickQuantity = 0
return
}
// 检查是否超过出库数量
if (pickQty > outQty) {
isValid = false
uni.showToast({
title: this.$t('outbound.exception.pickQuantityExceed'),
icon: 'none'
})
item.pickQuantity = outQty
}
})
if (!isValid) return
// 准备提交数据,包含所有物料编码和pickQuantity
const materialDetails = this.materialList.map(item => {
return {
jobDetailId: item.jobDetailId,
productId: item.productId,
pickQuantity: item.pickQuantity
}
})
try {
const response = await submitError({
trayCode: this.trayCode,
materialDetails: materialDetails
})
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>

View File

@@ -0,0 +1,158 @@
<template>
<view class="container">
<view class="form-card">
<uni-forms>
<uni-forms-item label="仓库:">
<uni-data-select
v-model="formData.warehouseId"
:localdata="warehouseList"
:clear="false"
placeholder="请选择仓库"
@change="handleWarehouseChange"
/>
</uni-forms-item>
<uni-forms-item label="出口:">
<uni-data-select
v-model="formData.exitId"
:localdata="exitList"
:clear="false"
placeholder="请选择出口"
/>
</uni-forms-item>
<button class="submit-button" hover-class="button-hover" @click="handleSubmit">空料箱出库</button>
</uni-forms>
</view>
</view>
</template>
<script>
import { getBasWarehouList } from '@/api/bas/bas.js'
import{ emptyBoxOut } from '@/api/out/ktpout.js'
export default {
data() {
return {
formData: {
warehouseId: '',
exitId: ''
},
warehouseList: [],
exitList: []
}
},
onReady() {
this.getWarehouseList()
},
methods: {
// 获取仓库列表
async getWarehouseList() {
try {
const response = await getBasWarehouList({warehouseType:'2'})
if (response.code === 200) {
this.warehouseList = response.rows.map(item => ({
value: item.warehouseId,
text: item.warehouseName
}))
}
} catch (error) {
console.error('获取仓库列表失败:', error)
uni.showToast({
title: '获取仓库列表失败',
icon: 'none'
})
}
},
// 处理仓库变化
handleWarehouseChange(warehouseId) {
this.formData.exitId = ''
// 模拟出口数据
this.exitList = [
{ value: '1', text: '出口1' },
{ value: '2', text: '出口2' },
{ value: '3', text: '出口3' }
]
},
// 提交表单
async handleSubmit() {
if (!this.formData.warehouseId) {
uni.showToast({
title: '请选择仓库',
icon: 'none'
})
return
}
if (!this.formData.exitId) {
uni.showToast({
title: '请选择出口',
icon: 'none'
})
return
}
// TODO: 调用出库API
const response = await emptyBoxOut(this.formData)
if (response.code === 200) {
uni.showToast({
title: '空料箱出库成功',
icon:'success'
})
// 清空表单
this.formData = {
warehouseId: '',
exitId: ''
}
} else {
uni.showToast({
title: response.msg || '出库操作失败',
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.form-card {
background-color: #fff;
border-radius: 16rpx;
padding: 40rpx 30rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}
:deep(.uni-forms-item) {
padding-bottom: 30rpx;
.uni-forms-item__label {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
.uni-easyinput__content {
background-color: #f8f8f8;
border-radius: 8rpx;
height: 80rpx;
padding: 0 24rpx;
}
}
.submit-button {
margin-top: 40rpx;
width: 100%;
background-color: #3B7FFF;
color: #fff;
border-radius: 8rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
&.button-hover {
background-color: #2c6be6;
}
}
</style>

View File

@@ -0,0 +1,333 @@
<template>
<view class="container">
<view class="form-card">
<uni-forms>
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.warehouse')">
<uni-data-select
v-model="formData.warehouseId"
:localdata="warehouseList"
:clear="false"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.warehousePlaceholder')"
@change="handleWarehouseChange"
/>
</uni-forms-item>
<view class="cargo-space-container" v-if="currentWarehouseType == '1'">
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.cargoSpace')">
<view class="cargo-input-group">
<uni-easyinput
v-model="formData.cargoSpaceName"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.cargoSpacePlaceholder')"
:clearable="true"
@input="handleCargoSpaceInput"
/>
<button class="recommend-btn" @click="handleRecommendCargoSpace">{{ $t('outbound.emptyPalletBox.emptyPallet.recommendCargoSpace') }}</button>
</view>
</uni-forms-item>
</view>
<view v-if="currentWarehouseType == '1' && cargoSpaceHeight" class="cargo-space-info">
<text class="cargo-space-height">{{ $t('outbound.emptyPalletBox.emptyPallet.cargoSpaceHeight') }}{{ cargoSpaceHeight }}{{ $t('outbound.emptyPalletBox.emptyPallet.meter') }}</text>
</view>
<view class="cargo-space-container" v-if="currentWarehouseType == '2'">
<uni-forms-item :label="$t('outbound.emptyPalletBox.emptyPallet.exit')">
<uni-data-select
v-model="formData.exitId"
:localdata="exitList"
:clear="false"
:placeholder="$t('outbound.emptyPalletBox.emptyPallet.exitPlaceholder')"
/>
</uni-forms-item>
</view>
<button class="submit-button" hover-class="button-hover" @click="handleSubmit">{{ $t('outbound.emptyPalletBox.emptyPallet.submit') }}</button>
</uni-forms>
</view>
</view>
</template>
<script>
import { getBasWarehouList, getFullCargoSpaceListByWarehouse,getCargoSpaceList } from '@/api/bas/bas.js'
import{emptyTrayOut} from '@/api/out/ktpout.js'
export default {
data() {
return {
formData: {
warehouseId: '',
cargoSpaceId: '',
exitId: '',
cargoSpaceName: ''
},
warehouseList: [],
cargoSpaceList: [],
exitList: [],
currentWarehouseType: '',
cargoSpaceHeight:''
}
},
onReady() {
this.getWarehouseList()
},
methods: {
async getWarehouseList() {
try {
const res = await getBasWarehouList({
pageNum:1,
pageSize:100,
typeData:['1','2']
})
if (res.code === 200) {
this.warehouseList = res.rows.map(item => ({
value: item.warehouseId,
text: item.warehouseName,
type: item.warehouseType
}))
}
} catch (error) {
console.error(this.$t('outbound.emptyPalletBox.emptyPallet.getWarehouseListFailed'), error)
}
},
async handleWarehouseChange(warehouseId) {
if (!warehouseId) return
const selectedWarehouse = this.warehouseList.find(item => item.value === warehouseId)
this.currentWarehouseType = selectedWarehouse ? selectedWarehouse.type : ''
this.formData.exitId = ''
if (this.currentWarehouseType == '2') {
// 模拟出口数据,实际项目中应该从后端获取
this.exitList = [
{ value: '1', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '1' },
{ value: '2', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '2' },
{ value: '3', text: this.$t('outbound.emptyPalletBox.emptyPallet.exit') + '3' }
]
}
},
handleCargoSpaceSelect(item) {
this.formData.cargoSpaceId = item.value
},
async handleRecommendCargoSpace() {
if (!this.formData.warehouseId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectWarehouse'),
icon: 'none'
})
return
}
// try {
const response = await getFullCargoSpaceListByWarehouse({ warehouseId: this.formData.warehouseId })
if (response.code === 200 && response.data.length > 0) {
// 获取第一个推荐货位
this.formData.cargoSpaceId = response.data[0].cargoSpaceId
this.formData.cargoSpaceName = response.data[0].cargoSpaceName
// 手动触发handleCargoSpaceInput方法获取货位高度信息
await this.handleCargoSpaceInput(response.data[0].cargoSpaceName)
} else {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.noAvailableCargoSpace'),
icon: 'none'
})
}
// } catch (error) {
// console.error('获取推荐货位失败:', error)
// uni.showToast({
// title: '获取推荐货位失败',
// icon: 'none'
// })
// }
},
// 处理货位选择
async handleCargoSpaceInput(value) {
if (value) {
try {
const response = await getCargoSpaceList({ cargoSpaceName: value, warehouseId: this.formData.warehouseId })
if (response.code === 200 && response.rows.length > 0) {
this.formData.cargoSpaceId = response.rows[0].cargoSpaceId
this.cargoSpaceHeight = response.rows[0].cargoHight
console.log(this.formData.cargoSpaceId)
} else {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} catch (error) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.getCargoSpaceInfoFailed'),
icon: 'none'
})
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
} else {
this.formData.cargoSpaceId = ''
this.cargoSpaceHeight = null
}
},
async handleSubmit() {
if (!this.formData.warehouseId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectWarehouse'),
icon: 'none'
})
return
}
if (this.currentWarehouseType == '1' && !this.formData.cargoSpaceId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectCargoSpace'),
icon: 'none'
})
return
}
if (this.currentWarehouseType == '2' && !this.formData.exitId) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.selectExit'),
icon: 'none'
})
return
}
// try {
const response = await emptyTrayOut(this.formData)
if (response.code === 200) {
uni.showToast({
title: this.$t('outbound.emptyPalletBox.emptyPallet.outboundSuccess'),
icon: 'success'
})
// 重置表单数据
this.formData = {
warehouseId: '',
cargoSpaceId: '',
exitId: ''
}
this.cargoSpaceList = []
this.exitList = []
this.currentWarehouseType = ''
this.cargoSpaceHeight = ''
} else {
uni.showToast({
title: response.msg || this.$t('outbound.emptyPalletBox.emptyPallet.outboundOperationFailed'),
icon: 'none'
})
}
// }
// catch (error) {
// console.error('出库失败:',error)
// uni.showToast({
// title: '出库失败',
// icon: 'none'
// })
// }
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.form-card {
background-color: #fff;
border-radius: 16rpx;
padding: 40rpx 30rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}
:deep(.uni-forms-item) {
padding-bottom: 30rpx;
.uni-forms-item__label {
font-size: 28rpx;
color: #333;
font-weight: 500;
white-space: nowrap;
}
.uni-easyinput__content {
background-color: #f8f8f8;
border-radius: 8rpx;
height: 80rpx;
padding: 0 24rpx;
}
}
.cargo-space-container {
margin-bottom: 30rpx;
}
.cargo-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
padding: 20rpx;
background-color: #f8f8f8;
border-radius: 8rpx;
}
.cargo-item {
padding: 20rpx;
text-align: center;
background-color: #fff;
border-radius: 8rpx;
border: 2rpx solid #e5e5e5;
cursor: pointer;
transition: all 0.3s ease;
&:hover {
background-color: #f0f7ff;
border-color: #3B7FFF;
}
}
.selected-item {
background-color: #3B7FFF;
color: #fff;
border-color: #3B7FFF;
&:hover {
background-color: #2c6be6;
}
}
.submit-button {
margin-top: 40rpx;
width: 100%;
background-color: #3B7FFF;
color: #fff;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
border-radius: 44rpx;
transition: all 0.3s ease;
}
.button-hover {
background-color: #2c6be6;
transform: translateY(2rpx);
}
.cargo-input-group {
display: flex;
gap: 20rpx;
align-items: center;
}
.recommend-btn {
flex-shrink: 0;
padding: 0 30rpx;
height: 80rpx;
line-height: 80rpx;
background-color: #3B7FFF;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
}
</style>

View File

@@ -0,0 +1,153 @@
<template>
<view class="container">
<view class="function-list">
<view class="function-item" @click="navigateTo('/pages/out/ktpout')">
<view class="icon-box blue">
<image src="/static/images/tabbar/trayout.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.emptyPalletBox.title') }}</text>
<text class="desc">{{ $t('outbound.emptyPalletBox.desc') }}</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/out/pkout')">
<view class="icon-box blue">
<image src="/static/images/tabbar/trayout.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.pkout.title') }}</text>
<text class="desc">{{ $t('outbound.pkout.desc') }}</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/out/ckMakeSureByTray')">
<view class="icon-box blue">
<image src="/static/images/tabbar/readyCheck.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.ckMakeSureByTray.title') }}</text>
<text class="desc">{{ $t('outbound.ckMakeSureByTray.desc') }}</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/out/bindShell')">
<view class="icon-box blue">
<image src="/static/images/tabbar/readyCheck.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.bindShelf.title') }}</text>
<text class="desc">{{ $t('outbound.bindShelf.desc') }}</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/out/errorout')">
<view class="icon-box blue">
<image src="/static/images/tabbar/readyCheck.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.exception.title') }}</text>
<text class="desc">{{ $t('outbound.exception.desc') }}</text>
</view>
</view>
<view class="function-item" @click="navigateTo('/pages/out/move')">
<view class="icon-box blue">
<image src="/static/images/tabbar/readyCheck.png" mode="aspectFit" class="icon-image" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="function-text">
<text class="title">{{ $t('outbound.move.title') }}</text>
<text class="desc">{{ $t('outbound.move.desc') }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import tab from '@/plugins/tab'
export default {
data() {
return {}
},
methods: {
navigateTo(url) {
tab.navigateTo(url)
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 20rpx;
background-color: #f5f7fa;
min-height: 100vh;
}
.function-list {
display: flex;
flex-direction: column;
gap: 24rpx;
}
.function-item {
display: flex;
align-items: center;
background-color: #fff;
padding: 32rpx;
border-radius: 16rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
&:hover {
transform: translateY(-4rpx);
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
}
&:active {
transform: translateY(0);
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
}
}
.icon-box {
width: 88rpx;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
margin-right: 32rpx;
transition: all 0.3s ease;
&.blue {
background: linear-gradient(135deg, #409eff, #3a8ee6);
box-shadow: 0 6rpx 16rpx rgba(64, 158, 255, 0.25);
}
&:hover {
transform: rotate(15deg) scale(1.1);
}
}
.iconfont {
color: #fff;
font-size: 44rpx;
transition: all 0.3s ease;
}
.function-text {
flex: 1;
.title {
font-size: 34rpx;
color: #2c3e50;
font-weight: 600;
margin-bottom: 10rpx;
letter-spacing: 1rpx;
}
.desc {
font-size: 26rpx;
color: #7f8c8d;
letter-spacing: 0.5rpx;
}
}
</style>

View File

@@ -0,0 +1,273 @@
<template>
<view class="container">
<uni-forms class="form-card">
<view class="form-content">
<!-- 第一个独立下拉框 -->
<uni-forms-item :label="$t('outbound.move.startPointType')">
<uni-data-select
v-model="formData.startPointType"
:localdata="pointTypeList"
:clear="false"
:placeholder="$t('outbound.move.startPointTypePlaceholder')"
@change="handleStartPointTypeChange"
/>
</uni-forms-item>
<!-- 第二个独立下拉框 -->
<uni-forms-item :label="$t('outbound.move.targetPointType')">
<uni-data-select
v-model="formData.targetPointType"
:localdata="pointTypeList"
:clear="false"
:placeholder="$t('outbound.move.targetPointTypePlaceholder')"
@change="handleTargetPointTypeChange"
/>
</uni-forms-item>
<!-- 第一个联动下拉框(主) -->
<uni-forms-item :label="$t('outbound.move.sourceLocation')">
<uni-data-select
v-model="formData.sourceLocationId"
:localdata="sourceLocationList"
:clear="false"
:placeholder="$t('outbound.move.sourceLocationPlaceholder')"
/>
</uni-forms-item>
<!-- 第二个联动下拉框(从) -->
<uni-forms-item :label="$t('outbound.move.targetLocation')">
<uni-data-select
v-model="formData.targetLocationId"
:localdata="targetLocationList"
:clear="false"
:placeholder="$t('outbound.move.targetLocationPlaceholder')"
/>
</uni-forms-item>
</view>
<button class="submit-button" @click="handleSubmit">{{ $t('outbound.move.submit') }}</button>
</uni-forms>
</view>
</template>
<script>
import { getPointTypeList, getPortList,submitMove } from '@/api/out/move.js'
export default {
data() {
return {
formData: {
startPointType: '',
targetPointType: '',
sourceLocationId: '',
targetLocationId: ''
},
pointTypeList: [],
sourceLocationList: [],
targetLocationList: []
}
},
onReady() {
this.getPointTypeList()
},
methods: {
// 获取点位列表
async getPointTypeList() {
try {
const res = await getPointTypeList({
dictType:"port_type"
})
// if (res.code === 200) {
this.pointTypeList = res.map(item => ({
value: item.dictValue,
text: this.$t(item.dictLabel)
}))
// }
} catch (error) {
console.error('获取点位列表失败', error)
uni.showToast({
title: this.$t('outbound.move.getPointTypeListFailed'),
icon: 'none'
})
}
},
// 处理起始点类型变化
async handleStartPointTypeChange(value) {
if (!value) {
this.sourceLocationList = []
return
}
try {
const res = await getPortList({
portType: value,
pageSize:100,
pageNum:1
})
if (res.code === 200) {
this.sourceLocationList = res.rows.map(item => ({
value: item.portName,
text: item.portName
}))
}
} catch (error) {
console.error('获取端口列表失败', error)
uni.showToast({
title: this.$t('outbound.move.getPortListFailed'),
icon: 'none'
})
}
},
// 处理目标点类型变化
async handleTargetPointTypeChange(value) {
if (!value) {
this.targetLocationList = []
return
}
try {
const res = await getPortList({
portType: value,
pageSize:100,
pageNum:1
})
if (res.code === 200) {
this.targetLocationList = res.rows.map(item => ({
value: item.portName,
text: item.portName
}))
}
} catch (error) {
console.error('获取目标端口列表失败', error)
uni.showToast({
title: this.$t('outbound.move.getPortListFailed'),
icon: 'none'
})
}
},
// 提交表单
async handleSubmit() {
// 表单验证
if (!this.formData.startPointType) {
uni.showToast({
title: this.$t('outbound.move.startPointTypeRequired'),
icon: 'none'
})
return
}
if (!this.formData.targetPointType) {
uni.showToast({
title: this.$t('outbound.move.targetPointTypeRequired'),
icon: 'none'
})
return
}
if (!this.formData.sourceLocationId) {
uni.showToast({
title: this.$t('outbound.move.sourceLocationRequired'),
icon: 'none'
})
return
}
if (!this.formData.targetLocationId) {
uni.showToast({
title: this.$t('outbound.move.targetLocationRequired'),
icon: 'none'
})
return
}
try {
const res = await submitMove({
startPoint:this.formData.sourceLocationId,
endPoint:this.formData.targetLocationId})
if (res.code === 200) {
uni.showToast({
title: this.$t('outbound.move.submitSuccess'),
icon: 'success'
})
// 重置表单
this.formData = {
sourceWarehouseId: '',
targetWarehouseId: '',
sourceLocationId: '',
targetLocationId: ''
}
this.sourceLocationList = []
this.targetLocationList = []
} else {
uni.showToast({
title: res.msg || this.$t('outbound.move.submitFailed'),
icon: 'none'
})
}
} catch (error) {
console.error('提交移库请求失败', error)
uni.showToast({
title: res.msg ||this.$t('outbound.move.submitError'),
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
.form-card {
background-color: #fff;
border-radius: 16rpx;
padding: 40rpx 30rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
}
.form-content {
margin-bottom: 40rpx;
}
:deep(.uni-forms-item) {
padding-bottom: 30rpx;
.uni-forms-item__label {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
}
.submit-button {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #007aff;
color: #fff;
font-size: 32rpx;
border-radius: 44rpx;
&:active {
background-color: #0062cc;
}
}
</style>

View File

@@ -0,0 +1,293 @@
<template>
<view class="container">
<view class="search-box">
<uni-easyinput
v-model="stockoutId"
:placeholder="$t('outbound.pkout.searchPlaceholder')"
:clearable="true"
@clear="handleClear"
@confirm="handleSearch"
@input="handleSearch"
ref="detailIdInput">
<template #right>
<text class="scan-icon" @click="handleScan">📷</text>
</template>
</uni-easyinput>
</view>
<view class="card-list">
<view v-if="orderList && orderList.length > 0">
<view v-for="(order, index) in orderList" :key="index" class="order-card" @click="handleOrderClick(order)">
<uni-card>
<view class="card-content">
<view class="info-row">
<text class="label">{{ $t('outbound.pkout.orderNumber') }}</text>
<text class="value">{{ order.stockoutId }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('outbound.pkout.createTime') }}</text>
<text class="value">{{ order.createDate }}</text>
</view>
<view class="info-row">
<text class="label">{{ $t('outbound.pkout.customer') }}</text>
<text class="value">{{ order.customerName }}</text>
</view>
<!-- 展开时显示物料信息 -->
<view v-if="order.expanded && order.goodsList" class="goods-list">
<view class="goods-title">{{ $t('outbound.pkout.goodsInfo') }}</view>
<view class="goods-table">
<view class="table-header">
<text class="header-cell" style="display: none;">{{ $t('outbound.pkout.productCode') }}</text>
<text class="header-cell">{{ $t('outbound.pkout.productName') }}</text>
<text class="header-cell">{{ $t('outbound.pkout.planQuantity') }}</text>
<text class="header-cell">{{ $t('outbound.pkout.outboundQuantity') }}</text>
<text class="header-cell">{{ $t('outbound.pkout.operation') }}</text>
</view>
<view v-for="(goods, goodsIndex) in order.goodsList" :key="goodsIndex" class="table-row">
<text class="table-cell" style="display: none;">{{ goods.productId }}</text>
<text class="table-cell">{{ goods.extraField.materialDesc }}</text>
<text class="table-cell">{{ goods.quantity }}</text>
<text class="table-cell">{{ goods.quantity - goods.assignNum }}</text>
<view class="table-cell">
<button class="operate-btn" @click.stop="handleOutStock(goods)" :disabled="(goods.quantity - goods.assignNum) <= 0" :class="{'operate-btn-disabled': (goods.quantity - goods.assignNum) <= 0}">
{{ $t('outbound.pkout.outbound') }}
</button>
</view>
</view>
</view>
</view>
</view>
</uni-card>
</view>
</view>
<view v-else class="no-data">{{ $t('outbound.pkout.noOrderInfo') }}</view>
</view>
</view>
</template>
<script>
import { getOutOrderList, getOutOrderDetail, pkOut } from '@/api/out/productOut'
export default {
data() {
return {
stockoutId: "",
orderList: [],
needRefresh: false
}
},
onReady() {
setTimeout(() => {
this.$nextTick(() => {
this.$refs.detailIdInput.onFocus()
})
}, 100)
},
onLoad() {
this.getOrderList()
},
onShow() {
if (this.needRefresh) {
this.getOrderList()
this.needRefresh = false
}
},
methods: {
// 获取出库单列表
async getOrderList() {
try {
const response = await getOutOrderList({"stockoutId":this.stockoutId})
this.orderList = response.map(order => ({
...order,
expanded: false,
goodsList: null
}))
} catch (error) {
console.error(this.$t('outbound.pkout.getOrderListFailed'), error)
uni.showToast({
title: this.$t('outbound.pkout.getOrderListFailed'),
icon: 'none'
})
}
},
// 获取物品列表
async getGoodsList(order) {
try {
const goodsResponse = await getOutOrderDetail({
stockoutId: order.stockoutId,
pageSize:100,
pageNum:1,
status:1
})
order.goodsList = goodsResponse.rows.map(item => ({
...item
// outQuantity: item.quantity-item.assignNum
}))
} catch (error) {
console.error(this.$t('outbound.pkout.getItemInfoFailed'), error)
uni.showToast({
title: this.$t('outbound.pkout.getItemInfoFailed'),
icon: 'none'
})
}
},
// 处理出库单点击
async handleOrderClick(order) {
// 切换展开状态
order.expanded = !order.expanded
// 如果展开且还没有加载物品列表,则加载物品列表
if (order.expanded && !order.goodsList) {
await this.getGoodsList(order)
}
},
// 处理搜索
handleSearch(value) {
this.stockoutId = value
this.getOrderList()
},
// 处理清除
handleClear() {
this.stockoutId = ""
this.getOrderList()
},
// 处理扫码
handleScan() {
uni.scanCode({
success: (res) => {
this.stockoutId = res.result
this.getOrderList()
}
})
},
// 处理出库数量变化
handleOutQuantityChange(goods) {
if (goods.outQuantity > goods.quantity - goods.assignNum) {
goods.outQuantity = goods.quantity - goods.assignNum
}
},
// 验证数量是否有效
isValidQuantity(goods) {
return goods.outQuantity > 0 && goods.outQuantity <= goods.quantity - goods.assignNum
},
// 处理出库
async handleOutStock(goods) {
// if (!this.isValidQuantity(goods)) return
try {
await pkOut({
stockinDetailId: goods.stockoutDetailId
})
uni.showToast({
title: this.$t('outbound.pkout.outboundSuccess'),
icon: 'success'
})
// 刷新数据
this.getOrderList()
} catch (error) {
console.error('出库失败:', error)
uni.showToast({
title: this.$t('outbound.pkout.outboundFailed'),
icon: 'none'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
padding: 20rpx;
}
.search-box {
margin-bottom: 20rpx;
}
.scan-icon {
font-size: 40rpx;
padding: 0 20rpx;
}
.card-list {
.order-card {
margin-bottom: 20rpx;
}
}
.info-row {
display: flex;
margin-bottom: 10rpx;
.label {
color: #666;
width: 160rpx;
}
.value {
color: #333;
flex: 1;
}
}
.goods-list {
margin-top: 20rpx;
.goods-title {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 10rpx;
}
}
.goods-table {
.table-header {
display: flex;
background-color: #f5f5f5;
padding: 20rpx 0;
.header-cell {
flex: 1;
text-align: center;
font-size: 24rpx;
color: #666;
}
}
.table-row {
display: flex;
padding: 20rpx 0;
border-bottom: 1rpx solid #eee;
.table-cell {
flex: 1;
text-align: center;
font-size: 24rpx;
color: #333;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.operate-btn {
background-color: #007AFF;
color: #fff;
font-size: 24rpx;
padding: 10rpx 20rpx;
border-radius: 4rpx;
&.operate-btn-disabled {
background-color: #ccc;
}
}
.no-data {
text-align: center;
color: #999;
padding: 40rpx 0;
}
</style>