修改订单拣货页面

This commit is contained in:
zm2000 2026-09-03 13:42:44 +08:00
parent 28bad8a62e
commit 2be017d58f

View File

@ -153,13 +153,19 @@
</template>
</view>
</view>
<!-- ====== 调试输入框 - 长按标题5次切换 ====== -->
<view v-if="showDebugInput" class="debug-input-bar" @touchstart.stop>
<!-- ====== 调试输入框 - 连点标题8次切换 ====== -->
<view
v-if="showDebugInput"
class="debug-input-bar"
:style="{ bottom: keyboardHeight ? keyboardHeight + 'px' : '0px' }"
@touchstart.stop
>
<text class="debug-input-label">调试扫描</text>
<input
class="debug-input-field"
v-model="debugInput"
:focus="debugInputFocus"
:adjust-position="false"
placeholder="输入模拟扫描内容"
@confirm="handleDebugSubmit"
@blur="handleDebugSubmit"
@ -168,13 +174,13 @@
<text class="debug-input-close" @click="showDebugInput = false">✕</text>
</view>
<u-popup :show="bindCartPopupVisible" mode="bottom" :closeable="true" border-radius="20" @close="closeBindCartPopup">
<view class="bind-cart-popup">
<view class="bind-cart-popup" :style="{ paddingBottom: keyboardHeight ? keyboardHeight + 'px' : '' }">
<view class="popup-header">
<text class="popup-title">绑定拣货车</text>
</view>
<view class="bind-cart-form">
<view class="bind-cart-search-row">
<u-input v-model="bindCartNoInput" placeholder="请输入或扫描拣货车编号" clearable></u-input>
<u-input v-model="bindCartNoInput" placeholder="请输入或扫描拣货车编号" clearable :adjust-position="false"></u-input>
<view class="bind-cart-query-btn" @click="handleBindCartSearch">查询</view>
</view>
</view>
@ -222,34 +228,6 @@
</view>
</u-popup>
<!-- 取消拣货弹窗 -->
<u-popup :show="showCancelPickPopup" mode="center" :closeable="true" :closeOnClickOverlay="false" border-radius="20" @close="showCancelPickPopup = false">
<view class="no-barcode-popup">
<view class="no-barcode-popup__title">取消拣货</view>
<view class="no-barcode-popup__body">
<text class="no-barcode-popup__text">确认取消当前拣货任务吗?</text>
</view>
<view class="no-barcode-popup__actions">
<view class="no-barcode-popup__btn no-barcode-popup__btn--cancel" @click="showCancelPickPopup = false">取消</view>
<view class="no-barcode-popup__btn no-barcode-popup__btn--confirm" @click="confirmCancelPick">确定</view>
</view>
</view>
</u-popup>
<!-- 完成拣货弹窗 -->
<u-popup :show="showCompletePickPopup" mode="center" :closeable="true" :closeOnClickOverlay="false" border-radius="20" @close="showCompletePickPopup = false">
<view class="no-barcode-popup">
<view class="no-barcode-popup__title">完成拣货</view>
<view class="no-barcode-popup__body">
<text class="no-barcode-popup__text">确认完成当前拣货任务吗?</text>
</view>
<view class="no-barcode-popup__actions">
<view class="no-barcode-popup__btn no-barcode-popup__btn--cancel" @click="showCompletePickPopup = false">取消</view>
<view class="no-barcode-popup__btn no-barcode-popup__btn--confirm" @click="confirmCompletePick">确定</view>
</view>
</view>
</u-popup>
<!-- 操作弹窗 -->
<u-popup :show="showActionsPopup" mode="bottom" :closeable="true" border-radius="20" @close="showActionsPopup = false">
<view class="actions-popup">
@ -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;