From 1b56642743e2439d88c36c38814437fe9bebccb5 Mon Sep 17 00:00:00 2001 From: modendeveloper Date: Sat, 21 Sep 2024 11:03:16 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5--=E7=BC=BA=E8=B4=A7=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E6=95=B0=E9=87=8F=E7=82=B9=E5=87=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=94=AE=E6=95=B0=E9=87=8F=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?0=EF=BC=8C=E7=82=B9=E5=87=BB=E5=87=8F=E5=B0=91=E9=94=AE?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E6=98=BE=E7=A4=BA=E4=B8=BA1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/shop/GoodsCon/index.vue | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pages/shop/GoodsCon/index.vue b/pages/shop/GoodsCon/index.vue index 67be1fd..5227a94 100644 --- a/pages/shop/GoodsCon/index.vue +++ b/pages/shop/GoodsCon/index.vue @@ -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--;