修改复核发货、订单拣货、关于页面

This commit is contained in:
zm2000 2026-08-17 17:58:47 +08:00
parent b2d6172f16
commit 876e13c495
5 changed files with 136 additions and 21 deletions

View File

@ -79,6 +79,28 @@
</view>
</view>
</view>
<!-- 检查结果弹窗:未发现新版本时展示原因,便于真机排查 -->
<view v-if="showCheckResultDialog" class="update-mask">
<view class="update-dialog">
<view class="update-header">
<text class="update-title">检查结果</text>
<text class="update-version">{{ checkResultTitle || '未发现新版本' }}</text>
</view>
<view class="update-body">
<view class="update-tip-box">
<text class="update-tip">未弹出「发现新版本」的原因:</text>
<text class="update-tip">{{ checkResultMessage || '未知' }}</text>
<text v-if="checkResultDetail" class="update-tip">{{ checkResultDetail }}</text>
</view>
</view>
<view class="update-actions">
<u-button type="primary" text="知道了" @click="closeCheckResultDialog"></u-button>
</view>
</view>
</view>
</view>
</template>
@ -107,7 +129,12 @@ export default {
url: '',
sha256: '',
publishedAtUtc: ''
}
},
// ===== 检查结果弹窗:未发现新版本时展示原因(便于真机排查) =====
showCheckResultDialog: false,
checkResultTitle: '',
checkResultMessage: '',
checkResultDetail: ''
};
},
onLoad() {
@ -137,12 +164,8 @@ export default {
if (hasNewVersion) {
return;
}
// 没有新版本:区分「检查失败」与「已是最新」
if (this.updateErrorMessage) {
uni.showToast({ title: '更新检查失败', icon: 'none' });
} else {
uni.showToast({ title: '当前已是最新版本', icon: 'none' });
}
// 未发现新版本:弹出「检查结果」弹窗,展示不弹新版本的原因(便于真机排查)
this.showCheckResultDialog = true;
})
.finally(() => {
this.updateChecking = false;
@ -172,11 +195,13 @@ export default {
hasCheckedUpdate: this.hasCheckedUpdate,
isCheckingUpdate: this.isCheckingUpdate
});
this.setCheckResult('正在检查中', '上一次检查还未结束或已检查过,请稍后再试。');
return false;
}
if (typeof plus === 'undefined' || !plus.runtime) {
this.logUpdateStep('checkForAppUpdate -> 非 APP-PLUS 环境,跳过更新检查');
this.setCheckResult('当前环境不支持更新检查', '仅在 APP-PLUS(打包后的 App)环境中支持版本检查。');
return false;
}
@ -201,13 +226,20 @@ export default {
this.logUpdateStep('checkForAppUpdate -> 标准化后的远端配置', latestInfo || {});
if (!currentVersion) {
this.logUpdateStep('checkForAppUpdate -> 未获取到当前应用版本,无法比较', { currentVersion });
this.updateErrorMessage = '获取当前应用版本失败';
return false;
// 与登录页保持一致:读版本为空时不要中止流程,交给 isVersionNewer 继续比较。
// 否则真机 getProperty 回调慢/未及时触发(3s 超时返回空)时,
// 关于页会被这里拦截不弹窗,而登录页没有此拦截却正常弹窗。
this.logUpdateStep('checkForAppUpdate -> 未获取到当前应用版本,继续比较', { currentVersion });
this.setCheckResult('未能读取当前应用版本', 'plus.runtime.getProperty 未返回版本号(可能回调超时),将按远端版本进行比较。');
}
if (!latestInfo || !latestInfo.version || !latestInfo.url) {
this.logUpdateStep('checkForAppUpdate -> 远端配置缺少必要字段,结束', latestInfo || {});
this.setCheckResult(
'远端配置缺少必要字段',
'最新版本配置缺少 version 或 url,无法进行比较。',
`远端返回:${JSON.stringify(latestInfo || {})}`
);
return false;
}
@ -220,6 +252,10 @@ export default {
if (!isNewer) {
this.logUpdateStep('checkForAppUpdate -> 远端版本不高于当前版本,不弹窗');
this.setCheckResult(
'当前已是最新版本',
`本机版本 ${currentVersion || '未知'},远端最新 ${latestInfo.version},无需更新。`
);
return false;
}
@ -230,6 +266,7 @@ export default {
sha256: String(latestInfo.sha256 || '').trim(),
publishedAtUtc: String(latestInfo.publishedAtUtc || '').trim()
};
this.setCheckResult('', '', '');
this.showUpdateDialog = true;
this.logUpdateStep('checkForAppUpdate -> 发现新版本,显示更新弹窗', this.updateInfo);
return true;
@ -237,6 +274,11 @@ export default {
this.logUpdateStep('checkForAppUpdate -> 检查异常', error);
console.warn('[update] check failed:', error);
this.updateErrorMessage = error?.message || '更新检查失败';
this.setCheckResult(
'更新检查失败',
'获取更新配置时出错,可能是网络不通、域名无法访问或明文流量被拦截。',
`错误信息:${error?.message || error?.errMsg || '未知错误'}`
);
return false;
} finally {
this.isCheckingUpdate = false;
@ -389,6 +431,14 @@ export default {
this.updateErrorMessage = '';
this.logUpdateStep('closeUpdateDialog -> 用户取消更新,弹窗关闭');
},
setCheckResult(title, message, detail) {
this.checkResultTitle = title || '';
this.checkResultMessage = message || '';
this.checkResultDetail = detail || '';
},
closeCheckResultDialog() {
this.showCheckResultDialog = false;
},
confirmUpdateDownload() {
if (this.isDownloadingUpdate) {
this.logUpdateStep('confirmUpdateDownload -> 已在下载中,忽略重复点击');

View File

@ -358,9 +358,9 @@
flex: 1;
text-align: center;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
white-space: normal;
word-break: break-all;
line-height: 1.4;
font-size: 29rpx;
}

View File

@ -212,6 +212,10 @@
</view>
<view class="intercept-info-popup__body">
<template v-if="isWaveInterceptList">
<view class="intercept-info-popup__row">
<text class="intercept-info-popup__label">波次号</text>
<text class="intercept-info-popup__value">{{ detailInfo.waveNo || '--' }}</text>
</view>
<view class="intercept-info-popup__tip intercept-info-popup__tip--first">该波次以下订单已被拦截,请勿复核发货</view>
<view v-for="(o, idx) in detailInfo.interceptList" :key="idx" class="intercept-info-popup__row">
<text class="intercept-info-popup__label">运单号</text>
@ -402,8 +406,17 @@ import voice from '@/core/utils/voice';
},
interceptWaybill(o) {
// 安全获取拦截订单的运单号(模板中不支持可选链写法)
const text = String((o && (o.firstWaybillNo || o.waybillNo)) || '').trim();
return text || '--';
const waybill = String((o && (o.firstWaybillNo || o.waybillNo)) || '').trim();
// 团购模式:运单号-总订单数-波次索引(data.list[x].intercepted[x].wave_index)
if (String(this.detailInfo?.listType || '').trim() === 'group') {
const totalOrders = Number(o?.totalOrders ?? this.detailInfo?.totalOrders ?? 0);
const waveIndex = String(o?.waveIndex ?? '').trim();
const parts = [waybill || '--'];
parts.push(totalOrders > 0 ? String(totalOrders) : '--');
parts.push(waveIndex || '--');
return parts.join('-');
}
return waybill || '--';
},
isGoodsMatched(item) {
const id = String(item?.id || '');

View File

@ -458,6 +458,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
orderInterceptInfo: {},
_interceptContinueNext: false,
_interceptNotifiedIds: [],
_interceptAutoNotifiedIds: [],
keyboardHeight: 0,
weighWeight: 0,
weighAfterReview: false,
@ -1683,6 +1684,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.reviewedOrderIds = [];
this.currentOrderIndex = -1;
this._printFailDismissed = false;
// 重置拦截自动提示去重(每个波次本次会话只自动弹 1 次)
this._interceptAutoNotifiedIds = [];
// 数量回归1
this.scanQuantity = 1;
this.saveSettings();
@ -1767,6 +1770,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
const waveUnreviewed = Number(wave?.unreviewed_count ?? wave?.unreviewedCount ?? 0);
const waveStocks = Array.isArray(wave?.stocks) ? wave.stocks : [];
// 团购模式:解析波次内被拦截订单(intercepted),参考散单模式拦截处理
// totalOrders 取波次总订单数(data.list[x].total_orders),供拦截弹窗展示"运单号-总订单数-波次索引"
const waveTotalOrderCount = Number(wave?.total_orders ?? wave?.totalOrders ?? wave?.order_count ?? wave?.orderCount ?? 0);
const waveInterceptList = (Array.isArray(wave?.intercepted) ? wave.intercepted : [])
.filter(inter => inter && typeof inter === 'object')
.map(inter => ({
@ -1774,7 +1779,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
deliveryOrderCode: String(inter?.delivery_order_code || inter?.deliveryOrderCode || '').trim(),
waybillNo: String(inter?.waybill_no || inter?.waybillNo || '').trim(),
interceptStatus: String(inter?.intercept_status || inter?.interceptStatus || '').trim(),
waveIndex: String(inter?.wave_index ?? inter?.waveIndex ?? '').trim()
waveIndex: String(inter?.wave_index ?? inter?.waveIndex ?? '').trim(),
totalOrders: waveTotalOrderCount
}));
return {
waveNo: String(wave?.wave_no || wave?.waveNo || '').trim(),
@ -2555,6 +2561,32 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.showDetailView = true;
this.listExpanded = false;
// 团购模式:进入含拦截单的波次时自动弹出拦截信息提示(含波次号、运单号)
// 每个波次本次会话只自动弹 1 次(按 waveId/waveNo 去重);已复核波次仅展示只读详情,不自动弹窗
if (
this.listType === 'group' &&
String(this.detailInfo?.recheckStatus || '').toLowerCase() !== 'fin' &&
!!this.detailInfo?.waveHasIntercept &&
Array.isArray(this.detailInfo?.interceptList) &&
this.detailInfo.interceptList.length > 0
) {
// Vue2 下划线开头 data 字段不会代理到 this,先保证数组存在再使用(先赋值后读取)
if (!Array.isArray(this._interceptAutoNotifiedIds)) {
this._interceptAutoNotifiedIds = [];
}
const waveKey = String(this.detailInfo?.waveId || this.detailInfo?.waveNo || '').trim();
const alreadyNotified = !!waveKey && this._interceptAutoNotifiedIds.includes(waveKey);
if (!alreadyNotified) {
if (waveKey) {
this._interceptAutoNotifiedIds = [...this._interceptAutoNotifiedIds, waveKey];
}
// 团购模式:自动弹出拦截信息时同步语音提示"有拦截订单"
this.speakVoice('有拦截订单');
// 真机 App 下 v-if 子组件挂载可能滞后于 $nextTick,延迟重试确保 ReviewDetail 就绪后再打开弹窗
this.openInterceptInfoWhenReady();
}
}
// D前缀波次:仅当通过商品条码扫描匹配进入时,自动标记所有商品为已扫并触发复核发货
// 从订单列表抽屉点击进入时(无条码校验),仅展示详情,需手动扫描商品条码复核
// 已复核订单不再触发自动复核/打印,仅展示只读详情
@ -2606,6 +2638,18 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
this.$refs.reviewDetail.openInterceptInfo();
}
},
// 团购模式自动弹拦截信息:ReviewDetail 是 v-if 渲染的子组件,真机 App 上挂载可能滞后于 $nextTick,
// 因此轮询等待 $refs 就绪后再打开弹窗,避免出现"只播语音不弹窗"的问题
openInterceptInfoWhenReady(retries = 6) {
if (this.$refs.reviewDetail) {
this.$refs.reviewDetail.openInterceptInfo();
return;
}
if (retries <= 0) return;
setTimeout(() => {
this.openInterceptInfoWhenReady(retries - 1);
}, 150);
},
// 判断单个订单是否被拦截(散单模式拦截订单拦截入口使用)
isOrderIntercepted(item) {
const status = String(item?.interceptStatus || item?.intercept_status || '').trim();

View File

@ -942,7 +942,8 @@ import voice from '@/core/utils/voice';
this.bindCartNoInput = this.getBindCartNo(item);
},
async handleBindCartSearch() {
const keyword = String(this.bindCartQueryKeyword || this.bindCartNoInput || '').trim();
// 以输入框当前值作为查询关键字,避免 bindCartQueryKeyword 缓存旧值导致第二次手动查询仍显示第一次的数据
const keyword = String(this.bindCartNoInput || '').trim();
this.bindCartQueryKeyword = keyword;
this.bindCartListLoading = true;
try {
@ -967,13 +968,20 @@ import voice from '@/core/utils/voice';
? [payload.cart]
: (payload?.data && typeof payload.data === 'object' ? [payload.data] : (payload && typeof payload === 'object' ? [payload] : [])));
this.bindCartList = list.filter(item => this.getBindCartNo(item) !== '--');
if (this.bindCartList.length > 0 && !this.selectedBindCartItem) {
const boundItem = this.bindCartList.find(item => this.isBindCartBound(item));
this.selectedBindCartItem = boundItem || this.bindCartList[0];
this.bindCartNoInput = this.getBindCartNo(this.selectedBindCartItem);
if (this.bindCartList.length > 0) {
// 优先选中与当前输入一致的车,其次已绑定的车,最后列表第一台,避免选中项停留在上次查询的旧车上
const normalizedKeyword = this.normalizeBarcodeText(keyword);
const matched = this.bindCartList.find(item =>
this.normalizeBarcodeText(this.getBindCartNo(item)) === normalizedKeyword
) || this.bindCartList.find(item => this.isBindCartBound(item)) || this.bindCartList[0];
this.selectedBindCartItem = matched;
this.bindCartNoInput = this.getBindCartNo(matched);
} else {
this.selectedBindCartItem = null;
}
} catch (error) {
this.bindCartList = [];
this.selectedBindCartItem = null;
this.showErrorModal(this.getApiErrorMessage(error, '查询拣货车失败'));
} finally {
this.bindCartListLoading = false;