- 拣货页:新增拣货要求横幅与弹窗展示,兼容 pick_mode 5 与 2/3/4 两种字段来源; 显示哪个商品即播报该商品拣货要求,去重串行、只播一次;弹窗样式优化 - 复核发货页:进入详情去重串行播报复核要求,「数据一致」排队到复核要求播报完成后; 复核要求字段优先取 recheck_requirements - 复核详情组件:「包装」改为「复核要求」,要求行改浅红底标签,字号调大; 「数据一致」改为事件上抛由父组件排队播报 - 打包模式页:新增打包要求标签展示与语音播报(去重串行、数据一致排队播报); 扫描重复跳过增加失败态豁免;重查失败恢复待重传状态;映射补充 packing_requirements
3954 lines
133 KiB
Vue
3954 lines
133 KiB
Vue
<template>
|
||
<view class="pack-mode-page">
|
||
<!-- 顶部栏 -->
|
||
<view class="top-bar">
|
||
<view class="status-bar"></view>
|
||
<view class="header">
|
||
<view class="header-left">
|
||
<view class="header-left__exit" @click="handleBack">
|
||
<u-icon name="arrow-left" size="36rpx" color="#303133"></u-icon>
|
||
</view>
|
||
<view class="today-pack-btn" @click="openTodayPackPanel">
|
||
<text class="today-pack-btn__text">今日打包</text>
|
||
</view>
|
||
</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': boundOperators.length }" @click="handleUserInfo">
|
||
<u-icon name="account-fill" size="34rpx" color="#ffffff"></u-icon>
|
||
<text class="user-info-btn__text">{{ topbarOperatorText }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="content">
|
||
<!-- ============ 已绑定态 ============ -->
|
||
<template v-if="bound">
|
||
<!-- 大团购打包时长闸门倒计时:packOrder 返回 wait_seconds/start_time 后展示,归零自动隐藏 -->
|
||
<view v-if="packWaitActive" class="pack-wait-bar">
|
||
<u-icon name="clock-fill" size="34rpx" color="#e6a23c"></u-icon>
|
||
<text class="pack-wait-bar__text">大团购打包倒计时</text>
|
||
<text class="pack-wait-bar__time">{{ packWaitText }}</text>
|
||
</view>
|
||
<!-- 订单查询 -->
|
||
<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="orderScanPlaceholder"
|
||
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 v-if="groupPackRetryReady" class="order-summary__row order-summary__row--retry">
|
||
<text class="order-summary__retry-text">打包上报失败,扫描商品条码或长按商品重新上报</text>
|
||
</view>
|
||
<view class="order-summary__row" :class="{ 'order-summary__row--blocked': orderBlocked }">
|
||
<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>
|
||
</view>
|
||
<view class="order-summary__row order-summary__stat-row">
|
||
<view class="order-summary__stat order-summary__stat--picker">
|
||
<text class="order-summary__stat-label order-summary__stat-label--picker">拣货</text>
|
||
<text class="order-summary__picker">{{ orderPickerName }}</text>
|
||
</view>
|
||
<view class="order-summary__stat-group">
|
||
<view class="order-summary__stat">
|
||
<text class="order-summary__stat-label">商品种类</text>
|
||
<text class="order-summary__num order-summary__num--green">{{ orderItemsKind }}</text>
|
||
</view>
|
||
<view class="order-summary__stat">
|
||
<text class="order-summary__stat-label">商品总数</text>
|
||
<text class="order-summary__num">{{ orderItemsTotal }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 商品明细:数量 + 图片 + 名称 + 条码(拦截/未复核/已打包时显示禁止打包提示) -->
|
||
<view v-if="orderBlocked" class="order-block order-block--blocked">
|
||
<view class="order-block__hint">{{ orderBlockedHint }}</view>
|
||
</view>
|
||
<view v-else 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 v-if="itemPackingRequirement(item)" class="order-item__requirement">
|
||
<text class="order-item__requirement-text">打包要求:{{ itemPackingRequirement(item) }}</text>
|
||
</view>
|
||
</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 v-if="workbenchMembers.length" class="member-section">
|
||
<view class="member-section__header">
|
||
<view class="member-select-all" @click="toggleSelectAllOffline">
|
||
<view class="member-checkbox" :class="{ 'member-checkbox--checked': allMembersSelected }">
|
||
<text v-if="allMembersSelected" class="member-checkbox__icon">✓</text>
|
||
</view>
|
||
<text class="member-section__title">在线操作员列表(支持勾选多人批量下线)</text>
|
||
</view>
|
||
<text class="member-section__count">{{ workbenchMembers.length }}人</text>
|
||
</view>
|
||
<scroll-view scroll-y class="member-list">
|
||
<view v-for="m in workbenchMembers" :key="m.id" class="member-item">
|
||
<view class="member-item__info" @click="toggleOfflineSelect(m)">
|
||
<view class="member-checkbox" :class="{ 'member-checkbox--checked': isMemberSelected(m) }">
|
||
<text v-if="isMemberSelected(m)" class="member-checkbox__icon">✓</text>
|
||
</view>
|
||
<text class="member-item__name">{{ m.user_name || '--' }}</text>
|
||
</view>
|
||
<view class="member-item__offline" @click="handleOfflineMember(m)">下线</view>
|
||
</view>
|
||
</scroll-view>
|
||
<view v-if="offlineSelectedIds.length" class="member-batch-bar">
|
||
<text class="member-batch-bar__text">已选 {{ offlineSelectedIds.length }} 人</text>
|
||
<view class="member-batch-bar__btn" @click="handleBatchOffline">批量下线</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 扫码识别工牌 → 绑定 / 追加新成员 -->
|
||
<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="retryPopupOpen"
|
||
mode="center"
|
||
:closeable="false"
|
||
:closeOnClickOverlay="false"
|
||
border-radius="20"
|
||
:z-index="10095"
|
||
>
|
||
<view class="retry-popup">
|
||
<view class="retry-popup__title">打包上报失败</view>
|
||
<view class="retry-popup__body">
|
||
<text class="retry-popup__text">{{ retryPopupText }}</text>
|
||
</view>
|
||
<view class="retry-popup__actions">
|
||
<view class="retry-popup__btn retry-popup__btn--cancel" @click="handleCloseRetryPopup">关闭</view>
|
||
<view class="retry-popup__btn retry-popup__btn--confirm" @click="handleRetryPackReport">
|
||
{{ retrySubmitting ? '重新上传中...' : '重新上传' }}
|
||
</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="offlinePopupOpen"
|
||
mode="center"
|
||
:closeable="true"
|
||
:closeOnClickOverlay="false"
|
||
border-radius="20"
|
||
:z-index="10096"
|
||
@close="handleCloseOfflinePopup"
|
||
>
|
||
<view class="offline-popup">
|
||
<view class="offline-popup__title">下线操作员</view>
|
||
<view class="offline-popup__body">
|
||
<text class="offline-popup__text">确认将「{{ offlineNamesText }}」下线?下线后需重新扫码绑定。</text>
|
||
</view>
|
||
<view class="offline-popup__actions">
|
||
<view class="offline-popup__btn offline-popup__btn--cancel" @click="handleCloseOfflinePopup">取消</view>
|
||
<view class="offline-popup__btn offline-popup__btn--confirm" @click="confirmOfflineMember">下线</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<!-- 今日打包统计面板 -->
|
||
<u-popup
|
||
:show="todayPackPanelOpen"
|
||
mode="center"
|
||
:closeable="true"
|
||
:closeOnClickOverlay="true"
|
||
border-radius="20"
|
||
:z-index="10095"
|
||
@close="closeTodayPackPanel"
|
||
>
|
||
<view class="today-pack-panel">
|
||
<view class="today-pack-panel__title">今日打包</view>
|
||
<view class="today-pack-panel__body">
|
||
<view class="today-pack-stat">
|
||
<text class="today-pack-stat__label">团购波次</text>
|
||
<text class="today-pack-stat__value">{{ todayWaveCount }}</text>
|
||
</view>
|
||
<view class="today-pack-stat">
|
||
<text class="today-pack-stat__label">团购订单</text>
|
||
<text class="today-pack-stat__value">{{ todayGroupOrderCount }}</text>
|
||
</view>
|
||
<view class="today-pack-stat">
|
||
<text class="today-pack-stat__label">散单</text>
|
||
<text class="today-pack-stat__value">{{ todaySingleCount }}</text>
|
||
</view>
|
||
<view v-if="isPersonalWorkbench" class="today-pack-stat">
|
||
<text class="today-pack-stat__label">团散</text>
|
||
<text class="today-pack-stat__value">{{ todayRatio !== null ? todayRatio : '—' }}</text>
|
||
</view>
|
||
<view v-if="isPersonalWorkbench" class="today-pack-stat">
|
||
<text class="today-pack-stat__label">均件数</text>
|
||
<text class="today-pack-stat__value">{{ todayAvgPiece !== null ? todayAvgPiece : '—' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
// 工作台在线成员列表本地缓存 key(服务端 getWorkbenchInfo 返回 members[] 时同步并缓存,重进时据此恢复)
|
||
const MEMBER_STORAGE_KEY = 'workbenchMembers'
|
||
// 无新打包任务自动登出:超过该时长(毫秒)自动结束最后打包任务并下线全部成员(不退出打包模式页面,只下线成员)
|
||
const IDLE_AUTO_LOGOUT_MS = 30 * 60 * 1000
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
// 当前绑定
|
||
bound: false,
|
||
workbenchId: '',
|
||
workbenchName: '',
|
||
workbenchToken: '',
|
||
warehouseId: '',
|
||
workbenchStatus: '',
|
||
workbenchType: '',
|
||
infoRefreshing: false, // 进入后刷新工作台信息请求防重入锁
|
||
bcastHealTimer: null, // 广播监听自愈定时器(onShow 延迟重新注册用)
|
||
idleLogoutTimer: null, // 无新打包任务自动登出定时器(setTimeout 句柄)
|
||
idleLoggingOut: false, // 自动登出防重入标志
|
||
// 当前操作员列表(工作台成员,本地保存 bindMember 返回的成员行 id,支持多人)
|
||
boundOperators: [],
|
||
// 工作台在线成员列表(以服务端 getWorkbenchInfo 返回的 members[] 为权威,绑定/下线后静默重拉同步)
|
||
workbenchMembers: [],
|
||
infoRefreshingSilent: false, // 静默刷新工作台信息防重入锁
|
||
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: '',
|
||
lastScannedCode: '', // 上一次扫描内容(连续相同跳过,防扫码枪重复触发)
|
||
orderInputFocus: false,
|
||
orderQuerying: false,
|
||
orderQueryState: '', // '' | loading | success | error
|
||
orderQueryResult: null,
|
||
orderQueryError: '',
|
||
packContextKey: '', // 查单返回的打包上下文 key(20 分钟有效,packOrder 凭此打包)
|
||
packKeyRetrying: false, // 打包上下文 key 失效自动重查防重入
|
||
packKeyRetryCount: 0, // 打包上下文 key 失效自动重查次数(手动扫码重置)
|
||
packReporting: false, // packOrder 上报请求防重入锁
|
||
finishPacking: false, // finishPack 完成打包请求防重入锁
|
||
hasActivePack: false, // 该工作台是否存在未结束打包任务(status<2):退出/解绑前自动上报打包完成
|
||
activePackIdentity: '', // 当前「打包中」订单唯一标识:团单为 wave_no,散单为 waybill_code(重复查单去重用)
|
||
activePackIsSandan: null, // 当前「打包中」订单类型:true=散单 / false=团单 / null=无进行中任务(重复查单需类型一致)
|
||
packRestored: false, // 重进后从服务端恢复的「打包中」态(跳过拦截/已打包/预检,直接展示进行中任务)
|
||
packWaitSeconds: 0, // 大团购打包时长闸门:packOrder 返回的需等待总秒数(0=无需等待)
|
||
packStartTime: 0, // 大团购打包时长闸门:packOrder 返回的开始打包毫秒时间戳(0=无需等待)
|
||
packWaitRemain: 0, // 大团购打包时长闸门:剩余等待秒数(倒计时展示,<=0 隐藏)
|
||
packWaitTimer: null, // 大团购打包时长闸门:倒计时 interval 句柄
|
||
packWaveScope: null, // 当前「打包中」任务波次范围(0=未分配 1=大团购 2=散单 3=小团购 4=单品单件)
|
||
packReqChain: null, // 打包要求语音播报串行队列(核实播报排队用)
|
||
// 团购核实:商品行已扫计数(key=商品行id/序号 → 已扫次数),达 plan_qty 视为已核实
|
||
groupVerified: {},
|
||
groupSubmitting: false, // 团购提交开始打包防重入
|
||
groupAutoSubmitted: false, // 团购全部核实后是否已自动提交开始打包
|
||
// 无条码复核弹窗(团单)
|
||
noBarcodePopupOpen: false,
|
||
noBarcodeItem: null, // { name, current, qty, item, idx }
|
||
// 取消核实弹窗(团单)
|
||
cancelVerifyPopupOpen: false,
|
||
// 打包上报失败弹窗(点击「重新上传」重传,成功后自动关闭)
|
||
retryPopupOpen: false,
|
||
retryPopupText: '',
|
||
retrySubmitting: false,
|
||
// 退出工作台弹窗
|
||
exitPopupOpen: false,
|
||
// 下线操作员二次确认弹窗(支持单人 / 多人批量下线)
|
||
offlinePopupOpen: false,
|
||
offlineMembers: [], // 待下线成员 [{ id, user_name }]
|
||
offlineSelectedIds: [], // 批量下线勾选的成员行 id
|
||
// 今日打包统计(workbench.getWorkbenchCount)
|
||
todayWaveCount: 0, // 团购波次
|
||
todayGroupOrderCount: 0, // 团购订单
|
||
todaySingleCount: 0, // 散单
|
||
todayRatio: null, // 团散比(仅个人工作台返回)
|
||
todayAvgPiece: null, // 均件数(仅个人工作台返回)
|
||
todayPackPanelOpen: 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 : '--';
|
||
},
|
||
// 是否个人工作台(仅个人工作台显示「团散 / 均件数」)
|
||
isPersonalWorkbench() {
|
||
return this.workbenchType === 'personal';
|
||
},
|
||
// 顶部操作员按钮文案:单人显示该操作员名称,多人显示「N人」
|
||
topbarOperatorText() {
|
||
const list = this.boundOperators;
|
||
if (!list.length) return '未绑定';
|
||
if (list.length === 1) {
|
||
return String(list[0] && list[0].userName || '').trim() || '已绑定';
|
||
}
|
||
return `${list.length}人`;
|
||
},
|
||
// 查询结果是否为散单
|
||
orderQueryIsSandan() {
|
||
const r = this.orderQueryResult;
|
||
return !!(r && Number(r.isSandan) === 1);
|
||
},
|
||
// 订单是否被禁止打包(拦截/未复核/已打包),命中时不显示商品明细
|
||
orderBlocked() {
|
||
// 重进恢复的进行中任务:跳过拦截/未复核/已打包判断,直接展示打包中状态
|
||
if (this.packRestored) return false;
|
||
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;
|
||
},
|
||
// 禁止打包提示文案:与 orderBlocked 判定顺序一致(拦截 → 未复核 → 已打包)
|
||
orderBlockedHint() {
|
||
if (!this.orderBlocked) return '';
|
||
const r = this.orderQueryResult;
|
||
const order = r && r.order;
|
||
if (this.orderQueryIsSandan && order && Number(order.intercept_flag) === 1) {
|
||
return '订单已拦截,禁止打包';
|
||
}
|
||
if (order) {
|
||
const recheck = String(order.recheck_status ?? '').trim().toLowerCase();
|
||
const recheckDone = recheck === 'fin' || recheck === 'finished' || recheck === '1';
|
||
if (!recheckDone) {
|
||
return '订单未复核,禁止打包';
|
||
}
|
||
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) return '订单已打包,禁止打包';
|
||
}
|
||
return '订单禁止打包';
|
||
},
|
||
// 精简概要:包材名称(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;
|
||
},
|
||
// 商品种类数(order.items_count,缺省按 items 数量)
|
||
orderItemsKind() {
|
||
const r = this.orderQueryResult;
|
||
const count = r?.order && (r.order.items_count !== undefined && r.order.items_count !== null) ? r.order.items_count : null;
|
||
if (count !== null) return count;
|
||
if (Array.isArray(r?.items)) return r.items.length;
|
||
return 0;
|
||
},
|
||
// 拣货人(order.picker_name,兜底 pickerName)
|
||
orderPickerName() {
|
||
const r = this.orderQueryResult;
|
||
const raw = (r?.order && (r.order.picker_name ?? r.order.pickerName)) ?? r?.picker_name ?? r?.pickerName;
|
||
return String(raw || '').trim() || '--';
|
||
},
|
||
// 团购订单商品明细(查询结果 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;
|
||
},
|
||
// 团购提交失败待重传:全部商品已核实、已自动提交过但无进行中打包任务(即上次上报未成功)
|
||
groupPackRetryReady() {
|
||
if (this.orderQueryIsSandan) return false;
|
||
if (!this.orderQueryResult) return false;
|
||
if (!this.groupAllVerified) return false;
|
||
if (!this.groupAutoSubmitted) return false;
|
||
if (this.hasActivePack) return false;
|
||
return !this.groupSubmitting;
|
||
},
|
||
// 输入框占位:按实际流程提示(未绑定操作员 → 扫工牌绑定;团购核实中 → 扫商品条码;否则 → 运单查询)
|
||
orderScanPlaceholder() {
|
||
if (!this.boundOperators.length) return '扫描/输入工牌绑定操作员';
|
||
if (this.groupPackRetryReady) return '扫描商品条码重新上报';
|
||
if (this.groupVerifyingActive && !this.orderBlocked) return '扫描商品条码核实';
|
||
return '扫描/输入运单号查询';
|
||
},
|
||
// 批量下线:是否已全选所有在线成员
|
||
allMembersSelected() {
|
||
const list = Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [];
|
||
return !!list.length && this.offlineSelectedIds.length === list.length;
|
||
},
|
||
// 下线确认弹窗展示的成员姓名(多人用「、」连接)
|
||
offlineNamesText() {
|
||
const names = (Array.isArray(this.offlineMembers) ? this.offlineMembers : [])
|
||
.map(m => String((m && m.user_name) || '').trim())
|
||
.filter(Boolean);
|
||
return names.length ? names.join('、') : '--';
|
||
},
|
||
// 大团购打包时长闸门:倒计时是否进行中(剩余秒数 > 0 时展示)
|
||
packWaitActive() {
|
||
return this.packWaitRemain > 0;
|
||
},
|
||
// 大团购打包时长闸门:倒计时文案 mm:ss
|
||
packWaitText() {
|
||
if (!this.packWaitActive) return '';
|
||
const total = this.packWaitRemain;
|
||
const m = Math.floor(total / 60);
|
||
const s = total % 60;
|
||
return `${m}:${s < 10 ? '0' : ''}${s}`;
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.loadBound(options);
|
||
// 读取本地保存的已绑定操作员列表(bindMember 返回的成员行 id,按 workbenchId 匹配)
|
||
this.loadBoundOperators();
|
||
// 恢复本地缓存的工作台成员列表(离线优先,随后 fetchWorkbenchInfo 以服务端 members 覆盖)
|
||
this.restoreWorkbenchMembers();
|
||
// 进入打包模式:重新拉取工作台信息(同时校验本地工作台 token 是否仍有效)
|
||
if (this.bound) {
|
||
this.fetchWorkbenchInfo();
|
||
// 进入打包页即拉取一次今日打包统计(班次日 08:00~次日 08:00)
|
||
this.loadTodayPackStat();
|
||
}
|
||
// 注册广播扫码回调(操作员弹窗内枪扫工牌识别绑定用)
|
||
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);
|
||
// 页面重新显示:重启无新打包任务自动登出计时(仅已绑定工作台时生效)
|
||
if (this.bound) {
|
||
this.scheduleIdleAutoLogout();
|
||
}
|
||
},
|
||
onHide() {
|
||
this.clearBcastHealTimer();
|
||
this.clearIdleAutoLogoutTimer();
|
||
this.safeDispatchBroadcast('pause');
|
||
},
|
||
onUnload() {
|
||
this.clearBcastHealTimer();
|
||
this.clearIdleAutoLogoutTimer();
|
||
this.clearPackWaitTimer();
|
||
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);
|
||
}
|
||
},
|
||
// 语音播报并返回完成 Promise(用于串行排队:上一条播完再播下一条)
|
||
speakTextAsync(text = '') {
|
||
try {
|
||
const tools = this.$tools;
|
||
if (!tools || typeof tools.speakText !== 'function') return Promise.resolve(false);
|
||
const task = tools.speakText(String(text).trim(), {});
|
||
if (task && typeof task.then === 'function') {
|
||
return task.catch(error => {
|
||
console.warn('[packMode] 语音播报失败:', error);
|
||
return false;
|
||
});
|
||
}
|
||
return Promise.resolve(false);
|
||
} catch (error) {
|
||
console.warn('[packMode] 语音播报异常:', error);
|
||
return Promise.resolve(false);
|
||
}
|
||
},
|
||
// 语音播报商品打包要求(查询订单成功后调用,多条要求去重后串行播报,记录完成 Promise 供核实播报排队)
|
||
speakPackingRequirements(items) {
|
||
if (!Array.isArray(items) || !items.length) return;
|
||
const reqs = [];
|
||
items.forEach((it) => {
|
||
const v = String((it && it.packing_requirements) || '').trim();
|
||
if (v && reqs.indexOf(v) === -1) reqs.push(v);
|
||
});
|
||
if (!reqs.length) return;
|
||
// 串行链:上一条播完再播下一条,最终 resolve 表示全部打包要求播报完成
|
||
let chain = Promise.resolve();
|
||
reqs.forEach((text) => {
|
||
chain = chain.then(() => this.speakTextAsync(`${text}`));
|
||
});
|
||
this.packReqChain = chain;
|
||
},
|
||
// 核实播报:排队到打包要求播报完成之后,避免打断打包要求播报
|
||
speakAfterPackRequirements(text = '') {
|
||
const chain = this.packReqChain;
|
||
if (chain && typeof chain.then === 'function') {
|
||
this.packReqChain = chain.then(() => this.speakTextAsync(`${text}`)).catch(() => {});
|
||
} else {
|
||
this.speakText(`${text}`);
|
||
}
|
||
},
|
||
// 清理广播自愈定时器(页面隐藏/卸载时避免残留定时器误注册广播)
|
||
clearBcastHealTimer() {
|
||
if (this.bcastHealTimer) {
|
||
clearTimeout(this.bcastHealTimer);
|
||
this.bcastHealTimer = null;
|
||
}
|
||
},
|
||
// 无新打包任务自动登出:重新计时(开始新打包 / 绑定成员 / 页面显示时调用)
|
||
scheduleIdleAutoLogout() {
|
||
this.clearIdleAutoLogoutTimer();
|
||
this.idleLogoutTimer = setTimeout(() => {
|
||
this.idleLogoutTimer = null;
|
||
this.autoLogoutForIdle();
|
||
}, IDLE_AUTO_LOGOUT_MS);
|
||
},
|
||
// 清除无新打包任务自动登出定时器
|
||
clearIdleAutoLogoutTimer() {
|
||
if (this.idleLogoutTimer) {
|
||
clearTimeout(this.idleLogoutTimer);
|
||
this.idleLogoutTimer = null;
|
||
}
|
||
},
|
||
// 超时触发:结束最后打包任务 → 下线全部成员 → 清空工作台,等待下一批操作员重新绑定(不退出打包模式页面)
|
||
async autoLogoutForIdle() {
|
||
if (this.idleLoggingOut) return;
|
||
this.idleLoggingOut = true;
|
||
try {
|
||
// 1. 结束最后打包任务(无进行中任务则跳过)
|
||
if (this.hasActivePack) {
|
||
const fr = await this.requestFinishPack();
|
||
if (fr && fr.expired) return;
|
||
}
|
||
// 2. 下线全部在线操作员(removeMember 支持 ids 数组),失败不阻断
|
||
const list = Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [];
|
||
const ids = list.map((m) => Number(m && m.id)).filter((id) => id > 0);
|
||
if (ids.length) {
|
||
const token = String(this.workbenchToken || '').trim();
|
||
if (!token) {
|
||
this.exitWorkbench(true);
|
||
return;
|
||
}
|
||
try {
|
||
const res = await this.$http('workbench.removeMember', { ids, token });
|
||
const bizCode = Number(res?.code);
|
||
// 401/403:工作台已解绑,被动退出回登录页
|
||
if (bizCode === 401 || bizCode === 403) {
|
||
this.exitWorkbench(true);
|
||
return;
|
||
}
|
||
} catch (error) {
|
||
// 失败不阻断
|
||
}
|
||
}
|
||
// 3. 清空本地成员列表与打包数据,防止残留给下一批操作员
|
||
this.workbenchMembers = [];
|
||
this.boundOperators = [];
|
||
try { uni.removeStorageSync(MEMBER_STORAGE_KEY); } catch (e) {}
|
||
try { uni.removeStorageSync('workbenchOperators'); } catch (e) {}
|
||
this.clearPackState();
|
||
// 4. 静默重拉工作台信息,成员列表以服务端为准
|
||
this.fetchWorkbenchInfo({ silent: true });
|
||
// 5. 语音 + 提示
|
||
this.speakText('已结束打包并下线全部成员');
|
||
uni.showToast({ title: '长时间无新打包任务,已自动下线', icon: 'none' });
|
||
} finally {
|
||
this.idleLoggingOut = false;
|
||
}
|
||
},
|
||
// 扫码内容去重:扫码枪偶发「内容重复/尾段不完整」输出(如 abcabc → abc、abcab → abc),避免重复查询
|
||
dedupeRepeatedScan(code) {
|
||
const s = String(code || '').replace(/\s+/g, '');
|
||
if (!s) return '';
|
||
const len = s.length;
|
||
// 偶数长度且前后两半完全相同(abcabc → abc);去重后至少保留 3 位,避免误伤短码
|
||
if (len >= 6 && len % 2 === 0) {
|
||
const half = len / 2;
|
||
if (s.slice(0, half) === s.slice(half)) {
|
||
return s.slice(0, half);
|
||
}
|
||
}
|
||
// 尾段与开头重叠(漏尾多扫了部分前缀,abcab → abc)
|
||
for (let overlap = Math.floor(len / 2); overlap >= 2; overlap--) {
|
||
if (len - overlap >= 3 && s.slice(0, overlap) === s.slice(len - overlap)) {
|
||
return s.slice(0, len - overlap);
|
||
}
|
||
}
|
||
return s;
|
||
},
|
||
// 主界面扫码统一入口:工牌码 → 识别并新增绑定;未绑定操作员 → 识别并自动绑定;团购核实时 → 扫商品条码核实;否则 → 按运单查询
|
||
handleBarcodeInput(code) {
|
||
// 扫码内容去重:处理扫码枪「内容重复/尾段不完整」输出(如 abcabc → abc、abcab → abc)
|
||
const c = this.dedupeRepeatedScan(code);
|
||
if (!c) return;
|
||
// 工牌码(base64 JSON 含 uuid)→ 识别该用户并新增绑定(未绑定首绑 / 已绑定追加新成员);工牌「再扫=下线」需保留连续扫描
|
||
if (this.parseBadgeCode(c).ok) {
|
||
this.handleBadgeScan(c);
|
||
return;
|
||
}
|
||
// 团购提交失败待重传:扫描任一商品条码直接重传开始打包(保持核实进度,不重新查单)
|
||
if (this.groupPackRetryReady && this.matchesAnyGroupItemCodeAny(c)) {
|
||
this.retryGroupPackSubmit();
|
||
return;
|
||
}
|
||
// 与上一次扫描内容完全一致 → 跳过(防止运单/商品条码重复触发查询/核实);
|
||
// 查询失败态豁免:断网/查询失败后重新扫描同一运单可再次触发查询(重试)
|
||
if (this.lastScannedCode === c && this.orderQueryState !== 'error') return;
|
||
this.lastScannedCode = c;
|
||
// 手动扫码重新查单:重置打包上下文 key 失效自动重查计数(用户主动换单/重扫视为新的一轮)
|
||
this.packKeyRetryCount = 0;
|
||
if (!this.boundOperators.length) {
|
||
// 未绑定操作员:输入/扫描值走绑定操作员流程(识别工牌 → 自动绑定,识别失败由 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) {
|
||
if (this.matchesAnyGroupItemCode(c)) {
|
||
this.handleGroupVerifyScan(c);
|
||
return;
|
||
}
|
||
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;
|
||
},
|
||
// 判断条码是否为当前团购订单中某待核实商品的可扫条码(用于首次核实区分商品条码与新面单)
|
||
matchesAnyGroupItemCode(code) {
|
||
const c = String(code || '').trim();
|
||
if (!c || 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(c) !== -1) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
},
|
||
// 判断条码是否为当前团购订单中任一商品的可扫条码(含已核实商品,重传触发用)
|
||
matchesAnyGroupItemCodeAny(code) {
|
||
const c = String(code || '').trim();
|
||
if (!c || this.orderQueryIsSandan || !this.orderQueryResult) return false;
|
||
const items = this.groupItems;
|
||
for (let i = 0; i < items.length; i++) {
|
||
if (this.groupItemCodes(items[i]).indexOf(c) !== -1) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
},
|
||
// 商品是否需要复核:need_recheck 为 'N' 视为免验(无需复核),其余(含缺省)按需要复核(Y)
|
||
isItemNeedRecheck(item) {
|
||
const v = String((item && item.need_recheck) || 'Y').trim().toUpperCase();
|
||
return v !== 'N';
|
||
},
|
||
isItemVerified(item, idx) {
|
||
// 免验商品(need_recheck=N)无需扫码复核,直接视为已核实
|
||
if (!this.isItemNeedRecheck(item)) return true;
|
||
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.speakAfterPackRequirements('数据一致');
|
||
uni.showToast({ title: `${name} 已核实`, icon: 'none' });
|
||
return true;
|
||
}
|
||
}
|
||
this.speakText('无记录');
|
||
uni.showToast({ title: '条码与待核实商品不匹配', icon: 'none' });
|
||
return false;
|
||
},
|
||
// 清空当前订单查询与团购核实状态(不打包,回到可查询新面单状态)
|
||
resetOrderQuery() {
|
||
this.groupVerified = {};
|
||
this.groupAutoSubmitted = false;
|
||
this.packRestored = false;
|
||
this.orderQueryState = '';
|
||
this.orderQueryResult = null;
|
||
this.orderQueryError = '';
|
||
this.orderBarcode = '';
|
||
this.packContextKey = '';
|
||
},
|
||
// 长按复核:团单任意未核实商品可通过“无条码复核”人工标记已核实
|
||
handleGroupItemLongPress(item, idx) {
|
||
if (this.orderQueryIsSandan) return;
|
||
// 提交失败待重传:长按任一商品直接重传开始打包
|
||
if (this.groupPackRetryReady) {
|
||
this.retryGroupPackSubmit();
|
||
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.speakAfterPackRequirements('数据一致');
|
||
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.packRestored = false;
|
||
this.orderQueryState = '';
|
||
this.orderQueryResult = null;
|
||
this.orderQueryError = '';
|
||
this.orderBarcode = '';
|
||
this.packContextKey = '';
|
||
// 重置上一次扫描内容,避免未核实任何商品即取消时,再次扫同一运单被去重跳过
|
||
this.lastScannedCode = '';
|
||
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;
|
||
}
|
||
},
|
||
// 打包上报失败后的手动重传:扫描商品条码/长按商品触发(保持核实状态,凭原 key 重新上报)
|
||
retryGroupPackSubmit() {
|
||
if (!this.groupPackRetryReady) return;
|
||
this.speakText('重新上报开始打包');
|
||
uni.showToast({ title: '重新上报开始打包', icon: 'none', duration: 2000 });
|
||
this.handleSubmitGroupPack();
|
||
},
|
||
// 提交开始打包服务器返回错误时:按最近查询条码自动重查订单获取新 key 并重新提交
|
||
async retryQueryForNewKey(failText = '') {
|
||
if (this.packKeyRetrying) return;
|
||
// 自动重查仅尝试一次,避免反复失败造成死循环;再次失败改为弹窗提示
|
||
if (this.packKeyRetryCount >= 1) {
|
||
this.openRetryPopup(failText || '打包上报失败,请重新扫码查询');
|
||
return;
|
||
}
|
||
this.packKeyRetrying = true;
|
||
try {
|
||
this.packKeyRetryCount += 1;
|
||
const r = this.orderQueryResult;
|
||
const barcode = String((r && (r.waybill_code || r.barcode)) || this.orderBarcode || '').trim();
|
||
if (!barcode) {
|
||
// 无条码可重查:提示手动重新扫码
|
||
this.openRetryPopup(failText || '打包上报失败,请重新扫码查询');
|
||
return;
|
||
}
|
||
// 重查前记录团购核实进度(重查会重置核实状态,成功后恢复并重新提交)
|
||
const wasGroupAllVerified = !this.orderQueryIsSandan && this.groupAllVerified;
|
||
// 重查前保存完整订单上下文:重查失败(断网/无记录)时恢复,保持「待重传」能力
|
||
const prevResult = this.orderQueryResult;
|
||
const prevState = this.orderQueryState;
|
||
const prevVerified = this.groupVerified;
|
||
const prevAutoSubmitted = this.groupAutoSubmitted;
|
||
this.speakText('上报失败,重新查询订单');
|
||
uni.showToast({ title: '上报失败,正在重新查询订单', icon: 'none', duration: 2500 });
|
||
await this.queryOrder(barcode);
|
||
if (this.orderQueryState !== 'success' || !this.orderQueryResult) {
|
||
// 重查失败:恢复重查前的订单与核实状态,保持「待重传」能力(长按/点击商品、扫描商品条码可重新上报)
|
||
this.orderQueryResult = prevResult;
|
||
this.orderQueryState = prevState;
|
||
this.groupVerified = prevVerified;
|
||
this.groupAutoSubmitted = prevAutoSubmitted;
|
||
this.orderQueryError = '';
|
||
this.openRetryPopup('重新查询订单失败,请检查网络后重新扫码');
|
||
return;
|
||
}
|
||
if (!this.orderQueryIsSandan && wasGroupAllVerified && this.groupItems.length) {
|
||
// 团购:恢复全部商品已核实并自动重新提交开始打包
|
||
const items = this.groupItems;
|
||
const verified = {};
|
||
items.forEach((it, i) => {
|
||
verified[this.groupItemKey(it, i)] = Math.max(1, Number(it?.plan_qty) || 1);
|
||
});
|
||
// 先置 groupAutoSubmitted 再写 groupVerified,避免 groupAllVerified 变化触发重复提交
|
||
this.groupAutoSubmitted = true;
|
||
this.groupVerified = verified;
|
||
this.handleSubmitGroupPack();
|
||
}
|
||
// 散单:queryOrder 成功后已自动上报;无商品明细团购也已自动提交,无需额外处理
|
||
} finally {
|
||
this.packKeyRetrying = false;
|
||
}
|
||
},
|
||
// 打开打包上报失败弹窗(可点击「重新上传」重传)
|
||
openRetryPopup(text) {
|
||
this.retryPopupText = String(text || '打包上报失败,请重新上传');
|
||
this.retryPopupOpen = true;
|
||
this.speakText('打包上报失败');
|
||
},
|
||
// 关闭重新上传弹窗(用户选择重新扫码等其它操作)
|
||
handleCloseRetryPopup() {
|
||
this.retryPopupOpen = false;
|
||
},
|
||
// 弹窗「重新上传」:重传开始打包,成功后自动关闭弹窗
|
||
async handleRetryPackReport() {
|
||
if (this.retrySubmitting) return;
|
||
this.retrySubmitting = true;
|
||
try {
|
||
const ok = await this.reportPackOrder();
|
||
if (ok) {
|
||
this.retryPopupOpen = false;
|
||
}
|
||
} finally {
|
||
this.retrySubmitting = false;
|
||
}
|
||
},
|
||
// 顶部操作员姓名按钮:打开操作员弹窗(展示在线成员列表,支持扫码追加绑定 / 下线成员)
|
||
handleUserInfo() {
|
||
this.userDrawerOpen = true;
|
||
// 确保广播监听(从其它页面返回时可能已 pause),弹窗内扫码即识别/追加绑定
|
||
this.safeDispatchBroadcast('setCallbacks', {
|
||
onResult: this.handleBroadcastResult
|
||
});
|
||
this.safeDispatchBroadcast('resume');
|
||
// 重置识别待绑定态;不自动聚焦输入框,避免默认拉起软键盘(点击输入框或相机扫码时再输入)
|
||
this.opScanCode = '';
|
||
this.opQueryState = '';
|
||
this.opQueryResult = null;
|
||
this.opQueryError = '';
|
||
this.opInputFocus = false;
|
||
},
|
||
// 关闭操作员弹窗
|
||
handleCloseUserDrawer() {
|
||
this.userDrawerOpen = false;
|
||
this.opInputFocus = false;
|
||
},
|
||
// 广播扫码结果:工牌码追加绑定 / 未绑定识别绑定 / 团购核实 / 运单查询(统一走 handleBarcodeInput)
|
||
handleBroadcastResult(result) {
|
||
// 打印广播扫描原始数据,便于排查枪扫/广播数据格式
|
||
console.log('[packMode] 广播扫描原始数据:', result);
|
||
const scanText = this.normalizeScanResult(result);
|
||
console.log('[packMode] handleBroadcastResult 扫描结果:', scanText);
|
||
if (!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: () => {}
|
||
});
|
||
},
|
||
// 订单唯一标识:散单比 waybill_code(barcode 兜底),团单比 wave_no(batch.wave_no 优先,order.wave_no 兜底)
|
||
orderIdentity(result) {
|
||
if (!result || typeof result !== 'object') return '';
|
||
if (Number(result.isSandan) === 1) {
|
||
return String(result.waybill_code || result.barcode || '').trim();
|
||
}
|
||
const batchNo = result.batch && result.batch.wave_no ? String(result.batch.wave_no) : '';
|
||
const orderNo = result.order && result.order.wave_no ? String(result.order.wave_no) : '';
|
||
return String(batchNo || orderNo || '').trim();
|
||
},
|
||
// 重复查单判断:本次查询结果与当前「打包中」订单相同(团单比 wave_no,散单比 waybill_code,且订单类型一致)
|
||
sameOrderQuery(result) {
|
||
if (!this.hasActivePack || !this.activePackIdentity) return false;
|
||
// 订单类型一致(散单/团单),避免散单 waybill_code 与团单 wave_no 同名误判
|
||
const newIsSandan = !!(result && Number(result.isSandan) === 1);
|
||
if (this.activePackIsSandan !== newIsSandan) return false;
|
||
const identity = this.orderIdentity(result);
|
||
return !!identity && identity === this.activePackIdentity;
|
||
},
|
||
// 波次范围:从当前查询结果订单行取 wave_scope(0=未分配 1=大团购 2=散单 3=小团购 4=单品单件),缺省返回 null
|
||
orderWaveScope() {
|
||
const r = this.orderQueryResult;
|
||
if (!r || typeof r !== 'object') return null;
|
||
const order = r.order || {};
|
||
const raw = order.wave_scope ?? order.waveScope ?? r.wave_scope ?? r.waveScope;
|
||
if (raw === undefined || raw === null || raw === '') return null;
|
||
return Number(raw);
|
||
},
|
||
// 按运单号条码查询订单(workbench.queryOrder)
|
||
async queryOrder(barcode) {
|
||
const code = String(barcode || '').trim();
|
||
if (!code) return;
|
||
// 无成员(未绑定操作员)时不允许查询订单
|
||
if (!this.boundOperators.length) {
|
||
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;
|
||
// 保存上一次查询结果:大团购打包时长闸门拦截「打包时长不足」时恢复展示,保持当前打包任务上下文
|
||
const previousResult = this.orderQueryResult;
|
||
this.orderQuerying = true;
|
||
this.orderQueryState = 'loading';
|
||
this.orderQueryResult = null;
|
||
this.orderQueryError = '';
|
||
uni.showLoading({ title: '查询中...', mask: true });
|
||
try {
|
||
// toastAfter=false:失败提示由本方法自行控制,避免拦截器重复弹 toast
|
||
// 弱网下显式 15s 超时,配合请求层硬超时兜底,失败后界面必定恢复可操作
|
||
const res = await this.$http('workbench.queryOrder', { token, barcode: code }, '', false, 'text', 15000);
|
||
const invalid = res?.flag === 'failure' || [0, 401, 403].indexOf(Number(res?.code)) !== -1;
|
||
if (invalid) {
|
||
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
|
||
if (this.handleWorkbenchAuthExpired(res?.code)) return;
|
||
const msg = String(res?.message || res?.msg || '');
|
||
// 大团购打包时长闸门:进行中的大团购任务未到等待时长时,扫描其它波次订单返回「打包时长不足」;
|
||
// 保持当前订单上下文不被覆盖,提示后允许继续扫描本波次订单
|
||
if (msg.indexOf('打包时长不足') !== -1) {
|
||
this.orderQueryState = previousResult ? 'success' : 'error';
|
||
this.orderQueryResult = previousResult;
|
||
this.orderQueryError = previousResult ? '' : msg;
|
||
this.orderBarcode = '';
|
||
this.speakText('打包时长不足');
|
||
uni.showToast({ title: '打包时长不足', icon: 'none', duration: 4000 });
|
||
return;
|
||
}
|
||
this.orderQueryState = 'error';
|
||
this.orderQueryError = msg || '查询失败,请重试';
|
||
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;
|
||
}
|
||
// 重复查单:本次查询与当前「打包中」订单相同(团单比 wave_no,散单比 waybill_code),
|
||
// 刷新为新扫运单数据(运单号/货主/包材/商品明细),保持「打包中」状态,不重复上报、不重新复核
|
||
if (this.sameOrderQuery(data)) {
|
||
this.orderQueryResult = data;
|
||
this.orderQueryState = 'success';
|
||
this.orderQueryError = '';
|
||
this.orderBarcode = '';
|
||
// 打包上下文 key 同步为新查询结果(key 始终对应最近一次查询)
|
||
this.packContextKey = String(data?.key || '').trim();
|
||
// 恢复态:跳过拦截/已打包/预检,避免同单重复查单被「已打包」拦截隐藏明细
|
||
this.packRestored = true;
|
||
// 团购:全部商品恢复为已核实(标绿),不要求重新复核
|
||
const dupItems = Array.isArray(data?.items) ? data.items : [];
|
||
const dupVerified = {};
|
||
dupItems.forEach((it, i) => {
|
||
dupVerified[this.groupItemKey(it, i)] = Math.max(1, Number(it?.plan_qty) || 1);
|
||
});
|
||
// 先置 groupAutoSubmitted 再写 groupVerified,避免 groupAllVerified 变化触发重复提交打包
|
||
this.groupAutoSubmitted = true;
|
||
this.groupVerified = dupVerified;
|
||
// 新查询进入另一订单:关闭打包上报失败弹窗
|
||
this.retryPopupOpen = false;
|
||
this.speakText('正在打包');
|
||
uni.showToast({ title: '订单打包中,请勿重复上报', icon: 'none' });
|
||
return;
|
||
}
|
||
this.orderQueryResult = data;
|
||
this.orderQueryState = 'success';
|
||
// 新查询正常进入,清除恢复态
|
||
this.packRestored = false;
|
||
// 新查询进入另一订单:关闭打包上报失败弹窗
|
||
this.retryPopupOpen = false;
|
||
// 打包上下文 key:packOrder 凭 key 由服务端解析订单信息,前端不回传订单数据
|
||
this.packContextKey = String(data?.key || '').trim();
|
||
// 查询成功:清空输入框,方便连续扫描下一单
|
||
this.orderBarcode = '';
|
||
// 语音播报商品打包要求
|
||
this.speakPackingRequirements(data?.items);
|
||
// 团购:初始化商品核实状态(不自动上报,全部核实后将自动提交开始打包)
|
||
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';
|
||
const errMsg = String(error && (error.message || error.errMsg) || '');
|
||
this.orderQueryError = errMsg.indexOf('timeout') !== -1 || errMsg.indexOf('超时') !== -1
|
||
? '网络超时,请检查网络后重试'
|
||
: (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 数组全部取出用「、」连接,或字符串直接返回)
|
||
orderItemBarcode(item) {
|
||
if (!item) return '';
|
||
const codes = item.barcodes ?? item.barcode;
|
||
if (Array.isArray(codes)) {
|
||
const list = codes
|
||
.map(c => {
|
||
if (!c) return '';
|
||
if (typeof c === 'object') return String(c.barcode || c.code || '').trim();
|
||
return String(c).trim();
|
||
})
|
||
.filter(Boolean);
|
||
return list.join('、');
|
||
}
|
||
if (codes && typeof codes === 'object') return String(codes.barcode || codes.code || '');
|
||
return String(codes || '');
|
||
},
|
||
// 商品打包要求
|
||
itemPackingRequirement(item) {
|
||
return String((item && item.packing_requirements) || '').trim();
|
||
},
|
||
// 打包预检(上报 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;
|
||
|
||
// 打包上下文 key:来自 workbench.queryOrder 响应(20 分钟有效),订单信息由服务端从 key 解析,前端不回传订单信息
|
||
const packKey = String(this.packContextKey || '').trim();
|
||
if (!packKey) {
|
||
uni.showToast({ title: '缺少打包上下文,请重新扫码查询', icon: 'none' });
|
||
return false;
|
||
}
|
||
// 打包人员:当前已绑定操作员(可多人)
|
||
const operators = this.boundOperators;
|
||
if (!operators || !operators.length || !operators.some(op => String(op && op.userName || '').trim())) {
|
||
uni.showToast({ title: '请先绑定操作员再上报打包', icon: 'none' });
|
||
return false;
|
||
}
|
||
|
||
this.packReporting = true;
|
||
uni.showLoading({ title: '打包上报中...', mask: true });
|
||
try {
|
||
// 波次范围 wave_scope(0=未分配 1=大团购 2=散单 3=小团购 4=单品单件):
|
||
// 上报查询结果中的订单行值,服务端复查(非法/缺省时兜底订单行值)
|
||
const waveScope = this.orderWaveScope();
|
||
const payload = {
|
||
key: packKey,
|
||
token
|
||
};
|
||
if (waveScope !== null && waveScope !== undefined) {
|
||
payload.wave_scope = waveScope;
|
||
}
|
||
|
||
// toastAfter=false:失败提示由本方法自行控制
|
||
// 弱网下显式 15s 超时,配合请求层硬超时兜底,失败后界面必定恢复可操作
|
||
const res = await this.$http('workbench.packOrder', payload, '', false, 'text', 15000);
|
||
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;
|
||
// 服务器返回错误(含打包上下文 key 失效等):自动重查订单获取新 key 并重新提交
|
||
this.retryQueryForNewKey(res?.message || '');
|
||
return false;
|
||
}
|
||
const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res;
|
||
console.log('[packMode] 打包上报成功:', data || res);
|
||
// 记录存在未结束打包任务:退出工作台/解绑操作员前将自动上报打包完成
|
||
this.hasActivePack = true;
|
||
// 记录当前「打包中」订单标识与类型,重复扫描同一订单时保持打包中、不重复上报
|
||
this.activePackIdentity = this.orderIdentity(this.orderQueryResult);
|
||
this.activePackIsSandan = this.orderQueryIsSandan;
|
||
// 大团购打包时长闸门:packOrder 响应下发倒计时字段(非大团购波次均为 0)
|
||
const respWaveScope = data?.wave_scope ?? data?.waveScope;
|
||
this.packWaveScope = (respWaveScope !== undefined && respWaveScope !== null && respWaveScope !== '')
|
||
? Number(respWaveScope)
|
||
: waveScope;
|
||
const waitSeconds = Number(data?.pack_wait_seconds ?? data?.packWaitSeconds) || 0;
|
||
const startTime = Number(data?.pack_start_time ?? data?.packStartTime) || 0;
|
||
this.startPackWaitCountdown(waitSeconds, startTime);
|
||
uni.showToast({ title: '已开始打包', icon: 'success' });
|
||
// 开始打包成功后刷新今日打包统计(以服务端为准)
|
||
this.loadTodayPackStat();
|
||
// 有新打包任务:重置 30 分钟无新任务自动登出计时
|
||
this.scheduleIdleAutoLogout();
|
||
return true;
|
||
} catch (error) {
|
||
console.error('[packMode] 打包上报失败:', error);
|
||
// 弱网超时/断网时给出明确失败提示并弹出重新上传弹窗
|
||
const errMsg = String(error && (error.message || error.errMsg) || '');
|
||
const title = errMsg.indexOf('timeout') !== -1 || errMsg.indexOf('超时') !== -1
|
||
? '网络超时,打包上报失败'
|
||
: (error?.message || '打包上报失败');
|
||
this.openRetryPopup(title);
|
||
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:失败提示由调用方自行控制(弱网 15s 超时,避免退出时卡住)
|
||
const res = await this.$http('workbench.finishPack', { token }, '', false, 'text', 15000);
|
||
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;
|
||
this.activePackIdentity = '';
|
||
this.activePackIsSandan = null;
|
||
// 打包任务结束:清除大团购打包时长闸门倒计时
|
||
this.clearPackWait();
|
||
}
|
||
return {
|
||
ok: true,
|
||
finished,
|
||
error: finished ? '' : (data?.message || '当前无进行中的打包任务')
|
||
};
|
||
} catch (error) {
|
||
console.error('[packMode] 完成打包失败:', error);
|
||
return { ok: false, error: error?.message || '完成打包失败' };
|
||
} finally {
|
||
this.finishPacking = false;
|
||
}
|
||
},
|
||
// 广播调用兜底(广播 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 匹配;兼容旧版单操作员缓存)
|
||
loadBoundOperators() {
|
||
let list = null
|
||
try {
|
||
list = uni.getStorageSync('workbenchOperators')
|
||
} catch (e) {}
|
||
if (!Array.isArray(list)) {
|
||
// 兼容旧版单操作员缓存(workbenchOperator 对象)
|
||
let saved = null
|
||
try {
|
||
saved = uni.getStorageSync('workbenchOperator')
|
||
} catch (e) {}
|
||
if (saved && typeof saved === 'object' && String(saved?.memberId || '')) {
|
||
list = [saved]
|
||
} else {
|
||
list = []
|
||
}
|
||
}
|
||
const wbId = String(this.workbenchId || '')
|
||
this.boundOperators = list
|
||
.filter(op => op && String(op?.memberId || ''))
|
||
.filter(op => !op.workbenchId || String(op.workbenchId) === wbId)
|
||
.map(op => ({
|
||
memberId: String(op.memberId),
|
||
workbenchId: String(op.workbenchId || wbId),
|
||
userId: (op.userId === null || op.userId === undefined || op.userId === '') ? '' : String(op.userId),
|
||
userName: String(op.userName || '')
|
||
}))
|
||
},
|
||
// 归一化服务端 members[] 为统一结构 { id, workbench_id, user_id, user_name }
|
||
normalizeWorkbenchMembers(members, workbenchId) {
|
||
const wbId = workbenchId === null || workbenchId === undefined ? '' : workbenchId;
|
||
return (Array.isArray(members) ? members : [])
|
||
.filter((m) => m && (m.id || m.member_id || m.memberId || m.user_name || m.userName || m.real_name || m.name))
|
||
.map((m) => ({
|
||
id: (m.id || m.member_id || m.memberId || ''),
|
||
workbench_id: (m.workbench_id ?? m.workbenchId ?? wbId ?? ''),
|
||
user_id: (m.user_id ?? m.userId ?? m.wms_account_id ?? m.wmsAccountId ?? null),
|
||
user_name: String(m.user_name ?? m.userName ?? m.real_name ?? m.realName ?? m.name ?? '')
|
||
}))
|
||
.filter((m) => m.id || m.user_name);
|
||
},
|
||
// 应用成员列表:写入 workbenchMembers + 本地缓存,并同步 boundOperators(现有业务依赖)
|
||
// 同一 user_id 只保留一个(服务端重复绑定会产生多行成员,显示/上报需去重)
|
||
applyWorkbenchMembers(members) {
|
||
const seen = new Set();
|
||
const list = (Array.isArray(members) ? members : []).filter((m) => {
|
||
if (!m || (!m.id && !m.user_name)) return false;
|
||
const uid = m.user_id;
|
||
const key = (uid !== null && uid !== undefined && uid !== '') ? ('uid_' + uid) : ('id_' + m.id);
|
||
if (seen.has(key)) return false;
|
||
seen.add(key);
|
||
return true;
|
||
});
|
||
this.workbenchMembers = list;
|
||
try {
|
||
uni.setStorageSync(MEMBER_STORAGE_KEY, list);
|
||
} catch (e) {}
|
||
const wbId = String(this.workbenchId || '');
|
||
this.boundOperators = list
|
||
.map((m) => ({
|
||
memberId: m.id === null || m.id === undefined ? '' : String(m.id),
|
||
workbenchId: String(m.workbench_id || wbId),
|
||
userId: (m.user_id === null || m.user_id === undefined || m.user_id === '') ? '' : String(m.user_id),
|
||
userName: String(m.user_name || '')
|
||
}))
|
||
.filter((op) => op.memberId);
|
||
try {
|
||
uni.setStorageSync('workbenchOperators', this.boundOperators);
|
||
} catch (e) {}
|
||
},
|
||
// 恢复本地缓存的工作台成员列表(服务端 members 缓存;缺失时用 boundOperators 兜底保持一致)
|
||
restoreWorkbenchMembers() {
|
||
let cached = null;
|
||
try {
|
||
cached = uni.getStorageSync(MEMBER_STORAGE_KEY);
|
||
} catch (e) {}
|
||
if (Array.isArray(cached) && cached.length) {
|
||
this.applyWorkbenchMembers(cached.filter((m) => m && (m.id || m.user_name)));
|
||
return;
|
||
}
|
||
// 无新缓存:用 boundOperators 兜底映射,保持 workbenchMembers 与 boundOperators 一致
|
||
const list = (Array.isArray(this.boundOperators) ? this.boundOperators : [])
|
||
.filter((op) => op && op.memberId);
|
||
this.workbenchMembers = list.map((op) => ({
|
||
id: String(op.memberId),
|
||
workbench_id: String(op.workbenchId || this.workbenchId || ''),
|
||
user_id: (op.userId === null || op.userId === undefined || op.userId === '') ? null : op.userId,
|
||
user_name: String(op.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');
|
||
},
|
||
// ===== 工牌码(base64 JSON 含 uuid)识别:主搜索框扫描新操作员工牌 → 新增绑定 =====
|
||
decodeBase64Text(value) {
|
||
if (!value) return '';
|
||
if (typeof atob !== 'function') return '';
|
||
const normalized = String(value).replace(/-/g, '+').replace(/_/g, '/');
|
||
const binary = atob(normalized);
|
||
try {
|
||
return decodeURIComponent(Array.prototype.map.call(binary, char => {
|
||
const code = char.charCodeAt(0).toString(16).padStart(2, '0');
|
||
return `%${code}`;
|
||
}).join(''));
|
||
} catch (e) {
|
||
return binary;
|
||
}
|
||
},
|
||
isBase64Text(value) {
|
||
if (!value) return false;
|
||
const text = String(value).trim().replace(/\s/g, '');
|
||
return /^[A-Za-z0-9+/=_-]+$/.test(text) && text.length % 4 === 0;
|
||
},
|
||
// 解析工牌码:仅用于识别「扫描值是工牌码(base64 JSON 含 uuid)还是运单条码」,返回 { ok, uuid }
|
||
parseBadgeCode(scanText) {
|
||
const raw = String(scanText || '').trim().replace(/\s+/g, '');
|
||
if (!raw) return { ok: false, uuid: '' };
|
||
let obj = null;
|
||
try {
|
||
const parsed = JSON.parse(raw);
|
||
if (parsed && typeof parsed === 'object') obj = parsed;
|
||
} catch (e) {}
|
||
if (!obj && this.isBase64Text(raw)) {
|
||
const decoded = this.decodeBase64Text(raw);
|
||
if (decoded) {
|
||
try {
|
||
const parsed = JSON.parse(decoded);
|
||
if (parsed && typeof parsed === 'object') obj = parsed;
|
||
} catch (e) {}
|
||
}
|
||
}
|
||
if (!obj || typeof obj !== 'object') return { ok: false, uuid: '' };
|
||
const uuid = String(obj.uuid || '').trim();
|
||
if (!uuid) return { ok: false, uuid: '' };
|
||
return { ok: true, uuid };
|
||
},
|
||
// 主搜索框扫到工牌码(base64 JSON 含 uuid)→ 识别该用户并新增绑定(已在线的同名/同 user_id 仅提示)
|
||
async handleBadgeScan(scanText) {
|
||
const parsed = this.parseBadgeCode(scanText);
|
||
if (!parsed.ok) return false;
|
||
// 请求参数按扫描值(原样),不做解码处理:ye4s_user.tmp_code 存的是扫描原文
|
||
const token = String(scanText || '').trim();
|
||
if (!token) return false;
|
||
// 识别该用户(queryUserByToken:ye4s 临时码 → real_name / wms_account_id)
|
||
let ident = null;
|
||
uni.showLoading({ title: '识别中...', mask: true });
|
||
try {
|
||
const res = await this.$http('index.queryUserByToken', { token }, '', 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) {
|
||
const rawWmsId = data?.wms_account_id ?? data?.wmsAccountId;
|
||
ident = {
|
||
name,
|
||
wmsAccountId: (rawWmsId === null || rawWmsId === undefined || rawWmsId === '') ? null : Number(rawWmsId)
|
||
};
|
||
}
|
||
} else {
|
||
const code = Number(res?.code);
|
||
if (this.handleWorkbenchAuthExpired(code)) return true;
|
||
const msg = String(res?.message || res?.msg || '');
|
||
uni.showToast({ title: code === 404 ? '未找到对应用户' : (msg || '识别失败,请重试'), icon: 'none' });
|
||
this.speakText('识别失败');
|
||
return true;
|
||
}
|
||
} catch (error) {
|
||
console.error('[packMode] 识别操作员失败:', error);
|
||
uni.showToast({ title: error?.message || '识别失败,请重试', icon: 'none' });
|
||
return true;
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
if (!ident) {
|
||
uni.showToast({ title: '未识别到操作员姓名', icon: 'none' });
|
||
return true;
|
||
}
|
||
// 已在线的同名/同 user_id 成员:再次扫描同一工牌 = 下线(移除该操作员)
|
||
const matchedMembers = (Array.isArray(this.workbenchMembers) ? this.workbenchMembers : []).filter((m) => {
|
||
if (!m) return false;
|
||
const mn = String(m.user_name || '').trim();
|
||
if (mn && mn === ident.name) return true;
|
||
if (ident.wmsAccountId !== null && ident.wmsAccountId !== undefined && m.user_id !== null && m.user_id !== undefined) {
|
||
return String(m.user_id) === String(ident.wmsAccountId);
|
||
}
|
||
return false;
|
||
});
|
||
if (matchedMembers.length) {
|
||
this.orderBarcode = '';
|
||
const ids = matchedMembers.map((m) => String(m && m.id || '').trim()).filter(Boolean);
|
||
if (ids.length) {
|
||
// 再次扫描同一操作员工牌:下线(移除该操作员)。
|
||
// doRemoveOperators 内部处理:仍有其他成员在线 → 打包任务不受影响;全员下线 → 先 finishPack 再 clearPackState
|
||
await this.doRemoveOperators(ids, { toastText: '操作员已下线' });
|
||
} else {
|
||
// 兜底:缓存成员缺少行 id(异常数据),无法下线,仅提示在线
|
||
uni.showToast({ title: `${ident.name} 已在线`, icon: 'none' });
|
||
this.speakText(`${ident.name} 已在线`);
|
||
}
|
||
return true;
|
||
}
|
||
// 未绑定过:调用 doBindOperator 追加为新在线成员
|
||
const result = await this.doBindOperator({ name: ident.name, wmsAccountId: ident.wmsAccountId });
|
||
if (result && result.ok) {
|
||
this.orderBarcode = '';
|
||
} else if (result && !result.expired && result.error) {
|
||
uni.showToast({ title: result.error, icon: 'none' });
|
||
}
|
||
return true;
|
||
},
|
||
// 按 ye4s 登录临时码识别操作员(index.queryUserByToken),成功后进入待绑定态
|
||
// 请求参数按扫描值(原样),不做解码处理:ye4s_user.tmp_code 存的是扫描原文
|
||
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 result = await this.doBindOperator({
|
||
name: ident.name,
|
||
wmsAccountId: ident.wmsAccountId
|
||
});
|
||
if (result && result.ok) {
|
||
// 重置识别待绑定态并关闭弹窗(顶部按钮自动变为“已绑定”)
|
||
this.opScanCode = '';
|
||
this.opQueryState = '';
|
||
this.opQueryResult = null;
|
||
this.opQueryError = '';
|
||
this.userDrawerOpen = false;
|
||
this.opInputFocus = false;
|
||
} else if (result && !result.expired) {
|
||
// 绑定失败:进入待绑定态,保留识别结果,展示「绑定」按钮供手动重试
|
||
this.opQueryState = 'identified';
|
||
uni.showToast({ title: result.error || '绑定操作员失败,请点击绑定重试', icon: 'none' });
|
||
this.speakText('绑定失败,请点击绑定重试');
|
||
}
|
||
},
|
||
// 绑定操作员核心逻辑(弹窗识别 / 主搜索框扫工牌新增绑定共用):
|
||
// 调用 workbench.bindMember 成功后把新成员追加进 workbenchMembers(同名/同 id 更新,不同用户叠加绑定)
|
||
async doBindOperator({ name, wmsAccountId }) {
|
||
const token = String(this.workbenchToken || '').trim();
|
||
if (!token) {
|
||
uni.showToast({ title: '工作台 token 缺失', icon: 'none' });
|
||
return { ok: false, error: '工作台 token 缺失' };
|
||
}
|
||
if (this.opBinding) return { ok: false, busy: true };
|
||
this.opBinding = true;
|
||
uni.showLoading({ title: '绑定中...', mask: true });
|
||
try {
|
||
const res = await this.$http('workbench.bindMember', {
|
||
userId: wmsAccountId !== null && wmsAccountId !== undefined ? wmsAccountId : null,
|
||
userName: 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 { ok: false, expired: true };
|
||
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 使用),追加到当前操作员列表
|
||
const mid = String(memberId);
|
||
const member = {
|
||
id: mid,
|
||
workbench_id: String(this.workbenchId || ''),
|
||
user_id: wmsAccountId !== null && wmsAccountId !== undefined ? String(wmsAccountId) : null,
|
||
user_name: String(name)
|
||
};
|
||
const wmList = Array.isArray(this.workbenchMembers) ? this.workbenchMembers.slice() : [];
|
||
// 同名/同 id 更新,不同用户叠加绑定
|
||
const wmIdx = wmList.findIndex((m) => String(m && m.id) === mid);
|
||
if (wmIdx >= 0) {
|
||
wmList[wmIdx] = member;
|
||
} else {
|
||
wmList.push(member);
|
||
}
|
||
this.applyWorkbenchMembers(wmList);
|
||
uni.removeStorageSync('workbenchOperator'); // 清理旧版单操作员缓存
|
||
uni.showToast({ title: '操作员绑定成功', icon: 'success' });
|
||
this.speakText(`${name} 绑定成功`);
|
||
// 绑定后静默重拉工作台信息,成员列表以服务端为准
|
||
this.fetchWorkbenchInfo({ silent: true });
|
||
// 重新绑定成员后重启无新任务自动登出计时
|
||
this.scheduleIdleAutoLogout();
|
||
return { ok: true, member };
|
||
} catch (error) {
|
||
console.error('[packMode] 绑定操作员失败:', error);
|
||
return { ok: false, error: error?.message || '绑定操作员失败' };
|
||
} finally {
|
||
uni.hideLoading();
|
||
this.opBinding = false;
|
||
}
|
||
},
|
||
// 下线单个在线操作员(workbench.removeMember):打开二次确认弹窗(避免 uni.showModal 被操作员弹窗覆盖)
|
||
handleOfflineMember(member) {
|
||
const id = String(member && member.id || '').trim();
|
||
if (!id) return;
|
||
this.offlineMembers = [member];
|
||
this.offlinePopupOpen = true;
|
||
},
|
||
// 切换批量下线勾选状态
|
||
toggleOfflineSelect(member) {
|
||
const id = String(member && member.id || '').trim();
|
||
if (!id) return;
|
||
const set = new Set(this.offlineSelectedIds);
|
||
if (set.has(id)) {
|
||
set.delete(id);
|
||
} else {
|
||
set.add(id);
|
||
}
|
||
this.offlineSelectedIds = Array.from(set);
|
||
},
|
||
// 是否已勾选该成员(批量下线)
|
||
isMemberSelected(member) {
|
||
const id = String(member && member.id || '').trim();
|
||
return !!id && this.offlineSelectedIds.indexOf(id) !== -1;
|
||
},
|
||
// 全选 / 取消全选
|
||
toggleSelectAllOffline() {
|
||
const list = Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [];
|
||
if (this.allMembersSelected) {
|
||
this.offlineSelectedIds = [];
|
||
} else {
|
||
this.offlineSelectedIds = list
|
||
.map(m => String(m && m.id || '').trim())
|
||
.filter(Boolean);
|
||
}
|
||
},
|
||
// 批量下线:勾选成员一次打开确认弹窗
|
||
handleBatchOffline() {
|
||
const ids = this.offlineSelectedIds;
|
||
if (!ids.length) {
|
||
uni.showToast({ title: '请先勾选要下线的操作员', icon: 'none' });
|
||
return;
|
||
}
|
||
const idSet = new Set(ids);
|
||
const members = (Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [])
|
||
.filter(m => idSet.has(String(m && m.id || '')));
|
||
if (!members.length) return;
|
||
this.offlineMembers = members;
|
||
this.offlinePopupOpen = true;
|
||
},
|
||
// 关闭下线操作员二次确认弹窗
|
||
handleCloseOfflinePopup() {
|
||
this.offlinePopupOpen = false;
|
||
this.offlineMembers = [];
|
||
},
|
||
// 确认下线:移除勾选 / 单个成员行(支持多人一次性下线)
|
||
async confirmOfflineMember() {
|
||
const members = Array.isArray(this.offlineMembers) ? this.offlineMembers : [];
|
||
const ids = members
|
||
.map(m => String(m && m.id || '').trim())
|
||
.filter(Boolean);
|
||
this.offlinePopupOpen = false;
|
||
this.offlineMembers = [];
|
||
// 清理已下线的勾选状态(批量下线后重新计算)
|
||
const removedSet = new Set(ids);
|
||
this.offlineSelectedIds = this.offlineSelectedIds.filter(id => !removedSet.has(id));
|
||
if (!ids.length) return;
|
||
await this.doRemoveOperators(ids);
|
||
},
|
||
// 执行移除成员请求(silent=true 时为退出工作台前的静默解绑:不弹 loading/toast/语音)
|
||
// 支持一次移除多个操作员(ids 传数组);全员下线(移除后无成员)时先 finishPack 再 clearPackState() 清空订单数据
|
||
async doRemoveOperators(ids, opts = {}) {
|
||
const silent = !!opts.silent;
|
||
const idList = (Array.isArray(ids) ? ids : [ids])
|
||
.map(v => String(v == null ? '' : v).trim())
|
||
.filter(Boolean);
|
||
if (!idList.length) {
|
||
if (!silent) uni.showToast({ title: '成员行ID不能为空', icon: 'none' });
|
||
return { ok: false, error: '成员行ID不能为空' };
|
||
}
|
||
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 {
|
||
const res = await this.$http('workbench.removeMember', {
|
||
ids: idList.map(Number),
|
||
token
|
||
});
|
||
const bizCode = Number(res?.code);
|
||
// 404:成员行已不存在(已被其它设备移除/下线),视为已移除,继续走本地清理流程
|
||
const missing = bizCode === 404;
|
||
const invalid = !missing && (res?.flag === 'failure' || [400, 403].indexOf(bizCode) !== -1);
|
||
if (invalid) {
|
||
// 401:工作台 token 失效,退出工作台模式并清除 token 回登录页
|
||
if (this.handleWorkbenchAuthExpired(bizCode)) return { ok: false, expired: true };
|
||
throw new Error(res?.message || '移除操作员失败');
|
||
}
|
||
// 从本地列表移除已移除的成员行(同步 workbenchMembers 与 boundOperators)
|
||
const removedSet = new Set(idList);
|
||
const removedNames = (Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [])
|
||
.filter(m => removedSet.has(String(m && m.id || '')))
|
||
.map(m => String((m && m.user_name) || '').trim())
|
||
.filter(Boolean);
|
||
const wmList = (Array.isArray(this.workbenchMembers) ? this.workbenchMembers : [])
|
||
.filter(m => !removedSet.has(String(m && m.id || '')));
|
||
if (wmList.length) {
|
||
this.applyWorkbenchMembers(wmList);
|
||
} else {
|
||
// 全员下线:清空成员列表与本地缓存
|
||
this.workbenchMembers = [];
|
||
uni.removeStorageSync(MEMBER_STORAGE_KEY);
|
||
this.boundOperators = [];
|
||
uni.removeStorageSync('workbenchOperators');
|
||
}
|
||
this.opScanCode = '';
|
||
this.opQueryState = '';
|
||
this.opQueryResult = null;
|
||
this.opQueryError = '';
|
||
// 全员下线(移除后工作台已无任何成员):先 finishPack 再 clearPackState() 清空订单数据
|
||
if (!this.boundOperators.length) {
|
||
const fr = await this.requestFinishPack();
|
||
if (fr && fr.expired) return { ok: false, expired: true };
|
||
this.clearPackState();
|
||
// 全员已下线:停止无新任务自动登出计时(重新绑定后由 doBindOperator 重启)
|
||
this.clearIdleAutoLogoutTimer();
|
||
}
|
||
if (!silent) {
|
||
uni.showToast({ title: opts.toastText || '操作员已移除', icon: 'success' });
|
||
const removedNameText = removedNames.length ? removedNames.join('、') : '';
|
||
this.speakText(removedNameText ? `${removedNameText} 移除成功` : '移除成功');
|
||
// 移除成功后关闭操作员弹窗
|
||
this.handleCloseUserDrawer();
|
||
// 下线后静默重拉工作台信息,成员列表以服务端为准(退出流程 silent 不重拉)
|
||
this.fetchWorkbenchInfo({ silent: true });
|
||
}
|
||
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;
|
||
}
|
||
},
|
||
// 清空订单打包状态与查询/核实数据(全员下线、退出工作台时调用)
|
||
clearPackState() {
|
||
this.orderBarcode = '';
|
||
this.orderQueryState = '';
|
||
this.orderQueryResult = null;
|
||
this.orderQueryError = '';
|
||
this.packContextKey = '';
|
||
this.groupVerified = {};
|
||
this.groupAutoSubmitted = false;
|
||
this.hasActivePack = false;
|
||
this.activePackIdentity = '';
|
||
this.activePackIsSandan = null;
|
||
this.packRestored = false;
|
||
this.clearPackWait();
|
||
},
|
||
// 启动大团购打包时长闸门倒计时(waitSeconds>0 且 startTime>0 时启动,否则清除)
|
||
startPackWaitCountdown(waitSeconds, startTime) {
|
||
this.clearPackWaitTimer();
|
||
const ws = Number(waitSeconds) || 0;
|
||
const st = Number(startTime) || 0;
|
||
this.packWaitSeconds = ws;
|
||
this.packStartTime = st;
|
||
if (ws > 0 && st > 0) {
|
||
this.updatePackWaitRemain();
|
||
this.packWaitTimer = setInterval(() => {
|
||
this.updatePackWaitRemain();
|
||
if (this.packWaitRemain <= 0) {
|
||
this.clearPackWaitTimer();
|
||
}
|
||
}, 1000);
|
||
} else {
|
||
this.packWaitRemain = 0;
|
||
}
|
||
},
|
||
// 刷新倒计时剩余秒数(remaining = waitSeconds - 已过去秒数)
|
||
updatePackWaitRemain() {
|
||
if (this.packWaitSeconds <= 0 || this.packStartTime <= 0) {
|
||
this.packWaitRemain = 0;
|
||
return;
|
||
}
|
||
const elapsed = Math.floor((Date.now() - this.packStartTime) / 1000);
|
||
this.packWaitRemain = Math.max(0, this.packWaitSeconds - elapsed);
|
||
},
|
||
// 清除倒计时定时器(页面卸载/任务结束时调用,避免 interval 泄漏)
|
||
clearPackWaitTimer() {
|
||
if (this.packWaitTimer) {
|
||
clearInterval(this.packWaitTimer);
|
||
this.packWaitTimer = null;
|
||
}
|
||
},
|
||
// 清空大团购打包时长闸门倒计时状态(打包任务结束 / 清空打包状态时调用)
|
||
clearPackWait() {
|
||
this.clearPackWaitTimer();
|
||
this.packWaitSeconds = 0;
|
||
this.packStartTime = 0;
|
||
this.packWaitRemain = 0;
|
||
this.packWaveScope = null;
|
||
},
|
||
// 读取本地已绑定信息(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;
|
||
},
|
||
// 从 getWorkbenchInfo 响应恢复「进行中的打包任务」:服务端是唯一事实来源,
|
||
// 把服务端记录的未结束任务画回界面(商品明细全部视为已核实、显示打包中、跳过拦截/已打包/预检)
|
||
restoreCurrentPackTask(raw) {
|
||
const src = raw && typeof raw === 'object' ? raw : {};
|
||
const wave = src.current_wave ?? src.currentWave;
|
||
const orders = src.current_orders ?? src.currentOrders ?? src.current_order ?? src.currentOrder;
|
||
|
||
const hasWave = !!(wave && typeof wave === 'object' && Object.keys(wave).length);
|
||
// 汇总进行中任务的订单(orders 可为数组或单个对象;空对象/空数组视为无进行中任务)
|
||
const orderList = Array.isArray(orders)
|
||
? orders.filter((od) => od && typeof od === 'object' && Object.keys(od).length)
|
||
: (orders && typeof orders === 'object' && Object.keys(orders).length) ? [orders] : [];
|
||
|
||
// 无进行中任务则不恢复(服务端无任务时可能返回空对象/空数组,需按“非空”判断)
|
||
if (!hasWave && !orderList.length) return;
|
||
|
||
const isSandan = hasWave ? 0 : 1;
|
||
|
||
let items = [];
|
||
orderList.forEach((od) => {
|
||
if (Array.isArray(od && od.items)) items = items.concat(od.items);
|
||
});
|
||
|
||
const waveNo = String(
|
||
(wave && (wave.wave_no ?? wave.waveNo)) ||
|
||
(orderList[0] && (orderList[0].wave_no ?? orderList[0].waveNo)) || ''
|
||
).trim();
|
||
// 散单恢复运单号:waybill_code(运单号)优先,express.waybill_code 次之,delivery_order_code(发货单号)最后兜底;
|
||
// 用 || 跳过空字符串;团购为波次,无单一运单号,置空
|
||
const firstOrder = orderList[0] || {};
|
||
const express = firstOrder.express || {};
|
||
const waybill = hasWave
|
||
? ''
|
||
: String(
|
||
firstOrder.waybill_code ||
|
||
express.waybill_code ||
|
||
firstOrder.delivery_order_code ||
|
||
firstOrder.waybillCode ||
|
||
firstOrder.barcode ||
|
||
''
|
||
).trim();
|
||
// 波次总单数:current_wave.order_count 优先,兜底 current_orders 数量
|
||
const rawTotal = wave && (wave.order_count ?? wave.total_orders ?? wave.totalOrders);
|
||
const totalOrders = (rawTotal !== undefined && rawTotal !== null) ? rawTotal : orderList.length;
|
||
|
||
const mappedItems = items.map((it, i) => {
|
||
const o = it || {};
|
||
// 实际字段:item_id(wms_item id)为主;item.id 可能为 0(无效),不能用于核实 key
|
||
const rawId = o.item_id ?? o.itemId ?? o.sku_id ?? o.id;
|
||
const hasValidId = rawId !== undefined && rawId !== null && rawId !== 0 && rawId !== '';
|
||
return {
|
||
id: hasValidId ? rawId : i,
|
||
plan_qty: Number((o.plan_qty ?? o.qty ?? o.num) || 1) || 1,
|
||
item_name: String((o.item_name ?? o.itemName ?? o.name ?? o.sku_name) || '').trim(),
|
||
item_code: String((o.item_code ?? o.itemCode ?? o.sku_code) || '').trim(),
|
||
barcodes: o.barcodes ?? o.barcode,
|
||
image_url: o.image_url ?? o.imageUrl ?? o.image,
|
||
need_recheck: o.need_recheck,
|
||
packing_requirements: o.packing_requirements
|
||
};
|
||
});
|
||
|
||
this.orderQueryResult = {
|
||
isSandan,
|
||
waybill_code: waybill,
|
||
barcode: waybill,
|
||
key: '', // 恢复态无需再发起 packOrder,不携带打包上下文 key
|
||
store_remark: String((orderList[0] && (orderList[0].store_remark ?? orderList[0].storeRemark)) || ''),
|
||
// 散单恢复运单信息(包材名称/物流公司/称重重量);团购 express 为 null,置 undefined
|
||
express: hasWave ? undefined : {
|
||
waybill_code: express.waybill_code,
|
||
logistics_name: express.logistics_name,
|
||
weighing_weight: express.weighing_weight,
|
||
package_material_name: express.package_material_name
|
||
},
|
||
batch: hasWave ? { wave_no: waveNo, total_orders: totalOrders } : undefined,
|
||
order: {
|
||
wave_no: waveNo,
|
||
recheck_status: 'fin', // 恢复态跳过未复核判断
|
||
pack_status: 'packing', // 恢复态跳过已打包判断(packRestored 兜底)
|
||
items_count: mappedItems.length,
|
||
items_total: mappedItems.reduce((s, it) => s + (Number(it.plan_qty) || 0), 0)
|
||
},
|
||
items: mappedItems
|
||
};
|
||
|
||
// 恢复「打包中」状态:全部商品视为已核实
|
||
const verified = {};
|
||
mappedItems.forEach((it, i) => {
|
||
verified[this.groupItemKey(it, i)] = Math.max(1, Number(it.plan_qty) || 1);
|
||
});
|
||
// 先置 groupAutoSubmitted 再写 groupVerified,避免 groupAllVerified 变化触发重复提交打包
|
||
this.groupAutoSubmitted = true;
|
||
this.groupVerified = verified;
|
||
this.orderQueryState = 'success';
|
||
this.orderQueryError = '';
|
||
this.orderBarcode = '';
|
||
this.packContextKey = '';
|
||
this.hasActivePack = true;
|
||
this.activePackIdentity = this.orderIdentity(this.orderQueryResult);
|
||
this.activePackIsSandan = this.orderQueryIsSandan;
|
||
this.packRestored = true; // 跳过拦截/已打包/预检,展示进行中任务
|
||
// 恢复大团购打包时长闸门倒计时(服务端在恢复响应中下发 wait_seconds/start_time 时续上倒计时)
|
||
const rawWait = raw?.pack_wait_seconds ?? raw?.packWaitSeconds ?? wave?.pack_wait_seconds ?? wave?.packWaitSeconds;
|
||
const rawStart = raw?.pack_start_time ?? raw?.packStartTime ?? wave?.pack_start_time ?? wave?.packStartTime;
|
||
if ((Number(rawWait) || 0) > 0 && (Number(rawStart) || 0) > 0) {
|
||
this.startPackWaitCountdown(rawWait, rawStart);
|
||
}
|
||
const rawScope = raw?.wave_scope ?? raw?.waveScope ?? wave?.wave_scope ?? wave?.waveScope;
|
||
if (rawScope !== undefined && rawScope !== null && rawScope !== '') {
|
||
this.packWaveScope = Number(rawScope);
|
||
}
|
||
console.log('[packMode] 恢复进行中打包任务:', { isSandan, waveNo, waybill, items: mappedItems.length });
|
||
},
|
||
// 重新拉取工作台信息:进入打包模式时校验本地工作台 token 并刷新工作台信息
|
||
// silent=true:静默刷新(绑定/下线成功后重拉同步成员),失败不弹 toast
|
||
async fetchWorkbenchInfo(options = {}) {
|
||
const silent = !!options.silent;
|
||
const token = String(this.workbenchToken || '').trim();
|
||
if (!token) return;
|
||
if (silent) {
|
||
if (this.infoRefreshingSilent) return;
|
||
this.infoRefreshingSilent = true;
|
||
} else {
|
||
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);
|
||
// 同步工作台在线成员列表(服务端 members 为权威,含绑定/下线后的最新状态)
|
||
if (Array.isArray(data?.members)) {
|
||
this.applyWorkbenchMembers(this.normalizeWorkbenchMembers(data.members, detail.id));
|
||
}
|
||
// 恢复进行中的打包任务(服务端是唯一事实来源:current_wave / current_orders)
|
||
this.restoreCurrentPackTask(data);
|
||
console.log('[packMode] 工作台信息刷新成功:', detail);
|
||
} catch (error) {
|
||
// 网络/其它异常:保留本地缓存信息继续使用,仅提示,不清除会话
|
||
console.warn('[packMode] 工作台信息刷新失败,沿用本地缓存:', error);
|
||
if (!silent) {
|
||
uni.showToast({ title: '工作台信息刷新失败', icon: 'none' });
|
||
}
|
||
} finally {
|
||
if (silent) {
|
||
this.infoRefreshingSilent = false;
|
||
} else {
|
||
this.infoRefreshing = false;
|
||
}
|
||
}
|
||
},
|
||
// 拉取今日打包统计(workbench.getWorkbenchCount):班次日 08:00~次日 08:00;失败静默,不阻断打包流程
|
||
async loadTodayPackStat() {
|
||
const token = String(this.workbenchToken || '').trim();
|
||
if (!token) return;
|
||
try {
|
||
// toastAfter=false:失败提示由本方法自行控制(静默)
|
||
const res = await this.$http('workbench.getWorkbenchCount', { token }, '', false);
|
||
const invalid = res?.flag === 'failure' || [401, 403].indexOf(Number(res?.code)) !== -1;
|
||
if (invalid) {
|
||
// 401:工作台 token 失效,退出工作台模式回登录页;其余(403 等)静默忽略
|
||
if (this.handleWorkbenchAuthExpired(res?.code)) return;
|
||
console.warn('[packMode] 今日打包统计失败:', res?.message || res?.code);
|
||
return;
|
||
}
|
||
const data = (res && typeof res === 'object' && res.data && typeof res.data === 'object') ? res.data : res;
|
||
if (!data || typeof data !== 'object') return;
|
||
// 统计值 Number(x) || 0 兜底;ratio/avg 用 ?? null 保留 null(散单为 0 时 ratio 为 null)
|
||
this.todayWaveCount = Number(data.group_wave_count) || 0;
|
||
this.todayGroupOrderCount = Number(data.group_order_count) || 0;
|
||
this.todaySingleCount = Number(data.single_order_count) || 0;
|
||
this.todayRatio = data.group_single_ratio ?? null;
|
||
this.todayAvgPiece = data.avg_piece_count ?? null;
|
||
} catch (error) {
|
||
console.warn('[packMode] 今日打包统计拉取失败:', error);
|
||
}
|
||
},
|
||
// 打开今日打包统计面板
|
||
openTodayPackPanel() {
|
||
this.todayPackPanelOpen = true;
|
||
},
|
||
// 关闭今日打包统计面板
|
||
closeTodayPackPanel() {
|
||
this.todayPackPanelOpen = false;
|
||
},
|
||
// 退出工作台模式(用户主动):打开退出确认弹窗
|
||
handleBack() {
|
||
this.exitPopupOpen = true;
|
||
},
|
||
// 确认退出工作台
|
||
async confirmExit() {
|
||
this.exitPopupOpen = false;
|
||
// 退出工作台 = 同时解绑操作员:操作员已绑定时先静默批量解绑(不弹提示,随后统一退出)
|
||
const ids = this.boundOperators.map(op => String(op && op.memberId || '').trim()).filter(Boolean);
|
||
if (ids.length && String(this.workbenchToken || '').trim()) {
|
||
const unbind = await this.doRemoveOperators(ids, { silent: true });
|
||
// 401 已由 handleWorkbenchAuthExpired 处理退出并回登录页,无需重复退出
|
||
if (unbind && unbind.expired) return;
|
||
}
|
||
await this.exitWorkbench(false);
|
||
},
|
||
// 关闭退出弹窗
|
||
handleCloseExitPopup() {
|
||
this.exitPopupOpen = false;
|
||
},
|
||
// 清除工作台 token 并返回登录页:工作台会话(主 token 即工作台 token)时一并清除主登录态
|
||
async exitWorkbench(withToast = false) {
|
||
this.clearIdleAutoLogoutTimer();
|
||
const wbToken = String(uni.getStorageSync('workbenchToken') || '').trim();
|
||
const mainToken = String(uni.getStorageSync('token') || '').trim();
|
||
uni.removeStorageSync('workbenchToken');
|
||
uni.removeStorageSync('workbenchInfo');
|
||
// 退出工作台同时清除本地操作员绑定记录,避免下次进入误恢复旧操作员
|
||
uni.removeStorageSync('workbenchOperator');
|
||
uni.removeStorageSync('workbenchOperators');
|
||
uni.removeStorageSync(MEMBER_STORAGE_KEY);
|
||
this.workbenchMembers = [];
|
||
this.boundOperators = [];
|
||
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__exit {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 56rpx;
|
||
height: 64rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.today-pack-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-left: 16rpx;
|
||
padding: 8rpx 16rpx;
|
||
border-radius: 8rpx;
|
||
background: #2979ff;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.today-pack-btn__text {
|
||
font-size: 30rpx;
|
||
color: #ffffff;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.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: #909399;
|
||
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;
|
||
}
|
||
|
||
/* 大团购打包时长闸门倒计时条 */
|
||
.pack-wait-bar {
|
||
margin-top: 16rpx;
|
||
background: #fdf6ec;
|
||
border: 2rpx solid #f3d19e;
|
||
border-radius: 16rpx;
|
||
padding: 16rpx 20rpx;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.pack-wait-bar__text {
|
||
font-size: 30rpx;
|
||
color: #b88230;
|
||
margin-left: 10rpx;
|
||
}
|
||
|
||
.pack-wait-bar__time {
|
||
font-size: 34rpx;
|
||
font-weight: bold;
|
||
color: #e6a23c;
|
||
margin-left: 8rpx;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
/* 已绑定态顶部工作台卡并入 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-summary__num--green {
|
||
color: #07c160;
|
||
}
|
||
|
||
.order-summary__stat-row {
|
||
justify-content: space-between;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.order-summary__stat {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
min-width: 0;
|
||
}
|
||
|
||
.order-summary__stat-group {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.order-summary__stat-group .order-summary__stat + .order-summary__stat {
|
||
margin-left: 24rpx;
|
||
}
|
||
|
||
.order-summary__stat--picker {
|
||
flex: 0 1 auto;
|
||
max-width: 100%;
|
||
}
|
||
|
||
.order-summary__stat-label {
|
||
font-size: 30rpx;
|
||
color: #909399;
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.order-summary__stat-label--picker {
|
||
flex-shrink: 0;
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.order-summary__picker {
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: 34rpx;
|
||
font-weight: bold;
|
||
color: #303133;
|
||
word-break: break-all;
|
||
line-height: 1.4;
|
||
}
|
||
|
||
/* 禁止打包:运单/波次行红底 */
|
||
.order-summary__row--blocked {
|
||
background: #e64340;
|
||
border-radius: 8rpx;
|
||
padding: 8rpx 12rpx;
|
||
}
|
||
|
||
.order-summary__row--blocked .order-summary__label,
|
||
.order-summary__row--blocked .order-summary__value,
|
||
.order-summary__row--blocked .order-summary__extra,
|
||
.order-summary__row--blocked .order-summary__num,
|
||
.order-summary__row--blocked .order-result-tag {
|
||
color: #ffffff;
|
||
}
|
||
|
||
/* 打包上报失败提示条:浅红底红字 */
|
||
.order-summary__row--retry {
|
||
background: #fdeceb;
|
||
border-radius: 8rpx;
|
||
padding: 10rpx 12rpx;
|
||
justify-content: center;
|
||
}
|
||
|
||
.order-summary__retry-text {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: #e64340;
|
||
line-height: 1.5;
|
||
text-align: center;
|
||
}
|
||
|
||
.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-block--blocked {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.order-block__hint {
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
color: #e64340;
|
||
text-align: center;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.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-item__requirement {
|
||
margin-top: 8rpx;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.order-item__requirement-text {
|
||
display: inline-block;
|
||
font-size: 34rpx;
|
||
color: #e64340;
|
||
background: #fef0f0;
|
||
border-radius: 6rpx;
|
||
padding: 2rpx 10rpx;
|
||
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;
|
||
}
|
||
|
||
.order-item--verified .order-item__requirement-text {
|
||
color: #e64340;
|
||
background: #fef0f0;
|
||
}
|
||
|
||
.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: 680rpx;
|
||
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: 56rpx;
|
||
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;
|
||
}
|
||
|
||
.member-section {
|
||
margin-bottom: 24rpx;
|
||
background: #f5f6f7;
|
||
border-radius: 16rpx;
|
||
padding: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.member-section__header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.member-select-all {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.member-select-all .member-checkbox {
|
||
margin-right: 12rpx;
|
||
}
|
||
|
||
.member-section__title {
|
||
flex: 1;
|
||
font-size: 34rpx;
|
||
color: #909399;
|
||
line-height: 1.4;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.member-section__count {
|
||
flex-shrink: 0;
|
||
margin-left: 16rpx;
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
color: #2979ff;
|
||
}
|
||
|
||
.member-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
max-height: 320rpx;
|
||
overflow-y: auto;
|
||
-webkit-overflow-scrolling: touch;
|
||
}
|
||
|
||
.member-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 18rpx 20rpx;
|
||
background: #ffffff;
|
||
border-radius: 12rpx;
|
||
border: 2rpx solid #e4e7ed;
|
||
}
|
||
|
||
.member-item:not(:last-child) {
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.member-item__info {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.member-item__name {
|
||
margin-left: 16rpx;
|
||
font-size: 46rpx;
|
||
color: #303133;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.member-checkbox {
|
||
flex-shrink: 0;
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
border-radius: 8rpx;
|
||
border: 2rpx solid #c0c4cc;
|
||
background: #ffffff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.member-checkbox--checked {
|
||
background: #2979ff;
|
||
border-color: #2979ff;
|
||
}
|
||
|
||
.member-checkbox__icon {
|
||
font-size: 36rpx;
|
||
color: #ffffff;
|
||
line-height: 1;
|
||
}
|
||
|
||
.member-batch-bar {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-top: 16rpx;
|
||
padding: 12rpx 20rpx;
|
||
background: #ecf5ff;
|
||
border-radius: 12rpx;
|
||
}
|
||
|
||
.member-batch-bar__text {
|
||
font-size: 36rpx;
|
||
color: #2979ff;
|
||
}
|
||
|
||
.member-batch-bar__btn {
|
||
padding: 8rpx 24rpx;
|
||
border-radius: 8rpx;
|
||
background: #2979ff;
|
||
color: #ffffff;
|
||
font-size: 36rpx;
|
||
}
|
||
|
||
.member-item__offline {
|
||
flex-shrink: 0;
|
||
margin-left: 16rpx;
|
||
padding: 8rpx 24rpx;
|
||
border-radius: 8rpx;
|
||
background: #fef0f0;
|
||
color: #f56c6c;
|
||
font-size: 36rpx;
|
||
}
|
||
|
||
.scan-section {
|
||
background: #f5f6f7;
|
||
border-radius: 16rpx;
|
||
padding: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.scan-row {
|
||
display: flex;
|
||
align-items: center;
|
||
background: #ffffff;
|
||
border: 2rpx solid #e4e7ed;
|
||
border-radius: 12rpx;
|
||
padding: 0 8rpx 0 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.scan-input {
|
||
flex: 1;
|
||
height: 96rpx;
|
||
font-size: 44rpx;
|
||
color: #303133;
|
||
}
|
||
|
||
.camera-btn {
|
||
width: 76rpx;
|
||
height: 76rpx;
|
||
margin-left: 8rpx;
|
||
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: 34rpx;
|
||
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: 44rpx;
|
||
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;
|
||
}
|
||
|
||
/* 打包上报失败弹窗(参考取消核实弹窗) */
|
||
.retry-popup {
|
||
width: 640rpx;
|
||
padding: 40rpx 32rpx 32rpx;
|
||
background: #ffffff;
|
||
border-radius: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.retry-popup__title {
|
||
font-size: 42rpx;
|
||
font-weight: 600;
|
||
color: #e64340;
|
||
text-align: center;
|
||
margin-bottom: 32rpx;
|
||
}
|
||
|
||
.retry-popup__body {
|
||
margin-bottom: 36rpx;
|
||
padding: 24rpx;
|
||
background: #f8f9fa;
|
||
border-radius: 12rpx;
|
||
}
|
||
|
||
.retry-popup__text {
|
||
font-size: 34rpx;
|
||
color: #303133;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.retry-popup__actions {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.retry-popup__btn {
|
||
flex: 1;
|
||
height: 88rpx;
|
||
border-radius: 12rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 36rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.retry-popup__btn:not(:last-child) {
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.retry-popup__btn--cancel {
|
||
background: #f5f7fa;
|
||
color: #606266;
|
||
border: 1rpx solid #dcdfe6;
|
||
}
|
||
|
||
.retry-popup__btn--confirm {
|
||
background: #2979ff;
|
||
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;
|
||
}
|
||
|
||
/* ===== 下线操作员二次确认弹窗 ===== */
|
||
.offline-popup {
|
||
width: 640rpx;
|
||
padding: 40rpx 32rpx 32rpx;
|
||
background: #ffffff;
|
||
border-radius: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.offline-popup__title {
|
||
font-size: 42rpx;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
text-align: center;
|
||
margin-bottom: 32rpx;
|
||
}
|
||
|
||
.offline-popup__body {
|
||
margin-bottom: 36rpx;
|
||
padding: 24rpx;
|
||
background: #f8f9fa;
|
||
border-radius: 12rpx;
|
||
}
|
||
|
||
.offline-popup__text {
|
||
font-size: 36rpx;
|
||
color: #303133;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.offline-popup__actions {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.offline-popup__btn {
|
||
flex: 1;
|
||
height: 88rpx;
|
||
border-radius: 12rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 36rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.offline-popup__btn:not(:last-child) {
|
||
margin-right: 20rpx;
|
||
}
|
||
|
||
.offline-popup__btn--cancel {
|
||
background: #f5f7fa;
|
||
color: #606266;
|
||
border: 1rpx solid #dcdfe6;
|
||
}
|
||
|
||
.offline-popup__btn--confirm {
|
||
background: #f56c6c;
|
||
color: #ffffff;
|
||
}
|
||
|
||
/* ===== 今日打包统计面板 ===== */
|
||
.today-pack-panel {
|
||
width: 640rpx;
|
||
padding: 40rpx 32rpx 32rpx;
|
||
background: #ffffff;
|
||
border-radius: 20rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.today-pack-panel__title {
|
||
font-size: 48rpx;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
text-align: center;
|
||
margin-bottom: 32rpx;
|
||
}
|
||
|
||
.today-pack-panel__body {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.today-pack-stat {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 20rpx 24rpx;
|
||
border-radius: 12rpx;
|
||
}
|
||
|
||
.today-pack-stat:not(:last-child) {
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
/* 斑马纹:白底 + 浅蓝底交替(参考商品查询库存斑马纹) */
|
||
.today-pack-stat:nth-child(even) {
|
||
background: #dde9fb;
|
||
}
|
||
|
||
.today-pack-stat:nth-child(odd) {
|
||
background: #ffffff;
|
||
}
|
||
|
||
.today-pack-stat__label {
|
||
font-size: 36rpx;
|
||
color: #000000;
|
||
}
|
||
|
||
.today-pack-stat__value {
|
||
font-size: 40rpx;
|
||
font-weight: 600;
|
||
color: #2979ff;
|
||
}
|
||
</style>
|