<template>
	<view>
		<u-navbar title="设置"></u-navbar>
		<u-cell-group>
			<u-cell-item title="修改手机号" v-model="userPhone" @click="gotoUrl('pages/user/phone')"></u-cell-item>
			<u-cell-item title="注销账号" value="注销后无法恢复，请谨慎操作" :value-style="valueStyle" @click="gotoUrl('pages/user/logout')"></u-cell-item>
		</u-cell-group>
		<view class="logout-btn" @click="signOut">
			退出帐号
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userId: '',
				userPhone: '',
				valueStyle: {
					color:'#ff3300',
				}
			}
		},
		onReady() {
			if(this.carhelp.getPersonInfo() != null) {
				this.userId = this.carhelp.getPersonInfo().id;
				
				var phone = this.carhelp.getPersonInfo().phone;
				var phone1 = phone.slice(0,3);
				var phone2 = phone.slice(-4);
				this.userPhone = phone1 + '****' + phone2;
			}
		},
		methods: {
			signOut() {
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.logout-btn{
		background-color: #fff;
		padding: 12px 0;
		text-align: center;
		margin-top: 12px;
	}
</style>
