潘超林 2 місяців тому
батько
коміт
b686a110cb
3 змінених файлів з 16 додано та 11 видалено
  1. 6 5
      pages/index/index.vue
  2. 7 3
      pages/index/pay-zfb.vue
  3. 3 3
      pages/index/pay.vue

+ 6 - 5
pages/index/index.vue

@@ -32,16 +32,15 @@
 				ap: ap,
 				radiovalue: 0,
 				shopId: "",
-				uid:"",
+				uid: "",
 				userInfo: {}
 			};
 		},
 		onLoad(options) {
 			this.shopId = options.shopId;
-			this.uid=options.uid;
+			this.uid = options.uid || '';
 			let alipayuserinfo = localStorage.getItem("aliPayUserInfo")
 			let wechatuserinfo = localStorage.getItem("weChatUserInfo")
-			console.log(wechatuserinfo);
 			this.radiovalue = 1
 			if (alipayuserinfo) {
 				this.zfbLink()
@@ -74,14 +73,16 @@
 					&redirect_uri=${encodeURIComponent(requestConfig.zfb_redirect_uri)}
 					&state=STATE
 					&shopId=${this.shopId}
-					&uid=${this.uid}
+					${this.uid?'&uid='+this.uid:''}
 					&type=zfb`
+					console.log(url);
 				window.location = url;
 
 			},
 			wxLink() {
 				/*微信授权登录*/
-				let redirect_uri = encodeURIComponent(requestConfig.wx_redirect_uri + '?shopId=' + this.shopId+'&uid='+this.uid)
+				let redirect_uri = encodeURIComponent(requestConfig.wx_redirect_uri + '?shopId=' + this.shopId + '&uid=' +
+					this.uid)
 				let url = `https://open.weixin.qq.com/connect/oauth2/authorize?
 							appid=${requestConfig.wx_appid}
 							&redirect_uri=${redirect_uri}

+ 7 - 3
pages/index/pay-zfb.vue

@@ -88,8 +88,9 @@
 			};
 		},
 		onLoad(options) {
+			console.log('options',options);
 			this.zfbInfo = options
-			this.uid = options.uid
+			this.uid = options.uid || ""
 			this.shopId = options.shopId
 			let info = localStorage.getItem('aliPayUserInfo');
 			this.localUserInfo = JSON.parse(info)
@@ -149,8 +150,9 @@
 				if (!this.price) {
 					uni.$u.toast('请输入支付金额!');
 				}
+
 				let res = await axios.get(`${requestConfig.BaseUrl}order/app/v1/buyer/order/createOfflineOrder
-						?shopId=${this.zfbInfo.shopId}&price=${this.price}&uid=${this.uid}`, {
+						?shopId=${this.zfbInfo.shopId}&price=${this.price}${this.uid?'&uid='+this.uid:''}`, {
 					headers: {
 						'token': `${this.userInfo.token}`
 					}
@@ -202,7 +204,9 @@
 
 			async getShopInfo() {
 				let res = await axios.get(
-					`${requestConfig.BaseUrl}user/app/v1/store/getStoreInfoByScan?shopId=${this.zfbInfo.shopId}&uid=${this.uid}`, {
+					`${requestConfig.BaseUrl}user/app/v1/store/getStoreInfoByScan?shopId=${this.zfbInfo.shopId}
+					${this.uid?'&uid='+this.uid:''}
+					`, {
 						headers: {
 							'token': `${this.userInfo.token}`
 						}

+ 3 - 3
pages/index/pay.vue

@@ -86,7 +86,7 @@
 		},
 		onLoad(options) {
 			this.shopId = options.shopId
-			this.uid = options.uid
+			this.uid = options.uid || ''
 			console.log(this.uid);
 			let info = localStorage.getItem('wechatuserInfo');
 			this.localUserInfo = JSON.parse(info)
@@ -133,7 +133,7 @@
 
 			async getShopInfo() {
 				let res = await axios.get(
-					`${requestConfig.BaseUrl}user/app/v1/store/getStoreInfoByScan?shopId=${this.shopId}&uid=${this.uid}`, {
+					`${requestConfig.BaseUrl}user/app/v1/store/getStoreInfoByScan?shopId=${this.shopId}${this.uid?'&uid='+this.uid:''}`, {
 						headers: {
 							'token': `${this.userInfo.token}`
 						}
@@ -196,7 +196,7 @@
 					uni.$u.toast('请输入支付金额!');
 				}
 				let res = await axios.get(`${requestConfig.BaseUrl}order/app/v1/buyer/order/createOfflineOrder
-					?shopId=${this.shopId}&price=${this.price}&uid=${this.uid}`, {
+					?shopId=${this.shopId}&price=${this.price}${this.uid?'&uid='+this.uid:''}`, {
 					headers: {
 						'token': `${this.userInfo.token}`
 					}