修改复核发货页面
This commit is contained in:
parent
9ec654692e
commit
a665fb40ed
@ -153,7 +153,7 @@
|
|||||||
<view class="multi-match-popup">
|
<view class="multi-match-popup">
|
||||||
<view class="multi-match-popup-title">库内有相同商品</view>
|
<view class="multi-match-popup-title">库内有相同商品</view>
|
||||||
<view class="multi-match-popup-body">
|
<view class="multi-match-popup-body">
|
||||||
<view class="multi-match-card" @click="handleMultiMatchSelect(0)">
|
<view class="multi-match-card" @click="handleMultiMatchSelect()">
|
||||||
<view class="multi-match-thumb">
|
<view class="multi-match-thumb">
|
||||||
<u-image
|
<u-image
|
||||||
class="multi-match-image"
|
class="multi-match-image"
|
||||||
@ -313,10 +313,11 @@ import voice from '@/core/utils/voice';
|
|||||||
viewMode: savedMode,
|
viewMode: savedMode,
|
||||||
showMultiMatchPopup: false,
|
showMultiMatchPopup: false,
|
||||||
multiMatchFirst: {},
|
multiMatchFirst: {},
|
||||||
|
multiMatchGoodsIndex: -1,
|
||||||
pendingScanCode: '',
|
pendingScanCode: '',
|
||||||
_dismissedMultiMatchCodes: [],
|
dismissedMultiMatchCodes: [],
|
||||||
_lastScanCode: '',
|
lastScanCode: '',
|
||||||
_lastScanTime: 0,
|
lastScanTime: 0,
|
||||||
showNoBarcodePopup: false,
|
showNoBarcodePopup: false,
|
||||||
noBarcodeItemName: '',
|
noBarcodeItemName: '',
|
||||||
noBarcodePickedCount: 0,
|
noBarcodePickedCount: 0,
|
||||||
@ -460,13 +461,13 @@ import voice from '@/core/utils/voice';
|
|||||||
|
|
||||||
// 基于时间的去重:300ms 内相同条码跳过,防止广播重复触发导致弹窗多次
|
// 基于时间的去重:300ms 内相同条码跳过,防止广播重复触发导致弹窗多次
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const elapsed = now - this._lastScanTime;
|
const elapsed = now - this.lastScanTime;
|
||||||
if (code === this._lastScanCode && elapsed < 300) {
|
if (code === this.lastScanCode && elapsed < 300) {
|
||||||
console.log('[ReviewDetail][handleScanCode] 去重拦截,相同条码:', code, '间隔(ms):', elapsed);
|
console.log('[ReviewDetail][handleScanCode] 去重拦截,相同条码:', code, '间隔(ms):', elapsed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this._lastScanCode = code;
|
this.lastScanCode = code;
|
||||||
this._lastScanTime = now;
|
this.lastScanTime = now;
|
||||||
|
|
||||||
// 多商品匹配弹窗已打开且扫描相同条码时,跳过避免重复提示
|
// 多商品匹配弹窗已打开且扫描相同条码时,跳过避免重复提示
|
||||||
if (this.showMultiMatchPopup && this.pendingScanCode === code) {
|
if (this.showMultiMatchPopup && this.pendingScanCode === code) {
|
||||||
@ -487,20 +488,31 @@ import voice from '@/core/utils/voice';
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多个商品匹配时,弹出底部抽屉显示第一个商品详情
|
// 命中行中存在 has_shared_barcode(库内存在共享同一条码的其他商品)时,弹出底部抽屉提示
|
||||||
if (matchIndices.length > 1) {
|
const sharedIdx = matchIndices.find(idx => this.goodsList[idx]?.has_shared_barcode);
|
||||||
// 如果用户之前关闭过该条码的弹窗,不再弹出,自动分配到未扫完的商品
|
if (sharedIdx !== undefined) {
|
||||||
if (this._dismissedMultiMatchCodes.includes(code)) {
|
// 如果用户之前关闭过该条码的弹窗,不再弹出,自动分配到未扫完的共享条码商品
|
||||||
// 从匹配列表中找第一个未扫完的商品
|
if (this.dismissedMultiMatchCodes.includes(code)) {
|
||||||
|
// 优先找共享条码商品中第一个未扫完的,否则找任意匹配商品中第一个未扫完的
|
||||||
let matchIndex = -1;
|
let matchIndex = -1;
|
||||||
for (let i = 0; i < matchIndices.length; i++) {
|
for (let i = 0; i < matchIndices.length; i++) {
|
||||||
const idx = matchIndices[i];
|
const idx = matchIndices[i];
|
||||||
const item = this.goodsList[idx];
|
const item = this.goodsList[idx];
|
||||||
if ((item?.scannedQty || 0) < (item?.planQty || 0)) {
|
if (item?.has_shared_barcode && (item?.scannedQty || 0) < (item?.planQty || 0)) {
|
||||||
matchIndex = idx;
|
matchIndex = idx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (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) {
|
if (matchIndex === -1) {
|
||||||
uni.showToast({ title: '所有匹配商品已复核完成', icon: 'none' });
|
uni.showToast({ title: '所有匹配商品已复核完成', icon: 'none' });
|
||||||
voice.speak('超出订单数');
|
voice.speak('超出订单数');
|
||||||
@ -541,15 +553,15 @@ import voice from '@/core/utils/voice';
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const firstIdx = matchIndices[0];
|
this.multiMatchFirst = { ...this.goodsList[sharedIdx] };
|
||||||
this.multiMatchFirst = { ...this.goodsList[firstIdx] };
|
this.multiMatchGoodsIndex = sharedIdx;
|
||||||
this.pendingScanCode = code;
|
this.pendingScanCode = code;
|
||||||
this.showMultiMatchPopup = true;
|
this.showMultiMatchPopup = true;
|
||||||
voice.speak('库内有相同商品');
|
voice.speak('库内有相同商品');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仅一个商品匹配,直接处理
|
// 无共享条码商品,直接处理第一个匹配商品
|
||||||
const matchIndex = matchIndices[0];
|
const matchIndex = matchIndices[0];
|
||||||
this.currentGoodsIndex = matchIndex;
|
this.currentGoodsIndex = matchIndex;
|
||||||
const matchedItem = this.goodsList[matchIndex];
|
const matchedItem = this.goodsList[matchIndex];
|
||||||
@ -735,19 +747,21 @@ import voice from '@/core/utils/voice';
|
|||||||
this.currentGoodsIndex = 0;
|
this.currentGoodsIndex = 0;
|
||||||
this.showMultiMatchPopup = false;
|
this.showMultiMatchPopup = false;
|
||||||
this.multiMatchFirst = {};
|
this.multiMatchFirst = {};
|
||||||
|
this.multiMatchGoodsIndex = -1;
|
||||||
this.pendingScanCode = '';
|
this.pendingScanCode = '';
|
||||||
this._dismissedMultiMatchCodes = [];
|
this.dismissedMultiMatchCodes = [];
|
||||||
this._lastScanCode = '';
|
this.lastScanCode = '';
|
||||||
this._lastScanTime = 0;
|
this.lastScanTime = 0;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 多商品匹配时,选择第一个商品进行处理
|
* 多商品匹配时,选择第一个商品进行处理
|
||||||
*/
|
*/
|
||||||
handleMultiMatchClose() {
|
handleMultiMatchClose() {
|
||||||
this.showMultiMatchPopup = false;
|
this.showMultiMatchPopup = false;
|
||||||
|
this.multiMatchGoodsIndex = -1;
|
||||||
// 将当前条码加入已忽略列表,关闭后不再弹窗提示
|
// 将当前条码加入已忽略列表,关闭后不再弹窗提示
|
||||||
if (this.pendingScanCode && !this._dismissedMultiMatchCodes.includes(this.pendingScanCode)) {
|
if (this.pendingScanCode && !this.dismissedMultiMatchCodes.includes(this.pendingScanCode)) {
|
||||||
this._dismissedMultiMatchCodes.push(this.pendingScanCode);
|
this.dismissedMultiMatchCodes.push(this.pendingScanCode);
|
||||||
}
|
}
|
||||||
this.pendingScanCode = '';
|
this.pendingScanCode = '';
|
||||||
},
|
},
|
||||||
@ -757,17 +771,10 @@ import voice from '@/core/utils/voice';
|
|||||||
this.pendingScanCode = '';
|
this.pendingScanCode = '';
|
||||||
if (!code) return;
|
if (!code) return;
|
||||||
|
|
||||||
// 重新查找匹配项,定位到第一个匹配商品并处理
|
// 定位弹窗对应的共享条码商品(无参数时使用弹窗打开时记录的行)
|
||||||
const matchIndices = [];
|
const targetIdx = (typeof index === 'number' && index >= 0) ? index : this.multiMatchGoodsIndex;
|
||||||
this.goodsList.forEach((item, idx) => {
|
this.multiMatchGoodsIndex = -1;
|
||||||
const candidates = this.extractBarcodeCandidates(item);
|
if (targetIdx === undefined || targetIdx < 0 || !this.goodsList[targetIdx]) return;
|
||||||
if (candidates.includes(code)) {
|
|
||||||
matchIndices.push(idx);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const targetIdx = matchIndices[index] ?? matchIndices[0];
|
|
||||||
if (targetIdx === undefined) return;
|
|
||||||
|
|
||||||
this.currentGoodsIndex = targetIdx;
|
this.currentGoodsIndex = targetIdx;
|
||||||
const matchedItem = this.goodsList[targetIdx];
|
const matchedItem = this.goodsList[targetIdx];
|
||||||
|
|||||||
@ -456,9 +456,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
showWeighPopup: false,
|
showWeighPopup: false,
|
||||||
showOrderInterceptPopup: false,
|
showOrderInterceptPopup: false,
|
||||||
orderInterceptInfo: {},
|
orderInterceptInfo: {},
|
||||||
_interceptContinueNext: false,
|
interceptContinueNext: false,
|
||||||
_interceptNotifiedIds: [],
|
interceptNotifiedIds: [],
|
||||||
_interceptAutoNotifiedIds: [],
|
interceptAutoNotifiedIds: [],
|
||||||
keyboardHeight: 0,
|
keyboardHeight: 0,
|
||||||
weighWeight: 0,
|
weighWeight: 0,
|
||||||
weighAfterReview: false,
|
weighAfterReview: false,
|
||||||
@ -474,9 +474,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
autoShip: true,
|
autoShip: true,
|
||||||
showPrintFailPopup: false,
|
showPrintFailPopup: false,
|
||||||
printFailMessage: '',
|
printFailMessage: '',
|
||||||
_pendingShipAction: 'autoNext',
|
pendingShipAction: 'autoNext',
|
||||||
_lastPrintError: '',
|
lastPrintError: '',
|
||||||
_printFailDismissed: false,
|
printFailDismissed: false,
|
||||||
printStationList: [],
|
printStationList: [],
|
||||||
selectedStationId: '',
|
selectedStationId: '',
|
||||||
stationListPage: 1,
|
stationListPage: 1,
|
||||||
@ -496,13 +496,13 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
taskId: '',
|
taskId: '',
|
||||||
scanPickerName: '',
|
scanPickerName: '',
|
||||||
reviewedOrderIds: [],
|
reviewedOrderIds: [],
|
||||||
_debugClickCount: 0,
|
debugClickCount: 0,
|
||||||
_debugClickTimer: null,
|
debugClickTimer: null,
|
||||||
_debugMode: false,
|
debugMode: false,
|
||||||
_debugLogs: [],
|
debugLogs: [],
|
||||||
_autoSelectFirst: false,
|
autoSelectFirst: false,
|
||||||
_scanKeyword: '',
|
scanKeyword: '',
|
||||||
_dprefixedBarcodeVerified: false,
|
dprefixedBarcodeVerified: false,
|
||||||
packageBindingCancelled: false,
|
packageBindingCancelled: false,
|
||||||
skipPackagePopupOnAllScanned: false,
|
skipPackagePopupOnAllScanned: false,
|
||||||
showDetailView: false,
|
showDetailView: false,
|
||||||
@ -665,12 +665,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.destroyKeyboardHeightListener();
|
this.destroyKeyboardHeightListener();
|
||||||
this.safeDispatchBroadcast('stop');
|
this.safeDispatchBroadcast('stop');
|
||||||
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
|
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||||
if (this._debugMode) {
|
if (this.debugMode) {
|
||||||
this.flushDebugLogs();
|
this.flushDebugLogs();
|
||||||
}
|
}
|
||||||
if (this._debugClickTimer) {
|
if (this.debugClickTimer) {
|
||||||
clearTimeout(this._debugClickTimer);
|
clearTimeout(this.debugClickTimer);
|
||||||
this._debugClickTimer = null;
|
this.debugClickTimer = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -1474,8 +1474,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const text = this.normalizeKeyword(this.keyword);
|
const text = this.normalizeKeyword(this.keyword);
|
||||||
if (!text) return;
|
if (!text) return;
|
||||||
this.keyword = '';
|
this.keyword = '';
|
||||||
this._autoSelectFirst = true; // 输入搜索选第一个
|
this.autoSelectFirst = true; // 输入搜索选第一个
|
||||||
this._scanKeyword = text; // 记录本次扫描/输入的快递单号或波次号
|
this.scanKeyword = text; // 记录本次扫描/输入的快递单号或波次号
|
||||||
// 详情视图模式下,搜索框输入当作条码传给 ReviewDetail
|
// 详情视图模式下,搜索框输入当作条码传给 ReviewDetail
|
||||||
if (this.showDetailView && this.$refs.reviewDetail) {
|
if (this.showDetailView && this.$refs.reviewDetail) {
|
||||||
// 已复核订单禁止扫描
|
// 已复核订单禁止扫描
|
||||||
@ -1500,7 +1500,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
if (this.isDprefixedWave) {
|
if (this.isDprefixedWave) {
|
||||||
const matchedOrder = this.findOrderByProductBarcode(text);
|
const matchedOrder = this.findOrderByProductBarcode(text);
|
||||||
if (matchedOrder) {
|
if (matchedOrder) {
|
||||||
this._dprefixedBarcodeVerified = true;
|
this.dprefixedBarcodeVerified = true;
|
||||||
this.goPickGoodsDetail(matchedOrder);
|
this.goPickGoodsDetail(matchedOrder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1528,24 +1528,24 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.matchPrintStation(text);
|
this.matchPrintStation(text);
|
||||||
},
|
},
|
||||||
handleSearchBoxDebugTap() {
|
handleSearchBoxDebugTap() {
|
||||||
this._debugClickCount += 1;
|
this.debugClickCount += 1;
|
||||||
// 超过2秒未继续点击则重置计数
|
// 超过2秒未继续点击则重置计数
|
||||||
if (this._debugClickTimer) {
|
if (this.debugClickTimer) {
|
||||||
clearTimeout(this._debugClickTimer);
|
clearTimeout(this.debugClickTimer);
|
||||||
}
|
}
|
||||||
this._debugClickTimer = setTimeout(() => {
|
this.debugClickTimer = setTimeout(() => {
|
||||||
this._debugClickCount = 0;
|
this.debugClickCount = 0;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
if (this._debugClickCount >= 10) {
|
if (this.debugClickCount >= 10) {
|
||||||
this._debugClickCount = 0;
|
this.debugClickCount = 0;
|
||||||
if (this._debugClickTimer) {
|
if (this.debugClickTimer) {
|
||||||
clearTimeout(this._debugClickTimer);
|
clearTimeout(this.debugClickTimer);
|
||||||
this._debugClickTimer = null;
|
this.debugClickTimer = null;
|
||||||
}
|
}
|
||||||
this._debugMode = !this._debugMode;
|
this.debugMode = !this.debugMode;
|
||||||
if (this._debugMode) {
|
if (this.debugMode) {
|
||||||
// 清空旧日志
|
// 清空旧日志
|
||||||
this._debugLogs = [];
|
this.debugLogs = [];
|
||||||
this.debugLog('调试模式', '已开启');
|
this.debugLog('调试模式', '已开启');
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
const filePath = '_doc/print_debug_log.txt';
|
const filePath = '_doc/print_debug_log.txt';
|
||||||
@ -1572,19 +1572,19 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
debugLog(label, data) {
|
debugLog(label, data) {
|
||||||
if (!this._debugMode) return;
|
if (!this.debugMode) return;
|
||||||
const timestamp = new Date().toLocaleString();
|
const timestamp = new Date().toLocaleString();
|
||||||
const text = `[${timestamp}][${label}] ${typeof data === 'string' ? data : JSON.stringify(data, null, 2)}`;
|
const text = `[${timestamp}][${label}] ${typeof data === 'string' ? data : JSON.stringify(data, null, 2)}`;
|
||||||
this._debugLogs.push(text);
|
this.debugLogs.push(text);
|
||||||
// 每10条写入一次文件
|
// 每10条写入一次文件
|
||||||
if (this._debugLogs.length >= 10) {
|
if (this.debugLogs.length >= 10) {
|
||||||
this.flushDebugLogs();
|
this.flushDebugLogs();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
flushDebugLogs() {
|
flushDebugLogs() {
|
||||||
if (!this._debugLogs.length) return;
|
if (!this.debugLogs.length) return;
|
||||||
const content = this._debugLogs.join('\n') + '\n';
|
const content = this.debugLogs.join('\n') + '\n';
|
||||||
this._debugLogs = [];
|
this.debugLogs = [];
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
try {
|
try {
|
||||||
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => {
|
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, fs => {
|
||||||
@ -1683,9 +1683,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
};
|
};
|
||||||
this.reviewedOrderIds = [];
|
this.reviewedOrderIds = [];
|
||||||
this.currentOrderIndex = -1;
|
this.currentOrderIndex = -1;
|
||||||
this._printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
// 重置拦截自动提示去重(每个波次本次会话只自动弹 1 次)
|
// 重置拦截自动提示去重(每个波次本次会话只自动弹 1 次)
|
||||||
this._interceptAutoNotifiedIds = [];
|
this.interceptAutoNotifiedIds = [];
|
||||||
// 数量回归1
|
// 数量回归1
|
||||||
this.scanQuantity = 1;
|
this.scanQuantity = 1;
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
@ -1700,7 +1700,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._autoSelectFirst = false; // 任务刷新保持原顺序
|
this.autoSelectFirst = false; // 任务刷新保持原顺序
|
||||||
uni.showLoading({ title: '刷新中...' });
|
uni.showLoading({ title: '刷新中...' });
|
||||||
try {
|
try {
|
||||||
const response = await this.$http('order.recheckOrder.scanTask', { task_id: Number(this.taskId) });
|
const response = await this.$http('order.recheckOrder.scanTask', { task_id: Number(this.taskId) });
|
||||||
@ -1956,7 +1956,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.paginationTotal = result?.total ?? flatList.length;
|
this.paginationTotal = result?.total ?? flatList.length;
|
||||||
this.goodsInfoList = [];
|
this.goodsInfoList = [];
|
||||||
// 刷新订单列表后重置已提示的拦截订单记录
|
// 刷新订单列表后重置已提示的拦截订单记录
|
||||||
this._interceptNotifiedIds = [];
|
this.interceptNotifiedIds = [];
|
||||||
this.totalOrders = result?.totalOrders ?? 0;
|
this.totalOrders = result?.totalOrders ?? 0;
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -1970,20 +1970,20 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
if (this.isDprefixedWave) return;
|
if (this.isDprefixedWave) return;
|
||||||
const unreviewedItems = this.orderList.filter(item => !item.isReviewed);
|
const unreviewedItems = this.orderList.filter(item => !item.isReviewed);
|
||||||
let target = null;
|
let target = null;
|
||||||
if (this._autoSelectFirst) {
|
if (this.autoSelectFirst) {
|
||||||
const scanKw = String(this._scanKeyword || '').trim();
|
const scanKw = String(this.scanKeyword || '').trim();
|
||||||
// 扫描快递单号时:优先精确匹配该运单号对应的订单,进入其复核详情
|
// 扫描快递单号时:优先精确匹配该运单号对应的订单,进入其复核详情
|
||||||
if (scanKw) {
|
if (scanKw) {
|
||||||
target = this.orderList.find(item => String(item.waybillNo || '').trim() === scanKw) || null;
|
target = this.orderList.find(item => String(item.waybillNo || '').trim() === scanKw) || null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!target) {
|
if (!target) {
|
||||||
target = this._autoSelectFirst ? unreviewedItems[0] : unreviewedItems.pop();
|
target = this.autoSelectFirst ? unreviewedItems[0] : unreviewedItems.pop();
|
||||||
}
|
}
|
||||||
if (target) {
|
if (target) {
|
||||||
// 扫描快递单号进入详情时,确保顶部显示该运单号(接口未返回运单号时兜底)
|
// 扫描快递单号进入详情时,确保顶部显示该运单号(接口未返回运单号时兜底)
|
||||||
if (this._autoSelectFirst && !String(target.waybillNo || '').trim() && this._scanKeyword) {
|
if (this.autoSelectFirst && !String(target.waybillNo || '').trim() && this.scanKeyword) {
|
||||||
target = { ...target, waybillNo: this._scanKeyword };
|
target = { ...target, waybillNo: this.scanKeyword };
|
||||||
}
|
}
|
||||||
this.goPickGoodsDetail(target);
|
this.goPickGoodsDetail(target);
|
||||||
}
|
}
|
||||||
@ -2040,7 +2040,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const unreviewedItems = this.orderList.filter(item => (item.unreviewedCount || 0) > 0);
|
const unreviewedItems = this.orderList.filter(item => (item.unreviewedCount || 0) > 0);
|
||||||
let target = null;
|
let target = null;
|
||||||
if (this._autoSelectFirst) {
|
if (this.autoSelectFirst) {
|
||||||
// 优先精确匹配 data.wave_id 对应的波次,进入该波次详情并显示其波次号
|
// 优先精确匹配 data.wave_id 对应的波次,进入该波次详情并显示其波次号
|
||||||
const targetWaveId = String(result?.waveId ?? '').trim();
|
const targetWaveId = String(result?.waveId ?? '').trim();
|
||||||
if (targetWaveId) {
|
if (targetWaveId) {
|
||||||
@ -2048,7 +2048,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!target) {
|
if (!target) {
|
||||||
target = this._autoSelectFirst ? unreviewedItems[0] : unreviewedItems.pop();
|
target = this.autoSelectFirst ? unreviewedItems[0] : unreviewedItems.pop();
|
||||||
}
|
}
|
||||||
if (target) {
|
if (target) {
|
||||||
this.goPickGoodsDetail(target);
|
this.goPickGoodsDetail(target);
|
||||||
@ -2439,12 +2439,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
if (interceptedIndex >= 0) {
|
if (interceptedIndex >= 0) {
|
||||||
this.currentOrderIndex = interceptedIndex;
|
this.currentOrderIndex = interceptedIndex;
|
||||||
}
|
}
|
||||||
this._interceptContinueNext = !!continueAfterIntercept;
|
this.interceptContinueNext = !!continueAfterIntercept;
|
||||||
// 自动跳转流程:记录本次已提示过的拦截订单,避免后续查找时重复弹窗造成死循环
|
// 自动跳转流程:记录本次已提示过的拦截订单,避免后续查找时重复弹窗造成死循环
|
||||||
if (continueAfterIntercept) {
|
if (continueAfterIntercept) {
|
||||||
const interceptedId = String(item.id || item.orderId || '');
|
const interceptedId = String(item.id || item.orderId || '');
|
||||||
if (interceptedId && !this._interceptNotifiedIds.includes(interceptedId)) {
|
if (interceptedId && !this.interceptNotifiedIds.includes(interceptedId)) {
|
||||||
this._interceptNotifiedIds = [...this._interceptNotifiedIds, interceptedId];
|
this.interceptNotifiedIds = [...this.interceptNotifiedIds, interceptedId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.speakVoice('此单已拦截');
|
this.speakVoice('此单已拦截');
|
||||||
@ -2455,7 +2455,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
// 切换订单时重置包材/称重取消标志,新订单继续正常弹窗
|
// 切换订单时重置包材/称重取消标志,新订单继续正常弹窗
|
||||||
this.packageBindingCancelled = false;
|
this.packageBindingCancelled = false;
|
||||||
this.weighCancelled = false;
|
this.weighCancelled = false;
|
||||||
this._printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
|
|
||||||
// 收集商品明细数据
|
// 收集商品明细数据
|
||||||
let rawItems = [];
|
let rawItems = [];
|
||||||
@ -2505,7 +2505,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
barcode: stockBarcodes.length > 0 ? stockBarcodes.join(', ') : String(snapshot?.barcode || snapshot?.item_code || rawItem?.item_code || '--'),
|
barcode: stockBarcodes.length > 0 ? stockBarcodes.join(', ') : String(snapshot?.barcode || snapshot?.item_code || rawItem?.item_code || '--'),
|
||||||
barcodes: stockBarcodes.length > 0 ? stockBarcodes : (snapshot?.barcode ? [snapshot.barcode] : []),
|
barcodes: stockBarcodes.length > 0 ? stockBarcodes : (snapshot?.barcode ? [snapshot.barcode] : []),
|
||||||
imageUrl,
|
imageUrl,
|
||||||
images
|
images,
|
||||||
|
// 库内是否存在共享同一条码的其他商品(order.recheckOrder.scanOrder 返回的 has_shared_barcode)
|
||||||
|
has_shared_barcode: !!(stockItem?.has_shared_barcode ?? rawItem?.has_shared_barcode ?? false)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2570,15 +2572,15 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
Array.isArray(this.detailInfo?.interceptList) &&
|
Array.isArray(this.detailInfo?.interceptList) &&
|
||||||
this.detailInfo.interceptList.length > 0
|
this.detailInfo.interceptList.length > 0
|
||||||
) {
|
) {
|
||||||
// Vue2 下划线开头 data 字段不会代理到 this,先保证数组存在再使用(先赋值后读取)
|
// 数组字段已去下划线前缀(data 中可正常代理到 this),无需再手动补默认值
|
||||||
if (!Array.isArray(this._interceptAutoNotifiedIds)) {
|
if (!Array.isArray(this.interceptAutoNotifiedIds)) {
|
||||||
this._interceptAutoNotifiedIds = [];
|
this.interceptAutoNotifiedIds = [];
|
||||||
}
|
}
|
||||||
const waveKey = String(this.detailInfo?.waveId || this.detailInfo?.waveNo || '').trim();
|
const waveKey = String(this.detailInfo?.waveId || this.detailInfo?.waveNo || '').trim();
|
||||||
const alreadyNotified = !!waveKey && this._interceptAutoNotifiedIds.includes(waveKey);
|
const alreadyNotified = !!waveKey && this.interceptAutoNotifiedIds.includes(waveKey);
|
||||||
if (!alreadyNotified) {
|
if (!alreadyNotified) {
|
||||||
if (waveKey) {
|
if (waveKey) {
|
||||||
this._interceptAutoNotifiedIds = [...this._interceptAutoNotifiedIds, waveKey];
|
this.interceptAutoNotifiedIds = [...this.interceptAutoNotifiedIds, waveKey];
|
||||||
}
|
}
|
||||||
// 团购模式:自动弹出拦截信息时同步语音提示"有拦截订单"
|
// 团购模式:自动弹出拦截信息时同步语音提示"有拦截订单"
|
||||||
this.speakVoice('有拦截订单');
|
this.speakVoice('有拦截订单');
|
||||||
@ -2591,7 +2593,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
// 从订单列表抽屉点击进入时(无条码校验),仅展示详情,需手动扫描商品条码复核
|
// 从订单列表抽屉点击进入时(无条码校验),仅展示详情,需手动扫描商品条码复核
|
||||||
// 已复核订单不再触发自动复核/打印,仅展示只读详情
|
// 已复核订单不再触发自动复核/打印,仅展示只读详情
|
||||||
if (this.isDprefixedWave && this.detailGoodsList.length > 0 && !item.isReviewed) {
|
if (this.isDprefixedWave && this.detailGoodsList.length > 0 && !item.isReviewed) {
|
||||||
if (this._dprefixedBarcodeVerified) {
|
if (this.dprefixedBarcodeVerified) {
|
||||||
this.detailGoodsList = this.detailGoodsList.map(g => ({
|
this.detailGoodsList = this.detailGoodsList.map(g => ({
|
||||||
...g,
|
...g,
|
||||||
scannedQty: g.planQty
|
scannedQty: g.planQty
|
||||||
@ -2625,7 +2627,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
backToList() {
|
backToList() {
|
||||||
this.showDetailView = false;
|
this.showDetailView = false;
|
||||||
this.detailGoodsList = [];
|
this.detailGoodsList = [];
|
||||||
this._dprefixedBarcodeVerified = false;
|
this.dprefixedBarcodeVerified = false;
|
||||||
// 从详情返回后刷新列表
|
// 从详情返回后刷新列表
|
||||||
// D波次:keyword 是商品条码,scanOrder 不支持,依赖本地已更新的 orderList
|
// D波次:keyword 是商品条码,scanOrder 不支持,依赖本地已更新的 orderList
|
||||||
if (this.keyword && !this.isDprefixedWave) {
|
if (this.keyword && !this.isDprefixedWave) {
|
||||||
@ -2663,8 +2665,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
// 关闭拦截订单弹窗:若为自动跳转流程(复核完自动找下一个)触发,则继续查找下一个未复核订单
|
// 关闭拦截订单弹窗:若为自动跳转流程(复核完自动找下一个)触发,则继续查找下一个未复核订单
|
||||||
handleCloseOrderInterceptPopup() {
|
handleCloseOrderInterceptPopup() {
|
||||||
this.showOrderInterceptPopup = false;
|
this.showOrderInterceptPopup = false;
|
||||||
const shouldContinue = this._interceptContinueNext;
|
const shouldContinue = this.interceptContinueNext;
|
||||||
this._interceptContinueNext = false;
|
this.interceptContinueNext = false;
|
||||||
if (shouldContinue) {
|
if (shouldContinue) {
|
||||||
this.goToNextOrder();
|
this.goToNextOrder();
|
||||||
}
|
}
|
||||||
@ -2811,8 +2813,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
},
|
},
|
||||||
handleGoodsItemClick() {
|
handleGoodsItemClick() {
|
||||||
// 打印未完成被关闭后(订单未打印未发货),点击商品列表项只重新弹出打印未完成弹窗,不自动重试打印
|
// 打印未完成被关闭后(订单未打印未发货),点击商品列表项只重新弹出打印未完成弹窗,不自动重试打印
|
||||||
if (this._printFailDismissed && !this.showPrintFailPopup) {
|
if (this.printFailDismissed && !this.showPrintFailPopup) {
|
||||||
this.printFailMessage = this._lastPrintError || '打印失败,未触发发货';
|
this.printFailMessage = this.lastPrintError || '打印失败,未触发发货';
|
||||||
this.showPrintFailPopup = true;
|
this.showPrintFailPopup = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3131,7 +3133,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
*/
|
*/
|
||||||
async ensurePrintedBeforeShip(actionType = 'autoNext') {
|
async ensurePrintedBeforeShip(actionType = 'autoNext') {
|
||||||
// 记录打印成功后的发货动作,供弹窗重试后继续执行
|
// 记录打印成功后的发货动作,供弹窗重试后继续执行
|
||||||
this._pendingShipAction = actionType;
|
this.pendingShipAction = actionType;
|
||||||
// 不打印模式:直接放行
|
// 不打印模式:直接放行
|
||||||
if (this.effectivePrintMode === 'noPrint') {
|
if (this.effectivePrintMode === 'noPrint') {
|
||||||
return true;
|
return true;
|
||||||
@ -3139,7 +3141,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
// 需要打印但未绑定打印台:阻止发货并提示
|
// 需要打印但未绑定打印台:阻止发货并提示
|
||||||
if (!this.printStationId) {
|
if (!this.printStationId) {
|
||||||
this.printFailMessage = '未绑定打印台,请先绑定打印台后再发货';
|
this.printFailMessage = '未绑定打印台,请先绑定打印台后再发货';
|
||||||
this._printFailDismissed = true;
|
this.printFailDismissed = true;
|
||||||
this.showPrintFailPopup = true;
|
this.showPrintFailPopup = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -3158,13 +3160,13 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
if (printed) {
|
if (printed) {
|
||||||
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
||||||
this.updateOrderPrintStatus(this.detailInfo);
|
this.updateOrderPrintStatus(this.detailInfo);
|
||||||
this._printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
this.speakVoice('打印成功');
|
this.speakVoice('打印成功');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 打印失败/超时:不触发发货,弹窗提示并提供打印按钮
|
// 打印失败/超时:不触发发货,弹窗提示并提供打印按钮
|
||||||
this.printFailMessage = this._lastPrintError || '打印失败,未触发发货';
|
this.printFailMessage = this.lastPrintError || '打印失败,未触发发货';
|
||||||
this._printFailDismissed = true;
|
this.printFailDismissed = true;
|
||||||
this.showPrintFailPopup = true;
|
this.showPrintFailPopup = true;
|
||||||
this.speakVoice('打印失败');
|
this.speakVoice('打印失败');
|
||||||
return false;
|
return false;
|
||||||
@ -3191,7 +3193,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
async printOrderAndWait(item) {
|
async printOrderAndWait(item) {
|
||||||
const target = item || this.detailInfo;
|
const target = item || this.detailInfo;
|
||||||
if (!target || !this.printStationId) {
|
if (!target || !this.printStationId) {
|
||||||
this._lastPrintError = '未绑定打印台';
|
this.lastPrintError = '未绑定打印台';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -3209,7 +3211,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
waveGroups = this.normalizeOrderPrintGroups(payload);
|
waveGroups = this.normalizeOrderPrintGroups(payload);
|
||||||
}
|
}
|
||||||
if (!waveGroups.length) {
|
if (!waveGroups.length) {
|
||||||
this._lastPrintError = '未获取到可打印数据';
|
this.lastPrintError = '未获取到可打印数据';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.printRequestCode = this.buildPrintRequestCode();
|
this.printRequestCode = this.buildPrintRequestCode();
|
||||||
@ -3224,14 +3226,14 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.debugLog('print.send 返回数据', response);
|
this.debugLog('print.send 返回数据', response);
|
||||||
const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500;
|
const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500;
|
||||||
if (!success) {
|
if (!success) {
|
||||||
this._lastPrintError = String(response?.message || response?.msg || '打印失败');
|
this.lastPrintError = String(response?.message || response?.msg || '打印失败');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this._lastPrintError = '';
|
this.lastPrintError = '';
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._lastPrintError = String(error?.message || error?.msg || error?.errMsg || '打印失败或超时');
|
this.lastPrintError = String(error?.message || error?.msg || error?.errMsg || '打印失败或超时');
|
||||||
console.warn('[printOrderAndWait] 打印失败/超时:', this._lastPrintError);
|
console.warn('[printOrderAndWait] 打印失败/超时:', this.lastPrintError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -3242,7 +3244,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
async doShip(action = 'autoNext') {
|
async doShip(action = 'autoNext') {
|
||||||
const ok = await this.callConfirmRecheck();
|
const ok = await this.callConfirmRecheck();
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
this._printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
if (action === 'dprefixed') {
|
if (action === 'dprefixed') {
|
||||||
// D前缀波次:确认复核后返回列表,等待下一个商品条码扫描定位
|
// D前缀波次:确认复核后返回列表,等待下一个商品条码扫描定位
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -3262,17 +3264,17 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const printed = await this.printOrderAndWait(this.detailInfo);
|
const printed = await this.printOrderAndWait(this.detailInfo);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (!printed) {
|
if (!printed) {
|
||||||
this.printFailMessage = this._lastPrintError || '打印失败,请重试';
|
this.printFailMessage = this.lastPrintError || '打印失败,请重试';
|
||||||
this.speakVoice('打印失败');
|
this.speakVoice('打印失败');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 打印成功:关闭弹窗,更新打印状态,触发发货
|
// 打印成功:关闭弹窗,更新打印状态,触发发货
|
||||||
this._printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
this.showPrintFailPopup = false;
|
this.showPrintFailPopup = false;
|
||||||
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
||||||
this.updateOrderPrintStatus(this.detailInfo);
|
this.updateOrderPrintStatus(this.detailInfo);
|
||||||
this.speakVoice('打印成功');
|
this.speakVoice('打印成功');
|
||||||
await this.doShip(this._pendingShipAction || 'autoNext');
|
await this.doShip(this.pendingShipAction || 'autoNext');
|
||||||
},
|
},
|
||||||
goToNextOrder() {
|
goToNextOrder() {
|
||||||
// 标记当前已复核
|
// 标记当前已复核
|
||||||
@ -3299,7 +3301,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const itemId = Number(item.id || item.orderId || 0);
|
const itemId = Number(item.id || item.orderId || 0);
|
||||||
if (itemId > 0 && this.reviewedOrderIds.includes(itemId)) continue;
|
if (itemId > 0 && this.reviewedOrderIds.includes(itemId)) continue;
|
||||||
// 散单模式:跳过已提示过的拦截订单,避免重复弹窗死循环
|
// 散单模式:跳过已提示过的拦截订单,避免重复弹窗死循环
|
||||||
if (this.listType === 'single' && this._interceptNotifiedIds.includes(String(itemId))) continue;
|
if (this.listType === 'single' && this.interceptNotifiedIds.includes(String(itemId))) continue;
|
||||||
if (this.listType === 'single') {
|
if (this.listType === 'single') {
|
||||||
if (!item.isReviewed) { nextOrder = item; break; }
|
if (!item.isReviewed) { nextOrder = item; break; }
|
||||||
} else {
|
} else {
|
||||||
@ -3313,7 +3315,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const itemId = Number(item.id || item.orderId || 0);
|
const itemId = Number(item.id || item.orderId || 0);
|
||||||
if (itemId > 0 && this.reviewedOrderIds.includes(itemId)) continue;
|
if (itemId > 0 && this.reviewedOrderIds.includes(itemId)) continue;
|
||||||
// 散单模式:跳过已提示过的拦截订单,避免重复弹窗死循环
|
// 散单模式:跳过已提示过的拦截订单,避免重复弹窗死循环
|
||||||
if (this.listType === 'single' && this._interceptNotifiedIds.includes(String(itemId))) continue;
|
if (this.listType === 'single' && this.interceptNotifiedIds.includes(String(itemId))) continue;
|
||||||
if (this.listType === 'single') {
|
if (this.listType === 'single') {
|
||||||
if (!item.isReviewed) { nextOrder = item; break; }
|
if (!item.isReviewed) { nextOrder = item; break; }
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user