diff --git a/App.vue b/App.vue index 530aef0..1b14e4d 100644 --- a/App.vue +++ b/App.vue @@ -4,6 +4,9 @@ import { ensureEntry } from '@/core/utils/auth-guard' let bootstrapping = false let validatedToken = '' +// H5(history 模式)下,整页直接刷新/打开 packMode 等“非入口页”时 uni-app 不创建页面视图(白屏)。 +// 该状态仅本次整页启动时自愈一次(页面缺失则回跳入口),避免重复触发。 +let h5WhiteHealDone = false export default { onLaunch() { @@ -11,6 +14,7 @@ export default { }, onShow() { this.bootstrapAuth() + this.h5WhiteScreenHeal() }, methods: { async bootstrapAuth() { @@ -28,6 +32,30 @@ export default { } finally { bootstrapping = false } + }, + // H5 白屏自愈:manifest h5 路由为 history 模式时,若应用是“整页加载”方式 + // 直接从 packMode 等非 tab、非入口页启动,uni-app 不会渲染出页面视图(uni-page), + // 且该会话内后续客户端跳转同样失效,页面会一直白屏(刷新也无法恢复)。 + // 这里在启动后检测:uni-app 外壳已挂载但 uni-page 缺失 → 判定为白屏态, + // 整页回跳根路径让应用从入口正常启动,避免停留在白屏。真机/App 端不参与编译。 + h5WhiteScreenHeal() { + // #ifdef H5 + if (h5WhiteHealDone) return + h5WhiteHealDone = true + if (typeof window === 'undefined' || !window.location) return + const bootPath = window.location.pathname || '/' + // 入口页(根/登录页)本身可正常渲染,无需处理 + if (bootPath === '/' || bootPath === '/pages/login/index') return + setTimeout(() => { + // 外壳 uni-app 已存在但页面视图 uni-page 缺失 → 白屏,回跳入口 + const shell = document.querySelector('uni-app') + const page = document.querySelector('uni-page') + if (shell && !page) { + console.warn('[App] H5 深链接整页启动未渲染页面视图(白屏),自动回跳入口页:', bootPath) + window.location.replace('/') + } + }, 1500) + // #endif } } } diff --git a/core/request/apis.js b/core/request/apis.js index 3d82843..591cbfe 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -10,6 +10,13 @@ export default { auth: false, method: "POST", isSystemApi: true + }, + // 按 token(ye4s 登录临时码)查询用户信息:ye4s_user.tmp_code 命中返回 real_name / wms_account_id(免登录、免鉴权) + queryUserByToken: { + path: "index.queryUserByToken", + auth: false, + method: "POST", + isSystemApi: true } }, /** 公共 ↓ **/ @@ -110,6 +117,13 @@ export default { method: "POST", isSystemApi: true }, + // 工作台绑定(需登录、需权限):绑定码 code + 工作台ID id,成功返回工作台 token + bind: { + path: "workbench.bind", + auth: true, + method: "POST", + isSystemApi: true + }, // 用工作台 token 获取工作台信息(免登录、免鉴权):token 无效/不存在返回 403 getWorkbenchInfo: { path: "workbench.getWorkbenchInfo", @@ -122,6 +136,34 @@ export default { auth: false, method: "POST", isSystemApi: true + }, + // 移除工作台成员(免登录、免鉴权,以工作台 token 鉴权):ids 为成员行 id(wms_workbench_member.id) + removeMember: { + path: "workbench.removeMember", + auth: false, + method: "POST", + isSystemApi: true + }, + // 工作台条码查询订单(免登录、免鉴权,以工作台 token 鉴权):token + barcode(运单号) + queryOrder: { + path: "workbench.queryOrder", + auth: false, + method: "POST", + isSystemApi: true + }, + // 工作台打包上报(免登录、免鉴权,以工作台 token 鉴权):发货单号定位订单创建打包任务 + packOrder: { + path: "workbench.packOrder", + auth: false, + method: "POST", + isSystemApi: true + }, + // 工作台打包完成(免登录、免鉴权,以工作台 token 鉴权):结束该工作台最后一个未结束打包任务 + finishPack: { + path: "workbench.finishPack", + auth: false, + method: "POST", + isSystemApi: true } }, storage: { diff --git a/pages.json b/pages.json index d884de5..bb6c778 100644 --- a/pages.json +++ b/pages.json @@ -292,6 +292,13 @@ { "titleNView": false } + }, + { + "path" : "pages/configuration/Workbench", + "style" : + { + "titleNView": false + } } ], diff --git a/pages/configuration/Workbench.vue b/pages/configuration/Workbench.vue new file mode 100644 index 0000000..e8e6f38 --- /dev/null +++ b/pages/configuration/Workbench.vue @@ -0,0 +1,666 @@ + + + + + diff --git a/pages/login/index.vue b/pages/login/index.vue index eaa51e4..463221c 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -183,6 +183,7 @@ export default { workbenchInputFocus: false, // 工作台登录码输入框自动聚焦(从打包模式退出回来时) showWorkbenchLogin: false, // 工作台登录码输入框显隐(隐藏入口:连续点击5次标题切换) workbenchTitleTapCount: 0, // 系统标题连点计数(满5次切换工作台登录码输入框显隐) + autoEntering: false, // 自动进入打包模式防重入锁(检测到有效工作台 token 时直接进入 packMode) } }, onLoad() { @@ -205,6 +206,8 @@ export default { }, onShow() { this.scanning = true; + // 检测到本地残留有效工作台 token 时自动进入打包模式(无需在登录页点击跳转) + this.autoEnterPackMode(); // 每次回到本页(reLaunch 重建 / 从其它页面返回)都重新绑定最新回调并确保广播监听 this.$store.dispatch('broadcast/setCallbacks', { onResult: this.handleBroadcastResult @@ -586,6 +589,38 @@ export default { } } }, + // 自动进入打包模式:登录页检测到本地残留有效工作台 token(workbenchToken 非空)时, + // 无需手动点击,自动进入打包模式页(packMode 内部会调用 getWorkbenchInfo 刷新工作台信息) + autoEnterPackMode() { + if (this.autoEntering) return; + const token = String(uni.getStorageSync('workbenchToken') || '').trim(); + if (!token) return; + + this.autoEntering = true; + setTimeout(() => { + // 延迟后再次校验(期间可能已被退出流程清除) + const current = String(uni.getStorageSync('workbenchToken') || '').trim(); + if (!current) { + this.autoEntering = false; + return; + } + // 工作台会话判定依赖 主 token === workbenchToken; + // 若主 token 被普通账号登录覆盖或被登出清空,用本地残留的有效工作台 token 恢复工作台会话, + // 否则路由守卫会把 packMode 视为未登录并重定向回登录页。 + const mainToken = String(uni.getStorageSync('token') || '').trim(); + if (mainToken !== current) { + console.log('[Login][auto] 主 token 与工作台 token 不一致,用本地工作台 token 恢复会话'); + setToken(current); + } + console.log('[Login][auto] 检测到有效工作台 token,自动进入打包模式'); + uni.reLaunch({ + url: '/pages/packing/packMode', + fail: () => { + this.autoEntering = false; + } + }); + }, 500); + }, handleWorkbenchInputConfirm() { // 工作台登录码输入框回车 / 枪扫内容(键盘模拟)落入该框后的统一入口: // 清空后交给 handleBroadcastResult 自动识别(wblc 工作台码 / 工牌 Base64) diff --git a/pages/packing/packMode.vue b/pages/packing/packMode.vue index 488f7f6..38562d9 100644 --- a/pages/packing/packMode.vue +++ b/pages/packing/packMode.vue @@ -8,26 +8,124 @@ 退出 - 打包模式 - + + 打包模式 + {{ workbenchName }} + + + + + + + @@ -51,6 +149,75 @@ + + + + + + 操作员 + + + + + + + + + + + @@ -65,10 +232,50 @@ export default { workbenchToken: '', warehouseId: '', workbenchStatus: '', - workbenchType: '' + workbenchType: '', + infoRefreshing: false, // 进入后刷新工作台信息请求防重入锁 + // 当前操作员(工作台成员,本地保存 bindMember 返回的成员行 id) + boundOperator: { + memberId: '', // wms_workbench_member.id + workbenchId: '', // 记录归属工作台,重新进入时按此匹配 + userId: '', // wms_account.id(非系统账号用户为空) + userName: '' // 姓名快照 + }, + opScanCode: '', // 操作员扫码输入框内容(ye4s 登录临时码) + opInputFocus: false, + opQueryState: '', // '' | loading | identified | error(识别待绑定状态) + opQueryResult: null, // 识别出的待绑定操作员 { scanToken, name, wmsAccountId } + opQueryError: '', + opBinding: false, // bindMember 请求中 + opRemoving: false, // removeMember 请求中 + // 操作员弹窗 + userDrawerOpen: false, + // 订单查询(workbench.queryOrder) + orderBarcode: '', + orderInputFocus: false, + orderQuerying: false, + orderQueryState: '', // '' | loading | success | error + orderQueryResult: null, + orderQueryError: '', + packReporting: false, // packOrder 上报请求防重入锁 + finishPacking: false, // finishPack 完成打包请求防重入锁 + hasActivePack: false, // 该工作台是否存在未结束打包任务(status<2):退出/解绑前自动上报打包完成 + // 团购核实:商品行已扫计数(key=商品行id/序号 → 已扫次数),达 plan_qty 视为已核实 + groupVerified: {}, + groupSubmitting: false, // 团购提交开始打包防重入 + groupAutoSubmitted: false // 团购全部核实后是否已自动提交开始打包 } }, - computed: { + // 团购:全部商品核实完成后自动提交开始打包(每次查询仅自动提交一次) + watch: { + groupAllVerified(verified) { + if (verified && !this.orderQueryIsSandan && this.orderQueryResult && !this.groupAutoSubmitted) { + this.groupAutoSubmitted = true; + this.handleSubmitGroupPack(); + } + } + }, + computed: { maskedToken() { const token = String(this.workbenchToken || ''); if (!token) return ''; @@ -84,12 +291,779 @@ export default { if (this.workbenchType === 'personal') return '个人工作台'; if (this.workbenchType === 'group') return '团体工作台'; return this.workbenchType ? this.workbenchType : '--'; + }, + // 查询结果是否为散单 + orderQueryIsSandan() { + const r = this.orderQueryResult; + return !!(r && Number(r.isSandan) === 1); + }, + // 精简概要:包材名称(express/order 的 package_material_name) + packageMaterialName() { + const r = this.orderQueryResult; + const raw = (r?.order && (r.order.package_material_name ?? r.order.packageMaterialName)) ?? (r?.express && (r.express.package_material_name ?? r.express.packageMaterialName)); + return String(raw || '').trim(); + }, + // 波次号(batch.wave_no 优先,兜底 order.wave_no) + orderWaveNo() { + const r = this.orderQueryResult; + const batchNo = r?.batch && r.batch.wave_no ? String(r.batch.wave_no) : ''; + const orderNo = r?.order && r.order.wave_no ? String(r.order.wave_no) : ''; + return batchNo || orderNo || '--'; + }, + // 波次总单数(团购 batch.total_orders;兜底 items_count) + orderWaveTotal() { + const r = this.orderQueryResult; + const batchTotal = r?.batch && (r.batch.total_orders !== undefined && r.batch.total_orders !== null) ? r.batch.total_orders : null; + const itemCount = r?.order && (r.order.items_count !== undefined && r.order.items_count !== null) ? r.order.items_count : 0; + return batchTotal !== null ? batchTotal : itemCount; + }, + // 商品总数量(order.items_total,缺省按 items 求和) + orderItemsTotal() { + const r = this.orderQueryResult; + const total = r?.order && (r.order.items_total !== undefined && r.order.items_total !== null) ? r.order.items_total : null; + if (total !== null) return total; + if (Array.isArray(r?.items)) { + return r.items.reduce((sum, it) => sum + (Number(it.plan_qty) || 0), 0); + } + return 0; + }, + // 团购订单商品明细(查询结果 items) + groupItems() { + const r = this.orderQueryResult; + return (r && Array.isArray(r.items)) ? r.items : []; + }, + // 团购已核实商品数 + groupVerifiedCount() { + const items = this.groupItems; + let count = 0; + for (let i = 0; i < items.length; i++) { + if (this.isItemVerified(items[i], i)) count++; + } + return count; + }, + // 团购商品是否全部核实(无明细视为无需核实) + groupAllVerified() { + if (this.orderQueryIsSandan) return false; + const items = this.groupItems; + if (!items.length) return true; + return this.groupVerifiedCount >= items.length; + }, + // 团购核实扫描激活中:存在未核实的可扫商品(此时扫码=核实商品条码) + groupVerifyingActive() { + if (this.orderQueryIsSandan) return false; + const items = this.groupItems; + return !!this.orderQueryResult && items.length > 0 && this.groupVerifiedCount < items.length; + }, + // 输入框占位:团购核实时提示扫商品条码 + groupScanPlaceholder() { + return this.groupVerifyingActive ? '扫描商品条码核实' : '扫描/输入运单号查询'; } }, onLoad(options) { this.loadBound(options); + // 读取本地保存的已绑定操作员(bindMember 返回的成员行 id,按 workbenchId 匹配) + this.loadBoundOperator(); + // 进入打包模式:重新拉取工作台信息(同时校验本地工作台 token 是否仍有效) + if (this.bound) { + this.fetchWorkbenchInfo(); + } + // 注册广播扫码回调(操作员弹窗内枪扫工牌识别绑定用) + this.safeDispatchBroadcast('setCallbacks', { + onResult: this.handleBroadcastResult + }); + this.safeDispatchBroadcast('start'); + }, + onShow() { + this.safeDispatchBroadcast('setCallbacks', { + onResult: this.handleBroadcastResult + }); + this.safeDispatchBroadcast('resume'); + }, + onHide() { + this.safeDispatchBroadcast('pause'); + }, + onUnload() { + 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('[packMode] 语音播报失败:', error)); + } + } catch (error) { + console.warn('[packMode] 语音播报异常:', error); + } + }, + // 主界面扫码统一入口:无成员不可查询;团购核实时 → 扫商品条码核实;否则 → 按运单查询 + handleBarcodeInput(code) { + const c = String(code || '').trim(); + if (!c) return; + if (!String(this.boundOperator?.memberId || '').trim()) { + uni.showToast({ title: '请先绑定操作员再查询', icon: 'none' }); + return; + } + this.orderBarcode = c; + this.orderInputFocus = false; + if (this.groupVerifyingActive) { + this.handleGroupVerifyScan(c); + return; + } + this.queryOrder(c); + }, + // ===== 团购商品核实 ===== + groupItemKey(item, idx) { + return (item && item.id !== undefined && item.id !== null) ? ('id_' + item.id) : ('idx_' + idx); + }, + // 商品可扫条码列表(barcodes[].barcode / barcode / item_code) + groupItemCodes(item) { + if (!item) return []; + const out = []; + const codes = item.barcodes ?? item.barcode; + if (Array.isArray(codes)) { + codes.forEach((c) => { + if (!c) return; + if (typeof c === 'object') { + if (c.barcode) out.push(String(c.barcode)); + else if (c.code) out.push(String(c.code)); + } else { + out.push(String(c)); + } + }); + } else if (codes && typeof codes === 'object') { + if (codes.barcode) out.push(String(codes.barcode)); + else if (codes.code) out.push(String(codes.code)); + } else if (codes) { + out.push(String(codes)); + } + if (item.item_code) out.push(String(item.item_code)); + return out.map(s => String(s).trim()).filter(Boolean); + }, + groupItemScannable(item) { + return this.groupItemCodes(item).length > 0; + }, + isItemVerified(item, idx) { + const qty = Math.max(1, Number(item && item.plan_qty) || 1); + const key = this.groupItemKey(item, idx); + return (this.groupVerified[key] || 0) >= qty; + }, + // 长按复核:整件标记已核实(视为数量全部扫满) + markItemVerified(item, idx) { + const key = this.groupItemKey(item, idx); + if (this.isItemVerified(item, idx)) return; + const qty = Math.max(1, Number(item && item.plan_qty) || 1); + this.groupVerified = Object.assign({}, this.groupVerified, { [key]: qty }); + }, + // 扫描计数 +1:扫中商品条码一次记一次,返回是否刚好扫满(该商品已核实) + incrementVerified(item, idx) { + const key = this.groupItemKey(item, idx); + const qty = Math.max(1, Number(item && item.plan_qty) || 1); + const current = this.groupVerified[key] || 0; + if (current >= qty) return false; + const next = current + 1; + this.groupVerified = Object.assign({}, this.groupVerified, { [key]: next }); + return next >= qty; + }, + // 商品行核实状态文案:已核实 / 已扫x/y + itemVerifyText(item, idx) { + if (this.orderQueryIsSandan) return ''; + // 已核实:绿底即完成状态,不再显示文字标签;未核实显示已扫 x/y + if (this.isItemVerified(item, idx)) return ''; + const current = this.groupVerified[this.groupItemKey(item, idx)] || 0; + const qty = Math.max(1, Number(item && item.plan_qty) || 1); + return `${current}/${qty}`; + }, + // 扫描条码与订单信息条码比对:命中且该商品未扫满 → 计数+1;达到数量即标记已完成 + handleGroupVerifyScan(barcode) { + const code = String(barcode || '').trim(); + if (!code) return; + if (this.orderQueryIsSandan || !this.orderQueryResult) return; + const items = this.groupItems; + for (let i = 0; i < items.length; i++) { + const item = items[i]; + if (this.isItemVerified(item, i)) continue; + if (this.groupItemCodes(item).indexOf(code) !== -1) { + const name = String(item.item_name || '商品').trim(); + const done = this.incrementVerified(item, i); + const key = this.groupItemKey(item, i); + const current = this.groupVerified[key] || 0; + const qty = Math.max(1, Number(item.plan_qty) || 1); + if (done) { + this.speakText(`${name},已核实`); + uni.showToast({ title: `${name} 已核实`, icon: 'none' }); + } else { + // 数量未扫满:提示进度 + uni.showToast({ title: `${name} ${current}/${qty}`, icon: 'none' }); + } + return; + } + } + this.speakText('条码不匹配'); + uni.showToast({ title: '条码与待核实商品不匹配', icon: 'none' }); + }, + // 长按复核:团单任意未核实商品可通过“无条码复核”人工标记已核实 + handleGroupItemLongPress(item, idx) { + if (this.orderQueryIsSandan) return; + if (this.isItemVerified(item, idx)) return; + const name = String(item.item_name || '该商品').trim(); + uni.showModal({ + title: '无条码复核', + content: `确认已核实「${name}」?(无条码复核,人工确认)`, + confirmText: '确认', + cancelText: '取消', + success: (res) => { + if (!res.confirm) return; + this.markItemVerified(item, idx); + this.speakText(`${name},已核实`); + } + }); + }, + // 取消团购核实:放弃本次核实且不开始打包,回到查询态 + handleCancelGroupVerify() { + uni.showModal({ + title: '取消核实', + content: '确认取消本次核实?将放弃当前订单的商品核实,且不会开始打包。', + confirmText: '取消核实', + cancelText: '继续核实', + success: (res) => { + if (!res.confirm) return; + // 清除核实与当前订单结果,回到可扫描其它运单状态 + this.groupVerified = {}; + this.groupAutoSubmitted = false; + this.orderQueryState = ''; + this.orderQueryResult = null; + this.orderQueryError = ''; + this.orderBarcode = ''; + uni.showToast({ title: '已取消核实', icon: 'none' }); + } + }); + }, + // 团购全部商品核实后:提交开始打包(packOrder status=1)并语音 + async handleSubmitGroupPack() { + if (this.groupSubmitting || !this.groupAllVerified) return; + this.groupSubmitting = true; + try { + const ok = await this.reportPackOrder(); + if (ok) { + this.speakText('开始打包'); + } + } finally { + this.groupSubmitting = false; + } + }, + // 打开操作员弹窗:已绑定态展示操作员信息;未绑定态准备枪扫/输入工牌绑定 + handleUserInfo() { + 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; + } + }, + // 关闭操作员弹窗 + handleCloseUserDrawer() { + this.userDrawerOpen = false; + this.opInputFocus = false; + }, + // 广播扫码结果:操作员弹窗打开且未绑定 → 识别操作员;主界面(已绑定)→ 查询订单 + handleBroadcastResult(result) { + const scanText = this.normalizeScanResult(result); + console.log('[packMode] handleBroadcastResult 扫描结果:', scanText); + if (!scanText) return; + if (this.userDrawerOpen && !this.boundOperator.memberId) { + this.opScanCode = scanText; + this.opInputFocus = false; + this.queryOperatorUser(scanText); + return; + } + if (this.bound) { + this.handleBarcodeInput(scanText); + } + }, + // 订单查询输入框回车确认 + handleOrderQueryConfirm() { + const code = String(this.orderBarcode || '').trim(); + if (!code) { + uni.showToast({ title: '请输入/扫描运单号', icon: 'none' }); + return; + } + this.handleBarcodeInput(code); + }, + // 订单查询相机扫码 + handleOrderCameraScan() { + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode', 'barCode', 'datamatrix', 'pdf417'], + success: (res) => { + const code = String(res?.result || '').trim(); + if (!code) return; + this.handleBarcodeInput(code); + }, + fail: () => {} + }); + }, + // 按运单号条码查询订单(workbench.queryOrder) + async queryOrder(barcode) { + const code = String(barcode || '').trim(); + if (!code) return; + // 无成员(未绑定操作员)时不允许查询订单 + if (!String(this.boundOperator?.memberId || '').trim()) { + uni.showToast({ title: '请先绑定操作员再查询订单', icon: 'none' }); + return; + } + const token = String(this.workbenchToken || '').trim(); + if (!token) { + uni.showToast({ title: '工作台 token 缺失', icon: 'none' }); + return; + } + if (this.orderQuerying) return; + this.orderQuerying = true; + this.orderQueryState = 'loading'; + this.orderQueryResult = null; + this.orderQueryError = ''; + uni.showLoading({ title: '查询中...', mask: true }); + try { + // toastAfter=false:失败提示由本方法自行控制,避免拦截器重复弹 toast + const res = await this.$http('workbench.queryOrder', { token, barcode: code }, '', false); + const invalid = res?.flag === 'failure' || [0, 401, 403].indexOf(Number(res?.code)) !== -1; + if (invalid) { + this.orderQueryState = 'error'; + this.orderQueryError = res?.message || '查询失败,请重试'; + return; + } + const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res; + if (!data || typeof data !== 'object') { + this.orderQueryState = 'error'; + this.orderQueryError = '查询结果无效'; + return; + } + this.orderQueryResult = data; + this.orderQueryState = 'success'; + // 查询成功:清空输入框,方便连续扫描下一单 + this.orderBarcode = ''; + // 团购:初始化商品核实状态(不自动上报,全部核实后将自动提交开始打包) + this.groupVerified = {}; + this.groupAutoSubmitted = false; + // 兜底:无商品明细的团购单视为无需核实,直接自动提交开始打包 + if (!this.orderQueryIsSandan && this.groupAllVerified && !this.groupAutoSubmitted) { + this.groupAutoSubmitted = true; + this.handleSubmitGroupPack(); + } + if (this.orderQueryIsSandan) { + // 散单:扫描面单立即上报开始打包(等查询 loading 关闭后再发起) + setTimeout(() => { + this.reportPackOrder().then((ok) => { + if (ok) this.speakText('开始打包'); + }); + }, 0); + } + } catch (error) { + console.error('[packMode] 查询订单失败:', error); + this.orderQueryState = 'error'; + this.orderQueryError = error?.message || '查询失败,请重试'; + } finally { + uni.hideLoading(); + this.orderQuerying = false; + } + }, + // 商品明细首张图片(image_url 为数组或字符串时取首个非空) + orderItemImg(item) { + if (!item) return ''; + const url = item.image_url ?? item.imageUrl; + if (Array.isArray(url)) { + const first = url.find(u => u); + return String(first || ''); + } + return String(url || ''); + }, + // 商品明细条码(barcodes 数组取首项 barcode,或字符串直接返回) + orderItemBarcode(item) { + if (!item) return ''; + const codes = item.barcodes ?? item.barcode; + if (Array.isArray(codes)) { + const first = codes.find(c => c); + if (first && typeof first === 'object') return String(first.barcode || first.code || ''); + return String(first || ''); + } + if (codes && typeof codes === 'object') return String(codes.barcode || codes.code || ''); + return String(codes || ''); + }, + // 打包预检(上报 packOrder 前):散单拦截 → 未复核 → 已打包;命中则文字+语音提示并禁止打包 + packPrecheck() { + const r = this.orderQueryResult; + const order = r && r.order; + if (!order) return true; + // 1. 拦截:仅散单判断(团购不做拦截) + if (this.orderQueryIsSandan && Number(order.intercept_flag) === 1) { + this.speakText('订单已拦截,禁止打包'); + uni.showToast({ title: '订单已拦截,禁止打包', icon: 'none' }); + return false; + } + // 2. 未复核(recheck_status 非完成视为未复核,团散都判) + const recheck = String(order.recheck_status ?? '').trim().toLowerCase(); + const recheckDone = recheck === 'fin' || recheck === 'finished' || recheck === '1'; + if (!recheckDone) { + this.speakText('订单未复核,禁止打包'); + uni.showToast({ title: '订单未复核,禁止打包', icon: 'none' }); + return false; + } + // 3. 已打包:散单看 pack_flag=1;团购无 pack_flag 用 pack_status 非空/非 none + let packed = false; + if (this.orderQueryIsSandan) { + packed = Number(order.pack_flag) === 1 || order.pack_flag === true; + } else { + const ps = String(order.pack_status ?? '').trim().toLowerCase(); + packed = ps !== '' && ps !== 'none'; + } + if (packed) { + this.speakText('已打包'); + uni.showToast({ title: '已打包', icon: 'none' }); + return false; + } + return true; + }, + // 工作台打包上报(workbench.packOrder):基于最近一次查询结果,状态=1 打包中;成功返回 true + async reportPackOrder() { + const r = this.orderQueryResult; + if (!r) return false; + // 打包预检:订单未复核/拦截/已打包时提示并禁止开始打包 + if (!this.packPrecheck()) return false; + const token = String(this.workbenchToken || '').trim(); + if (!token) return false; + if (this.packReporting) return false; + + const deliveryOrderCode = String(r?.order?.delivery_order_code || '').trim(); + if (!deliveryOrderCode) { + uni.showToast({ title: '缺少发货单号,无法上报打包', icon: 'none' }); + return false; + } + // 打包人员:当前已绑定操作员 + const operator = this.boundOperator; + if (!operator || !String(operator.memberId || '').trim() || !String(operator.userName || '').trim()) { + uni.showToast({ title: '请先绑定操作员再上报打包', icon: 'none' }); + return false; + } + + this.packReporting = true; + uni.showLoading({ title: '打包上报中...', mask: true }); + try { + const payload = { + token, + delivery_order_code: deliveryOrderCode, + status: 1, // 打包中 + wave_total_orders: (r?.batch && r.batch.total_orders !== undefined && r.batch.total_orders !== null) + ? Number(r.batch.total_orders) + : 1, + users: [{ + wms_account_id: (operator.userId !== '' && operator.userId !== null && operator.userId !== undefined) ? Number(operator.userId) : null, + real_name: operator.userName + }] + }; + const waveNo = (r?.batch && r.batch.wave_no) ? String(r.batch.wave_no) : (r?.order && r.order.wave_no ? String(r.order.wave_no) : ''); + if (waveNo) payload.wave_no = waveNo; + const itemsCount = r?.order && r.order.items_count !== undefined && r.order.items_count !== null ? Number(r.order.items_count) : null; + if (itemsCount !== null) payload.items_count = itemsCount; + const itemsTotal = r?.order && r.order.items_total !== undefined && r.order.items_total !== null ? Number(r.order.items_total) : null; + if (itemsTotal !== null) payload.items_total = itemsTotal; + + // toastAfter=false:失败提示由本方法自行控制 + const res = await this.$http('workbench.packOrder', payload, '', false); + const invalid = res?.flag === 'failure' || [0, 400, 401, 403].indexOf(Number(res?.code)) !== -1; + if (invalid) { + uni.showToast({ title: res?.message || '打包上报失败', icon: 'none' }); + return false; + } + console.log('[packMode] 打包上报成功:', res?.data || res); + // 记录存在未结束打包任务:退出工作台/解绑操作员前将自动上报打包完成 + this.hasActivePack = true; + uni.showToast({ title: '已开始打包', icon: 'success' }); + return true; + } catch (error) { + console.error('[packMode] 打包上报失败:', error); + uni.showToast({ title: error?.message || '打包上报失败', icon: 'none' }); + return false; + } finally { + uni.hideLoading(); + this.packReporting = false; + } + }, + // 工作台打包完成请求(workbench.finishPack):结束该工作台最后一个未结束打包任务 + async requestFinishPack() { + const token = String(this.workbenchToken || '').trim(); + if (!token) return { ok: false, error: '工作台 token 缺失' }; + if (this.finishPacking) return { ok: false, busy: true }; + this.finishPacking = true; + try { + // toastAfter=false:失败提示由调用方自行控制 + const res = await this.$http('workbench.finishPack', { token }, '', false); + const invalid = res?.flag === 'failure' || [401, 403].indexOf(Number(res?.code)) !== -1; + if (invalid) { + return { ok: false, error: res?.message || '完成打包失败' }; + } + const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res; + const finished = !!(data && (data.finished === true || data.finished === 'true' || data.finished === 1)); + if (finished) { + this.hasActivePack = false; + } + return { + ok: true, + finished, + error: finished ? '' : (data?.message || '当前无进行中的打包任务') + }; + } catch (error) { + console.error('[packMode] 完成打包失败:', error); + return { ok: false, error: error?.message || '完成打包失败' }; + } finally { + this.finishPacking = false; + } + }, + // 退出/解绑前上报打包完成:存在进行中任务时先结束;失败不阻断后续 + async ensurePackFinishedBeforeLeave() { + if (!this.hasActivePack) return true; + const r = await this.requestFinishPack(); + if (!r.ok || !r.finished) { + console.warn('[packMode] 离开前上报打包完成未成功:', r); + return false; + } + return true; + }, + // 广播调用兜底(广播 store 未初始化/禁用时静默失败) + safeDispatchBroadcast(action, payload) { + try { + const task = this.$store.dispatch(`broadcast/${action}`, payload); + if (task && typeof task.catch === 'function') { + task.catch(error => { + console.warn(`[packMode] broadcast/${action} 调用失败:`, error); + }); + } + } catch (error) { + console.warn(`[packMode] broadcast/${action} 调用异常:`, error); + } + }, + // 归一化广播扫描结果文本 + normalizeScanResult(scanResult) { + if (!scanResult) return ''; + if (typeof scanResult === 'string') return String(scanResult).trim(); + if (typeof scanResult.result === 'string') return String(scanResult.result).trim(); + if (Array.isArray(scanResult.result)) { + const firstResult = scanResult.result.find(item => item); + if (typeof firstResult === 'string') return String(firstResult).trim(); + if (firstResult && typeof firstResult.data === 'string') return String(firstResult.data).trim(); + } + if (typeof scanResult.data === 'string') return String(scanResult.data).trim(); + return ''; + }, + // 读取本地保存的已绑定操作员(bindMember 返回的成员行 id,按 workbenchId 匹配) + loadBoundOperator() { + let saved = null + try { + saved = uni.getStorageSync('workbenchOperator') + } catch (e) {} + if (!saved || typeof saved !== 'object') saved = {} + const sameWorkbench = String(saved?.workbenchId || '') === String(this.workbenchId || '') + this.boundOperator = sameWorkbench + ? { + memberId: String(saved?.memberId || ''), + workbenchId: String(saved?.workbenchId || ''), + userId: (saved?.userId === null || saved?.userId === undefined || saved?.userId === '') ? '' : String(saved?.userId), + userName: String(saved?.userName || '') + } + : { memberId: '', workbenchId: String(this.workbenchId || ''), userId: '', userName: '' } + }, + // 操作员扫码输入框回车确认 + handleOpInputConfirm() { + const code = String(this.opScanCode || '').trim(); + if (!code) return; + // 识别成功后输入框回显的是姓名(非工牌码),避免把姓名当码再次查询 + if (this.opQueryState === 'identified' && this.opQueryResult && code === this.opQueryResult.name) { + return; + } + this.queryOperatorUser(code); + }, + // 操作员相机扫码 + handleOpCameraScan() { + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode', 'barCode', 'datamatrix', 'pdf417'], + success: (res) => { + const code = String(res?.result || '').trim(); + if (!code) return; + this.opScanCode = code; + this.opInputFocus = false; + this.queryOperatorUser(code); + }, + fail: () => {} + }); + }, + // 按 ye4s 登录临时码识别操作员(index.queryUserByToken),成功后进入待绑定态 + async queryOperatorUser(token) { + const t = String(token || '').trim(); + if (!t) return; + if (this.opQueryState === 'loading' || this.opBinding) return; + this.opQueryState = 'loading'; + this.opQueryResult = null; + this.opQueryError = ''; + uni.showLoading({ title: '识别中...', mask: true }); + try { + // toastAfter=false:失败提示由本方法自行控制,避免拦截器重复弹 toast + const res = await this.$http('index.queryUserByToken', { token: t }, '', false); + if (res?.flag === 'success' || Number(res?.code) === 200) { + const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res; + const name = String(data?.real_name ?? data?.realName ?? '').trim(); + if (!name) { + this.opQueryState = 'error'; + this.opQueryError = '未识别到操作员姓名'; + return; + } + const rawWmsId = data?.wms_account_id ?? data?.wmsAccountId; + this.opQueryResult = { + scanToken: t, + name, + wmsAccountId: (rawWmsId === null || rawWmsId === undefined || rawWmsId === '') ? null : Number(rawWmsId) + }; + this.opQueryState = 'identified'; + // 扫描/输入成功且识别到姓名:输入框直接回显姓名 + this.opScanCode = name; + this.opInputFocus = false; + } else { + const code = Number(res?.code); + const msg = String(res?.message || res?.msg || ''); + if (code === 404) { + this.opQueryError = '未找到对应用户'; + } else if (code === 400) { + this.opQueryError = 'token 不能为空'; + } else { + this.opQueryError = msg || '识别失败,请重试'; + } + this.opQueryState = 'error'; + } + } catch (error) { + console.error('[packMode] 识别操作员失败:', error); + this.opQueryState = 'error'; + this.opQueryError = error?.message || '识别失败,请重试'; + } finally { + uni.hideLoading(); + } + }, + // 绑定操作员到本工作台(workbench.bindMember) + async handleBindOperator() { + const ident = this.opQueryResult; + if (!ident) return; + const token = String(this.workbenchToken || '').trim(); + if (!token) { + uni.showToast({ title: '工作台 token 缺失', icon: 'none' }); + return; + } + if (this.opBinding) return; + this.opBinding = true; + uni.showLoading({ title: '绑定中...', mask: true }); + try { + const res = await this.$http('workbench.bindMember', { + userId: ident.wmsAccountId !== null && ident.wmsAccountId !== undefined ? ident.wmsAccountId : null, + userName: ident.name, + token + }); + const invalid = res?.flag === 'failure' || Number(res?.code) === 400 || Number(res?.code) === 403; + if (invalid) { + throw new Error(res?.message || '绑定操作员失败'); + } + const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res; + const memberId = data?.id ?? data?.member_id ?? data?.memberId; + if (memberId === null || memberId === undefined || memberId === '') { + throw new Error('绑定成功但未返回成员ID'); + } + // bindMember 返回后本地保存成员行 id(供 removeMember 使用),并展示为当前操作员 + this.boundOperator = { + memberId: String(memberId), + workbenchId: String(this.workbenchId || ''), + userId: ident.wmsAccountId !== null && ident.wmsAccountId !== undefined ? String(ident.wmsAccountId) : '', + userName: String(ident.name) + }; + uni.setStorageSync('workbenchOperator', this.boundOperator); + // 重置识别待绑定态并关闭弹窗(顶部按钮自动变为“已绑定”) + this.opScanCode = ''; + this.opQueryState = ''; + this.opQueryResult = null; + this.opQueryError = ''; + this.userDrawerOpen = false; + this.opInputFocus = false; + uni.showToast({ title: '操作员绑定成功', icon: 'success' }); + } catch (error) { + console.error('[packMode] 绑定操作员失败:', error); + uni.showToast({ title: error?.message || '绑定操作员失败', icon: 'none' }); + } finally { + uni.hideLoading(); + this.opBinding = false; + } + }, + // 移除操作员(workbench.removeMember):按本地保存的成员行 id 直接移除 + handleRemoveOperator() { + const memberId = String(this.boundOperator?.memberId || '').trim(); + if (!memberId) return; + this.doRemoveOperator(memberId); + }, + // 执行移除成员请求 + async doRemoveOperator(memberId) { + if (this.opRemoving) return; + const token = String(this.workbenchToken || '').trim(); + if (!token) { + uni.showToast({ title: '工作台 token 缺失', icon: 'none' }); + return; + } + this.opRemoving = true; + uni.showLoading({ title: '移除中...', mask: true }); + try { + // 成员解绑/登出前:若存在进行中的打包任务先上报打包完成(失败不阻断解绑) + await this.ensurePackFinishedBeforeLeave(); + const res = await this.$http('workbench.removeMember', { + ids: Number(memberId), + token + }); + const invalid = res?.flag === 'failure' || [400, 403, 404].indexOf(Number(res?.code)) !== -1; + if (invalid) { + throw new Error(res?.message || '移除操作员失败'); + } + // 清除本地记录,回到可重新绑定态 + this.boundOperator = { memberId: '', workbenchId: String(this.workbenchId || ''), userId: '', userName: '' }; + uni.setStorageSync('workbenchOperator', this.boundOperator); + this.opScanCode = ''; + this.opQueryState = ''; + this.opQueryResult = null; + this.opQueryError = ''; + // 操作员已移除:清空查询订单/团购核实列表数据,避免残留给下一位操作员 + this.orderBarcode = ''; + this.orderQueryState = ''; + this.orderQueryResult = null; + this.orderQueryError = ''; + this.groupVerified = {}; + this.groupAutoSubmitted = false; + uni.showToast({ title: '操作员已移除', icon: 'success' }); + } catch (error) { + console.error('[packMode] 移除操作员失败:', error); + uni.showToast({ title: error?.message || '移除操作员失败', icon: 'none' }); + } finally { + uni.hideLoading(); + this.opRemoving = false; + } + }, // 读取本地已绑定信息(wblc 免登录 / 绑定成功均写入 storage) loadBound(options) { const cached = uni.getStorageSync('workbenchInfo') || {}; @@ -102,19 +1076,86 @@ export default { this.workbenchType = String(cached?.type || ''); this.bound = !!this.workbenchToken; }, - // 彻底退出打包模式:清除工作台会话与登录态,回到完全未登录状态 - async handleBack() { + // 重新拉取工作台信息:进入打包模式时校验本地工作台 token 并刷新工作台信息 + async fetchWorkbenchInfo() { + const token = String(this.workbenchToken || '').trim(); + if (!token) return; + if (this.infoRefreshing) return; + this.infoRefreshing = true; + try { + const res = await this.$http('workbench.getWorkbenchInfo', { token }); + const invalid = res?.flag === 'failure' || Number(res?.code) === 400 || Number(res?.code) === 403; + if (invalid) { + console.warn('[packMode] 工作台 token 已失效,退出工作台模式:', res?.message || res?.code); + await this.exitWorkbench(true); + return; + } + const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') + ? res.data + : res; + if (!data || typeof data !== 'object') { + await this.exitWorkbench(true); + return; + } + const detail = { + id: data?.workbench_id ?? data?.workbenchId ?? data?.id ?? this.workbenchId, + name: String(data?.name || this.workbenchName), + warehouse_id: data?.warehouse_id ?? data?.warehouseId ?? '', + status: data?.status ?? '', + type: String(data?.type || ''), + remark: String(data?.remark || ''), + token + }; + // 刷新页面展示与本地缓存 + this.workbenchId = String(detail.id); + this.workbenchName = detail.name; + this.warehouseId = String(detail.warehouse_id ?? ''); + this.workbenchStatus = detail.status ?? ''; + this.workbenchType = detail.type; + uni.setStorageSync('workbenchInfo', detail); + console.log('[packMode] 工作台信息刷新成功:', detail); + } catch (error) { + // 网络/其它异常:保留本地缓存信息继续使用,仅提示,不清除会话 + console.warn('[packMode] 工作台信息刷新失败,沿用本地缓存:', error); + uni.showToast({ title: '工作台信息刷新失败', icon: 'none' }); + } finally { + this.infoRefreshing = false; + } + }, + // 退出工作台模式(用户主动):确认后清除工作台 token 并返回登录页 + handleBack() { + uni.showModal({ + title: '退出工作台模式', + content: '退出后将清除本地工作台登录记录,需要重新扫码(wblc 开头登录码)才能进入打包模式。', + confirmText: '退出', + cancelText: '取消', + success: async (res) => { + if (!res.confirm) return; + // 退出工作台前:若存在进行中的打包任务先上报打包完成 + await this.ensurePackFinishedBeforeLeave(); + await this.exitWorkbench(false); + } + }); + }, + // 清除工作台 token 并返回登录页:工作台会话(主 token 即工作台 token)时一并清除主登录态 + async exitWorkbench(withToast = false) { + const wbToken = String(uni.getStorageSync('workbenchToken') || '').trim(); + const mainToken = String(uni.getStorageSync('token') || '').trim(); uni.removeStorageSync('workbenchToken'); uni.removeStorageSync('workbenchInfo'); - // 标记:回到登录页后自动聚焦“工作台登录码”输入框,方便直接枪扫再次登录 - uni.setStorageSync('loginAutoFocusScan', 1); - try { - // logout 内部 clearSession(store) 会清除 token / isLogin / userInfo 等并跳回登录页 - await this.$store.dispatch('logout'); - } catch (error) { - console.warn('[packMode] 退出打包模式失败,兜底跳转登录页:', error); - uni.reLaunch({ url: '/pages/login/index' }); + if (withToast) { + uni.showToast({ title: '工作台登录已失效,请重新登录', icon: 'none' }); } + if (wbToken && mainToken === wbToken) { + try { + // logout 内部 clearSession(store) 会清除主 token / isLogin / userInfo 等并跳回登录页 + await this.$store.dispatch('logout'); + return; + } catch (error) { + console.warn('[packMode] 退出工作台模式失败,兜底跳转登录页:', error); + } + } + uni.reLaunch({ url: '/pages/login/index' }); } } } @@ -136,8 +1177,9 @@ export default { display: flex; align-items: center; justify-content: space-between; - height: 88rpx; - padding: 0 24rpx; + min-height: 144rpx; + padding: 16rpx 24rpx; + box-sizing: border-box; background: #ffffff; box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); } @@ -158,17 +1200,63 @@ export default { font-size: 34rpx; font-weight: 600; color: #303133; + line-height: 1.15; +} + +.header-center { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + flex: 1; + min-width: 0; +} + +.header-subtitle { + margin-top: 4rpx; + font-size: 34rpx; + color: #303133; + line-height: 1.25; + text-align: center; + word-break: break-all; + max-width: 100%; } .header-right { width: 260rpx; + display: flex; + align-items: center; + justify-content: flex-end; +} + +.user-info-btn { + display: flex; + align-items: center; + gap: 6rpx; + padding: 8rpx 16rpx; + border-radius: 8rpx; + background: #2979ff; + max-width: 248rpx; +} + +.user-info-btn--bound { + background: #18b566; +} + +.user-info-btn__text { + font-size: 34rpx; + color: #ffffff; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .content { - padding: 24rpx; + padding: 0 24rpx 24rpx; box-sizing: border-box; } +/* 已绑定态顶部工作台卡并入 header,以下旧样式不再使用 */ .state-card { background: #ffffff; border-radius: 20rpx; @@ -223,37 +1311,482 @@ export default { font-size: 24rpx; } -.placeholder-card { +/* ===== 查询订单 ===== */ +.order-query-card { margin-top: 24rpx; background: #ffffff; border-radius: 20rpx; - padding: 64rpx 40rpx; + padding: 28rpx; box-sizing: border-box; - display: flex; - flex-direction: column; - align-items: center; - gap: 20rpx; box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04); } -.placeholder-title { - margin-top: 8rpx; - font-size: 32rpx; - font-weight: 600; +.order-query__scan-row { + display: flex; + align-items: center; + gap: 8rpx; + background: #f5f6f7; + border: 2rpx solid #e4e7ed; + border-radius: 12rpx; + padding: 0 8rpx 0 20rpx; + box-sizing: border-box; +} + +.order-query__input { + flex: 1; + height: 88rpx; + font-size: 34rpx; color: #303133; } -.placeholder-desc { - font-size: 26rpx; - line-height: 1.7; +.order-query__loading { + margin-top: 24rpx; + padding: 24rpx 0; + display: flex; + justify-content: center; + align-items: center; +} + +.order-query__error { + margin-top: 24rpx; + background: #fef0f0; + border-radius: 16rpx; + padding: 24rpx 20rpx; + box-sizing: border-box; +} + +.order-query__error-text { + font-size: 34rpx; + color: #f56c6c; + text-align: center; + line-height: 1.5; +} + +.order-query__head { + margin-top: 24rpx; + display: flex; + align-items: center; + gap: 16rpx; + border-bottom: 1rpx solid #f0f0f0; + padding-bottom: 16rpx; +} + +.order-result-waybill { + flex: 1; + font-size: 34rpx; + font-weight: 600; + color: #303133; + word-break: break-all; +} + +.order-result-tag { + flex-shrink: 0; + padding: 6rpx 18rpx; + border-radius: 999rpx; + font-size: 28rpx; +} + +.order-result-tag--sandan { + background: #e8f8ef; + color: #18b566; +} + +.order-result-tag--tuangou { + background: #e8f0fe; + color: #2979ff; +} + +.order-summary { + margin-top: 20rpx; + background: #f8f9fb; + border-radius: 16rpx; + padding: 16rpx 20rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 8rpx; +} + +.order-summary__row { + display: flex; + align-items: center; + gap: 16rpx; +} + +.order-summary__label { + font-size: 30rpx; + color: #909399; + flex-shrink: 0; +} + +.order-summary__value { + flex: 1; + font-size: 34rpx; + font-weight: 600; + color: #303133; + word-break: break-all; + min-width: 0; +} + +.order-summary__extra { + flex-shrink: 0; + font-size: 30rpx; + color: #2979ff; +} + +.order-summary__num { + font-size: 36rpx; + font-weight: 600; + color: #2979ff; +} + +.order-block { + margin-top: 20rpx; + background: #f8f9fb; + border-radius: 16rpx; + padding: 20rpx; + box-sizing: border-box; +} + +.order-block__title { + font-size: 34rpx; + font-weight: 600; + color: #303133; + margin-bottom: 12rpx; +} + +.order-item { + display: flex; + align-items: center; + gap: 16rpx; + background: #ffffff; + border-radius: 12rpx; + padding: 16rpx; + margin-top: 12rpx; +} + +.order-item__img { + width: 96rpx; + height: 96rpx; + border-radius: 12rpx; + background: #f0f1f4; + flex-shrink: 0; +} + +.order-item__img--placeholder { + display: flex; + align-items: center; + justify-content: center; +} + +.order-item__info { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + gap: 6rpx; +} + +.order-item__name { + font-size: 34rpx; + font-weight: 600; + color: #303133; + word-break: break-all; +} + +.order-item__barcode { + font-size: 34rpx; + color: #909399; + word-break: break-all; +} + +.order-item__qty { + flex-shrink: 0; + font-size: 36rpx; + font-weight: 600; + color: #2979ff; +} + +.order-empty { + padding: 24rpx 0; + font-size: 30rpx; color: #909399; text-align: center; } +/* 团购商品核实区 */ +.group-verify { + margin-top: 20rpx; + background: #fffbea; + border-radius: 16rpx; + padding: 16rpx 20rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 12rpx; +} + +.group-verify__head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16rpx; +} + +.group-verify__head ::v-deep .u-button { + width: 128rpx !important; + height: 76rpx !important; + padding: 0 !important; + margin: 0 !important; + border-radius: 10rpx; +} + +.group-verify__head ::v-deep .u-button__text { + font-size: 26rpx !important; +} + +.group-verify__progress { + font-size: 30rpx; + font-weight: 600; + color: #2979ff; +} + +/* 商品行右侧:数量 + 核实状态 */ +.order-item__right { + flex-shrink: 0; + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 6rpx; +} + +.order-item__state { + font-size: 26rpx; + color: #c0c4cc; +} + +.order-item__state--done { + color: #18b566; +} + +.order-item--verified { + background: #43a047; +} + +.order-item--verified .order-item__name, +.order-item--verified .order-item__barcode, +.order-item--verified .order-item__qty, +.order-item--verified .order-item__state { + color: #ffffff; +} + +.order-item--verified .order-item__img { + background: rgba(255, 255, 255, 0.2); +} + +.order-item--verified .order-item__state { + font-weight: 600; +} + .action-area { margin-top: 48rpx; display: flex; flex-direction: column; gap: 20rpx; } + +.operator-line { + display: flex; + align-items: center; + gap: 14rpx; +} + +.operator-line__name { + font-size: 34rpx; + 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: 34rpx; +} + +.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: 34rpx; + color: #f56c6c; +} + +.operator-ident-card { + margin-top: 24rpx; + background: #f0f7ff; + border-radius: 16rpx; + padding: 20rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: stretch; + gap: 20rpx; +} + +/* ===== 操作员弹窗 ===== */ +.user-drawer { + width: 560rpx; + box-sizing: border-box; + background: #ffffff; + border-radius: 16rpx; + display: flex; + flex-direction: column; + max-height: 75vh; + overflow: hidden; +} + +.user-drawer__header { + padding: 48rpx 28rpx 16rpx; + flex-shrink: 0; +} + +.user-drawer__title { + font-size: 34rpx; + font-weight: 600; + color: #303133; + text-align: center; +} + +.user-drawer__body { + flex: 1; + min-height: 0; + padding: 20rpx 28rpx 40rpx; + box-sizing: border-box; + overflow-y: auto; +} + +.scan-section { + background: #f5f6f7; + border-radius: 16rpx; + padding: 20rpx; + box-sizing: border-box; +} + +.scan-row { + display: flex; + align-items: center; + gap: 8rpx; + background: #ffffff; + border: 2rpx solid #e4e7ed; + border-radius: 12rpx; + padding: 0 8rpx 0 20rpx; + box-sizing: border-box; +} + +.scan-input { + flex: 1; + height: 88rpx; + font-size: 34rpx; + color: #303133; +} + +.camera-btn { + width: 76rpx; + height: 76rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.scan-tip { + display: flex; + align-items: center; + gap: 8rpx; + margin-top: 16rpx; +} + +.scan-tip__text { + font-size: 24rpx; + color: #909399; +} + +.query-state { + margin-top: 32rpx; + padding: 48rpx 24rpx; + box-sizing: border-box; + display: flex; + flex-direction: column; + align-items: center; + gap: 16rpx; +} + +.query-state--loading { + min-height: 200rpx; + justify-content: center; +} + +.query-state--error { + background: #fef0f0; + border-radius: 16rpx; +} + +.query-state__error-text { + font-size: 34rpx; + color: #f56c6c; + text-align: center; + line-height: 1.5; +} + +.result-card { + margin-top: 32rpx; + background: #f0f7ff; + border-radius: 16rpx; + padding: 12rpx 24rpx; + box-sizing: border-box; +} + +.result-row { + display: flex; + justify-content: space-between; + align-items: center; + padding: 22rpx 0; + gap: 20rpx; +} + +.result-label { + font-size: 28rpx; + color: #909399; + flex-shrink: 0; +} + +.result-value { + font-size: 28rpx; + font-weight: 600; + color: #303133; + word-break: break-all; + text-align: right; +} + +.result-divider { + height: 1rpx; + background: #e4e7ed; +}