From e08fa1c8ce67a8f06a85db3fc79156f853e8aab3 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Sat, 11 Jul 2026 18:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E6=8B=A3?= =?UTF-8?q?=E8=B4=A7=E3=80=81=E5=A4=8D=E6=A0=B8=E5=8F=91=E8=B4=A7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/order-review-comps/ReviewDetail.vue | 124 +++++- pages/work/order/order-review.vue | 77 ++++ pages/work/order/picking.vue | 411 ++++++++++++------ 3 files changed, 460 insertions(+), 152 deletions(-) diff --git a/pages/work/order/order-review-comps/ReviewDetail.vue b/pages/work/order/order-review-comps/ReviewDetail.vue index 0e6a664..afae545 100644 --- a/pages/work/order/order-review-comps/ReviewDetail.vue +++ b/pages/work/order/order-review-comps/ReviewDetail.vue @@ -178,6 +178,22 @@ + + + + + 无条码复核 + + + 将商品「{{ noBarcodeItemName }}」标记为已复核({{ noBarcodePickedCount }}/{{ noBarcodeItemTotalQty }} → {{ noBarcodeItemTotalQty }}/{{ noBarcodeItemTotalQty }})? + + + + 取消 + 确定 + + + @@ -253,7 +269,11 @@ import voice from '@/core/utils/voice'; pendingScanCode: '', _dismissedMultiMatchCodes: [], _lastScanCode: '', - _lastScanTime: 0 + _lastScanTime: 0, + showNoBarcodePopup: false, + noBarcodeItemName: '', + noBarcodePickedCount: 0, + noBarcodeItemTotalQty: 0 }; }, computed: { @@ -512,27 +532,31 @@ import voice from '@/core/utils/voice'; return; } - uni.showModal({ - title: '无条码复核', - content: `将商品「${skuName}」标记为已复核(${scannedQty}/${planQty} → ${planQty}/${planQty})?`, - success: (res) => { - if (!res.confirm) return; - this.$emit('updateScannedQty', this.currentGoodsIndex, 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; - } - } - // 标记当前商品条码匹配 - this.$emit('barcodeMatched', matchId); - uni.showToast({ title: `已标记为已复核(${planQty}/${planQty})`, icon: 'success' }); - voice.speak('数据一致'); + // 设置弹窗数据 + this.noBarcodeItemName = skuName; + this.noBarcodePickedCount = scannedQty; + this.noBarcodeItemTotalQty = planQty; + this.showNoBarcodePopup = true; + }, + confirmNoBarcodeReview() { + const item = this.currentGoods; + if (!item) return; + const planQty = item.planQty || 0; + this.showNoBarcodePopup = false; + this.$emit('updateScannedQty', this.currentGoodsIndex, 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; } - }); + } + // 标记当前商品条码匹配 + this.$emit('barcodeMatched', matchId); + uni.showToast({ title: `已标记为已复核(${planQty}/${planQty})`, icon: 'success' }); + voice.speak('数据一致'); }, previewCurrentGoodsImage() { const images = this.getCurrentGoodsImageList(); @@ -1309,4 +1333,62 @@ import voice from '@/core/utils/voice'; .multi-match-footer-btn:active { opacity: 0.7; } + + /* 无条码复核弹窗 */ + .no-barcode-popup { + width: 640rpx; + padding: 40rpx 32rpx 32rpx; + background: #ffffff; + border-radius: 20rpx; + box-sizing: border-box; + } + + .no-barcode-popup__title { + font-size: 42rpx; + font-weight: 600; + color: #303133; + text-align: center; + margin-bottom: 32rpx; + } + + .no-barcode-popup__body { + margin-bottom: 36rpx; + padding: 24rpx; + background: #f8f9fa; + border-radius: 12rpx; + } + + .no-barcode-popup__text { + font-size: 36rpx; + color: #303133; + line-height: 1.6; + } + + .no-barcode-popup__actions { + display: flex; + align-items: center; + gap: 20rpx; + } + + .no-barcode-popup__btn { + flex: 1; + height: 88rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + font-weight: 500; + } + + .no-barcode-popup__btn--cancel { + background: #f5f7fa; + color: #606266; + border: 1rpx solid #dcdfe6; + } + + .no-barcode-popup__btn--confirm { + background: #2979ff; + color: #ffffff; + } diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index a219694..035ba37 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -524,6 +524,13 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; return 'reviewFirst'; } return this.printMode; + }, + isDprefixedWave() { + // D前缀波次:单品单件订单,无需逐件扫描 + if (this.listType !== 'single') return false; + const list = Array.isArray(this.orderList) ? this.orderList : []; + if (!list.length) return false; + return list.some(item => String(item.waveNo || '').startsWith('D')); } }, onLoad(options) { @@ -1154,6 +1161,38 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; } this.goPickGoodsDetail(target); }, + findOrderByProductBarcode(barcode) { + if (!barcode || !Array.isArray(this.orderList)) return null; + const kw = String(barcode).trim().toLowerCase(); + if (!kw) return null; + for (const order of this.orderList) { + // 跳过已复核的订单 + if (order.isReviewed) continue; + const items = Array.isArray(order.detailItems) ? order.detailItems : []; + for (const item of items) { + if (!item || typeof item !== 'object') continue; + // 检查 stock 中的 barcodes 数组 + const stock = item.stock && typeof item.stock === 'object' ? item.stock : null; + if (stock && Array.isArray(stock.barcodes)) { + if (stock.barcodes.some(b => String(b || '').trim().toLowerCase() === kw)) { + return order; + } + } + // 检查 item_snapshot 中的条码 + const snapshot = item.item_snapshot && typeof item.item_snapshot === 'object' ? item.item_snapshot : null; + if (snapshot) { + const snapBarcode = String(snapshot.barcode || '').trim().toLowerCase(); + if (snapBarcode === kw) return order; + const snapCode = String(snapshot.item_code || '').trim().toLowerCase(); + if (snapCode === kw) return order; + } + // 检查 item 直接字段 + const itemCode = String(item.item_code || '').trim().toLowerCase(); + if (itemCode === kw) return order; + } + } + return null; + }, handleSearch() { const text = this.normalizeKeyword(this.keyword); if (!text) return; @@ -1179,6 +1218,17 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; } return; } + // D前缀波次:在订单列表中查找商品条码所属订单 + if (this.isDprefixedWave) { + const matchedOrder = this.findOrderByProductBarcode(text); + if (matchedOrder) { + this.goPickGoodsDetail(matchedOrder); + } else { + uni.showToast({ title: '未找到匹配的商品', icon: 'none' }); + this.speakVoice('无记录'); + } + return; + } // 已绑定打印台或设置为不打印时,切换到搜索订单功能 if (this.printStationId || this.printMode === 'noPrint') { this.requestScanOrder(text); @@ -1593,8 +1643,10 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; icon: 'none' }); } + // D前缀波次:不自动进入详情,等待扫描商品条码定位所属订单 // 自动选中订单:输入搜索选第一个,任务刷新选最后一个 this.$nextTick(() => { + if (this.isDprefixedWave) return; const unreviewedItems = this.orderList.filter(item => !item.isReviewed); const target = this._autoSelectFirst ? unreviewedItems[0] : unreviewedItems.pop(); if (target) { @@ -1907,6 +1959,17 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; this.showDetailView = true; this.listExpanded = false; + // D前缀波次:自动标记所有商品为已扫,跳过逐件扫描 + if (this.isDprefixedWave && this.detailGoodsList.length > 0) { + this.detailGoodsList = this.detailGoodsList.map(g => ({ + ...g, + scannedQty: g.planQty + })); + this.$nextTick(() => { + this.handleDetailAllScanned(); + }); + } + // 先打印后复核:进入详情时自动触发未打印订单的打印 if (this.effectivePrintMode === 'printFirst' && this.printStationId) { const isGroup = this.listType === 'group'; @@ -2029,6 +2092,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; } }, afterPackageBinding() { + // D前缀波次:跳过称重,确认复核后返回列表,等待下一个商品条码 + if (this.isDprefixedWave) { + this.handleDprefixedAutoConfirm(); + return; + } // 团购模式始终需要称重,散单根据设置 const needWeigh = this.listType === 'group' || this.weighAfterReview; if (needWeigh) { @@ -2296,6 +2364,15 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; setTimeout(() => this.goToNextOrder(), 500); } }, + async handleDprefixedAutoConfirm() { + // D前缀波次:确认复核后返回列表,等待下一个商品条码扫描定位 + const ok = await this.callConfirmRecheck(); + if (ok) { + setTimeout(() => { + this.backToList(); + }, 500); + } + }, goToNextOrder() { // 标记当前已复核 const currentId = String(this.detailInfo?.orderId || this.detailInfo?.recordId || ''); diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index edb8d0c..13251d3 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -51,6 +51,7 @@ class="detail-main-right" :class="{ 'detail-main-right--matched': isSelectedItemMatchedHighlight() }" @click="goProductQueryByCurrentBarcode" + @longpress="handleLongPressItem" > {{ selectedPickItem.itemName || '--' }} @@ -159,6 +160,50 @@ + + + + 无条码拣货 + + + 将商品「{{ noBarcodeItemName }}」标记为已拣货({{ noBarcodePickedCount }}/{{ noBarcodeItemTotalQty }} → {{ noBarcodeItemTotalQty }}/{{ noBarcodeItemTotalQty }})? + + + + 取消 + 确定 + + + + + + + + 取消拣货 + + 确认取消当前拣货任务吗? + + + 取消 + 确定 + + + + + + + + 完成拣货 + + 确认完成当前拣货任务吗? + + + 取消 + 确定 + + + + @@ -219,6 +264,12 @@ import voice from '@/core/utils/voice'; bindCartQueryKeyword: '', boundCartStorageKey: 'order_picking_bound_cart_v1', showActionsPopup: false, + showNoBarcodePopup: false, + noBarcodeItemName: '', + noBarcodePickedCount: 0, + noBarcodeItemTotalQty: 0, + showCancelPickPopup: false, + showCompletePickPopup: false, submittingWavePickTask: false, currentWavePickSubmitPromise: null, wavePickSubmitQueue: [], @@ -1219,88 +1270,91 @@ import voice from '@/core/utils/voice'; }); return; } - uni.showModal({ - title: '完成拣货', - content: '确认完成当前拣货任务吗?', - success: async res => { - if (!res?.confirm) { - return; - } - uni.showLoading({ - title: '正在提交...' - }); - try { - if (this.currentWavePickSubmitPromise) { - await this.currentWavePickSubmitPromise; - } - const confirmedOrderIds = this.normalizeConfirmedOrderIds(this.confirmedOrderIds); - const completeMode = confirmedOrderIds.length ? 2 : 1; - console.log('[pick.wavePickTaskComplete] derived state:', { - task_id: taskIdNumber, - confirmedOrderIds, - completeMode - }); - const response = await this.requestWavePickTaskComplete(taskIdNumber, { - mode: completeMode, - order_ids: confirmedOrderIds - }); - if (String(response?.flag || '').toLowerCase() === 'failure') { - this.showErrorModal(response?.message || '完成拣货失败'); - return; - } - uni.showToast({ - title: '完成成功', - icon: 'none' - }); - voice.speak('拣货完成'); - // 通知列表页更新该波次状态为已复核 - const completedBatchNo = String(this.taskInfo?.batchNo || '').trim(); - if (completedBatchNo) { - uni.setStorageSync('pick_completed_wave', completedBatchNo); - } - this.taskId = ''; - this.keyword = ''; - this.taskInfo = { - taskId: '', - taskNo: '', - batchNo: '', - status: 0, - creatorId: '', - creatorName: '' - }; - this.boxList = []; - this.pickingSummary = { - totalLines: 0, - totalQty: 0, - distinctSpaces: 0, - distinctItems: 0 - }; - this.pickingView = { - modeCode: '', - modeName: '--', - items: [] - }; - this.selectedIndex = 0; - this.selectedItemImageLoading = false; - this.selectedItemImageUrl = ''; - this.selectedItemImageUrls = []; - this.selectedItemBarcodeLoading = false; - this.selectedItemBarcode = ''; - this.boundCartNo = ''; - this.boundCartName = ''; - this.bindCartNoInput = ''; - this.bindCartList = []; - this.selectedBindCartItem = null; - this.bindCartQueryKeyword = ''; - this.pickedItemKeys = []; - this.clearConfirmedOrderIdsForTask(taskIdNumber); - } catch (error) { - this.showErrorModal(this.getApiErrorMessage(error, '完成拣货失败')); - } finally { - uni.hideLoading(); - } - } + this.showCompletePickPopup = true; + }, + async confirmCompletePick() { + this.showCompletePickPopup = false; + const taskIdNumber = Number(this.taskInfo?.taskId || this.taskId || 0); + if (!taskIdNumber) { + uni.showToast({ + title: '缺少任务ID', + icon: 'none' + }); + return; + } + uni.showLoading({ + title: '正在提交...' }); + try { + if (this.currentWavePickSubmitPromise) { + await this.currentWavePickSubmitPromise; + } + const confirmedOrderIds = this.normalizeConfirmedOrderIds(this.confirmedOrderIds); + const completeMode = confirmedOrderIds.length ? 2 : 1; + console.log('[pick.wavePickTaskComplete] derived state:', { + task_id: taskIdNumber, + confirmedOrderIds, + completeMode + }); + const response = await this.requestWavePickTaskComplete(taskIdNumber, { + mode: completeMode, + order_ids: confirmedOrderIds + }); + if (String(response?.flag || '').toLowerCase() === 'failure') { + this.showErrorModal(response?.message || '完成拣货失败'); + return; + } + uni.showToast({ + title: '完成成功', + icon: 'none' + }); + voice.speak('拣货完成'); + // 通知列表页更新该波次状态为已复核 + const completedBatchNo = String(this.taskInfo?.batchNo || '').trim(); + if (completedBatchNo) { + uni.setStorageSync('pick_completed_wave', completedBatchNo); + } + this.taskId = ''; + this.keyword = ''; + this.taskInfo = { + taskId: '', + taskNo: '', + batchNo: '', + status: 0, + creatorId: '', + creatorName: '' + }; + this.boxList = []; + this.pickingSummary = { + totalLines: 0, + totalQty: 0, + distinctSpaces: 0, + distinctItems: 0 + }; + this.pickingView = { + modeCode: '', + modeName: '--', + items: [] + }; + this.selectedIndex = 0; + this.selectedItemImageLoading = false; + this.selectedItemImageUrl = ''; + this.selectedItemImageUrls = []; + this.selectedItemBarcodeLoading = false; + this.selectedItemBarcode = ''; + this.boundCartNo = ''; + this.boundCartName = ''; + this.bindCartNoInput = ''; + this.bindCartList = []; + this.selectedBindCartItem = null; + this.bindCartQueryKeyword = ''; + this.pickedItemKeys = []; + this.clearConfirmedOrderIdsForTask(taskIdNumber); + } catch (error) { + this.showErrorModal(this.getApiErrorMessage(error, '完成拣货失败')); + } finally { + uni.hideLoading(); + } }, handleCancelPick() { this.showActionsPopup = false; @@ -1319,57 +1373,60 @@ import voice from '@/core/utils/voice'; }); return; } - uni.showModal({ - title: '取消拣货', - content: '确认取消当前拣货任务吗?', - success: async res => { - if (!res?.confirm) { - return; - } - uni.showLoading({ - title: '正在取消...' - }); - try { - const response = await this.$http('order.wave.wavePickTaskCancelSelf', { - task_id: taskIdNumber - }); - const payload = response?.data?.data || response?.data || response || {}; - const cancelledCount = Number(payload?.cancelled_count ?? 0); - const taskNo = String(payload?.task_no || this.taskInfo?.taskNo || '').trim(); - const successTitle = cancelledCount > 0 - ? (taskNo ? `已取消:${taskNo}` : '取消成功') - : '取消完成'; - uni.showToast({ - title: successTitle, - icon: 'none' - }); - if (cancelledCount > 0) { - this.taskId = ''; - this.taskInfo = { - taskId: '', - taskNo: '', - batchNo: '', - status: 0, - creatorId: '', - creatorName: '' - }; - this.pickingView = { - modeCode: '', - modeName: '--', - items: [] - }; - this.selectedIndex = 0; - } - } catch (error) { - uni.showToast({ - title: this.getApiErrorMessage(error, '取消拣货失败'), - icon: 'none' - }); - } finally { - uni.hideLoading(); - } - } + this.showCancelPickPopup = true; + }, + async confirmCancelPick() { + this.showCancelPickPopup = false; + const taskIdNumber = Number(this.taskInfo?.taskId || this.taskId || 0); + if (!taskIdNumber) { + uni.showToast({ + title: '缺少任务ID', + icon: 'none' + }); + return; + } + uni.showLoading({ + title: '正在取消...' }); + try { + const response = await this.$http('order.wave.wavePickTaskCancelSelf', { + task_id: taskIdNumber + }); + const payload = response?.data?.data || response?.data || response || {}; + const cancelledCount = Number(payload?.cancelled_count ?? 0); + const taskNo = String(payload?.task_no || this.taskInfo?.taskNo || '').trim(); + const successTitle = cancelledCount > 0 + ? (taskNo ? `已取消:${taskNo}` : '取消成功') + : '取消完成'; + uni.showToast({ + title: successTitle, + icon: 'none' + }); + if (cancelledCount > 0) { + this.taskId = ''; + this.taskInfo = { + taskId: '', + taskNo: '', + batchNo: '', + status: 0, + creatorId: '', + creatorName: '' + }; + this.pickingView = { + modeCode: '', + modeName: '--', + items: [] + }; + this.selectedIndex = 0; + } + } catch (error) { + uni.showToast({ + title: this.getApiErrorMessage(error, '取消拣货失败'), + icon: 'none' + }); + } finally { + uni.hideLoading(); + } }, getApiErrorMessage(error, fallback = '请求失败') { const message = error?.message || error?.msg || error?.errMsg || error?.data?.message; @@ -1742,6 +1799,40 @@ import voice from '@/core/utils/voice'; }); } }); + }, + // ====== 无条码拣货 ====== + handleLongPressItem() { + const item = this.selectedPickItem; + if (!item) { + return; + } + const totalQty = Number(item.totalQty || 0); + const isPicked = this.isPickItemPicked(item); + if (isPicked) { + uni.showToast({ + title: '该商品已拣货完成', + icon: 'none' + }); + return; + } + const pickedQty = 0; + this.noBarcodeItemName = item.itemName || '--'; + this.noBarcodePickedCount = pickedQty; + this.noBarcodeItemTotalQty = totalQty; + this.showNoBarcodePopup = true; + }, + confirmNoBarcodePick() { + const item = this.selectedPickItem; + if (!item) { + return; + } + this.markPickItemPicked(item); + this.showNoBarcodePopup = false; + this.submitWavePickTaskIntermediate(); + uni.showToast({ + title: '已标记为已拣货', + icon: 'none' + }); } } }; @@ -2361,4 +2452,62 @@ import voice from '@/core/utils/voice'; height: calc(20rpx + env(safe-area-inset-bottom)); } + /* 无条码拣货弹窗 */ + .no-barcode-popup { + width: 640rpx; + padding: 40rpx 32rpx 32rpx; + background: #ffffff; + border-radius: 20rpx; + box-sizing: border-box; + } + + .no-barcode-popup__title { + font-size: 42rpx; + font-weight: 600; + color: #303133; + text-align: center; + margin-bottom: 32rpx; + } + + .no-barcode-popup__body { + margin-bottom: 36rpx; + padding: 24rpx; + background: #f8f9fa; + border-radius: 12rpx; + } + + .no-barcode-popup__text { + font-size: 36rpx; + color: #303133; + line-height: 1.6; + } + + .no-barcode-popup__actions { + display: flex; + align-items: center; + gap: 20rpx; + } + + .no-barcode-popup__btn { + flex: 1; + height: 88rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + font-weight: 500; + } + + .no-barcode-popup__btn--cancel { + background: #f5f7fa; + color: #606266; + border: 1rpx solid #dcdfe6; + } + + .no-barcode-popup__btn--confirm { + background: #2979ff; + color: #ffffff; + } +