diff --git a/core/request/apis.js b/core/request/apis.js index 02ae22c..5af8f39 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -236,6 +236,18 @@ export default { method: "POST", isSystemApi: true }, + wavePickTaskSubmit: { + path: "pick.wavePickTaskSubmit", + auth: true, + method: "POST", + isSystemApi: true + }, + wavePickTaskComplete: { + path: "pick.wavePickTaskComplete", + auth: true, + method: "POST", + isSystemApi: true + }, items: { path: "pick.items", auth: true, @@ -249,6 +261,26 @@ export default { isSystemApi: true } }, + pickCart: { + scan: { + path: "pickCart.scan", + auth: true, + method: "POST", + isSystemApi: true + }, + list: { + path: "pickCart.list", + auth: true, + method: "POST", + isSystemApi: true + }, + bindTaskCart: { + path: "pickCart.bindTaskCart", + auth: true, + method: "POST", + isSystemApi: true + } + }, order: { print: { getWavePlatformPrintData: { diff --git a/pages/work/order/groupon-picking-detail.vue b/pages/work/order/groupon-picking-detail.vue index 25a0abe..266e350 100644 --- a/pages/work/order/groupon-picking-detail.vue +++ b/pages/work/order/groupon-picking-detail.vue @@ -143,8 +143,8 @@ page: Number(page || 1), pageSize: Number(this.pageSize || 20) }, + only_todo: 1, where: { - source: 0, wave_type: 1 } }; diff --git a/pages/work/order/picking.vue b/pages/work/order/picking.vue index b632369..5275ebb 100644 --- a/pages/work/order/picking.vue +++ b/pages/work/order/picking.vue @@ -4,6 +4,9 @@ @@ -86,9 +89,14 @@ > {{ selectedItemImageLoading ? '图片加载中...' : '暂无商品图片' }} - + {{ selectedPickItem.itemName || '--' }} + 拣货车:{{ boundCartNo }}{{ boundCartName ? `(${boundCartName})` : '' }} 商品条码:{{ selectedItemBarcodeLoading ? '条码加载中...' : (selectedItemBarcode || '--') }} 库位:{{ selectedPickItem.spaceName || '--' }} @@ -117,7 +125,7 @@ v-for="(item, index) in filteredPickItems" :key="`${item.spaceId}-${item.itemCode}-${index}`" class="index-cell" - :class="{ 'index-cell--active': selectedIndex === index }" + :class="{ 'index-cell--active': selectedIndex === index, 'index-cell--picked': isPickItemPicked(item) }" @click="selectPickItem(index)" > {{ index + 1 }} @@ -129,6 +137,43 @@ + + + + 绑定拣货车 + + + + + + + + 查询 + + + + 拣货车列表加载中... + 暂无拣货车数据 + + + {{ getBindCartNo(item) }}{{ getBindCartName(item) ? `(${getBindCartName(item)})` : '' }} + 已绑定 + + + + + 取消 + 确定 + + + @@ -149,6 +194,21 @@ selectedItemBarcodeLoading: false, selectedItemBarcode: '', itemBarcodeCache: {}, + pickedItemKeys: [], + pickedStateStorageKey: 'order_picking_picked_state_v1', + boundCartNo: '', + boundCartName: '', + bindCartNoInput: '', + bindCartPopupVisible: false, + bindCartListLoading: false, + bindCartList: [], + selectedBindCartItem: null, + bindCartQueryKeyword: '', + boundCartStorageKey: 'order_picking_bound_cart_v1', + submittingWavePickTask: false, + wavePickSubmitQueue: [], + isNetworkConnected: true, + isFlushingWavePickSubmitQueue: false, showActionSheet: false, taskInfo: { taskId: '', @@ -259,6 +319,8 @@ } }, onLoad(options) { + this.initWavePickSubmitNetworkStatus(); + this.bindNetworkStatusChange(); this.$store.dispatch('broadcast/setCallbacks', { onResult: this.handleBroadcastScan }); @@ -279,9 +341,86 @@ this.$store.dispatch('broadcast/stop'); }, onUnload() { + this.unbindNetworkStatusChange(); this.$store.dispatch('broadcast/stop'); }, methods: { + initWavePickSubmitNetworkStatus() { + uni.getNetworkType({ + success: res => { + const networkType = String(res?.networkType || '').toLowerCase(); + this.isNetworkConnected = networkType !== 'none'; + if (this.isNetworkConnected) { + this.flushWavePickSubmitQueue(); + } + }, + fail: () => { + this.isNetworkConnected = true; + } + }); + }, + bindNetworkStatusChange() { + if (this._networkStatusChangeHandler) { + return; + } + this._networkStatusChangeHandler = res => { + const isConnected = Boolean(res?.isConnected) && String(res?.networkType || '').toLowerCase() !== 'none'; + this.isNetworkConnected = isConnected; + if (isConnected) { + this.flushWavePickSubmitQueue(); + } + }; + uni.onNetworkStatusChange(this._networkStatusChangeHandler); + }, + unbindNetworkStatusChange() { + if (!this._networkStatusChangeHandler) { + return; + } + if (typeof uni.offNetworkStatusChange === 'function') { + uni.offNetworkStatusChange(this._networkStatusChangeHandler); + } + this._networkStatusChangeHandler = null; + }, + enqueueWavePickSubmitTask(taskIdNumber) { + const normalizedTaskId = Number(taskIdNumber || 0); + if (!normalizedTaskId) { + return; + } + if (this.wavePickSubmitQueue.includes(normalizedTaskId)) { + return; + } + this.wavePickSubmitQueue.push(normalizedTaskId); + }, + dequeueWavePickSubmitTask(taskIdNumber) { + const normalizedTaskId = Number(taskIdNumber || 0); + this.wavePickSubmitQueue = this.wavePickSubmitQueue.filter(id => Number(id) !== normalizedTaskId); + }, + async flushWavePickSubmitQueue() { + if (!this.isNetworkConnected || this.isFlushingWavePickSubmitQueue || !this.wavePickSubmitQueue.length) { + return; + } + this.isFlushingWavePickSubmitQueue = true; + try { + while (this.isNetworkConnected && this.wavePickSubmitQueue.length) { + const taskIdNumber = Number(this.wavePickSubmitQueue[0] || 0); + if (!taskIdNumber) { + this.wavePickSubmitQueue.shift(); + continue; + } + try { + await this.requestWavePickTaskSubmit(taskIdNumber, 8000); + this.wavePickSubmitQueue.shift(); + } catch (error) { + if (!this.isNetworkConnected || this.isWeakNetworkError(error)) { + break; + } + break; + } + } + } finally { + this.isFlushingWavePickSubmitQueue = false; + } + }, getSelectedImageList() { if (Array.isArray(this.selectedItemImageUrls) && this.selectedItemImageUrls.length) { return this.selectedItemImageUrls; @@ -313,6 +452,432 @@ } return ''; }, + normalizeBarcodeText(barcode) { + return String(barcode || '').trim().replace(/\s+/g, '').toUpperCase(); + }, + getPickItemUniqueKey(item) { + if (!item || typeof item !== 'object') { + return ''; + } + const stockId = String(item.stockId || '').trim(); + const spaceId = String(item.spaceId || '').trim(); + const itemCode = String(item.itemCode || '').trim(); + return [stockId, spaceId, itemCode].join('|'); + }, + getCurrentTaskIdNumber() { + return Number(this.taskInfo?.taskId || this.taskId || 0); + }, + loadPickedStateMap() { + try { + const raw = uni.getStorageSync(this.pickedStateStorageKey); + if (!raw) { + return {}; + } + if (typeof raw === 'string') { + const parsed = JSON.parse(raw); + return parsed && typeof parsed === 'object' ? parsed : {}; + } + return raw && typeof raw === 'object' ? raw : {}; + } catch (error) { + return {}; + } + }, + savePickedStateMap(map) { + try { + uni.setStorageSync(this.pickedStateStorageKey, map || {}); + } catch (error) { + // ignore storage write error + } + }, + persistPickedStateForCurrentTask() { + const taskIdNumber = this.getCurrentTaskIdNumber(); + if (!taskIdNumber) { + return; + } + const map = this.loadPickedStateMap(); + map[String(taskIdNumber)] = Array.from(new Set(this.pickedItemKeys.filter(Boolean))); + this.savePickedStateMap(map); + }, + restorePickedStateForCurrentTask() { + const taskIdNumber = this.getCurrentTaskIdNumber(); + if (!taskIdNumber) { + this.pickedItemKeys = []; + this.boundCartNo = ''; + return; + } + const map = this.loadPickedStateMap(); + const restored = Array.isArray(map[String(taskIdNumber)]) ? map[String(taskIdNumber)] : []; + this.pickedItemKeys = restored.filter(Boolean); + }, + getBoundCartTaskKey() { + return String(this.getCurrentTaskIdNumber() || '').trim(); + }, + loadBoundCartMap() { + try { + const raw = uni.getStorageSync(this.boundCartStorageKey); + if (!raw) { + return {}; + } + if (typeof raw === 'string') { + const parsed = JSON.parse(raw); + return parsed && typeof parsed === 'object' ? parsed : {}; + } + return raw && typeof raw === 'object' ? raw : {}; + } catch (error) { + return {}; + } + }, + saveBoundCartMap(map) { + try { + uni.setStorageSync(this.boundCartStorageKey, map || {}); + } catch (error) { + // ignore + } + }, + restoreBoundCartForCurrentTask() { + const taskKey = this.getBoundCartTaskKey(); + if (!taskKey) { + this.boundCartNo = ''; + this.boundCartName = ''; + this.bindCartNoInput = ''; + this.bindCartList = []; + this.selectedBindCartItem = null; + return; + } + const map = this.loadBoundCartMap(); + const saved = map[taskKey]; + const boundCartNo = typeof saved === 'object' + ? String(saved?.cartNo || saved?.cart_code || '').trim() + : String(saved || '').trim(); + const boundCartName = typeof saved === 'object' + ? String(saved?.cartName || saved?.cart_name || '').trim() + : ''; + this.boundCartNo = boundCartNo; + this.boundCartName = boundCartName; + this.bindCartNoInput = boundCartNo; + }, + persistBoundCartForCurrentTask(cartNo, cartName = '') { + const taskKey = this.getBoundCartTaskKey(); + if (!taskKey) { + return; + } + const map = this.loadBoundCartMap(); + map[taskKey] = { + cartNo: String(cartNo || '').trim(), + cartName: String(cartName || '').trim() + }; + this.saveBoundCartMap(map); + }, + openBindCartPopup() { + if (!this.hasActiveTask) { + uni.showToast({ + title: '请先进入拣货任务', + icon: 'none' + }); + return; + } + this.bindCartNoInput = this.boundCartNo || ''; + this.bindCartQueryKeyword = this.bindCartNoInput || ''; + this.selectedBindCartItem = null; + this.bindCartPopupVisible = true; + this.handleBindCartSearch(); + }, + closeBindCartPopup() { + this.bindCartPopupVisible = false; + }, + applyBindCartScanResult(rawValue) { + const scanText = this.normalizeScanResult(rawValue); + if (!scanText) { + uni.showToast({ + title: '未识别到有效拣货车编码', + icon: 'none' + }); + return; + } + this.bindCartNoInput = scanText; + this.bindCartQueryKeyword = scanText; + this.handleBindCartSearch(); + }, + handleBindCartScan() { + uni.scanCode({ + onlyFromCamera: true, + scanType: ['barCode', 'qrCode'], + success: res => { + this.applyBindCartScanResult(res); + }, + fail: () => { + uni.showToast({ + title: '扫码失败,请重试', + icon: 'none' + }); + } + }); + }, + getBindCartItemKey(item) { + const cartNo = this.getBindCartNo(item); + return String(item?.id || item?.cart_id || item?.cartId || cartNo || '').trim(); + }, + getBindCartNo(item) { + return String( + item?.cart_code || + item?.cartCode || + item?.cart_no || + item?.cartNo || + item?.code || + '--' + ).trim() || '--'; + }, + getBindCartName(item) { + return String( + item?.cart_name || + item?.cartName || + item?.cart?.cart_name || + item?.cart?.cartName || + item?.name || + '' + ).trim(); + }, + getBindCartStatusText(item) { + const status = String(item?.status ?? item?.cart_status ?? '').trim(); + if (!status) { + return '--'; + } + const map = { + 0: '未绑定', + 1: '已绑定', + 2: '可用', + 3: '停用' + }; + return map[status] || status; + }, + getBindCartDesc(item) { + const cartName = this.getBindCartName(item); + const taskId = String(item?.current_task_id || item?.task_id || item?.taskId || '').trim(); + const taskText = taskId ? `当前任务:${taskId}` : '当前任务:无'; + return cartName ? `名称:${cartName},${taskText}` : taskText; + }, + isBindCartSelected(item) { + return this.getBindCartItemKey(item) === this.getBindCartItemKey(this.selectedBindCartItem); + }, + isBindCartBound(item) { + const currentBoundNo = this.normalizeBarcodeText(this.boundCartNo); + const itemCartNo = this.normalizeBarcodeText(this.getBindCartNo(item)); + return Boolean(currentBoundNo) && currentBoundNo === itemCartNo; + }, + selectBindCartItem(item) { + this.selectedBindCartItem = item || null; + this.bindCartNoInput = this.getBindCartNo(item); + }, + async handleBindCartSearch() { + const keyword = String(this.bindCartQueryKeyword || this.bindCartNoInput || '').trim(); + this.bindCartQueryKeyword = keyword; + this.bindCartListLoading = true; + try { + const response = keyword + ? await this.$http('pickCart.scan', { cart_code: keyword }, '', false) + : await this.$http('pickCart.list', { + pagination: { page: 1, pageSize: 20 }, + where: { + keyword: '', + status: '', + current_task_id: this.getCurrentTaskIdNumber() || '' + } + }, '', false); + const payload = response?.data?.data || response?.data || response?.result || response || {}; + const list = Array.isArray(payload?.list) + ? payload.list + : Array.isArray(payload?.rows) + ? payload.rows + : Array.isArray(payload?.items) + ? payload.items + : (payload?.cart + ? [payload.cart] + : (payload?.data && typeof payload.data === 'object' ? [payload.data] : (payload && typeof payload === 'object' ? [payload] : []))); + this.bindCartList = list.filter(item => this.getBindCartNo(item) !== '--'); + if (this.bindCartList.length > 0 && !this.selectedBindCartItem) { + const boundItem = this.bindCartList.find(item => this.isBindCartBound(item)); + this.selectedBindCartItem = boundItem || this.bindCartList[0]; + this.bindCartNoInput = this.getBindCartNo(this.selectedBindCartItem); + } + } catch (error) { + this.bindCartList = []; + this.showErrorModal(this.getApiErrorMessage(error, '查询拣货车失败')); + } finally { + this.bindCartListLoading = false; + } + }, + async confirmBindCart() { + const cartNo = String(this.bindCartNoInput || this.getBindCartNo(this.selectedBindCartItem) || '').trim(); + if (!cartNo) { + uni.showToast({ + title: '请输入拣货车编号', + icon: 'none' + }); + return; + } + const taskIdNumber = this.getCurrentTaskIdNumber(); + if (!taskIdNumber) { + uni.showToast({ + title: '缺少拣货任务ID', + icon: 'none' + }); + return; + } + let cartName = this.getBindCartName(this.selectedBindCartItem); + let selectedCartId = Number( + this.selectedBindCartItem?.id || + this.selectedBindCartItem?.cart_id || + this.selectedBindCartItem?.cartId || + 0 + ); + if (!cartName) { + try { + const response = await this.$http('pickCart.scan', { cart_code: cartNo }, '', false); + const payload = response?.data?.data || response?.data || response?.result || response || {}; + const scannedItem = payload?.cart || payload?.data || payload; + cartName = this.getBindCartName(scannedItem); + selectedCartId = Number( + scannedItem?.id || + scannedItem?.cart_id || + scannedItem?.cartId || + selectedCartId || + 0 + ); + } catch (error) { + cartName = ''; + } + } + const bindPayload = { + task_id: taskIdNumber + }; + if (Number.isFinite(selectedCartId) && selectedCartId > 0) { + bindPayload.cart_id = selectedCartId; + } + try { + const bindResponse = await this.$http('pickCart.bindTaskCart', bindPayload, '', false); + if (String(bindResponse?.flag || '').toLowerCase() === 'failure') { + this.showErrorModal(bindResponse?.message || '绑定拣货车失败'); + return; + } + } catch (error) { + this.showErrorModal(this.getApiErrorMessage(error, '绑定拣货车失败')); + return; + } + this.boundCartNo = cartNo; + this.boundCartName = cartName; + this.persistBoundCartForCurrentTask(cartNo, cartName); + this.bindCartPopupVisible = false; + uni.showToast({ + title: '绑定成功', + icon: 'none' + }); + }, + isPickItemPicked(item) { + const key = this.getPickItemUniqueKey(item); + return Boolean(key) && this.pickedItemKeys.includes(key); + }, + markPickItemPicked(item) { + const key = this.getPickItemUniqueKey(item); + if (!key || this.pickedItemKeys.includes(key)) { + return; + } + this.pickedItemKeys = [...this.pickedItemKeys, key]; + this.persistPickedStateForCurrentTask(); + }, + isSelectedItemMatchedHighlight() { + return this.isPickItemPicked(this.selectedPickItem); + }, + triggerBarcodeMatchedHighlight(item) { + this.markPickItemPicked(item); + }, + sleep(ms = 0) { + return new Promise(resolve => { + setTimeout(resolve, Number(ms) || 0); + }); + }, + isWeakNetworkError(error) { + const errorText = String( + error?.errMsg || + error?.message || + error?.msg || + error?.data?.message || + '' + ).toLowerCase(); + if (!errorText) { + return false; + } + return ( + errorText.includes('timeout') || + errorText.includes('timed out') || + errorText.includes('network') || + errorText.includes('request:fail') || + errorText.includes('连接') || + errorText.includes('超时') + ); + }, + createSubmitTimeoutError(timeoutMs) { + const error = new Error(`提交超时(${timeoutMs}ms)`); + error.code = 'REQUEST_TIMEOUT'; + error.errMsg = `request:fail timeout ${timeoutMs}`; + return error; + }, + requestWavePickTaskSubmit(taskIdNumber, timeoutMs = 8000) { + const requestPromise = this.$http('pick.wavePickTaskSubmit', { + task_id: taskIdNumber + }); + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => { + reject(this.createSubmitTimeoutError(timeoutMs)); + }, timeoutMs); + }); + return Promise.race([requestPromise, timeoutPromise]); + }, + async submitWavePickTaskIntermediate() { + const taskIdNumber = this.getCurrentTaskIdNumber(); + if (!taskIdNumber || this.submittingWavePickTask) { + return; + } + if (!this.isNetworkConnected) { + this.enqueueWavePickSubmitTask(taskIdNumber); + uni.showToast({ + title: '当前离线,已加入补提队列', + icon: 'none' + }); + return; + } + const maxAttempts = 3; + let lastError = null; + this.submittingWavePickTask = true; + try { + for (let attempt = 1; attempt <= maxAttempts; attempt += 1) { + try { + await this.requestWavePickTaskSubmit(taskIdNumber, 8000); + this.dequeueWavePickSubmitTask(taskIdNumber); + return; + } catch (error) { + lastError = error; + const isWeakNetwork = this.isWeakNetworkError(error); + if (!this.isNetworkConnected) { + this.enqueueWavePickSubmitTask(taskIdNumber); + break; + } + if (!isWeakNetwork || attempt >= maxAttempts) { + break; + } + await this.sleep(attempt * 600); + } + } + if (!this.isNetworkConnected) { + return; + } + const fallbackMessage = this.isWeakNetworkError(lastError) + ? '网络较差,提交拣货中间态失败,请重试' + : '提交拣货中间态失败'; + this.showErrorModal(this.getApiErrorMessage(lastError, fallbackMessage)); + } finally { + this.submittingWavePickTask = false; + } + }, handleScanKeywordEntry(rawKeyword) { const scanText = this.normalizeScanResult(rawKeyword); if (!scanText) { @@ -331,9 +896,25 @@ }, handleBroadcastScan(payload) { const scanText = this.normalizeScanResult(payload); + if (this.bindCartPopupVisible) { + this.applyBindCartScanResult(scanText); + return; + } if (!this.hasActiveTask) { this.handleScanKeywordEntry(scanText); + return; } + const scanBarcode = this.normalizeBarcodeText(scanText); + const currentBarcode = this.normalizeBarcodeText(this.selectedItemBarcode); + if (scanBarcode && currentBarcode && scanBarcode === currentBarcode) { + this.triggerBarcodeMatchedHighlight(this.selectedPickItem); + this.submitWavePickTaskIntermediate(); + return; + } + uni.showToast({ + title: '商品条码不一致', + icon: 'none' + }); }, extractTaskIdCandidate(rawValue) { if (rawValue === null || rawValue === undefined || rawValue === '') { @@ -412,6 +993,13 @@ } return lines.join('\n'); }, + showErrorModal(message, title = '提示') { + uni.showModal({ + title, + content: String(message || '请求失败'), + showCancel: false + }); + }, async requestPickTaskByKeyword(keyword) { const normalizedKeyword = String(keyword || '').trim(); if (!normalizedKeyword) { @@ -427,7 +1015,11 @@ try { const response = await this.$http('pick.query', { keyword: normalizedKeyword - }); + }, '', false); + if (String(response?.flag || '').toLowerCase() === 'failure') { + this.showErrorModal(response?.message || '任务查询失败'); + return; + } const taskId = this.extractTaskIdFromPickQueryResponse(response); if (!taskId) { uni.showToast({ @@ -449,10 +1041,7 @@ }); return; } - uni.showToast({ - title: this.getApiErrorMessage(error, '任务查询失败'), - icon: 'none' - }); + this.showErrorModal(this.getApiErrorMessage(error, '任务查询失败')); } finally { uni.hideLoading(); } @@ -475,11 +1064,96 @@ this.showActionSheet = false; } }, + requestWavePickTaskComplete(taskIdNumber, options = {}) { + const payload = { + task_id: taskIdNumber, + mode: Number(options?.mode || 1) + }; + if (payload.mode === 2 && Array.isArray(options?.order_ids) && options.order_ids.length) { + payload.order_ids = options.order_ids; + } + return this.$http('pick.wavePickTaskComplete', payload, '', false); + }, handleCompletePick() { this.showActionSheet = false; - uni.showToast({ + if (!this.hasActiveTask) { + uni.showToast({ + title: '缺少拣货任务', + icon: 'none' + }); + return; + } + const taskIdNumber = Number(this.taskInfo?.taskId || this.taskId || 0); + if (!taskIdNumber) { + uni.showToast({ + title: '缺少任务ID', + icon: 'none' + }); + return; + } + uni.showModal({ title: '完成拣货', - icon: 'none' + content: '确认全部完成当前拣货任务吗?', + success: async res => { + if (!res?.confirm) { + return; + } + uni.showLoading({ + title: '正在提交...' + }); + try { + const response = await this.requestWavePickTaskComplete(taskIdNumber, { + mode: 1 + }); + if (String(response?.flag || '').toLowerCase() === 'failure') { + this.showErrorModal(response?.message || '完成拣货失败'); + return; + } + uni.showToast({ + title: '完成成功', + icon: 'none' + }); + 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 = []; + } catch (error) { + this.showErrorModal(this.getApiErrorMessage(error, '完成拣货失败')); + } finally { + uni.hideLoading(); + } + } }); }, handleCancelPick() { @@ -625,6 +1299,8 @@ })) })) }; + this.restorePickedStateForCurrentTask(); + this.restoreBoundCartForCurrentTask(); this.selectedIndex = 0; }, async requestWavePickTaskDetail() { @@ -636,15 +1312,17 @@ try { const response = await this.$http('pick.wavePickTaskDetail', { task_id: taskIdNumber - }); + }, '', false); + if (String(response?.flag || '').toLowerCase() === 'failure') { + this.pickingView.items = []; + this.showErrorModal(response?.message || '任务详情获取失败'); + return; + } const payload = this.extractTaskDetailPayload(response); this.normalizeTaskDetailPayload(payload); } catch (error) { this.pickingView.items = []; - uni.showToast({ - title: this.getApiErrorMessage(error, '任务详情获取失败'), - icon: 'none' - }); + this.showErrorModal(this.getApiErrorMessage(error, '任务详情获取失败')); } finally { this.loadingTaskDetail = false; } @@ -1041,7 +1719,43 @@ } .nav-right { - padding-right: 20rpx; + padding-right: 12rpx; + display: flex; + align-items: center; + justify-content: flex-end; + gap: 26rpx; + flex-wrap: nowrap; + min-width: 0; + } + + .nav-action-btn { + height: 48rpx; + padding: 0 12rpx; + border-radius: 999rpx; + display: flex; + align-items: center; + justify-content: center; + background: #eaf2ff; + border: 1rpx solid #cfe1ff; + flex-shrink: 1; + } + + .nav-action-btn--bind { + background: #f0f9eb; + border-color: #d2f0c8; + } + + .nav-action-btn__text { + font-size: 24rpx; + color: #2979ff; + line-height: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + ::v-deep .nav-right .u-icon { + flex-shrink: 0; } .nav-right--disabled { @@ -1095,6 +1809,7 @@ align-items: center; justify-content: space-between; gap: 12rpx; + flex-wrap: wrap; } .pick-name { @@ -1104,6 +1819,16 @@ flex: 1; } + .pick-cart-tag { + padding: 4rpx 12rpx; + border-radius: 999rpx; + background: #f0f9eb; + color: #67c23a; + font-size: 22rpx; + line-height: 1.4; + border: 1rpx solid #d9f0cf; + } + .pick-row { display: flex; align-items: center; @@ -1174,6 +1899,13 @@ flex: 1; min-width: 0; cursor: pointer; + border-radius: 10rpx; + transition: all 0.2s ease; + } + + .detail-main-right--matched { + background: #ecf5ff; + box-shadow: inset 0 0 0 2rpx #2979ff; } .pick-image-empty { @@ -1274,6 +2006,159 @@ border-color: #2979ff; } + .index-cell--picked { + background: #f0f9eb; + border-color: #67c23a; + } + + .bind-cart-popup { + padding: 20rpx 24rpx 28rpx; + box-sizing: border-box; + } + + .popup-header { + display: flex; + align-items: center; + justify-content: center; + padding: 8rpx 0 18rpx; + } + + .popup-title { + font-size: 32rpx; + color: #303133; + font-weight: 600; + } + + .bind-cart-form { + padding: 0 0 20rpx; + } + + .bind-cart-search-row { + display: flex; + align-items: center; + gap: 12rpx; + } + + .bind-cart-scan-btn, + .bind-cart-query-btn { + height: 68rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + padding: 0 18rpx; + box-sizing: border-box; + font-size: 26rpx; + flex-shrink: 0; + } + + .bind-cart-scan-btn { + width: 72rpx; + background: #f2f7ff; + border: 1rpx solid #d9e8ff; + } + + .bind-cart-query-btn { + min-width: 96rpx; + background: #2979ff; + color: #ffffff; + } + + .bind-cart-tip { + margin-top: 10rpx; + font-size: 22rpx; + color: #909399; + } + + .bind-cart-list { + max-height: 420rpx; + padding: 0 0 20rpx; + box-sizing: border-box; + } + + .bind-cart-empty { + padding: 20rpx 0; + text-align: center; + font-size: 26rpx; + color: #909399; + } + + .bind-cart-item { + margin-bottom: 12rpx; + padding: 18rpx; + border-radius: 14rpx; + background: #f8f9fa; + border: 1rpx solid #ebeef5; + } + + .bind-cart-item--active { + background: #ecf5ff; + border-color: #2979ff; + } + + .bind-cart-item__head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12rpx; + } + + .bind-cart-item__title { + font-size: 28rpx; + color: #303133; + font-weight: 600; + } + + .bind-cart-item__bound { + font-size: 22rpx; + color: #67c23a; + padding: 2rpx 10rpx; + border-radius: 999rpx; + background: #f0f9eb; + border: 1rpx solid #d9f0cf; + line-height: 1.4; + flex-shrink: 0; + } + + .bind-cart-item__status { + font-size: 22rpx; + color: #67c23a; + } + + .bind-cart-item__desc { + display: block; + margin-top: 8rpx; + font-size: 24rpx; + color: #606266; + } + + .bind-cart-actions { + display: flex; + align-items: center; + gap: 16rpx; + } + + .bind-cart-btn { + flex: 1; + height: 76rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 28rpx; + font-weight: 500; + } + + .bind-cart-btn--cancel { + background: #f5f7fa; + color: #606266; + } + + .bind-cart-btn--confirm { + background: #2979ff; + color: #ffffff; + } + .index-text { font-size: 34rpx; font-weight: 600; diff --git a/pages/work/order/scatter-picking-detail.vue b/pages/work/order/scatter-picking-detail.vue index fdc1ff1..f52c54d 100644 --- a/pages/work/order/scatter-picking-detail.vue +++ b/pages/work/order/scatter-picking-detail.vue @@ -183,7 +183,6 @@ methods: { buildBatchListParams(page = this.currentPage) { const where = { - source: 0, wave_type: 2 }; if (this.onlyMine && this.currentUserId) { @@ -194,6 +193,7 @@ page: Math.max(1, Number(page || 1)), pageSize: Math.max(1, Number(this.pageSize || 20)) }, + only_todo: 1, where }; }, diff --git a/pages/work/order/scatter-wave-strategy.vue b/pages/work/order/scatter-wave-strategy.vue index 5c34dca..95fc5ff 100644 --- a/pages/work/order/scatter-wave-strategy.vue +++ b/pages/work/order/scatter-wave-strategy.vue @@ -336,9 +336,7 @@ const strategyId = Number(this.currentStrategy?.id || 0); return { strategy_id: strategyId, - strategyId, - source: 'pda', - operation_source: 'pda' + source: 'pda' }; }, buildPickingRouteParams(payload) { diff --git a/pages/work/storage/gBWaveStrategy.vue b/pages/work/storage/gBWaveStrategy.vue index eadc2c0..4cd0981 100644 --- a/pages/work/storage/gBWaveStrategy.vue +++ b/pages/work/storage/gBWaveStrategy.vue @@ -336,9 +336,7 @@ const strategyId = Number(this.currentStrategy?.id || 0); return { strategy_id: strategyId, - strategyId, - source: 'pda', - operation_source: 'pda' + source: 'pda' }; }, buildPickingRouteParams(payload) {