|
|
|
|
@ -24,6 +24,8 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
|
|
<!-- 1. 物料箱条码 (使用 oneInput) --> |
|
|
|
|
<uni-forms-item label="物料箱条码:" label-width="100px"> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
@ -35,40 +37,20 @@ |
|
|
|
|
<view class="input-box"> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="boxCode" |
|
|
|
|
@confirm="handleBoxConfirm" |
|
|
|
|
v-model="oneInput" |
|
|
|
|
@input="oneInputBlur" |
|
|
|
|
placeholder="物料箱条码" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
confirm-type="done" |
|
|
|
|
:focus="boxInputFocus" |
|
|
|
|
:key="'box-' + boxInputFocus" |
|
|
|
|
/> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<!-- <button |
|
|
|
|
@click="handleSubmit" |
|
|
|
|
:disabled="!startData || !endCenter" |
|
|
|
|
class="submit-btn" |
|
|
|
|
:class="{ 'btn-disabled': !startData || !endCenter }" |
|
|
|
|
> |
|
|
|
|
配送 |
|
|
|
|
</button> --> |
|
|
|
|
</view> |
|
|
|
|
<!-- <view v-if="boxData" class="box-info"> |
|
|
|
|
<view class="info-section"> |
|
|
|
|
<text class="info-text"> |
|
|
|
|
包含订单: |
|
|
|
|
<text class="info-value">{{ boxData.quantity }}</text> 单 |
|
|
|
|
</text> |
|
|
|
|
<text class="info-text"> |
|
|
|
|
对应中心: |
|
|
|
|
<text class="info-value-center">{{ boxData.wcName }}</text> |
|
|
|
|
</text> |
|
|
|
|
</view> |
|
|
|
|
<button @click="detailsFn()" class="details-btn"> |
|
|
|
|
明细 <text class="arrow">›</text> |
|
|
|
|
</button> |
|
|
|
|
</view> --> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
|
|
<!-- 2. 起点站点/区域 (使用 twoInput) --> |
|
|
|
|
<uni-forms-item |
|
|
|
|
label="起点站点:" |
|
|
|
|
label-width="100px" |
|
|
|
|
@ -82,18 +64,21 @@ |
|
|
|
|
</template> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="startCode" |
|
|
|
|
@confirm="handleStartConfirm" |
|
|
|
|
v-model="twoInput" |
|
|
|
|
@input="twoInputBlur" |
|
|
|
|
placeholder="站点码" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
confirm-type="done" |
|
|
|
|
:focus="startInputFocus" |
|
|
|
|
:key="'start-' + startInputFocus" |
|
|
|
|
/> |
|
|
|
|
<view v-if="startData" class="start-confirm"> |
|
|
|
|
<text class="check-icon">✓</text> |
|
|
|
|
<text class="confirm-text">已确认: {{ startData.stationName }}</text> |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
|
|
<!-- 叫料模式下的起点选择 (保持 Picker 不变,但逻辑需适配) --> |
|
|
|
|
<uni-forms-item label="起点区域:" label-width="100px" v-else> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
@ -135,6 +120,8 @@ |
|
|
|
|
>暂无可配送物料</text |
|
|
|
|
> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
|
|
<!-- 3. 终点区域 (使用 therrInput 用于叫料模式的扫码) --> |
|
|
|
|
<uni-forms-item |
|
|
|
|
label="终点区域:" |
|
|
|
|
label-width="150px" |
|
|
|
|
@ -176,27 +163,32 @@ |
|
|
|
|
</text> |
|
|
|
|
</view> |
|
|
|
|
</picker> |
|
|
|
|
<!-- 终点区域选择 - 无数据时显示提示 --> |
|
|
|
|
<view v-else class="empty-tip-picker"> |
|
|
|
|
<text class="empty-text">暂无数据</text> |
|
|
|
|
</view> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
|
|
|
|
|
<!-- 叫料模式下的终点扫码 --> |
|
|
|
|
<uni-forms-item label="终点区域:" label-width="150px" v-else> |
|
|
|
|
<template #label> |
|
|
|
|
<view class="required-label"> |
|
|
|
|
<text class="required-mark">*</text> |
|
|
|
|
<text>终点区域:</text> |
|
|
|
|
</view> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="endStationCode" |
|
|
|
|
placeholder="请扫描区域码" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
confirm-type="done" |
|
|
|
|
/> |
|
|
|
|
</template> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="therrInput" |
|
|
|
|
@input="therrInputBlur" |
|
|
|
|
placeholder="请扫描区域码" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
confirm-type="done" |
|
|
|
|
:focus="endInputFocus" |
|
|
|
|
:key="'end-' + endInputFocus" |
|
|
|
|
/> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</uni-forms> |
|
|
|
|
|
|
|
|
|
<view class="footer-action"> |
|
|
|
|
<button |
|
|
|
|
@click="handleSubmit" |
|
|
|
|
@ -212,38 +204,47 @@ |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import ifrm from "@/pages/index/ifrm"; |
|
|
|
|
import inputBlur from '@/mixin/inputBlur.js'; // 引入 mixin |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
mixins: [inputBlur], // 注册 mixin |
|
|
|
|
components: { |
|
|
|
|
ifrm, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
boxCode: "", |
|
|
|
|
startCode: "", |
|
|
|
|
// 移除 boxCode, startCode, endStationCode,改用 mixin 的 oneInput, twoInput, therrInput |
|
|
|
|
|
|
|
|
|
boxData: null, |
|
|
|
|
startData: null, |
|
|
|
|
showDetails: false, |
|
|
|
|
|
|
|
|
|
// 焦点控制变量 |
|
|
|
|
boxInputFocus: true, |
|
|
|
|
startInputFocus: false, |
|
|
|
|
endInputFocus: false, // 新增:终点输入框焦点 |
|
|
|
|
|
|
|
|
|
mockBoxes: {}, |
|
|
|
|
workCenters: [], |
|
|
|
|
yieldOrderList: [], //订单明细 |
|
|
|
|
yieldOrderList: [], |
|
|
|
|
scanMode: "bind", |
|
|
|
|
hasData: false, |
|
|
|
|
workCenters: [], // 作业中心列表 |
|
|
|
|
endAreas: [], // 终点区域列表 |
|
|
|
|
endCenter: "", // 选中的作业中心 |
|
|
|
|
endArea: "", // 选中的终点区域 |
|
|
|
|
endCenterIndex: 0, // 作业中心选中索引 |
|
|
|
|
endAreaIndex: 0, // 终点区域选中索引 |
|
|
|
|
startAreas: [], // 起点区域列表 |
|
|
|
|
startStations: [], // 起点站点列表 |
|
|
|
|
startArea: "蓝色周转盒放置区", // 选中的起点区域 |
|
|
|
|
startStation: "", // 选中的起点站点 |
|
|
|
|
startAreaIndex: 0, // 起点区域选中索引 |
|
|
|
|
startStationIndex: 0, // 起点站点选中索引 |
|
|
|
|
endStationCode: "", //叫料终点 |
|
|
|
|
|
|
|
|
|
workCenters: [], |
|
|
|
|
endAreas: [], |
|
|
|
|
endCenter: "", |
|
|
|
|
endArea: "", |
|
|
|
|
endCenterIndex: 0, |
|
|
|
|
endAreaIndex: 0, |
|
|
|
|
|
|
|
|
|
startAreas: [], |
|
|
|
|
startStations: [], |
|
|
|
|
startArea: "蓝色周转盒放置区", |
|
|
|
|
startStation: "", |
|
|
|
|
startAreaIndex: 0, |
|
|
|
|
startStationIndex: 0, |
|
|
|
|
|
|
|
|
|
// endStationCode 移除,改用 therrInput |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
@ -252,25 +253,10 @@ export default { |
|
|
|
|
return !this.startData || !this.endCenter; |
|
|
|
|
} |
|
|
|
|
if (this.scanMode == "unbind") { |
|
|
|
|
return !this.endStationCode || !this.startStation; |
|
|
|
|
// 叫料模式:需要起点站点和终点扫码值 |
|
|
|
|
return !this.startStation || !this.therrInput; |
|
|
|
|
} |
|
|
|
|
// // 必须填写物料箱条码和终点作业中心 |
|
|
|
|
// if (!this.endCenterIndex) { |
|
|
|
|
// return false; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// // 根据模式校验起点 |
|
|
|
|
// if (this.scanMode == "bind") { |
|
|
|
|
// console.log(4444444, !this.startData); |
|
|
|
|
// // 送料模式:需要 startData |
|
|
|
|
// return !this.startData; |
|
|
|
|
// } else if (this.scanMode == "unbind") { |
|
|
|
|
// console.log(3333333333, !this.startStationIndex); |
|
|
|
|
// // 叫料模式:需要 startStation |
|
|
|
|
// return !this.startStationIndex; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// return false; |
|
|
|
|
return true; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
@ -280,17 +266,82 @@ export default { |
|
|
|
|
this.$refs.ifrm.topMenuClick(btn); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 【核心】实现 mixin 回调:处理物料箱扫码 |
|
|
|
|
oneInputData(val) { |
|
|
|
|
if (!val) return; |
|
|
|
|
const code = val.trim(); |
|
|
|
|
this.handleBoxConfirmLogic(code); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 【核心】实现 mixin 回调:处理起点站点扫码 |
|
|
|
|
twoInputData(val) { |
|
|
|
|
if (!val) return; |
|
|
|
|
const code = val.trim(); |
|
|
|
|
this.handleStartConfirmLogic(code); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 【核心】实现 mixin 回调:处理终点区域扫码 (叫料模式) |
|
|
|
|
therrInputData(val) { |
|
|
|
|
if (!val) return; |
|
|
|
|
// 这里可以直接赋值给一个临时变量,或者在提交时直接使用 therrInput |
|
|
|
|
// 为了保持逻辑一致,我们可以在这里做简单的校验或提示 |
|
|
|
|
console.log("终点区域扫码结果:", val); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 原 handleBoxConfirm 逻辑 |
|
|
|
|
handleBoxConfirmLogic(code) { |
|
|
|
|
if (!code) return; |
|
|
|
|
this.$u.api |
|
|
|
|
.getQuantityLocation({ boxBarcode: code }) |
|
|
|
|
.then((res) => { |
|
|
|
|
this.boxData = res.data; |
|
|
|
|
uni.showToast({ title: '物料箱识别成功', icon: 'none' }); |
|
|
|
|
|
|
|
|
|
// 焦点跳转 |
|
|
|
|
this.boxInputFocus = false; |
|
|
|
|
if (this.scanMode === 'bind') { |
|
|
|
|
this.startInputFocus = true; |
|
|
|
|
} else { |
|
|
|
|
// 叫料模式下,扫完箱子可能需要选起点,这里可以根据需求调整 |
|
|
|
|
// 假设叫料模式扫完箱子后,焦点保持在箱子或跳到起点Picker(无法自动聚焦picker,故保持当前或提示) |
|
|
|
|
this.boxInputFocus = true; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.showToast({ title: err || '查询失败', icon: 'none' }); |
|
|
|
|
this.clearOneInput(); |
|
|
|
|
this.boxInputFocus = false; |
|
|
|
|
this.$nextTick(() => { this.boxInputFocus = true; }); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 原 handleStartConfirm 逻辑 |
|
|
|
|
handleStartConfirmLogic(code) { |
|
|
|
|
if (!code) return; |
|
|
|
|
this.$u.api |
|
|
|
|
.getStationName({ stationCode: code }) |
|
|
|
|
.then((res) => { |
|
|
|
|
this.startData = res.data; |
|
|
|
|
uni.showToast({ title: '起点站点确认', icon: 'none' }); |
|
|
|
|
|
|
|
|
|
// 焦点跳转:送料模式下,扫完起点,可能需要选终点(Picker无法聚焦),故失焦 |
|
|
|
|
this.startInputFocus = false; |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
uni.showToast({ title: err || '站点查询失败', icon: 'none' }); |
|
|
|
|
this.clearTwoInput(); |
|
|
|
|
this.startInputFocus = false; |
|
|
|
|
this.$nextTick(() => { this.startInputFocus = true; }); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 起点区域选择变化 |
|
|
|
|
handleStartAreaChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.startArea = this.startAreas[index].name; |
|
|
|
|
this.startAreaIndex = index; |
|
|
|
|
|
|
|
|
|
// 清空起点站点 |
|
|
|
|
this.startStation = ""; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
|
|
|
|
|
// 获取对应站点列表(从 stationCodeList 读取) |
|
|
|
|
this.getStartStationsList(this.startAreas[index].id); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
@ -303,46 +354,35 @@ export default { |
|
|
|
|
|
|
|
|
|
// 获取起点区域列表 |
|
|
|
|
getStartAreasList() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "加载中...", |
|
|
|
|
mask: true, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
uni.showLoading({ title: "加载中...", mask: true }); |
|
|
|
|
this.$u.api |
|
|
|
|
.getStationRegion() |
|
|
|
|
.then((res) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
const list = res.data || []; |
|
|
|
|
|
|
|
|
|
this.startAreas = list.map((area) => ({ |
|
|
|
|
id: area.stationRegion, |
|
|
|
|
name: area.stationRegion, |
|
|
|
|
stationCodeList: area.stationCodeList || [], |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
// 查找"镀前周转盒放置区" |
|
|
|
|
const targetRegion = this.startAreas.find( |
|
|
|
|
(item) => item.name == "蓝色周转盒放置区" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (targetRegion) { |
|
|
|
|
// 默认选中该区域 |
|
|
|
|
const targetIndex = this.startAreas.findIndex( |
|
|
|
|
(item) => item.id === targetRegion.id |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (targetIndex !== -1) { |
|
|
|
|
this.startArea = targetRegion.name; |
|
|
|
|
this.startAreaIndex = targetRegion.id; |
|
|
|
|
|
|
|
|
|
// 获取对应站点列表并默认选中第一个 |
|
|
|
|
const stationCodeList = targetRegion.stationCodeList || []; |
|
|
|
|
if (stationCodeList && stationCodeList.length > 0) { |
|
|
|
|
this.startStations = stationCodeList.map((code) => ({ |
|
|
|
|
id: code, |
|
|
|
|
name: code, |
|
|
|
|
})); |
|
|
|
|
// 站点列表默认选中第一个数据 |
|
|
|
|
this.startStation = stationCodeList[0]; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
} |
|
|
|
|
@ -350,36 +390,26 @@ export default { |
|
|
|
|
} else { |
|
|
|
|
this.startArea = "蓝色周转盒放置区"; |
|
|
|
|
this.startAreaIndex = "蓝色周转盒放置区"; |
|
|
|
|
this.startStation = null |
|
|
|
|
this.startStation = null; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "加载区域列表失败", |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
uni.showToast({ title: "加载区域列表失败", icon: "none" }); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取起点站点列表(根据区域 ID) |
|
|
|
|
getStartStationsList(areaId) { |
|
|
|
|
if (!areaId) { |
|
|
|
|
this.startStations = []; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 从 startAreas 中找到对应区域,获取 stationCodeList |
|
|
|
|
const area = this.startAreas.find((item) => item.id === areaId); |
|
|
|
|
|
|
|
|
|
if (area && area.stationCodeList && area.stationCodeList.length > 0) { |
|
|
|
|
// 将 stationCodeList 转换为 picker 需要的格式 |
|
|
|
|
this.startStations = area.stationCodeList.map((code, index) => ({ |
|
|
|
|
id: code, |
|
|
|
|
name: code, |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
// 默认选中第一个站点 |
|
|
|
|
if (this.startStations.length > 0) { |
|
|
|
|
this.startStation = this.startStations[0].name; |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
@ -390,28 +420,21 @@ export default { |
|
|
|
|
this.startStationIndex = 0; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 作业中心选择变化 |
|
|
|
|
|
|
|
|
|
handleEndChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
const selectedWorkCenter = this.workCenters[index]; |
|
|
|
|
|
|
|
|
|
this.endCenter = selectedWorkCenter.name; |
|
|
|
|
this.endCenterIndex = selectedWorkCenter.id; |
|
|
|
|
|
|
|
|
|
// 清空终点区域 |
|
|
|
|
this.endArea = ""; |
|
|
|
|
this.endAreaIndex = 0; |
|
|
|
|
|
|
|
|
|
// 从作业中心获取 stationRegionList 作为区域列表 |
|
|
|
|
if ( |
|
|
|
|
selectedWorkCenter.stationRegionList && |
|
|
|
|
selectedWorkCenter.stationRegionList.length > 0 |
|
|
|
|
) { |
|
|
|
|
// 判断 stationRegionList 是对象数组还是字符串数组 |
|
|
|
|
const firstItem = selectedWorkCenter.stationRegionList[0]; |
|
|
|
|
|
|
|
|
|
if (typeof firstItem === "object") { |
|
|
|
|
// 对象数组 |
|
|
|
|
this.endAreas = selectedWorkCenter.stationRegionList.map( |
|
|
|
|
(region) => ({ |
|
|
|
|
id: region.id, |
|
|
|
|
@ -419,7 +442,6 @@ export default { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
// 字符串数组 |
|
|
|
|
this.endAreas = selectedWorkCenter.stationRegionList.map( |
|
|
|
|
(region, idx) => ({ |
|
|
|
|
id: idx, |
|
|
|
|
@ -427,8 +449,6 @@ export default { |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 默认选中第一个区域 |
|
|
|
|
if (this.endAreas.length > 0) { |
|
|
|
|
this.endArea = this.endAreas[0].name; |
|
|
|
|
this.endAreaIndex = this.endAreas[0].id; |
|
|
|
|
@ -438,27 +458,25 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 终点区域选择变化 |
|
|
|
|
handleAreaChange(e) { |
|
|
|
|
const index = e.detail.value; |
|
|
|
|
this.endArea = this.endAreas[index].name; |
|
|
|
|
this.endAreaIndex = index; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleModeChange(mode) { |
|
|
|
|
this.scanMode = mode; |
|
|
|
|
this.hasData = false; |
|
|
|
|
|
|
|
|
|
// 清空物料箱数据 |
|
|
|
|
this.boxCode = ""; |
|
|
|
|
this.boxData = null; |
|
|
|
|
this.boxInputFocus = true; |
|
|
|
|
// 使用 mixin 的清空方法 |
|
|
|
|
this.clearInput(); |
|
|
|
|
|
|
|
|
|
// 清空送料模式数据 |
|
|
|
|
this.startCode = ""; |
|
|
|
|
this.boxData = null; |
|
|
|
|
this.startData = null; |
|
|
|
|
this.boxInputFocus = true; |
|
|
|
|
this.startInputFocus = false; |
|
|
|
|
this.endInputFocus = false; |
|
|
|
|
|
|
|
|
|
// 清空叫料模式数据 |
|
|
|
|
this.startArea = ""; |
|
|
|
|
this.startStation = ""; |
|
|
|
|
this.startAreaIndex = 0; |
|
|
|
|
@ -466,14 +484,12 @@ export default { |
|
|
|
|
this.startAreas = []; |
|
|
|
|
this.startStations = []; |
|
|
|
|
|
|
|
|
|
// 清空终点数据 |
|
|
|
|
this.endCenter = ""; |
|
|
|
|
this.endArea = ""; |
|
|
|
|
this.endCenterIndex = 0; |
|
|
|
|
this.endAreaIndex = 0; |
|
|
|
|
this.endAreas = []; |
|
|
|
|
|
|
|
|
|
// 叫料模式时加载起点区域列表 |
|
|
|
|
if (mode === "unbind") { |
|
|
|
|
this.getStartAreasList(); |
|
|
|
|
} |
|
|
|
|
@ -482,43 +498,18 @@ export default { |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
// 获取订单明细 |
|
|
|
|
|
|
|
|
|
detailsFn() { |
|
|
|
|
this.showDetails = true; |
|
|
|
|
this.$u.api |
|
|
|
|
.boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode,isDetail:false }) |
|
|
|
|
.boxbarcodeDetails({ boxBarcode: this.boxData.boxBarcode, isDetail: false }) |
|
|
|
|
.then((res) => { |
|
|
|
|
this.yieldOrderList = res.data.yieldOrderList; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleBoxConfirm() { |
|
|
|
|
const code = this.boxCode.trim(); |
|
|
|
|
if (!code) return; |
|
|
|
|
this.$u.api |
|
|
|
|
.getQuantityLocation({ boxBarcode: this.boxCode }) |
|
|
|
|
.then((res) => { |
|
|
|
|
this.boxData = res.data; |
|
|
|
|
this.boxInputFocus = false; |
|
|
|
|
this.startInputFocus = true; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleStartConfirm() { |
|
|
|
|
const code = this.startCode.trim(); |
|
|
|
|
if (!code) return; |
|
|
|
|
this.$u.api |
|
|
|
|
.getStationName({ stationCode: this.startCode }) |
|
|
|
|
.then((res) => { |
|
|
|
|
console.log("起点站点", res.data); |
|
|
|
|
this.startData = res.data; |
|
|
|
|
this.startInputFocus = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取作业中心列表 |
|
|
|
|
getWorkCenterList() { |
|
|
|
|
this.$u.api.getWorkCenter().then((res) => { |
|
|
|
|
console.log(res.data); |
|
|
|
|
this.workCenters = res.data.map((c) => ({ |
|
|
|
|
id: c.id, |
|
|
|
|
name: c.wcName, |
|
|
|
|
@ -528,61 +519,66 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleSubmit() { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: "提交中...", |
|
|
|
|
}); |
|
|
|
|
let startStationCode = ""; |
|
|
|
|
uni.showLoading({ title: "提交中..." }); |
|
|
|
|
|
|
|
|
|
let query_ = { |
|
|
|
|
boxBarcode: this.boxBarcode || "", //箱条码 |
|
|
|
|
// startStationCode: startStationCode, //开始站点 |
|
|
|
|
// endWcId: this.endCenterIndex, //终点作业中心 |
|
|
|
|
// endStationCode: this.endStationCode, //终点区域 |
|
|
|
|
// stationRegion: this.endArea, |
|
|
|
|
boxBarcode: this.oneInput || (this.boxData ? this.boxData.boxBarcode : ""), |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (this.scanMode === "bind") { |
|
|
|
|
// 送料模式:从 startData 获取 |
|
|
|
|
if (!this.startData) { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ title: '请扫描起点站点', icon: 'none' }); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
query_.startStationCode = this.startData.stationCode; |
|
|
|
|
query_.endWcId = this.endCenterIndex; |
|
|
|
|
query_.stationRegion = this.endArea; |
|
|
|
|
} else if (this.scanMode === "unbind") { |
|
|
|
|
// 叫料模式:从选中的站点获取 |
|
|
|
|
if (!this.startStation) { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ title: '请选择起点站点', icon: 'none' }); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!this.therrInput) { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ title: '请扫描终点区域', icon: 'none' }); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
query_.startStationCode = this.startStation; |
|
|
|
|
query_.endStationCode = this.endStationCode; |
|
|
|
|
} |
|
|
|
|
if (this.scanMode == "unbind" && this.endStationCode == "") { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: `请选择终点区域!`, |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
query_.endStationCode = this.therrInput; // 使用 mixin 变量 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$u.api |
|
|
|
|
.boxBindingTesk(query_) |
|
|
|
|
.then((res) => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: `成功配送至 ${this.endCenter}!`, |
|
|
|
|
title: `成功配送!`, |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
|
|
|
|
|
this.boxCode = ""; |
|
|
|
|
// 提交成功后清空并重置焦点 |
|
|
|
|
this.clearInput(); |
|
|
|
|
this.boxData = null; |
|
|
|
|
this.startCode = ""; |
|
|
|
|
this.startData = null; |
|
|
|
|
this.endCenter = ""; |
|
|
|
|
this.endArea = ""; |
|
|
|
|
|
|
|
|
|
this.boxInputFocus = true; |
|
|
|
|
this.startInputFocus = false; |
|
|
|
|
this.endInputFocus = false; |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ title: err || '提交失败', icon: 'none' }); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
|
.page-container { |
|
|
|
|
display: flex; |
|
|
|
|
|