Przeglądaj źródła

feat:支付取消提示优化

zhanghui 2 lat temu
rodzic
commit
e92701c7fe
1 zmienionych plików z 15 dodań i 5 usunięć
  1. 15 5
      myPages/recharge/index.vue

+ 15 - 5
myPages/recharge/index.vue

@@ -258,11 +258,20 @@
 							// 刷新用户信息
 							that.getUserInfo()
 						},
-						fail: res => {
-							uni.showModal({
-								content: '支付失败',
-								showCancel: false
-							});
+						fail: err => {
+							console.log(err)
+							if (err.errMsg === "requestPayment:fail cancel"){
+								uni.showModal({
+									content: '支付取消',
+									showCancel: false
+								});
+							}else {
+								uni.showModal({
+									content: '支付失败',
+									showCancel: false
+								});
+							}
+
 						}
 					});
 				})
@@ -271,6 +280,7 @@
 			getUserInfo(){
 				this.$api.getUserInfo().then(res=>{
 					console.log('++++++++++++获取用户信息++++++++++++++++++',res)
+
 					uni.setStorageSync('userInfo',res.data.data)
 					this.userInfo = res.data.data
 				})