Browse Source

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

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

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

@ -16,11 +16,9 @@
<view class="ljh_right uni-row uni-flex u-col-center" style=" <view class="ljh_right uni-row uni-flex u-col-center" style="
align-items: center;"> align-items: center;">
<text class="tnum" v-if="!isEditCount">{{dataContent.qty}}</text> <text class="tnum" v-if="!isEditCount">{{dataContent.qty}}</text>
<input v-if="isEditCount" type="digit" v-model="countValue" @input="inputClick" style=" <com-number-box v-if="isEditCount" ref="comNumberBox" v-model="dataContent.qty" :max="99999" :min="0"
width: 180rpx; style='width: 100px;' @change="qtyChanged($event)">
height: 70rpx; </com-number-box>
text-align: center;
background-color:#DCDCDC" />
<text class="tunit">{{dataContent.uom}}</text> <text class="tunit">{{dataContent.uom}}</text>
</view> </view>
@ -33,10 +31,11 @@
getInventoryTypeStyle, getInventoryTypeStyle,
getInventoryStatusDesc, getInventoryStatusDesc,
} from '@/common/basic.js'; } from '@/common/basic.js';
import comNumberBox from '@/mycomponents/common/comNumberBox.vue';
export default { export default {
name: 'comItemTop', name: 'comItemTop',
components: {}, components: {comNumberBox},
props: { props: {
dataContent: { dataContent: {
type: Object, type: Object,
@ -47,19 +46,10 @@
default: false default: false
} }
}, },
watch: {
dataContent: {
handler(newval, oldval) {
this.countValue = this.dataContent.qty
},
immediate: true,
deep: true
}
},
data() { data() {
return { return {
countValue: 0
} }
}, },
filters: { filters: {
@ -74,37 +64,22 @@
}, },
methods: { methods: {
inputClick(value) {
this.$nextTick(() => { qtyChanged(value) {
if(value.detail.value==""){ if (value <= 0) {
uni.showToast({ uni.showToast({
title: "输入数量不能为空" title: "输入数量不能小于或等于0"
}) })
this.dataContent.qty = this.countValue; this.dataContent.qty = this.dataContent.recommendQty
return; this.$refs.comNumberBox.setValue(this.dataContent.qty);
} }else if(value>this.dataContent.recommendQty){
uni.showToast({
if (value.detail.value < 0) { title: "输入数量不能大于库存数量"+this.dataContent.recommendQty
uni.showToast({ })
title: "输入数量不能小于0" this.dataContent.qty = this.dataContent.recommendQty
}) this.$refs.comNumberBox.setValue(this.dataContent.qty);
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;
})
}
} }
} }
</script> </script>

Loading…
Cancel
Save