Browse Source

原料直发修改数量用num自定义组件

dev_pda
李俊城 2 years ago
parent
commit
54cfa5bc64
  1. 67
      fe/PDA/mycomponents/comItem/comItemTop.vue

67
fe/PDA/mycomponents/comItem/comItemTop.vue

@ -16,11 +16,9 @@
<view class="ljh_right uni-row uni-flex u-col-center" style="
align-items: center;">
<text class="tnum" v-if="!isEditCount">{{dataContent.qty}}</text>
<input v-if="isEditCount" type="digit" v-model="countValue" @input="inputClick" style="
width: 180rpx;
height: 70rpx;
text-align: center;
background-color:#DCDCDC" />
<com-number-box v-if="isEditCount" ref="comNumberBox" v-model="dataContent.qty" :max="99999" :min="0"
style='width: 100px;' @change="qtyChanged($event)">
</com-number-box>
<text class="tunit">{{dataContent.uom}}</text>
</view>
@ -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);
}
},
}
}
</script>

Loading…
Cancel
Save