123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <view class="user-content">
- <!-- 头部 -->
- <view class="user-head">
- <view class="user-photo">
- <open-data type="userAvatarUrl"></open-data>
- </view>
- <view class="user-info">
- <open-data type="userNickName"></open-data>
- </view>
- </view>
- <!-- 列表 -->
- <view class="user-list">
- <u-cell-group>
- <u-cell-item icon="gift" index="0" @click="toPage" title="我的优惠卷"></u-cell-item>
- <u-cell-item icon="order" index="1" @click="toPage" title="我的订单"></u-cell-item>
- <u-cell-item icon="file-text" index="2" @click="toPage" title="服务协议"></u-cell-item>
- <!-- <u-cell-item icon="info-circle" index="3" @click="toPage" title="关于我们"></u-cell-item> -->
- </u-cell-group>
- </view>
- <!-- 退出 -->
- <view class="user-btn">
- <u-button type="error" @click="quitSys" shape="circle">退出登录</u-button>
- </view>
- </view>
- </template>
- <script>
- import {logout} from '@/api/login.js'
- import {getLookUpDatas} from '@/api/data.js'
- export default {
- data() {
- return {
-
- };
- },
- onShow() {
- },
- onLoad() {
- // 获取订单状态数据字典
- this.getCodeList('ORDER_STATUS')
- // 获取支付方式数据字典
- this.getCodeList('PAY_TYPE')
- },
- methods:{
- // 获取数据字典
- getCodeList (code) {
- getLookUpDatas({type:code}).then(res =>{
- if (res.status == 200) {
- console.log(res.data,'res.data')
- if (code == 'ORDER_STATUS') {
- this.$u.vuex('vuex_payStatus', res.data)
- } else {
- this.$u.vuex('vuex_payType', res.data)
- }
- }
- })
- },
- // 打开对应的页面
- toPage(index){
- let pageUrl=['/pages/coupon/index/index','/pages/order/order','/pages/agreement/agreement?fromPage=usercenter']
- uni.navigateTo({
- url: pageUrl[index]
- })
- },
- // 退出登录
- quitSys(){
- let _this = this
- uni.showModal({
- title: '提示',
- content: '您确定要退出登录吗?',
- success(res) {
- if (res.confirm) {
- logout({}).then(res => {
- getApp().globalData.token = ''
- _this.$u.vuex('vuex_token','')
- uni.reLaunch({
- url: '/pages/index/index'
- });
- });
- }
- }
- });
- },
- bindGetUserInfo(res){
- console.log(res)
- },
- }
- }
- </script>
- <style lang="scss">
- .user-content{
- width: 100%;
- .user-head{
- display: flex;
- align-items: center;
- padding: 35rpx;
- .user-info{
- flex-grow: 1;
- padding: 0 20rpx;
- }
- .user-photo{
- width: 100rpx;
- height: 100rpx;
- border-radius: 50%;
- overflow: hidden;
- margin-right: 30rpx;
- }
- }
-
- .user-list{
- padding:0 20rpx;
- }
- .user-btn{
- padding: 85rpx 100rpx;
- }
- }
- </style>
|