浏览代码

bug 修复

lilei 4 年之前
父节点
当前提交
8013159005
共有 6 个文件被更改,包括 37 次插入33 次删除
  1. 10 8
      components/uni-coods/uni-coods.vue
  2. 8 6
      libs/axios.js
  3. 4 0
      pages/cart/cart.vue
  4. 10 15
      pages/goods/goodsDetail.vue
  5. 4 1
      pages/index/index.vue
  6. 1 3
      pages/login/login.vue

+ 10 - 8
components/uni-coods/uni-coods.vue

@@ -73,7 +73,7 @@
 			addGoodToCart(item){
 				uni.showLoading({
 					mask: true,
-					title: "加入购物车..."
+					title: "正在加入购物车..."
 				})
 				addGoodsToCart(item).then(res => {
 					if(res.status == 200){
@@ -81,12 +81,14 @@
 						if(!item.hasCunzai){
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 						}
-						// 刷新购物车数据
-						uni.$emit('getCartList')
-						uni.showToast({
-							icon: 'none',
-							title:'加入购物车成功'
-						})
+						setTimeout(()=>{
+							uni.showToast({
+								icon: 'none',
+								title:'添加成功'
+							})
+							// 刷新购物车数据
+							uni.$emit('getCartList')
+						},100)
 					}else{
 						uni.hideLoading()
 					}
@@ -100,7 +102,7 @@
 			},
 			// 加入购物车
 			addCart(item) {
-				this.addGoodToCart({goodsNo:item.goodsNo,buyQty:1,hasCunzai:this.hasCunzai(item)})
+				this.addGoodToCart({goodsNo:item.goodsNo,buyQty:1,hasCunzai:false})
 			},
 			// 商品详情
 			toDetail(item){

+ 8 - 6
libs/axios.js

@@ -37,12 +37,14 @@ const request = (opts, hasToken) => {
 				if(ret.status == '200'){
 					resolve(ret)
 				}else{
-					uni.showToast({
-						icon:'none',
-						title: ret.message,
-						mask: true,
-						duration: 5000 
-					})
+					if(ret.status != '401'){
+						uni.showToast({
+							icon:'none',
+							title: ret.message,
+							mask: true,
+							duration: 5000 
+						})
+					}
 					resolve(ret)
 				}
 				resolve(ret)

+ 4 - 0
pages/cart/cart.vue

@@ -357,6 +357,10 @@
 				})
 				deleteGoodsFormCart({idList:ids}).then(res => {
 					if(res.status == 200){
+						uni.showToast({
+							title:"删除成功",
+							icon:"none"
+						})
 						// 刷新购物车
 						this.getCartList()
 					}

+ 10 - 15
pages/goods/goodsDetail.vue

@@ -109,20 +109,22 @@
 			addGoodToCart(item){
 				uni.showLoading({
 					mask: true,
-					title: "加入购物车..."
+					title: "正在加入购物车..."
 				})
 				addGoodsToCart(item).then(res => {
 					if(res.status == 200){
-						// 刷新购物车数据
-						uni.$emit('getCartList')
 						// 刷新购物车数量
 						if(!item.hasCunzai){
 							this.$store.state.vuex_cartNums = this.$store.state.vuex_cartNums + 1
 						}
-						uni.showToast({
-							icon: 'none',
-							title:'加入购物车成功'
-						})
+						setTimeout(()=>{
+							uni.showToast({
+								icon: 'none',
+								title:'添加成功'
+							})
+							// 刷新购物车数据
+							uni.$emit('getCartList')
+						},100)
 					}else{
 						uni.hideLoading()
 					}
@@ -137,14 +139,7 @@
 			// 加入购物车
 			addCart() {
 				let item = this.goodContent
-				if(this.nums * item.sellGold >= this.goldLimit){
-					this.addGoodToCart({goodsNo:item.goodsNo,buyQty:this.nums,hasCunzai:this.hasCunzai(item)})
-				}else{
-					uni.showToast({
-						icon: 'none',
-						title: `此商品需满${this.goldLimit}乐豆才能购买`
-					})
-				}
+				this.addGoodToCart({goodsNo:item.goodsNo,buyQty:this.nums,hasCunzai:this.hasCunzai(item)})
 			},
 			// 立即下单
 			toOrder(){

+ 4 - 1
pages/index/index.vue

@@ -99,7 +99,10 @@
 			})
 		},
 		onUnload() {
-			uni.$off('getCarListSuccess')
+			console.log('onUnload')
+			uni.$off('getCarCount')
+			uni.$off('getCartList')
+			uni.$off('getUserInfo')
 		},
 		onShow() {
 			// 获取订单状态数据字典

+ 1 - 3
pages/login/login.vue

@@ -43,9 +43,6 @@
 					background: '#00aaff'
 				}
 			}
-		},
-		onShow() {
-			
 		},
 		mounted() {},
 		onLoad(option) {
@@ -81,6 +78,7 @@
 				if (!this.code) {
 					this.wxLogin()
 				} 
+				console.log(this.code, e)
 				if (e.target.errMsg === 'getPhoneNumber:ok') {
 					setTimeout(()=>{
 						login({