feat(B2B备货): 商品行展示图片与条码增强,版本升至 1.0.147
- stockPreparationDetail 商品卡片新增商品缩略图(多图角标 1/N、点击预览多图、
无图占位/加载失败占位)
- 商品名称只显示名称,条码统一由条码行展示;条码取值扩展
stock.barcodes / item_snapshot.barcode,超 3 个支持展开/收起
- 新增相机扫码按钮,扫码结果匹配商品条码标记已扫
- 扫码匹配 extractItemBarcodeCandidates 支持条码对象({barcode})与 item_snapshot.barcode
- 编辑分箱 startEdit 保留 stock / item_snapshot 字段
- package.json 与 manifest.json 版本号 1.0.146 → 1.0.147
This commit is contained in:
parent
d4d101865e
commit
afd1672610
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wms-pda",
|
||||
"version": "1.0.146",
|
||||
"version": "1.0.147",
|
||||
"private": true,
|
||||
"description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)",
|
||||
"scripts": {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name" : "WMS_PDA",
|
||||
"appid" : "__UNI__0B3DAD3",
|
||||
"description" : "多平台快速开发的UI框架",
|
||||
"versionName" : "1.0.146",
|
||||
"versionCode" : 1000146,
|
||||
"versionName" : "1.0.147",
|
||||
"versionCode" : 1000147,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"statusbar" : {
|
||||
|
||||
@ -38,9 +38,45 @@
|
||||
<text class="packing-tip__text">同一商品行 + 箱号不能重复;分箱数量合计需等于应拣数量(超量会被拦截)。</text>
|
||||
</view>
|
||||
<view v-for="(it, idx) in editItems" :key="idx" class="goods-item">
|
||||
<view class="goods-item__header">
|
||||
<text class="goods-item__name">{{ formatItemName(it) }}</text>
|
||||
<text v-if="it.scanned" class="goods-item__scanned">已扫</text>
|
||||
<view class="goods-item__top">
|
||||
<view class="goods-item__images">
|
||||
<view class="goods-item__img-wrap" @click.stop="previewItemImages(it, 0)">
|
||||
<image
|
||||
v-if="getItemImageCount(it) > 0 && !isItemImageError(it)"
|
||||
:key="'item-img-' + getItemFirstImage(it)"
|
||||
:src="getItemFirstImage(it)"
|
||||
class="goods-item__img"
|
||||
mode="aspectFill"
|
||||
@error="handleItemImageError(it)"
|
||||
></image>
|
||||
<view v-else-if="isItemImageError(it)" class="goods-item__img goods-item__img--error">
|
||||
<u-icon name="close-circle" size="40" color="#f56c6c"></u-icon>
|
||||
<text class="goods-item__img-error-text">加载失败</text>
|
||||
</view>
|
||||
<view v-else class="goods-item__img goods-item__img--empty">
|
||||
<u-icon name="photo" size="40" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
<view v-if="getItemImageCount(it) > 1" class="goods-item__img-badge">
|
||||
<text class="goods-item__img-badge-text">1/{{ getItemImageCount(it) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item__info">
|
||||
<view class="goods-item__header">
|
||||
<view class="goods-item__name">
|
||||
<text class="goods-item__name-text">{{ getItemNameWithBarcode(it) }}</text>
|
||||
</view>
|
||||
<view class="goods-item__actions">
|
||||
<view class="goods-item__actions-top">
|
||||
<text v-if="hasMoreBarcodes(it)" class="goods-item__barcode-toggle" @click.stop="toggleBarcodeExpand(it)">{{ isBarcodeExpanded(it) ? '收起' : '展开' }}</text>
|
||||
<view class="goods-item__scan-btn" @click.stop="handleItemScan()">
|
||||
<u-icon name="scan" size="64rpx" color="#2979ff"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<text v-if="it.scanned" class="goods-item__scanned">已扫</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item__row">
|
||||
<text class="goods-item__label">应拣</text>
|
||||
@ -79,8 +115,39 @@
|
||||
</view>
|
||||
<view v-else class="goods-list">
|
||||
<view v-for="(it, idx) in items" :key="idx" class="goods-item">
|
||||
<view class="goods-item__header">
|
||||
<text class="goods-item__name">{{ formatItemName(it) }}</text>
|
||||
<view class="goods-item__top">
|
||||
<view class="goods-item__images">
|
||||
<view class="goods-item__img-wrap" @click.stop="previewItemImages(it, 0)">
|
||||
<image
|
||||
v-if="getItemImageCount(it) > 0 && !isItemImageError(it)"
|
||||
:key="'item-img-' + getItemFirstImage(it)"
|
||||
:src="getItemFirstImage(it)"
|
||||
class="goods-item__img"
|
||||
mode="aspectFill"
|
||||
@error="handleItemImageError(it)"
|
||||
></image>
|
||||
<view v-else-if="isItemImageError(it)" class="goods-item__img goods-item__img--error">
|
||||
<u-icon name="close-circle" size="40" color="#f56c6c"></u-icon>
|
||||
<text class="goods-item__img-error-text">加载失败</text>
|
||||
</view>
|
||||
<view v-else class="goods-item__img goods-item__img--empty">
|
||||
<u-icon name="photo" size="40" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
<view v-if="getItemImageCount(it) > 1" class="goods-item__img-badge">
|
||||
<text class="goods-item__img-badge-text">1/{{ getItemImageCount(it) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item__info">
|
||||
<view class="goods-item__header">
|
||||
<view class="goods-item__name">
|
||||
<text class="goods-item__name-text">{{ getItemNameWithBarcode(it) }}</text>
|
||||
</view>
|
||||
<view class="goods-item__actions">
|
||||
<text v-if="hasMoreBarcodes(it)" class="goods-item__barcode-toggle" @click.stop="toggleBarcodeExpand(it)">{{ isBarcodeExpanded(it) ? '收起' : '展开' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-item__row">
|
||||
<text class="goods-item__label">应拣:</text>
|
||||
@ -269,6 +336,8 @@
|
||||
photoSyncTimer: null,
|
||||
autoSaveTimer: null,
|
||||
lastSavedPackingKey: '',
|
||||
barcodeExpandMap: {},
|
||||
imageErrorMap: {},
|
||||
allowDirectBack: false,
|
||||
showCancelPrepConfirm: false,
|
||||
showFinishPrepConfirm: false,
|
||||
@ -443,6 +512,8 @@
|
||||
const sourceFields = [
|
||||
item?.barcode,
|
||||
item?.barcodes,
|
||||
item?.stock?.barcodes,
|
||||
item?.item_snapshot?.barcode,
|
||||
item?.skuCode,
|
||||
item?.sku_code,
|
||||
item?.item_barcode,
|
||||
@ -453,7 +524,9 @@
|
||||
sourceFields.forEach(source => {
|
||||
const list = Array.isArray(source) ? source : [source];
|
||||
list.forEach(s => {
|
||||
const text = String(s || '').trim();
|
||||
// 条码对象(如 stock.barcodes 的 {id, barcode})取其 barcode 字段
|
||||
const raw = (s && typeof s === 'object') ? (s.barcode ?? s.value ?? s.code) : s;
|
||||
const text = String(raw || '').trim();
|
||||
if (!text) return;
|
||||
text.split(/[;,,、|\s]+/)
|
||||
.map(part => this.normalizeScanCode(part))
|
||||
@ -498,6 +571,20 @@
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 相机扫码匹配商品条码
|
||||
handleItemScan() {
|
||||
if (!this.editing) return;
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
|
||||
success: (res) => {
|
||||
const code = this.normalizeUniScanResult(res);
|
||||
if (!code) return;
|
||||
this.markItemScannedByCode(code);
|
||||
},
|
||||
fail: () => {}
|
||||
});
|
||||
},
|
||||
async fetchDetail() {
|
||||
this.loading = true;
|
||||
try {
|
||||
@ -509,6 +596,7 @@
|
||||
return;
|
||||
}
|
||||
this.detail = data;
|
||||
this.imageErrorMap = {};
|
||||
this.loadPhotos();
|
||||
// 备货中:默认进入可编辑分箱
|
||||
if (this.canEdit) {
|
||||
@ -550,10 +638,69 @@
|
||||
return [];
|
||||
},
|
||||
formatItemName(item) {
|
||||
// 只显示商品名称;商品条码统一由下方「条码」行展示,避免重复
|
||||
const name = String(item?.item_name || '').trim();
|
||||
const code = String(item?.item_code || '').trim();
|
||||
if (name && code) return `${name}、${code}`;
|
||||
return name || code || '--';
|
||||
return name || '--';
|
||||
},
|
||||
// 名称 + 顿号 + 条码(同一文本流,换行更自然)
|
||||
getItemNameWithBarcode(item) {
|
||||
const name = this.formatItemName(item);
|
||||
if (this.getBarcodeCount(item) > 0) {
|
||||
return `${name}、${this.getBarcodeDisplayText(item)}`;
|
||||
}
|
||||
return name;
|
||||
},
|
||||
// 商品条码:优先取 stock.barcodes,其次 barcodes / barcode / item_snapshot.barcode
|
||||
getBarcodeList(item) {
|
||||
if (!item || typeof item !== 'object') return [];
|
||||
const collected = [];
|
||||
const push = (list) => {
|
||||
if (Array.isArray(list)) {
|
||||
list.forEach(b => {
|
||||
const text = typeof b === 'string' ? b : (b?.barcode ?? b?.value ?? b?.code);
|
||||
const code = String(text ?? '').trim();
|
||||
if (code) collected.push(code);
|
||||
});
|
||||
} else if (typeof list === 'string' && list.trim()) {
|
||||
list.split(/[;;,,\s]+/).forEach(s => {
|
||||
const code = s.trim();
|
||||
if (code) collected.push(code);
|
||||
});
|
||||
}
|
||||
};
|
||||
push(item.stock?.barcodes);
|
||||
if (collected.length === 0) push(item.barcodes);
|
||||
if (collected.length === 0) push(item.barcode);
|
||||
if (collected.length === 0) push(item.item_snapshot?.barcode);
|
||||
return Array.from(new Set(collected));
|
||||
},
|
||||
getBarcodeCount(item) {
|
||||
return this.getBarcodeList(item).length;
|
||||
},
|
||||
hasMoreBarcodes(item) {
|
||||
return this.getBarcodeCount(item) > 3;
|
||||
},
|
||||
getBarcodeExpandKey(item) {
|
||||
if (!item || typeof item !== 'object') return 'unknown';
|
||||
return String(item.order_item_id || item.stock_id || item.item_id || item.item_code || 'unknown');
|
||||
},
|
||||
isBarcodeExpanded(item) {
|
||||
return !!this.barcodeExpandMap[this.getBarcodeExpandKey(item)];
|
||||
},
|
||||
toggleBarcodeExpand(item) {
|
||||
const key = this.getBarcodeExpandKey(item);
|
||||
this.$set(this.barcodeExpandMap, key, !this.barcodeExpandMap[key]);
|
||||
},
|
||||
getBarcodeDisplayList(item) {
|
||||
const list = this.getBarcodeList(item);
|
||||
if (list.length > 3 && !this.isBarcodeExpanded(item)) {
|
||||
return list.slice(0, 3);
|
||||
}
|
||||
return list;
|
||||
},
|
||||
getBarcodeDisplayText(item) {
|
||||
const list = this.getBarcodeDisplayList(item);
|
||||
return list.length > 0 ? list.join(';') : '--';
|
||||
},
|
||||
getPickLocations(item) {
|
||||
const locs = item?.pick_locations;
|
||||
@ -563,6 +710,40 @@
|
||||
.filter(Boolean)
|
||||
.join('、');
|
||||
},
|
||||
// 商品图片:优先取 stock.image_url
|
||||
getItemImages(item) {
|
||||
const raw = item?.stock?.image_url ?? item?.image_url;
|
||||
if (Array.isArray(raw)) {
|
||||
return raw.map(String).map(s => s.trim()).filter(Boolean);
|
||||
}
|
||||
if (typeof raw === 'string' && raw.trim()) {
|
||||
return raw.split(/[;;,,\s]+/).map(s => s.trim()).filter(Boolean);
|
||||
}
|
||||
return [];
|
||||
},
|
||||
getItemImageCount(item) {
|
||||
return this.getItemImages(item).length;
|
||||
},
|
||||
getItemFirstImage(item) {
|
||||
return this.getItemImages(item)[0] || '';
|
||||
},
|
||||
getItemImageKey(item) {
|
||||
return String(item?.order_item_id || item?.stock_id || item?.item_id || item?.item_code || 'unknown');
|
||||
},
|
||||
isItemImageError(item) {
|
||||
return !!this.imageErrorMap[this.getItemImageKey(item)];
|
||||
},
|
||||
handleItemImageError(item) {
|
||||
this.$set(this.imageErrorMap, this.getItemImageKey(item), true);
|
||||
},
|
||||
previewItemImages(item, index) {
|
||||
const urls = this.getItemImages(item);
|
||||
if (!urls.length) return;
|
||||
uni.previewImage({
|
||||
urls,
|
||||
current: urls[index] || urls[0]
|
||||
});
|
||||
},
|
||||
getItemPackedQty(item) {
|
||||
const boxes = item?.boxes;
|
||||
if (!Array.isArray(boxes)) return 0;
|
||||
@ -606,6 +787,8 @@
|
||||
item_name: it.item_name,
|
||||
plan_qty: it.plan_qty,
|
||||
pick_locations: it.pick_locations || [],
|
||||
stock: it.stock || null,
|
||||
item_snapshot: it.item_snapshot || null,
|
||||
barcode: it.barcode,
|
||||
barcodes: it.barcodes,
|
||||
skuCode: it.skuCode,
|
||||
@ -1213,9 +1396,20 @@
|
||||
border: 1rpx solid #ebeef5;
|
||||
}
|
||||
|
||||
.goods-item__top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.goods-item__info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.goods-item__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
@ -1223,14 +1417,31 @@
|
||||
.goods-item__name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.goods-item__name-text {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #303133;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.goods-item__actions {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.goods-item__actions-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.goods-item__scanned {
|
||||
flex-shrink: 0;
|
||||
margin-left: 12rpx;
|
||||
margin-top: 8rpx;
|
||||
padding: 2rpx 14rpx;
|
||||
font-size: 36rpx;
|
||||
line-height: 1.4;
|
||||
@ -1239,6 +1450,20 @@
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.goods-item__scan-btn {
|
||||
flex-shrink: 0;
|
||||
margin-left: 12rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-item__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -1265,6 +1490,70 @@
|
||||
color: #18a058;
|
||||
}
|
||||
|
||||
.goods-item__barcode-toggle {
|
||||
flex-shrink: 0;
|
||||
font-size: 36rpx;
|
||||
color: #2979ff;
|
||||
line-height: 1.4;
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-item__images {
|
||||
flex-shrink: 0;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.goods-item__img-wrap {
|
||||
position: relative;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.goods-item__img {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
background-color: #f5f7fa;
|
||||
border: 1rpx solid #ebeef5;
|
||||
}
|
||||
|
||||
.goods-item__img--empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.goods-item__img--error {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.goods-item__img-error-text {
|
||||
margin-top: 4rpx;
|
||||
font-size: 20rpx;
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.goods-item__img-badge {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 2rpx 10rpx;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 10rpx 0 8rpx 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.goods-item__img-badge-text {
|
||||
font-size: 20rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.goods-item__boxes,
|
||||
.goods-item__locations {
|
||||
display: flex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user