修改绑定包材、复核发货页面
This commit is contained in:
parent
840dd35a10
commit
4002c9feeb
@ -628,11 +628,15 @@ import voice from '@/core/utils/voice';
|
|||||||
}
|
}
|
||||||
|
|
||||||
.header-title {
|
.header-title {
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: 600;
|
|
||||||
color: #303133;
|
|
||||||
text-align: center;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-right {
|
.header-right {
|
||||||
|
|||||||
@ -326,9 +326,9 @@
|
|||||||
.header-title {
|
.header-title {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 0 16rpx;
|
padding: 0 16rpx;
|
||||||
font-size: 34rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 600;
|
font-weight: bold;
|
||||||
color: #303133;
|
color: #333;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="package-binding-page">
|
<view class="package-binding-page">
|
||||||
<view class="normar_container">
|
<view class="normar_container">
|
||||||
<page-nav title="包材绑定">
|
<page-nav title="绑定包材">
|
||||||
<template #left>
|
<template #left>
|
||||||
<view
|
<view
|
||||||
class="nav-manual-input"
|
class="nav-manual-input"
|
||||||
@ -114,14 +114,15 @@ import voice from '@/core/utils/voice';
|
|||||||
this.$store.dispatch('broadcast/stop');
|
this.$store.dispatch('broadcast/stop');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onScanData(data) {
|
async onScanData(data) {
|
||||||
const scanText = data && data.data ? data.data.trim() : '';
|
const scanText = data && data.data ? data.data.trim() : '';
|
||||||
console.log('[包材绑定] 广播扫描到数据:', scanText);
|
console.log('[包材绑定] 广播扫描到数据:', scanText);
|
||||||
if (!scanText) return;
|
if (!scanText) return;
|
||||||
// 如果已显示订单信息,则扫描结果作为包材条码处理
|
// 如果已显示订单信息,则扫描结果作为包材条码处理
|
||||||
if (this.showOrderInfo) {
|
if (this.showOrderInfo) {
|
||||||
this.packageInputCode = scanText;
|
this.packageInputCode = scanText;
|
||||||
this.handlePackageCodeSearch(scanText);
|
await this.$nextTick();
|
||||||
|
await this.handlePackageCodeSearch(scanText);
|
||||||
} else {
|
} else {
|
||||||
this.scanInput = scanText;
|
this.scanInput = scanText;
|
||||||
this.handleScanConfirm(scanText);
|
this.handleScanConfirm(scanText);
|
||||||
@ -157,29 +158,41 @@ import voice from '@/core/utils/voice';
|
|||||||
async fetchOrderInfo(code) {
|
async fetchOrderInfo(code) {
|
||||||
uni.showLoading({ title: '查询中...' });
|
uni.showLoading({ title: '查询中...' });
|
||||||
try {
|
try {
|
||||||
const res = await this.$http('order.recheckOrder.scanOrder', { waybill_code: code }, '', false);
|
// 1. 调用 index.toOrder 用运单号获取订单ID
|
||||||
if (res && res.flag !== 'failure') {
|
const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false);
|
||||||
const data = res.data || {};
|
if (toOrderRes && toOrderRes.flag !== 'failure') {
|
||||||
|
const orderId = Number(toOrderRes.order_id);
|
||||||
|
if (!orderId || orderId <= 0) {
|
||||||
|
uni.showToast({ title: '未找到订单', icon: 'none' });
|
||||||
|
this.speakVoice('无记录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.orderInfo = {
|
this.orderInfo = {
|
||||||
order_id: data.order_id || 0,
|
order_id: orderId,
|
||||||
waybill_code: code
|
waybill_code: code
|
||||||
};
|
};
|
||||||
// 获取推荐包材
|
// 2. 调用 order.detail 用订单ID获取已绑定的包材数据
|
||||||
if (data.suggested_package_material) {
|
try {
|
||||||
this.suggestedPkg = data.suggested_package_material;
|
const detailRes = await this.$http('order.detail', { order_id: orderId, tableType: 'dispatch' }, '', false);
|
||||||
} else if (Array.isArray(data.list) && data.list.length > 0) {
|
if (detailRes && detailRes.flag !== 'failure') {
|
||||||
const firstItem = data.list[0];
|
const detailData = detailRes.data || {};
|
||||||
if (firstItem.suggested_package_material) {
|
// 从运单信息中提取已绑定的包材
|
||||||
this.suggestedPkg = firstItem.suggested_package_material;
|
const firstExpress = (detailData.expresses || [])[0];
|
||||||
|
if (firstExpress && firstExpress.package_material_id) {
|
||||||
|
this.suggestedPkg = {
|
||||||
|
id: firstExpress.package_material_id,
|
||||||
|
name: firstExpress.package_material_name_snapshot
|
||||||
|
};
|
||||||
|
this.packageInputCode = firstExpress.package_material_name_snapshot || '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('获取订单详情失败', e);
|
||||||
}
|
}
|
||||||
this.showOrderInfo = true;
|
this.showOrderInfo = true;
|
||||||
this.$nextTick(() => {
|
|
||||||
this.packageFocused = true;
|
|
||||||
});
|
|
||||||
uni.showToast({ title: '查询成功', icon: 'success' });
|
uni.showToast({ title: '查询成功', icon: 'success' });
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: (res && res.msg) || '查询失败', icon: 'none' });
|
uni.showToast({ title: (toOrderRes && toOrderRes.msg) || '查询失败', icon: 'none' });
|
||||||
this.speakVoice('无记录');
|
this.speakVoice('无记录');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -200,10 +213,17 @@ import voice from '@/core/utils/voice';
|
|||||||
try {
|
try {
|
||||||
const res = await this.$http('setting.packageMaterial.search', { keyword: trimmed }, '', false);
|
const res = await this.$http('setting.packageMaterial.search', { keyword: trimmed }, '', false);
|
||||||
const list = Array.isArray(res?.data) ? res.data : [];
|
const list = Array.isArray(res?.data) ? res.data : [];
|
||||||
const matched = list.find(item => String(item.material_code || '') === trimmed);
|
// 优先按 material_code 精确匹配,再按 barcodes 数组匹配
|
||||||
|
const matched = list.find(item => {
|
||||||
|
if (String(item.material_code || '') === trimmed) return true;
|
||||||
|
const barcodes = item.barcodes || [];
|
||||||
|
return barcodes.some(b => String(b.barcode || '') === trimmed);
|
||||||
|
}) || list[0];
|
||||||
if (matched) {
|
if (matched) {
|
||||||
this.scannedPackageMaterial = matched;
|
this.scannedPackageMaterial = matched;
|
||||||
this.packageInputCode = matched.material_name || matched.material_code || trimmed;
|
this.packageInputCode = matched.material_name || matched.material_code || trimmed;
|
||||||
|
await this.$nextTick();
|
||||||
|
this.$forceUpdate();
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({ title: '数据一致', icon: 'success' });
|
uni.showToast({ title: '数据一致', icon: 'success' });
|
||||||
this.speakVoice('数据一致');
|
this.speakVoice('数据一致');
|
||||||
@ -287,6 +307,10 @@ import voice from '@/core/utils/voice';
|
|||||||
gap: 0;
|
gap: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::v-deep .nav-title .title {
|
||||||
|
padding-left: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
::v-deep .nav-title .right {
|
::v-deep .nav-title .right {
|
||||||
width: auto;
|
width: auto;
|
||||||
min-width: 80rpx;
|
min-width: 80rpx;
|
||||||
@ -399,7 +423,7 @@ import voice from '@/core/utils/voice';
|
|||||||
.info-value-input {
|
.info-value-input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: flex-start;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8rpx;
|
gap: 8rpx;
|
||||||
|
|
||||||
|
|||||||
@ -101,7 +101,7 @@
|
|||||||
<view class="list-table-header">
|
<view class="list-table-header">
|
||||||
<text class="list-table-col list-table-col--no">序号</text>
|
<text class="list-table-col list-table-col--no">序号</text>
|
||||||
<text class="list-table-col list-table-col--name">商品名称</text>
|
<text class="list-table-col list-table-col--name">商品名称</text>
|
||||||
<text class="list-table-col list-table-col--qty">计划</text>
|
<text class="list-table-col list-table-col--qty">数量</text>
|
||||||
<text class="list-table-col list-table-col--qty">已扫</text>
|
<text class="list-table-col list-table-col--qty">已扫</text>
|
||||||
<text class="list-table-col list-table-col--status">状态</text>
|
<text class="list-table-col list-table-col--status">状态</text>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user