diff --git a/env.js b/env.js index c33f58a..b87b72a 100644 --- a/env.js +++ b/env.js @@ -1,4 +1,4 @@ -// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址 -export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址 +export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址 +// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址 export const API_URL = `${BASE_URL}/system` //后台接口域名 export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss diff --git a/pages/configuration/Workbench.vue b/pages/configuration/Workbench.vue index e8e6f38..1bbd7c0 100644 --- a/pages/configuration/Workbench.vue +++ b/pages/configuration/Workbench.vue @@ -120,10 +120,10 @@ - 支持扫码枪广播 / 摄像头扫描工作台屏幕二维码 + 扫描工作台屏幕二维码 关闭 - 确认绑定 + 确定 @@ -184,6 +184,19 @@ this.safeDispatchBroadcast('stop'); }, methods: { + // 语音播报($tools.speakText 封装,自动 catch) + speakText(text = '') { + try { + const tools = this.$tools; + if (!tools || typeof tools.speakText !== 'function') return; + const task = tools.speakText(String(text).trim(), {}); + if (task && typeof task.catch === 'function') { + task.catch(error => console.warn('[WorkbenchBind] 语音播报失败:', error)); + } + } catch (error) { + console.warn('[WorkbenchBind] 语音播报异常:', error); + } + }, safeDispatchBroadcast(action, payload) { try { const task = this.$store.dispatch(`broadcast/${action}`, payload); @@ -216,6 +229,7 @@ const code = this.normalizeBindCode(scanText); if (!this.validateBindCode(code)) { uni.showToast({ title: '扫码内容不是有效绑定码', icon: 'none' }); + this.speakText('无记录'); return; } this.bindCode = code; @@ -338,6 +352,7 @@ this.confirmBind(); } else { uni.showToast({ title: '扫码内容不是有效绑定码', icon: 'none' }); + this.speakText('无记录'); } }, fail: (error) => { @@ -357,6 +372,7 @@ const id = Number(workbench.id ?? workbench.workbench_id ?? 0); if (!this.validateBindCode(code)) { uni.showToast({ title: '请输入有效的6位绑定码', icon: 'none' }); + this.speakText('无记录'); return; } if (!id) { @@ -373,14 +389,17 @@ const isSuccess = String(res?.flag || '').toLowerCase() === 'success' || Number(res?.code) === 200 || Number(res?.code) === 1; if (!isSuccess) { uni.showToast({ title: res?.message || '绑定失败', icon: 'none' }); + this.speakText('绑定失败'); return; } uni.showToast({ title: '绑定成功', icon: 'success' }); + this.speakText('绑定成功'); this.closeBindPopup(); this.loadWorkbenchList(); } catch (error) { const msg = String(error?.message || error?.msg || '绑定失败'); uni.showToast({ title: msg, icon: 'none' }); + this.speakText('绑定失败'); } finally { this.binding = false; this.safeDispatchBroadcast('resume'); diff --git a/pages/packing/packMode.vue b/pages/packing/packMode.vue index 6eff6a5..54864f3 100644 --- a/pages/packing/packMode.vue +++ b/pages/packing/packMode.vue @@ -168,55 +168,39 @@ - - - - + + {{ opQueryError || '识别失败,请重试' }} + @@ -288,6 +272,28 @@ + + + + + 移除操作员 + + 确认移除操作员「{{ boundOperator.userName || '--' }}」?移除后需重新扫码绑定。 + + + 取消 + 确定 + + + @@ -341,7 +347,9 @@ export default { // 取消核实弹窗(团单) cancelVerifyPopupOpen: false, // 退出工作台弹窗 - exitPopupOpen: false + exitPopupOpen: false, + // 移除操作员二次确认弹窗 + removeOperatorPopupOpen: false } }, // 团购:全部商品核实完成后自动提交开始打包(每次查询仅自动提交一次) @@ -737,28 +745,30 @@ export default { this.groupSubmitting = false; } }, - // 打开操作员弹窗:已绑定态展示操作员信息;未绑定态准备枪扫/输入工牌绑定 + // 顶部操作员姓名按钮:已绑定态直接弹移除二次确认;未绑定态打开操作员弹窗准备枪扫/输入工牌绑定 handleUserInfo() { + // 已绑定:简化操作,直接弹移除操作员二次确认弹窗 + if (this.boundOperator.memberId) { + this.handleRemoveOperator(); + return; + } + // 未绑定:打开操作员弹窗 this.userDrawerOpen = true; // 确保广播监听(从其它页面返回时可能已 pause),未绑定时扫码即识别绑定 this.safeDispatchBroadcast('setCallbacks', { onResult: this.handleBroadcastResult }); this.safeDispatchBroadcast('resume'); - if (!this.boundOperator.memberId) { - // 重置识别待绑定态并聚焦输入框,便于扫码枪/键盘输入 - this.opScanCode = ''; - this.opQueryState = ''; - this.opQueryResult = null; - this.opQueryError = ''; - this.$nextTick(() => { - setTimeout(() => { - this.opInputFocus = true; - }, 300); - }); - } else { - this.opInputFocus = false; - } + // 重置识别待绑定态并聚焦输入框,便于扫码枪/键盘输入 + this.opScanCode = ''; + this.opQueryState = ''; + this.opQueryResult = null; + this.opQueryError = ''; + this.$nextTick(() => { + setTimeout(() => { + this.opInputFocus = true; + }, 300); + }); }, // 关闭操作员弹窗 handleCloseUserDrawer() { @@ -1173,11 +1183,12 @@ export default { name, wmsAccountId: (rawWmsId === null || rawWmsId === undefined || rawWmsId === '') ? null : Number(rawWmsId) }; - this.opQueryState = 'identified'; + // 识别成功直接进入绑定流程(binding 态不展示绑定按钮,避免按钮一闪而过) + this.opQueryState = 'binding'; // 扫描/输入成功且识别到姓名:输入框直接回显姓名 this.opScanCode = name; this.opInputFocus = false; - // 有效扫描值直接完成绑定,无需手动点击绑定按钮(延迟到识别 loading 关闭后) + // 有效扫描值直接完成绑定(延迟到识别 loading 关闭后,避免与绑定 loading 冲突) setTimeout(() => { this.handleBindOperator(); }, 0); @@ -1253,18 +1264,31 @@ export default { this.speakText('绑定成功'); } catch (error) { console.error('[packMode] 绑定操作员失败:', error); - uni.showToast({ title: error?.message || '绑定操作员失败', icon: 'none' }); - this.speakText('绑定失败'); + // 绑定失败:进入待绑定态,保留识别结果,展示「绑定」按钮供手动重试 + this.opQueryState = 'identified'; + uni.showToast({ title: error?.message || '绑定操作员失败,请点击绑定重试', icon: 'none' }); + this.speakText('绑定失败,请点击绑定重试'); } finally { uni.hideLoading(); this.opBinding = false; } }, - // 移除操作员(workbench.removeMember):按本地保存的成员行 id 直接移除 + // 移除操作员(workbench.removeMember):先弹二次确认,确认后按本地保存的成员行 id 移除 handleRemoveOperator() { const memberId = String(this.boundOperator?.memberId || '').trim(); if (!memberId) return; - this.doRemoveOperator(memberId); + this.removeOperatorPopupOpen = true; + }, + // 关闭移除操作员二次确认弹窗 + handleCloseRemoveOperatorPopup() { + this.removeOperatorPopupOpen = false; + }, + // 确认移除操作员 + async confirmRemoveOperator() { + const memberId = String(this.boundOperator?.memberId || '').trim(); + this.removeOperatorPopupOpen = false; + if (!memberId) return; + await this.doRemoveOperator(memberId); }, // 执行移除成员请求(silent=true 时为退出工作台前的静默解绑:不弹 loading/toast/语音) async doRemoveOperator(memberId, opts = {}) { @@ -1971,51 +1995,6 @@ export default { gap: 20rpx; } -.operator-line { - display: flex; - align-items: center; -} - -.operator-line__name { - font-size: 36rpx; - font-weight: 600; - color: #303133; - flex: 1; - min-width: 0; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.operator-line__status { - flex-shrink: 0; - padding: 6rpx 16rpx; - border-radius: 999rpx; - font-size: 36rpx; - margin-left: 14rpx; - margin-right: 30rpx; -} - -.operator-line__status--bound { - background: #e8f8ef; - color: #18b566; -} - -.operator-line__remove { - display: flex; - align-items: center; - gap: 6rpx; - flex-shrink: 0; - padding: 10rpx 20rpx; - border-radius: 8rpx; - background: #fef0f0; -} - -.operator-line__remove-text { - font-size: 36rpx; - color: #f56c6c; -} - .operator-ident-card { margin-top: 24rpx; background: #f0f7ff; @@ -2043,9 +2022,11 @@ export default { .user-drawer__header { padding: 48rpx 28rpx 16rpx; flex-shrink: 0; + text-align: center; } .user-drawer__title { + display: block; font-size: 42rpx; font-weight: 600; color: #303133; @@ -2349,4 +2330,64 @@ export default { background: #f56c6c; color: #ffffff; } + +.remove-operator-popup { + width: 640rpx; + padding: 40rpx 32rpx 32rpx; + background: #ffffff; + border-radius: 20rpx; + box-sizing: border-box; +} + +.remove-operator-popup__title { + font-size: 42rpx; + font-weight: 600; + color: #303133; + text-align: center; + margin-bottom: 32rpx; +} + +.remove-operator-popup__body { + margin-bottom: 36rpx; + padding: 24rpx; + background: #f8f9fa; + border-radius: 12rpx; +} + +.remove-operator-popup__text { + font-size: 36rpx; + color: #303133; + line-height: 1.6; +} + +.remove-operator-popup__actions { + display: flex; + align-items: center; +} + +.remove-operator-popup__btn { + flex: 1; + height: 88rpx; + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + font-size: 36rpx; + font-weight: 500; +} + +.remove-operator-popup__btn:not(:last-child) { + margin-right: 20rpx; +} + +.remove-operator-popup__btn--cancel { + background: #f5f7fa; + color: #606266; + border: 1rpx solid #dcdfe6; +} + +.remove-operator-popup__btn--confirm { + background: #f56c6c; + color: #ffffff; +} diff --git a/pages/work/order/gBWaveStrategy.vue b/pages/work/order/gBWaveStrategy.vue index 92eec44..680bc6e 100644 --- a/pages/work/order/gBWaveStrategy.vue +++ b/pages/work/order/gBWaveStrategy.vue @@ -15,6 +15,7 @@ {{ currentStrategy.strategyName }} + 状态:已停用 创建人:{{ currentStrategy.creatorName }} 匹配订单:{{ currentStrategy.matchedOrderCountFiltered }} SKU区间:{{ currentStrategy.orderMinSku }} - {{ currentStrategy.orderMaxSku }} @@ -68,7 +69,7 @@ @@ -76,7 +77,7 @@ + 已停用 {{ item.matchedOrderCountFiltered }} @@ -334,8 +336,12 @@ const expressLimitList = this.normalizeLimitList(source.allowed_expresses); const provinceLimitList = this.normalizeLimitList(source.allowed_provinces); const platformLimitList = this.normalizeLimitList(source.allowed_platforms); + const status = Number(source.status); return { id: source.id ?? '', + status, + disabled: status === 0, + statusText: status === 0 ? '已停用' : '启用', strategyName: source.strategy_name || '', strategyType: source.strategy_type ?? '--', strategyTypeText: this.normalizeStrategyTypeText(source.strategy_type), @@ -371,6 +377,13 @@ if (!item || typeof item !== 'object') { return; } + if (item.disabled) { + uni.showToast({ + title: '该策略已停用', + icon: 'none' + }); + return; + } this.currentStrategyId = item.id; }, handleRefresh() { @@ -384,6 +397,13 @@ }); return; } + if (this.currentStrategy.disabled) { + uni.showToast({ + title: '该策略已停用', + icon: 'none' + }); + return; + } if (this.creatingTask) { return; } @@ -432,7 +452,8 @@ const parsedList = this.parseWaveStrategyResponse(response); parsedList.sort((a, b) => Number(b.matchedOrderCountFiltered) - Number(a.matchedOrderCountFiltered)); this.strategyList = parsedList; - this.currentStrategyId = this.strategyList[0]?.id || ''; + const firstEnabled = this.strategyList.find(item => !item.disabled); + this.currentStrategyId = firstEnabled?.id || ''; } catch (error) { this.currentStrategyId = ''; this.strategyList = []; @@ -582,6 +603,13 @@ margin-bottom: 14rpx; } + .strategy-status-row { + font-size: 24rpx; + color: #f56c6c; + margin-top: -10rpx; + margin-bottom: 14rpx; + } + .card-row { display: flex; align-items: flex-start; @@ -701,6 +729,31 @@ box-shadow: 0 10rpx 24rpx rgba(255, 153, 0, 0.2); } + .pick-card--disabled { + border-color: #dcdfe6; + background: #f5f7fa; + opacity: 0.72; + } + + .pick-card--disabled .pick-card__title-marquee { + background: #c0c4cc; + } + + .pick-card--disabled .pick-card__bottom { + background: #c0c4cc; + } + + .pick-card__disabled-badge { + align-self: flex-end; + margin: 8rpx 8rpx 0 0; + padding: 0 10rpx; + border-radius: 8rpx; + background: #909399; + color: #ffffff; + font-size: 18rpx; + line-height: 28rpx; + } + .pick-card__top { display: flex; justify-content: space-between; diff --git a/pages/work/order/scatter-wave-strategy.vue b/pages/work/order/scatter-wave-strategy.vue index 3233d81..d97211c 100644 --- a/pages/work/order/scatter-wave-strategy.vue +++ b/pages/work/order/scatter-wave-strategy.vue @@ -15,6 +15,7 @@ {{ currentStrategy.strategyName }} + 状态:已停用 创建人:{{ currentStrategy.creatorName }} 匹配订单:{{ currentStrategy.matchedOrderCountFiltered }} SKU区间:{{ currentStrategy.orderMinSku }} - {{ currentStrategy.orderMaxSku }} @@ -68,25 +69,26 @@ - - - - + + + + + 已停用 {{ item.matchedOrderCountFiltered }} @@ -334,8 +336,12 @@ const expressLimitList = this.normalizeLimitList(source.allowed_expresses); const provinceLimitList = this.normalizeLimitList(source.allowed_provinces); const platformLimitList = this.normalizeLimitList(source.allowed_platforms); + const status = Number(source.status); return { id: source.id ?? '', + status, + disabled: status === 0, + statusText: status === 0 ? '已停用' : '启用', strategyName: source.strategy_name || '', strategyType: source.strategy_type ?? '--', strategyTypeText: this.normalizeStrategyTypeText(source.strategy_type), @@ -371,6 +377,13 @@ if (!item || typeof item !== 'object') { return; } + if (item.disabled) { + uni.showToast({ + title: '该策略已停用', + icon: 'none' + }); + return; + } this.currentStrategyId = item.id; }, handleRefresh() { @@ -384,6 +397,13 @@ }); return; } + if (this.currentStrategy.disabled) { + uni.showToast({ + title: '该策略已停用', + icon: 'none' + }); + return; + } if (this.creatingTask) { return; } @@ -432,7 +452,8 @@ const parsedList = this.parseWaveStrategyResponse(response); parsedList.sort((a, b) => Number(b.matchedOrderCountFiltered) - Number(a.matchedOrderCountFiltered)); this.strategyList = parsedList; - this.currentStrategyId = this.strategyList[0]?.id || ''; + const firstEnabled = this.strategyList.find(item => !item.disabled); + this.currentStrategyId = firstEnabled?.id || ''; } catch (error) { this.currentStrategyId = ''; this.strategyList = []; @@ -582,6 +603,13 @@ margin-bottom: 14rpx; } + .strategy-status-row { + font-size: 24rpx; + color: #f56c6c; + margin-top: -10rpx; + margin-bottom: 14rpx; + } + .card-row { display: flex; align-items: flex-start; @@ -701,6 +729,31 @@ box-shadow: 0 10rpx 24rpx rgba(255, 153, 0, 0.2); } + .pick-card--disabled { + border-color: #dcdfe6; + background: #f5f7fa; + opacity: 0.72; + } + + .pick-card--disabled .pick-card__title-marquee { + background: #c0c4cc; + } + + .pick-card--disabled .pick-card__bottom { + background: #c0c4cc; + } + + .pick-card__disabled-badge { + align-self: flex-end; + margin: 8rpx 8rpx 0 0; + padding: 0 10rpx; + border-radius: 8rpx; + background: #909399; + color: #ffffff; + font-size: 18rpx; + line-height: 28rpx; + } + .pick-card__top { display: flex; justify-content: space-between;