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"
</view> :disabled="isPack"
<view class="cardbox"> v-model="wxparams"
<view class="cardContent" v-for="(item, index) in goodsList" :key="item.PLNR"> :focus="isFocus"
<view class="listItemTitle"> placeholder="请扫描产品包装条码/外箱码"
<view> @confirm="handleConfirm"
<view class="item">PL号:{{ item }}</view> ></uni-easyinput>
</view> </view>
<u-button size="mini" type="primary" plain @click="deleGonds(index)"> <view class="cardbox">
<u-icon name="trash" size="28"></u-icon> <view
删除 class="cardContent"
</u-button> v-for="(item, index) in goodsList"
</view> :key="item.PLNR"
</view> >
</view> <view class="listItemTitle">
<view>
<view class="item">PL号:{{ item }}</view>
</view>
<u-button v-if="!isPack" size="mini" type="primary" plain @click="deleGonds(index)">
<u-icon name="trash" size="28"></u-icon>
删除
</u-button>
</view>
</view>
</view>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn> <BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</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 {
isFocus: false, isFocus: false,
isDisabled: false, isDisabled: false,
wxparams: "", wxparams: "",
goodsList: [], goodsList: [],
btnArr: [{ btnArr: [
style: '', {
type: 'warning', style: "",
text: '返回', type: "warning",
way: 'goBack' text: "返回",
}, way: "goBack",
{ },
style: '', {
type: 'primary', style: "",
text: '提交', type: "primary",
way: 'goSubmit' text: "提交",
} way: "goSubmit",
], },
}; ],
}, isBL: false,
methods: { isPack: false,
handleConfirm(e) { };
this.isFocus = false; },
this.isDisabled = true; methods: {
if (this.goodsList.some((item) => item === e)) { handleConfirm(e) {
this.$u.toast('已经存在当前条码'); if (e.startsWith("BL")) {
this.reset() // 如果扫描的BL需要查询装箱明细
return return this.$u.api.sapApi
} .sapCaseInfo({
e && this.goodsList.push(e) ZCODE: e,
this.reset() })
}, .then(({ DATA: res }) => {
deleGonds(index) { // 有装箱信息, 禁用输入框
this.goodsList.splice(index, 1) if (res.length) {
}, this.isPack = true;
reset() { this.goodsList = res.map(v => v.PLNR)
setTimeout(() => { }
this.isFocus = true; });
this.isDisabled = false; }
this.wxparams = '' this.isPack = false
}, 1000); if (this.goodsList.some((item) => item === e)) {
}, this.$u.toast("已经存在当前条码");
getBtnHandle(row) { this.reset();
console.log('getBtnHandle', row); return;
this[row.way](); }
}, e && this.goodsList.push(e);
// 提交 this.reset();
goSubmit() { },
if (!this.goodsList.length) { deleGonds(index) {
return this.$u.toast('请添加需要解除装箱的箱条码/外箱码') this.goodsList.splice(index, 1);
} },
const DATUM = parseTime(new Date(),'{y}{m}{d}'), reset() {
UNAME = this.vuex_user.nickName, setTimeout(() => {
UZEIT = parseTime(new Date(),'{h}{i}{s}'); this.isPack = false
const arr = this.goodsList.map((item) => { this.isFocus = true;
return { this.isDisabled = false;
plnr: item, this.wxparams = "";
UPDKZ: 'D', }, 1000);
DATUM, },
UNAME, getBtnHandle(row) {
UZEIT, console.log("getBtnHandle", row);
werks: this.vuex_user_factory this[row.way]();
} },
}) // 提交
this.$u.api.sapApi goSubmit() {
.sapCasePlnr(arr) if (!this.goodsList.length) {
.then((res) => { return this.$u.toast("请添加需要解除装箱的箱条码/外箱码");
const flag = res.some((item) => { }
const b = item.TYPE == 'E' const DATUM = parseTime(new Date(), "{y}{m}{d}"),
if (b) { UNAME = this.vuex_user.nickName,
this.$u.toast(item.MESSAGE) UZEIT = parseTime(new Date(), "{h}{i}{s}");
} const arr = this.goodsList.map((item) => {
return b return {
}) plnr: item,
if (!flag) { UPDKZ: "D",
this.$u.toast(res[0].MESSAGE); DATUM,
this.goodsList = [] UNAME,
} UZEIT,
}) werks: this.vuex_user_factory,
}, };
goBack() {} });
}, this.$u.api.sapApi.sapCasePlnr(arr).then((res) => {
}; const flag = res.some((item) => {
const b = item.TYPE == "E";
if (b) {
this.$u.toast(item.MESSAGE);
}
return b;
});
if (!flag) {
this.$u.toast(res[0].MESSAGE);
this.goodsList = [];
this.reset()
}
});
},
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 {
margin-top: 10rpx; margin-top: 10rpx;
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 {
display: flex;
justify-content: space-between;
padding: 20rpx;
border-bottom: 2px solid #f8f8f8;
.listItemTitle { .u-btn {
display: flex; width: 150rpx;
justify-content: space-between; margin: 0px;
padding: 20rpx; margin-top: 10rpx;
border-bottom: 2px solid #f8f8f8; }
.u-btn { .item {
width: 150rpx; line-height: 50rpx;
margin: 0px; color: #333;
margin-top: 10rpx; font-size: 28rpx;
} font-weight: 500;
word-break: break-all;
.item { font-weight: 600;
line-height: 50rpx; }
color: #333; }
font-size: 28rpx;
font-weight: 500;
word-break: break-all;
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