修改复核发货页面
This commit is contained in:
parent
163fbc86a7
commit
b51a149d15
@ -360,7 +360,7 @@
|
|||||||
<view class="print-fail-popup">
|
<view class="print-fail-popup">
|
||||||
<view class="print-fail-popup-title">打印未完成</view>
|
<view class="print-fail-popup-title">打印未完成</view>
|
||||||
<view class="print-fail-popup-body">
|
<view class="print-fail-popup-body">
|
||||||
<text class="print-fail-popup-text">打印失败或超时,未触发发货。请重试打印,打印成功后将自动发货。</text>
|
<text class="print-fail-popup-text">{{ printFailBodyText }}</text>
|
||||||
<view v-if="printFailMessage" class="print-fail-popup-msg">
|
<view v-if="printFailMessage" class="print-fail-popup-msg">
|
||||||
<text class="print-fail-popup-msg__text">{{ printFailMessage }}</text>
|
<text class="print-fail-popup-msg__text">{{ printFailMessage }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -613,6 +613,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
return this.printMode;
|
return this.printMode;
|
||||||
},
|
},
|
||||||
|
printFailBodyText() {
|
||||||
|
if (this.pendingShipAction === 'groupShip') {
|
||||||
|
return '打印失败或超时,未触发发货。请重试打印,打印成功后将进入包材绑定。';
|
||||||
|
}
|
||||||
|
return '打印失败或超时,未触发发货。请重试打印,打印成功后将自动发货。';
|
||||||
|
},
|
||||||
isDprefixedWave() {
|
isDprefixedWave() {
|
||||||
// 单品单件订单,无需逐件扫描
|
// 单品单件订单,无需逐件扫描
|
||||||
// 优先根据 pick_mode=2 判断(scanOrder 接口返回),D前缀波次作为兼容兜底
|
// 优先根据 pick_mode=2 判断(scanOrder 接口返回),D前缀波次作为兼容兜底
|
||||||
@ -2920,6 +2926,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dprefixedAllScannedHandled = true;
|
this.dprefixedAllScannedHandled = true;
|
||||||
|
// 团单:全部商品已复核完成时,先判断打印是否成功,打印未成功弹「打印未完成」弹窗
|
||||||
|
if (this.listType === 'group') {
|
||||||
|
this.handleGroupAllScanned();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 散单模式不走包材流程
|
// 散单模式不走包材流程
|
||||||
if (this.listType !== 'single' && this.enablePackageBinding) {
|
if (this.listType !== 'single' && this.enablePackageBinding) {
|
||||||
this.packageInputCode = '';
|
this.packageInputCode = '';
|
||||||
@ -2933,6 +2944,23 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
this.afterPackageBinding();
|
this.afterPackageBinding();
|
||||||
},
|
},
|
||||||
|
// 团单全部商品已复核完成:先判断打印是否成功,打印成功才弹包材绑定弹窗
|
||||||
|
async handleGroupAllScanned() {
|
||||||
|
if (!(await this.ensurePrintedBeforeShip('groupShip'))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.openGroupPackageBinding();
|
||||||
|
},
|
||||||
|
// 弹包材绑定弹窗(打印成功 / 打印失败重试成功后进入包材绑定)
|
||||||
|
openGroupPackageBinding() {
|
||||||
|
this.packageInputCode = '';
|
||||||
|
this.scannedPackageCode = '';
|
||||||
|
this.scannedPackageId = '';
|
||||||
|
this.scannedPackageMaterial = null;
|
||||||
|
this.suggestedPkg = this.detailInfo?.suggestedPkg || null;
|
||||||
|
console.log('[packageBinding] 推荐包材数据:', JSON.stringify(this.suggestedPkg));
|
||||||
|
this.showPackageBindingPopup = true;
|
||||||
|
},
|
||||||
handleGoodsItemClick() {
|
handleGoodsItemClick() {
|
||||||
// 打印未完成被关闭后(订单未打印未发货),点击商品列表项只重新弹出打印未完成弹窗,不自动重试打印
|
// 打印未完成被关闭后(订单未打印未发货),点击商品列表项只重新弹出打印未完成弹窗,不自动重试打印
|
||||||
if (this.printFailDismissed && !this.showPrintFailPopup) {
|
if (this.printFailDismissed && !this.showPrintFailPopup) {
|
||||||
@ -2989,16 +3017,16 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
// 团购模式始终需要称重,散单根据设置
|
// 团购模式始终需要称重,散单根据设置
|
||||||
const needWeigh = this.listType === 'group' || this.weighAfterReview;
|
const needWeigh = this.listType === 'group' || this.weighAfterReview;
|
||||||
if (needWeigh) {
|
if (needWeigh && this.listType === 'group') {
|
||||||
console.log('[weigh] listType:', this.listType, 'itemsWeight:', this.detailInfo?.itemsWeight, 'refWeightG:', this.refWeightG);
|
console.log('[weigh] listType:', this.listType, 'itemsWeight:', this.detailInfo?.itemsWeight, 'refWeightG:', this.refWeightG);
|
||||||
// 需要称重:弹出称重抽屉
|
// 团购模式:弹出称重抽屉(发货已在包材绑定确认时完成)
|
||||||
this.weighWeight = 0;
|
this.weighWeight = 0;
|
||||||
this.showWeighPopup = true;
|
this.showWeighPopup = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 不需要称重
|
// 散单(需要/不需要称重统一):先打印成功 → 发货;需要称重时发货成功后弹称重弹窗
|
||||||
if (this.autoShip) {
|
if (this.autoShip) {
|
||||||
// 自动发货:直接调用复核API后进下一单
|
// 自动发货:直接调用复核API后进下一单(需要称重时复核后弹称重弹窗)
|
||||||
this.handleAutoConfirmAndNext();
|
this.handleAutoConfirmAndNext();
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -3060,6 +3088,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
async handlePackageBindingConfirm() {
|
async handlePackageBindingConfirm() {
|
||||||
this.showPackageBindingPopup = false;
|
this.showPackageBindingPopup = false;
|
||||||
this.packageBindingCancelled = false;
|
this.packageBindingCancelled = false;
|
||||||
|
// 团单的打印确认已在「全部商品复核完成」时完成,此处直接发货
|
||||||
|
await this.doGroupShip();
|
||||||
|
},
|
||||||
|
// 团单发货:提交复核 + 包材绑定 + 后续流程(包材绑定确认、打印失败重试后共用)
|
||||||
|
async doGroupShip() {
|
||||||
uni.showLoading({ title: '提交复核中...' });
|
uni.showLoading({ title: '提交复核中...' });
|
||||||
try {
|
try {
|
||||||
const waybillNo = String(this.detailInfo?.waybillNo || '').trim();
|
const waybillNo = String(this.detailInfo?.waybillNo || '').trim();
|
||||||
@ -3386,6 +3419,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
const ok = await this.callConfirmRecheck();
|
const ok = await this.callConfirmRecheck();
|
||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
this.printFailDismissed = false;
|
this.printFailDismissed = false;
|
||||||
|
// 散单称重模式:发货(确认复核)成功后弹出称重弹窗,称重完成后再进入下一单
|
||||||
|
if (this.listType === 'single' && this.weighAfterReview && !this.isDprefixedWave) {
|
||||||
|
this.weighWeight = 0;
|
||||||
|
this.showWeighPopup = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (action === 'dprefixed') {
|
if (action === 'dprefixed') {
|
||||||
// D前缀波次:确认复核后返回列表,等待下一个商品条码扫描定位
|
// D前缀波次:确认复核后返回列表,等待下一个商品条码扫描定位
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -3415,6 +3454,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
this.detailInfo = { ...this.detailInfo, isPrinted: true, unprintedCount: 0 };
|
||||||
this.updateOrderPrintStatus(this.detailInfo);
|
this.updateOrderPrintStatus(this.detailInfo);
|
||||||
this.speakVoice('打印成功');
|
this.speakVoice('打印成功');
|
||||||
|
// 团单:打印成功后重新进入包材绑定(发货在包材绑定确认时完成)
|
||||||
|
if (this.pendingShipAction === 'groupShip') {
|
||||||
|
this.openGroupPackageBinding();
|
||||||
|
return;
|
||||||
|
}
|
||||||
await this.doShip(this.pendingShipAction || 'autoNext');
|
await this.doShip(this.pendingShipAction || 'autoNext');
|
||||||
},
|
},
|
||||||
goToNextOrder() {
|
goToNextOrder() {
|
||||||
@ -3648,17 +3692,25 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
if (!waveGroups.length) return;
|
if (!waveGroups.length) return;
|
||||||
|
|
||||||
this.printRequestCode = this.buildPrintRequestCode();
|
this.printRequestCode = this.buildPrintRequestCode();
|
||||||
await this.$http('print.send', {
|
const response = await this.$http('print.send', {
|
||||||
type: 'express',
|
type: 'express',
|
||||||
printStationId: this.printStationId,
|
printStationId: this.printStationId,
|
||||||
requestCode: this.printRequestCode,
|
requestCode: this.printRequestCode,
|
||||||
data: { waveGroups }
|
data: { waveGroups }
|
||||||
});
|
});
|
||||||
|
// 检查打印结果:失败时不更新打印状态,发货前 ensurePrintedBeforeShip 会重新打印并拦截发货
|
||||||
|
const success = response?.flag !== 'failure' && response?.code !== '500' && response?.code !== 500;
|
||||||
|
if (!success) {
|
||||||
|
this.lastPrintError = String(response?.message || response?.msg || '打印失败');
|
||||||
|
console.warn('[autoPrint] 自动打印失败:', this.lastPrintError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log('[autoPrint] 自动打印发送成功');
|
console.log('[autoPrint] 自动打印发送成功');
|
||||||
// 同步更新订单列表中的打印状态
|
// 同步更新订单列表中的打印状态
|
||||||
this.updateOrderPrintStatus(item);
|
this.updateOrderPrintStatus(item);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('[autoPrint] 自动打印失败:', error?.message || error);
|
this.lastPrintError = String(error?.message || error?.msg || error?.errMsg || '打印失败或超时');
|
||||||
|
console.warn('[autoPrint] 自动打印失败:', this.lastPrintError);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateOrderPrintStatus(item) {
|
updateOrderPrintStatus(item) {
|
||||||
@ -3686,6 +3738,19 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
|||||||
}
|
}
|
||||||
return o;
|
return o;
|
||||||
});
|
});
|
||||||
|
// 同步 detailInfo 打印状态:波次打印成功后视为已打印,避免发货前 ensurePrintedBeforeShip 重复打印
|
||||||
|
if (this.detailInfo) {
|
||||||
|
const detailId = String(this.detailInfo.orderId || this.detailInfo.recordId || '');
|
||||||
|
const detailWaveNo = String(this.detailInfo.waveNo || '');
|
||||||
|
const detailWaveId = String(this.detailInfo.waveId || '');
|
||||||
|
const itemWaveId = String(item.waveId || '');
|
||||||
|
const matched = detailId === itemId
|
||||||
|
|| (waveNo && detailWaveNo === waveNo)
|
||||||
|
|| (itemWaveId && detailWaveId === itemWaveId);
|
||||||
|
if (matched) {
|
||||||
|
this.detailInfo = { ...this.detailInfo, unprintedCount: 0, isPrinted: true };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async handlePrintOrder(item, options = {}) {
|
async handlePrintOrder(item, options = {}) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user