Jelajahi Sumber

调起支付

梁汉强 4 tahun lalu
induk
melakukan
045e6d3e20
2 mengubah file dengan 36 tambahan dan 37 penghapusan
  1. 3 3
      common/conf/config.js
  2. 33 34
      pages/activityList/activity/musicBoost.vue

+ 3 - 3
common/conf/config.js

@@ -1,11 +1,11 @@
 //公众号ID
-const appId = 'wxf3f84c916a741cac';
+const appId = 'wx322e246549d7620d';
 
 //公众号密钥
-const appSecret = '8377629994436f17210500a11bbce6cc';
+const appSecret = '118059d75bc8c1a08162fc8a8cf5ac04';
 
 //经过编码后的回调地址
-const redireactUrl = 'https://vote.guosen-fumao.cn/vote-h5/index.html#/';
+const redireactUrl = 'http://yyzs.nanyue6688.com/vote-h5/index.html#/';
 
 //获取用户授权信息Code
 const authUrl = (path) => { return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(redireactUrl+path)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`};

+ 33 - 34
pages/activityList/activity/musicBoost.vue

@@ -181,41 +181,39 @@
 			},
 			//礼物支付
 			async pay() {
-				alert(1)
-				let orderInfo  = (await this.$u.api.yeePay.initOrder(
-					{
-					  "appId": appId,
-					  "channel": "WECHAT",
-					  "channelPromotionInfo": "",
-					  "channelSpecifiedInfo": "",
-					  "csUrl": "",
-					  "expiredTime": "",
-					  "fundProcessType": "",
-					  "goodsName": "测试",
-					  "memo": "",
-					  "notifyUrl": "https://vote.guosen-fumao.cn/vote-h5/index.html",
-					  "orderAmount": 0.01,
-					  "orderId": "363223222169",
-					  "payWay": "MINI_PROGRAM",
-					  "redirectUrl": "",
-					  "scene": "ONLINE",
-					  "uniqueOrderNo": "",
-					  "userId": "ofODrjk12F8egZQJELDhcD-kMd2Y",
-					  "userIp": "127.0.0.1"
+				// if (this.$u.test.isEmpty(this.userId)) {
+				// 	let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
+				// 	window.location.href = authUrl(path);
+				// } else {
+					alert(1)
+					let orderInfo  = (await this.$u.api.yeePay.initOrder(
+						{
+						  "appId": appId,
+						  "channel": "WECHAT",
+							"channelPromotionInfo": "",
+							"channelSpecifiedInfo": "",
+							"csUrl": "",
+							"expiredTime": "",
+							"fundProcessType": "",
+							"goodsName": this.boostDetail.presentList[this.current].name,
+							"memo": "",
+							"notifyUrl": "https://vote.guosen-fumao.cn/vote-h5/index.html",
+							"orderAmount": this.count * this.currentPresentSum,
+							"orderId": new Date().getTime(),
+							"payWay": "WECHAT_OFFIACCOUNT",
+							"redirectUrl": "",
+							"scene": "OFFLINE",
+							"uniqueOrderNo": "",
+							"userId": uni.getStorageSync("openid"),
+							"userIp": "127.0.0.1"
+						}
+					));
+					console.log(orderInfo,123456);
+					if(typeof orderInfo.prePayTn != 'undefined' ){
+						//调起支付
+						this.toPay(JSON.parse(orderInfo.prePayTn));
 					}
-				)).data;
-				if(typeof orderInfo.prePayTn != 'undefined' ){
-					//调起支付
-					this.toPay(orderInfo.prePayTn);
-				}
-			},
-			pay() {
-				if (this.$u.test.isEmpty(this.userId)) {
-					let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
-					window.location.href = authUrl(path);
-				} else {
-					console.log("发起支付");
-				}
+				// }
 			},
 			//获取助力详情
 			getBoostDetail(productId, userId) {
@@ -282,6 +280,7 @@
 				this.type = "分享到朋友圈"
 			},
 			toPay(info) {
+				console.log(info,456789);
 				WeixinJSBridge.invoke('getBrandWCPayRequest', info, (res) => {
 					if (res.err_msg == "get_brand_wcpay_request:ok" ) {
 						this.$u.api.boost.billRecord({