feat(复核/打包/拣货): 统一语音播报顺序与去重,移除要求前缀,新增取消拣货二次确认

复核发货(pages/work/order/order-review.vue、order-review-comps/ReviewDetail.vue)
- 语音播报顺序调整为:复核命中商品 → 播报"数据一致" → 播报该商品复核要求内容
- 移除进入详情时统一播报复核要求;包材匹配成功改为直接播报"数据一致"
- 同一商品(按商品 id 去重)仅播报一次复核要求,数量>1 多次扫码不重复播报
- 进入详情时语音播报免复核商品(need_recheck=N)的打包要求,按文本去重播报一次
- 商品卡片移除"复核要求:"标签前缀,仅显示要求内容
- ReviewDetail 的 speakDataConsistent 事件携带命中商品

打包模式(pages/packing/packMode.vue)
- 语音播报顺序调整为:核实命中商品 → 播报"数据一致" → 播报该商品打包要求 → 全部核实后执行打包
- 移除查询订单成功后统一播报打包要求
- 新增 groupPackQueued 标志:语音播报结束后再执行打包,防止播报期间被误判为上报失败重传
- 商品条目移除"打包要求:"标签前缀,仅显示要求内容

拣货(pages/work/order/picking.vue)
- 移除"拣货要求:"标签前缀,仅显示要求内容
- 新增取消拣货二次确认弹窗(确认取消拣货任务)
- 操作弹窗按钮间距样式调整(gap 改为 margin-left)
This commit is contained in:
zm2000 2026-10-01 18:19:06 +08:00
parent 27f4d178aa
commit 031fb0c5b6
4 changed files with 143 additions and 59 deletions

View File

