feat(钢卷打包): 新增钢卷打包功能及相关页面

- 在easycode页面添加打包按钮及跳转逻辑
- 新增packing页面用于钢卷打包操作
- 更新应用版本号至1.3.16
- 添加打包状态相关表单字段及样式
This commit is contained in:
砂糖
2025-12-12 15:15:06 +08:00
parent 2ac6d387e1
commit 133d41c4e5
6 changed files with 666 additions and 20 deletions

View File

@@ -38,6 +38,7 @@
<button class="type-btn ship-btn" @click="handleShip">发货</button>
<button class="type-btn move-btn" @click="handleTranfer">移库</button>
<button class="type-btn see-btn" @click="handleSee">查看存储钢卷</button>
<button class="type-btn packing-btn" @click="handlePack">打包</button>
</view>
</view>
@@ -74,7 +75,7 @@
<view class="form-card" v-if="form.coilId">
<view class="form-item form-item-optional">
<text class="form-label-optional">目标库区</text>
<!-- 未选择目标库区显示扫码按钮 -->
<view v-if="!targetWarehouse" class="scan-btn-wrapper" @click="handleScanWarehouseCode">
<view class="scan-icon">
@@ -163,12 +164,31 @@
})
})
},
async handlePack() {
const content = await this.getQRCodeContent()
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content
.current_coil_id : null;
if (!coilId) {
uni.showToast({
title: '二维码异常',
icon: 'none'
})
return;
}
uni.navigateTo({
url: '/pages/easycode/packing?coilId=' + coilId
})
},
handleSee() {
uni.scanCode({
success(scanRes) {
// 查询真实库区在此处的钢卷
listMaterialCoil({ actualWarehouseId: scanRes.result, dataType: 1 }).then(res => {
listMaterialCoil({
actualWarehouseId: scanRes.result,
dataType: 1
}).then(res => {
if (res.total == 0) {
uni.showToast({
title: '该库区未发现钢卷',
@@ -292,6 +312,7 @@
});
return;
}
uni.hideLoading();
const content = JSON.parse(qrcodeRecord.content);
console.log('解析后的内容:', content);
@@ -444,7 +465,9 @@
// 重置移库状态
this.targetWarehouse = null;
this.coilDetail = coilRes.data;
this.form = { ...coilRes.data };
this.form = {
...coilRes.data
};
// 打开移库弹窗
this.$refs.tranferPopup.open();
@@ -462,7 +485,9 @@
// 移库操作:第二步 - 扫描目标库区码(核心补充)
async handleScanWarehouseCode() {
try {
uni.showLoading({ title: '扫码中...' });
uni.showLoading({
title: '扫码中...'
});
// 扫描库区二维码
const scanRes = await new Promise((resolve, reject) => {
uni.scanCode({
@@ -484,7 +509,9 @@
console.log('扫描到的目标库区ID', targetWarehouseId);
// 调用接口获取库区详情关键通过库区ID查询名称等信息
uni.showLoading({ title: '验证库区...' });
uni.showLoading({
title: '验证库区...'
});
const warehouseRes = await getActualWarehouse(targetWarehouseId);
uni.hideLoading();
@@ -540,16 +567,24 @@
try {
// 再次校验:防止异常场景
if (!this.targetWarehouse || !this.form.warehouseId) {
uni.showToast({ title: '请先选择目标库区', icon: 'none' });
uni.showToast({
title: '请先选择目标库区',
icon: 'none'
});
return;
}
if (this.targetWarehouse.actualWarehouseId === this.coilDetail.warehouseId) {
uni.showToast({ title: '目标库区不能与当前库区相同', icon: 'none' });
uni.showToast({
title: '目标库区不能与当前库区相同',
icon: 'none'
});
return;
}
this.loading = true;
uni.showLoading({ title: '移库中...' });
uni.showLoading({
title: '移库中...'
});
// 1. 核心:更新钢卷的库区信息
const updateRes = await updateMaterialCoilSimple(this.form);
@@ -580,7 +615,11 @@
// 操作成功
uni.hideLoading();
uni.showToast({ title: '移库成功', icon: 'success', duration: 1500 });
uni.showToast({
title: '移库成功',
icon: 'success',
duration: 1500
});
// 关闭弹窗并重置状态
setTimeout(() => {
@@ -775,13 +814,21 @@
color: #e6a23c;
border-color: #e6a23c;
}
.see-btn {
background-color: #6fd2ff;
color: #0777ff;
border-color: #0777ff;
}
.packing-btn {
background-color: #f2e9ff;
/* 浅紫底色,与黄色#fff9e6、蓝色#6fd2ff等浅底色亮度/饱和度匹配 */
color: #722ed1;
/* 深紫文字色,延续「同色系饱和色」的文字/边框逻辑 */
border-color: #722ed1;
}
.move-btn:active {
background-color: #fff3cc;
opacity: 0.9;
@@ -894,14 +941,14 @@
}
}
}
/* 扫码按钮样式 */
.scan-btn-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 20rpx;
.scan-icon {
width: 160rpx;
height: 160rpx;
@@ -911,22 +958,22 @@
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 24rpx rgba(52, 199, 89, 0.3);
&:active {
transform: scale(0.95);
}
}
.icon-camera {
font-size: 70rpx;
color: #fff;
}
.scan-tip {
font-size: 28rpx;
color: #666;
}
.scan-hint {
font-size: 24rpx;
color: #999;