Commit 86bd34a2 by LJM

add

parent 9111c8a4
......@@ -85,6 +85,10 @@
border-radius: 4rpx;
margin-bottom: 16rpx;
padding: 24rpx;
transition: all 0.4s ease;
&.disabled {
background-color: #f2f9ff;
}
.pb16 {
padding-bottom: 16rpx;
}
......@@ -150,7 +154,7 @@
}
.delete {
position: absolute;
right: 10rpx;
right: 0rpx;
top: -13rpx;
width: 30rpx;
height: 30rpx;
......@@ -171,6 +175,9 @@
border-radius: 4rpx;
font-size: 26rpx;
color: #ffffff;
&.disabled {
background: #9ca8ad;
}
}
}
}
......
......@@ -3,30 +3,30 @@
<view class="text row verCenter">
<view style="width: 50%;margin-left: 25rpx;">
<text class="t1">待装载箱数:</text>
<text class="t2">88</text>
<text class="t2">-</text>
</view>
<view style="width: 50%;">
<text class="t1">入仓号数:</text>
<text class="t2">88</text>
<text class="t2">-</text>
</view>
</view>
<view class="input-box row bothSide verCenter">
<input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" />
<view class="btn row rowCenter verCenter">添 加</view>
<input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" v-model="keyword" @input="handleInput($event)" :focus="is_focus" />
<view class="btn row rowCenter verCenter" @click="add()">添 加</view>
</view>
<view class="list">
<view class="list" v-if="list.length > 0">
<scroll-view scroll-y="true" class="scroll-Y">
<view class="title">合箱结果:</view>
<view class="box row bothSide verCenter" v-for="(item,index) in 20" :key="index">
<view class="box row bothSide verCenter" v-for="(item,index) in list" :key="index">
<view class="row verCenter">
<text class="t1">{{index + 1}}.</text>
<text class="t2">X0422001</text>
<text class="t2">{{item}}</text>
</view>
<view class="tt">删除</view>
<view class="tt" @click="deleteFix(index)">删除</view>
</view>
</scroll-view>
</view>
<view class="fix-btn row rowCenter verCenter">合 箱</view>
<view class="fix-btn row rowCenter verCenter" @click="fixBox()">合 箱</view>
</view>
</template>
......@@ -37,11 +37,123 @@
export default {
data() {
return {
is_focus: true, //获取焦点动态化
keyword: '',
old_box_sn_str: '',
list: []
};
},
watch: {
list(arr) {
if (arr.length > 0) {
this.old_box_sn_str = arr.join(',');
} else {
this.old_box_sn_str = '';
}
}
},
methods: {
/**
* 监听输入框
* @param {Object} event
*/
handleInput: debounce(function(event) {
var inputValue = event.target.value;
if (inputValue) {
if (inputValue.includes('\n')) {
// 如果包含回车符,则移除回车符
const keyword = inputValue.replace(/\n/g, '');
// 执行添加操作
this.add(keyword);
// 清空输入框
this.keyword = '';
// 再次获取焦点
this.clearInputAndFocus();
}
}
}, 500),
/**
* 添加
*/
add() {
if (!this.keyword) {
uni.showToast({
title: '请输入箱号',
icon: 'none'
});
return false;
}
// 检查输入的箱号是否已经存在于列表中
if (this.list.includes(this.keyword)) {
uni.showToast({
title: '箱号已存在,请勿重复添加',
icon: 'none'
});
// 清空输入框
this.keyword = '';
return false;
}
// 将输入的箱号添加到列表中
this.list.push(this.keyword);
// 清空输入框
this.keyword = '';
// 再次获取焦点
this.clearInputAndFocus();
},
/**
* 合箱
*/
fixBox() {
if (this.list.length == 0) {
uni.showModal({
title: '',
content: '请先扫描箱号',
showCancel: false
});
return false;
}
this.request(API.fixBox, 'POST', { old_box_sn_str: this.old_box_sn_str }, true).then(res => {
if (res.err_code === 0) {
uni.showModal({
title: '',
content: '合箱成功',
showCancel: false,
success: (res) => {
if (res.confirm) {
this.list = [];
// 再次获取焦点
this.clearInputAndFocus();
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 删除
*/
deleteFix(index) {
this.list.splice(index, 1);
},
/**
* 再次获取焦点
*/
clearInputAndFocus() {
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 200);
}
}
};
</script>
......
<template>
<view class="printBox">
<view class="input-box row bothSide verCenter">
<input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" />
<view class="btn row rowCenter verCenter">打印箱号</view>
<input class="uni-input" placeholder="输入或扫描入箱号" placeholder-style="color:#000;font-weight: bold;" v-model="box_sn" />
<view class="btn row rowCenter verCenter" @click="print()">打印箱号</view>
</view>
</view>
</template>
<script>
import { API } from '@/util/api.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
box_sn: ''
};
},
methods: {
print() {
if (!this.box_sn) {
uni.showModal({
title: '',
content: '请先扫描箱号',
showCancel: false
});
return false;
}
this.request(API.fixBox, 'POST', { old_box_sn_str: this.old_box_sn_str }, true).then(res => {
if (res.err_code === 0) {
uni.showModal({
title: '',
content: '打印成功,请查看打印机',
showCancel: false
});
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
}
}
};
</script>
......
......@@ -285,6 +285,10 @@ const API = {
*/
fixBox: API_BASE + '/supplywechatwms/fixBox',
/**
* 取消释放
*/
cancelRelease: API_BASE + '/supplywechatwms/cancelRelease',
/**
* 识别二维码的数量和型号
* */
identifyQrCodeNumAndSn: API_BASE_WMS + '/api/stockIn/identifyQrCodeNumAndSn',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment