修改绑定包材页面
This commit is contained in:
parent
2a7847de15
commit
b92d796805
@ -187,7 +187,8 @@ import voice from '@/core/utils/voice';
|
|||||||
this.showOrderInfo = true;
|
this.showOrderInfo = true;
|
||||||
uni.showToast({ title: '查询成功', icon: 'success' });
|
uni.showToast({ title: '查询成功', icon: 'success' });
|
||||||
// 3. 后台静默加载已绑定的包材信息(不阻塞界面)
|
// 3. 后台静默加载已绑定的包材信息(不阻塞界面)
|
||||||
this.loadBoundPackageMaterial(orderId);
|
// 传入扫描的运单号,用于匹配主单/子单对应的包材
|
||||||
|
this.loadBoundPackageMaterial(orderId, code);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: (toOrderRes && toOrderRes.msg) || '查询失败', icon: 'none' });
|
uni.showToast({ title: (toOrderRes && toOrderRes.msg) || '查询失败', icon: 'none' });
|
||||||
this.speakVoice('无记录');
|
this.speakVoice('无记录');
|
||||||
@ -200,20 +201,32 @@ import voice from '@/core/utils/voice';
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 后台静默加载已绑定的包材信息(不阻塞界面)
|
* 后台静默加载已绑定的包材信息(不阻塞界面)
|
||||||
*/
|
* @param {number} orderId 订单ID
|
||||||
async loadBoundPackageMaterial(orderId) {
|
* @param {string} waybillCode 当前扫描的运单号(可能为主单或子单)
|
||||||
|
*/
|
||||||
|
async loadBoundPackageMaterial(orderId, waybillCode) {
|
||||||
try {
|
try {
|
||||||
const detailRes = await this.$http('order.detail', { order_id: orderId, tableType: 'dispatch' }, '', false);
|
const detailRes = await this.$http('order.detail', { order_id: orderId, tableType: 'dispatch' }, '', false);
|
||||||
if (detailRes && detailRes.flag !== 'failure') {
|
if (detailRes && detailRes.flag !== 'failure') {
|
||||||
const detailData = detailRes.data || {};
|
const detailData = detailRes.data || {};
|
||||||
const firstExpress = (detailData.expresses || [])[0];
|
const expresses = detailData.expresses || [];
|
||||||
if (firstExpress && firstExpress.package_material_id) {
|
const targetCode = String(waybillCode || '').trim();
|
||||||
|
// 仅按当前扫描的运单号(主单/子单)精确匹配对应的快递记录,未命中则显示空值
|
||||||
|
const matchedExpress = expresses.find(e => {
|
||||||
|
const codeOf = String(e.waybill_code || e.waybill_no || e.waybillCode || '').trim();
|
||||||
|
return codeOf === targetCode;
|
||||||
|
});
|
||||||
|
if (matchedExpress && matchedExpress.package_material_id) {
|
||||||
this.suggestedPkg = {
|
this.suggestedPkg = {
|
||||||
id: firstExpress.package_material_id,
|
id: matchedExpress.package_material_id,
|
||||||
name: firstExpress.package_material_name_snapshot
|
name: matchedExpress.package_material_name_snapshot
|
||||||
};
|
};
|
||||||
this.packageInputCode = firstExpress.package_material_name_snapshot || '';
|
this.packageInputCode = matchedExpress.package_material_name_snapshot || '';
|
||||||
|
} else {
|
||||||
|
// 未命中对应运单:清空包材显示
|
||||||
|
this.suggestedPkg = null;
|
||||||
|
this.packageInputCode = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user