Browse Source

Merge branch 'dev' into ats2

twt 10 months ago
parent
commit
e9caa7bb57
6 changed files with 167 additions and 18 deletions
  1. 95 12
      pages/index/index.vue
  2. 3 1
      pages/partner/myQr.vue
  3. 55 4
      pages/user/user.vue
  4. 10 0
      store/index.js
  5. 1 1
      utils/common.js
  6. 3 0
      utils/request.js

+ 95 - 12
pages/index/index.vue

@@ -312,6 +312,7 @@
 				qrSHow:false,
 				customerInfo:'',
 				userInfo:'',
+				exitNum:'',
 			}
 		},
 		onLoad(opt) {
@@ -330,9 +331,10 @@
 			
 			if (shareID) {
 				this.shareID = shareID
+				console.log('this.shareID==='+this.shareID)
 				//this.$store.commit('mutationsshareID', shareID)
 			}
-			//this.shareID='C01DF9DA51A341888754DE0C4ADB29D9'
+			//this.shareID='F16E7299-6850-4015-ABCE-A9F2794B45B5'
 			//this.shareID='1BF04FAEC8844ECE9C40E880C3B13721'
 			
 			//this.unionId="26A1039A-DB10-4D0E-BBA2-541C06274EED";
@@ -355,8 +357,8 @@
 				this.queryHomeCardList()
 				this.queryManagerInfo()
 			}else{
-				console.log("uniLogin")
-				this.uniLogin()
+					this.uniLogin()
+				
 			}
 			//版本更新
 		    this.UpdateManager();
@@ -372,7 +374,12 @@
 				this.themeColor=themeColor
 			}
 			this.getwxLoing=true;
-			if(this.userInfo){
+			
+			this.exitNum=this.$store.state.exitNum;
+			if(this.exitNum==1){
+				this.carInfo=''
+			}else{
+               if(this.userInfo){
 				if(indexaddcar==1){
 					uni.removeStorageSync('indexaddcar');
 					this.getCarList();
@@ -384,7 +391,8 @@
 						this.getCarList();
 					}
 					this.jsTime()
-				}
+				  }
+			  }
 			}
 			
 		    
