diff --git a/core/request/apis.js b/core/request/apis.js index a120c7a..a4ff5ad 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -447,6 +447,12 @@ export default { isSystemApi: true } }, + detail: { + path: "order.detail", + auth: true, + method: "POST", + isSystemApi: true + }, bindExpressPackageMaterialByWaybill: { path: "order.bindExpressPackageMaterialByWaybill", auth: true, diff --git a/pages/work/order/order-review-comps/ReviewDetail.vue b/pages/work/order/order-review-comps/ReviewDetail.vue index 419f57f..fcaece4 100644 --- a/pages/work/order/order-review-comps/ReviewDetail.vue +++ b/pages/work/order/order-review-comps/ReviewDetail.vue @@ -864,8 +864,8 @@ import voice from '@/core/utils/voice'; .barcode-tag { flex-shrink: 0; - font-size: 22rpx; - color: #2979ff; + font-size: 26rpx; + color: #000000; background: #f0f7ff; border: 1rpx solid #b3d8ff; border-radius: 6rpx; @@ -1078,11 +1078,11 @@ import voice from '@/core/utils/voice'; } .list-table-row--active { - background: #f0f7ff; + background: #9dc4f1; } .list-table-row--active .list-table-col { - color: #0050B3; + color: #000000; } .list-table-row--matched { @@ -1176,7 +1176,7 @@ import voice from '@/core/utils/voice'; .package-info-value { font-size: 34rpx; - color: #2979ff; + color: #000000; font-weight: 500; } diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index 8bed360..edb8d0c 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -62,7 +62,7 @@ - 分配篮号: + 分配篮号:篮子总数:{{ boxList.length }} @@ -2081,6 +2081,7 @@ import voice from '@/core/utils/voice'; .pick-row--top { margin-top: 10rpx; + justify-content: space-between; } .alloc-panel { @@ -2201,8 +2202,12 @@ import voice from '@/core/utils/voice'; } .index-cell--picked { - background: #f0f9eb; - border-color: #67c23a; + background: #2d8a2d; + border-color: #1a6b1a; + } + + .index-cell--picked .index-text { + color: #ffffff; } .bind-cart-popup { diff --git a/pages/work/order/weighing.vue b/pages/work/order/weighing.vue index 4e79257..b0a61f3 100644 --- a/pages/work/order/weighing.vue +++ b/pages/work/order/weighing.vue @@ -54,7 +54,10 @@ placeholder="请输入重量" border="surround" :customStyle="{ flex: 1 }" + :focus="weightFocused" + class="weigh-input" > + g @@ -80,35 +83,45 @@ import voice from '@/core/utils/voice'; data() { return { scanInput: '', - scanFocused: true, + scanFocused: false, showScanInput: false, orderInfo: { order_id: 0, waybill_code: '' }, + waves: [], + orderDetail: null, + orderItems: [], + expresses: [], netWeight: '', manualWeight: '', + weightFocused: false, submitting: false, showOrderInfo: false }; }, 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() { - this.stopScan(); + this.$store.dispatch('broadcast/stop'); }, methods: { - startScan() { - uni.$on('onScanData', this.onScanData); - }, - stopScan() { - uni.$off('onScanData', this.onScanData); - }, onScanData(data) { - if (data) { - this.scanInput = data; - this.handleScanConfirm(data); + const scanText = data && data.data ? data.data.trim() : ''; + console.log('[称重] 广播扫描到快递单号:', scanText); + if (scanText) { + this.scanInput = scanText; + this.handleScanConfirm(scanText); } }, toggleScanInput() { @@ -145,6 +158,7 @@ import voice from '@/core/utils/voice'; ); if (!orderItem) { uni.showToast({ title: '未找到匹配订单', icon: 'none' }); + this.speakVoice('无记录'); return; } if (!orderItem.is_reviewed) { @@ -152,6 +166,10 @@ import voice from '@/core/utils/voice'; this.speakVoice('订单未复核'); this.showOrderInfo = false; this.orderInfo = { order_id: 0, waybill_code: '' }; + this.waves = []; + this.orderDetail = null; + this.orderItems = []; + this.expresses = []; this.netWeight = ''; this.manualWeight = ''; return; @@ -171,6 +189,10 @@ import voice from '@/core/utils/voice'; this.speakVoice('订单未复核'); this.showOrderInfo = false; this.orderInfo = { order_id: 0, waybill_code: '' }; + this.waves = []; + this.orderDetail = null; + this.orderItems = []; + this.expresses = []; this.netWeight = ''; this.manualWeight = ''; return; @@ -183,12 +205,56 @@ import voice from '@/core/utils/voice'; 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.$nextTick(() => { + this.weightFocused = true; + }); } else { uni.showToast({ title: res.msg || '查询失败', icon: 'none' }); + this.speakVoice('无记录'); } } catch (e) { uni.showToast({ title: '网络异常', icon: 'none' }); + this.speakVoice('无记录'); } finally { uni.hideLoading(); } @@ -200,7 +266,7 @@ import voice from '@/core/utils/voice'; } this.submitting = true; const payload = { - order_id: this.orderInfo.order_id, + order_id: 0, waybill_code: this.orderInfo.waybill_code, weighing_weight: Number((Number(this.manualWeight) / 1000).toFixed(3)) }; @@ -208,13 +274,16 @@ import voice from '@/core/utils/voice'; .then(res => { if (res && res.flag !== 'failure') { uni.showToast({ title: '设置成功', icon: 'success' }); + this.speakVoice('称重成功'); this.resetForm(); } else { uni.showToast({ title: res.msg || '提交失败', icon: 'none' }); + this.speakVoice('称重失败'); } }) .catch(() => { uni.showToast({ title: '网络异常', icon: 'none' }); + this.speakVoice('称重失败'); }) .finally(() => { this.submitting = false; @@ -229,8 +298,13 @@ import voice from '@/core/utils/voice'; resetForm() { this.scanInput = ''; this.orderInfo = { order_id: 0, waybill_code: '' }; + this.waves = []; + this.orderDetail = null; + this.orderItems = []; + this.expresses = []; this.netWeight = ''; this.manualWeight = ''; + this.weightFocused = false; this.showOrderInfo = false; this.scanFocused = true; } @@ -328,9 +402,14 @@ import voice from '@/core/utils/voice'; .info-row { display: flex; align-items: center; + justify-content: space-between; padding: 24rpx 24rpx; border-bottom: 1rpx solid #f0f0f0; + &:nth-child(-n+2) { + background-color: #ffedd5; + } + &:last-child { border-bottom: none; } @@ -340,12 +419,14 @@ import voice from '@/core/utils/voice'; color: #000; width: 160rpx; flex-shrink: 0; + text-align: center; } .info-value { font-size: 32rpx; color: #000; flex: 1; + text-align: center; &--highlight { color: #000; @@ -354,6 +435,23 @@ import voice from '@/core/utils/voice'; .info-value-input { 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; + } } } }