From 89b94a71dc4722fe75ea236575b7f89fa9784cf1 Mon Sep 17 00:00:00 2001 From: linxi Date: Tue, 18 Mar 2025 11:16:01 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A3343=20=E3=80=90=E7=A4=BC=E5=93=81?= =?UTF-8?q?=E3=80=91=E8=B4=AD=E4=B9=B0=E7=A4=BC=E5=93=81=E6=95=B0=E9=87=8F?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=8F=AF=E4=BB=A5=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ProductWindow.vue | 43 +++++++++++++++++++++++++++++++---- mixins/goCartMixins.js | 8 +++++-- pages/shop/GoodsCon/index.vue | 9 ++++++-- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue index 3fbd413..a75f2f9 100644 --- a/components/ProductWindow.vue +++ b/components/ProductWindow.vue @@ -46,7 +46,14 @@ 购买数量 - - {{ cartNum }} + 1) { + num.cart_num = changeValue + } else { + num.cart_num++ + } if (num.cart_num > stock) { if(stock < 1) { this.$set(this.attr.productSelect, 'cart_num', 1) @@ -291,7 +295,7 @@ export default { 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) + // this.$set(this, 'cart_num', num.cart_num) } } } else { diff --git a/pages/shop/GoodsCon/index.vue b/pages/shop/GoodsCon/index.vue index 970f8a0..6eacf90 100644 --- a/pages/shop/GoodsCon/index.vue +++ b/pages/shop/GoodsCon/index.vue @@ -1244,7 +1244,12 @@ export default { let stock = productSelect.stock || 0 let num = this.attr.productSelect if (changeValue) { - num.cart_num++ + console.log(changeValue); + if(changeValue > 1) { + num.cart_num = changeValue + } else { + num.cart_num++ + } if (num.cart_num > stock) { if(stock < 1) { this.$set(this.attr.productSelect, 'cart_num', 1) @@ -1259,7 +1264,7 @@ export default { 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) + // this.$set(this, 'cart_num', num.cart_num) } } } else {