修改订单复核模块
This commit is contained in:
parent
4692f0d12d
commit
2da51c98f6
@ -521,19 +521,27 @@
|
||||
return [];
|
||||
}
|
||||
|
||||
const priorities = [
|
||||
(menuName) => menuName === '收货作业' || (menuName.includes('收货') && menuName.includes('作业')),
|
||||
(menuName) => menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'))
|
||||
// 默认显示的菜单列表(按顺序匹配)
|
||||
const defaultMenuNames = [
|
||||
'收货作业',
|
||||
'商品查询',
|
||||
'订单拣货',
|
||||
'散单波次策略',
|
||||
'团购波次策略',
|
||||
'散单拣货详情',
|
||||
'团购拣货详情',
|
||||
'订单复核',
|
||||
'移库作业'
|
||||
];
|
||||
|
||||
const selectedKeys = new Set();
|
||||
const prioritized = [];
|
||||
|
||||
priorities.forEach((matcher) => {
|
||||
defaultMenuNames.forEach((targetName) => {
|
||||
const matched = source.find((item) => {
|
||||
const menuName = this.sanitizeText(item?.name || item?.meta?.title);
|
||||
const key = this.getMenuKey(item);
|
||||
return key && !selectedKeys.has(key) && matcher(menuName);
|
||||
return key && !selectedKeys.has(key) && menuName === targetName;
|
||||
});
|
||||
|
||||
if (matched) {
|
||||
|
||||
@ -110,11 +110,11 @@
|
||||
<text class="empty-text">暂无未复核订单</text>
|
||||
</view>
|
||||
<view v-else class="record-list">
|
||||
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="goPickGoodsDetail(item)">
|
||||
<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">[{{ item.waveIndex }}]</text>
|
||||
<text class="record-value record-value--id">{{ listType === 'single' ? (item.waybillNo || '--') : (item.waveNo || '--') }}</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>
|
||||
@ -264,7 +264,8 @@
|
||||
totalOrders: 0,
|
||||
totalUnreviewedCount: 0,
|
||||
taskId: '',
|
||||
scanPickerName: ''
|
||||
scanPickerName: '',
|
||||
reviewedOrderIds: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -300,6 +301,8 @@
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('resume');
|
||||
// 从 storage 读取待处理的复核完成事件(兼容 uni.$emit 跨页面不可靠的场景)
|
||||
this.applyPendingReviewComplete();
|
||||
},
|
||||
onHide() {
|
||||
this.safeDispatchBroadcast('pause');
|
||||
@ -1141,6 +1144,11 @@
|
||||
},
|
||||
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 ? '已复核' : '未复核';
|
||||
}
|
||||
@ -1404,7 +1412,9 @@
|
||||
const { orderId, waveNo, listType } = data;
|
||||
if (!Array.isArray(this.orderList) || this.orderList.length === 0) return;
|
||||
|
||||
if (this.listType === 'single') {
|
||||
const mode = String(listType || this.listType || '').trim();
|
||||
|
||||
if (mode === 'single') {
|
||||
// 散单模式:根据 orderId 匹配并标记为已复核
|
||||
let updated = false;
|
||||
this.orderList = this.orderList.map(item => {
|
||||
@ -1420,7 +1430,12 @@
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} else if (this.listType === 'group') {
|
||||
// 记录已完成复核的 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 => {
|
||||
@ -1435,12 +1450,28 @@
|
||||
}
|
||||
|
||||
// 重新计算总未复核数
|
||||
if (this.listType === 'single') {
|
||||
if (mode === 'single') {
|
||||
this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
|
||||
} else if (this.listType === 'group') {
|
||||
} 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) {
|
||||
@ -1828,12 +1859,21 @@
|
||||
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;
|
||||
@ -1878,6 +1918,18 @@
|
||||
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;
|
||||
|
||||
@ -1440,7 +1440,13 @@
|
||||
}, '', false);
|
||||
if (String(response?.flag || '').toLowerCase() === 'failure') {
|
||||
this.pickingView.items = [];
|
||||
this.showErrorModal(response?.message || '任务详情获取失败');
|
||||
const msg = String(response?.message || '').trim();
|
||||
// 存在未分配储位订单时,显示引导提示
|
||||
if (msg.includes('未分配储位')) {
|
||||
this.showErrorModal('存在未分配储位的订单。如需拣其他货,请点击\'更多\'→\'取消拣货\'。');
|
||||
} else {
|
||||
this.showErrorModal(msg || '任务详情获取失败');
|
||||
}
|
||||
return;
|
||||
}
|
||||
const payload = this.extractTaskDetailPayload(response);
|
||||
|
||||
@ -669,20 +669,34 @@
|
||||
if (this.confirmingRecheck) {
|
||||
return;
|
||||
}
|
||||
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||
if (!orderId) {
|
||||
uni.showToast({
|
||||
title: '缺少订单ID',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
const listType = String(this.detailInfo?.listType || '').trim();
|
||||
let params;
|
||||
if (listType === 'group') {
|
||||
const waveId = String(this.detailInfo?.waveId || '').trim();
|
||||
if (!waveId) {
|
||||
uni.showToast({
|
||||
title: '缺少波次ID',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
params = { wave_id: waveId };
|
||||
} else {
|
||||
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||
if (!orderId) {
|
||||
uni.showToast({
|
||||
title: '缺少订单ID',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
params = { order_id: orderId };
|
||||
}
|
||||
|
||||
this.confirmingRecheck = true;
|
||||
uni.showLoading({
|
||||
title: '确认复核中...'
|
||||
});
|
||||
const params = { order_id: orderId };
|
||||
console.log('[confirmRecheck] 请求参数:', JSON.stringify(params));
|
||||
try {
|
||||
const response = await this.$http('order.recheckOrder.confirmRecheck', params);
|
||||
@ -692,11 +706,18 @@
|
||||
icon: 'success'
|
||||
});
|
||||
// 通知订单复核页面更新列表状态
|
||||
uni.$emit('orderReviewCompleted', {
|
||||
const reviewCompletedData = {
|
||||
orderId: this.detailInfo.orderId,
|
||||
waveNo: this.detailInfo.waveNo,
|
||||
waveId: this.detailInfo.waveId,
|
||||
listType: this.detailInfo.listType
|
||||
});
|
||||
};
|
||||
uni.$emit('orderReviewCompleted', reviewCompletedData);
|
||||
try {
|
||||
uni.setStorageSync('pendingReviewComplete', reviewCompletedData);
|
||||
} catch (e) {
|
||||
console.warn('[confirmRecheck] 缓存复核完成数据失败:', e);
|
||||
}
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user