Fix:3601 【商城小程序】加购或送礼,输入数量超过商品库存,页面点击无效

This commit is contained in:
modendeveloper
2025-04-08 23:45:38 +08:00
parent ed81a95cd9
commit a5d0ce8657
+8 -1
View File
@@ -138,7 +138,10 @@ export default {
deep: true
},
cartNumber(val) {
console.log(+val <= 1 || val === '', 'cartNumber');
console.log(this.attr, 'cartNumber');
if (val > this.attrObj.productSelect.stock) {
val = this.attrObj.productSelect.stock
}
this.$emit('input', +val)
this.$emit("changeFun", { action: "ChangeCartNum", value: +val })
}
@@ -154,6 +157,10 @@ export default {
this.cartNumber = 1
this.$forceUpdate()
}
if(+e > this.attrObj.productSelect.stock) {
this.cartNumber = this.attrObj.productSelect.stock
this.$forceUpdate()
}
},
reRender(data) {
this.$set(this, 'attrObj', JSON.parse(JSON.stringify(data)))