From 24d455a2e863e851f40a6ad67dbb356a1661f720 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Tue, 25 Aug 2026 10:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/work/order/picking.vue | 95 +++++++++++++++++++++++++++++++++--- 1 file changed, 89 insertions(+), 6 deletions(-) diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index 13cee20..ddb082d 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -64,9 +64,21 @@ {{ selectedPickItem.itemName || '--' }} 拣货车:{{ boundCartNo }}{{ boundCartName ? `(${boundCartName})` : '' }} - 货主:{{ selectedPickItem.storeRemark || '--' }} - 商品条码:{{ selectedItemBarcodeLoading ? '条码加载中...' : (selectedItemBarcode || '--') }} - 库位:{{ selectedPickItem.spaceName || '--' }} + 货主:{{ selectedPickItem.storeRemark || '--' }} + + 条码: + {{ selectedItemBarcodeLoading ? '条码加载中...' : (selectedItemBarcode || '--') }} + {{ barcodeExpanded ? '收起' : '展开' }} + + 库位:{{ selectedPickItem.spaceName || '--' }} 应拣总数:{{ selectedPickItem.totalQty }} @@ -314,6 +326,8 @@ import voice from '@/core/utils/voice'; selectedItemBarcodeLoading: false, selectedItemBarcode: '', itemBarcodeCache: {}, + barcodeExpanded: false, + barcodeClampLength: 14, pickedItemKeys: [], pickedStateStorageKey: 'order_picking_picked_state_v1', confirmedOrderIds: [], @@ -460,6 +474,12 @@ import voice from '@/core/utils/voice'; return null; } return this.filteredPickItems[this.selectedIndex] || this.filteredPickItems[0]; + }, + selectedBarcodeText() { + return this.selectedItemBarcodeLoading ? '' : String(this.selectedItemBarcode || '').trim(); + }, + isBarcodeTooLong() { + return this.selectedBarcodeText.length > this.barcodeClampLength; } }, watch: { @@ -474,6 +494,7 @@ import voice from '@/core/utils/voice'; }, selectedPickItem: { handler(item) { + this.barcodeExpanded = false; this.loadSelectedItemImage(item); this.loadSelectedItemBarcode(item); }, @@ -484,6 +505,7 @@ import voice from '@/core/utils/voice'; this.initWavePickSubmitNetworkStatus(); this.bindNetworkStatusChange(); this.restoreBasketDisplayMode(); + this.updateBarcodeClampLength(); this.$store.dispatch('broadcast/setCallbacks', { onResult: this.handleBroadcastScan }); @@ -1952,6 +1974,32 @@ import voice from '@/core/utils/voice'; } return String(entry.barcode || entry.code || '').trim(); }, + // 按屏幕宽度估算一行可容纳的条码字符数,作为展开/收起的触发阈值 + updateBarcodeClampLength() { + let estimated = 16; + try { + const info = uni.getSystemInfoSync(); + const screenWidth = info.windowWidth || 375; + const rpx = screenWidth / 750; + // 条码文本可用宽度(rpx) = 750 - 24*2(页面左右padding) - 200(商品图) - 16(detail-main gap) - 170(标签列) + const availableRpx = 316; + // 数字/字母平均字符宽 ≈ 字号 * 0.58 + const charWidthRpx = 34 * 0.58; + if (availableRpx > 0 && charWidthRpx > 0) { + estimated = Math.floor(availableRpx / charWidthRpx); + } + } catch (e) { + // 异常时使用兜底估算值 + } + // 减去容差:宁可稍早触发展开,也不让“一行放不下却看不到按钮” + this.barcodeClampLength = Math.max(10, estimated - 2); + }, + toggleBarcodeExpand() { + if (!this.isBarcodeTooLong) { + return; + } + this.barcodeExpanded = !this.barcodeExpanded; + }, async loadSelectedItemBarcode(item) { if (!item) { this.selectedItemBarcode = ''; @@ -2201,13 +2249,17 @@ import voice from '@/core/utils/voice'; box-sizing: border-box; display: flex; flex-direction: column; - gap: 8rpx; min-height: 0; } + .content-wrap > * + * { + margin-top: 8rpx; + } + .top-detail-panel { flex: 1; min-height: 0; + margin: 0 -12rpx; } .wave-banner { @@ -2562,7 +2614,7 @@ import voice from '@/core/utils/voice'; } .pick-name { - font-size: 36rpx; + font-size: 34rpx; color: #303133; font-weight: 600; flex: 1; @@ -2589,12 +2641,12 @@ import voice from '@/core/utils/voice'; .detail-main { display: flex; align-items: flex-start; - gap: 16rpx; } .detail-main-left { width: 200rpx; min-width: 200rpx; + margin-right: 16rpx; } .goods-image { @@ -2641,6 +2693,8 @@ import voice from '@/core/utils/voice'; .detail-main-right--matched { background: #ecf5ff; box-shadow: inset 0 0 0 2rpx #2979ff; + padding: 5rpx; + box-sizing: border-box; } .pick-image-empty { @@ -2692,6 +2746,12 @@ import voice from '@/core/utils/voice'; color: #909399; } + .pick-row--compact .pick-label { + width: auto; + min-width: auto; + margin-right: 5rpx; + } + .pick-value { flex: 1; color: #303133; @@ -2703,6 +2763,29 @@ import voice from '@/core/utils/voice'; font-weight: 700; } + .pick-row--barcode { + align-items: flex-start; + } + + .pick-value--clamp { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + word-break: keep-all; + } + + .barcode-toggle-btn { + flex-shrink: 0; + margin-left: 12rpx; + margin-top: 4rpx; + padding: 0 16rpx; + font-size: 26rpx; + line-height: 40rpx; + color: #2979ff; + background: #ecf5ff; + border-radius: 8rpx; + } + .index-grid { display: flex; flex-wrap: wrap;