From badafedccb814258fa54156b558458fa04191f8d Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期二, 30 七月 2024 11:42:48 +0800
Subject: [PATCH] update

---
 sub_pages/customer/shop/shop.vue |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/sub_pages/customer/shop/shop.vue b/sub_pages/customer/shop/shop.vue
index 166571f..82c1522 100644
--- a/sub_pages/customer/shop/shop.vue
+++ b/sub_pages/customer/shop/shop.vue
@@ -315,6 +315,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 +339,9 @@
 				})
 				this.$message.hideLoading()
 				if (code === 0) {
-					item.shopnum += addnum
+					item.shopnum += addnum
+					this.$forceUpdate()
 				}
-				this.$forceUpdate()
 			},
 
 		}

--
Gitblit v1.9.3