梁汉强 il y a 4 ans
Parent
commit
e70f4d255a
4 fichiers modifiés avec 61 ajouts et 11 suppressions
  1. 9 1
      common/http/http.api.js
  2. 2 2
      common/utils/global.js
  3. 10 0
      pages.json
  4. 40 8
      pages/activityList/activity/musicBoost.vue

+ 9 - 1
common/http/http.api.js

@@ -73,6 +73,9 @@ let pointsGoodsUrl={
 let musicBoostUrl = {
 	detailUrl: '/cyzh-production/production/getProductDetail'
 }
+let yeePayUrl = {
+	initOrder: '/yeePay/initOrder'
+}
 
 // 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
 // https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
@@ -145,9 +148,14 @@ const install = (Vue, vm) => {
 	let musicBoost = {
 		detail:(params = {}) => vm.$u.get(musicBoostUrl.detailUrl, params),
 	}
+	
+	let yeePay = {
+		initOrder:(params = {}) => vm.$u.post(yeePayUrl.initOrder, params),
+	}
+	
 
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
-	vm.$u.api = {wxInfo,uploadFile, activity, user, points, boost,production,goods,medal,pointsGoods, musicBoost};
+	vm.$u.api = {wxInfo,uploadFile, activity, user, points, boost,production,goods,medal,pointsGoods, musicBoost,yeePay};
 }
 
 export default {

+ 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.168:9612'
+	// baseUrl: 'https://vote.guosen-fumao.cn/ldt/api'
+	baseUrl: 'http://192.168.1.48:9612'
 }
 
 export default global

+ 10 - 0
pages.json

@@ -256,5 +256,15 @@
 	"globalStyle": {
 		"navigationStyle": "custom",
 		"backgroundColor": "#F8F8F8"
+	},
+	"condition" : { //模式配置,仅开发期间生效
+		"current": 0, //当前激活的模式(list 的索引项)
+		"list": [
+			{
+				"name": "", //模式名称
+				"path": "", //启动页面,必选
+				"query": "" //启动参数,在页面的onLoad函数里面得到
+			}
+		]
 	}
 }

+ 40 - 8
pages/activityList/activity/musicBoost.vue

@@ -103,6 +103,7 @@
 
 <script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
 <script>
+	import {appId} from	'@/common/conf/config.js'
 	import {authUrl} from '@/common/conf/config.js';
 	import {getUrlParams} from '@/common/utils/utils.js';
 	export default {
@@ -152,13 +153,40 @@
 				}
 			},
 			//礼物支付
-			pay() {
-				if (this.$u.test.isEmpty(this.userId)) {
-					let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
-					window.location.href = authUrl(path);
-				} else {
-					
+			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"
+					}
+				)).data;
+				if(typeof orderInfo.prePayTn != 'undefined' ){
+					//调起支付
+					this.toPay(orderInfo.prePayTn);
 				}
+				// if (this.$u.test.isEmpty(this.userId)) {
+				// 	let path = 'pages/activityList/activity/musicBoost?id=' + this.productId;
+				// 	window.location.href = authUrl(path);
+				// } else {
+					
+				// }
 			},
 			//获取助力详情
 			getBoostDetail(productId, userId) {
@@ -210,8 +238,12 @@
 			//邀请
 			invite() {
 				this.shareShow = true;
-			}
-		}
+			},
+			toPay(info){
+				WeixinJSBridge.invoke(
+				      'getBrandWCPayRequest',info ,
+				      (res) =>{});
+		}}
 	}
 </script>