setUp.vue 5.8 KB
<template>
	<view class="page">
		<view class="box">
			<view class="item" @click="person" data-id="1">
				<view class="left">个人资料</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
			<view class="item" @click="person" data-id="2">
				<view class="left">销售管理</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
			<view class="item" @click="person" data-id="3">
				<view class="left">地址管理</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
			<!-- <view class="item" @click="person" data-id="4">
				<view class="left">使用规范</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view> -->
			<!-- <view class="item" @click="person" data-id="5">
				<view class="left">APP详情</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view> -->
			<view class="item" @click="register">
				<view class="left">绑定手机</view>
				<view class="right">{{mobile}}
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
			<view class="item" >
				<view class="left">邀请人</view>
				<view class="right" v-if="parent_id==null" @click="yaoqing">去绑定
					<image src="../../static/right.png" mode="widthFix" />
				</view >
				<view class="right" v-else>已绑定
					<!-- <image src="../../static/right.png" mode="widthFix" /> -->
				</view>
			</view>
			<view class="item" @click="getinfo">
				<view class="left">版本信息</view>
				<view class="right">{{version}}
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
		</view>
		<view class="btn" @click="quit">退出登录</view>
	</view>
</template>

<script>
	import app from "../../App.vue";
	export default {
		data() {
			return {
				avatar:'',
				nickname:'',
				mobile:'',
				version:'',
				parent_id:""
			}
		},
		onLoad(options) {
			console.log('344848',options)
			this.avatar=options.avatar;
			this.nickname=options.nickname;
			this.mobile=options.mobile;
			
			console.log(this.parent_id)
		},
		methods: {
			// 获取用户信息
			getuserinfo() {
				let that = this;
				var url = 'member/index';
				var params = {
			
				}
				console.log('7766554', params)
				app.post(url, params).then((res) => {
					console.log(res);
					
					that.parent_id=res.data.data.parent_id;
					
				}).catch((err) => {
					
					
					console.log(err)
					if(err.msg="用户未登录"){
						that.isuser=1
					}
					
					console.log('我是userusesue',that.isuser)
						
			
				})
			},
			// 个人资料
			person(e) {
				let id=e.currentTarget.dataset.id;
				if(id==1){
					uni.navigateTo({
						url: '/pages/usercenter/personalData?avatar='+this.avatar+'&nickname='+this.nickname
					})
				}else if(id==2){
					uni.navigateTo({
						url: '/pages/usercenter/sales'
					})
				}else if(id==3){
					uni.navigateTo({
						url: '/pages/usercenter/address'
					})
				}else if(id==4){
					// uni.navigateTo({
					// 	url: '/pages/usercenter/address'
					// })
				}
			},
			// 退出登录
			quit(){
				uni.clearStorageSync()
				uni.setStorageSync("token","");
				uni.reLaunch({
					url:'/pages/login/loginindex'
				})
			},
			// 注册、
			register(){
				uni.navigateTo({
					url:'/pages/usercenter/bindphone'
				})
			},
			// 获取版本信息
			getversioninfo() {
				let that=this;
				uni.getSystemInfo({
					success: function(res) {
						console.log('版本基本信息', res)
						console.log(res.model);
						console.log(res.pixelRatio);
						console.log(res.windowWidth);
						console.log(res.windowHeight);
						console.log(res.language);
						console.log(res.version);
						console.log(res.SDKVersion);
						that.version=res.version
					}
				});
			},
			// 绑定邀请人
			yaoqing(){
				uni.navigateTo({
					url:"/pages/usercenter/yaoqing"
				})
			},
			// 获取版本信息
			getinfo(){
				let that = this;
				var url = 'order/confirm_order';
				var params = {
					province_id:that.province_id,
					keyword: that.keyword,
					order: that.order,
					page: that.page,
					pageNum: 10
				}
				console.log('参数', params)
				app.post(url, params, "post").then((res) => {
					console.log(res);
					that.shoplist = that.shoplist.concat(res.data.data)
				}).catch((err) => {
					console.log(err)
				
				})
			}
			
			
			
		},
		onShow() {
			let that=this;
			console.log(3234344398)
			 uni.$once('phone',function(data){
				 console.log(data)
			        that.mobile=data
			    })
				that.getversioninfo()
				// 获取用户信息
				that.getuserinfo()
		}
	}
</script>

<style>
	page {
		background: #F7F7F7;

	}

	.box {
		padding: 0 32rpx;
		box-sizing: border-box;
		background: #fff;
	}

	.item {
		height: 108rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 1px solid #EDEDED;

	}

	.left {
		width: calc(100% -220rpx);
		display: flex;
		align-items: center;
		font-size: 28rpx;
		font-family: PingFangHK-Regular, PingFangHK;
		font-weight: 400;
		color: rgba(8, 18, 31, 1);
	}

	.right {
		width: 220rpx;
		font-size: 28rpx;
		font-family: PingFangHK-Regular, PingFangHK;
		font-weight: 400;
		color: rgba(61, 69, 76, 1);
		display: flex;
		align-items: center;
		justify-content: flex-end;
	}

	.right image {
		width: 32rpx;
		margin-left: 16rpx;
	}

	.btn {
		width: 686rpx;
		height: 84rpx;
		background: rgba(194, 148, 69, 1);
		border-radius: 8rpx;
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: rgba(255, 255, 255, 1);
		display: flex;
		justify-content: center;
		align-items: center;
		margin: 100rpx auto;
	}
</style>