lyqu 4 лет назад
Родитель
Сommit
c06f931322

+ 2 - 2
common/utils/global.js

@@ -1,6 +1,6 @@
 let global = {
-	// baseUrl: 'https://vote.guosen-fumao.cn/ldt/api'
-	baseUrl: 'http://192.168.1.48:9612'
+	baseUrl: 'http://yyzs.nanyue6688.com/ldt/api'
+	// baseUrl: 'http://192.168.1.48:9612'
 }
 
 export default global

+ 69 - 26
pages/activityList/activity/authorBoost.vue

@@ -178,35 +178,37 @@
 				}
 			},
 			//礼物支付
-			pay() {
-				if (this.$u.test.isEmpty(this.senderId)) {
+			async pay() {
+				if (this.$u.test.isEmpty(this.userId)) {
 					let path = 'pages/activityList/activity/authorBoost?activityId=' + this.activityId + '&receiverId=' + this.receiverId;
 					window.location.href = authUrl(path);
 				} else {
-					console.log("发起支付");
-					//支付成功后: 
-					// this.$u.api.boost.billRecord({
-					// 	userId: this.senderId,
-					// 	openId: uni.getStorageSync("openid"),
-					// 	activityId: this.activityId,
-					// 	price: this.count * this.currentPresentSum,
-					// 	presentId: this.presentId,
-					// 	presentCount: this.count,
-					//  type: 2,
-					// 	payStatus: '',
-					// }).then(res => {
-					// 	this.$u.api.boost.doReward({
-					// 		activityId: this.activityId,
-					// 		presentId: this.presentId,
-					// 		senderId: this.senderId,
-					// 		receiverId: this.receiverId,
-					// 		type: 3,
-					// 		count: this.count,
-					// 	}).then(res => {
-					// 		this.successShow = true;
-					// 	})
-					// })
-					this.successShow = true;
+					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"
+						}
+					));
+					if(typeof orderInfo.prePayTn != 'undefined' ){
+						//调起支付
+						this.toPay(JSON.parse(orderInfo.prePayTn));
+					}
 				}
 			},
 			//获取助力详情
@@ -272,6 +274,47 @@
 				this.shareShow = false;
 				this.wxShareShow = true;
 				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({
+							userId: this.senderId,
+							openId: uni.getStorageSync("openid"),
+							activityId: this.activityId,
+							price: this.count * this.currentPresentSum,
+							presentId: this.presentId,
+							presentCount: this.count,
+							type: 2,
+							payStatus: 1,
+						}).then(res => {
+							this.$u.api.boost.doReward({
+								activityId: this.activityId,
+								presentId: this.presentId,
+								senderId: this.senderId,
+								receiverId: this.receiverId,
+								type: 3,
+								count: this.count,
+							}).then(res => {
+								this.successShow = true;
+							})
+						})
+					} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
+						this.$u.api.boost.billRecord({
+							userId: this.senderId,
+							openId: uni.getStorageSync("openid"),
+							activityId: this.activityId,
+							price: this.count * this.currentPresentSum,
+							presentId: this.presentId,
+							presentCount: this.count,
+							type: 2,
+							payStatus: 2,
+						})
+					} else {
+						console.log(res.err_msg);
+					}
+				});
 			}
 		}
 	}

+ 5 - 7
pages/activityList/activity/musicBoost.vue

@@ -181,11 +181,10 @@
 			},
 			//礼物支付
 			async pay() {
-				// if (this.$u.test.isEmpty(this.userId)) {
-				// 	let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
-				// 	window.location.href = authUrl(path);
-				// } else {
-					alert(1)
+				if (this.$u.test.isEmpty(this.userId)) {
+					let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
+					window.location.href = authUrl(path);
+				} else {
 					let orderInfo  = (await this.$u.api.yeePay.initOrder(
 						{
 						  "appId": appId,
@@ -208,12 +207,11 @@
 							"userIp": "127.0.0.1"
 						}
 					));
-					console.log(orderInfo,123456);
 					if(typeof orderInfo.prePayTn != 'undefined' ){
 						//调起支付
 						this.toPay(JSON.parse(orderInfo.prePayTn));
 					}
-				// }
+				}
 			},
 			//获取助力详情
 			getBoostDetail(productId, userId) {