修改订单拣货页面

This commit is contained in:
zm2000 2026-08-25 10:46:04 +08:00
parent 9672a315b6
commit 24d455a2e8

View File

@ -64,9 +64,21 @@
<text class="pick-name">{{ selectedPickItem.itemName || '--' }}</text>
<text v-if="boundCartNo" class="pick-cart-tag">拣货车:{{ boundCartNo }}{{ boundCartName ? `(${boundCartName})` : '' }}</text>
</view>
<view class="pick-row"><text class="pick-label">货主:</text><text class="pick-value">{{ selectedPickItem.storeRemark || '--' }}</text></view>
<view class="pick-row"><text class="pick-label">商品条码:</text><text class="pick-value">{{ selectedItemBarcodeLoading ? '条码加载中...' : (selectedItemBarcode || '--') }}</text></view>
<view class="pick-row"><text class="pick-label">库位:</text><text class="pick-value pick-value--highlight">{{ selectedPickItem.spaceName || '--' }}</text></view>
<view class="pick-row pick-row--compact"><text class="pick-label">货主:</text><text class="pick-value">{{ selectedPickItem.storeRemark || '--' }}</text></view>
<view class="pick-row pick-row--barcode pick-row--compact">
<text v-if="!isBarcodeTooLong || selectedItemBarcodeLoading" class="pick-label">条码:</text>
<text
class="pick-value"
:class="{ 'pick-value--clamp': isBarcodeTooLong && !barcodeExpanded }"
@click.stop="toggleBarcodeExpand"
>{{ selectedItemBarcodeLoading ? '条码加载中...' : (selectedItemBarcode || '--') }}</text>
<text
v-if="isBarcodeTooLong && !selectedItemBarcodeLoading"
class="barcode-toggle-btn"
@click.stop="toggleBarcodeExpand"
>{{ barcodeExpanded ? '收起' : '展开' }}</text>
</view>
<view class="pick-row pick-row--compact"><text class="pick-label">库位:</text><text class="pick-value pick-value--highlight">{{ selectedPickItem.spaceName || '--' }}</text></view>
<view class="pick-row"><text class="pick-label">应拣总数:</text><text class="pick-value">{{ selectedPickItem.totalQty }}</text></view>
</view>
</view>
@ -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;