setUp.vue 6.4 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="changemima" >
				<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="xieyi" data-type="1">
				<view class="left">用户协议</view>
				<view class="right">
					<image src="../../static/right.png" mode="widthFix" />
				</view>
			</view>
			<view class="item" @click="xieyi" data-type="2">
				<view class="left">隐私政策</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:"",
				address:''
			}
		},
		onLoad(options) {
			console.log('344848',options)
			this.avatar=options.avatar;
			this.nickname=options.nickname;
			this.mobile=options.mobile;
			this.address=options.address
			
			console.log(this.parent_id)
		},
		methods: {
			changemima(){
				uni.navigateTo({
					url: '/pages/login/forgetmima'
				})
			},
			// 获取用户信息
			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+"&address="+this.address
					})
				}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=app.globalData.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)
				
				})
			},
			// 用户协议和隐私政策
			xieyi(e){
				let type = e.currentTarget.dataset.type;
				if (type == 1) {
					uni.navigateTo({
						url: '/pages/login/xieyi?type=' + type
					})
				} else {
					uni.navigateTo({
						url: '/pages/login/xieyi?type=' + type
					})
				}
			}
			
			
			
		},
		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>