diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue
index 3e025ec..79125b0 100644
--- a/pages/work/order/order-review.vue
+++ b/pages/work/order/order-review.vue
@@ -262,10 +262,10 @@
orderList: [],
listType: '',
totalOrders: 0,
- totalUnreviewedCount: 0,
taskId: '',
scanPickerName: '',
- reviewedOrderIds: []
+ reviewedOrderIds: [],
+ _navigatedToDetail: false
};
},
computed: {
@@ -275,6 +275,27 @@
return list;
}
return list.filter(item => !item?.hasBoundPrintStation);
+ },
+ totalUnreviewedCount() {
+ const list = Array.isArray(this.orderList) ? this.orderList : [];
+ if (!list.length) return 0;
+ const reviewedIds = this.reviewedOrderIds;
+ if (this.listType === 'single') {
+ return list.filter(item => {
+ const itemId = Number(item.id || item.orderId || 0);
+ if (itemId > 0 && reviewedIds.includes(itemId)) return false;
+ return !item.isReviewed;
+ }).length;
+ }
+ if (this.listType === 'group') {
+ return list.filter(item => (item.unreviewedCount || 0) > 0).length;
+ }
+ // listType 为空时兜底
+ return list.filter(item => {
+ const itemId = Number(item.id || item.orderId || 0);
+ if (itemId > 0 && reviewedIds.includes(itemId)) return false;
+ return !item.isReviewed;
+ }).length;
}
},
onLoad(options) {
@@ -292,8 +313,7 @@
this.initializeOrderList();
this.loadPrintStations();
- // 监听复核完成事件,更新订单列表状态
- uni.$on('orderReviewCompleted', this.handleReviewCompleted);
+ // 监听拦截完成事件
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
},
onShow() {
@@ -301,15 +321,14 @@
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('resume');
- // 从 storage 读取待处理的复核完成事件(兼容 uni.$emit 跨页面不可靠的场景)
- this.applyPendingReviewComplete();
+ // 返回页面时刷新订单列表数据,确保复核状态和剩余未复核数准确
+ this.refreshOrderListIfNeeded();
},
onHide() {
this.safeDispatchBroadcast('pause');
},
onUnload() {
this.safeDispatchBroadcast('stop');
- uni.$off('orderReviewCompleted', this.handleReviewCompleted);
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
},
methods: {
@@ -706,7 +725,6 @@
this.paginationTotal = 0;
this.currentPage = 1;
this.totalOrders = 0;
- this.totalUnreviewedCount = 0;
this.listType = '';
},
async handleRefreshTask() {
@@ -903,12 +921,14 @@
logs: Array.isArray(item?.logs) ? item.logs : []
};
},
- handleScanOrderSuccess(result) {
+ handleScanOrderSuccess(result, silent = false) {
if (!result) {
- uni.showToast({
- title: '未查询到订单',
- icon: 'none'
- });
+ if (!silent) {
+ uni.showToast({
+ title: '未查询到订单',
+ icon: 'none'
+ });
+ }
return;
}
@@ -941,11 +961,12 @@
this.paginationTotal = result?.total ?? flatList.length;
this.goodsInfoList = [];
this.totalOrders = result?.totalOrders ?? 0;
- this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
- uni.showToast({
- title: `共匹配 ${flatList.length} 条订单`,
- icon: 'none'
- });
+ if (!silent) {
+ uni.showToast({
+ title: `共匹配 ${flatList.length} 条订单`,
+ icon: 'none'
+ });
+ }
return;
}
@@ -979,11 +1000,12 @@
this.paginationTotal = this.orderList.length;
this.goodsInfoList = [];
this.totalOrders = this.orderList.reduce((sum, w) => sum + (w.totalOrders || 0), 0);
- this.totalUnreviewedCount = this.orderList.filter(item => (item.unreviewedCount || 0) > 0).length;
- uni.showToast({
- title: `共匹配 ${this.orderList.length} 个波次`,
- icon: 'none'
- });
+ if (!silent) {
+ uni.showToast({
+ title: `共匹配 ${this.orderList.length} 个波次`,
+ icon: 'none'
+ });
+ }
return;
}
@@ -1054,9 +1076,10 @@
`waveIndex=${encodeURIComponent(waveIndex)}`,
`cacheKey=${encodeURIComponent(cacheKey)}`
];
+ this._navigatedToDetail = true;
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
},
- async requestScanOrder(keyword) {
+ async requestScanOrder(keyword, silent = false) {
const normalizedKeyword = this.normalizeKeyword(keyword);
if (!normalizedKeyword) {
uni.showToast({
@@ -1066,22 +1089,28 @@
return;
}
- uni.showLoading({
- title: '查询订单中...'
- });
+ if (!silent) {
+ uni.showLoading({
+ title: '查询订单中...'
+ });
+ }
try {
const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword));
const payload = this.extractScanOrderPayload(response);
const result = this.normalizeScanOrderResult(payload);
- this.handleScanOrderSuccess(result);
+ this.handleScanOrderSuccess(result, silent);
} catch (error) {
- const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
- uni.showToast({
- title: message || '订单查询失败',
- icon: 'none'
- });
+ if (!silent) {
+ const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
+ uni.showToast({
+ title: message || '订单查询失败',
+ icon: 'none'
+ });
+ }
} finally {
- uni.hideLoading();
+ if (!silent) {
+ uni.hideLoading();
+ }
}
},
async toggleUnboundPrintStationOnly() {
@@ -1221,6 +1250,7 @@
`orderIds=${encodeURIComponent(JSON.stringify(orderIds))}`,
`cacheKey=${encodeURIComponent(cacheKey)}`
];
+ this._navigatedToDetail = true;
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
},
async handlePrintAllUnreviewed(item) {
@@ -1448,28 +1478,12 @@
return item;
});
}
-
- // 重新计算总未复核数
- if (mode === 'single') {
- this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
- } else if (mode === 'group') {
- this.totalUnreviewedCount = this.orderList.filter(item => (item.unreviewedCount || 0) > 0).length;
- }
},
- applyPendingReviewComplete() {
- try {
- const pending = uni.getStorageSync('pendingReviewComplete');
- if (pending) {
- uni.removeStorageSync('pendingReviewComplete');
- // 先记录已完成复核的 orderId,确保 getReviewStatusText 能立即识别
- const id = Number(pending.orderId);
- if (id > 0 && !this.reviewedOrderIds.includes(id)) {
- this.reviewedOrderIds = [...this.reviewedOrderIds, id];
- }
- this.handleReviewCompleted(pending);
- }
- } catch (e) {
- console.warn('[OrderReview] 读取待处理复核完成数据失败:', e);
+ refreshOrderListIfNeeded() {
+ // 如果是从详情页返回且有 keyword,直接从服务器重新拉取最新数据(静默,不显示提示)
+ if (this._navigatedToDetail && this.keyword) {
+ this._navigatedToDetail = false;
+ this.requestScanOrder(this.keyword, true);
}
},
handlePageChange(page) {
diff --git a/pages/work/order/scatter-pick-goods-detail.vue b/pages/work/order/scatter-pick-goods-detail.vue
index eb8ff71..4ee67a8 100644
--- a/pages/work/order/scatter-pick-goods-detail.vue
+++ b/pages/work/order/scatter-pick-goods-detail.vue
@@ -83,7 +83,7 @@
{{ currentGoods.skuName || '--' }}
- 条码:{{ currentGoods.barcode || '--' }}
+ 条码:{{ currentGoods.barcode || '--' }}
货主:{{ detailInfo.storeRemark || '--' }}
已扫:{{ currentGoods.scannedQty || 0 }}
@@ -431,6 +431,42 @@
});
return Array.from(new Set(result));
},
+ handleBarcodeClick() {
+ const item = this.currentGoods;
+ if (!item) return;
+ const skuName = item.skuName || '商品';
+ const planQty = item.planQty || 0;
+ const scannedQty = item.scannedQty || 0;
+ if (scannedQty >= planQty) {
+ uni.showToast({ title: '该商品已复核完成', icon: 'none' });
+ return;
+ }
+ uni.showModal({
+ title: '无条码复核',
+ content: `将商品「${skuName}」标记为已复核(${scannedQty}/${planQty} → ${planQty}/${planQty})?`,
+ success: (res) => {
+ if (!res.confirm) return;
+ const idx = this.goodsList.findIndex(g => g.id === item.id);
+ if (idx < 0) return;
+ if (typeof this.$set === 'function') {
+ this.$set(this.goodsList, idx, { ...item, scannedQty: planQty });
+ } else {
+ this.goodsList[idx].scannedQty = planQty;
+ }
+ // 标记条码匹配状态,使条码行高亮
+ const matchId = String(item.id || '');
+ if (matchId) {
+ this.matchedGoodsId = matchId;
+ if (typeof this.$set === 'function') {
+ this.$set(this.matchedGoodsState, matchId, true);
+ } else {
+ this.matchedGoodsState[matchId] = true;
+ }
+ }
+ uni.showToast({ title: `已标记为已复核(${planQty}/${planQty})`, icon: 'success' });
+ }
+ });
+ },
handleBroadcastResult(result) {
const scanCode = this.normalizeScanResult(result);
if (!scanCode) {
@@ -1097,6 +1133,16 @@
line-height: 54rpx;
}
+ .barcode-value {
+ color: #2979ff;
+ text-decoration: underline;
+ text-decoration-color: rgba(41, 121, 255, 0.45);
+ }
+
+ .barcode-value:active {
+ opacity: 0.7;
+ }
+
.goods-row--barcode-highlight {
background: #f0fff4;
border: 1rpx solid #b7eb8f;
diff --git a/pages/work/product/query.vue b/pages/work/product/query.vue
index 75b0c7c..ac87c2d 100644
--- a/pages/work/product/query.vue
+++ b/pages/work/product/query.vue
@@ -141,8 +141,8 @@
>
库位
- 库存
- 可移库存
+ 库存
+ 可移库存
@@ -161,7 +161,7 @@
class="storage-table__row"
>
{{ getStorageSpaceText(storageItem) }}
- {{ getStorageQuantityText(storageItem) }}
+ {{ getStorageQuantityText(storageItem) }}
批次号
库位
- 库存
- 可移库存
+ 库存
+ 可移库存
@@ -208,7 +208,7 @@
>
{{ getBatchNumberBySource(storageItem, item) }}
{{ getStorageSpaceText(storageItem) }}
- {{ getStorageQuantityText(storageItem) }}
+ {{ getStorageQuantityText(storageItem) }}
{{ getStorageAvailableText(storageItem) }}
@@ -820,13 +820,15 @@
.filter(Boolean)
)];
},
- filterByBarcodeExact(list, keyword) {
+ filterByBarcodeFuzzy(list, keyword) {
const target = this.normalizeKeyword(keyword);
if (!target) {
return list;
}
- return (list || []).filter(item => this.extractBarcodeList(item).includes(target));
+ return (list || []).filter(item =>
+ this.extractBarcodeList(item).some(barcode => barcode.includes(target))
+ );
},
extractListFromResponse(response) {
const responseData = response && response.data;
@@ -933,11 +935,27 @@
return list.filter(item => !this.hasBatchNumber(item));
},
updateDisplayListByMode(sourceList, keyword, isBarcodeKeyword) {
- const filteredByKeyword = isBarcodeKeyword
- ? this.filterByBarcodeExact(sourceList, keyword)
- : this.filterByNameContains(sourceList, keyword);
+ // 无论是条码还是名称,都支持模糊匹配
+ const filteredByBarcode = this.filterByBarcodeFuzzy(sourceList, keyword);
+ const filteredByName = this.filterByNameContains(sourceList, keyword);
- this.list = this.applyQueryModeFilter(filteredByKeyword);
+ // 合并去重:以名称为主,补充条码模糊匹配到的额外结果
+ const mergedMap = new Map();
+ filteredByName.forEach(item => {
+ const keys = this.getProductMatchKeys(item);
+ const key = keys.find(k => k) || JSON.stringify(item);
+ mergedMap.set(key, item);
+ });
+ filteredByBarcode.forEach(item => {
+ const keys = this.getProductMatchKeys(item);
+ const key = keys.find(k => k) || JSON.stringify(item);
+ if (!mergedMap.has(key)) {
+ mergedMap.set(key, item);
+ }
+ });
+ const merged = Array.from(mergedMap.values());
+
+ this.list = this.applyQueryModeFilter(merged);
this.scheduleRefreshStorageSectionMetas();
},
buildQueryParams(keyword) {
@@ -1723,8 +1741,8 @@
.goods-item {
background: #fff;
border-radius: 12rpx;
- padding: 10rpx 16rpx;
- margin-bottom: 20rpx;
+ padding: 24rpx 16rpx;
+ margin-bottom: 28rpx;
border: 1rpx solid #e9edf3;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
position: relative;
@@ -1733,8 +1751,8 @@
.item-summary {
position: relative;
background: #fff;
- padding-bottom: 10rpx;
- margin-bottom: 4rpx;
+ padding-bottom: 18rpx;
+ margin-bottom: 8rpx;
border-radius: 12rpx 12rpx 0 0;
box-shadow: 0 6rpx 14rpx rgba(15, 23, 42, 0.06);
}
@@ -1942,8 +1960,8 @@
.storage-table__row {
display: grid;
align-items: center;
- min-height: 48rpx;
- padding: 0;
+ min-height: 72rpx;
+ padding: 8rpx 0;
border-bottom: 1rpx solid #e8eef7;
box-sizing: border-box;
}
@@ -2020,6 +2038,16 @@
flex: none;
}
+ .storage-col--qty-stock {
+ color: #e74c3c;
+ font-weight: 600;
+ }
+
+ .storage-col--qty-available {
+ color: #2979ff;
+ font-weight: 600;
+ }
+
.storage-col--action {
color: #2979ff;
font-weight: 600;