diff --git a/pages/replenishment/replenishShorts.vue b/pages/replenishment/replenishShorts.vue
index 7652a87..1ad7a66 100644
--- a/pages/replenishment/replenishShorts.vue
+++ b/pages/replenishment/replenishShorts.vue
@@ -4,11 +4,10 @@
@@ -32,6 +31,24 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -40,17 +57,17 @@
-
+
- 暂无缺货数据
- 当前仓库所有SKU分拣区库存充足,无需补货。
+ {{ list.length === 0 ? '暂无缺货数据' : '未找到匹配的商品' }}
+ {{ list.length === 0 ? '当前仓库所有SKU分拣区库存充足,无需补货。' : '请尝试其他搜索关键词' }}
{{ item.stock_code || item.stock_id || '-' }}
+
+ 缺货数
+
+ {{ formatQty(item.shortage) }}
+
+
+ 补货状态
+
+ {{ replenishStatusText(item.replenishment_status) }}
+
商品名称
{{ item.stock_name || '-' }}
- 分拣区库存
-
- {{ formatQty(item.pick_zone_quantity) }}
-
-
- 存货区库存
-
- {{ formatQty(item.storage_zone_quantity) }}
-
-
- 订单需求
+ 出货数量
{{ formatQty(item.total_demand) }}
- 缺口
+ 分拣区数量
- {{ formatQty(item.shortage) }}
+ {{ formatQty(item.pick_zone_quantity) }}
- 建议补货
+ 存储区数量
- {{ formatQty(item.replenishment_needed) }}
+ {{ formatQty(item.storage_zone_quantity) }}
- 补货状态
+ 推荐补货量
- {{ replenishStatusText(item.replenishment_status) }}
+ {{ formatQty(item.replenishment_needed) }}
补货库位
@@ -146,6 +163,7 @@
total: 0,
page: 1,
pageSize: 20,
+ searchKeyword: '',
sort: {
sortField: 'shortage',
sortOrder: 'DESC'
@@ -155,6 +173,16 @@
computed: {
totalPages() {
return Math.max(1, Math.ceil(this.total / this.pageSize));
+ },
+ filteredList() {
+ const keyword = this.searchKeyword.trim();
+ if (!keyword) {
+ return this.list;
+ }
+ return this.list.filter(item => {
+ const name = String(item.stock_name || '').toLowerCase();
+ return name.includes(keyword.toLowerCase());
+ });
}
},
onLoad() {
@@ -164,8 +192,9 @@
goProductQuery(item) {
const keyword = item.stock_name || item.stock_code || item.stock_id || '';
const stockId = item.stock_id || '';
+ uni.setStorageSync('replenish_query_keyword', keyword);
uni.navigateTo({
- url: `/pages/work/product/query?keyword=${encodeURIComponent(keyword)}&stock_id=${encodeURIComponent(stockId)}`
+ url: `/pages/work/product/query?stock_id=${encodeURIComponent(stockId)}`
});
},
handleBack() {
@@ -313,9 +342,13 @@
line-height: 1;
}
- .header-side--right .header-action-text {
- margin-left: 0;
- color: #2979ff;
+ .header-btn-refresh {
+ padding: 14rpx 28rpx;
+ background: #2979ff;
+ color: #ffffff;
+ font-size: 30rpx;
+ border-radius: 8rpx;
+ line-height: 1;
}
/* ===== 汇总统计栏 ===== */
@@ -367,6 +400,42 @@
line-height: 1;
}
+ /* ===== 搜索框 ===== */
+ .search-bar {
+ padding: 12rpx 16rpx;
+ background: #ffffff;
+ border-bottom: 1rpx solid #ebeef5;
+ flex-shrink: 0;
+ }
+
+ .search-bar__input-wrap {
+ display: flex;
+ align-items: center;
+ gap: 16rpx;
+ padding: 20rpx 24rpx;
+ background: #f5f7fa;
+ border-radius: 12rpx;
+ }
+
+ .search-bar__input {
+ flex: 1;
+ font-size: 34rpx;
+ color: #303133;
+ height: 48rpx;
+ line-height: 48rpx;
+ padding: 0;
+ background: transparent;
+ border: none;
+ outline: none;
+ }
+
+ .search-bar__clear {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 6rpx;
+ }
+
/* ===== 页面主体 ===== */
.page-body {
flex: 1;
@@ -444,7 +513,7 @@
}
.card-metric--1 {
- background: #f8f9fb;
+ background: #f0f2f5;
border-radius: 6rpx;
}
@@ -488,7 +557,11 @@
}
.card-metric__value--danger {
- color: #f56c6c;
+ background-color: #f56c6c;
+ color: #ffffff;
+ padding: 18rpx 12rpx;
+ margin: -18rpx 0;
+ border-radius: 0 6rpx 6rpx 0;
}
.card-metric__value--primary {
@@ -540,7 +613,7 @@
/* ===== 底部统计栏 ===== */
.bottom-bar {
flex-shrink: 0;
- padding: 16rpx 24rpx;
+ padding: 24rpx 24rpx;
background: #ffffff;
border-top: 1rpx solid #ebeef5;
}
@@ -553,13 +626,13 @@
}
.bottom-bar__text {
- font-size: 24rpx;
+ font-size: 26rpx;
color: #909399;
}
.pagination-btn {
- padding: 12rpx 24rpx;
- font-size: 26rpx;
+ padding: 18rpx 36rpx;
+ font-size: 30rpx;
color: #2979ff;
background: #f0f5ff;
border-radius: 8rpx;
diff --git a/pages/work/order/order-review-comps/ReviewDetail.vue b/pages/work/order/order-review-comps/ReviewDetail.vue
index 994883d..419f57f 100644
--- a/pages/work/order/order-review-comps/ReviewDetail.vue
+++ b/pages/work/order/order-review-comps/ReviewDetail.vue
@@ -251,6 +251,7 @@ import voice from '@/core/utils/voice';
showMultiMatchPopup: false,
multiMatchFirst: {},
pendingScanCode: '',
+ _dismissedMultiMatchCodes: [],
_lastScanCode: '',
_lastScanTime: 0
};
@@ -381,6 +382,53 @@ import voice from '@/core/utils/voice';
// 多个商品匹配时,弹出底部抽屉显示第一个商品详情
if (matchIndices.length > 1) {
+ // 如果用户之前关闭过该条码的弹窗,不再弹出,自动分配到未扫完的商品
+ if (this._dismissedMultiMatchCodes.includes(code)) {
+ // 从匹配列表中找第一个未扫完的商品
+ let matchIndex = -1;
+ for (let i = 0; i < matchIndices.length; i++) {
+ const idx = matchIndices[i];
+ const item = this.goodsList[idx];
+ if ((item?.scannedQty || 0) < (item?.planQty || 0)) {
+ matchIndex = idx;
+ break;
+ }
+ }
+ if (matchIndex === -1) {
+ uni.showToast({ title: '所有匹配商品已复核完成', icon: 'none' });
+ return true;
+ }
+ this.currentGoodsIndex = matchIndex;
+ const matchedItem = this.goodsList[matchIndex];
+ const maxQty = matchedItem?.planQty || 0;
+ const currentScanned = matchedItem?.scannedQty || 0;
+ const addQty = Math.min(this.scanQty || 1, maxQty - currentScanned);
+ const newScanned = Math.min(currentScanned + addQty, maxQty);
+ this.$emit('updateScannedQty', matchIndex, newScanned);
+ const allDone = this.goodsList.every((item, idx) => {
+ const qty = idx === matchIndex ? newScanned : (item.scannedQty || 0);
+ return qty >= (item.planQty || 0);
+ });
+ if (allDone) {
+ voice.speak('数据一致');
+ }
+ // 已扫数量达到计划数量时,标记为已匹配(显示绿底和"已匹配"状态)
+ if (newScanned >= maxQty) {
+ const matchedId = String(matchedItem?.id || '');
+ if (matchedId) {
+ this.matchedGoodsId = matchedId;
+ if (typeof this.$set === 'function') {
+ this.$set(this.matchedGoodsState, matchedId, true);
+ } else {
+ this.matchedGoodsState[matchedId] = true;
+ }
+ }
+ }
+ if ((this.scanQty || 1) > 1) {
+ this.$emit('resetScanQty');
+ }
+ return true;
+ }
const firstIdx = matchIndices[0];
this.multiMatchFirst = { ...this.goodsList[firstIdx] };
this.pendingScanCode = code;
@@ -527,6 +575,7 @@ import voice from '@/core/utils/voice';
this.showMultiMatchPopup = false;
this.multiMatchFirst = {};
this.pendingScanCode = '';
+ this._dismissedMultiMatchCodes = [];
this._lastScanCode = '';
this._lastScanTime = 0;
},
@@ -535,6 +584,10 @@ import voice from '@/core/utils/voice';
*/
handleMultiMatchClose() {
this.showMultiMatchPopup = false;
+ // 将当前条码加入已忽略列表,关闭后不再弹窗提示
+ if (this.pendingScanCode && !this._dismissedMultiMatchCodes.includes(this.pendingScanCode)) {
+ this._dismissedMultiMatchCodes.push(this.pendingScanCode);
+ }
this.pendingScanCode = '';
},
handleMultiMatchSelect(index) {
diff --git a/pages/work/product/query.vue b/pages/work/product/query.vue
index 09fc72e..49ce72e 100644
--- a/pages/work/product/query.vue
+++ b/pages/work/product/query.vue
@@ -266,7 +266,12 @@
});
this.safeDispatchBroadcast('start');
this.routeStockId = options?.stock_id || '';
- const routeKeyword = this.normalizeKeyword(options?.keyword || options?.barcode || options?.code || '');
+ // 优先从存储中读取关键字(解决 URL 传参中文乱码问题)
+ const storageKeyword = uni.getStorageSync('replenish_query_keyword') || '';
+ const routeKeyword = this.normalizeKeyword(storageKeyword || options?.keyword || options?.barcode || options?.code || '');
+ if (storageKeyword) {
+ uni.removeStorageSync('replenish_query_keyword');
+ }
if (routeKeyword) {
this.keyword = routeKeyword;
}
@@ -706,19 +711,15 @@
}
});
- if (!warehouseItemMap.size) {
- return;
- }
-
- // 找到 mergedList 中对应的商品
+ // 找到 mergedList 中需要获取图片的商品
const itemsToFetch = [];
mergedList.forEach(item => {
if (!item || typeof item !== 'object') {
return;
}
- const id = item.id;
- if (id && warehouseItemMap.has(id)) {
+ const id = item.id || item.stock_id;
+ if (id && (warehouseItemMap.has(id) || !warehouseItemMap.size)) {
itemsToFetch.push({ item, id });
}
});
@@ -772,6 +773,75 @@
}
});
},
+ /**
+ * 从 stock.warehouse.getBarcodes 接口获取商品条码
+ * @param {Array} mergedList 合并后的商品列表
+ */
+ async fetchProductBarcodes(mergedList) {
+ if (!Array.isArray(mergedList) || !mergedList.length) {
+ return;
+ }
+
+ const itemsToFetch = mergedList.filter(item => {
+ if (!item || typeof item !== 'object') return false;
+ const id = item.id || item.stock_id;
+ return !!id;
+ });
+
+ if (!itemsToFetch.length) {
+ return;
+ }
+
+ console.log('[ProductQuery] 开始获取商品条码,数量:', itemsToFetch.length);
+
+ const results = await Promise.allSettled(
+ itemsToFetch.map((item) => {
+ const id = item.id || item.stock_id;
+ return this.$http('stock.warehouse.getBarcodes', { id: Number(id) });
+ })
+ );
+
+ itemsToFetch.forEach((item, index) => {
+ const result = results[index];
+ if (result.status === 'rejected') {
+ return;
+ }
+
+ const response = result.value;
+ if (!response || response.code !== 200) {
+ return;
+ }
+
+ const barcodeList = this.extractBarcodeListFromResponse(response);
+ const allBarcodes = (barcodeList || [])
+ .map(entry => {
+ if (!entry) return '';
+ if (typeof entry === 'string') return entry.trim();
+ if (typeof entry !== 'object') return '';
+ return String(entry.barcode || entry.code || '').trim();
+ })
+ .filter(Boolean);
+
+ if (allBarcodes.length > 0) {
+ item.barcodes = allBarcodes;
+ console.log(`[ProductQuery] 商品 id=${item.id || item.stock_id} 获取到 ${allBarcodes.length} 个条码`);
+ }
+ });
+ },
+ extractBarcodeListFromResponse(response) {
+ const candidates = [
+ response?.data,
+ response?.data?.data,
+ response?.list,
+ response
+ ];
+ for (let i = 0; i < candidates.length; i += 1) {
+ if (Array.isArray(candidates[i])) {
+ return candidates[i];
+ }
+ }
+ return [];
+ },
getBarcodeText(item) {
if (!item || typeof item !== 'object') {
return '--';
@@ -1032,20 +1102,12 @@
},
buildWarehouseListWhereParams(keyword) {
const normalized = this.normalizeKeyword(keyword);
- if (!normalized && !this.routeStockId) {
+ if (!normalized) {
return {};
}
const where = {};
- if (this.routeStockId) {
- where.stock_id = {
- operator: 'eq',
- value: this.routeStockId,
- type: 'number'
- };
- }
-
if (normalized) {
if (this.isBarcodeLike(normalized)) {
where.barcode = {
@@ -1055,7 +1117,7 @@
};
} else {
where.item_name = {
- operator: 'like',
+ operator: this.routeStockId ? 'eq' : 'like',
value: normalized,
type: 'string'
};
@@ -1599,7 +1661,16 @@
if (searchOk || warehouseOk || listOk) {
const detailList = listOk ? this.extractListFromResponse(listRes) : [];
- const mergedList = this.mergeProductResultLists(nextList, warehouseList, detailList);
+ let mergedList = this.mergeProductResultLists(nextList, warehouseList, detailList);
+
+ // 从分拣缺货补货进入时,根据 stock_id 精确匹配
+ if (this.routeStockId) {
+ const targetStockId = Number(this.routeStockId);
+ mergedList = mergedList.filter(item => {
+ const id = Number(item.id || item.stock_id);
+ return id === targetStockId;
+ });
+ }
// 异步获取商品图片(不阻塞主流程)
this.fetchProductImages(mergedList, warehouseList).then(() => {
@@ -1609,6 +1680,11 @@
console.warn('[ProductQuery] 获取商品图片异常:', error);
});
+ // 异步获取商品条码(不阻塞主流程)
+ this.fetchProductBarcodes(mergedList).catch(error => {
+ console.warn('[ProductQuery] 获取商品条码异常:', error);
+ });
+
this.rawList = mergedList;
this.updateDisplayListByMode(mergedList, keyword, isBarcodeKeyword);
console.log('[ProductQuery] 搜索结果数量:', this.list.length);