修改称重、复核发货页面

This commit is contained in:
zm2000 2026-07-12 16:05:58 +08:00
parent e08fa1c8ce
commit 37a962d27a
2 changed files with 75 additions and 42 deletions

View File

@ -53,8 +53,8 @@
@goodsItemClick="handleGoodsItemClick"
/>
<view v-else class="detail-empty">
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
<text class="empty-text">请搜索或扫码选择订单进行复核</text>
<u-icon :name="isDprefixedWave ? 'scan' : 'list'" size="86" color="#c0c4cc"></u-icon>
<text class="empty-text">{{ isDprefixedWave ? '请扫描商品条码进行复核' : '请搜索或扫码选择订单进行复核' }}</text>
</view>
</view>
@ -1960,7 +1960,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.listExpanded = false;
// D前缀波次:自动标记所有商品为已扫,跳过逐件扫描
if (this.isDprefixedWave && this.detailGoodsList.length > 0) {
// 已复核订单不再触发自动复核/打印,仅展示只读详情
if (this.isDprefixedWave && this.detailGoodsList.length > 0 && !item.isReviewed) {
this.detailGoodsList = this.detailGoodsList.map(g => ({
...g,
scannedQty: g.planQty
@ -1987,7 +1988,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.showDetailView = false;
this.detailGoodsList = [];
// 从详情返回后刷新列表
if (this.keyword) {
// D波次:keyword 是商品条码,scanOrder 不支持,依赖本地已更新的 orderList
if (this.keyword && !this.isDprefixedWave) {
this.requestScanOrder(this.keyword, true);
}
},
@ -2033,9 +2035,26 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
}
}
// 刷新订单列表数据
if (this.keyword) {
// 非D波次:keyword 是运单号/波次号,可用 scanOrder 刷新
// D波次:keyword 是商品条码,scanOrder 不支持,依赖本地更新
if (this.keyword && !this.isDprefixedWave) {
this.requestScanOrder(this.keyword, true);
}
// 标记当前已复核(本地更新,即使 requestScanOrder 不刷新也能保持正确状态)
const currentId = String(this.detailInfo?.orderId || this.detailInfo?.recordId || '');
if (currentId) {
const id = Number(currentId);
if (id > 0 && !this.reviewedOrderIds.includes(id)) {
this.reviewedOrderIds = [...this.reviewedOrderIds, id];
}
this.orderList = this.orderList.map(item => {
const itemId = Number(item.id || item.orderId || 0);
if (itemId === id) {
return { ...item, isReviewed: true, unreviewedCount: 0 };
}
return item;
});
}
this.speakVoice('发货成功');
return true;
} catch (error) {

View File

@ -144,6 +144,44 @@ import voice from '@/core/utils/voice';
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
async fetchOrderDetail(code) {
try {
const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false);
if (toOrderRes && toOrderRes.flag !== 'failure') {
const rawOrderId = Number(toOrderRes.order_id);
if (rawOrderId > 0) {
this.orderInfo.order_id = rawOrderId;
}
this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : [];
// 调用 order.detail 获取订单详情
try {
const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id, tableType: 'dispatch' }, '', false);
if (detailRes && detailRes.flag !== 'failure') {
const detailData = detailRes.data || {};
this.orderDetail = detailData.detail || null;
this.orderItems = detailData.items || [];
this.expresses = detailData.expresses || [];
// 从订单详情中更新商品净重
if (detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) {
this.netWeight = detailData.detail.items_weight;
}
// 从运单信息中更新称重重量
const firstExpress = (detailData.expresses || [])[0];
if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) {
// 接口返回 kg,页面显示 g,乘以 1000 转换
this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000));
}
}
} catch (e) {
console.error('获取订单详情失败', e);
}
}
} catch (e) {
console.error('获取波次信息失败', e);
}
},
async fetchOrderInfo(code) {
uni.showLoading({ title: '查询中...' });
try {
@ -205,49 +243,25 @@ import voice from '@/core/utils/voice';
this.manualWeight = waveItem?.items_weight ? String(waveItem.items_weight) : '';
}
// 调用 index.toOrder 获取订单ID及所属波次信息
try {
const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false);
if (toOrderRes && toOrderRes.flag !== 'failure') {
const rawOrderId = Number(toOrderRes.order_id);
if (rawOrderId > 0) {
this.orderInfo.order_id = rawOrderId;
}
this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : [];
// 调用 order.detail 获取订单详情
try {
const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id }, '', false);
if (detailRes && detailRes.flag !== 'failure') {
const detailData = detailRes.data || {};
this.orderDetail = detailData.detail || null;
this.orderItems = detailData.items || [];
this.expresses = detailData.expresses || [];
// 从订单详情中更新商品净重
if (detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) {
this.netWeight = detailData.detail.items_weight;
}
// 从运单信息中更新称重重量
const firstExpress = (detailData.expresses || [])[0];
if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) {
// 接口返回 kg,页面显示 g,乘以 1000 转换
this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000));
}
}
} catch (e) {
console.error('获取订单详情失败', e);
}
}
} catch (e) {
console.error('获取波次信息失败', e);
}
// 调用 index.toOrder 获取订单ID及所属波次信息(已提取到 fetchOrderDetail 方法)
await this.fetchOrderDetail(code);
this.showOrderInfo = true;
// 自动聚焦称重重量输入框
this.$nextTick(() => {
this.weightFocused = true;
});
} else if (res && res.message === '接口错误: 未找到对应订单') {
// 未找到对应订单时跳过未复核检测,继续查询
this.orderInfo = {
order_id: 0,
waybill_code: code
};
this.showOrderInfo = true;
await this.fetchOrderDetail(code);
this.$nextTick(() => {
this.weightFocused = true;
});
} else {
uni.showToast({ title: res.msg || '查询失败', icon: 'none' });
this.speakVoice('无记录');