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>
......
......@@ -7,7 +7,7 @@
</view>
<view class="action-bar">
<template v-if="box_sn">
<view class="btn1 row rowCenter verCenter">打印箱号</view>
<view class="btn1 row rowCenter verCenter" @click="print()">打印箱号</view>
</template>
<template v-else>
<view class="btn row rowCenter verCenter" @click="getBoxSn()">取箱号</view>
......@@ -16,12 +16,12 @@
</view>
<view class="column-box row bothSide verCenter">
<view class="input-box row verCenter">
<input class="uni-input" :disabled="tallyData.customer_name" :class="{ 'disabled': tallyData.customer_name }" placeholder="输入或扫描入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="erp_order_sn" />
<input class="uni-input" :disabled="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !=''" :class="{ 'disabled': tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn !='' }" placeholder="输入或扫描入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="erp_order_sn" />
</view>
<view class="action-bar row verCenter">
<template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1">
<view class="btn1 row rowCenter verCenter" style="margin-right: 8rpx;">取消释放</view>
<view class="btn row rowCenter verCenter">关单封箱</view>
<template v-if="tallyData.detail && tallyData.detail.length > 0 && step == 1 && erp_order_sn != ''">
<view class="btn1 row rowCenter verCenter" style="margin-right: 8rpx;" @click="cancelRelease()">取消释放</view>
<view class="btn row rowCenter verCenter" @click="closeBox()">关单封箱</view>
</template>
<template v-else>
<view class="btn row rowCenter verCenter" @click="getTallyData(1)">锁定理货</view>
......@@ -81,7 +81,7 @@
<!-- 列表 -->
<view class="list" v-if="tallyData && tallyData.detail">
<scroll-view scroll-y="true" class="scroll-Y">
<view class="box" v-for="(item,index) in tallyData.detail" :key="index">
<view class="box" v-for="(item,index) in tallyData.detail" :key="index" :class="{disabled:item.tally_status == 3}">
<view class="title pb16 row verCenter">
<text class="t1">{{item.goods_type}}</text>
<text class="t2 row rowCenter verCenter" v-if="item.is_goods_check_cn"></text>
......@@ -146,7 +146,12 @@
</template>
<view class="default row rowCenter verCenter" @click="chooseImageChange(index)" v-if="image_list.length < 5"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</view>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
<template v-if="item.tally_status == 3">
<view class="btn row rowCenter verCenter disabled" @click="cancelTallyDetail(index)">取消理货</view>
</template>
<template v-else>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
</template>
</view>
</view>
</scroll-view>
......@@ -181,6 +186,10 @@
<view class="pop-btn row rowCenter verCenter" @click="confirmChange">确 认</view>
</view>
</uni-popup>
<!-- 关单封箱弹窗 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" :title="title" value="" confirmText="新箱子" cancelText="不需要换箱" placeholder="请输入毛重" @close="dialogInputClose" @confirm="dialogInputConfirm" :is-mask-click="true" :before-close="true"></uni-popup-dialog>
</uni-popup>
</view>
</template>
......@@ -192,7 +201,8 @@
export default {
data() {
return {
step: 1,
title: '',
step: 0,
keyword: '',
curr: -1, //当前打开的是哪个产地
fixBoxStyle: '',
......@@ -216,10 +226,13 @@
},
watch: {
image_list(arr) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
});
const allNonEmpty = arr.every(subArr => subArr.length > 0);
if (allNonEmpty) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
});
}
}
},
created() {
......@@ -337,6 +350,7 @@
let data = JSON.parse(uploadFileRes.data);
if (data.code === 0) {
this.image_list[key].push(data.data.oss_image_url);
this.$forceUpdate();
} else {
uni.showToast({
title: data.msg,
......@@ -379,6 +393,7 @@
*/
deletePic(index, i) {
this.image_list[index].splice(i, 1);
this.$forceUpdate();
},
/**
* 识别
......@@ -490,16 +505,23 @@
if (res.data.detail.length > 0) {
// 使用 map 方法生成表单数组
this.form = res.data.detail.map((item) => ({
tally_num: '', // 入库数量
origin: '', // 原产地
net_weight: '', // 净重
goods_check_pic: '', // 商检的必须上传图片
tally_num: item.tally_num, // 入库数量
origin: item.origin, // 原产地
net_weight: item.net_weight, // 净重
goods_check_pic: item.goods_check_pic, // 商检的必须上传图片
wstydl_id: item.wstydl_id, // 理货明细ID
erp_order_sn: this.erp_order_sn, // 入仓号
wsty_id: this.wsty_id, // 箱子id
is_goods_check_cn: item.is_goods_check_cn //是否商检
}));
this.image_list = res.data.detail.map(() => new Array()); //图片特殊处理
res.data.detail.forEach((item, index) => {
if (item.goods_check_pic) {
this.image_list[index] = item.goods_check_pic.split(',');
}
});
}
} else {
uni.showToast({
......@@ -545,10 +567,139 @@
}
}
this.request(API.submitTallyDetail, 'POST', this.form[index], true).then(res => {
if (res.err_code === 0) {
this.getTallyData(1);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 理货明细撤销
*/
cancelTallyDetail(index) {
uni.showModal({
title: '提示',
content: '确定取消该商品理货吗?',
success: (res) => {
if (res.confirm) {
this.request(API.cancelTallyDetail, 'POST', { wstydl_id: this.form[index].wstydl_id, wsty_id: this.form[index].wsty_id }, true).then(res => {
if (res.err_code === 0) {
this.getTallyData(1);
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
/**
* 取消释放
*/
cancelRelease() {
uni.showModal({
title: '提示',
content: '确定取消释放该箱号吗?',
success: (res) => {
if (res.confirm) {
this.request(API.cancelRelease, 'POST', { wsty_id: this.wsty_id }, true).then(res => {
if (res.err_code === 0) {
this.tallyData = [];
this.box_sn = '';
this.erp_order_sn = '';
this.wsty_id = '';
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
/**
* 关单封箱
*/
closeBox() {
this.title = `入仓号${this.erp_order_sn}已经全部验货完毕是否更换新的箱子?`;
this.$refs.inputDialog.open();
},
/**
* 新箱子
*/
dialogInputConfirm(val) {
if (!val) {
uni.showToast({
title: '请输入毛重',
icon: 'none'
});
return false;
}
this.request(API.closeBox, 'POST', { wsty_id: this.wsty_id, gross_weight: val }, true).then(res => {
if (res.err_code === 0) {
this.box_sn = '';
this.wsty_id = '';
this.tallyData = [];
this.erp_order_sn = '';
this.$refs.inputDialog.close()
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 不需要换箱
*/
dialogInputClose() {
this.request(API.closeBox, 'POST', { wsty_id: this.wsty_id, gross_weight: '' }, true).then(res => {
if (res.err_code === 0) {
this.$refs.inputDialog.close();
this.tallyData = [];
this.erp_order_sn = '';
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 打印箱号
*/
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,
......@@ -563,4 +714,14 @@
<style scoped lang="scss">
@import '@/assets/css/tally/index.scss';
::v-deep {
.uni-dialog-title-text {
padding: 10px;
text-align: center;
color: #404547;
font-size: 26rpx !important;
font-weight: bold !important;
}
}
</style>
\ No newline at end of file
<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