@ -155,7 +155,7 @@
<text class="order-item__space">、</text>
<text class="order-item__barcode">{{ orderItemBarcode(item) || item.item_code || '--' }}</text>
<view v-if="itemPackingRequirement(item)" class="order-item__requirement">
<text class="order-item__requirement-text">打包要求:{{ itemPackingRequirement(item) }}</text>
<text class="order-item__requirement-text">{{ itemPackingRequirement(item) }}</text>
</view>
</view>
</view>
@ -477,10 +477,11 @@ export default {
packWaitRemain: 0, // 大团购打包时长闸门:剩余等待秒数(倒计时展示,<=0 隐藏)
packWaitTimer: null, // 大团购打包时长闸门:倒计时 interval 句柄
packWaveScope: null, // 当前「打包中」任务波次范围(0=未分配 1=大团购 2=散单 3=小团购 4=单品单件)
packReqChain: null, // 打包要求语音播报串行队列(核实播报排队用)
packReqChain: null, // 语音播报串行队列(核实命中后:数据一致 → 该商品打包要求 → 执行打包)
// 团购核实:商品行已扫计数(key=商品行id/序号 → 已扫次数),达 plan_qty 视为已核实
groupVerified: {},
groupSubmitting: false, // 团购提交开始打包防重入
groupPackQueued: false, // 团购全部核实后:语音播报结束前排队执行打包(防止播报期间被误判为上报失败重传)
groupAutoSubmitted: false, // 团购全部核实后是否已自动提交开始打包
// 无条码复核弹窗(团单)
noBarcodePopupOpen: false,
@ -700,6 +701,7 @@ export default {
if (!this.groupAllVerified) return false;
if (!this.groupAutoSubmitted) return false;
if (this.hasActivePack) return false;
if (this.groupPackQueued) return false;
return !this.groupSubmitting;
},
// 输入框占位:按实际流程提示(未绑定操作员 → 扫工牌绑定;团购核实中 → 扫商品条码;否则 → 运单查询)
@ -826,30 +828,23 @@ export default {
return Promise.resolve(false);
}
},
// 语音播报商品打包要求(查询订单成功后调用,多条要求去重后串行播报,记录完成 Promise 供核实播报排队)
speakPackingRequirements(items) {
if (!Array.isArray(items) || !items.length) return;
const reqs = [];
items.forEach((it) => {
const v = String((it && it.packing_requirements) || '').trim();
if (v && reqs.indexOf(v) === -1) reqs.push(v);
});
if (!reqs.length) return;
// 串行链:上一条播完再播下一条,最终 resolve 表示全部打包要求播报完成
let chain = Promise.resolve();
reqs.forEach((text) => {
chain = chain.then(() => this.speakTextAsync(`${text}`));
});
this.packReqChain = chain;
},
// 核实播报:排队到打包要求播报完成之后,避免打断打包要求播报
speakAfterPackRequirements(text = '') {
const chain = this.packReqChain;
if (chain && typeof chain.then === 'function') {
this.packReqChain = chain.then(() => this.speakTextAsync(`${text}`)).catch(() => {});
} else {
this.speakText(`${text}`);
// 核实命中商品后的语音与打包顺序:播报「数据一致」→ 播报该商品打包要求 →(全部核实后)执行打包
afterItemVerified(item) {
let chain = this.packReqChain && typeof this.packReqChain.then === 'function'
? this.packReqChain
: Promise.resolve();
chain = chain.then(() => this.speakTextAsync('数据一致'));
const req = String((item && item.packing_requirements) || '').trim();
if (req) {
chain = chain.then(() => this.speakTextAsync(req));
}
// 全部商品核实完成:先置提交标记,等语音播报结束后再执行打包(避免播报被提交打断)
if (this.groupAllVerified) {
this.groupAutoSubmitted = true;
this.groupPackQueued = true;
chain = chain.then(() => this.handleSubmitGroupPack());
}
this.packReqChain = chain.catch(() => {});
},
// 清理广播自愈定时器(页面隐藏/卸载时避免残留定时器误注册广播)
clearBcastHealTimer() {
@ -1103,7 +1098,7 @@ export default {
const name = String(item.item_name || '商品').trim();
// 团单:条码比对命中一次即标记该商品已完成(数量一次扫满)
this.markItemVerified(item, i);
this.speakAfterPackRequirements('数据一致');
this.afterItemVerified(item);
uni.showToast({ title: `${name} 已核实`, icon: 'none' });
return true;
}
@ -1143,7 +1138,7 @@ export default {
const info = this.noBarcodeItem;
if (!info) return;
this.markItemVerified(info.item, info.idx);
this.speakAfterPackRequirements('数据一致');
this.afterItemVerified(info.item);
this.noBarcodePopupOpen = false;
// 延迟清空,避免关闭动画期间文案闪变
setTimeout(() => {
@ -1194,6 +1189,7 @@ export default {
}
} finally {
this.groupSubmitting = false;
this.groupPackQueued = false;
}
},
// 打包上报失败后的手动重传:扫描商品条码/长按商品触发(保持核实状态,凭原 key 重新上报)
@ -1452,8 +1448,6 @@ export default {
this.packContextKey = String(data?.key || '').trim();
// 查询成功:清空输入框,方便连续扫描下一单
this.orderBarcode = '';
// 语音播报商品打包要求
this.speakPackingRequirements(data?.items);
// 团购:初始化商品核实状态(不自动上报,全部核实后将自动提交开始打包)
this.groupVerified = {};
this.groupAutoSubmitted = false;

View File

@ -65,7 +65,6 @@
<text class="metric-scanned">{{ item.scannedQty || 0 }}</text>
</view>
<view v-if="item.packageRequirement && item.packageRequirement !== '--'" class="goods-pack-row goods-pack-row--grid">
<text class="goods-pack-label">复核要求:</text>
<text class="goods-pack-value">{{ item.packageRequirement }}</text>
</view>
</view>
@ -128,7 +127,6 @@
<text class="list-card-tag">{{ item.location || '--' }}</text>
</view>
<view v-if="item.packageRequirement && item.packageRequirement !== '--'" class="goods-pack-row">
<text class="goods-pack-label">复核要求:</text>
<text class="goods-pack-value">{{ item.packageRequirement }}</text>
</view>
</view>
@ -548,8 +546,8 @@ import voice from '@/core/utils/voice';
voice.speak('超出订单数');
}
this.$emit('updateScannedQty', matchIndex, newScanned);
// 扫码匹配成功即播报"数据一致"(排队到复核要求播报完成后)
this.$emit('speakDataConsistent');
// 复核命中商品:先播报"数据一致",再播报命中商品的复核要求
this.$emit('speakDataConsistent', matchedItem);
// 已扫数量达到计划数量时,标记为已匹配(显示绿底和"已匹配"状态)
if (newScanned >= maxQty) {
const matchedId = String(matchedItem?.id || '');
@ -601,8 +599,8 @@ import voice from '@/core/utils/voice';
// 更新已扫数量
this.$emit('updateScannedQty', matchIndex, newScanned);
// 扫码匹配成功即播报"数据一致"(排队到复核要求播报完成后)
this.$emit('speakDataConsistent');
// 复核命中商品:先播报"数据一致",再播报命中商品的复核要求
this.$emit('speakDataConsistent', matchedItem);
// 已扫数量达到计划数量时,才标记为已匹配
if (newScanned >= maxQty) {
@ -668,7 +666,7 @@ import voice from '@/core/utils/voice';
// 标记当前商品条码匹配
this.$emit('barcodeMatched', matchId);
uni.showToast({ title: `已标记为已复核(${planQty}/${planQty})`, icon: 'success' });
this.$emit('speakDataConsistent');
this.$emit('speakDataConsistent', item);
},
handleListLongPress(item, index) {
if (this.isReadOnly) return;
@ -836,8 +834,8 @@ import voice from '@/core/utils/voice';
const newScanned = Math.min(currentScanned + addQty, maxQty);
this.$emit('updateScannedQty', targetIdx, newScanned);
// 扫码匹配成功即播报"数据一致"(排队到复核要求播报完成后)
this.$emit('speakDataConsistent');
// 复核命中商品:先播报"数据一致",再播报命中商品的复核要求
this.$emit('speakDataConsistent', matchedItem);
if (newScanned >= maxQty) {
const matchedId = String(matchedItem?.id || '');

View File

@ -493,6 +493,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
orderList: [],
listType: '', packingRequirements: '',
recheckReqChain: null,
// 已播报过复核要求的商品 id(同一商品在本订单内仅播报一次复核要求)
spokenReqItemIds: [],
pickMode: '',
totalOrders: 0,
taskId: '',
@ -1146,33 +1148,36 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
// 语音播报复核要求(进入详情后调用,去重后串行播报,记录链供后续播报排队,参考打包模式页 speakPackingRequirements)
speakRecheckRequirements(items) {
// 进入详情时语音播报"免复核商品"的打包要求(need_recheck=N 且含打包要求),按文本去重后串行播报一次
speakNoRecheckPackRequirements(items) {
if (!Array.isArray(items) || !items.length) return;
const reqs = [];
items.forEach((it) => {
if (String((it && it.need_recheck) || '').trim().toUpperCase() !== 'N') return;
const v = String((it && it.packageRequirement) || '').trim();
if (v && v !== '--' && reqs.indexOf(v) === -1) reqs.push(v);
});
if (!reqs.length) return;
let chain = Promise.resolve();
const prev = this.recheckReqChain;
let chain = (prev && typeof prev.then === 'function') ? prev : Promise.resolve();
reqs.forEach((text) => {
chain = chain.then(() => voice.speak(`${text}`, { minInterval: 800 }));
});
this.recheckReqChain = chain;
this.recheckReqChain = chain.catch(() => {});
},
// 复核要求播报完成后再播报(避免打断复核要求播报)
speakAfterRecheckRequirements(text = '') {
const chain = this.recheckReqChain;
if (chain && typeof chain.then === 'function') {
this.recheckReqChain = chain.then(() => voice.speak(`${text}`, { minInterval: 800 })).catch(() => {});
} else {
voice.speak(`${text}`, { minInterval: 800 });
// 子组件(ReviewDetail)数据一致播报统一入口:复核命中商品后先播报"数据一致",再播报命中商品的复核要求内容
handleSpeakDataConsistent(item) {
const prev = this.recheckReqChain;
let chain = (prev && typeof prev.then === 'function') ? prev : Promise.resolve();
chain = chain.then(() => voice.speak('数据一致', { minInterval: 800 }));
const req = String((item && item.packageRequirement) || '').trim();
const itemId = String((item && item.id) || '').trim();
// 同一商品(按商品 id 去重)仅播报一次复核要求内容,商品数量>1 时多次扫码不再重复播报
if (req && req !== '--' && itemId && !this.spokenReqItemIds.includes(itemId)) {
this.spokenReqItemIds.push(itemId);
chain = chain.then(() => voice.speak(`${req}`, { minInterval: 800 }));
}
},
// 子组件(ReviewDetail)数据一致播报统一入口:排队到复核要求播报完成后
handleSpeakDataConsistent() {
this.speakAfterRecheckRequirements('数据一致');
this.recheckReqChain = chain.catch(() => {});
},
loadScanQuantity() {
try {
@ -2627,6 +2632,10 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
// 设置详情数据
this.detailGoodsList = goodsList;
// 进入新订单时重置"已播报复核要求商品"记录,确保本订单内每件商品只播一次复核要求
this.spokenReqItemIds = [];
// 进入详情时语音播报"免复核商品"的打包要求(按文本去重,播报一次)
this.speakNoRecheckPackRequirements(goodsList);
this.detailInfo = {
recordId: String(item.id || ''),
orderId: Number(item.id || item.orderId || 0),
@ -2665,9 +2674,6 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.showDetailView = true;
this.listExpanded = false;
// 进入详情后语音播报复核要求(去重串行播报)
this.speakRecheckRequirements(this.detailGoodsList);
// 团购模式:进入含拦截单的波次时自动弹出拦截信息提示(含波次号、运单号)
// 每个波次本次会话只自动弹 1 次(按 waveId/waveNo 去重);已复核波次仅展示只读详情,不自动弹窗
if (
@ -3098,7 +3104,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.scannedPackageId = String(matched.id || '');
uni.hideLoading();
uni.showToast({ title: '包材匹配成功:' + (matched.material_name || trimmed), icon: 'success' });
this.speakAfterRecheckRequirements('数据一致');
this.speakVoice('数据一致');
} else {
this.scannedPackageMaterial = null;
uni.hideLoading();

View File

@ -87,7 +87,6 @@
<text class="packing-req-banner__value">{{ selectedPickItem.packingRequirements }}</text>
</view>
<view v-if="selectedPickItem && selectedPickItem.pickRequirements" class="pick-req-banner" @click="showPickReqPopup = true">
<text class="pick-req-banner__label">拣货要求:</text>
<text class="pick-req-banner__value">{{ selectedPickItem.pickRequirements }}</text>
</view>
<view class="alloc-panel">
@ -232,6 +231,20 @@
</view>
</u-popup>
<!-- 取消拣货二次确认弹窗 -->
<u-popup :show="showCancelPickConfirm" mode="center" :closeable="true" :closeOnClickOverlay="false" border-radius="20" @close="showCancelPickConfirm = false">
<view class="cancel-pick-confirm-popup">
<view class="cancel-pick-confirm-popup__title">确认取消拣货</view>
<view class="cancel-pick-confirm-popup__body">
<text class="cancel-pick-confirm-popup__text">{{ cancelPickConfirmText }}</text>
</view>
<view class="cancel-pick-confirm-popup__actions">
<view class="cancel-pick-confirm-popup__btn cancel-pick-confirm-popup__btn--cancel" @click="showCancelPickConfirm = false">再想想</view>
<view class="cancel-pick-confirm-popup__btn cancel-pick-confirm-popup__btn--confirm" @click="confirmCancelPick">确认取消</view>
</view>
</view>
</u-popup>
<!-- 操作弹窗 -->
<u-popup :show="showActionsPopup" mode="bottom" :closeable="true" border-radius="20" @close="showActionsPopup = false">
<view class="actions-popup">
@ -344,6 +357,7 @@ import voice from '@/core/utils/voice';
boundCartStorageKey: 'order_picking_bound_cart_v1',
keyboardHeight: 0,
showActionsPopup: false,
showCancelPickConfirm: false,
showNoBarcodePopup: false,
noBarcodeItemName: '',
noBarcodePickedCount: 0,
@ -390,6 +404,10 @@ import voice from '@/core/utils/voice';
const currentTaskId = Number(this.taskInfo?.taskId || this.taskId || 0);
return Number.isFinite(currentTaskId) && currentTaskId > 0;
},
cancelPickConfirmText() {
const taskNo = String(this.taskInfo?.taskNo || '').trim();
return taskNo ? `确认取消拣货任务「${taskNo}」?` : '确认取消当前拣货任务?';
},
currentLoginUserId() {
return String(
this.$store?.getters?.user?.id ||
@ -1788,6 +1806,10 @@ import voice from '@/core/utils/voice';
});
return;
}
this.showCancelPickConfirm = true;
},
confirmCancelPick() {
this.showCancelPickConfirm = false;
this.doCancelPick();
},
async doCancelPick() {
@ -2777,7 +2799,6 @@ import voice from '@/core/utils/voice';
.actions-popup-body {
display: flex;
gap: 20rpx;
margin-bottom: 32rpx;
}
@ -2790,6 +2811,10 @@ import voice from '@/core/utils/voice';
justify-content: center;
}
.actions-popup-btn + .actions-popup-btn {
margin-left: 20rpx;
}
.actions-popup-btn--cancel {
background: #fff1f0;
border: 2rpx solid #ffccc7;
@ -3553,4 +3578,65 @@ import voice from '@/core/utils/voice';
color: #ffffff;
}
/* 取消拣货二次确认弹窗 */
.cancel-pick-confirm-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.cancel-pick-confirm-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.cancel-pick-confirm-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #fef0f0;
border-radius: 12rpx;
}
.cancel-pick-confirm-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.cancel-pick-confirm-popup__actions {
display: flex;
align-items: center;
}
.cancel-pick-confirm-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.cancel-pick-confirm-popup__btn + .cancel-pick-confirm-popup__btn {
margin-left: 20rpx;
}
.cancel-pick-confirm-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.cancel-pick-confirm-popup__btn--confirm {
background: #fa3534;
color: #ffffff;
}
</style>