Fix:【商城小程序】商品详情页--缺货商品购买数量点击增加键数量显示为0,点击减少键数量显示为1
This commit is contained in:
@@ -1174,11 +1174,21 @@ export default {
|
||||
if (changeValue) {
|
||||
num.cart_num++;
|
||||
if (num.cart_num > stock) {
|
||||
this.$set(this.attr.productSelect, "cart_num", stock);
|
||||
this.$set(this, "cart_num", stock);
|
||||
if(stock < 1) {
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "cart_num", 1);
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "cart_num", stock);
|
||||
this.$set(this, "cart_num", stock);
|
||||
}
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
this.$set(this, "cart_num", num.cart_num);
|
||||
if (num.cart_num < 1) {
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "cart_num", 1);
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
this.$set(this, "cart_num", num.cart_num);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
num.cart_num--;
|
||||
|
||||
Reference in New Issue
Block a user