Browse Source

拼团支付修改

twt 2 years ago
parent
commit
49ddc90032
3 changed files with 72 additions and 8 deletions
  1. 57 5
      pages/index/index.vue
  2. 12 2
      pages/login/empower.vue
  3. 3 1
      pages/pay/pay.vue

+ 57 - 5
pages/index/index.vue

@@ -13,7 +13,7 @@
 		data() {
 			return {
 				url: '',
-				
+				shopId:'',
 				wxOpendata:'',
 				logindata:'',
 				id:'',
@@ -23,13 +23,52 @@
 			var that=this;
 			this.wxOpendata=uni.getStorageSync("wxOpendata");
 			this.logindata=uni.getStorageSync("logindata");
+			//this.wxOpendata.code='39C455DB5CAF4FD4AE5F3F52EBA8ABD6'
+			//opt.scene='E37BB2965A084534859DB351BA611AF9' //连锁二号
+			//opt.scene='1B43BADDB6704B27B6C1604523287EAF' //连锁一号
+			if(opt.scene){
+				this.shopId=opt.scene;
+				that.shopId=that.insertStr(that.shopId,8,"-");
+				that.shopId=that.insertStr(that.shopId,13,"-");
+				that.shopId=that.insertStr(that.shopId,18,"-");
+				that.shopId=that.insertStr(that.shopId,23,"-");
+				uni.setStorage({
+					key: 'shopId',
+					data: that.shopId,
+					success: function () {
+					}
+				});
+				if(this.shopId!=this.wxOpendata.shopID){
+					uni.removeStorageSync('wxOpendata');
+					this.wxOpendata=''
+				}
+			}
 			if (opt.path) {
 			      //this.url = `${this.url}${options.path}`
 				   //this.url = opt.path
 				    console.log('options', opt)
 					//console.log(opt)
 					var url=opt.path.replace('$', '?')
-					
+					this.shopId=opt.shopId;
+					if(this.shopId!=this.wxOpendata.shopID){
+						if(opt.shareID){
+							 var webviewurl=url+'&shareID='+opt.shareID+'&type='+opt.type
+						}else{
+							 var webviewurl=url+'&type='+opt.type
+						}
+						var testshopid='1B43BADD-B670-4B27-B6C1-604523287EAF'
+						uni.setStorage({
+							key: 'webviewurl',
+							data: webviewurl,
+							success: function () {
+								uni.navigateTo({
+									url:'../login/empower?shopId='+that.shopId
+								})
+								uni.removeStorageSync('wxOpendata');
+							}
+						});
+						return false;
+					}
 					if(that.wxOpendata.code){
 						if(opt.shareID){
 							 var webviewurl=url+"&codeapp="+that.wxOpendata.code+'&shareID='+opt.shareID+'&type='+opt.type+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
@@ -80,7 +119,12 @@
 				        console.log('当前位置的经度是:' + res.longitude);
 				        console.log('当前位置的纬度:' + res.latitude);
 						if(opt.id){
-							that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+							if(opt.type==6){
+								that.url=that.$webURL+'paySuccessPinTuan?id='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+							}else{
+								that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+							}
+							
 						}else{
 							/* if(!that.wxOpendata.shopID||!that.logindata){
 								uni.navigateTo({
@@ -99,7 +143,11 @@
 					fail(err) {
 						console.log(err)
 					    if(opt.id){
-					    	that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=""&lng=""'
+					    	if(opt.type==6){
+					    		that.url=that.$webURL+'paySuccessPinTuan?id='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=&lng=&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+					    	}else{
+					    		that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=&lng=&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+					    	}
 					    }else{
 					    	if(!that.wxOpendata.shopID){
 					    		uni.navigateTo({
@@ -108,7 +156,7 @@
 					    	}
 					    	if(that.wxOpendata.code){
 					    		//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
-					    		that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'
+					    		that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
 					    	}
 					    }
 					}
@@ -137,6 +185,9 @@
 			goUrl(){
 				
 			},
+			insertStr(soure, start, newStr){
+			   return soure.slice(0, start) + newStr + soure.slice(start);
+			},
            message(event){
                console.log(event);
            	let { data } = event.mp.detail
@@ -153,6 +204,7 @@
 			}
 			var obj=JSON.stringify(share) */
 			var newUrl=this.shareData.path.replace('?', '$')
+			newUrl=newUrl+'&shopId='+this.wxOpendata.shopID
 			console.log(newUrl)
 			/*   
 			    if (this.shareData) {

+ 12 - 2
pages/login/empower.vue

@@ -34,6 +34,11 @@ export default {
       this.type=opt.type;
 	  this.loginType=opt.loginType;
 	  this.wxOpendata=uni.getStorageSync("wxOpendata");
+	  var shopID=uni.getStorageSync("shopId");
+	  if(shopID){
+		  this.shopID=shopID;
+		  uni.removeStorageSync('shopId');
+	  }
 	  if(this.loginType==1){
 		  
 	  }else{
@@ -144,9 +149,14 @@ export default {
 						    	url:'login?shopId='+that.shopID
 						    })
 					   }else{
-						   uni.navigateTo({
+						   uni.showToast({
+						        title: '请扫码店铺码',
+						    	 icon:'none',
+						        duration: 3000
+						    });
+						   /* uni.navigateTo({
 						   	url:'../user/scanCode'
-						   })
+						   }) */
 					   }
 					   
 					  /* if(!that.type){

+ 3 - 1
pages/pay/pay.vue

@@ -18,6 +18,7 @@
 				redisId:'',
 				money:'',
 				id:'',
+				type:'',
 			}
 		},
 		onLoad(opt) {
@@ -27,6 +28,7 @@
 				this.redisId=opt.redisId
 				this.money=opt.money
 				this.id=opt.id
+				this.type=opt.type
 				this.getPayInfoByRedis()
 			}
 			/* this.redisId='91CA851E-624C-44DE-ACDE-15EC5D0CC4B4'
@@ -70,7 +72,7 @@
 			  				 });		   
 			  		
 			  		uni.reLaunch({
-			  			url:'../index/index?id='+that.id
+			  			url:'../index/index?id='+that.id+'&type='+that.type
 			  		})
 			  		
 			      },