扫码逻调

master
zhangdi 23 hours ago
parent eb2d225d22
commit 4af25d30e4
  1. 2
      pages/logistics/claimGoods.vue
  2. 4
      pages/logistics/delivery.vue
  3. 4
      pages/logistics/intoStock.vue
  4. 262
      pages/logistics/packaging.vue
  5. 2
      pages/logistics/site.vue
  6. 2
      pages/logistics/weighing.vue

@ -112,7 +112,9 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import scan from '@/mixin/scan.js';
export default { export default {
mixins: [scan],
components: { components: {
ifrm, ifrm,
}, },

@ -205,9 +205,9 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js'; // mixin import inputBlur from '@/mixin/inputBlur.js'; // mixin
import scan from '../../mixin/scan.js';
export default { export default {
mixins: [inputBlur], // mixin mixins: [inputBlur,scan], // mixin
components: { components: {
ifrm, ifrm,
}, },

@ -68,9 +68,9 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js'; // mixin import inputBlur from '@/mixin/inputBlur.js'; // mixin
import scan from '../../mixin/scan.js';
export default { export default {
mixins: [inputBlur], // mixin mixins: [inputBlur,scan], // mixin
components: { components: {
ifrm, ifrm,
}, },

@ -3,33 +3,21 @@
<uni-forms ref="wrForm" class="formBox" label-position="top"> <uni-forms ref="wrForm" class="formBox" label-position="top">
<uni-forms-item label="扫描模式:" label-width="100px" class="label-left"> <uni-forms-item label="扫描模式:" label-width="100px" class="label-left">
<view class="mode-switch"> <view class="mode-switch">
<view <view class="switch-btn" :class="{ active: scanMode === 'bind' }" @click="handleModeChange('bind')">
class="switch-btn"
:class="{ active: scanMode === 'bind' }"
@click="handleModeChange('bind')"
>
绑定 绑定
</view> </view>
<view <view class="switch-btn" :class="{ active: scanMode === 'unbind' }" @click="handleModeChange('unbind')">
class="switch-btn"
:class="{ active: scanMode === 'unbind' }"
@click="handleModeChange('unbind')"
>
解绑 解绑
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 物料箱条码输入 --> <!-- 物料箱条码输入 -->
<uni-forms-item label="物料箱条码:" label-width="100px"> <uni-forms-item label="物料箱条码:" label-width="100px">
<template #label> <template #label>
<view class="custom-label"> <view class="custom-label">
<text class="label-text">物料箱条码</text> <text class="label-text">物料箱条码</text>
<text <text v-if="scanMode === 'unbind'" class="one-click-unbind-btn" @click="handleOneClickUnbind">
v-if="scanMode === 'unbind'"
class="one-click-unbind-btn"
@click="handleOneClickUnbind"
>
一键解绑 一键解绑
</text> </text>
</view> </view>
@ -37,21 +25,14 @@
<view class="bottom-input-row"> <view class="bottom-input-row">
<view class="weight-input-wrapper"> <view class="weight-input-wrapper">
<view class="input-box"> <view class="input-box">
<!-- 修改点 1: 使用 mixin oneInput oneInputBlur --> <!-- 修改: 移除 @confirm保留 v-model focus -->
<input <input type="text" v-model="boxCode" placeholder="物料箱条码" class="uni-input-border" :focus="boxInputFocus"
type="text" @focus="onBoxFocus" @confirm="handleBoxConfirm" />
v-model="oneInput" <view v-if="boxCode" class="clear-icon" @click="clearBoxInput">清空</view>
@input="oneInputBlur"
placeholder="物料箱条码"
class="uni-input-border"
:focus="boxInputFocus"
:key="'box-' + boxInputFocus"
/>
<view v-if="oneInput" class="clear-icon" @click="clearBoxInput">清空</view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="activeBox" class="box-stats"> <view v-if="activeBox" class="box-stats">
<view class="stats-left"> <view class="stats-left">
<text class="stats-label">当前物料箱</text> <text class="stats-label">当前物料箱</text>
@ -60,36 +41,22 @@
<view class="stats-right"> <view class="stats-right">
<view class="stats-item"> <view class="stats-item">
<text class="stats-label">配送终点</text> <text class="stats-label">配送终点</text>
<text class="stats-value" <text class="stats-value">{{ boxInfo.wcName
>{{ boxInfo.wcName }}{{
}}{{
boxInfo.stationRegion ? "-" + boxInfo.stationRegion : "" boxInfo.stationRegion ? "-" + boxInfo.stationRegion : ""
}}</text }}</text>
>
</view> </view>
</view> </view>
</view> </view>
</uni-forms-item> </uni-forms-item>
<!-- 流程卡输入 --> <!-- 流程卡输入 -->
<uni-forms-item <uni-forms-item :label="scanMode === 'bind' ? `扫描流程卡(装箱)` : `扫描流程卡(解绑)`
:label=" " label-width="200px">
scanMode === 'bind' ? `扫描流程卡(装箱):` : `扫描流程卡(解绑):` <!-- 修改: 移除 @confirm保留 v-model focus -->
" <input type="text" v-model="cardCode" :disabled="!activeBox" placeholder="流程卡号" class="uni-input-border"
label-width="200px" :class="{ 'input-disabled': !activeBox }" :focus="cardInputFocus" @focus="onCardFocus"
> @confirm="handleCardConfirm" />
<!-- 修改点 2: 使用 mixin twoInput twoInputBlur -->
<input
type="text"
v-model="twoInput"
@input="twoInputBlur"
:disabled="!activeBox"
placeholder="流程卡号"
class="uni-input-border"
:class="{ 'input-disabled': !activeBox }"
:focus="cardInputFocus"
:key="'card-' + cardInputFocus"
/>
</uni-forms-item> </uni-forms-item>
</uni-forms> </uni-forms>
@ -97,11 +64,9 @@
<view class="orders-header"> <view class="orders-header">
<view class="orders-left"> <view class="orders-left">
<text class="orders-icon"></text> <text class="orders-icon"></text>
<text class="orders-title" <text class="orders-title">箱内明细 ({{
>箱内明细 ({{ boxInfo.yieldOrderList ? boxInfo.yieldOrderList.length : 0
boxInfo.yieldOrderList ? boxInfo.yieldOrderList.length : 0 }})</text>
}})</text
>
</view> </view>
<view class="orders-right"> <view class="orders-right">
<text class="orders-weight-label">总重量</text> <text class="orders-weight-label">总重量</text>
@ -116,24 +81,19 @@
</view> </view>
<view v-else class="orders-list"> <view v-else class="orders-list">
<view <view v-for="(order, index) in boxInfo.yieldOrderList" :key="order.id" class="order-card"
v-for="(order, index) in boxInfo.yieldOrderList" :class="{ 'order-latest': index === 0 }">
:key="order.id"
class="order-card"
:class="{ 'order-latest': index === 0 }"
>
<view class="order-header"> <view class="order-header">
<text class="order-no">{{ order.woOrder }}流程卡号</text> <text class="order-no">{{ order.woOrder }}流程卡号</text>
<text class="order-no">{{ order.cardNo }}</text> <text class="order-no">{{ order.cardNo }}</text>
</view> </view>
<view class="order-footer"> <view class="order-footer">
<text class="order-part">{{ order.partCode }}</text> <text class="order-part">{{ order.partCode }}</text>
<text class="order-weight" <text class="order-weight">{{
>{{ order.actualWeighing >= 0 || order.actualWeighing != null
order.actualWeighing >= 0 || order.actualWeighing != null ? order.actualWeighing + "g"
? order.actualWeighing + "g" : 0 + "g"
: 0 + "g" }}
}}
</text> </text>
</view> </view>
</view> </view>
@ -144,31 +104,34 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import inputBlur from '@/mixin/inputBlur.js'; import scan from '../../mixin/scan.js';
export default { export default {
mixins: [inputBlur], // mixin
components: { components: {
ifrm, ifrm,
}, },
mixins: [scan], // scan mixin
onNavigationBarButtonTap(btn) { onNavigationBarButtonTap(btn) {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },
data() { data() {
return { return {
// oneInput, twoInput, oldOneInput mixin
list: ["绑定", "解绑"], list: ["绑定", "解绑"],
current: 1, current: 1,
boxInfo: { boxInfo: {
yieldOrderList: [], yieldOrderList: [],
}, },
// boxCode cardCode mixin oneInput/twoInput boxCode: "",
cardCode: "",
activeBox: null, activeBox: null,
orders: [], orders: [],
boxInputFocus: true, boxInputFocus: true,
cardInputFocus: false, cardInputFocus: false,
scanMode: "bind", scanMode: "bind",
hasData: false, hasData: false,
// 'box' 'card'
currentScanTarget: 'box'
}; };
}, },
computed: { computed: {
@ -192,28 +155,45 @@ export default {
}, },
}, },
methods: { methods: {
// // --- ---
clearBoxInput() { onBoxFocus() {
this.clearOneInput(); // mixin this.currentScanTarget = 'box';
this.boxInputFocus = false; },
this.$nextTick(() => { onCardFocus() {
this.boxInputFocus = true; this.currentScanTarget = 'card';
}); },
// --- ---
handleBoxConfirm() {
if (!this.boxCode) return;
// /
this.handleBoxScan(this.boxCode.trim());
}, },
// mixin handleCardConfirm() {
oneInputData(val) { if (!this.cardCode) return;
// val mixin // /
if (!val) return; this.handleCardScan(this.cardCode.trim());
const code = val.trim();
this.handleBoxConfirmLogic(code);
}, },
// handleBoxConfirm // --- ( scan mixin ) ---
handleBoxConfirmLogic(code) { getBarCode(code) {
if (!code) return; if (!code) return;
const trimCode = code.trim();
if (this.currentScanTarget === 'box') {
this.handleBoxScan(trimCode);
} else {
this.handleCardScan(trimCode);
}
},
// --- ---
handleBoxScan(code) {
if (!code) return;
//
this.boxCode = code;
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: code, isDetail: false }) .boxbarcodeDetails({ boxBarcode: code, isDetail: false })
.then((res) => { .then((res) => {
@ -222,48 +202,39 @@ export default {
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
} }
this.activeBox = code; this.activeBox = code;
this.boxCode = '';
uni.showToast({ uni.showToast({
title: `物料箱 ${code} 已就绪`, title: `物料箱 ${code} 已就绪`,
icon: "none", icon: "none",
}); });
// //
this.boxInputFocus = false; this.cardCode = '';
this.cardInputFocus = true; this.switchToCard();
}) })
.catch(err => { .catch(err => {
uni.showToast({ title: err || '查询失败', icon: 'none' }); uni.showToast({ title: err || '查询失败', icon: 'none' });
// 便 this.boxCode = '';
this.oneInput = ''; this.switchToBox();
this.oldOneInput = '';
this.boxInputFocus = false;
this.$nextTick(() => { this.boxInputFocus = true; });
}); });
}, },
// mixin // --- ---
twoInputData(val) { handleCardScan(code) {
// val mixin if (!code) return;
if (!val) return;
const code = val.trim();
this.handleCardConfirmLogic(code);
},
// handleCardConfirm
handleCardConfirmLogic(code) {
if (!this.activeBox) { if (!this.activeBox) {
uni.showToast({ uni.showToast({
title: "请先扫描物料箱条码", title: "请先扫描物料箱条码",
icon: "none", icon: "none",
}); });
// this.switchToBox();
this.cardInputFocus = false;
this.boxInputFocus = true;
return; return;
} }
//
this.cardCode = code;
uni.showLoading({ uni.showLoading({
title: "查询中...", title: "查询中...",
mask: true, mask: true,
@ -356,14 +327,10 @@ export default {
}); });
} }
} }
// 便 // 便
this.twoInput = ''; this.cardCode = '';
this.oldTwoInput = ''; this.switchToCard();
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
}) })
.catch((err) => { .catch((err) => {
uni.hideLoading(); uni.hideLoading();
@ -371,15 +338,34 @@ export default {
title: err, title: err,
icon: "error", icon: "error",
}); });
this.twoInput = ''; this.cardCode = '';
this.oldTwoInput = ''; this.switchToCard();
this.cardInputFocus = false;
this.$nextTick(() => {
this.cardInputFocus = true;
});
}); });
}, },
// --- ---
switchToBox() {
this.cardInputFocus = false;
this.currentScanTarget = 'box';
this.$nextTick(() => {
this.boxInputFocus = true;
});
},
switchToCard() {
this.boxInputFocus = false;
this.currentScanTarget = 'card';
this.$nextTick(() => {
this.cardInputFocus = true;
});
},
clearBoxInput() {
this.boxCode = "";
this.activeBox = null;
this.boxInfo = { yieldOrderList: [] };
this.switchToBox();
},
handleOneClickUnbind() { handleOneClickUnbind() {
if (!this.activeBox) { if (!this.activeBox) {
uni.showToast({ uni.showToast({
@ -398,13 +384,12 @@ export default {
.then(() => { .then(() => {
this.boxInfo.yieldOrderList = []; this.boxInfo.yieldOrderList = [];
this.activeBox = null; this.activeBox = null;
this.clearOneInput(); // 使 mixin this.boxCode = "";
uni.showToast({ uni.showToast({
title: "解绑成功", title: "解绑成功",
icon: "success", icon: "success",
}); });
this.boxInputFocus = true; this.switchToBox();
this.cardInputFocus = false;
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
@ -423,11 +408,11 @@ export default {
this.boxInfo = { this.boxInfo = {
yieldOrderList: [], yieldOrderList: [],
}; };
this.clearInput(); // 使 mixin clearInput this.boxCode = "";
this.cardCode = "";
this.activeBox = null; this.activeBox = null;
this.orders = []; this.orders = [];
this.boxInputFocus = true; this.switchToBox();
this.cardInputFocus = false;
uni.showToast({ uni.showToast({
title: `已切换到${mode === "bind" ? "绑定" : "解绑"}模式`, title: `已切换到${mode === "bind" ? "绑定" : "解绑"}模式`,
@ -436,6 +421,7 @@ export default {
}, },
refreshBoxInfo() { refreshBoxInfo() {
if (!this.activeBox) return;
this.$u.api this.$u.api
.boxbarcodeDetails({ boxBarcode: this.activeBox, isDetail: false }) .boxbarcodeDetails({ boxBarcode: this.activeBox, isDetail: false })
.then((res) => { .then((res) => {
@ -445,8 +431,6 @@ export default {
} }
}); });
}, },
// handleBoxConfirm handleCardConfirm
}, },
}; };
</script> </script>
@ -661,6 +645,7 @@ export default {
.tip-text { .tip-text {
font-size: 20rpx; font-size: 20rpx;
} }
.bottom-input-row { .bottom-input-row {
display: flex; display: flex;
gap: 10px; gap: 10px;
@ -692,6 +677,7 @@ export default {
.submit-btn.disabled { .submit-btn.disabled {
opacity: 0.5; opacity: 0.5;
} }
/* 在 style scoped 中添加 */ /* 在 style scoped 中添加 */
.delete-btn { .delete-btn {
position: absolute; position: absolute;
@ -749,6 +735,7 @@ export default {
flex-direction: row !important; flex-direction: row !important;
margin-top: 20rpx; margin-top: 20rpx;
} }
.barcode-header { .barcode-header {
position: relative; position: relative;
width: 100%; width: 100%;
@ -806,18 +793,21 @@ export default {
.uni-forms-item { .uni-forms-item {
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.input-box { .input-box {
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.input-box .uni-input-border{
.input-box .uni-input-border {
flex: 1; flex: 1;
} }
.clear-icon { .clear-icon {
position: absolute; position: absolute;
right: 10rpx; right: 10rpx;
color:#999; color: #999;
padding: 5rpx 10rpx 5rpx 5rpx; padding: 5rpx 10rpx 5rpx 5rpx;
} }
</style> </style>

@ -151,10 +151,12 @@
<script> <script>
import ifrm from "@/pages/index/ifrm"; import ifrm from "@/pages/index/ifrm";
import scan from '../../mixin/scan.js';
export default { export default {
components: { components: {
ifrm, ifrm,
}, },
mixins: [scan], // mixin
onNavigationBarButtonTap(btn) { onNavigationBarButtonTap(btn) {
this.$refs.ifrm.topMenuClick(btn); this.$refs.ifrm.topMenuClick(btn);
}, },

@ -58,6 +58,7 @@ import tTable from "@/components/t-table/t-table.vue";
import tTh from "@/components/t-table/t-th.vue"; import tTh from "@/components/t-table/t-th.vue";
import tTr from "@/components/t-table/t-tr.vue"; import tTr from "@/components/t-table/t-tr.vue";
import tTd from "@/components/t-table/t-td.vue"; import tTd from "@/components/t-table/t-td.vue";
import scan from '../../mixin/scan.js';
export default { export default {
components: { components: {
ifrm, ifrm,
@ -66,6 +67,7 @@ export default {
tTr, tTr,
tTd, tTd,
}, },
mixins: [scan], // mixin
data() { data() {
return { return {
processCardNo: "", processCardNo: "",

Loading…
Cancel
Save