diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index b6d6eaa..983c6c0 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -153,13 +153,19 @@ - - + + 调试扫描 ✕ - + 绑定拣货车 - + 查询 @@ -222,34 +228,6 @@ - - - - 取消拣货 - - 确认取消当前拣货任务吗? - - - 取消 - 确定 - - - - - - - - 完成拣货 - - 确认完成当前拣货任务吗? - - - 取消 - 确定 - - - - @@ -347,13 +325,12 @@ import voice from '@/core/utils/voice'; bindCartSubmitting: false, bindCartSearchSeq: 0, boundCartStorageKey: 'order_picking_bound_cart_v1', + keyboardHeight: 0, showActionsPopup: false, showNoBarcodePopup: false, noBarcodeItemName: '', noBarcodePickedCount: 0, noBarcodeItemTotalQty: 0, - showCancelPickPopup: false, - showCompletePickPopup: false, showWaveListPopup: false, showPackingReqPopup: false, submittingWavePickTask: false, @@ -508,6 +485,7 @@ import voice from '@/core/utils/voice'; } }, onLoad(options) { + this.initKeyboardHeightListener(); this.initWavePickSubmitNetworkStatus(); this.bindNetworkStatusChange(); this.restoreBasketDisplayMode(); @@ -535,10 +513,48 @@ import voice from '@/core/utils/voice'; this.$store.dispatch('broadcast/stop'); }, onUnload() { + this.destroyKeyboardHeightListener(); this.unbindNetworkStatusChange(); this.$store.dispatch('broadcast/stop'); }, methods: { + initKeyboardHeightListener() { + // H5 端:监听 visualViewport 高度变化,差值即键盘高度(仅垫高弹窗内容,不整页上推) + // #ifdef H5 + if (typeof window !== 'undefined' && window.visualViewport) { + this._baseViewportHeight = window.visualViewport.height; + this._onViewportResize = () => { + const vh = window.visualViewport ? window.visualViewport.height : window.innerHeight; + const diff = this._baseViewportHeight - vh; + this.keyboardHeight = diff > 0 ? Math.round(diff) : 0; + }; + window.visualViewport.addEventListener('resize', this._onViewportResize); + } + // #endif + // App/小程序端:使用原生键盘高度回调 + // #ifndef H5 + this._keyboardHeightCb = (res) => { + this.keyboardHeight = (res && res.height) || 0; + }; + if (typeof uni.onKeyboardHeightChange === 'function') { + uni.onKeyboardHeightChange(this._keyboardHeightCb); + } + // #endif + }, + destroyKeyboardHeightListener() { + // #ifdef H5 + if (typeof window !== 'undefined' && window.visualViewport && this._onViewportResize) { + window.visualViewport.removeEventListener('resize', this._onViewportResize); + this._onViewportResize = null; + } + // #endif + // #ifndef H5 + if (this._keyboardHeightCb && typeof uni.offKeyboardHeightChange === 'function') { + uni.offKeyboardHeightChange(this._keyboardHeightCb); + this._keyboardHeightCb = null; + } + // #endif + }, initWavePickSubmitNetworkStatus() { uni.getNetworkType({ success: res => { @@ -1331,7 +1347,7 @@ import voice from '@/core/utils/voice'; // ====== 调试功能 ====== handleTitleClick() { this._titleClickCount = (this._titleClickCount || 0) + 1; - if (this._titleClickCount >= 5) { + if (this._titleClickCount >= 8) { this._titleClickCount = 0; this.showDebugInput = !this.showDebugInput; if (this.showDebugInput) { @@ -1623,10 +1639,9 @@ import voice from '@/core/utils/voice'; }); return; } - this.showCompletePickPopup = true; + this.doCompletePick(); }, - async confirmCompletePick() { - this.showCompletePickPopup = false; + async doCompletePick() { const taskIdNumber = Number(this.taskInfo?.taskId || this.taskId || 0); if (!taskIdNumber) { uni.showToast({ @@ -1728,10 +1743,9 @@ import voice from '@/core/utils/voice'; }); return; } - this.showCancelPickPopup = true; + this.doCancelPick(); }, - async confirmCancelPick() { - this.showCancelPickPopup = false; + async doCancelPick() { const taskIdNumber = Number(this.taskInfo?.taskId || this.taskId || 0); if (!taskIdNumber) { uni.showToast({ @@ -3272,6 +3286,70 @@ import voice from '@/core/utils/voice'; height: calc(20rpx + env(safe-area-inset-bottom)); } + /* 调试扫描输入条 */ + .debug-input-bar { + position: fixed; + left: 0; + right: 0; + bottom: 0; + z-index: 9999; + display: flex; + align-items: center; + padding: 12rpx 20rpx; + padding-bottom: calc(12rpx + env(safe-area-inset-bottom)); + background: rgba(255, 255, 255, 0.97); + border-top: 1rpx solid #ebeef5; + box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.06); + box-sizing: border-box; + } + + .debug-input-label { + flex-shrink: 0; + margin-right: 12rpx; + font-size: 26rpx; + color: #909399; + } + + .debug-input-field { + flex: 1; + min-width: 0; + height: 68rpx; + padding: 0 20rpx; + border-radius: 10rpx; + background: #f5f7fa; + font-size: 28rpx; + color: #303133; + box-sizing: border-box; + } + + .debug-input-btn { + flex-shrink: 0; + margin-left: 12rpx; + height: 68rpx; + padding: 0 24rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 10rpx; + background: #2979ff; + color: #ffffff; + font-size: 26rpx; + } + + .debug-input-close { + flex-shrink: 0; + margin-left: 16rpx; + width: 52rpx; + height: 52rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 50%; + background: #f5f7fa; + color: #909399; + font-size: 28rpx; + } + /* 无条码拣货弹窗 */ .no-barcode-popup { width: 640rpx;