WMS_PDA/pages/packing/packMode.vue
2026-09-11 18:23:42 +08:00

2400 lines
74 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="pack-mode-page">
<!-- 顶部栏 -->
<view class="top-bar">
<view class="status-bar"></view>
<view class="header">
<view class="header-left" @click="handleBack">
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
<text class="header-left__text">退出</text>
</view>
<view class="header-center">
<text class="header-title">打包模式</text>
<text v-if="bound && workbenchName" class="header-subtitle">{{ workbenchName }}</text>
</view>
<view class="header-right">
<view class="user-info-btn" :class="{ 'user-info-btn--bound': boundOperator.memberId }" @click="handleUserInfo">
<u-icon name="account-fill" size="34rpx" color="#ffffff"></u-icon>
<text class="user-info-btn__text">{{ boundOperator.memberId ? (boundOperator.userName || '已绑定') : '未绑定' }}</text>
</view>
</view>
</view>
</view>
<view class="content">
<!-- ============ 已绑定态 ============ -->
<template v-if="bound">
<!-- 订单查询 -->
<view class="order-query-card">
<view class="order-query__scan-line">
<view class="order-query__scan-row">
<input
class="order-query__input"
v-model="orderBarcode"
:focus="orderInputFocus"
placeholder="扫描/输入运单号查询"
placeholder-style="color:#c0c4cc;font-size:34rpx"
@confirm="handleOrderQueryConfirm"
/>
<view class="camera-btn" @click="handleOrderCameraScan">
<u-icon name="scan" size="36rpx" color="#2979ff"></u-icon>
</view>
</view>
<template v-if="orderQueryState === 'success' && orderQueryResult && !orderQueryIsSandan">
<u-button
v-if="groupVerifyingActive && groupItems.length > 0 && !orderBlocked"
text="取消核实"
type="error"
@click="handleCancelGroupVerify"
></u-button>
</template>
</view>
<!-- 查询中 -->
<view v-if="orderQueryState === 'loading'" class="order-query__loading">
<u-loading-icon text="查询中..." color="#2979ff"></u-loading-icon>
</view>
<!-- 查询失败 -->
<view v-else-if="orderQueryState === 'error'" class="order-query__error">
<text class="order-query__error-text">{{ orderQueryError || '查询失败,请重试' }}</text>
</view>
<!-- 查询成功 -->
<template v-else-if="orderQueryState === 'success' && orderQueryResult">
<!-- 头部:运单号 + 类型(仅团购显示;散单运单号在概要行展示) -->
<view v-if="!orderQueryIsSandan" class="order-query__head">
<text class="order-result-waybill">{{ orderQueryResult.waybill_code || orderQueryResult.barcode || '--' }}</text>
<text class="order-result-tag order-result-tag--tuangou">团购</text>
<text class="order-verify-progress">已扫{{ groupVerifiedCount }}/{{ groupItems.length }}种</text>
</view>
<!-- 精简概要:波次(散单显示运单) 共x单 / 包材名称 商品总数量 -->
<view class="order-summary">
<view class="order-summary__row">
<text class="order-summary__label">{{ orderQueryIsSandan ? '运单' : '波次' }}</text>
<text class="order-summary__value order-summary__value--strong">{{ orderQueryIsSandan ? orderWaybillNo : orderWaveNo }}</text>
<text v-if="orderQueryIsSandan" class="order-result-tag order-result-tag--sandan order-summary__tag">散单</text>
<text v-if="!orderQueryIsSandan" class="order-summary__extra">共 <text class="order-summary__num">{{ orderWaveTotal }}</text> 单</text>
</view>
<view v-if="orderQueryResult.store_remark" class="order-summary__row">
<text class="order-summary__label">货主</text>
<text class="order-summary__value">{{ orderQueryResult.store_remark }}</text>
</view>
<view class="order-summary__row">
<text class="order-summary__label">包材</text>
<text class="order-summary__value">{{ packageMaterialName || '--' }}</text>
<text class="order-summary__extra">商品总数 <text class="order-summary__num">{{ orderItemsTotal }}</text></text>
</view>
</view>
<!-- 商品明细:数量 + 图片 + 名称 + 条码(拦截/未复核/已打包时不显示) -->
<view v-if="!orderBlocked" class="order-block">
<template v-if="orderQueryResult.items && orderQueryResult.items.length">
<view
v-for="(item, idx) in orderQueryResult.items"
:key="item.id || idx"
class="order-item"
:class="{ 'order-item--verified': !orderQueryIsSandan && isItemVerified(item, idx) }"
@longpress="handleGroupItemLongPress(item, idx)"
>
<view class="order-item__top">
<view class="order-item__qty-group">
<view class="order-item__qty-item">
<text class="order-item__label">数量</text>
<text class="order-item__value">{{ item.plan_qty }}</text>
</view>
</view>
<view class="order-item__image-wrap" @click="previewItemImage(item)">
<image
v-if="orderItemImg(item)"
class="order-item__image"
:src="orderItemImg(item)"
mode="aspectFill"
></image>
<view v-else class="order-item__image order-item__image--placeholder">
<u-icon name="photo" size="24" color="#c0c4cc"></u-icon>
</view>
<view v-if="orderItemImages(item).length > 1" class="order-item__image-count">+{{ orderItemImages(item).length - 1 }}</view>
</view>
</view>
<view class="order-item__bottom">
<text class="order-item__name">{{ item.item_name || '--' }}</text>
<text class="order-item__space">、</text>
<text class="order-item__barcode">{{ orderItemBarcode(item) || item.item_code || '--' }}</text>
</view>
</view>
</template>
<view v-else class="order-empty">无商品明细</view>
</view>
</template>
</view>
</template>
<!-- ============ 未绑定态:提示返回登录页 ============ -->
<template v-else>
<view class="state-card">
<view class="state-badge">
<u-icon name="info-circle" size="36rpx" color="#909399"></u-icon>
<text class="state-badge__text">未绑定工作台</text>
</view>
<view class="info-block">
<view class="info-row">
<text class="info-label">提示</text>
<text class="info-value">当前未绑定工作台,请返回登录页使用工作台登录码(wblc 开头)登录后进入打包模式。</text>
</view>
</view>
</view>
<view class="action-area action-area--col">
<u-button text="返回登录页" plain @click="handleBack"></u-button>
</view>
</template>
</view>
<!-- 操作员弹窗 -->
<u-popup
:show="userDrawerOpen"
mode="center"
round="16"
bgColor="#ffffff"
:closeable="true"
:z-index="10090"
@close="handleCloseUserDrawer"
>
<view class="user-drawer">
<view class="user-drawer__header">
<text class="user-drawer__title">操作员</text>
</view>
<view class="user-drawer__body">
<!-- 未绑定:扫码识别工牌 → 绑定 -->
<view class="scan-section">
<view class="scan-row">
<input
class="scan-input"
v-model="opScanCode"
:focus="opInputFocus"
placeholder="输入/扫描工牌绑定工作台"
placeholder-style="color:#c0c4cc;font-size:34rpx"
@confirm="handleOpInputConfirm"
/>
<view class="camera-btn" @click="handleOpCameraScan">
<u-icon name="scan" size="36rpx" color="#2979ff"></u-icon>
</view>
</view>
</view>
<view v-if="opQueryState === 'loading'" class="query-state query-state--loading">
<u-loading-icon text="识别中..." color="#2979ff"></u-loading-icon>
</view>
<view v-else-if="opQueryState === 'identified' && opQueryResult" class="operator-ident-card">
<u-button
text="绑定"
type="primary"
:loading="opBinding"
@click="handleBindOperator"
></u-button>
</view>
<view v-else-if="opQueryState === 'error'" class="query-state query-state--error">
<text class="query-state__error-text">{{ opQueryError || '识别失败,请重试' }}</text>
</view>
</view>
</view>
</u-popup>
<!-- 无条码复核弹窗(团单) -->
<u-popup
:show="noBarcodePopupOpen"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
:z-index="10095"
@close="handleCloseNoBarcodePopup"
>
<view class="no-barcode-popup">
<view class="no-barcode-popup__title">无条码复核</view>
<view class="no-barcode-popup__body">
<text class="no-barcode-popup__text">
将商品「{{ noBarcodeItem ? noBarcodeItem.name : '--' }}」标记为已核实({{ noBarcodeItem ? noBarcodeItem.current : 0 }}/{{ noBarcodeItem ? noBarcodeItem.qty : 0 }} → {{ noBarcodeItem ? noBarcodeItem.qty : 0 }}/{{ noBarcodeItem ? noBarcodeItem.qty : 0 }})?
</text>
</view>
<view class="no-barcode-popup__actions">
<view class="no-barcode-popup__btn no-barcode-popup__btn--cancel" @click="handleCloseNoBarcodePopup">取消</view>
<view class="no-barcode-popup__btn no-barcode-popup__btn--confirm" @click="confirmNoBarcodeReview">确定</view>
</view>
</view>
</u-popup>
<!-- 取消核实弹窗(团单) -->
<u-popup
:show="cancelVerifyPopupOpen"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
:z-index="10095"
@close="handleCloseCancelVerifyPopup"
>
<view class="cancel-verify-popup">
<view class="cancel-verify-popup__title">取消核实</view>
<view class="cancel-verify-popup__body">
<text class="cancel-verify-popup__text">确认取消本次核实?将放弃当前订单的商品核实,且不会开始打包。</text>
</view>
<view class="cancel-verify-popup__actions">
<view class="cancel-verify-popup__btn cancel-verify-popup__btn--cancel" @click="handleCloseCancelVerifyPopup">关闭</view>
<view class="cancel-verify-popup__btn cancel-verify-popup__btn--confirm" @click="confirmCancelVerify">确定</view>
</view>
</view>
</u-popup>
<!-- 退出工作台弹窗 -->
<u-popup
:show="exitPopupOpen"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
:z-index="10095"
@close="handleCloseExitPopup"
>
<view class="exit-popup">
<view class="exit-popup__title">退出工作台模式</view>
<view class="exit-popup__body">
<text class="exit-popup__text">退出后将清除本地工作台登录记录,需要重新扫码(wblc 开头登录码)才能进入打包模式。</text>
</view>
<view class="exit-popup__actions">
<view class="exit-popup__btn exit-popup__btn--cancel" @click="handleCloseExitPopup">取消</view>
<view class="exit-popup__btn exit-popup__btn--confirm" @click="confirmExit">退出</view>
</view>
</view>
</u-popup>
<!-- 移除操作员二次确认弹窗 -->
<u-popup
:show="removeOperatorPopupOpen"
mode="center"
:closeable="true"
:closeOnClickOverlay="false"
border-radius="20"
:z-index="10095"
@close="handleCloseRemoveOperatorPopup"
>
<view class="remove-operator-popup">
<view class="remove-operator-popup__title">移除操作员</view>
<view class="remove-operator-popup__body">
<text class="remove-operator-popup__text">确认移除操作员「{{ boundOperator.userName || '--' }}」?移除后需重新扫码绑定。</text>
</view>
<view class="remove-operator-popup__actions">
<view class="remove-operator-popup__btn remove-operator-popup__btn--cancel" @click="handleCloseRemoveOperatorPopup">取消</view>
<view class="remove-operator-popup__btn remove-operator-popup__btn--confirm" @click="confirmRemoveOperator">确定</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
export default {
data() {
return {
// 当前绑定
bound: false,
workbenchId: '',
workbenchName: '',
workbenchToken: '',
warehouseId: '',
workbenchStatus: '',
workbenchType: '',
infoRefreshing: false, // 进入后刷新工作台信息请求防重入锁
bcastHealTimer: null, // 广播监听自愈定时器(onShow 延迟重新注册用)
// 当前操作员(工作台成员,本地保存 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, // 团购全部核实后是否已自动提交开始打包
// 无条码复核弹窗(团单)
noBarcodePopupOpen: false,
noBarcodeItem: null, // { name, current, qty, item, idx }
// 取消核实弹窗(团单)
cancelVerifyPopupOpen: false,
// 退出工作台弹窗
exitPopupOpen: false,
// 移除操作员二次确认弹窗
removeOperatorPopupOpen: false
}
},
// 团购:全部商品核实完成后自动提交开始打包(每次查询仅自动提交一次)
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 '';
if (token.length <= 12) return token;
return `${token.substring(0, 6)}...${token.substring(token.length - 4)}`;
},
statusText() {
if (this.workbenchStatus === 0 || this.workbenchStatus === '0') return '禁用';
if (this.workbenchStatus === 1 || this.workbenchStatus === '1') return '启用';
return this.workbenchStatus === '' || this.workbenchStatus === null || typeof this.workbenchStatus === 'undefined' ? '--' : String(this.workbenchStatus);
},
typeText() {
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);
},
// 订单是否被禁止打包(拦截/未复核/已打包),命中时不显示商品明细
orderBlocked() {
const r = this.orderQueryResult;
const order = r && r.order;
if (!order) return false;
// 1. 拦截:仅散单判断
if (this.orderQueryIsSandan && Number(order.intercept_flag) === 1) {
return true;
}
// 2. 未复核(团散都判)
const recheck = String(order.recheck_status ?? '').trim().toLowerCase();
const recheckDone = recheck === 'fin' || recheck === 'finished' || recheck === '1';
if (!recheckDone) {
return true;
}
// 3. 已打包:散单看 pack_flag;团购看 pack_status
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';
}
return packed;
},
// 精简概要:包材名称(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();
},
// 运单号(waybill_code 优先,兜底 barcode)——散单概要行显示用
orderWaybillNo() {
const r = this.orderQueryResult;
const waybill = r?.waybill_code ? String(r.waybill_code) : '';
const barcode = r?.barcode ? String(r.barcode) : '';
return waybill || barcode || '--';
},
// 波次号(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;
},
// 团购总已扫件数(所有商品已扫次数之和,单件不超过 plan_qty)
groupScannedTotal() {
const items = this.groupItems;
let sum = 0;
for (let i = 0; i < items.length; i++) {
const qty = Math.max(1, Number(items[i] && items[i].plan_qty) || 1);
const current = this.groupVerified[this.groupItemKey(items[i], i)] || 0;
sum += Math.min(current, qty);
}
return sum;
},
// 团购商品是否全部核实(无明细视为无需核实)
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;
// 被禁止打包(拦截/未复核/已打包)时不激活核实,扫描走运单查询
if (this.orderBlocked) return false;
const items = this.groupItems;
return !!this.orderQueryResult && items.length > 0 && this.groupVerifiedCount < items.length;
},
// 输入框占位:团购核实时提示扫商品条码
groupScanPlaceholder() {
return (this.groupVerifyingActive && !this.orderBlocked) ? '扫描商品条码核实' : '扫描/输入运单号查询';
}
},
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');
// 诊断:确认接收器是否在监听
this.$store.dispatch('broadcast/getStatus').then((status) => {
console.log('[packMode][bcast] onShow 广播状态:', JSON.stringify(status));
});
// 自愈:reLaunch 进入本页时,登录页 onUnload 的 broadcast/stop 可能晚于本页 start,
// 把刚注册的接收器注销导致主页面扫码收不到广播(打开绑定弹窗时 resume 又恢复正常)。
// 延迟后强制重新注册一次,确保主页面连续扫码可用。
this.clearBcastHealTimer();
this.bcastHealTimer = setTimeout(() => {
this.$store.dispatch('broadcast/getStatus').then((status) => {
const listening = !!(status && status.isListening);
if (!listening) {
console.warn('[packMode][bcast] 广播未在监听,延迟重启接收器');
this.safeDispatchBroadcast('start');
} else {
// 状态显示在监听,但 reLaunch 竞态可能已把接收器注销而标志仍为真,强制重新注册一次
console.log('[packMode][bcast] 延迟自愈:重新注册广播接收器');
this.safeDispatchBroadcast('resume');
}
});
}, 1200);
},
onHide() {
this.clearBcastHealTimer();
this.safeDispatchBroadcast('pause');
},
onUnload() {
this.clearBcastHealTimer();
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);
}
},
// 清理广播自愈定时器(页面隐藏/卸载时避免残留定时器误注册广播)
clearBcastHealTimer() {
if (this.bcastHealTimer) {
clearTimeout(this.bcastHealTimer);
this.bcastHealTimer = null;
}
},
// 主界面扫码统一入口:未绑定操作员 → 识别并自动绑定;团购核实时 → 扫商品条码核实;否则 → 按运单查询
handleBarcodeInput(code) {
const c = String(code || '').replace(/\s+/g, '');
if (!c) return;
if (!String(this.boundOperator?.memberId || '').trim()) {
// 未绑定操作员:输入/扫描值走绑定操作员流程(识别工牌 → 自动绑定,识别失败由 queryOperatorUser 提示)
this.opScanCode = c;
this.opInputFocus = false;
this.orderBarcode = ''; // 清空订单输入框,避免残留工牌码,便于连续操作
this.queryOperatorUser(c);
return;
}
this.orderBarcode = c;
this.orderInputFocus = false;
if (this.groupVerifyingActive && !this.orderBlocked) {
// 团单尚未开始核实时(groupVerifiedCount === 0):扫描其它团购面单直接查询新订单(不弹窗)
if (this.groupVerifiedCount === 0) {
this.resetOrderQuery();
this.queryOrder(c);
return;
}
// 团单核实中:扫描内容按商品条码核实(匹配商品明细条码)
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}`;
},
// 商品行已扫数:已核实返回 plan_qty,否则返回当前已扫次数
groupItemScanned(item, idx) {
const qty = Math.max(1, Number(item && item.plan_qty) || 1);
const current = this.groupVerified[this.groupItemKey(item, idx)] || 0;
return Math.min(current, qty);
},
// 扫描条码与订单信息条码比对:命中一次即标记该商品已完成(数量一次扫满)
// 返回 true=命中商品条码已核实;false=未命中(供调用方判断是否切换面单)
handleGroupVerifyScan(barcode) {
const code = String(barcode || '').trim();
if (!code) return false;
if (this.orderQueryIsSandan || !this.orderQueryResult) return false;
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();
// 团单:条码比对命中一次即标记该商品已完成(数量一次扫满)
this.markItemVerified(item, i);
this.speakText('数据一致');
uni.showToast({ title: `${name} 已核实`, icon: 'none' });
return true;
}
}
this.speakText('无记录');
uni.showToast({ title: '条码与待核实商品不匹配', icon: 'none' });
return false;
},
// 清空当前订单查询与团购核实状态(不打包,回到可查询新面单状态)
resetOrderQuery() {
this.groupVerified = {};
this.groupAutoSubmitted = false;
this.orderQueryState = '';
this.orderQueryResult = null;
this.orderQueryError = '';
this.orderBarcode = '';
},
// 长按复核:团单任意未核实商品可通过“无条码复核”人工标记已核实
handleGroupItemLongPress(item, idx) {
if (this.orderQueryIsSandan) return;
if (this.isItemVerified(item, idx)) return;
const name = String(item.item_name || '该商品').trim();
const qty = Math.max(1, Number(item.plan_qty) || 1);
const current = this.groupVerified[this.groupItemKey(item, idx)] || 0;
this.noBarcodeItem = { name, current, qty, item, idx };
this.noBarcodePopupOpen = true;
},
// 无条码复核:确认标记已核实
confirmNoBarcodeReview() {
const info = this.noBarcodeItem;
if (!info) return;
this.markItemVerified(info.item, info.idx);
this.speakText('数据一致');
this.noBarcodePopupOpen = false;
// 延迟清空,避免关闭动画期间文案闪变
setTimeout(() => {
this.noBarcodeItem = null;
}, 300);
},
// 关闭无条码复核弹窗
handleCloseNoBarcodePopup() {
this.noBarcodePopupOpen = false;
// 延迟清空,避免关闭动画期间文案闪变为占位符
setTimeout(() => {
this.noBarcodeItem = null;
}, 300);
},
// 取消团购核实:打开取消核实弹窗
handleCancelGroupVerify() {
this.cancelVerifyPopupOpen = true;
},
// 确认取消核实
confirmCancelVerify() {
this.cancelVerifyPopupOpen = false;
// 清除核实与当前订单结果,回到可扫描其它运单状态
this.groupVerified = {};
this.groupAutoSubmitted = false;
this.orderQueryState = '';
this.orderQueryResult = null;
this.orderQueryError = '';
this.orderBarcode = '';
uni.showToast({ title: '已取消核实', icon: 'none' });
this.speakText('已取消核实');
},
// 关闭取消核实弹窗(继续核实)
handleCloseCancelVerifyPopup() {
this.cancelVerifyPopupOpen = false;
},
// 团购全部商品核实后:提交开始打包(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() {
// 已绑定:简化操作,直接弹移除操作员二次确认弹窗
if (this.boundOperator.memberId) {
this.handleRemoveOperator();
return;
}
// 未绑定:打开操作员弹窗
this.userDrawerOpen = true;
// 确保广播监听(从其它页面返回时可能已 pause),未绑定时扫码即识别绑定
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('resume');
// 重置识别待绑定态并聚焦输入框,便于扫码枪/键盘输入
this.opScanCode = '';
this.opQueryState = '';
this.opQueryResult = null;
this.opQueryError = '';
this.$nextTick(() => {
setTimeout(() => {
this.opInputFocus = true;
}, 300);
});
},
// 关闭操作员弹窗
handleCloseUserDrawer() {
this.userDrawerOpen = false;
this.opInputFocus = false;
},
// 广播扫码结果:未绑定操作员 → 识别并自动绑定;已绑定 → 查询订单
handleBroadcastResult(result) {
// 打印广播扫描原始数据,便于排查枪扫/广播数据格式
console.log('[packMode] 广播扫描原始数据:', result);
const scanText = this.normalizeScanResult(result);
console.log('[packMode] handleBroadcastResult 扫描结果:', scanText);
if (!scanText) return;
if (this.bound && !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()) {
this.speakText('未绑定操作员');
uni.showToast({ title: '请先绑定操作员再查询订单', icon: 'none', duration: 4000 });
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) {
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(res?.code)) return;
this.orderQueryState = 'error';
this.orderQueryError = res?.message || '查询失败,请重试';
this.speakText('无记录');
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;
// 团购:查询后立即预检(未复核/已打包时提示并语音,商品明细已隐藏),命中则不进入核实流程
let precheckBlocked = false;
if (!this.orderQueryIsSandan) {
precheckBlocked = !this.packPrecheck();
}
// 兜底:无商品明细且未禁止打包的团购单视为无需核实,直接自动提交开始打包
if (!precheckBlocked && !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 || '');
},
// 商品明细图片列表(多图:image_url 数组 / images 数组;单图兜底 imageUrl)
orderItemImages(item) {
if (!item) return [];
let list = [];
const url = item.image_url ?? item.imageUrl;
if (Array.isArray(url)) {
list = url;
} else if (url) {
list = [url];
}
if (Array.isArray(item.images)) {
const imgs = item.images.map(u => String(u || '').trim()).filter(Boolean);
if (imgs.length) list = imgs;
}
return list.map(u => String(u || '').trim()).filter(Boolean);
},
// 点击商品图放大预览(支持多图切换)
previewItemImage(item) {
const images = this.orderItemImages(item);
if (!images.length) return;
const current = this.orderItemImg(item) || images[0];
uni.previewImage({
current,
urls: images
});
},
// 商品明细条码(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', duration: 3000 });
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', duration: 3000 });
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', duration: 3000 });
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) {
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(res?.code)) return false;
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) {
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(res?.code)) {
return { ok: false, expired: true, error: '工作台登录已失效' };
}
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) {
const clean = (v) => String(v || '').replace(/\s+/g, '');
if (!scanResult) return '';
if (typeof scanResult === 'string') return clean(scanResult);
if (typeof scanResult.result === 'string') return clean(scanResult.result);
if (Array.isArray(scanResult.result)) {
const firstResult = scanResult.result.find(item => item);
if (typeof firstResult === 'string') return clean(firstResult);
if (firstResult && typeof firstResult.data === 'string') return clean(firstResult.data);
}
if (typeof scanResult.data === 'string') return clean(scanResult.data);
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: () => {}
});
},
// 操作员识别失败统一提示(扫描值非有效工牌码时,提示先绑定操作员)
notifyOperatorIdentifyFailed() {
this.speakText('未绑定操作员');
uni.showToast({ title: '请先绑定操作员再查询订单', icon: 'none', duration: 4000 });
// 识别失败后重新拉起广播监听,确保主页面连续扫码仍能收到广播
this.safeDispatchBroadcast('resume');
},
// 按 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 = '未识别到操作员姓名';
this.notifyOperatorIdentifyFailed();
return;
}
const rawWmsId = data?.wms_account_id ?? data?.wmsAccountId;
this.opQueryResult = {
scanToken: t,
name,
wmsAccountId: (rawWmsId === null || rawWmsId === undefined || rawWmsId === '') ? null : Number(rawWmsId)
};
// 识别成功直接进入绑定流程(binding 态不展示绑定按钮,避免按钮一闪而过)
this.opQueryState = 'binding';
// 扫描/输入成功且识别到姓名:输入框直接回显姓名
this.opScanCode = name;
this.opInputFocus = false;
// 有效扫描值直接完成绑定(延迟到识别 loading 关闭后,避免与绑定 loading 冲突)
setTimeout(() => {
this.handleBindOperator();
}, 0);
} else {
const code = Number(res?.code);
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(code)) return;
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';
this.notifyOperatorIdentifyFailed();
}
} catch (error) {
console.error('[packMode] 识别操作员失败:', error);
this.opQueryState = 'error';
this.opQueryError = error?.message || '识别失败,请重试';
this.notifyOperatorIdentifyFailed();
} 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) {
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(res?.code)) return;
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' });
this.speakText('绑定成功');
} catch (error) {
console.error('[packMode] 绑定操作员失败:', error);
// 绑定失败:进入待绑定态,保留识别结果,展示「绑定」按钮供手动重试
this.opQueryState = 'identified';
uni.showToast({ title: error?.message || '绑定操作员失败,请点击绑定重试', icon: 'none' });
this.speakText('绑定失败,请点击绑定重试');
} finally {
uni.hideLoading();
this.opBinding = false;
}
},
// 移除操作员(workbench.removeMember):先弹二次确认,确认后按本地保存的成员行 id 移除
handleRemoveOperator() {
const memberId = String(this.boundOperator?.memberId || '').trim();
if (!memberId) return;
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 = {}) {
const silent = !!opts.silent;
if (this.opRemoving) return { ok: false, busy: true };
const token = String(this.workbenchToken || '').trim();
if (!token) {
if (!silent) uni.showToast({ title: '工作台 token 缺失', icon: 'none' });
return { ok: false, error: '工作台 token 缺失' };
}
this.opRemoving = true;
if (!silent) 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) {
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
if (this.handleWorkbenchAuthExpired(res?.code)) return { ok: false, expired: true };
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;
if (!silent) {
uni.showToast({ title: '操作员已移除', icon: 'success' });
this.speakText('移除成功');
}
return { ok: true };
} catch (error) {
console.error('[packMode] 移除操作员失败:', error);
if (!silent) {
uni.showToast({ title: error?.message || '移除操作员失败', icon: 'none' });
this.speakText('移除失败');
}
return { ok: false, error: error?.message };
} finally {
if (!silent) uni.hideLoading();
this.opRemoving = false;
}
},
// 读取本地已绑定信息(wblc 免登录 / 绑定成功均写入 storage)
loadBound(options) {
const cached = uni.getStorageSync('workbenchInfo') || {};
// 优先使用 storage 中的原始信息(UTF-8),避免真机上 URL 中文参数乱码
this.workbenchId = String(cached?.id || options?.workbenchId || '');
this.workbenchName = String(cached?.name || options?.workbenchName || '');
this.workbenchToken = String(cached?.token || uni.getStorageSync('workbenchToken') || '');
this.warehouseId = String(cached?.warehouse_id ?? cached?.warehouseId ?? '');
this.workbenchStatus = cached?.status ?? '';
this.workbenchType = String(cached?.type || '');
this.bound = !!this.workbenchToken;
},
// 重新拉取工作台信息:进入打包模式时校验本地工作台 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;
}
},
// 退出工作台模式(用户主动):打开退出确认弹窗
handleBack() {
this.exitPopupOpen = true;
},
// 确认退出工作台
async confirmExit() {
this.exitPopupOpen = false;
// 退出工作台前:若存在进行中的打包任务先上报打包完成
await this.ensurePackFinishedBeforeLeave();
// 退出工作台 = 同时解绑操作员:操作员已绑定时先静默解绑(不弹提示,随后统一退出)
const memberId = String(this.boundOperator?.memberId || '').trim();
if (memberId && String(this.workbenchToken || '').trim()) {
const unbind = await this.doRemoveOperator(memberId, { silent: true });
// 401 已由 handleWorkbenchAuthExpired 处理退出并回登录页,无需重复退出
if (unbind && unbind.expired) return;
}
await this.exitWorkbench(false);
},
// 关闭退出弹窗
handleCloseExitPopup() {
this.exitPopupOpen = 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.removeStorageSync('workbenchOperator');
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' });
},
// 业务请求返回 401(工作台 token 失效):退出工作台模式、清除 token 并回登录页;返回 true 表示已处理退出
handleWorkbenchAuthExpired(code) {
if (Number(code) === 401) {
this.exitWorkbench(true);
return true;
}
return false;
}
}
}
</script>
<style lang="scss" scoped>
.pack-mode-page {
width: 100vw;
height: 100vh;
background: #f5f6f7;
box-sizing: border-box;
overflow: hidden;
}
.top-bar {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
z-index: 999;
background: #ffffff;
}
.status-bar {
height: var(--status-bar-height, 0px);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 144rpx;
padding: 16rpx 24rpx;
box-sizing: border-box;
background: #ffffff;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);
}
.header-left {
display: flex;
align-items: center;
width: 260rpx;
}
.header-left__text {
margin-left: 8rpx;
font-size: 34rpx;
color: #606266;
}
.header-title {
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: 0 12rpx 24rpx;
box-sizing: border-box;
height: calc(100vh - var(--status-bar-height, 0px) - 144rpx);
margin-top: calc(var(--status-bar-height, 0px) + 144rpx);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* 已绑定态顶部工作台卡并入 header,以下旧样式不再使用 */
.state-card {
background: #ffffff;
border-radius: 20rpx;
padding: 32rpx 28rpx;
box-sizing: border-box;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
}
.state-badge {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 24rpx;
}
.state-badge__text {
font-size: 36rpx;
font-weight: 600;
color: #303133;
}
.info-block {
display: flex;
flex-direction: column;
gap: 20rpx;
border-top: 1rpx solid #f0f0f0;
padding-top: 24rpx;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20rpx;
}
.info-label {
font-size: 26rpx;
color: #909399;
flex-shrink: 0;
}
.info-value {
font-size: 26rpx;
color: #303133;
text-align: right;
word-break: break-all;
}
.info-value--mono {
font-family: monospace;
font-size: 24rpx;
}
/* ===== 查询订单 ===== */
.order-query-card {
margin-top: 16rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 16rpx 12rpx;
box-sizing: border-box;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
overflow: hidden;
}
.order-query__scan-line {
display: flex;
align-items: center;
gap: 12rpx;
flex-shrink: 0;
}
.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;
height: 64rpx;
flex: 1;
min-width: 0;
}
.order-query__scan-row .camera-btn {
width: 52rpx;
height: 52rpx;
flex-shrink: 0;
}
.order-query__input {
flex: 1;
height: 60rpx;
font-size: 34rpx;
color: #303133;
}
.order-query__loading {
margin-top: 16rpx;
padding: 16rpx 0;
display: flex;
justify-content: center;
align-items: center;
}
.order-query__error {
margin-top: 16rpx;
background: #fef0f0;
border-radius: 16rpx;
padding: 16rpx 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: 8rpx;
display: flex;
align-items: center;
gap: 16rpx;
border-bottom: 1rpx solid #f0f0f0;
padding-bottom: 8rpx;
flex-shrink: 0;
}
.order-result-waybill {
flex: 1;
font-size: 34rpx;
font-weight: bold;
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: transparent;
color: #303133;
font-size: 30rpx;
font-weight: 600;
}
.order-result-tag--tuangou {
background: transparent;
color: #303133;
font-size: 30rpx;
font-weight: 600;
}
.order-summary {
margin-top: 12rpx;
background: #f8f9fb;
border-radius: 16rpx;
padding: 12rpx 16rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 6rpx;
flex-shrink: 0;
}
.order-summary__row {
display: flex;
align-items: center;
}
.order-summary__label {
font-size: 30rpx;
color: #909399;
flex-shrink: 0;
margin-right: 20rpx;
}
.order-summary__value {
flex: 1;
font-size: 34rpx;
font-weight: bold;
color: #303133;
word-break: break-all;
min-width: 0;
}
.order-summary__value--strong {
font-size: 38rpx;
}
.order-summary__extra {
flex-shrink: 0;
font-size: 30rpx;
color: #2979ff;
margin-left: 20rpx;
}
.order-summary__tag {
margin-left: 16rpx;
}
.order-summary__num {
font-size: 36rpx;
font-weight: bold;
color: #2979ff;
}
.order-block {
margin-top: 12rpx;
background: #f8f9fb;
border-radius: 16rpx;
padding: 16rpx;
box-sizing: border-box;
flex: 1;
min-height: 0;
overflow-y: auto;
}
.order-block__title {
font-size: 26rpx;
font-weight: normal;
color: #303133;
margin-bottom: 8rpx;
}
.order-item {
background: #ffffff;
border: 1rpx solid #000000;
border-radius: 10rpx;
margin-top: 12rpx;
overflow: hidden;
}
.order-item__top {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.order-item__qty-group {
display: flex;
flex-direction: row;
flex: 1;
min-width: 0;
border-bottom: 1rpx solid #000000;
}
.order-item__qty-item {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
padding: 16rpx 0 8rpx 16rpx;
}
.order-item__qty-item:not(:last-child) {
border-right: 1rpx solid #000000;
}
.order-item__label {
font-size: 30rpx;
color: #000000;
flex-shrink: 0;
width: 80rpx;
text-align: left;
line-height: 1.6;
}
.order-item__value {
font-size: 46rpx;
color: #000000;
font-weight: 500;
flex: 1;
text-align: center;
padding: 0 10rpx;
}
.order-item__value--done {
color: #07c160;
font-weight: 600;
}
.order-item__image-wrap {
flex-shrink: 0;
margin-left: 16rpx;
padding: 4rpx 16rpx 0 0;
position: relative;
}
.order-item__image-count {
position: absolute;
right: 20rpx;
bottom: 4rpx;
background: rgba(0, 0, 0, 0.55);
color: #ffffff;
font-size: 22rpx;
line-height: 1.4;
padding: 2rpx 10rpx;
border-radius: 999rpx;
}
.order-item__image {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
background: #f2f3f5;
}
.order-item__image--placeholder {
display: flex;
align-items: center;
justify-content: center;
}
.order-item__bottom {
padding: 4rpx 16rpx 16rpx;
line-height: 1.5;
}
.order-item__name {
font-size: 40rpx;
color: #000000;
font-weight: 500;
line-height: 1.5;
word-break: break-all;
}
.order-item__space {
font-size: 40rpx;
color: #000000;
line-height: 1.5;
}
.order-item__barcode {
font-size: 40rpx;
color: #000000;
line-height: 1.5;
word-break: break-all;
}
.order-empty {
padding: 24rpx 0;
font-size: 30rpx;
color: #909399;
text-align: center;
}
/* 团购商品核实区 */
.group-verify {
margin-top: 12rpx;
background: #fffbea;
border-radius: 16rpx;
padding: 12rpx 16rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 8rpx;
}
.group-verify__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16rpx;
}
.order-query__scan-line ::v-deep .u-button {
width: 120rpx !important;
height: 48rpx !important;
padding: 0 !important;
margin: 0 !important;
border-radius: 10rpx;
flex-shrink: 0;
}
.order-query__scan-line ::v-deep .u-button__text {
font-size: 24rpx !important;
}
.order-verify-progress {
flex-shrink: 0;
font-size: 30rpx;
font-weight: 600;
color: #303133;
}
.group-verify__progress {
font-size: 30rpx;
font-weight: 600;
color: #2979ff;
}
/* 团购已核实:绿色高亮(参考订单复核 matched) */
.order-item--verified {
background: #07c160;
}
.order-item--verified .order-item__label,
.order-item--verified .order-item__value,
.order-item--verified .order-item__name,
.order-item--verified .order-item__space,
.order-item--verified .order-item__barcode {
color: #ffffff;
}
.action-area {
margin-top: 48rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
}
.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;
text-align: center;
}
.user-drawer__title {
display: block;
font-size: 42rpx;
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: 36rpx;
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: 36rpx;
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;
}
/* 无条码复核弹窗 */
.no-barcode-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.no-barcode-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.no-barcode-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #f8f9fa;
border-radius: 12rpx;
}
.no-barcode-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.no-barcode-popup__actions {
display: flex;
align-items: center;
}
.no-barcode-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.no-barcode-popup__btn:not(:last-child) {
margin-right: 20rpx;
}
.no-barcode-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.no-barcode-popup__btn--confirm {
background: #2979ff;
color: #ffffff;
}
/* 取消核实弹窗(参考无条码复核弹窗) */
.cancel-verify-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.cancel-verify-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.cancel-verify-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #f8f9fa;
border-radius: 12rpx;
}
.cancel-verify-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.cancel-verify-popup__actions {
display: flex;
align-items: center;
}
.cancel-verify-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.cancel-verify-popup__btn:not(:last-child) {
margin-right: 20rpx;
}
.cancel-verify-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.cancel-verify-popup__btn--confirm {
background: #f56c6c;
color: #ffffff;
}
/* 退出工作台弹窗(参考取消核实弹窗) */
.exit-popup {
width: 640rpx;
padding: 40rpx 32rpx 32rpx;
background: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
}
.exit-popup__title {
font-size: 42rpx;
font-weight: 600;
color: #303133;
text-align: center;
margin-bottom: 32rpx;
}
.exit-popup__body {
margin-bottom: 36rpx;
padding: 24rpx;
background: #f8f9fa;
border-radius: 12rpx;
}
.exit-popup__text {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
}
.exit-popup__actions {
display: flex;
align-items: center;
}
.exit-popup__btn {
flex: 1;
height: 88rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
font-weight: 500;
}
.exit-popup__btn:not(:last-child) {
margin-right: 20rpx;
}
.exit-popup__btn--cancel {
background: #f5f7fa;
color: #606266;
border: 1rpx solid #dcdfe6;
}
.exit-popup__btn--confirm {
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;
}
</style>