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