You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
4.9 KiB
Vue

<template>
<view class="myset">
<view class="myset_header">
<image src="../../../static/image/member_card.jpg" mode=""></image>
</view>
<view class="myset_main">
<view class="myset_main_up">
<navigator url="./common/message/message">
<view class="text_icon cuIcon-profile text-red"></view>
我的信息
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<view class="hr"></view>
<!-- <navigator v-show="userInfo.grade==1" url="./common/cost/cost">
<view class="text_icon cuIcon-form text-cyan"></view>
成本列表
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<view class="hr"></view> -->
<navigator v-if="userInfo.user==0" url="./common/my-card/my-card">
<view class="text_icon cuIcon-card text-orange"></view>
我的卡包
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<view v-if="userInfo.user==0" class="hr"></view>
<navigator v-if="userInfo.user==0" url="./common/expense/expense">
<view class="text_icon cuIcon-font text-olive"></view>
评价记录
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<view v-if="userInfo.user==0" class="hr"></view>
<navigator v-if="userInfo.user==0" url="./common/expense-record/expense-record">
<view class="text_icon cuIcon-font text-olive"></view>
消费记录
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<navigator url="./common/salary/salary">
<view class="text_icon cuIcon-card text-orange"></view>
我的工资
<view class="text_icon_right cuIcon-right"> </view>
</navigator>
<view class="hr"></view>
<navigator url="./common/change-password/change-password">
<view class="text_icon cuIcon-edit text-grayC"></view>
修改密码
<view class="text_icon_right cuIcon-right text-black"> </view>
</navigator>
<view class="hr"></view>
</view>
</view>
<button @click="loginout" size="default" class="myset_footer cu-btn bg-red lg">退出当前账号</button>
<!-- <tabBar :pagePath="'/pages/tabBar/home/home'"></tabBar> -->
</view>
</template>
<script>
export default {
data() {
return {
userInfo: null,
}
},
onPullDownRefresh: function() {
setTimeout(function() {
uni.switchTab({
url: './mySet'
})
uni.showToast({
title: '刷新成功',
icon: 'success',
duration: 2000
});
uni.stopPullDownRefresh();
}, 500);
},
methods: {
loginout() {
var mobilePhone = {
mobilePhone: this.userInfo.mobilePhone * 1
}
if (this.userInfo.user == 0) {
this.$api.memberlogoutn(mobilePhone).then(res => {
if (res.code == '000000') {
uni.showToast({
title: '已退出登录',
icon: "none",
duration: 1000
})
uni.reLaunch({
url: '../../login/login'
});
}
})
} else {
this.$api.stafflogout(mobilePhone).then(res => {
if (res.code == '000000') {
uni.showToast({
title: '已退出登录',
icon: "none",
duration: 1000
})
uni.reLaunch({
url: '../../login/login?key=1'
});
uni.removeStorageSync('userInfo')
} else {
uni.showToast({
title: res.message,
icon: 'error',
duration: 2000
})
}
})
}
}
},
onShow: function() {
uni.stopPullDownRefresh();
var token = uni.getStorageSync('userInfo').token
this.userInfo = uni.getStorageSync('userInfo')
this.$api.storelist({
id: ''
}).then(res => {
//console.log(res);
if (res.code == '510002') {
uni.showToast({
title: '登录已过期',
icon: "none",
duration: 1000
})
uni.reLaunch({
url: '../../login/login'
})
} else if (res.code == '502001') {
uni.showToast({
title: '未登录',
icon: "none",
duration: 1000
})
uni.reLaunch({
url: '../../login/login'
})
} else {
//console.log('已登录');
}
})
}
}
</script>
<style>
.myset {
background-color: #F1F1F1;
}
.myset .myset_header {
height: 35vh;
padding: 0 atuo;
overflow: hidden;
margin-bottom: 20upx;
}
.myset .myset_header>image {
width: 94%;
margin: 20upx 3%;
border-radius: 20upx;
font-size: 36upx;
}
.myset .myset_main {
background-color: #FFFFFF;
width: 94%;
border: #d0e3da 1upx solid;
margin: 0 3%;
border-radius: 15upx;
}
.myset .myset_main_up>navigator {
padding: 30upx 10upx;
}
.myset_main .myset_main_up {
border-radius: 5upx;
}
.myset_main_up .text_icon {
float: left;
margin-left: 30upx;
font-size: 36upx;
}
.myset_main_up .text_icon_right {
float: right;
margin-right: 30upx;
font-size: 36upx;
}
.myset .hr {
height: 2upx;
background-color: #aab5d9;
}
.myset .myset_footer {
width: 95%;
position: absolute;
bottom: 30upx;
font-size: 30upx;
margin: 0 3%;
}
</style>