瀏覽代碼

bug 修复

lilei 4 年之前
父節點
當前提交
6df4cc1621
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 3 1
      components/uni-coods/uni-coods.vue
  2. 4 2
      pages/goods/goodsDetail.vue

+ 3 - 1
components/uni-coods/uni-coods.vue

@@ -77,7 +77,9 @@
 				})
 				})
 				addGoodsToCart(item).then(res => {
 				addGoodsToCart(item).then(res => {
 					if(res.status == 200){
 					if(res.status == 200){
-						// 刷新购物车
+						// 刷新购物车数据
+						uni.$emit('getCartList')
+						// 刷新购物车数量
 						if(!item.hasCunzai){
 						if(!item.hasCunzai){
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 						}
 						}

+ 4 - 2
pages/goods/goodsDetail.vue

@@ -97,7 +97,7 @@
 					console.log(res)
 					console.log(res)
 					if(res.status == 200){
 					if(res.status == 200){
 						this.goodContent = res.data
 						this.goodContent = res.data
-						this.goldLimit = res.data.goodsType.goldLimit
+						this.goldLimit = res.data.goodsType.goldLimit || 0
 						let arr=res.data.images.split(',')
 						let arr=res.data.images.split(',')
 						arr.map(item => {
 						arr.map(item => {
 							this.imageList.push({image:item})
 							this.imageList.push({image:item})
@@ -113,7 +113,9 @@
 				})
 				})
 				addGoodsToCart(item).then(res => {
 				addGoodsToCart(item).then(res => {
 					if(res.status == 200){
 					if(res.status == 200){
-						// 刷新购物车
+						// 刷新购物车数据
+						uni.$emit('getCartList')
+						// 刷新购物车数量
 						if(!item.hasCunzai){
 						if(!item.hasCunzai){
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 						}
 						}