You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
5.3 KiB

<template>
<view>
<uni-popup ref="popupqtyedit" type="center">
<view class="uni-popup-view" style="display: flex;flex-direction: column; width: 500rpx;">
<view
style="display: flex; justify-content: center; align-items: center; padding: 10rpx;flex-direction: column;">
<view style="padding: 10rpx; font-weight: bold; font-size: 35rpx;">{{title}}</view>
<view class="" style="width: 100%; background-color: black;height: 2rpx;">
</view>
</view>
<view style="padding: 6rpx;margin-left: 15rpx;font-size: 32rpx;">箱码 : {{dataContent.recommendPackingCode}}</view>
<view style="padding: 6rpx;margin-left: 15rpx;font-size: 32rpx;">物料号 : {{dataContent.itemCode}}</view>
<view style="padding: 6rpx;margin-left: 15rpx;font-size: 32rpx;">名称 : {{dataContent.itemName}}</view>
<view style="padding: 6rpx;margin-left: 15rpx;font-size: 32rpx;">描述 : {{dataContent.itemDesc1}}</view>
<view style="display: flex; justify-content: center;align-items: center; padding: 6rpx;margin-top: 10rpx;">
<com-number-box v-model="value" :max="99999999" :min="0" style='margin: 0px 5px' />
<view class="">
({{dataContent.uom}})
</view>
</view>
<view class="uni-popup-button-box">
<button @click="cancle" class="save-button" style="width: 220rpx;margin-top: 10rpx;margin-right: 10rpx; " type="default">取消</button>
<button @click="submit" class="save-button" style="width: 220rpx;margin-top: 10rpx;margin-left: 10rpx; " type="primary">确定</button>
</view>
</view>
<comMessage ref="comMessage"></comMessage>
</uni-popup>
</view>
</template>
<script>
import {
showErrorMsg,
} from '@/common/basic.js';
import comMessage from '@/mycomponents/common/comMessage.vue'
import comNumberBox from '@/mycomponents/common/comNumberBox.vue'
export default {
components: {
comMessage,
comNumberBox
},
props: {
title: {
type: String,
default: ""
}
},
data() {
return {
value: 0,
defaultValue: 0,
vaildMaxValue: {
type: Boolean,
default: true
},
//允许小于等于0
allowZero: {
type: Boolean,
default: true
},
dataContent: {},
}
},
created() {
},
methods: {
openPopup(qty) {
this.value = qty;
this.defaultValue = qty;
this.$refs['popupqtyedit'].open("center");
},
//vaild,提交是是否校验数量
openPopup1(qty, vaild) {
this.value = qty;
this.defaultValue = qty;
this.vaildMaxValue = vaild;
this.$refs['popupqtyedit'].open("center");
},
//vaildqty校验的数量,提交时与输入的值做比较
openPopup2(qty, vaildqty) {
this.value = qty;
this.defaultValue = vaildqty;
this.vaildMaxValue = true;
this.$refs['popupqtyedit'].open("center");
},
//qty当前数量,vaildqty校验的最大数量 , isZero数量是否允许为0
openPopup3(item, qty, vaildqty, isZero) {
this.dataContent = item
this.value = qty;
this.defaultValue = vaildqty;
this.vaildMaxValue = true;
this.allowZero = isZero;
this.$refs['popupqtyedit'].open("center");
},
//qty当前数量,不验证最大值,不允许为0
openPopup4(qty, vaildMaxValue, isZero) {
this.value = qty;
this.defaultValue = qty;
this.vaildMaxValue = vaildMaxValue;
this.allowZero = isZero;
this.$refs['popupqtyedit'].open("center");
},
cancle(){
this.$refs['popupqtyedit'].close();
},
//确定
submit() {
let that = this;
if (that.value === "") {
this.showMessage('数量不能为空');
that.value = that.defaultValue;
} else {
let qty = Number(that.value);
if (that.vaildMaxValue) {
if (qty > that.defaultValue) {
this.showMessage('数量不能大于' + that.defaultValue);
that.value = that.defaultValue;
} else {
if (!that.allowZero) //不允许0
{
if (qty == 0) {
this.showMessage('数量不能为0');
that.value = that.value;
} else if (qty < 0) {
this.showMessage('数量不能小于0');
that.value = that.value;
} else {
that.$emit("getvalue", qty);
that.$refs['popupqtyedit'].close();
}
} else {
that.$emit("getvalue", qty);
that.$refs['popupqtyedit'].close();
}
}
} else {
if (!that.allowZero) //不允许0
{
if (qty == 0) {
this.showMessage('数量不能为0');
that.value = that.defaultValue;
} else if (qty < 0) {
this.showMessage('数量不能小于0');
that.value = that.defaultValue;
} else {
that.$emit("getvalue", qty);
that.$refs['popupqtyedit'].close();
}
} else {
that.$emit("getvalue", qty);
that.$refs['popupqtyedit'].close();
}
}
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message);
}
}
}
</script>
<!-- background-color: #fff; -->
<style scoped lang="scss">
.center {
flex: auto;
display: flex;
flex-direction: column;
justify-content: center;
// align-items: center;
}
.flex-item {
width: 50%;
text-align: center;
}
.messageButton {
border-color: #F8F8F8;
}
.messagePopup {
background-color: #fff;
border-radius: 5px;
}
/deep/ .uni-input-input {
font-size: 20px;
height: 46px;
}
</style>