@@ -463,7 +471,24 @@
 			},
 			addCar(){
 				if(!this.userInfo){
-					this.authorizShow=true;
+						if(this.exitNum!=1){
+							this.authorizShow=true;
+						}else{
+							this.$common.automaticlogin().then(val => {
+								this.userInfo=this.$store.state.userInfo;
+								this.wxOpenData=this.$store.state.wxOpenData;
+								/* uni.navigateTo({
+									url:'../user/addCar/addCar?type=1'
+								}) */
+								this.exitNum=''
+								this.$store.commit('mutationsexitNum', '')
+								this.getCarList();
+								uni.navigateTo({
+									url:'../user/addCar/cailist'
+								}) 
+							})
+						}
+					
 				}else{
 					uni.navigateTo({
 						url:'../user/addCar/addCar?type=1'
@@ -488,7 +513,7 @@
 				})
 			},
 			changeCar(){
-			   /* uni.scanCode({
+			     /* uni.scanCode({
 				 	success: function (res) {
 				 		console.log('条码类型:' + res.scanType);
 						console.log( res);
@@ -525,26 +550,63 @@
 			},
 			goGoods(item){
 				if(!this.userInfo){
-					this.authorizShow=true;
+					if(this.exitNum!=1){
+						this.authorizShow=true;
+					}else{
+						this.$common.automaticlogin().then(val => {
+							this.userInfo=this.$store.state.userInfo;
+							this.wxOpenData=this.$store.state.wxOpenData;
+							this.exitNum=''
+							this.$store.commit('mutationsexitNum', '')
+							uni.navigateTo({
+								url:'../shop/goodsDetail?id='+item.id
+							})
+						})
+					}
 				}else{
 					uni.navigateTo({
 						url:'../shop/goodsDetail?id='+item.id
 					})
 				}
+				/* if(!this.userInfo){
+					this.authorizShow=true;
+				}else{
+					uni.navigateTo({
+						url:'../shop/goodsDetail?id='+item.id
+					})
+				} */
 			},
 			goJk(item){
-				if(!this.userInfo){
+				/* if(!this.userInfo){
 					this.authorizShow=true;
 				}else{
 					uni.navigateTo({
 						url:'../activity/jkDetail?id='+item.id
 					})
+				} */
+				if(!this.userInfo){
+					if(this.exitNum!=1){
+						this.authorizShow=true;
+					}else{
+						this.$common.automaticlogin().then(val => {
+							this.userInfo=this.$store.state.userInfo;
+							this.wxOpenData=this.$store.state.wxOpenData;
+							this.exitNum=''
+							this.$store.commit('mutationsexitNum', '')
+							uni.navigateTo({
+								url:'../activity/jkDetail?id='+item.id
+							})
+						})
+					}
+				}else{
+					uni.navigateTo({
+						url:'../activity/jkDetail?id='+item.id
+					})
 				}
 				
 			},
 			goRoter(item){
-				console.log(item)
-				if(item.bizType==7){ //7门店列表
+               if(item.bizType==7){ //7门店列表
 					uni.navigateTo({
 						url:'shopList'
 					})
@@ -560,7 +622,28 @@
 						
 					}else 
 				if(!this.userInfo){
-					this.authorizShow=true;
+					if(this.exitNum!=1){
+						this.authorizShow=true;
+					}else{
+						this.$common.automaticlogin().then(val => {
+							this.userInfo=this.$store.state.userInfo;
+							this.wxOpenData=this.$store.state.wxOpenData;
+							this.exitNum=''
+							this.$store.commit('mutationsexitNum', '')
+							this.goRoter2(item)
+						})
+					}
+				}else{
+					this.goRoter2(item)
+				}
+				
+			},
+			goRoter2(item){
+				console.log(item)
+				
+				if(!this.userInfo){
+					//this.authorizShow=true;
+					
 				}else{
 					if(item.bizType==0){
 						if(item.name=='新车'){ //

+ 3 - 1
pages/partner/myQr.vue

@@ -83,7 +83,9 @@
 				    bizType:this.type,
 					openId:this.wxOpenData.openid,
 					unionId:this.ext.unionId,
-					shopId:this.ext.shopId
+					//shopId:this.ext.shopId,
+					shopId:this.wxOpenData.loginInfo.customerInfo.shopID,
+					path:'pages/index/index'
 				}, 'GET').then(res => {
 					uni.hideLoading();
 					this.img = 'data:image/png;base64,'+uni.arrayBufferToBase64(res);

+ 55 - 4
pages/user/user.vue

@@ -360,7 +360,8 @@
 
 		</view>
 		<view class="rowBoxBg">
-			<view class="exit" @click="exit">退出登录</view>
+			<view class="exit2" @click="exit">切换账号</view>
+			<view class="exit" @click="exit2">退出登录</view>
 		</view>
 		
 		<view class="releaseVersion">版本号:{{release_version}}</view>
@@ -424,6 +425,7 @@
 				interval:3000,
 				showSetting:'',
 				f2csystemlist:'',
+				exitNum:'',
 			}
 		},
 		onLoad(opt) {
@@ -474,7 +476,24 @@
 				this.queryMyDetail();
 			} else {
 				//console.log("授权")
-				this.authorizShow = true;
+				this.exitNum=this.$store.state.exitNum;
+				if(this.exitNum!=1){
+					this.authorizShow = true;
+				}else{
+					this.$common.automaticlogin().then(val => {
+						this.userInfo=this.$store.state.userInfo;
+						this.wxOpenData=this.$store.state.wxOpenData;
+						this.exitNum=''
+						this.$store.commit('mutationsexitNum', '')
+						if (this.userInfo) {
+							this.queryMyDetail();
+						}
+						if(!this.userInfo){
+							this.authorizShow=true
+						}
+					})
+				}
+				
 			}
 			if (wxOpenData) {
 
@@ -489,7 +508,7 @@
 				var that=this;
 				uni.showModal({
 				  title: '提示',
-				  content: '是否退出登录',
+				  content: '是否切换账号',
 				  success(res) {
 				    if (res.confirm) {
 						uni.clearStorageSync()
@@ -508,6 +527,27 @@
 				});
 				
 			},
+			exit2(){
+				var that=this;
+				uni.showModal({
+				  title: '提示',
+				  content: '是否退出登录',
+				  success(res) {
+				    if (res.confirm) {
+						uni.clearStorageSync()
+						that.$store.commit('mutationsuserInfo', '')
+						that.$store.commit('mutationscarInfo', '')
+						that.$store.commit('mutationsexitNum', '1')
+						/* uni.reLaunch({
+							 url: '../index/index'
+						}); */
+						  uni.switchTab({
+							 url: '../index/index'
+						 }) 
+				    }
+				  }
+				});
+			},
 			makePhoneCall(tel){
 				uni.makePhoneCall({
 				  phoneNumber: tel,
@@ -797,13 +837,24 @@
 .exit{
 	background: #FFFFFF;
 	line-height: 100rpx;
-	margin-top: 20rpx;
+	
 	font-size: 28rpx;
 	font-family: PingFang;
 	font-weight: 500;
 	color: #ED2323;
 	text-align: center;
 }
+.exit2{
+	background: #FFFFFF;
+	line-height: 100rpx;
+	font-size: 28rpx;
+	font-family: PingFang;
+	font-weight: 500;
+	color: #3C3C3C;
+	text-align: center;
+	border-bottom: 1px solid #eaeaea;
+	margin-top: 20rpx;
+}
 .cardNameIcon{
 	width: 30rpx;height: 30rpx;
 }

+ 10 - 0
store/index.js

@@ -9,6 +9,7 @@ const store = new Vuex.Store({
 		ckshopInfo:'',
 		userInfo:'',
 		wxOpenData:'',
+		exitNum:'',
 	},
 	getters:{
 		getyuyueData(state){
@@ -25,6 +26,9 @@ const store = new Vuex.Store({
 		},
 		getwxOpenData(state){
 			return state.wxOpenData
+		},
+		getexitNum(state){
+			return state.exitNum
 		}
     },
     mutations: {
@@ -43,6 +47,9 @@ const store = new Vuex.Store({
 		mutationswxOpenData(state,data){
 			state.wxOpenData=data
 		},
+		mutationsexitNum(state,data){
+			state.exitNum=data
+		},
 	},
     actions: {
 		actionsyuyueData(context,playload){
@@ -60,6 +67,9 @@ const store = new Vuex.Store({
 		actionswxOpenData(context,playload){
 			context.commit('mutationswxOpenData',playload)
 		},
+		actionsexitNum(context,playload){
+			context.commit('mutationsexitNum',playload)
+		},
 	}
 })
 export default store

+ 1 - 1
utils/common.js

@@ -13,7 +13,7 @@ const automaticlogin = function() {
 	//console.log($store.state.userInfo)
 	var that=this;
 	var extConfig = uni.getExtConfigSync();
-	 /* extConfig={
+	  /* extConfig={
 		"shopId": "23173848-292E-4AEA-B590-73AC9A763F1D",
 		"url":"https://store-api.qdbtl.cn/",
 		"unionId":"C3748B46-B778-40AA-8C60-A9B0F2FA23A7",

+ 3 - 0
utils/request.js

@@ -33,6 +33,9 @@ const http = (url = '', date = {}, type = 'POST', header = {
 		}else if(wxOpenData.loginInfo?.token){
 			header['token']=wxOpenData.loginInfo.token;
 		}
+		if(wxOpenData.loginInfo){
+			header['uid']=wxOpenData.loginInfo.uid; 
+		}
 		//console.log($store.state.carInfo)
 		//header['token']='98A9FED8814B457288166BDF623F33D1';
 		//header['uid']='39415962-C9D3-466D-A73F-5B5429A8DB2A';