fix(复核): 确认复核接口弱网防重入与错误提示区分网络/业务失败
- 新增 confirmRechecking 防重入标记,请求进行中忽略重复触发,避免弱网下重复复核/重复发货 - confirmRecheck 请求改为 10s 快速失败 + 关闭全局 toast,由本地统一处理错误 - 新增 handleConfirmRecheckError 区分网络异常与业务失败:网络异常提示结果未确认并语音播报,业务失败展示原始提示 - doGroupShip/afterPackageBinding 失败统一复用 handleConfirmRecheckError
This commit is contained in:
parent
031fb0c5b6
commit
4d33fc3241
@ -514,6 +514,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
skipPackagePopupOnAllScanned: false,
|
||||
// 订单全部为"无需复核"商品时的"点击商品卡片触发发货"防重入标志:每次进入新订单复位
|
||||
noRecheckAutoAdvanceHandled: false,
|
||||
// 确认复核接口弱网防重入:请求进行中标记,避免弱网下用户重复点击导致重复复核/重复发货
|
||||
confirmRechecking: false,
|
||||
showDetailView: false,
|
||||
showListDrawer: false,
|
||||
detailGoodsList: [],
|
||||
@ -2898,9 +2900,15 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
uni.showToast({ title: '缺少订单/波次ID', icon: 'none' });
|
||||
return false;
|
||||
}
|
||||
// 弱网防重入:上一次确认复核请求未完成时忽略本次触发,避免弱网下重复提交导致重复复核/重复发货
|
||||
if (this.confirmRechecking) {
|
||||
return false;
|
||||
}
|
||||
this.confirmRechecking = true;
|
||||
uni.showLoading({ title: '确认复核中...' });
|
||||
try {
|
||||
await this.$http('order.recheckOrder.confirmRecheck', params);
|
||||
// 确认复核为写操作:弱网下快速失败(10s)避免长时间挂起;toastAfter=false 关闭全局 toast,由 handleConfirmRecheckError 统一按弱网/业务失败区分提示
|
||||
await this.$http('order.recheckOrder.confirmRecheck', params, '', false, 'text', 10000);
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '已确认复核', icon: 'success' });
|
||||
// 通知订单复核页面更新列表状态
|
||||
@ -2945,9 +2953,32 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return true;
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const msg = String(error?.message || error?.msg || error?.errMsg || '确认复核失败');
|
||||
uni.showToast({ title: msg, icon: 'none' });
|
||||
this.handleConfirmRecheckError(error);
|
||||
return false;
|
||||
} finally {
|
||||
this.confirmRechecking = false;
|
||||
}
|
||||
},
|
||||
// 确认复核接口弱网/失败统一处理:区分网络异常与业务失败,避免误重试导致重复复核
|
||||
handleConfirmRecheckError(error) {
|
||||
const flag = String(error?.flag || '').trim();
|
||||
const rawMsg = String(error?.message || error?.msg || '').trim();
|
||||
const errMsg = String(error?.errMsg || '').trim();
|
||||
// 网络异常判定:请求层硬超时兜底返回 flag=failure 且 message 含"网络超时/超时";原生失败 errMsg 含 request:fail/timeout
|
||||
const isTimeout = flag === 'failure' && /网络超时|超时|timeout/.test(rawMsg);
|
||||
const isNativeFail = /request:fail|timeout/i.test(errMsg);
|
||||
const isNetworkError = isTimeout || isNativeFail;
|
||||
const toastText = isNetworkError
|
||||
? '网络异常,复核结果未确认,请检查网络后重试'
|
||||
: (rawMsg || '确认复核失败');
|
||||
uni.showToast({
|
||||
title: toastText,
|
||||
icon: 'none',
|
||||
// 网络异常/业务失败提示展示 5s,便于 PDA 现场确认
|
||||
duration: 5000
|
||||
});
|
||||
if (isNetworkError) {
|
||||
this.speakVoice('网络异常,请检查网络');
|
||||
}
|
||||
},
|
||||
handleDetailAllScanned() {
|
||||
@ -3192,8 +3223,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
this.afterPackageBinding();
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const message = String(error?.message || error?.msg || error?.errMsg || '复核提交失败');
|
||||
uni.showToast({ title: message, icon: 'none' });
|
||||
this.handleConfirmRecheckError(error);
|
||||
}
|
||||
},
|
||||
handlePackageBindingSkip() {
|
||||
@ -3206,7 +3236,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
if (!params) {
|
||||
throw new Error('缺少订单/波次ID');
|
||||
}
|
||||
await this.$http('order.recheckOrder.confirmRecheck', params);
|
||||
// 确认复核为写操作:弱网下快速失败(10s);toastAfter=false 关闭全局 toast,由 doGroupShip 的 catch 统一处理
|
||||
await this.$http('order.recheckOrder.confirmRecheck', params, '', false, 'text', 10000);
|
||||
// 通知订单复核页面更新列表状态
|
||||
uni.$emit('orderReviewCompleted', {
|
||||
orderId: this.detailInfo.orderId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user