Commit eb73a2ed authored by 何远江's avatar 何远江

修改解除装箱逻辑

parent e779fe70
<template> <template>
<view style="padding: 20rpx 0;"> <view style="padding: 20rpx 0">
<view class="btn"> <view class="btn">
<uni-easyinput prefixIcon="search" :disabled="isDisabled" v-model="wxparams" :focus="isFocus" <uni-easyinput
placeholder="请扫描产品包装条码/外箱码" @confirm="handleConfirm"></uni-easyinput> prefixIcon="search"
:disabled="isPack"
v-model="wxparams"
:focus="isFocus"
placeholder="请扫描产品包装条码/外箱码"
@confirm="handleConfirm"
></uni-easyinput>
</view> </view>
<view class="cardbox"> <view class="cardbox">
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.PLNR"> <view
class="cardContent"
v-for="(item, index) in goodsList"
:key="item.PLNR"
>
<view class="listItemTitle"> <view class="listItemTitle">
<view> <view>
<view class="item">PL号:{{ item }}</view> <view class="item">PL号:{{ item }}</view>
</view> </view>
<u-button size="mini" type="primary" plain @click="deleGonds(index)"> <u-button v-if="!isPack" size="mini" type="primary" plain @click="deleGonds(index)">
<u-icon name="trash" size="28"></u-icon> <u-icon name="trash" size="28"></u-icon>
删除 删除
</u-button> </u-button>
...@@ -22,11 +32,11 @@ ...@@ -22,11 +32,11 @@
</view> </view>
</template> </template>
<script> <script>
import BottomBtn from '@/components/BottomBtn/index.vue'; import BottomBtn from "@/components/BottomBtn/index.vue";
import { parseTime} from "@/utils/ruoyi"; import { parseTime } from "@/utils/ruoyi";
export default { export default {
components: { components: {
BottomBtn BottomBtn,
}, },
data() { data() {
return { return {
...@@ -34,87 +44,103 @@ ...@@ -34,87 +44,103 @@
isDisabled: false, isDisabled: false,
wxparams: "", wxparams: "",
goodsList: [], goodsList: [],
btnArr: [{ btnArr: [
style: '', {
type: 'warning', style: "",
text: '返回', type: "warning",
way: 'goBack' text: "返回",
way: "goBack",
}, },
{ {
style: '', style: "",
type: 'primary', type: "primary",
text: '提交', text: "提交",
way: 'goSubmit' way: "goSubmit",
} },
], ],
isBL: false,
isPack: false,
}; };
}, },
methods: { methods: {
handleConfirm(e) { handleConfirm(e) {
this.isFocus = false; if (e.startsWith("BL")) {
this.isDisabled = true; // 如果扫描的BL需要查询装箱明细
return this.$u.api.sapApi
.sapCaseInfo({
ZCODE: e,
})
.then(({ DATA: res }) => {
// 有装箱信息, 禁用输入框
if (res.length) {
this.isPack = true;
this.goodsList = res.map(v => v.PLNR)
}
});
}
this.isPack = false
if (this.goodsList.some((item) => item === e)) { if (this.goodsList.some((item) => item === e)) {
this.$u.toast('已经存在当前条码'); this.$u.toast("已经存在当前条码");
this.reset() this.reset();
return return;
} }
e && this.goodsList.push(e) e && this.goodsList.push(e);
this.reset() this.reset();
}, },
deleGonds(index) { deleGonds(index) {
this.goodsList.splice(index, 1) this.goodsList.splice(index, 1);
}, },
reset() { reset() {
setTimeout(() => { setTimeout(() => {
this.isPack = false
this.isFocus = true; this.isFocus = true;
this.isDisabled = false; this.isDisabled = false;
this.wxparams = '' this.wxparams = "";
}, 1000); }, 1000);
}, },
getBtnHandle(row) { getBtnHandle(row) {
console.log('getBtnHandle', row); console.log("getBtnHandle", row);
this[row.way](); this[row.way]();
}, },
// 提交 // 提交
goSubmit() { goSubmit() {
if (!this.goodsList.length) { if (!this.goodsList.length) {
return this.$u.toast('请添加需要解除装箱的箱条码/外箱码') return this.$u.toast("请添加需要解除装箱的箱条码/外箱码");
} }
const DATUM = parseTime(new Date(),'{y}{m}{d}'), const DATUM = parseTime(new Date(), "{y}{m}{d}"),
UNAME = this.vuex_user.nickName, UNAME = this.vuex_user.nickName,
UZEIT = parseTime(new Date(),'{h}{i}{s}'); UZEIT = parseTime(new Date(), "{h}{i}{s}");
const arr = this.goodsList.map((item) => { const arr = this.goodsList.map((item) => {
return { return {
plnr: item, plnr: item,
UPDKZ: 'D', UPDKZ: "D",
DATUM, DATUM,
UNAME, UNAME,
UZEIT, UZEIT,
werks: this.vuex_user_factory werks: this.vuex_user_factory,
} };
}) });
this.$u.api.sapApi this.$u.api.sapApi.sapCasePlnr(arr).then((res) => {
.sapCasePlnr(arr)
.then((res) => {
const flag = res.some((item) => { const flag = res.some((item) => {
const b = item.TYPE == 'E' const b = item.TYPE == "E";
if (b) { if (b) {
this.$u.toast(item.MESSAGE) this.$u.toast(item.MESSAGE);
} }
return b return b;
}) });
if (!flag) { if (!flag) {
this.$u.toast(res[0].MESSAGE); this.$u.toast(res[0].MESSAGE);
this.goodsList = [] this.goodsList = [];
this.reset()
} }
}) });
}, },
goBack() {} goBack() {},
}, },
}; };
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.btn { .btn {
padding: 10rpx 20rpx; padding: 10rpx 20rpx;
background: #fff; background: #fff;
.title { .title {
...@@ -122,16 +148,15 @@ ...@@ -122,16 +148,15 @@
color: #000; color: #000;
font-size: 34rpx; font-size: 34rpx;
} }
} }
.cardContent { .cardContent {
border-radius: 8px; border-radius: 8px;
background: #fff; background: #fff;
margin-bottom: 20rpx; margin-bottom: 20rpx;
}
} .listItemTitle {
.listItemTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20rpx; padding: 20rpx;
...@@ -151,5 +176,5 @@ ...@@ -151,5 +176,5 @@
word-break: break-all; word-break: break-all;
font-weight: 600; font-weight: 600;
} }
} }
</style> </style>
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 to comment