2237 lines
66 KiB
Vue
2237 lines
66 KiB
Vue
<template>
|
||
<view class="scatter-picking-detail-page">
|
||
<view class="normar_container">
|
||
<page-nav :title="title"></page-nav>
|
||
|
||
<view class="search-filter">
|
||
<view class="search-box">
|
||
<view class="search-box-inner">
|
||
<u-search
|
||
v-model="keyword"
|
||
placeholder="请输入快递单号/波次号"
|
||
:bg-color="'#f5f5f5'"
|
||
shape="round"
|
||
:show-action="false"
|
||
@search="handleSearch"
|
||
@clear="clearSearch"
|
||
></u-search>
|
||
<view class="search-actions">
|
||
<view class="scan-btn" @click="handleCameraScan">
|
||
<u-icon name="scan" size="38rpx" color="#2979ff"></u-icon>
|
||
</view>
|
||
<view class="search-divider"></view>
|
||
<view class="search-btn" @click="handleSearch">
|
||
<text class="search-btn__text">搜索</text>
|
||
</view>
|
||
<view class="search-divider"></view>
|
||
<view class="search-btn search-btn--clear" @click="handleClearList">
|
||
<text class="search-btn__text search-btn__text--clear">清空</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="print-config-row">
|
||
<view class="print-config-col">
|
||
<view class="print-station-select" @click="togglePrintStationDropdown(); showPrintModeDropdown = false">
|
||
<text class="print-station-value" :class="{ 'print-station-value--bound': !!printStationId }">{{ printStationName || '请选择打印台' }}</text>
|
||
<u-icon :name="showPrintStationDropdown ? 'arrow-up' : 'arrow-down'" size="24" color="#909399"></u-icon>
|
||
</view>
|
||
<view v-if="showPrintStationDropdown" class="print-station-dropdown-inline">
|
||
<view v-if="printStationList.length === 0" class="print-station-option print-station-option--empty">暂无可用打印台</view>
|
||
<view
|
||
v-for="station in printStationList"
|
||
:key="station.id"
|
||
class="print-station-option"
|
||
:class="{ 'print-station-option--active': station.id === printStationId }"
|
||
@click.stop="handlePrintStationSelect(station)"
|
||
>
|
||
{{ station.name }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="print-config-col">
|
||
<view class="print-mode-select" @click="showPrintModeDropdown = !showPrintModeDropdown; showPrintStationDropdown = false">
|
||
<text class="print-mode-value">{{ printMode === 'printFirst' ? '先打印后复核' : '先复核后打印' }}</text>
|
||
<u-icon :name="showPrintModeDropdown ? 'arrow-up' : 'arrow-down'" size="24" color="#909399"></u-icon>
|
||
</view>
|
||
<view v-if="showPrintModeDropdown" class="print-mode-dropdown-inline">
|
||
<view
|
||
class="print-mode-dropdown-option"
|
||
:class="{ 'print-mode-dropdown-option--active': printMode === 'printFirst' }"
|
||
@click.stop="printMode = 'printFirst'; showPrintModeDropdown = false"
|
||
>
|
||
先打印后复核
|
||
</view>
|
||
<view
|
||
class="print-mode-dropdown-option"
|
||
:class="{ 'print-mode-dropdown-option--active': printMode === 'reviewFirst' }"
|
||
@click.stop="printMode = 'reviewFirst'; showPrintModeDropdown = false"
|
||
>
|
||
先复核后打印
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<scroll-view class="detail-scroll" scroll-y>
|
||
<view v-if="goodsInfoList.length > 0" class="goods-info-section">
|
||
<view class="section-title">商品信息</view>
|
||
<view class="goods-info-list">
|
||
<view v-for="item in goodsInfoList" :key="item.id" class="goods-info-item">
|
||
<view class="goods-info-row goods-info-row--top">
|
||
<view class="goods-info-cell"><text class="goods-info-label">蓝号:</text><text class="goods-info-value">{{ item.basketNo || '--' }}</text></view>
|
||
<view class="goods-info-cell"><text class="goods-info-label">数量:</text><text class="goods-info-value">{{ item.planQty || 0 }}</text></view>
|
||
<view class="goods-info-cell"><text class="goods-info-label">已扫:</text><text class="goods-info-value">{{ item.scannedQty || 0 }}</text></view>
|
||
</view>
|
||
<view class="goods-info-row goods-info-row--bottom">
|
||
<view class="goods-info-image-wrap">
|
||
<u-image
|
||
:src="item.imageUrl || ''"
|
||
mode="aspectFill"
|
||
width="120rpx"
|
||
height="120rpx"
|
||
>
|
||
<template #error>
|
||
<view class="goods-info-image-placeholder">
|
||
<u-icon name="photo" size="28" color="#c0c4cc"></u-icon>
|
||
</view>
|
||
</template>
|
||
</u-image>
|
||
</view>
|
||
<text class="goods-info-name">{{ item.skuName || '--' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view v-if="displayOrderList.length === 0" class="empty-state">
|
||
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
||
<text class="empty-text">暂无未复核订单</text>
|
||
</view>
|
||
<view v-else class="record-list">
|
||
<view v-for="item in displayOrderList" :key="item.id" class="record-item" :class="{ 'record-item--reviewed': getReviewStatusText(item) === '已复核' }" @click="goPickGoodsDetail(item)">
|
||
<view class="record-main record-main--row">
|
||
<text class="record-value" :class="getReviewStatusText(item) === '已复核' ? 'record-value--reviewed' : 'record-value--unreviewed'">{{ getReviewStatusText(item) }}</text>
|
||
<text v-if="item.waveIndex" class="record-value record-value--wave-index" :class="{ 'record-value--wave-index-reviewed': getReviewStatusText(item) === '已复核' }">[{{ item.waveIndex }}]</text>
|
||
<text class="record-value record-value--id" :class="{ 'record-value--id-reviewed': getReviewStatusText(item) === '已复核' }">{{ listType === 'single' ? (item.waybillNo || '--') : (item.waveNo || '--') }}</text>
|
||
<view class="record-print-col">
|
||
<text v-if="getPrintStatusText(item) === '已打印'" class="record-value record-value--printed">已打印</text>
|
||
<text v-else class="record-value" :class="isPrintDisabled(item) ? 'record-value--print-disabled' : 'record-value--unprinted'" @click.stop="!isPrintDisabled(item) && handlePrintOrder(item)">未打印</text>
|
||
<text v-if="item.interceptStatus && item.interceptStatus !== 'none'" class="record-value--intercepted">拦截</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="safe-area-bottom"></view>
|
||
</scroll-view>
|
||
|
||
<view v-if="orderList.length > 0" class="bottom-stats-bar">
|
||
<view class="bottom-stats-info">
|
||
<text class="bottom-stats-text">波次总单数:<text class="bottom-stats-value">{{ totalOrders }}</text></text>
|
||
<text class="bottom-stats-divider"></text>
|
||
<text class="bottom-stats-text">剩余未复核:<text class="bottom-stats-value bottom-stats-value--warn">{{ totalUnreviewedCount }}</text></text>
|
||
</view>
|
||
<view class="bottom-stats-btn" @click="handleRefreshTask">
|
||
<text class="bottom-stats-btn__text">刷新任务数据</text>
|
||
</view>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
<u-popup v-if="showPrintPopup" :show="showPrintPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="showPrintPopup = false">
|
||
<view class="print-popup">
|
||
<view class="print-popup-title">打印设置</view>
|
||
<view class="print-row print-row--station">
|
||
<text class="print-label">打印台</text>
|
||
<view class="print-picker" @click="togglePrintStationDropdown">
|
||
<text class="print-picker-value">{{ printStationName || '--' }}</text>
|
||
<u-icon :name="showPrintStationDropdown ? 'arrow-up' : 'arrow-down'" size="24" color="#909399"></u-icon>
|
||
</view>
|
||
<view v-if="showPrintStationDropdown" class="print-station-dropdown">
|
||
<view
|
||
v-for="station in printStationList"
|
||
:key="station.id"
|
||
class="print-station-option"
|
||
:class="{ 'print-station-option--active': station.id === printStationId }"
|
||
@click.stop="handlePrintStationSelect(station)"
|
||
>
|
||
{{ station.name }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="print-row print-row--action">
|
||
<text class="print-label">打印</text>
|
||
<u-button
|
||
type="primary"
|
||
size="mini"
|
||
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff', fontSize: '26rpx', height: '64rpx', lineHeight: '64rpx', padding: '0 20rpx' }"
|
||
@click="handleConfirmPrint"
|
||
>
|
||
打印
|
||
</u-button>
|
||
</view>
|
||
<view class="print-row print-row--message">
|
||
<text class="print-label">打印消息</text>
|
||
<text class="print-message">{{ printMessage || '暂无打印消息' }}</text>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
|
||
<u-popup :show="showStationListPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10090" @close="showStationListPopup = false; selectedStationId = ''">
|
||
<view class="print-popup">
|
||
<view class="print-popup-title">打印台列表</view>
|
||
<scroll-view class="station-list-scroll" scroll-y>
|
||
<view v-if="printStationList.length === 0" class="station-list-empty">暂无打印台数据</view>
|
||
<view
|
||
v-for="station in printStationList"
|
||
:key="station.id"
|
||
class="station-list-item"
|
||
:class="{ 'station-list-item--selected': selectedStationId === station.id }"
|
||
@click="handleStationListItemClick(station)"
|
||
>
|
||
<view class="station-list-item__left">
|
||
<text class="station-list-item__name" :class="{ 'station-list-item__name--active': selectedStationId === station.id }">{{ station.name }}</text>
|
||
</view>
|
||
<view v-if="selectedStationId === station.id" class="station-list-item__check">
|
||
<u-icon name="checkmark" size="36rpx" color="#2979ff"></u-icon>
|
||
</view>
|
||
</view>
|
||
<view class="safe-bottom-in-popup"></view>
|
||
</scroll-view>
|
||
<view v-if="stationListTotal > 0" class="station-list-pagination">
|
||
<pagination
|
||
:pageNum.sync="stationListPage"
|
||
:pageSize="stationListPageSize"
|
||
:total="stationListTotal"
|
||
:showTotal="true"
|
||
:prevText="'上一页'"
|
||
:nextText="'下一页'"
|
||
:showFirstLast="true"
|
||
:firstText="'首页'"
|
||
:lastText="'末页'"
|
||
@change="handleStationListPageChange"
|
||
/>
|
||
</view>
|
||
<view class="station-list-confirm">
|
||
<u-button
|
||
type="primary"
|
||
:disabled="!selectedStationId"
|
||
:customStyle="{ backgroundColor: selectedStationId ? '#2979ff' : '#a0c4ff', borderColor: selectedStationId ? '#2979ff' : '#a0c4ff', fontSize: '30rpx', height: '80rpx', lineHeight: '80rpx', borderRadius: '12rpx', marginTop: '20rpx' }"
|
||
@click="handleStationListConfirm"
|
||
>
|
||
确定
|
||
</u-button>
|
||
</view>
|
||
</view>
|
||
</u-popup>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
title: '订单复核',
|
||
grabCount: 0,
|
||
keyword: '',
|
||
showUnboundPrintStationOnly: false,
|
||
currentUserId: '',
|
||
pageSize: 20,
|
||
currentPage: 1,
|
||
paginationTotal: 0,
|
||
showStationListPopup: false,
|
||
showPrintPopup: false,
|
||
showPrintStationDropdown: false,
|
||
printStationName: '--',
|
||
printStationId: '',
|
||
printMode: 'printFirst',
|
||
showPrintModeDropdown: false,
|
||
printStationList: [],
|
||
selectedStationId: '',
|
||
stationListPage: 1,
|
||
stationListPageSize: 20,
|
||
stationListTotal: 0,
|
||
printMessage: '',
|
||
pendingPrintCount: 0,
|
||
printRequestCode: '',
|
||
printWaveGroups: [],
|
||
printWavePlatformPrintData: null,
|
||
printTargetList: [],
|
||
goodsInfoList: [],
|
||
orderList: [],
|
||
listType: '',
|
||
totalOrders: 0,
|
||
totalUnreviewedCount: 0,
|
||
taskId: '',
|
||
scanPickerName: '',
|
||
reviewedOrderIds: []
|
||
};
|
||
},
|
||
computed: {
|
||
displayOrderList() {
|
||
const list = Array.isArray(this.orderList) ? this.orderList : [];
|
||
if (!this.showUnboundPrintStationOnly) {
|
||
return list;
|
||
}
|
||
return list.filter(item => !item?.hasBoundPrintStation);
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.safeDispatchBroadcast('setCallbacks', {
|
||
onResult: this.handleBroadcastResult
|
||
});
|
||
this.safeDispatchBroadcast('start');
|
||
|
||
this.currentUserId = String(this.$store?.getters?.user?.id || this.$store?.getters?.user?.user_id || '');
|
||
const hasGrabCountParam = options && Object.prototype.hasOwnProperty.call(options, 'grabCount');
|
||
const parsedGrabCount = Number(options?.grabCount || 0);
|
||
this.grabCount = hasGrabCountParam
|
||
? Math.max(0, parsedGrabCount)
|
||
: 5;
|
||
this.initializeOrderList();
|
||
this.loadPrintStations();
|
||
|
||
// 监听复核完成事件,更新订单列表状态
|
||
uni.$on('orderReviewCompleted', this.handleReviewCompleted);
|
||
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
|
||
},
|
||
onShow() {
|
||
this.safeDispatchBroadcast('setCallbacks', {
|
||
onResult: this.handleBroadcastResult
|
||
});
|
||
this.safeDispatchBroadcast('resume');
|
||
// 从 storage 读取待处理的复核完成事件(兼容 uni.$emit 跨页面不可靠的场景)
|
||
this.applyPendingReviewComplete();
|
||
},
|
||
onHide() {
|
||
this.safeDispatchBroadcast('pause');
|
||
},
|
||
onUnload() {
|
||
this.safeDispatchBroadcast('stop');
|
||
uni.$off('orderReviewCompleted', this.handleReviewCompleted);
|
||
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
|
||
},
|
||
methods: {
|
||
buildBatchListParams(page = this.currentPage) {
|
||
const where = {
|
||
source: 0,
|
||
wave_type: 2
|
||
};
|
||
return {
|
||
pagination: {
|
||
page: Math.max(1, Number(page || 1)),
|
||
pageSize: Math.max(1, Number(this.pageSize || 20))
|
||
},
|
||
where
|
||
};
|
||
},
|
||
extractPagination(payload, response) {
|
||
return payload?.pagination || payload?.page || response?.data?.pagination || response?.pagination || null;
|
||
},
|
||
extractBatchListPayload(response) {
|
||
const candidates = [
|
||
response?.data?.data,
|
||
response?.data,
|
||
response?.result,
|
||
response
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const current = candidates[i];
|
||
if (current && typeof current === 'object' && !Array.isArray(current)) {
|
||
return current;
|
||
}
|
||
}
|
||
return {};
|
||
},
|
||
extractBatchList(payload, response) {
|
||
const candidates = [
|
||
payload?.list,
|
||
payload?.rows,
|
||
payload?.items,
|
||
payload?.data?.list,
|
||
response?.data?.list,
|
||
response?.data?.data?.list,
|
||
response?.list
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
if (Array.isArray(candidates[i])) {
|
||
return candidates[i];
|
||
}
|
||
}
|
||
return [];
|
||
},
|
||
initializeOrderList() {
|
||
this.orderList = [];
|
||
this.paginationTotal = 0;
|
||
this.currentPage = 1;
|
||
this.pageSize = 20;
|
||
},
|
||
normalizeGoodsInfoList(items) {
|
||
if (!Array.isArray(items)) {
|
||
return [];
|
||
}
|
||
return items
|
||
.map((item, index) => {
|
||
const source = item && typeof item === 'object' ? item : {};
|
||
const basketNo = String(
|
||
source.basket_no
|
||
|| source.basketNo
|
||
|| source.basket_code
|
||
|| source.basketCode
|
||
|| source.line_no
|
||
|| source.lineNo
|
||
|| '--'
|
||
).trim() || '--';
|
||
const planQty = Number(source.plan_qty ?? source.planQty ?? source.qty ?? source.quantity ?? 0);
|
||
const scannedQty = Number(source.scanned_qty ?? source.scannedQty ?? source.finish_qty ?? source.finishQty ?? source.done_qty ?? source.doneQty ?? source.picked_qty ?? source.pickedQty ?? 0);
|
||
const imageUrl = String(source.image || source.image_url || source.product_image || source.goods_image || source.pic || source.cover || '').trim();
|
||
const skuName = String(source.sku_name || source.skuName || source.name || source.product_name || source.goods_name || '--').trim() || '--';
|
||
return {
|
||
id: String(source.id ?? source.item_id ?? source.itemId ?? `${basketNo}-${index + 1}`),
|
||
basketNo,
|
||
planQty: Number.isFinite(planQty) ? planQty : 0,
|
||
scannedQty: Number.isFinite(scannedQty) ? scannedQty : 0,
|
||
imageUrl,
|
||
skuName
|
||
};
|
||
})
|
||
.filter(item => !!item.basketNo || !!item.skuName);
|
||
},
|
||
normalizeBatchWaveList(list) {
|
||
if (!Array.isArray(list)) {
|
||
return [];
|
||
}
|
||
return list
|
||
.map((item, index) => {
|
||
const source = item && typeof item === 'object' ? item : {};
|
||
const waveNo = String(source.wave_no || source.waveNo || '').trim();
|
||
const waveId = source.wave_id ?? source.waveId ?? source.id ?? '';
|
||
const printStationId = source.print_station_id ?? source.printStationId ?? source.station_id ?? source.stationId ?? '';
|
||
const normalizedPrintStationId = String(printStationId || '').trim();
|
||
const rowId = source.id ?? waveId ?? waveNo ?? `batch-${this.currentPage}-${index + 1}`;
|
||
const pickerName = String(source.picker_name || source.pickerName || source.user_name || source.userName || '--').trim() || '--';
|
||
const cartNo = String(source.cart_code || source.cartCode || source.cart_no || source.cartNo || '--').trim() || '--';
|
||
const unreviewedCount = Number(source.unreviewed_count ?? source.unreviewedCount ?? source.pending_count ?? source.pendingCount ?? 0);
|
||
const unprintedCount = Number(source.unprinted_count ?? source.unprintedCount ?? 0);
|
||
const orderCount = Number(source.order_count ?? source.orderCount ?? 0);
|
||
const interceptStatus = String(source.intercept_status || source.interceptStatus || '').trim();
|
||
const assigneeId = String((source.picker_id ?? source.pickerId ?? source.user_id ?? source.userId) || '').trim();
|
||
return {
|
||
id: String(rowId || `batch-${this.currentPage}-${index + 1}`),
|
||
waveId: typeof waveId === 'number' ? waveId : String(waveId || '').trim(),
|
||
waveNo,
|
||
pickerName,
|
||
cartNo,
|
||
unreviewedCount: Number.isFinite(unreviewedCount) ? unreviewedCount : 0,
|
||
unprintedCount: Number.isFinite(unprintedCount) ? unprintedCount : 0,
|
||
orderCount: Number.isFinite(orderCount) ? orderCount : 0,
|
||
interceptStatus,
|
||
status: String(source.status || 'pending'),
|
||
waybillCode: String(source.waybill_no || source.waybillCode || source.waybill_code || ''),
|
||
printStationId: normalizedPrintStationId,
|
||
hasBoundPrintStation: !!normalizedPrintStationId && normalizedPrintStationId !== '0',
|
||
isMine: !!this.currentUserId && !!assigneeId && assigneeId === this.currentUserId
|
||
};
|
||
})
|
||
.filter(item => !!item.waveNo);
|
||
},
|
||
resolvePaginationTotal(payload, response, pagination, list) {
|
||
const candidates = [
|
||
pagination?.total,
|
||
payload?.total,
|
||
payload?.count,
|
||
payload?.totalCount,
|
||
response?.data?.total,
|
||
response?.total,
|
||
Array.isArray(list) ? list.length : 0
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const value = Number(candidates[i]);
|
||
if (Number.isFinite(value) && value >= 0) {
|
||
return value;
|
||
}
|
||
}
|
||
return 0;
|
||
},
|
||
resolveWarehouseId() {
|
||
const user = this.$store?.getters?.user || {};
|
||
const userInfo = this.$store?.getters?.userInfo || {};
|
||
const candidates = [
|
||
user?.warehouse_id,
|
||
user?.warehouseId,
|
||
user?.store_id,
|
||
user?.storeId,
|
||
userInfo?.warehouse_id,
|
||
userInfo?.warehouseId,
|
||
userInfo?.store_id,
|
||
userInfo?.storeId,
|
||
uni.getStorageSync('warehouse_id'),
|
||
uni.getStorageSync('warehouseId'),
|
||
uni.getStorageSync('store_id'),
|
||
uni.getStorageSync('storeId')
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const value = Number(candidates[i]);
|
||
if (Number.isFinite(value) && value > 0) {
|
||
return value;
|
||
}
|
||
}
|
||
return 0;
|
||
},
|
||
normalizeWaveIds(list) {
|
||
const sourceList = Array.isArray(list) ? list : [];
|
||
const normalized = sourceList
|
||
.map(item => item?.waveId ?? '')
|
||
.map(value => (typeof value === 'number' ? value : String(value || '').trim()))
|
||
.filter(value => value !== '' && value !== '--');
|
||
return Array.from(new Set(normalized));
|
||
},
|
||
buildWavePlatformPrintParams() {
|
||
const warehouseId = this.resolveWarehouseId();
|
||
const waveIds = this.normalizeWaveIds(this.printTargetList);
|
||
return {
|
||
warehouse_id: warehouseId,
|
||
wave_ids: waveIds
|
||
};
|
||
},
|
||
extractWavePlatformPrintPayload(response) {
|
||
const candidates = [
|
||
response?.data?.data,
|
||
response?.data,
|
||
response?.result,
|
||
response
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const current = candidates[i];
|
||
if (current && typeof current === 'object') {
|
||
return current;
|
||
}
|
||
}
|
||
return {};
|
||
},
|
||
normalizeWaveGroups(payload) {
|
||
const groups = Array.isArray(payload?.waveGroups) ? payload.waveGroups : [];
|
||
return groups
|
||
.map(group => (group && typeof group === 'object' ? group : null))
|
||
.filter(group => !!group);
|
||
},
|
||
buildPrintRequestCode() {
|
||
const timePart = Date.now().toString(36);
|
||
const randomPart = Math.random().toString(36).slice(2, 10);
|
||
return `PRINT_${timePart}_${randomPart}`;
|
||
},
|
||
async requestWavePlatformPrintData() {
|
||
const params = this.buildWavePlatformPrintParams();
|
||
if (!params.warehouse_id) {
|
||
throw new Error('缺少仓库ID');
|
||
}
|
||
if (!params.wave_ids.length) {
|
||
throw new Error('缺少波次ID');
|
||
}
|
||
const response = await this.$http('order.print.getWavePlatformPrintData', params);
|
||
const payload = this.extractWavePlatformPrintPayload(response);
|
||
const waveGroups = this.normalizeWaveGroups(payload);
|
||
if (!waveGroups.length) {
|
||
throw new Error('未获取到可打印的waveGroups');
|
||
}
|
||
this.printWavePlatformPrintData = payload;
|
||
this.printWaveGroups = waveGroups;
|
||
this.printRequestCode = this.buildPrintRequestCode();
|
||
return payload;
|
||
},
|
||
buildPrintRecordWhere() {
|
||
return {};
|
||
},
|
||
buildPrintRecordParams(page = 1) {
|
||
return {
|
||
page: Math.max(1, Number(page || 1)),
|
||
pageSize: 20,
|
||
where: this.buildPrintRecordWhere()
|
||
};
|
||
},
|
||
extractPrintRecordList(response) {
|
||
const list = response?.data?.list || response?.data?.data?.list;
|
||
return Array.isArray(list) ? list : [];
|
||
},
|
||
extractPrintRecordTotal(response) {
|
||
const candidates = [
|
||
response?.data?.total,
|
||
response?.data?.pagination?.total,
|
||
response?.data?.data?.total,
|
||
response?.data?.count,
|
||
response?.total,
|
||
response?.count
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const value = Number(candidates[i]);
|
||
if (Number.isFinite(value) && value >= 0) {
|
||
return value;
|
||
}
|
||
}
|
||
return 0;
|
||
},
|
||
normalizePrintStations(list) {
|
||
return list
|
||
.map(item => {
|
||
const source = item && typeof item === 'object' ? item : {};
|
||
const id = String(source.id ?? source.print_station_id ?? source.printStationId ?? '').trim();
|
||
const name = String(source.name || source.station_name || source.print_station_name || '').trim();
|
||
return {
|
||
id,
|
||
name
|
||
};
|
||
})
|
||
.filter(item => !!item.id && !!item.name);
|
||
},
|
||
async loadPrintStations(page = 1, autoAssign = true) {
|
||
const response = await this.$http('print.getList', this.buildPrintRecordParams(page));
|
||
const list = this.extractPrintRecordList(response);
|
||
const total = this.extractPrintRecordTotal(response);
|
||
const stations = this.normalizePrintStations(list);
|
||
this.printStationList = stations;
|
||
this.stationListTotal = total;
|
||
this.stationListPage = Math.max(1, Number(page || 1));
|
||
if (autoAssign && stations.length && !this.printStationId) {
|
||
this.printStationId = stations[0]?.id || '';
|
||
this.printStationName = stations[0]?.name || '--';
|
||
}
|
||
},
|
||
togglePrintStationDropdown() {
|
||
if (!this.printStationList.length) {
|
||
uni.showToast({
|
||
title: '暂无可用打印台',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
this.showPrintStationDropdown = !this.showPrintStationDropdown;
|
||
},
|
||
handlePrintStationSelect(station) {
|
||
this.printStationId = String(station?.id || '');
|
||
this.printStationName = String(station?.name || '--');
|
||
this.showPrintStationDropdown = false;
|
||
},
|
||
safeDispatchBroadcast(action, payload) {
|
||
try {
|
||
const task = this.$store.dispatch(`broadcast/${action}`, payload);
|
||
if (task && typeof task.catch === 'function') {
|
||
task.catch(error => {
|
||
console.warn(`[ScatterPickingDetail] broadcast/${action} 调用失败:`, error);
|
||
});
|
||
}
|
||
} catch (error) {
|
||
console.warn(`[ScatterPickingDetail] broadcast/${action} 调用异常:`, error);
|
||
}
|
||
},
|
||
normalizeKeyword(value) {
|
||
return String(value || '').replace(/\s+/g, '');
|
||
},
|
||
normalizeScanResult(scanResult) {
|
||
if (!scanResult) {
|
||
return '';
|
||
}
|
||
|
||
if (typeof scanResult === 'string') {
|
||
return this.normalizeKeyword(scanResult);
|
||
}
|
||
|
||
if (typeof scanResult.result === 'string') {
|
||
return this.normalizeKeyword(scanResult.result);
|
||
}
|
||
|
||
if (Array.isArray(scanResult.result)) {
|
||
const firstResult = scanResult.result.find(item => item);
|
||
if (typeof firstResult === 'string') {
|
||
return this.normalizeKeyword(firstResult);
|
||
}
|
||
if (firstResult && typeof firstResult.data === 'string') {
|
||
return this.normalizeKeyword(firstResult.data);
|
||
}
|
||
}
|
||
|
||
if (typeof scanResult.data === 'string') {
|
||
return this.normalizeKeyword(scanResult.data);
|
||
}
|
||
|
||
return '';
|
||
},
|
||
handleBroadcastResult(result) {
|
||
const scanText = this.normalizeScanResult(result);
|
||
if (!scanText) {
|
||
return;
|
||
}
|
||
this.keyword = scanText;
|
||
this.handleSearch();
|
||
},
|
||
handleSearch() {
|
||
this.keyword = this.normalizeKeyword(this.keyword);
|
||
this.requestScanOrder(this.keyword);
|
||
},
|
||
handleCameraScan() {
|
||
uni.scanCode({
|
||
onlyFromCamera: true,
|
||
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
|
||
success: (res) => {
|
||
const scanResult = this.normalizeScanResult(res);
|
||
if (!scanResult) {
|
||
uni.showToast({
|
||
title: '未识别到有效条码',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
this.keyword = scanResult;
|
||
this.handleSearch();
|
||
},
|
||
fail: (error) => {
|
||
const errMsg = String(error?.errMsg || '').toLowerCase();
|
||
if (errMsg.includes('cancel')) {
|
||
return;
|
||
}
|
||
uni.showToast({
|
||
title: '扫码失败,请重试',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
},
|
||
clearSearch() {
|
||
this.keyword = '';
|
||
},
|
||
handleClearList() {
|
||
this.keyword = '';
|
||
this.orderList = [];
|
||
this.goodsInfoList = [];
|
||
this.paginationTotal = 0;
|
||
this.currentPage = 1;
|
||
this.totalOrders = 0;
|
||
this.totalUnreviewedCount = 0;
|
||
this.listType = '';
|
||
},
|
||
async handleRefreshTask() {
|
||
if (!this.taskId) {
|
||
if (this.keyword) {
|
||
this.handleSearch();
|
||
} else {
|
||
this.initializeOrderList();
|
||
this.currentPage = 1;
|
||
}
|
||
return;
|
||
}
|
||
uni.showLoading({ title: '刷新中...' });
|
||
try {
|
||
const response = await this.$http('order.recheckOrder.scanTask', { task_id: Number(this.taskId) });
|
||
const payload = this.extractScanOrderPayload(response);
|
||
const result = this.normalizeScanOrderResult(payload);
|
||
this.handleScanOrderSuccess(result);
|
||
} catch (error) {
|
||
const message = String(error?.message || error?.msg || error?.errMsg || '刷新失败');
|
||
uni.showToast({ title: message, icon: 'none' });
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
},
|
||
buildScanOrderParams(keyword) {
|
||
const value = this.normalizeKeyword(keyword);
|
||
return {
|
||
keyword: value
|
||
};
|
||
},
|
||
extractScanOrderPayload(response) {
|
||
const candidates = [
|
||
response?.data?.data,
|
||
response?.data,
|
||
response?.result,
|
||
response
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const current = candidates[i];
|
||
if (current && typeof current === 'object') {
|
||
return current;
|
||
}
|
||
}
|
||
return {};
|
||
},
|
||
normalizeScanOrderResult(payload) {
|
||
const listType = String(payload?.list_type || payload?.listType || '').trim();
|
||
const matchType = String(payload?.match_type || payload?.matchType || '').trim();
|
||
const taskId = String(payload?.task_id ?? payload?.taskId ?? '').trim();
|
||
const pickerName = String(payload?.picker_name || payload?.pickerName || '').trim();
|
||
|
||
// 扁平化订单列表模式(散单:运单号/波次号命中)
|
||
const totalOrders = Number(payload?.total_orders ?? payload?.totalOrders ?? 0);
|
||
const totalUnreviewedCount = Number(payload?.unreviewed_count ?? payload?.unreviewedCount ?? 0);
|
||
|
||
if (listType === 'single') {
|
||
const list = Array.isArray(payload?.list) ? payload.list : [];
|
||
return {
|
||
listType: 'single',
|
||
matchType,
|
||
list: list.map(item => this.normalizeScanOrderItem(item)),
|
||
total: Number(payload?.total ?? payload?.count ?? list.length),
|
||
totalOrders,
|
||
totalUnreviewedCount,
|
||
taskId,
|
||
pickerName
|
||
};
|
||
}
|
||
|
||
// 嵌套波次结构模式(团单:车号命中)
|
||
if (listType === 'group') {
|
||
const waves = Array.isArray(payload?.waves || payload?.list) ? (payload?.waves || payload?.list) : [];
|
||
const normalizedWaves = waves.map(wave => {
|
||
const subList = Array.isArray(wave?.list || wave?.items) ? (wave?.list || wave?.items).map(item => this.normalizeScanOrderItem(item)) : [];
|
||
const waveTotalOrders = Number(wave?.order_count ?? wave?.orderCount ?? subList.length);
|
||
const waveUnreviewed = Number(wave?.unreviewed_count ?? wave?.unreviewedCount ?? 0);
|
||
const waveStocks = Array.isArray(wave?.stocks) ? wave.stocks : [];
|
||
return {
|
||
waveNo: String(wave?.wave_no || wave?.waveNo || '').trim(),
|
||
waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(),
|
||
waveId: wave?.wave_id ?? wave?.waveId ?? wave?.id ?? '',
|
||
cartNo: String(wave?.cart_code || wave?.cartCode || wave?.cart_no || wave?.cartNo || '').trim(),
|
||
pickerName: String(wave?.picker_name || wave?.pickerName || '').trim(),
|
||
status: String(wave?.status || 'pending'),
|
||
unreviewedCount: waveUnreviewed > 0 ? waveUnreviewed : subList.length,
|
||
unprintedCount: Number(wave?.unprinted_count ?? wave?.unprintedCount ?? 0),
|
||
orderCount: Number(wave?.order_count ?? wave?.orderCount ?? 0),
|
||
totalOrders: waveTotalOrders,
|
||
stocks: waveStocks,
|
||
orderIds: (Array.isArray(wave?.order_ids) ? wave.order_ids : Array.isArray(wave?.orderIds) ? wave.orderIds : []).map(id => Number(id)),
|
||
interceptStatus: String(wave?.intercept_status || wave?.interceptStatus || '').trim(),
|
||
list: subList
|
||
};
|
||
});
|
||
const calcTotalOrders = normalizedWaves.reduce((sum, w) => sum + w.totalOrders, 0);
|
||
const calcUnreviewed = normalizedWaves.reduce((sum, w) => sum + w.unreviewedCount, 0);
|
||
const groupWaybillNo = String(
|
||
payload?.waybill_no || payload?.waybillNo || ''
|
||
).trim();
|
||
return {
|
||
listType: 'group',
|
||
matchType,
|
||
waves: normalizedWaves,
|
||
waybillNo: groupWaybillNo,
|
||
total: Number(payload?.total ?? payload?.count ?? waves.length),
|
||
totalOrders: calcTotalOrders,
|
||
totalUnreviewedCount: calcUnreviewed,
|
||
taskId,
|
||
pickerName
|
||
};
|
||
}
|
||
|
||
// 单订单详情模式(运单号命中但无波次信息)
|
||
const order = payload?.order && typeof payload.order === 'object' ? payload.order : {};
|
||
const items = Array.isArray(payload?.items) ? payload.items : [];
|
||
const firstItem = items[0] && typeof items[0] === 'object' ? items[0] : {};
|
||
const orderId = Number(
|
||
payload?.order_id
|
||
|| payload?.orderId
|
||
|| order?.order_id
|
||
|| order?.orderId
|
||
|| order?.id
|
||
|| firstItem?.order_id
|
||
|| firstItem?.orderId
|
||
|| 0
|
||
);
|
||
const recheckStatus = String(
|
||
payload?.recheck_status
|
||
|| payload?.recheckStatus
|
||
|| order?.recheck_status
|
||
|| order?.recheckStatus
|
||
|| ''
|
||
).trim().toLowerCase();
|
||
const waybillNo = String(
|
||
payload?.waybill_no
|
||
|| order?.waybill_no
|
||
|| order?.waybillCode
|
||
|| order?.waybill_code
|
||
|| ''
|
||
).trim();
|
||
const cartMatchView = payload?.cart_match_view && typeof payload.cart_match_view === 'object'
|
||
? payload.cart_match_view
|
||
: null;
|
||
const storeRemark = String(
|
||
payload?.list?.[0]?.store_remark
|
||
|| payload?.store_remark
|
||
|| order?.store_remark
|
||
|| order?.storeRemark
|
||
|| ''
|
||
).trim();
|
||
|
||
return {
|
||
listType: 'detail',
|
||
matchType,
|
||
cartMatchView,
|
||
orderId,
|
||
recheckStatus,
|
||
waybillNo,
|
||
order,
|
||
items,
|
||
pickerName,
|
||
storeRemark,
|
||
expresses: Array.isArray(payload?.expresses) ? payload.expresses : [],
|
||
logs: Array.isArray(payload?.logs) ? payload.logs : []
|
||
};
|
||
},
|
||
normalizeScanOrderItem(item) {
|
||
if (!item || typeof item !== 'object') return {};
|
||
return {
|
||
id: item?.id ?? item?.order_id ?? item?.orderId ?? '',
|
||
orderId: item?.order_id ?? item?.orderId ?? item?.id ?? '',
|
||
waybillNo: String(item?.waybill_no || item?.waybillCode || item?.waybill_code || '').trim(),
|
||
waveNo: String(item?.wave_no || item?.waveNo || '').trim(),
|
||
waveIndex: String(item?.wave_index || item?.waveIndex || '').trim(),
|
||
pickerName: String(item?.picker_name || item?.pickerName || '').trim(),
|
||
cartNo: String(item?.cart_code || item?.cartCode || item?.cart_no || item?.cartNo || '').trim(),
|
||
status: String(item?.status || 'pending'),
|
||
recheckStatus: String(item?.recheck_status || item?.recheckStatus || '').trim().toLowerCase(),
|
||
isReviewed: !!item?.is_reviewed || !!item?.isReviewed,
|
||
isPrinted: !!item?.is_printed || !!item?.isPrinted,
|
||
interceptStatus: String(item?.intercept_status || item?.interceptStatus || '').trim(),
|
||
totalOrders: Number(item?.total_orders ?? item?.totalOrders ?? 0),
|
||
storeRemark: String(item?.store_remark || item?.storeRemark || '').trim(),
|
||
detail: item?.detail && typeof item.detail === 'object' ? item.detail : null,
|
||
items: Array.isArray(item?.items) ? item.items
|
||
: Array.isArray(item?.goods_items) ? item.goods_items
|
||
: Array.isArray(item?.goodsItems) ? item.goodsItems
|
||
: Array.isArray(item?.goods) ? item.goods
|
||
: Array.isArray(item?.stock) ? item.stock
|
||
: Array.isArray(item?.stocks) ? item.stocks
|
||
: [],
|
||
expresses: Array.isArray(item?.expresses) ? item.expresses : [],
|
||
logs: Array.isArray(item?.logs) ? item.logs : []
|
||
};
|
||
},
|
||
handleScanOrderSuccess(result) {
|
||
if (!result) {
|
||
uni.showToast({
|
||
title: '未查询到订单',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
this.listType = result?.listType || '';
|
||
this.taskId = result?.taskId || '';
|
||
this.scanPickerName = result?.pickerName || '';
|
||
const listType = this.listType;
|
||
|
||
// 散单模式(list_type=single):刷新当前页面列表
|
||
if (listType === 'single') {
|
||
const flatList = Array.isArray(result?.list) ? result.list : [];
|
||
this.orderList = flatList.map((item, index) => ({
|
||
id: String(item?.id || item?.orderId || `scan-${Date.now()}-${index}`),
|
||
waveNo: item?.waveNo || '--',
|
||
waybillNo: item?.waybillNo || '',
|
||
waveIndex: item?.waveIndex || '',
|
||
pickerName: item?.pickerName || '--',
|
||
cartNo: item?.cartNo || '--',
|
||
unreviewedCount: item?.recheckStatus === 'fin' ? 0 : 1,
|
||
status: item?.status || 'pending',
|
||
waybillCode: item?.waybillNo || '',
|
||
recheckStatus: item?.recheckStatus || '',
|
||
isReviewed: !!item?.isReviewed,
|
||
isPrinted: !!item?.isPrinted,
|
||
interceptStatus: String(item?.interceptStatus || '').trim(),
|
||
totalOrders: Number(item?.totalOrders ?? 0),
|
||
storeRemark: item?.storeRemark || '',
|
||
detailItems: Array.isArray(item?.items) ? item.items : []
|
||
}));
|
||
this.paginationTotal = result?.total ?? flatList.length;
|
||
this.goodsInfoList = [];
|
||
this.totalOrders = result?.totalOrders ?? 0;
|
||
this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
|
||
uni.showToast({
|
||
title: `共匹配 ${flatList.length} 条订单`,
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 团单模式(list_type=group):按波次嵌套展示
|
||
if (listType === 'group') {
|
||
const waves = Array.isArray(result?.waves) ? result.waves : [];
|
||
const groupWaybillNo = result?.waybillNo || '';
|
||
this.orderList = waves.map((wave, wi) => {
|
||
const subList = Array.isArray(wave?.list) ? wave.list : [];
|
||
const waveUnreviewed = Number(wave?.unreviewedCount ?? 0);
|
||
const rawWaveId = wave?.waveId ?? wave?.id ?? '';
|
||
return {
|
||
id: String(rawWaveId || wave?.waveNo || `wave-${Date.now()}-${wi}`),
|
||
waveId: rawWaveId,
|
||
waveNo: wave?.waveNo || '--',
|
||
waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(),
|
||
waybillNo: groupWaybillNo,
|
||
pickerName: wave?.pickerName || '--',
|
||
cartNo: wave?.cartNo || '--',
|
||
unreviewedCount: waveUnreviewed > 0 ? waveUnreviewed : subList.length,
|
||
unprintedCount: Number(wave?.unprintedCount ?? 0),
|
||
orderCount: Number(wave?.orderCount ?? 0),
|
||
totalOrders: Number(wave?.orderCount ?? subList.length),
|
||
stocks: Array.isArray(wave?.stocks) ? wave.stocks : [],
|
||
orderIds: Array.isArray(wave?.orderIds) ? wave.orderIds.map(id => Number(id)) : [],
|
||
interceptStatus: String(wave?.interceptStatus || '').trim(),
|
||
status: wave?.status || 'pending',
|
||
children: subList
|
||
};
|
||
});
|
||
this.paginationTotal = this.orderList.length;
|
||
this.goodsInfoList = [];
|
||
this.totalOrders = this.orderList.reduce((sum, w) => sum + (w.totalOrders || 0), 0);
|
||
this.totalUnreviewedCount = this.orderList.filter(item => (item.unreviewedCount || 0) > 0).length;
|
||
uni.showToast({
|
||
title: `共匹配 ${this.orderList.length} 个波次`,
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 单订单详情模式(运单号命中,无波次信息)
|
||
const order = result?.order || {};
|
||
const orderId = Number(result?.orderId || 0);
|
||
if (!orderId) {
|
||
uni.showToast({
|
||
title: '未查询到订单',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (String(result?.recheckStatus || '').toLowerCase() === 'fin') {
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '该订单已复核完成,禁止再次进入',
|
||
showCancel: false,
|
||
success: () => {
|
||
uni.navigateBack({
|
||
delta: 1
|
||
});
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (result?.matchType === 'cart') {
|
||
uni.showToast({
|
||
title: '车号命中,已定位订单',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
|
||
const cacheKey = `scatter_scan_order_${Date.now()}_${orderId}`;
|
||
try {
|
||
const goodsList = this.normalizeGoodsInfoList(result?.items);
|
||
this.goodsInfoList = goodsList;
|
||
uni.setStorageSync(cacheKey, {
|
||
items: Array.isArray(result?.items) ? result.items : [],
|
||
expresses: Array.isArray(result?.expresses) ? result.expresses : [],
|
||
logs: Array.isArray(result?.logs) ? result.logs : []
|
||
});
|
||
} catch (error) {
|
||
console.warn('[ScatterPickingDetail] 缓存 scanOrder 结果失败:', error);
|
||
}
|
||
|
||
const storeRemark = result?.storeRemark || '';
|
||
const waveIndex = String(
|
||
result?.waveIndex
|
||
|| order?.wave_index
|
||
|| order?.waveIndex
|
||
|| ''
|
||
).trim();
|
||
const params = [
|
||
`recordId=${encodeURIComponent(String(orderId))}`,
|
||
`orderId=${encodeURIComponent(String(orderId))}`,
|
||
`waveNo=${encodeURIComponent(String(order?.wave_no || order?.waveNo || '--'))}`,
|
||
`pickerName=${encodeURIComponent(String(order?.picker_name || order?.pickerName || '--'))}`,
|
||
`cartNo=${encodeURIComponent(String(order?.cart_code || order?.cartCode || order?.cart_no || order?.cartNo || '--'))}`,
|
||
`status=${encodeURIComponent(String(order?.status || 'pending'))}`,
|
||
`recheckStatus=${encodeURIComponent(String(result?.recheckStatus || order?.recheck_status || ''))}`,
|
||
`unreviewedCount=${encodeURIComponent(String(order?.unreviewed_count || order?.unreviewedCount || 0))}`,
|
||
`waybillNo=${encodeURIComponent(String(result?.waybillNo || '--'))}`,
|
||
`matchType=${encodeURIComponent(String(result?.matchType || ''))}`,
|
||
`storeRemark=${encodeURIComponent(storeRemark)}`,
|
||
`waveIndex=${encodeURIComponent(waveIndex)}`,
|
||
`cacheKey=${encodeURIComponent(cacheKey)}`
|
||
];
|
||
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
||
},
|
||
async requestScanOrder(keyword) {
|
||
const normalizedKeyword = this.normalizeKeyword(keyword);
|
||
if (!normalizedKeyword) {
|
||
uni.showToast({
|
||
title: '请输入快递单号或车号',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
uni.showLoading({
|
||
title: '查询订单中...'
|
||
});
|
||
try {
|
||
const response = await this.$http('order.recheckOrder.scanOrder', this.buildScanOrderParams(normalizedKeyword));
|
||
const payload = this.extractScanOrderPayload(response);
|
||
const result = this.normalizeScanOrderResult(payload);
|
||
this.handleScanOrderSuccess(result);
|
||
} catch (error) {
|
||
const message = String(error?.message || error?.msg || error?.errMsg || '').trim();
|
||
uni.showToast({
|
||
title: message || '订单查询失败',
|
||
icon: 'none'
|
||
});
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
},
|
||
async toggleUnboundPrintStationOnly() {
|
||
this.showUnboundPrintStationOnly = true;
|
||
this.selectedStationId = this.printStationId || '';
|
||
this.stationListPage = 1;
|
||
this.stationListTotal = 0;
|
||
this.printStationList = [];
|
||
uni.showLoading({
|
||
title: '加载打印台...'
|
||
});
|
||
try {
|
||
await this.loadPrintStations(1, false);
|
||
this.showStationListPopup = true;
|
||
} catch (error) {
|
||
uni.showToast({
|
||
title: '打印台列表加载失败',
|
||
icon: 'none'
|
||
});
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
},
|
||
handleStationListPageChange(page) {
|
||
const targetPage = Math.max(1, Number(page || 1));
|
||
if (targetPage === this.stationListPage) {
|
||
return;
|
||
}
|
||
this.stationListPage = targetPage;
|
||
this.loadPrintStations(targetPage, false);
|
||
},
|
||
handleStationListConfirm() {
|
||
if (!this.selectedStationId) {
|
||
return;
|
||
}
|
||
const station = this.printStationList.find(s => s.id === this.selectedStationId);
|
||
if (!station) {
|
||
return;
|
||
}
|
||
this.showStationListPopup = false;
|
||
this.selectedStationId = '';
|
||
setTimeout(() => {
|
||
this.printStationId = String(station.id);
|
||
this.printStationName = String(station.name || '--');
|
||
uni.showToast({
|
||
title: `已绑定打印台:${station.name}`,
|
||
icon: 'none'
|
||
});
|
||
}, 300);
|
||
},
|
||
handleStationListItemClick(station) {
|
||
if (!station || !station.id) {
|
||
return;
|
||
}
|
||
if (this.selectedStationId === station.id) {
|
||
this.selectedStationId = '';
|
||
} else {
|
||
this.selectedStationId = station.id;
|
||
}
|
||
},
|
||
getReviewStatusText(item) {
|
||
if (!item) return '--';
|
||
// 优先检查内存中的已完成复核标记(兼容事件/存储异步场景)
|
||
const itemId = Number(item.id || item.orderId || 0);
|
||
if (itemId > 0 && this.reviewedOrderIds.includes(itemId)) {
|
||
return '已复核';
|
||
}
|
||
if (this.listType === 'single') {
|
||
return item.isReviewed ? '已复核' : '未复核';
|
||
}
|
||
// group 模式:根据 unreviewedCount 判断
|
||
return (item.unreviewedCount || 0) === 0 ? '已复核' : '未复核';
|
||
},
|
||
isPrintDisabled(item) {
|
||
if (!item) return true;
|
||
// 先复核后打印模式下,禁止直接打印
|
||
if (this.printMode === 'reviewFirst') return true;
|
||
if (this.listType === 'single') return false;
|
||
// group 模式:orderCount 和 unprintedCount 都为 0 时禁用
|
||
return (item.orderCount || 0) === 0 && (item.unprintedCount || 0) === 0;
|
||
},
|
||
getPrintStatusText(item) {
|
||
if (!item) return '--';
|
||
if (this.listType === 'single') {
|
||
return item.isPrinted ? '已打印' : '未打印';
|
||
}
|
||
// group 模式:orderCount 和 unprintedCount 都为 0 时显示未打印(无数据可打)
|
||
if ((item.unprintedCount || 0) === 0 && (item.orderCount || 0) > 0) {
|
||
return '已打印';
|
||
}
|
||
return '未打印';
|
||
},
|
||
goPickGoodsDetail(item) {
|
||
if (!item) {
|
||
return;
|
||
}
|
||
// 缓存商品明细数据
|
||
let items = [];
|
||
if (Array.isArray(item?.detailItems)) {
|
||
items = item.detailItems;
|
||
} else if (Array.isArray(item?.stocks)) {
|
||
// group 模式:使用波次的 stocks
|
||
items = item.stocks;
|
||
} else if (Array.isArray(item?.children)) {
|
||
// group 模式:收集所有子订单的 items
|
||
item.children.forEach(child => {
|
||
if (Array.isArray(child?.items)) {
|
||
items = items.concat(child.items);
|
||
}
|
||
});
|
||
}
|
||
const cacheKey = `order_detail_${Date.now()}_${item.id}`;
|
||
try {
|
||
uni.setStorageSync(cacheKey, { items });
|
||
} catch (error) {
|
||
console.warn('[OrderReview] 缓存商品明细失败:', error);
|
||
}
|
||
const storeRemark = String(item?.storeRemark || this.orderList?.[0]?.storeRemark || '').trim();
|
||
const waveIndex = String(item?.waveIndex || '').trim();
|
||
const orderIds = Array.isArray(item?.orderIds) ? item.orderIds : [];
|
||
const waveId = String(item?.waveId ?? item?.id ?? '').trim();
|
||
const interceptStatus = String(item?.interceptStatus || '').trim();
|
||
const params = [
|
||
`recordId=${encodeURIComponent(String(item.id || ''))}`,
|
||
`orderId=${encodeURIComponent(String(item.id || ''))}`,
|
||
`waveId=${encodeURIComponent(waveId)}`,
|
||
`waveNo=${encodeURIComponent(String(item.waveNo || '--'))}`,
|
||
`waybillNo=${encodeURIComponent(String(item.waybillNo || '--'))}`,
|
||
`pickerName=${encodeURIComponent(String(this.scanPickerName || item.pickerName || '--'))}`,
|
||
`cartNo=${encodeURIComponent(String(item.cartNo || '--'))}`,
|
||
`status=${encodeURIComponent(String(item.status || 'pending'))}`,
|
||
`unreviewedCount=${encodeURIComponent(String(item.unreviewedCount || 0))}`,
|
||
`listType=${encodeURIComponent(this.listType)}`,
|
||
`storeRemark=${encodeURIComponent(storeRemark)}`,
|
||
`waveIndex=${encodeURIComponent(waveIndex)}`,
|
||
`interceptStatus=${encodeURIComponent(interceptStatus)}`,
|
||
`orderIds=${encodeURIComponent(JSON.stringify(orderIds))}`,
|
||
`cacheKey=${encodeURIComponent(cacheKey)}`
|
||
];
|
||
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
||
},
|
||
async handlePrintAllUnreviewed(item) {
|
||
const target = item && typeof item === 'object' ? item : null;
|
||
if (!target) {
|
||
uni.showToast({
|
||
title: '暂无未复核订单可打印',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
this.printTargetList = [target];
|
||
try {
|
||
await this.requestWavePlatformPrintData();
|
||
} catch (error) {
|
||
const message = String(error?.message || error?.msg || error?.errMsg || '打印数据获取失败');
|
||
this.printMessage = message;
|
||
uni.showToast({
|
||
title: message,
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
this.pendingPrintCount = Number(target.unreviewedCount || 0);
|
||
this.printMessage = `待打印未复核订单 ${this.pendingPrintCount} 条`;
|
||
this.showPrintStationDropdown = false;
|
||
this.showPrintPopup = true;
|
||
},
|
||
buildPrintSendParams() {
|
||
if (!this.printRequestCode) {
|
||
this.printRequestCode = this.buildPrintRequestCode();
|
||
}
|
||
return {
|
||
type: 'express',
|
||
printStationId: this.printStationId,
|
||
requestCode: this.printRequestCode,
|
||
data: {
|
||
waveGroups: Array.isArray(this.printWaveGroups) ? this.printWaveGroups : []
|
||
}
|
||
};
|
||
},
|
||
async handleConfirmPrint() {
|
||
if (!this.printStationList.length || !this.printStationId || !this.printStationName || this.printStationName === '--') {
|
||
this.printMessage = '请选择打印台';
|
||
uni.showToast({
|
||
title: '请选择打印台',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
if (!Array.isArray(this.printWaveGroups) || !this.printWaveGroups.length) {
|
||
this.printMessage = '未获取到打印数据';
|
||
uni.showToast({
|
||
title: '未获取到打印数据',
|
||
icon: 'none'
|
||
});
|
||
return;
|
||
}
|
||
|
||
const params = this.buildPrintSendParams();
|
||
const effectivePrintCount = Number(this.pendingPrintCount || 0) > 0
|
||
? Number(this.pendingPrintCount || 0)
|
||
: this.printWaveGroups.length;
|
||
uni.showLoading({
|
||
title: '发送打印中...'
|
||
});
|
||
try {
|
||
const response = await this.$http('print.send', params);
|
||
const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500;
|
||
if (!success) {
|
||
throw new Error(response?.message || response?.msg || '打印失败');
|
||
}
|
||
this.printMessage = `打印已发送,未复核订单 ${effectivePrintCount} 条`;
|
||
uni.showToast({
|
||
title: `已发起打印${effectivePrintCount}条`,
|
||
icon: 'none'
|
||
});
|
||
this.showPrintPopup = false;
|
||
} catch (error) {
|
||
const message = String(error?.message || error?.msg || error?.errMsg || '打印失败');
|
||
this.printMessage = message;
|
||
uni.showToast({
|
||
title: message,
|
||
icon: 'none'
|
||
});
|
||
} finally {
|
||
uni.hideLoading();
|
||
}
|
||
},
|
||
buildOrderPrintDataParams(item) {
|
||
if (this.listType === 'single') {
|
||
return {
|
||
order_ids: [Number(item.id)]
|
||
};
|
||
}
|
||
// group 模式:使用接口返回的 order_ids
|
||
const orderIds = Array.isArray(item?.orderIds) ? item.orderIds : [];
|
||
return {
|
||
order_ids: orderIds.length > 0 ? orderIds : [Number(item.id)]
|
||
};
|
||
},
|
||
extractOrderPrintPayload(response) {
|
||
const candidates = [
|
||
response?.data?.data,
|
||
response?.data,
|
||
response?.result,
|
||
response
|
||
];
|
||
for (let i = 0; i < candidates.length; i += 1) {
|
||
const current = candidates[i];
|
||
if (current && typeof current === 'object') {
|
||
return current;
|
||
}
|
||
}
|
||
return {};
|
||
},
|
||
normalizeOrderPrintGroups(payload) {
|
||
const groups = Array.isArray(payload?.waveGroups) ? payload.waveGroups : [];
|
||
if (groups.length) return groups;
|
||
// 如果返回的不是 waveGroups 结构,尝试包装成 waveGroups
|
||
if (payload && typeof payload === 'object') {
|
||
return [payload];
|
||
}
|
||
return [];
|
||
},
|
||
async handlePrintOrder(item) {
|
||
if (!item) {
|
||
uni.showToast({ title: '打印数据无效', icon: 'none' });
|
||
return;
|
||
}
|
||
|
||
uni.showLoading({ title: '处理打印中...' });
|
||
|
||
try {
|
||
// 1. 获取打印数据
|
||
const params = this.buildOrderPrintDataParams(item);
|
||
const response = await this.$http('order.print.getOrderPrintData', params);
|
||
const payload = this.extractOrderPrintPayload(response);
|
||
const waveGroups = this.normalizeOrderPrintGroups(payload);
|
||
if (!waveGroups.length) {
|
||
throw new Error('未获取到可打印数据');
|
||
}
|
||
|
||
// 2. 检查打印台
|
||
if (!this.printStationId || this.printStationName === '--') {
|
||
throw new Error('无可用的打印台');
|
||
}
|
||
|
||
// 3. 发送打印
|
||
this.printRequestCode = this.buildPrintRequestCode();
|
||
const sendParams = {
|
||
type: 'express',
|
||
printStationId: this.printStationId,
|
||
requestCode: this.printRequestCode,
|
||
data: {
|
||
waveGroups
|
||
}
|
||
};
|
||
const sendResponse = await this.$http('print.send', sendParams);
|
||
const success = sendResponse?.flag !== 'failure' && sendResponse?.code !== '500' && sendResponse?.code !== 500;
|
||
if (!success) {
|
||
throw new Error(sendResponse?.message || sendResponse?.msg || '打印发送失败');
|
||
}
|
||
|
||
uni.hideLoading();
|
||
uni.showToast({ title: '打印已发送', icon: 'success' });
|
||
} catch (error) {
|
||
uni.hideLoading();
|
||
const message = String(error?.message || error?.msg || error?.errMsg || '打印失败');
|
||
uni.showToast({ title: message, icon: 'none' });
|
||
}
|
||
},
|
||
handleInterceptCompleted(data) {
|
||
if (!data) return;
|
||
const { orderId } = data;
|
||
if (!Array.isArray(this.orderList) || this.orderList.length === 0) return;
|
||
this.orderList = this.orderList.map(item => {
|
||
const itemId = Number(item.id || item.orderId || 0);
|
||
if (itemId === Number(orderId)) {
|
||
return { ...item, interceptStatus: 'intercepted_at_warehouse' };
|
||
}
|
||
return item;
|
||
});
|
||
},
|
||
handleReviewCompleted(data) {
|
||
if (!data) return;
|
||
const { orderId, waveNo, listType } = data;
|
||
if (!Array.isArray(this.orderList) || this.orderList.length === 0) return;
|
||
|
||
const mode = String(listType || this.listType || '').trim();
|
||
|
||
if (mode === 'single') {
|
||
// 散单模式:根据 orderId 匹配并标记为已复核
|
||
let updated = false;
|
||
this.orderList = this.orderList.map(item => {
|
||
const itemId = Number(item.id || item.orderId || 0);
|
||
if (itemId > 0 && itemId === Number(orderId)) {
|
||
updated = true;
|
||
return { ...item, isReviewed: true, unreviewedCount: 0 };
|
||
}
|
||
// 也尝试用运单号或 waveNo 匹配
|
||
if (!updated && waveNo && item.waveNo === waveNo) {
|
||
updated = true;
|
||
return { ...item, isReviewed: true, unreviewedCount: 0 };
|
||
}
|
||
return item;
|
||
});
|
||
// 记录已完成复核的 orderId,供 getReviewStatusText 兜底判断
|
||
const id = Number(orderId);
|
||
if (id > 0 && !this.reviewedOrderIds.includes(id)) {
|
||
this.reviewedOrderIds = [...this.reviewedOrderIds, id];
|
||
}
|
||
} else if (mode === 'group') {
|
||
// 团单模式:找到对应波次,减少 unreviewedCount
|
||
let updated = false;
|
||
this.orderList = this.orderList.map(item => {
|
||
if (item.waveNo === waveNo || String(item.id) === String(orderId)) {
|
||
const currentCount = Number(item.unreviewedCount || 0);
|
||
const newCount = Math.max(0, currentCount - 1);
|
||
updated = true;
|
||
return { ...item, unreviewedCount: newCount };
|
||
}
|
||
return item;
|
||
});
|
||
}
|
||
|
||
// 重新计算总未复核数
|
||
if (mode === 'single') {
|
||
this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
|
||
} else if (mode === 'group') {
|
||
this.totalUnreviewedCount = this.orderList.filter(item => (item.unreviewedCount || 0) > 0).length;
|
||
}
|
||
},
|
||
applyPendingReviewComplete() {
|
||
try {
|
||
const pending = uni.getStorageSync('pendingReviewComplete');
|
||
if (pending) {
|
||
uni.removeStorageSync('pendingReviewComplete');
|
||
// 先记录已完成复核的 orderId,确保 getReviewStatusText 能立即识别
|
||
const id = Number(pending.orderId);
|
||
if (id > 0 && !this.reviewedOrderIds.includes(id)) {
|
||
this.reviewedOrderIds = [...this.reviewedOrderIds, id];
|
||
}
|
||
this.handleReviewCompleted(pending);
|
||
}
|
||
} catch (e) {
|
||
console.warn('[OrderReview] 读取待处理复核完成数据失败:', e);
|
||
}
|
||
},
|
||
handlePageChange(page) {
|
||
const targetPage = Math.max(1, Number(page || 1));
|
||
if (targetPage === this.currentPage) {
|
||
return;
|
||
}
|
||
this.currentPage = targetPage;
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.scatter-picking-detail-page {
|
||
height: 100vh;
|
||
background: #f8f9fa;
|
||
}
|
||
|
||
.normar_container {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
|
||
::v-deep .u-popup,
|
||
::v-deep .u-popup-mask {
|
||
z-index: 10090 !important;
|
||
}
|
||
|
||
::v-deep .nav-title .right {
|
||
width: auto;
|
||
min-width: 136rpx;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.nav-right-action {
|
||
font-size: 32rpx;
|
||
line-height: 36rpx;
|
||
color: #ffffff;
|
||
padding: 8rpx 18rpx;
|
||
border-radius: 6rpx;
|
||
background: #2979ff;
|
||
}
|
||
|
||
.nav-right-action--active {
|
||
color: #ffffff;
|
||
background: #1f67e6;
|
||
}
|
||
|
||
.nav-right-action--bound {
|
||
color: #ffffff;
|
||
background: #07c160;
|
||
}
|
||
|
||
.detail-scroll {
|
||
flex: 1;
|
||
min-height: 0;
|
||
height: auto;
|
||
padding: 20rpx 24rpx 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.bottom-stats-bar {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 16rpx 24rpx;
|
||
padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
|
||
background: #ffffff;
|
||
border-top: 1rpx solid #ebeef5;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.bottom-stats-info {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.bottom-stats-text {
|
||
font-size: 26rpx;
|
||
color: #909399;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.bottom-stats-value {
|
||
color: #303133;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.bottom-stats-value--warn {
|
||
color: #fa8c16;
|
||
}
|
||
|
||
.bottom-stats-divider {
|
||
width: 1rpx;
|
||
height: 24rpx;
|
||
background: #dcdfe6;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.bottom-stats-btn {
|
||
flex-shrink: 0;
|
||
margin-left: 16rpx;
|
||
padding: 8rpx 20rpx;
|
||
border: none;
|
||
border-radius: 10rpx;
|
||
background: #2979ff;
|
||
}
|
||
|
||
.bottom-stats-btn:active {
|
||
opacity: 0.7;
|
||
}
|
||
|
||
.bottom-stats-btn__text {
|
||
font-size: 26rpx;
|
||
color: #ffffff;
|
||
line-height: 1.4;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.goods-info-section {
|
||
background: #ffffff;
|
||
border-radius: 12rpx;
|
||
padding: 18rpx;
|
||
border: 1rpx solid #ebeef5;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 30rpx;
|
||
line-height: 42rpx;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
margin-bottom: 14rpx;
|
||
}
|
||
|
||
.goods-info-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 14rpx;
|
||
}
|
||
|
||
.goods-info-item {
|
||
padding: 16rpx;
|
||
border-radius: 10rpx;
|
||
background: #fafafa;
|
||
border: 1rpx solid #f0f0f0;
|
||
}
|
||
|
||
.goods-info-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.goods-info-row--top {
|
||
flex-wrap: wrap;
|
||
gap: 12rpx 20rpx;
|
||
}
|
||
|
||
.goods-info-row--bottom {
|
||
margin-top: 14rpx;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.goods-info-cell {
|
||
display: flex;
|
||
align-items: center;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
}
|
||
|
||
.goods-info-label {
|
||
color: #909399;
|
||
}
|
||
|
||
.goods-info-value {
|
||
color: #303133;
|
||
}
|
||
|
||
.goods-info-image-wrap {
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.goods-info-image-placeholder {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: #f2f3f5;
|
||
border-radius: 10rpx;
|
||
}
|
||
|
||
.goods-info-name {
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: 30rpx;
|
||
line-height: 44rpx;
|
||
color: #303133;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.pagination-wrap {
|
||
background: #ffffff;
|
||
border-top: 1rpx solid #f0f0f0;
|
||
padding: 0 24rpx env(safe-area-inset-bottom);
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.search-filter {
|
||
background: #ffffff;
|
||
padding: 20rpx 24rpx 16rpx;
|
||
border: 1rpx solid #f0f0f0;
|
||
border-top: none;
|
||
border-radius: 0;
|
||
}
|
||
|
||
.print-config-row {
|
||
margin-top: 16rpx;
|
||
display: flex;
|
||
flex-direction: row;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.print-config-col {
|
||
flex: 1;
|
||
position: relative;
|
||
min-width: 0;
|
||
}
|
||
|
||
.print-station-select,
|
||
.print-mode-select {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 12rpx 16rpx;
|
||
border: 1rpx solid #dcdfe6;
|
||
border-radius: 10rpx;
|
||
background: #fafafa;
|
||
}
|
||
|
||
.print-station-value,
|
||
.print-mode-value {
|
||
flex: 1;
|
||
font-size: 26rpx;
|
||
color: #303133;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.print-station-value--bound {
|
||
color: #07c160;
|
||
}
|
||
|
||
.print-station-dropdown-inline,
|
||
.print-mode-dropdown-inline {
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
top: 100%;
|
||
max-height: 300rpx;
|
||
overflow-y: auto;
|
||
background: #ffffff;
|
||
border: 1rpx solid #ebeef5;
|
||
border-radius: 10rpx;
|
||
z-index: 100;
|
||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
|
||
}
|
||
|
||
.print-station-option,
|
||
.print-mode-dropdown-option {
|
||
padding: 16rpx 20rpx;
|
||
font-size: 26rpx;
|
||
color: #303133;
|
||
border-bottom: 1rpx solid #f2f3f5;
|
||
}
|
||
|
||
.print-station-option:last-child,
|
||
.print-mode-dropdown-option:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.print-station-option--active,
|
||
.print-mode-dropdown-option--active {
|
||
color: #2979ff;
|
||
background: #f0f7ff;
|
||
}
|
||
|
||
.print-station-option--empty {
|
||
color: #c0c4cc;
|
||
text-align: center;
|
||
}
|
||
|
||
.print-station-option:active,
|
||
.print-mode-dropdown-option:active {
|
||
background: #f5f5f5;
|
||
}
|
||
|
||
.search-box {
|
||
position: relative;
|
||
}
|
||
|
||
.search-box-inner {
|
||
position: relative;
|
||
}
|
||
|
||
::v-deep .search-box-inner .u-search {
|
||
width: 100%;
|
||
}
|
||
|
||
::v-deep .search-box-inner .u-search__content {
|
||
padding-right: 280rpx;
|
||
}
|
||
|
||
::v-deep .search-box-inner .u-search__content__close {
|
||
margin-right: 12rpx;
|
||
}
|
||
|
||
.search-actions {
|
||
position: absolute;
|
||
right: 24rpx;
|
||
top: 50%;
|
||
transform: translateY(-50%);
|
||
height: 68rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.scan-btn {
|
||
height: 68rpx;
|
||
padding: 0 8rpx 0 4rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
&:active {
|
||
opacity: 0.88;
|
||
}
|
||
}
|
||
|
||
.search-divider {
|
||
width: 1rpx;
|
||
height: 28rpx;
|
||
background: #dcdfe6;
|
||
margin: 0 16rpx 0 10rpx;
|
||
}
|
||
|
||
.search-btn {
|
||
height: 68rpx;
|
||
padding: 0 8rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex-shrink: 0;
|
||
|
||
&:active {
|
||
opacity: 0.88;
|
||
}
|
||
}
|
||
|
||
.search-btn__text {
|
||
font-size: 30rpx;
|
||
color: #2979ff;
|
||
font-weight: 500;
|
||
line-height: 1;
|
||
}
|
||
|
||
.search-btn__text--clear {
|
||
color: #909399;
|
||
}
|
||
|
||
.record-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 14rpx;
|
||
}
|
||
|
||
.record-item {
|
||
background: #ffffff;
|
||
border-radius: 12rpx;
|
||
padding: 18rpx;
|
||
border: 1rpx solid #ebeef5;
|
||
transition: background 0.2s;
|
||
}
|
||
|
||
.record-item:active {
|
||
opacity: 0.75;
|
||
}
|
||
|
||
.record-item--reviewed {
|
||
background: #f5f5f5;
|
||
}
|
||
|
||
.record-item--reviewed:active {
|
||
opacity: 0.75;
|
||
}
|
||
|
||
.record-main {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.record-main--row {
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
gap: 20rpx;
|
||
flex-wrap: nowrap;
|
||
}
|
||
|
||
.record-main--row .record-value {
|
||
flex: none;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.record-main--row .record-value--id {
|
||
flex: 1;
|
||
text-align: center;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.record-value--wave-index {
|
||
flex-shrink: 0;
|
||
font-size: 24rpx;
|
||
color: #2979ff;
|
||
background: #f0f7ff;
|
||
border: 1rpx solid #b3d8ff;
|
||
border-radius: 6rpx;
|
||
padding: 0 8rpx;
|
||
margin-right: 8rpx;
|
||
line-height: 34rpx;
|
||
height: 34rpx;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
}
|
||
|
||
/* 已复核行:运单/波次号颜色与复核状态一致 */
|
||
.record-main--row .record-value--id.record-value--id-reviewed {
|
||
color: #909399;
|
||
}
|
||
|
||
/* 已复核行:波次索引标签颜色灰化 */
|
||
.record-main--row .record-value--wave-index.record-value--wave-index-reviewed {
|
||
color: #909399;
|
||
background: #e8e8e8;
|
||
border-color: #d0d0d0;
|
||
}
|
||
|
||
.record-left {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.record-line {
|
||
display: flex;
|
||
align-items: center;
|
||
flex-wrap: nowrap;
|
||
font-size: 32rpx;
|
||
line-height: 52rpx;
|
||
}
|
||
|
||
.record-line + .record-line {
|
||
margin-top: 8rpx;
|
||
}
|
||
|
||
.record-label {
|
||
width: 170rpx;
|
||
min-width: 170rpx;
|
||
color: #909399;
|
||
white-space: nowrap;
|
||
word-break: keep-all;
|
||
overflow-wrap: normal;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.record-value {
|
||
flex: 1;
|
||
color: #303133;
|
||
}
|
||
|
||
.record-value--reviewed {
|
||
color: #909399;
|
||
}
|
||
|
||
.record-value--unreviewed {
|
||
color: #fa8c16;
|
||
}
|
||
|
||
.record-value--printed {
|
||
color: #f56c6c;
|
||
}
|
||
|
||
.record-value--unprinted {
|
||
color: #07c160;
|
||
padding: 4rpx 16rpx;
|
||
border: 2rpx solid #07c160;
|
||
border-radius: 8rpx;
|
||
font-size: 26rpx;
|
||
line-height: 1.4;
|
||
background: #f0fff5;
|
||
}
|
||
|
||
.record-value--unprinted:active {
|
||
opacity: 0.7;
|
||
}
|
||
|
||
.record-value--print-disabled {
|
||
color: #c0c4cc;
|
||
padding: 4rpx 16rpx;
|
||
border: 2rpx solid #dcdfe6;
|
||
border-radius: 8rpx;
|
||
font-size: 26rpx;
|
||
line-height: 1.4;
|
||
background: #f5f5f5;
|
||
}
|
||
|
||
.record-value--intercepted {
|
||
display: inline-block;
|
||
margin-left: 8rpx;
|
||
padding: 0 8rpx;
|
||
font-size: 22rpx;
|
||
color: #ffffff;
|
||
border-radius: 6rpx;
|
||
line-height: 1.6;
|
||
background: #f56c6c;
|
||
}
|
||
|
||
.record-right {
|
||
min-width: 180rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
margin-left: 16rpx;
|
||
}
|
||
|
||
.record-count {
|
||
font-size: 30rpx;
|
||
line-height: 40rpx;
|
||
color: #fa8c16;
|
||
}
|
||
|
||
.record-status {
|
||
margin-top: 12rpx;
|
||
font-size: 30rpx;
|
||
line-height: 40rpx;
|
||
color: #2979ff;
|
||
}
|
||
|
||
.record-footer {
|
||
margin-top: 14rpx;
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.empty-state {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.empty-text {
|
||
margin-top: 18rpx;
|
||
font-size: 28rpx;
|
||
color: #909399;
|
||
}
|
||
|
||
.safe-area-bottom {
|
||
height: calc(30rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.print-popup {
|
||
padding: 24rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
|
||
background: #ffffff;
|
||
border-top-left-radius: 20rpx;
|
||
border-top-right-radius: 20rpx;
|
||
}
|
||
|
||
.print-popup-title {
|
||
font-size: 34rpx;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.print-row {
|
||
display: flex;
|
||
align-items: flex-start;
|
||
padding: 16rpx 0;
|
||
border-bottom: 1rpx solid #f2f3f5;
|
||
}
|
||
|
||
.print-row--station {
|
||
position: relative;
|
||
}
|
||
|
||
.print-row--station .print-label {
|
||
padding-top: 10rpx;
|
||
}
|
||
|
||
.print-row--action {
|
||
align-items: center;
|
||
}
|
||
|
||
.print-row--message {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.print-label {
|
||
min-width: 130rpx;
|
||
width: 130rpx;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #909399;
|
||
}
|
||
|
||
.print-value {
|
||
flex: 1;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #303133;
|
||
}
|
||
|
||
.print-picker {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 10rpx 16rpx;
|
||
border: 1rpx solid #dcdfe6;
|
||
border-radius: 10rpx;
|
||
background: #fafafa;
|
||
}
|
||
|
||
.print-picker-value {
|
||
flex: 1;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #303133;
|
||
padding-right: 16rpx;
|
||
word-break: break-all;
|
||
}
|
||
|
||
.print-station-dropdown {
|
||
position: absolute;
|
||
right: 0;
|
||
top: calc(100% - 4rpx);
|
||
width: calc(100% - 154rpx);
|
||
max-height: 300rpx;
|
||
overflow-y: auto;
|
||
background: #ffffff;
|
||
border: 1rpx solid #ebeef5;
|
||
border-radius: 10rpx;
|
||
z-index: 10091;
|
||
}
|
||
|
||
.print-station-option {
|
||
padding: 16rpx 20rpx;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #303133;
|
||
}
|
||
|
||
.print-station-option + .print-station-option {
|
||
border-top: 1rpx solid #f2f3f5;
|
||
}
|
||
|
||
.print-station-option--active {
|
||
color: #2979ff;
|
||
}
|
||
|
||
.print-message {
|
||
flex: 1;
|
||
font-size: 28rpx;
|
||
line-height: 40rpx;
|
||
color: #303133;
|
||
}
|
||
|
||
.station-list-scroll {
|
||
max-height: 600rpx;
|
||
padding: 0 10rpx;
|
||
}
|
||
|
||
.station-list-pagination {
|
||
padding: 16rpx 10rpx 4rpx;
|
||
border-top: 1rpx solid #f2f3f5;
|
||
}
|
||
|
||
.station-list-empty {
|
||
text-align: center;
|
||
padding: 60rpx 0;
|
||
font-size: 28rpx;
|
||
color: #909399;
|
||
}
|
||
|
||
.station-list-item {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 24rpx 20rpx;
|
||
border-bottom: 1rpx solid #f2f3f5;
|
||
}
|
||
|
||
.station-list-item--selected {
|
||
background: #f0f7ff;
|
||
}
|
||
|
||
.station-list-item:active {
|
||
background: #f5f6fa;
|
||
}
|
||
|
||
.station-list-item--selected:active {
|
||
background: #e0f0ff;
|
||
}
|
||
|
||
.station-list-item__left {
|
||
flex: 1;
|
||
min-width: 0;
|
||
}
|
||
|
||
.station-list-item__name {
|
||
font-size: 30rpx;
|
||
color: #303133;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.station-list-item__name--active {
|
||
color: #2979ff;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.station-list-item__check {
|
||
flex-shrink: 0;
|
||
margin-left: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.station-list-item__id {
|
||
font-size: 26rpx;
|
||
color: #909399;
|
||
}
|
||
|
||
.station-list-confirm {
|
||
padding: 16rpx 10rpx calc(10rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.safe-bottom-in-popup {
|
||
height: calc(10rpx + env(safe-area-inset-bottom));
|
||
}
|
||
</style> |