Bladeren bron

替换微信支付通过贵阳银行跳转方式

CarlYang 3 jaren geleden
bovenliggende
commit
55459887c2

+ 5 - 1
common/apiurl.js

@@ -70,7 +70,11 @@ const apiurl = {
 	// 订单退款
 	updateOrderRefundApi: '/client/orderinfo/refundApply',
 	// 获取退款详情
-	getOrderRefundDetailsApi: '/client/orderinfo/refund/detail/'
+	getOrderRefundDetailsApi: '/client/orderinfo/refund/detail/',
+	// 普通微信支付
+	ordinaryWxPayApi: '/client/pay/gzbank/poly',
+	// 包月微信支付
+	monthlyWxPayApi: '/client/monthpay/gzbank/poly'
 }
 
 export {

+ 1 - 2
common/config.js

@@ -2,9 +2,8 @@ const config = {
 	wxAppid:'wxbe90cc7c5233dd84',// 测试wxAppid 
 	// wxAppid: 'wx45c3cf2b632f5fd5', // 正式wxAppid
 	
-	// baseUrl: 'https://wx.hw.hongweisoft.com/parking',// 64服务器
+	baseUrl:'https://wx.hw.hongweisoft.com/parking',// 64服务器
 	// baseUrl: 'https://parking.pdzhtc.com', //正式接口访问地址
-	baseUrl: 'http://wx.hw.hongweisoft.com/parkingzn'
 }
 export {
 	config

+ 7 - 1
common/http.api.js

@@ -59,6 +59,10 @@ const install = (Vue, vm) => {
 	let updateOrderRefund = (params = {}) => vm.$u.post(apiurl.updateOrderRefundApi, params);
 	// 获取订单退款详情
 	let getOrderRefundDetails = (params = {}) => vm.$u.get(apiurl.getOrderRefundDetailsApi + params.orderId)
+	// 普通微信支付
+	let ordinaryWxPay = (params = {}) => vm.$u.post(apiurl.ordinaryWxPayApi, params)
+	// 包月微信支付
+	let monthlyWxPay = (params = {}) => vm.$u.post(apiurl.monthlyWxPayApi, params)
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		feedbackAdd,
@@ -94,7 +98,9 @@ const install = (Vue, vm) => {
 		getOrderInfo,
 		getEquomentInfo,
 		updateOrderRefund,
-		getOrderRefundDetails
+		getOrderRefundDetails,
+		ordinaryWxPay,
+		monthlyWxPay
 	};
 }
 

+ 7 - 7
pages/center/phoneLogin/phoneLogin.vue

@@ -145,13 +145,13 @@ export default {
 		},
 		// 微信登录
 		wechatLogin() {
-			// this.jumpIndex()
-			const openId = this.$store.state.vuex_wxinfo?.openId
-			if (openId) {
-				this.jumpIndex()
-			} else {
-				this.getCode()
-			}
+			this.jumpIndex()
+			// const openId = this.$store.state.vuex_wxinfo?.openId
+			// if (openId) {
+			// 	this.jumpIndex()
+			// } else {
+			// 	this.getCode()
+			// }
 		},
 		// 微信已登录则跳转到首页
 		jumpIndex() {

+ 41 - 6
pages/handleMonthly/handleMonthly.vue

@@ -63,6 +63,9 @@
 
 <script>
 	import getUrlParams from "../../utils/getUrlParams.js";
+	import {
+		monthlyWxPay
+	} from '@/common/http.api.js'
 	export default {
 		data() {
 			return {
@@ -252,12 +255,13 @@
 			 * 最后再调起微信支付
 			 * */
 			wechatPay() {
-				const openId = this.$store.state.vuex_wxinfo.openId
-				if (openId) {
-					this.getWXPay()
-				} else {
-					this.getCode()
-				}
+				// const openId = this.$store.state.vuex_wxinfo.openId
+				// if (openId) {
+				// 	this.getWXPay()
+				// } else {
+				// 	this.getCode()
+				// }
+				this.getWXPayByJava()
 			},
 			/**
 			 * 调起微信支付接口
@@ -293,6 +297,37 @@
 					}
 				});
 			},
+			/**
+			 * 直接通过后台获取贵阳银行微信支付地址
+			 * @param {Array} list 需要支付的订单组合数组
+			 * @param {Number} deviceNo 设备编号(在停车锁部分需要)
+			 * */
+			getWXPayByJava(orderList, deviceNo) {
+				const jumpUrl = window.location.href.split('#')[0] + '#/pages/center/monthly/monthly'
+				// 支付成功跳转到包月页面
+				let params = {
+					monthId: this.monthId,
+					openid: '',
+					jumpUrl: jumpUrl
+				};
+				this.$u.api.monthlyWxPay(params)
+					.then(res => {
+						if (res.code === 200) {
+							location.href = res.data.qrCodeUrl
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error',
+							});
+						}
+					})
+					.catch(err => {
+						this.$refs.uToast.show({
+							title: '无法调起微信支付!',
+							type: 'error',
+						});
+					})
+			},
 			/**
 			 * 获取code
 			 * 1 微信登录获取code

+ 37 - 6
pages/paymentMethod/paymentMethod.vue

@@ -91,12 +91,13 @@
 			 * 最后再调起微信支付
 			 * */
 			wechatPay() {
-				const openId = this.$store.state.vuex_wxinfo.openId
-				if (openId) {
-					this.getWXPay(this.curOrderList, this.deviceNo)
-				} else {
-					this.getCode()
-				}
+				// const openId = this.$store.state.vuex_wxinfo.openId
+				// if (openId) {
+				// 	this.getWXPay(this.curOrderList, this.deviceNo)
+				// } else {
+				// 	this.getCode()
+				// }
+				this.getWXPayByJava(this.curOrderList, this.deviceNo)
 			},
 			/**
 			 * 调起微信支付接口
@@ -132,6 +133,36 @@
 					}
 				});
 			},
+			/**
+			 * 直接通过后台获取贵阳银行微信支付地址
+			 * @param {Array} list 需要支付的订单组合数组
+			 * @param {Number} deviceNo 设备编号(在停车锁部分需要)
+			 * */
+			getWXPayByJava(orderList, deviceNo) {
+				let params = {
+					orderList: orderList,
+					openid: '',
+					jumpUrl: window.location.href,
+					deviceNo: deviceNo ? deviceNo : null
+				};
+				this.$u.api.ordinaryWxPay(params)
+					.then(res => {
+						if (res.code === 200) {
+							location.href = res.data.qrCodeUrl
+						} else {
+							this.$refs.uToast.show({
+								title: res.msg,
+								type: 'error',
+							});
+						}
+					})
+					.catch(err => {
+						this.$refs.uToast.show({
+							title: '无法调起微信支付!',
+							type: 'error',
+						});
+					})
+			},
 			/**
 			 * 获取code
 			 * 1 微信登录获取code