From f29b9dee3aa4c05fc36e8d89ec96f60efe71196e Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期二, 30 七月 2024 17:54:55 +0800
Subject: [PATCH] 1

---
 sub_pages/customer/shop/shop.vue |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue
index 166571f..6cc13c3 100644
--- a/sub_pages/customer/shop/shop.vue
+++ b/sub_pages/customer/shop/shop.vue
@@ -249,7 +249,11 @@
 
 			},
 			//update 关注
-			async updateGz(type) {
+			async updateGz(type) {
+				if(!this.currentInfo.id){
+					this.$message.showToast('请先登录')
+					return
+				}
 				this.$message.showLoading()
 				const {
 					code
@@ -315,6 +319,13 @@
 				}
 				if (!item.shopnum) {
 					item.shopnum = 0
+				}
+				if (!item.stock) {
+					item.stock = 0
+				}
+				if (item.shopnum + addnum > item.stock) {
+					this.$message.showToast('库存不足,无法添加')
+					return
 				}
 				if (item.shopnum + addnum >= 0) {
 
@@ -332,9 +343,9 @@
 				})
 				this.$message.hideLoading()
 				if (code === 0) {
-					item.shopnum += addnum
+					item.shopnum += addnum
+					this.$forceUpdate()
 				}
-				this.$forceUpdate()
 			},
 
 		}

--
Gitblit v1.9.3