diff --git a/fe/PDA/mycomponents/comItem/comItemTop.vue b/fe/PDA/mycomponents/comItem/comItemTop.vue index dddde102a..25e71461d 100644 --- a/fe/PDA/mycomponents/comItem/comItemTop.vue +++ b/fe/PDA/mycomponents/comItem/comItemTop.vue @@ -16,11 +16,9 @@ {{dataContent.qty}} - + + {{dataContent.uom}} @@ -33,10 +31,11 @@ getInventoryTypeStyle, getInventoryStatusDesc, } from '@/common/basic.js'; + import comNumberBox from '@/mycomponents/common/comNumberBox.vue'; export default { name: 'comItemTop', - components: {}, + components: {comNumberBox}, props: { dataContent: { type: Object, @@ -47,19 +46,10 @@ default: false } }, - watch: { - dataContent: { - handler(newval, oldval) { - this.countValue = this.dataContent.qty - }, - immediate: true, - deep: true - } - - }, + data() { return { - countValue: 0 + } }, filters: { @@ -74,37 +64,22 @@ }, methods: { - inputClick(value) { - this.$nextTick(() => { - if(value.detail.value==""){ - uni.showToast({ - title: "输入数量不能为空" - }) - this.dataContent.qty = this.countValue; - return; - } - - if (value.detail.value < 0) { - uni.showToast({ - title: "输入数量不能小于0" - }) - this.countValue = this.dataContent.qty; - return; - } - - if (value.detail.value > this.dataContent.recommendQty) { - uni.showToast({ - title: "输入数量不能大于库存" + this.dataContent.recommendQty - }) - this.countValue = this.dataContent.qty - return; - } - - this.dataContent.qty = this.countValue; - }) - - - } + + qtyChanged(value) { + if (value <= 0) { + uni.showToast({ + title: "输入数量不能小于或等于0" + }) + this.dataContent.qty = this.dataContent.recommendQty + this.$refs.comNumberBox.setValue(this.dataContent.qty); + }else if(value>this.dataContent.recommendQty){ + uni.showToast({ + title: "输入数量不能大于库存数量"+this.dataContent.recommendQty + }) + this.dataContent.qty = this.dataContent.recommendQty + this.$refs.comNumberBox.setValue(this.dataContent.qty); + } + }, } }