Sfoglia il codice sorgente

优化分享登录

zhengjinyi 4 anni fa
parent
commit
34cb6884a3

+ 1 - 2
components/cm-module/listTemplate/commodityList.vue

@@ -104,7 +104,7 @@
 			}
 		},
 		created() {		
-			console.log(this.typeId)
+			// console.log(this.typeId)
 			this.setScrollHeight();		
 			this.$api.getComStorage('userInfo').then((resolve) =>{
 				this.clubStatus = resolve.clubStatus
@@ -165,7 +165,6 @@
 							this.setProductPrice()
 							this.showSkeleton = false
 						}
-						console.log(this.listData)
 						// 防上拉暴滑
 						this.pullFlag = false;
 						setTimeout(()=>{ this.pullFlag = true; },500)

+ 3 - 2
h5/pages/activity/activity_mid.vue

@@ -41,7 +41,7 @@
 										<text class="none">¥<text>???</text></text>
 									</view>
 									<view class="price-right">
-										<view class="login-btn" @click.stop="this.$api.navigateTo(`/pages/login/apply?clubStatus=${clubStatus}`)">去升级</view>
+										<view class="login-btn btn-upgrade" @click.stop="this.$api.navigateTo(`/pages/login/apply?clubStatus=${clubStatus}`)">去升级</view>
 									</view>
 								</view>
 							</template>
@@ -59,7 +59,7 @@
 									<text class="none">¥<text>???</text></text>
 								</view>
 								<view class="price-right">
-									<view class="login-btn" @click.stop="navigator()">登录</view>
+									<view class="login-btn" @click.stop="navigator">登录</view>
 								</view>
 							</view>
 						</template>
@@ -172,6 +172,7 @@
 			navigator(){
 				authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
 					if(wxResponse == 1){
+						this.$store.commit('setLoginType',9)
 						this.$api.navigateTo('/pages/login/login?type=0')
 					}else{
 						this.$api.navigateTo('/pages/authorization/authorization?type=1')

+ 5 - 0
pages.json

@@ -211,6 +211,11 @@
 			"style": {
 				"navigationBarTitleText": "入驻咨询"
 			}
+		},{
+			"path": "pages/login/loginshare",
+			"style": {
+				"navigationBarTitleText": "查看订单"
+			}
 		},{
 			"path": "pages/login/apply",
 			"style": {

+ 3 - 1
pages/goods/product.vue

@@ -508,7 +508,9 @@
 			navToLogin(){
 				authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
 					if(wxResponse == 1){
-						this.$api.navigateTo(`/pages/login/login?type=detilType&id=${this.productID}`)
+						this.$store.commit('setLoginType',8)
+						this.$store.commit('setLoginProductId',this.productID)
+						this.$api.navigateTo(`/pages/login/login?id=${this.productID}`)
 					}else{
 						this.$api.navigateTo('/pages/authorization/authorization?type=1')
 					}

+ 19 - 1
pages/login/bindwechat.vue

@@ -92,6 +92,9 @@
 		onLoad(option) {
 			this.getVerificationCode()
 		},
+		computed: {
+			...mapState(['isWxAuthorize','isLoginType','isLoginProductId','isLoginOrderId'])
+		},
 		methods:{
 			...mapMutations(['login']),
 			bindWechatInfo(){
@@ -182,7 +185,22 @@
 						}
 						// console.log(params)
 						bindingWechat(params).then(response =>{
-							this.$api.switchTabTo('/pages/tabBar/user/user')
+							console.log(this.isLoginType)
+							console.log(this.isLoginProductId)
+							console.log(this.isLoginOrderId)
+							switch(this.isLoginType){
+								case 9:
+									this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
+									break;
+								case 8:
+									this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
+									break;
+								case 7:
+									this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.isLoginOrderId}`)
+									break;
+								default:
+									this.$api.switchTabTo('/pages/tabBar/user/user')
+							}
 						}).catch(error =>{
 							this.$util.msg(error.msg,2000)
 						})							

+ 2 - 1
pages/login/login.vue

@@ -57,7 +57,7 @@
 			this.getOption = JSON.stringify(option)
 		},
 		computed: {
-			...mapState(['hasLogin','userInfo','isWxAuthorize'])
+			...mapState(['hasLogin','isWxAuthorize','isLoginType'])
 		},
 		methods:{
 			...mapMutations(['login']),
@@ -99,6 +99,7 @@
 			authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
 				if(wxResponse == 1){
 					wxLogin.wxLoginQuick()
+					console.log(this.isLoginType)
 				}else{
 					this.$api.navigateTo('/pages/authorization/authorization?type=0')
 				}	

+ 10 - 1
pages/login/logincode.vue

@@ -50,7 +50,16 @@
 						}							
 						invitationCodeLogin(params).then(response =>{
 							this.login(response.data)
-							this.$api.switchTabTo('/pages/tabBar/home/home')
+							switch(this.isLoginType){
+								case 9:
+									this.$api.navigateTo(`/h5/pages/activity/activity_mid`)
+									break;
+								case 8:
+									this.$api.navigateTo(`/pages/goods/product?id=${this.isLoginProductId}`)
+									break;
+								default:
+									this.$api.switchTabTo('/pages/tabBar/user/user')
+							}
 						}).catch(error =>{
 							this.$util.msg(error.msg,2000)
 							this.isUserInfo = false

+ 260 - 0
pages/login/loginshare.vue

@@ -0,0 +1,260 @@
+<template>
+	<view class="container login" v-if="isShareStatus">
+		<view class="container-main clearfix">
+			<view class="main-title">此订单包含如下商品:</view>
+			<view class="main-list clearfix">
+				<view class="main-list-item" v-for="(item, index) in productList" :key="index">
+					<view class="item-image">
+						<image :src="item.mainImage" mode="widthFix"></image>
+					</view>
+					<view class="item-mesage">
+						<view class="item-name">{{item.name}}</view>
+						<view class="item-num"><text>X</text>{{item.num}}</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="container-footer">
+			<view class="login-btn" @click.stop="goLogin(1)">账号登录查看</view>
+			<view class="login-btn" @click.stop="goLogin(2)">使用分享码查看</view>
+			<view class="pay-statustext">
+				<view class="pay-statustext-inner">
+					<view class="pay-icon">
+						<text class="iconfont icon-gantanhao-yuankuang"></text>
+					</view>
+					<view class="pay-text">
+						<text>使用账号登录支持确认订单和直接付款,使用分享码只支持查看订单,不能操作</text>
+					</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import authorize from '@/common/config/authorize.js' 
+	import { orderShareCode } from "@/api/order.js" 
+	export default{
+		data() {
+			return{
+				imagePath:'https://img.caimei365.com/group1/M00/03/83/Cmis214FbbCAQhKoAAKWfqqSIds292.png',
+				shareCode:'',  		//获取用户登录的邀请码
+				isUserInfo:false,	//控制显示授权弹窗
+				nickName:'',		//存储用户名
+				userInfo:'',		//存储微信用户授权信息
+				orderID:0,			//订单ID
+				userID:0,			//分享人的用户ID
+				isShareStatus:false,
+				serviceProviderId:'',
+				productList:[
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+					{mainImage:'https://img.caimei365.com/group1/M00/03/95/Cmis2F778GGALIeNAAGtOmuO4Sk263.jpg',name:'元泰Picocare皮秒激光美容仪皮秒激光调Q激光色素治疗养肤换肤祛除彩色纹身',num:1},
+				]
+			}
+		},
+		onLoad(e) {
+			console.log(e)
+			this.orderID = e.orderID
+			this.userID = e.userID
+			if(e.serviceProviderId){
+				this.serviceProviderId = e.serviceProviderId
+			}
+		},
+		methods:{
+			initQueryUser(){
+				authorize.getCode('weixin').then(wechatcode =>{
+					let params ={
+							code:wechatcode,
+							orderID:this.orderID,
+							userID:this.userID,
+							shareCode:this.shareCode,
+							serviceProviderId:this.serviceProviderId
+						}
+					orderShareCode(params).then(response =>{
+						console.log(response.code)
+						if(response.code === 2){
+							this.$api.navigateTo(`/seller/pages/order/order-details?type=share&orderID=${this.orderID}`)
+						}else if(response.code === 0) {
+							console.log(response.data)
+							if(response.data == true){//同为会所运营人员查看订单详情
+								this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.orderID}`)
+							}else{//游客第二次查看订单详情
+								this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderID=${this.orderID}`)
+							}
+						}else if(response.code === -2){
+							this.$util.modal('提示',response.msg,'确定','',false,() =>{})
+						}else{
+							this.isShareStatus = true
+						}
+					})
+				})
+			},
+			goLogin(index){
+				switch(index){
+					case 1:
+						this.$store.commit('setLoginType',7)
+						this.$store.commit('setLoginOrderId',this.orderID)
+						this.$api.navigateTo('/pages/login/login')
+						break;
+					case 2:
+						this.$api.navigateTo(`/pages/user/order/orderShareLogin?orderID=${this.orderID}&userID=${this.userID}`)
+						break;
+				}
+			}
+		},
+		onShow() {
+			this.initQueryUser()
+		}
+	}
+</script>
+
+<style lang="scss">
+	.login{
+		width: 100%;
+		height:auto;
+		background: #F7F7F7;
+		.model-warp.none{
+			display: none;			
+		}
+		.model-warp.show{
+			display: block;
+		}
+		.container-main{
+			width: 100%;
+			height: auto;
+			padding-top:80rpx ;
+			padding-bottom: 352rpx;
+			.main-title{
+				width: 100%;
+				height: 80rpx;
+				padding: 0 20rpx;
+				background-color: #F7F7F7;
+				line-height: 80rpx;
+				text-align: left;
+				font-size: $font-size-30;
+				color: #333;
+				box-sizing: border-box;
+				position: fixed;
+				top: 0;
+				left: 0;
+			}
+			.main-list{
+				box-sizing: border-box;
+				width: 100%;
+				height: auto;
+				background-color: #FFFFFF;
+				.main-list-item{
+					box-sizing: border-box;
+					width: 100%;
+					height: 200rpx;
+					padding: 20rpx;
+					border-bottom: 1px solid #F7F7F7;
+					.item-image{
+						width: 160rpx;
+						height: 160rpx;
+						float: left;
+						image{
+							width: 160rpx;
+							height: 160rpx;
+							display: block;
+						}
+					}
+					.item-mesage{
+						width: 530rpx;
+						height: 160rpx;
+						float: left;
+						margin-left: 20rpx;
+						.item-name{
+							width: 100%;
+							height:84rpx;
+							line-height: 42rpx;
+							font-size: $font-size-28;
+							color: #333333;
+							text-align: justify;
+							text-overflow:ellipsis;
+							display: -webkit-box;
+							word-break: break-all;
+							-webkit-box-orient: vertical;
+							-webkit-line-clamp: 2;
+							overflow: hidden;
+						}
+						.item-num{
+							width: 100%;
+							height:46rpx;
+							line-height: 46rpx;
+							margin-top: 30rpx;
+							font-size: $font-size-28;
+							color: #333333;
+							text-align: left;
+							text{
+								font-size: $font-size-20;
+							}
+						}
+					}
+				}
+			}
+		}
+		.login-btn{
+			width: 702rpx;
+			height: 88rpx;
+			font-size: $font-size-28;
+			line-height: 88rpx;
+			color: #FFFFFF;
+			margin: 0 auto;
+			margin-bottom: 24rpx;
+			text-align: center;
+			background: $btn-confirm;
+			border-radius: 14rpx;
+		}
+		.container-footer{
+			box-sizing: border-box;
+			width: 100%;
+			height: 352rpx;
+			padding: 0 24rpx;
+			padding-top: 24rpx;
+			padding-bottom: 24rpx;
+			background-color: #FFFFFF;
+			position: fixed;
+			bottom: 0;
+			left: 0;
+		}
+		.pay-statustext{
+			width: 100%;
+			height: auto;
+			float: left;
+			.pay-statustext-inner{
+				width: 100%;
+				margin: 0 auto;
+				.pay-icon{
+					width: 62rpx;
+					height: 100%;
+					float: left;
+					text-align: center;
+					.iconfont{
+						color: $color-system;
+						font-size:$font-size-36;
+						line-height: 20rpx;
+					}
+				}
+				.pay-text{
+					width: 635rpx;
+					height: 100%;
+					float: left;
+					line-height: 40rpx;
+					font-size: $font-size-26;
+					color: $color-system;
+					text-align: justify;
+				}
+			}
+		}
+	}
+</style>

+ 5 - 5
pages/tabBar/user/user.vue

@@ -42,7 +42,7 @@
 						<view class="order-item" @click="navigator('/pages/user/order/order-list?state=1')" hover-class="common-hover"  :hover-stay-time="50">
 							<view class="order-icon">
 								<image src="../../../static/temp/order5@3x.png" mode=""></image>
-								<text 	v-if="confirmedCount>0" 
+								<text 	v-if="confirmedCount>0 && hasLogin" 
 										class="uni-badge uni-badge-error uni-small uni-badge--small icon-num" 
 										:class="[confirmedCount < 10 ? 'goleft':'']">
 										{{confirmedCount == 99? '99+' : confirmedCount}}
@@ -53,7 +53,7 @@
 						<view class="order-item" @click="navigator('/pages/user/order/order-list?state=2')"  hover-class="common-hover" :hover-stay-time="50">
 							<view class="order-icon">
 								<image src="../../../static/temp/order1@3x.png" mode=""></image>
-								<text  v-if="paymentCount >0" 
+								<text  v-if="paymentCount >0 && hasLogin" 
 									   class="uni-badge uni-badge-error uni-small uni-badge--small icon-num " 
 									   :class="[paymentCount < 10 ? 'goleft':'']">
 									   {{paymentCount == 99? '99+' : paymentCount}}
@@ -64,7 +64,7 @@
 						<view class="order-item" @click="navigator('/pages/user/order/order-list?state=3')" hover-class="common-hover"  :hover-stay-time="50">
 							<view class="order-icon">
 								<image src="../../../static/temp/order2@3x.png" mode=""></image>
-								<text   v-if="waitShipmentsCount >0" 
+								<text   v-if="waitShipmentsCount >0 && hasLogin" 
 										class="uni-badge uni-badge-error uni-small uni-badge--small icon-num" 
 										:class="[waitShipmentsCount < 10 ? 'goleft':'']">
 										{{waitShipmentsCount == 99? '99+' : waitShipmentsCount}}
@@ -75,7 +75,7 @@
 						<view class="order-item" @click="navigator('/pages/user/order/order-list?state=4')" hover-class="common-hover"  :hover-stay-time="50">
 							<view class="order-icon">
 								<image src="../../../static/temp/order3@3x.png" mode=""></image>
-								<text 	v-if="shipmentsCount>0" 
+								<text 	v-if="shipmentsCount>0 && hasLogin" 
 										class="uni-badge uni-badge-error uni-small uni-badge--small icon-num" 
 										:class="[shipmentsCount < 10 ? 'goleft':'']">
 										{{shipmentsCount == 99? '99+' : shipmentsCount}}
@@ -86,7 +86,7 @@
 						<view class="order-item" @click="navigator('/pages/user/order/order-list?state=5')" hover-class="common-hover"  :hover-stay-time="50">
 							<view class="order-icon">
 								<image src="../../../static/temp/order4@3x.png" mode=""></image>
-								<text 	v-if="salesReturnCount >0"
+								<text 	v-if="salesReturnCount >0 && hasLogin"
 										class="uni-badge uni-badge-error uni-small uni-badge--small icon-num" 
 										:class="[salesReturnCount < 10 ? 'goleft':'']">
 										{{salesReturnCount == 99? '99+' : salesReturnCount}}

+ 2 - 34
pages/user/order/orderShareLogin.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="container login" v-if="isShareStatus">
+	<view class="container login">
 		<view class="login-main">
 			<image class="logo" :src="imagePath" mode=""></image>
 		</view>
@@ -28,46 +28,14 @@
 				orderID:0,			//订单ID
 				userID:0			,//分享人的用户ID
 				isShareStatus:false,
-				serviceProviderId:''
 			}
 		},
 		onLoad(e) {
 			console.log(e)
 			this.orderID = e.orderID
 			this.userID = e.userID
-			if(e.serviceProviderId){
-				this.serviceProviderId = e.serviceProviderId
-			}
 		},
 		methods:{
-			initQueryUser(){
-				authorize.getCode('weixin').then(wechatcode =>{
-					let params ={
-							code:wechatcode,
-							orderID:this.orderID,
-							userID:this.userID,
-							shareCode:this.shareCode,
-							serviceProviderId:this.serviceProviderId
-						}
-					orderShareCode(params).then(response =>{
-						console.log(response.code)
-						if(response.code === 2){
-							this.$api.navigateTo(`/seller/pages/order/order-details?type=share&orderID=${this.orderID}`)
-						}else if(response.code === 0) {
-							console.log(response.data)
-							if(response.data == true){//同为会所运营人员查看订单详情
-								this.$api.navigateTo(`/pages/user/order/order-details?type=share&orderID=${this.orderID}`)
-							}else{//游客第二次查看订单详情
-								this.$api.redirectTo(`/pages/user/order/order-sharedetails?orderID=${this.orderID}`)
-							}
-						}else if(response.code === -2){
-							this.$util.modal('提示',response.msg,'确定','',false,() =>{})
-						}else{
-							this.isShareStatus = true
-						}
-					})
-				})
-			},
 			goLogin() {
 				if(this.shareCode == ''){
 					this.$util.msg('请联系分享人获取分享码',2000);
@@ -95,7 +63,7 @@
 			},
 		},
 		onShow() {
-			this.initQueryUser()
+			
 		}
 	}
 </script>

+ 21 - 2
store/index.js

@@ -13,6 +13,8 @@ const store = new Vuex.Store({
 		cartNumber:0,
 		isIphoneX:false,
 		isActivity:false,
+		isLoginType:0,
+		isLoginProductId:0
 	},
 	mutations: {
 		login(state, provider) {
@@ -74,11 +76,25 @@ const store = new Vuex.Store({
 		setChangeVar(state,variable){
 			//获取设备信息是否为IphoneX
 			state.isIphoneX = variable;
-			console.log(state.isIphoneX);
 		},
 		setIsIphone(state,variable){
 			//获取设备信息是否为IphoneX
 			state.isIphone = variable;
+		},
+		setLoginType(state,variable){
+			//获取设备信息是否为IphoneX
+			state.isLoginType = variable;
+			console.log(state.isLoginType);
+		},
+		setLoginProductId(state,variable){
+			//获取设备信息是否为IphoneX
+			state.isLoginProductId = variable;
+			console.log(state.isLoginProductId);
+		},
+		setLoginOrderId(state,variable){
+			//获取设备信息是否为IphoneX
+			state.isLoginOrderId = variable;
+			console.log(state.isLoginOrderId);
 		}
 	},
 	actions:{
@@ -90,7 +106,10 @@ const store = new Vuex.Store({
 		},
 		setActivityFn:function(context,vData){
 			context.commit('setActivity',vData)
-		}
+		},
+		// setLoginTypeFn:function(context,vData){
+		// 	context.commit('setLoginType',vData)
+		// }
 	}
 })