扫码逻调

master
zhangdi 22 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>
import ifrm from "@/pages/index/ifrm";
import scan from '@/mixin/scan.js';
export default {
mixins: [scan],
components: {
ifrm,
},

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

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

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

@ -151,10 +151,12 @@
<script>
import ifrm from "@/pages/index/ifrm";
import scan from '../../mixin/scan.js';
export default {
components: {
ifrm,
},
mixins: [scan], // mixin
onNavigationBarButtonTap(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 tTr from "@/components/t-table/t-tr.vue";
import tTd from "@/components/t-table/t-td.vue";
import scan from '../../mixin/scan.js';
export default {
components: {
ifrm,
@ -66,6 +67,7 @@ export default {
tTr,
tTd,
},
mixins: [scan], // mixin
data() {
return {
processCardNo: "",

Loading…
Cancel
Save