修改称重、订单拣货、复核发货页面

This commit is contained in:
zm2000 2026-07-09 17:04:46 +08:00
parent 28b16a6cd5
commit dc7f8a67a1
4 changed files with 130 additions and 21 deletions

View File

@ -447,6 +447,12 @@ export default {
isSystemApi: true isSystemApi: true
} }
}, },
detail: {
path: "order.detail",
auth: true,
method: "POST",
isSystemApi: true
},
bindExpressPackageMaterialByWaybill: { bindExpressPackageMaterialByWaybill: {
path: "order.bindExpressPackageMaterialByWaybill", path: "order.bindExpressPackageMaterialByWaybill",
auth: true, auth: true,

View File

@ -864,8 +864,8 @@ import voice from '@/core/utils/voice';
.barcode-tag { .barcode-tag {
flex-shrink: 0; flex-shrink: 0;
font-size: 22rpx; font-size: 26rpx;
color: #2979ff; color: #000000;
background: #f0f7ff; background: #f0f7ff;
border: 1rpx solid #b3d8ff; border: 1rpx solid #b3d8ff;
border-radius: 6rpx; border-radius: 6rpx;
@ -1078,11 +1078,11 @@ import voice from '@/core/utils/voice';
} }
.list-table-row--active { .list-table-row--active {
background: #f0f7ff; background: #9dc4f1;
} }
.list-table-row--active .list-table-col { .list-table-row--active .list-table-col {
color: #0050B3; color: #000000;
} }
.list-table-row--matched { .list-table-row--matched {
@ -1176,7 +1176,7 @@ import voice from '@/core/utils/voice';
.package-info-value { .package-info-value {
font-size: 34rpx; font-size: 34rpx;
color: #2979ff; color: #000000;
font-weight: 500; font-weight: 500;
} }

View File

@ -62,7 +62,7 @@
</view> </view>
</view> </view>
<view class="alloc-panel"> <view class="alloc-panel">
<view class="pick-row pick-row--top"><text class="pick-label">分配篮号:</text></view> <view class="pick-row pick-row--top"><text class="pick-label">分配篮号:</text><text class="pick-value">篮子总数:{{ boxList.length }}</text></view>
<scroll-view class="alloc-scroll" scroll-y> <scroll-view class="alloc-scroll" scroll-y>
<view class="alloc-wrap" v-if="selectedPickItem.boxAllocations && selectedPickItem.boxAllocations.length"> <view class="alloc-wrap" v-if="selectedPickItem.boxAllocations && selectedPickItem.boxAllocations.length">
<view class="alloc-item" v-for="alloc in selectedPickItem.boxAllocations" :key="`${selectedPickItem.itemCode}-${alloc.boxId}`"> <view class="alloc-item" v-for="alloc in selectedPickItem.boxAllocations" :key="`${selectedPickItem.itemCode}-${alloc.boxId}`">
@ -2081,6 +2081,7 @@ import voice from '@/core/utils/voice';
.pick-row--top { .pick-row--top {
margin-top: 10rpx; margin-top: 10rpx;
justify-content: space-between;
} }
.alloc-panel { .alloc-panel {
@ -2201,8 +2202,12 @@ import voice from '@/core/utils/voice';
} }
.index-cell--picked { .index-cell--picked {
background: #f0f9eb; background: #2d8a2d;
border-color: #67c23a; border-color: #1a6b1a;
}
.index-cell--picked .index-text {
color: #ffffff;
} }
.bind-cart-popup { .bind-cart-popup {

View File

@ -54,7 +54,10 @@
placeholder="请输入重量" placeholder="请输入重量"
border="surround" border="surround"
:customStyle="{ flex: 1 }" :customStyle="{ flex: 1 }"
:focus="weightFocused"
class="weigh-input"
></u-input> ></u-input>
<text class="info-unit">g</text>
</view> </view>
</view> </view>
</view> </view>
@ -80,35 +83,45 @@ import voice from '@/core/utils/voice';
data() { data() {
return { return {
scanInput: '', scanInput: '',
scanFocused: true, scanFocused: false,
showScanInput: false, showScanInput: false,
orderInfo: { orderInfo: {
order_id: 0, order_id: 0,
waybill_code: '' waybill_code: ''
}, },
waves: [],
orderDetail: null,
orderItems: [],
expresses: [],
netWeight: '', netWeight: '',
manualWeight: '', manualWeight: '',
weightFocused: false,
submitting: false, submitting: false,
showOrderInfo: false showOrderInfo: false
}; };
}, },
onLoad() { onLoad() {
this.startScan(); this.$store.dispatch('broadcast/setCallbacks', {
onResult: this.onScanData
});
this.$store.dispatch('broadcast/start');
},
onShow() {
this.$store.dispatch('broadcast/resume');
},
onHide() {
this.$store.dispatch('broadcast/pause');
}, },
onUnload() { onUnload() {
this.stopScan(); this.$store.dispatch('broadcast/stop');
}, },
methods: { methods: {
startScan() {
uni.$on('onScanData', this.onScanData);
},
stopScan() {
uni.$off('onScanData', this.onScanData);
},
onScanData(data) { onScanData(data) {
if (data) { const scanText = data && data.data ? data.data.trim() : '';
this.scanInput = data; console.log('[称重] 广播扫描到快递单号:', scanText);
this.handleScanConfirm(data); if (scanText) {
this.scanInput = scanText;
this.handleScanConfirm(scanText);
} }
}, },
toggleScanInput() { toggleScanInput() {
@ -145,6 +158,7 @@ import voice from '@/core/utils/voice';
); );
if (!orderItem) { if (!orderItem) {
uni.showToast({ title: '未找到匹配订单', icon: 'none' }); uni.showToast({ title: '未找到匹配订单', icon: 'none' });
this.speakVoice('无记录');
return; return;
} }
if (!orderItem.is_reviewed) { if (!orderItem.is_reviewed) {
@ -152,6 +166,10 @@ import voice from '@/core/utils/voice';
this.speakVoice('订单未复核'); this.speakVoice('订单未复核');
this.showOrderInfo = false; this.showOrderInfo = false;
this.orderInfo = { order_id: 0, waybill_code: '' }; this.orderInfo = { order_id: 0, waybill_code: '' };
this.waves = [];
this.orderDetail = null;
this.orderItems = [];
this.expresses = [];
this.netWeight = ''; this.netWeight = '';
this.manualWeight = ''; this.manualWeight = '';
return; return;
@ -171,6 +189,10 @@ import voice from '@/core/utils/voice';
this.speakVoice('订单未复核'); this.speakVoice('订单未复核');
this.showOrderInfo = false; this.showOrderInfo = false;
this.orderInfo = { order_id: 0, waybill_code: '' }; this.orderInfo = { order_id: 0, waybill_code: '' };
this.waves = [];
this.orderDetail = null;
this.orderItems = [];
this.expresses = [];
this.netWeight = ''; this.netWeight = '';
this.manualWeight = ''; this.manualWeight = '';
return; return;
@ -183,12 +205,56 @@ import voice from '@/core/utils/voice';
this.manualWeight = waveItem?.items_weight ? String(waveItem.items_weight) : ''; this.manualWeight = waveItem?.items_weight ? String(waveItem.items_weight) : '';
} }
// 调用 index.toOrder 获取订单ID及所属波次信息
try {
const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false);
if (toOrderRes && toOrderRes.flag !== 'failure') {
const rawOrderId = Number(toOrderRes.order_id);
if (rawOrderId > 0) {
this.orderInfo.order_id = rawOrderId;
}
this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : [];
// 调用 order.detail 获取订单详情
try {
const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id }, '', false);
if (detailRes && detailRes.flag !== 'failure') {
const detailData = detailRes.data || {};
this.orderDetail = detailData.detail || null;
this.orderItems = detailData.items || [];
this.expresses = detailData.expresses || [];
// 从订单详情中更新商品净重
if (detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) {
this.netWeight = detailData.detail.items_weight;
}
// 从运单信息中更新称重重量
const firstExpress = (detailData.expresses || [])[0];
if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) {
// 接口返回 kg,页面显示 g,乘以 1000 转换
this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000));
}
}
} catch (e) {
console.error('获取订单详情失败', e);
}
}
} catch (e) {
console.error('获取波次信息失败', e);
}
this.showOrderInfo = true; this.showOrderInfo = true;
// 自动聚焦称重重量输入框
this.$nextTick(() => {
this.weightFocused = true;
});
} else { } else {
uni.showToast({ title: res.msg || '查询失败', icon: 'none' }); uni.showToast({ title: res.msg || '查询失败', icon: 'none' });
this.speakVoice('无记录');
} }
} catch (e) { } catch (e) {
uni.showToast({ title: '网络异常', icon: 'none' }); uni.showToast({ title: '网络异常', icon: 'none' });
this.speakVoice('无记录');
} finally { } finally {
uni.hideLoading(); uni.hideLoading();
} }
@ -200,7 +266,7 @@ import voice from '@/core/utils/voice';
} }
this.submitting = true; this.submitting = true;
const payload = { const payload = {
order_id: this.orderInfo.order_id, order_id: 0,
waybill_code: this.orderInfo.waybill_code, waybill_code: this.orderInfo.waybill_code,
weighing_weight: Number((Number(this.manualWeight) / 1000).toFixed(3)) weighing_weight: Number((Number(this.manualWeight) / 1000).toFixed(3))
}; };
@ -208,13 +274,16 @@ import voice from '@/core/utils/voice';
.then(res => { .then(res => {
if (res && res.flag !== 'failure') { if (res && res.flag !== 'failure') {
uni.showToast({ title: '设置成功', icon: 'success' }); uni.showToast({ title: '设置成功', icon: 'success' });
this.speakVoice('称重成功');
this.resetForm(); this.resetForm();
} else { } else {
uni.showToast({ title: res.msg || '提交失败', icon: 'none' }); uni.showToast({ title: res.msg || '提交失败', icon: 'none' });
this.speakVoice('称重失败');
} }
}) })
.catch(() => { .catch(() => {
uni.showToast({ title: '网络异常', icon: 'none' }); uni.showToast({ title: '网络异常', icon: 'none' });
this.speakVoice('称重失败');
}) })
.finally(() => { .finally(() => {
this.submitting = false; this.submitting = false;
@ -229,8 +298,13 @@ import voice from '@/core/utils/voice';
resetForm() { resetForm() {
this.scanInput = ''; this.scanInput = '';
this.orderInfo = { order_id: 0, waybill_code: '' }; this.orderInfo = { order_id: 0, waybill_code: '' };
this.waves = [];
this.orderDetail = null;
this.orderItems = [];
this.expresses = [];
this.netWeight = ''; this.netWeight = '';
this.manualWeight = ''; this.manualWeight = '';
this.weightFocused = false;
this.showOrderInfo = false; this.showOrderInfo = false;
this.scanFocused = true; this.scanFocused = true;
} }
@ -328,9 +402,14 @@ import voice from '@/core/utils/voice';
.info-row { .info-row {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
padding: 24rpx 24rpx; padding: 24rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0; border-bottom: 1rpx solid #f0f0f0;
&:nth-child(-n+2) {
background-color: #ffedd5;
}
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
@ -340,12 +419,14 @@ import voice from '@/core/utils/voice';
color: #000; color: #000;
width: 160rpx; width: 160rpx;
flex-shrink: 0; flex-shrink: 0;
text-align: center;
} }
.info-value { .info-value {
font-size: 32rpx; font-size: 32rpx;
color: #000; color: #000;
flex: 1; flex: 1;
text-align: center;
&--highlight { &--highlight {
color: #000; color: #000;
@ -354,6 +435,23 @@ import voice from '@/core/utils/voice';
.info-value-input { .info-value-input {
flex: 1; flex: 1;
flex-direction: row;
align-items: center;
display: flex;
gap: 8rpx;
.info-unit {
font-size: 32rpx;
color: #000;
white-space: nowrap;
}
}
.weigh-input {
::v-deep .u-input__content__field-wrapper__field {
font-size: 40rpx !important;
text-align: center !important;
}
} }
} }
} }