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