diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue
index 812c9e9..22a0376 100644
--- a/pages/work/order/order-review.vue
+++ b/pages/work/order/order-review.vue
@@ -2147,9 +2147,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
const normalizedKeyword = this.normalizeKeyword(keyword);
if (!normalizedKeyword) {
uni.showToast({
- title: '请输入快递单号或车号',
+ title: '扫描关键词不能为空',
icon: 'none'
});
+ // 对应接口 400「扫描关键词不能为空」:同步语音提示
+ this.speakVoice('扫描关键词不能为空');
return;
}
@@ -2159,35 +2161,61 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
});
}
try {
- const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword));
+ // 第4参 toastAfter=false:关闭请求层全局错误 toast,由 handleScanOrderError 统一按 silent 控制提示与语音
+ const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword), '', false);
// 检测接口返回的错误信息
if (response?.flag === 'failure') {
+ // 依据后端提示(400 扫描关键词不能为空 / 404 未找到对应订单 / 400 订单未拣货不允许复核等)toast + 语音播报
const errorMsg = String(response?.message || response?.msg || '').trim();
- if (!silent) {
- uni.showToast({
- title: errorMsg || '订单查询失败',
- icon: 'none'
- });
- }
+ this.handleScanOrderError(errorMsg || '订单查询失败', silent);
return;
}
const payload = this.extractScanOrderPayload(response);
const result = this.normalizeScanOrderResult(payload);
this.handleScanOrderSuccess(result, silent);
} catch (error) {
- if (!silent) {
- const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
- uni.showToast({
- title: message || '订单查询失败',
- icon: 'none'
- });
- }
+ const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
+ this.handleScanOrderError(message || '订单查询失败', silent);
} finally {
if (!silent) {
uni.hideLoading();
}
}
},
+ // scanOrder 接口业务失败:toast 展示后端提示,并按提示内容语音播报
+ handleScanOrderError(message, silent = false) {
+ const raw = String(message || '').trim();
+ // 去除后端常见包装前缀:如 "接口错误: 未找到对应订单" -> "未找到对应订单"
+ const cleaned = raw.replace(/^接口错误\s*[::]\s*/, '').trim();
+ const toastText = cleaned || '订单查询失败';
+ if (!silent) {
+ uni.showToast({
+ title: toastText,
+ icon: 'none',
+ // 业务错误提示(如未找到对应订单/订单未拣货等)展示 5s,便于 PDA 现场确认
+ duration: 5000
+ });
+ }
+ const voiceText = this.resolveScanOrderErrorVoice(toastText);
+ if (voiceText) {
+ this.speakVoice(voiceText);
+ }
+ },
+ // 将 scanOrder 返回的业务提示映射为语音播报文本(对应接口 400/404 常见错误)
+ resolveScanOrderErrorVoice(message) {
+ const text = String(message || '').trim();
+ if (/未拣货/.test(text)) {
+ return '订单未拣货,不允许复核';
+ }
+ if (/未找到对应订单|未查询到订单|无匹配订单|未找到订单/.test(text)) {
+ return '未找到对应订单';
+ }
+ if (/扫描关键词不能为空|关键词为空|请输入快递单号或车号/.test(text)) {
+ return '扫描关键词不能为空';
+ }
+ // 其他未识别的业务提示:仅 toast 不额外播报,避免朗读非预期文案
+ return '';
+ },
async toggleUnboundPrintStationOnly() {
this.showUnboundPrintStationOnly = true;
this.selectedStationId = this.printStationId || '';
diff --git a/pages/work/order/scatter-picking-detail.vue b/pages/work/order/scatter-picking-detail.vue
index 5d0c1ff..a80b6c7 100644
--- a/pages/work/order/scatter-picking-detail.vue
+++ b/pages/work/order/scatter-picking-detail.vue
@@ -93,32 +93,29 @@
打印台
-
- {{ printStationName || '--' }}
-
-
-
-
- {{ station.name }}
-
+
+
打印
-
- 打印
-
+
+
+ 打印
+
+
打印消息
@@ -143,7 +140,7 @@
currentPage: 1,
paginationTotal: 0,
showPrintPopup: false,
- showPrintStationDropdown: false,
+ printStationInputKeyword: '',
printStationName: '--',
printStationId: '',
printStationList: [],
@@ -462,6 +459,109 @@
.map(group => (group && typeof group === 'object' ? group : null))
.filter(group => !!group);
},
+ /**
+ * 提取 getWavePlatformPrintData 返回的 locked_wave_groups(打印锁占用的分组)
+ * 已打印面单的数据会出现在 locked_wave_groups,而 waveGroups 为空
+ * @param {object} payload
+ */
+ extractLockedWaveGroups(payload) {
+ const groups = Array.isArray(payload?.locked_wave_groups) ? payload.locked_wave_groups : [];
+ return groups
+ .map(group => (group && typeof group === 'object' ? group : null))
+ .filter(group => !!group);
+ },
+ /**
+ * 判断锁定订单是否为拦截订单(无需解锁,禁止打印)
+ * 当 locked_orders 的 order_id 与 intercepted_orders 的 order_id 一致(拦截集合覆盖全部锁定集合)时返回 true
+ * @param {object} payload getWavePlatformPrintData 返回的数据
+ * @returns {boolean}
+ */
+ isInterceptedPrintBlock(payload) {
+ const lockedOrders = Array.isArray(payload?.locked_orders) ? payload.locked_orders : [];
+ const interceptedOrders = Array.isArray(payload?.intercepted_orders) ? payload.intercepted_orders : [];
+ const lockedIds = new Set(
+ lockedOrders.map(order => order?.order_id ?? order?.orderId ?? '').filter(id => id !== '' && id != null)
+ );
+ const interceptedIds = new Set(
+ interceptedOrders.map(order => order?.order_id ?? order?.orderId ?? '').filter(id => id !== '' && id != null)
+ );
+ if (!lockedIds.size || !interceptedIds.size) {
+ return false;
+ }
+ // 拦截集合覆盖全部锁定集合 → 锁定订单均为拦截订单,不支持打印
+ for (const id of lockedIds) {
+ if (!interceptedIds.has(id)) {
+ return false;
+ }
+ }
+ return true;
+ },
+ /**
+ * 将 locked_wave_groups 转换为 unlockWavePlatformPrintDataByGroup 所需的 groups 分组条件
+ * 每个(波次 + 平台 + 系统快递编码)组合为一个分组
+ * @param {Array} lockedWaveGroups 打印锁占用的波次平台分组
+ */
+ buildUnlockGroups(lockedWaveGroups) {
+ const groups = [];
+ (Array.isArray(lockedWaveGroups) ? lockedWaveGroups : []).forEach(waveGroup => {
+ const waveId = waveGroup?.wave_id ?? waveGroup?.waveId ?? waveGroup?.id ?? '';
+ const platforms = Array.isArray(waveGroup?.platforms) ? waveGroup.platforms : [];
+ if (platforms.length) {
+ platforms.forEach(platform => {
+ groups.push({
+ wave_id: waveId,
+ platform: platform?.platform ?? platform?.platform_code ?? '',
+ sys_logistics_code: platform?.sys_logistics_code ?? platform?.sysLogisticsCode ?? platform?.logistics_code ?? '',
+ order_ids: Array.isArray(platform?.order_ids) ? platform.order_ids : []
+ });
+ });
+ } else if (waveId !== '' && waveId != null) {
+ // 无平台嵌套时按波次兜底
+ groups.push({ wave_id: waveId, platform: '', sys_logistics_code: '', order_ids: [] });
+ }
+ });
+ return groups.filter(group => group.wave_id !== '' && group.wave_id != null);
+ },
+ /**
+ * 按分组解锁波次平台打印锁(order.print.unlockWavePlatformPrintDataByGroup)
+ * 将传入的分组中已锁定的订单 print_lock_status 置为 none
+ * @param {Array} lockedWaveGroups 打印锁占用的波次平台分组(用于构建 groups 条件)
+ * @returns {Promise