zpj 1 miesiąc temu
rodzic
commit
fc89bd427f
2 zmienionych plików z 14 dodań i 11 usunięć
  1. 12 10
      pages/index.vue
  2. 2 1
      service/tools.js

+ 12 - 10
pages/index.vue

@@ -56,7 +56,7 @@
 				zfbUrl: '',
 				zfbUrl: '',
 
 
 				code_type: 1,
 				code_type: 1,
-				code: '',
+				shop_code: '',
 			}
 			}
 		},
 		},
 
 
@@ -64,8 +64,9 @@
 			// #ifdef H5
 			// #ifdef H5
 			let isWeiXin = isWx();
 			let isWeiXin = isWx();
 			if (isWeiXin) {
 			if (isWeiXin) {
-				tools.wxInitialize(["chooseWXPay"]);
+				const href = window.location.href
 				
 				
+				console.log(href);
 				if (href.indexOf('?code=') > -1 || href.indexOf('&code=') > -1) {
 				if (href.indexOf('?code=') > -1 || href.indexOf('&code=') > -1) {
 					const urlArr = href.split('?')
 					const urlArr = href.split('?')
 					const rightUrlArr = urlArr[1].split('#/')
 					const rightUrlArr = urlArr[1].split('#/')
@@ -97,14 +98,18 @@
 				}
 				}
 				
 				
 			}
 			}
+			
+			if(isWeiXin){
+				tools.wxInitialize(["chooseWXPay"]);
+			}
 			// #endif
 			// #endif
 
 
 			this.headH = getNavHeight();
 			this.headH = getNavHeight();
 			this.headPTop = getPhoneTopHeight();
 			this.headPTop = getPhoneTopHeight();
 
 
 
 
-			if (data.code !== undefined) {
-				this.code = data.code
+			if (data.shop_code !== undefined) {
+				this.shop_code = data.shop_code
 				this.code_type = data.img_type
 				this.code_type = data.img_type
 			} else {
 			} else {
 				uni.reLaunch({
 				uni.reLaunch({
@@ -114,7 +119,7 @@
 			}
 			}
 			
 			
 			payImgInfo({
 			payImgInfo({
-				code: this.code
+				code: this.shop_code
 			}).then((res) => {
 			}).then((res) => {
 				if (res.code === 1) {
 				if (res.code === 1) {
 					this.shop_id = res.data.id;
 					this.shop_id = res.data.id;
@@ -161,7 +166,7 @@
 					this.code_type = 1 //烟草码
 					this.code_type = 1 //烟草码
 				}
 				}
 				payPay({
 				payPay({
-					code: this.code,
+					code: this.shop_code,
 					pay_money: this.totalNum,
 					pay_money: this.totalNum,
 					pay_code_source: this.code_type,
 					pay_code_source: this.code_type,
 					pay_type: pay_type,
 					pay_type: pay_type,
@@ -170,10 +175,7 @@
 				}).then((res) => {
 				}).then((res) => {
 
 
 					if (res.code === 1) {
 					if (res.code === 1) {
-						
-						console.log(res);
-						return
-						
+
 						this.order_id = res.data.order_id
 						this.order_id = res.data.order_id
 						
 						
 						if (res.data.is_bank == 0 && res.data.is_yee == 1) {
 						if (res.data.is_bank == 0 && res.data.is_yee == 1) {

+ 2 - 1
service/tools.js

@@ -1,5 +1,6 @@
 import 'jweixin-module'
 import 'jweixin-module'
-
+import './base64.js'
+const Base64 = (typeof window !== 'undefined' ? window.Base64 : globalThis.Base64)
 const wxJs = (typeof window !== 'undefined') ? (window.jWeixin || window.wx) : {}
 const wxJs = (typeof window !== 'undefined') ? (window.jWeixin || window.wx) : {}
 
 
 let tools = {}
 let tools = {}