From 42e5ea86f7edc9361227edd979a8ae1952713161 Mon Sep 17 00:00:00 2001
From: Liuyi <candymxq888@outlook.com>
Date: 星期六, 19 十月 2024 16:19:16 +0800
Subject: [PATCH] 添加共享列表,修改共享功能相关代码

---
 pages/recharge/index.vue |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/pages/recharge/index.vue b/pages/recharge/index.vue
index ebffff7..d025a07 100644
--- a/pages/recharge/index.vue
+++ b/pages/recharge/index.vue
@@ -2,7 +2,7 @@
 	import{ ref ,onMounted} from 'vue'
 	import { wxPayApi } from '../../api/index.js'
 	
-	const choosedMoney = ref()
+	const choosedMoney = ref(50)
 	const disabled = ref(true)
 	//选择金额
 	const moneyList = ref([
@@ -56,13 +56,12 @@
 		if(disabled.value){
 			money = choosedMoney.value
 		}else{
-			money = otherMoney.value
+			money = Number(otherMoney.value)
 		}
 		await wxPayApi({businessType:1,tradeAmount:money}).then((res) =>{
-			console.log('reswxpay',res)
-			
-			  //调用微信官方支付接口弹出付款界面,输入密码扣款
-			  wx.requestPayment({
+			if(res.code == 200){
+				//调用微信官方支付接口弹出付款界面,输入密码扣款
+				wx.requestPayment({
 				  //预支付订单信息
 				  // appId: res.data.appId,
 				  timeStamp: res.data.timeStamp,     //时间戳 
@@ -70,20 +69,33 @@
 				  package: res.data.package,		//prepay_id
 				  signType: res.data.signType,		//签名算法MD5		
 				  paySign: res.data.paySign ,//微信签名 
-			     success (res) {
-			       if (res.errMsg == "requestPayment:ok"){
-			          console.log('支付成功', res)
-			       }else{
-			          console.log('支付失败')
-			       }
-			     },
-			     fail (res) { 
-			       console.log('支付失败', res)
-			     }
-			  })
+				 success (res) {
+				   if (res.errMsg == "requestPayment:ok"){
+					  console.log('支付成功', res)
+					  uni.showToast({
+						title: '支付成功',
+						duration: 2000,
+					  });
+					  uni.navigateBack()
+				   }else{
+					  uni.showToast({
+						title: '支付失败',
+						duration: 2000,
+						icon:'none'
+					  });
+				   }
+				   
+				 },
+				 fail (res) { 
+				   uni.showToast({
+						title: '微信支付失败',
+						duration: 2000,
+						icon:'none'
+				   });
+				 }
+				})
+			}
 		})
-
-		
 	}
 </script>
 <template>

--
Gitblit v1.9.3