profile.vue 12.9 KB
Newer Older
M
maguohua 已提交
1
<template>
M
maguohua 已提交
2
    <div class="profile_page">
M
maguohua 已提交
3 4
        <head-top go-back='true' :head-title="profiletitle"></head-top>
        <section class="profile-number">
M
maguohua 已提交
5
            <router-link :to="getUserinfo? '/profile/info' : '/login'" class="profile-link">
M
profile  
maguohua 已提交
6 7
                <img :src="getImgPath(this.avatar)" class="privateImage" v-if="this.avatar">
                <span class="privateImage" v-else>
M
maguohua 已提交
8 9 10 11 12
                    <svg class="privateImage-svg">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#avatar-default"></use>
                    </svg>
                </span>
                <div class="user-info">
M
profile  
maguohua 已提交
13
                    <p>{{username}}</p>
M
maguohua 已提交
14 15 16 17 18 19
                    <p>
                        <span class="user-icon">
                            <svg class="icon-mobile" fill="#fff">
                                <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#mobile"></use>
                            </svg>
                        </span>
M
profile  
maguohua 已提交
20
                        <span class="icon-mobile-number">{{mobile}}</span>
M
maguohua 已提交
21 22 23 24 25 26 27 28 29 30 31 32
                    </p>
                </div>
                <span class="arrow">
                    <svg class="arrow-svg" fill="#fff">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                    </svg>
                </span>
            </router-link>
        </section>
        <section class="info-data">
            <ul class="clear">
                <router-link to="/profile/balance" tag="li" class="info-data-link">
M
profile  
maguohua 已提交
33
                    <span class="info-data-top"><b>{{balance}}</b></span>
M
maguohua 已提交
34 35 36
                    <span class="info-data-bottom">我的余额</span>
                </router-link>
                <router-link to="/profile/benefit" tag="li" class="info-data-link">
M
profile  
maguohua 已提交
37
                    <span class="info-data-top"><b>{{count}}</b></span>
M
maguohua 已提交
38 39 40
                    <span class="info-data-bottom">我的优惠</span>
                </router-link>
                <router-link to="/profile/points" tag="li" class="info-data-link">
M
profile  
maguohua 已提交
41
                    <span class="info-data-top"><b>{{pointNumber}}</b></span>
M
maguohua 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
                    <span class="info-data-bottom">我的积分</span>
                </router-link>
            </ul>
        </section>
        <section class="profile-1reTe">
            <!-- 我的订单 -->
            <router-link to='/order' class="myorder">
                <aside>
                    <svg fill="#4aa5f0">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#order"></use>
                    </svg>
                </aside>
                <div class="myorder-div">
                    <span>我的订单</span>
                    <span class="myorder-divsvg">
                        <svg fill="#bbb">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                        </svg>
                    </span>
                </div>
            </router-link>
            <!-- 积分商城 -->
            <router-link to='/order' class="myorder">
                <aside>
                    <svg fill="#fc7b53">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#point"></use>
                    </svg>
                </aside>
                <div class="myorder-div">
                    <span>积分商城</span>
                    <span class="myorder-divsvg">
                        <svg fill="#bbb">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                        </svg>
                    </span>
                </div>
            </router-link>
            <!-- 饿了么会员卡 -->
            <router-link to='/vipcard' class="myorder">
                <aside>
                    <svg fill="#ffc636">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#vip"></use>
                    </svg>
                </aside>
                <div class="myorder-div">
                    <span>饿了么会员卡</span>
                    <span class="myorder-divsvg">
                        <svg fill="#bbb">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                        </svg>
                    </span>
                </div>
            </router-link>
        </section>
        <section class="profile-1reTe">
            <!-- 服务中心 -->
M
profile  
maguohua 已提交
98
            <router-link to='/service' class="myorder">
M
maguohua 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
                <aside>
                    <svg fill="#4aa5f0">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#service"></use>
                    </svg>
                </aside>
                <div class="myorder-div">
                    <span>服务中心</span>
                    <span class="myorder-divsvg">
                        <svg fill="#bbb">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                        </svg>
                    </span>
                </div>
            </router-link>
            <!-- 下载饿了么APP -->
            <router-link to='/profile/service' class="myorder">
                <aside>
                    <svg fill="#3cabff">
                        <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#download"></use>
                    </svg>
                </aside>
                <div class="myorder-div" style="border-bottom:0;">
                    <span>下载饿了么APP</span>
                    <span class="myorder-divsvg">
                        <svg fill="#bbb">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#arrow-right"></use>
                        </svg>
                    </span>
                </div>
            </router-link>
        </section>
M
maguohua 已提交
130
        <foot-guide></foot-guide>
M
maguohua 已提交
131 132 133 134 135 136 137 138
        <transition name="router-slid">
            <router-view></router-view>
        </transition>
    </div>
</template>

<script>
import headTop from '../../components/header/head'
M
maguohua 已提交
139
import footGuide from '../../components/footer/footGuide'
M
maguohua 已提交
140
import {mapState} from 'vuex'
M
profile  
maguohua 已提交
141
import {getImgPath} from '../../components/common/mixin'
M
maguohua 已提交
142 143 144 145 146

export default {
    data(){
        return{
            profiletitle: '我的',
M
profile  
maguohua 已提交
147
            getUserinfo: {},        //得到数据 
M
maguohua 已提交
148 149 150 151 152
            username: '登陆/注册',           //用户名
            mobile: '登陆后享受更多特权',             //电话号码
            balance: '0',            //我的余额
            count : '0',             //优惠券个数
            pointNumber : '0',       //积分数
M
profile  
maguohua 已提交
153
            avatar: '',             //头像地址
M
maguohua 已提交
154 155 156 157
        }
    },

    mounted(){
M
profile  
maguohua 已提交
158
        this.getUserinfo = this.userInfo;
M
maguohua 已提交
159 160 161 162 163 164 165 166
        if (this.userInfo) {
            this.avatar = this.getUserinfo.avatar;
            this.username = this.getUserinfo.username;
            this.mobile = this.getUserinfo.mobile;
            this.balance = this.getUserinfo.balance;
            this.count = this.getUserinfo.gift_amount;
            this.pointNumber = this.getUserinfo.point;
        }
M
maguohua 已提交
167 168
    },

M
profile  
maguohua 已提交
169 170
    mixins: [getImgPath],

M
maguohua 已提交
171
    components:{
M
maguohua 已提交
172 173
        headTop,
        footGuide,
M
maguohua 已提交
174 175 176 177
    },

    computed:{
         ...mapState([
M
update  
maguohua 已提交
178
            'userInfo', 
M
maguohua 已提交
179 180 181 182 183 184
        ]),
    },

    methods:{

    },
M
maguohua 已提交
185 186 187
    watch: {
        userInfo: function (){
            this.getUserinfo = this.userInfo;
M
update  
maguohua 已提交
188 189 190 191 192 193
            this.avatar = this.getUserinfo&&this.getUserinfo.avatar || '';
            this.username = this.getUserinfo&&this.getUserinfo.username ||'登陆/注册';
            this.mobile = this.getUserinfo&&this.getUserinfo.mobile ||'登陆后享受更多特权';
            this.balance = this.getUserinfo&&this.getUserinfo.balance || '0';
            this.count = this.getUserinfo&&this.getUserinfo.gift_amount || '0';
            this.pointNumber = this.getUserinfo&&this.getUserinfo.point || '0';
M
maguohua 已提交
194 195
        }
    }
M
maguohua 已提交
196 197 198 199 200 201
}

</script>

<style lang="scss" scoped>
   @import '../../style/mixin'; 
M
maguohua 已提交
202 203 204 205 206 207
    
    .profile_page{
        p, span{
            font-family: Helvetica Neue,Tahoma,Arial;
        }
    }
M
maguohua 已提交
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
   .profile-number{
        padding-top:1.95rem;
        .profile-link{
            display:block;
            display:flex;
            box-align: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            align-items: center;
            background:$blue;
            padding: .666667rem .6rem;
            .privateImage{
                display:inline-block;
                @include wh(2.5rem,2.5rem);
                border-radius:50%;
                vertical-align:middle;
                .privateImage-svg{
                    background:$fc;
                    border-radius:50%;
                    @include wh(2.5rem,2.5rem);
                }
            }
            .user-info{
                margin-left:.48rem;
                -webkit-box-flex: 1;
                -ms-flex-positive: 1;
                flex-grow: 1;
                p{
                    font-weight:700;
                    @include sc(.8rem,$fc);
                    .user-icon{
                        @include wh(0.5rem,0.75rem);
                        display:inline-block;
                        vertical-align:middle;
                        line-height:0.75rem;
                        .icon-mobile{
                            @include wh(100%,100%);
                        }
                    }
                    .icon-mobile-number{
                        display:inline-block;
                        @include sc(.57333rem,$fc);

                    }
                }
                
            }
            .arrow{
                @include wh(.46667rem,.98rem);
                display:inline-block;
                svg{
                   @include wh(100%,100%); 
                }
            }
        }
   }
   .info-data{
        width:100%;
        background:$fc;
        box-sizing: border-box;
        ul{
            .info-data-link{
                float:left;
                width:33.33%;
                display:inline-block;
                border-right:1px solid #f1f1f1;
                span{
                    display:block;
                    width:100%;
                    text-align:center;
                }
                .info-data-top{
                    @include sc(.55rem,#333);
                    padding: .853333rem 0 .453333rem;
                    b{
                        display:inline-block;
                        @include sc(1.2rem,#f90);
                        font-weight:700;
                        line-height:1rem;
                        font-family: Helvetica Neue,Tahoma;
                    }
                }
                .info-data-bottom{
                    @include sc(.57333rem,#666);
                    font-weight:400;
                    padding-bottom:.453333rem;

                }
            }
            .info-data-link:nth-of-type(2){
                .info-data-top{
                    b{
                        color:#ff5f3e;
                    }
                }
               
            }
            .info-data-link:nth-of-type(3){
                border:0;
                .info-data-top{
                    b{
                        color:#6ac20b;
                    }
                }
            }
        }   
   }
   .profile-1reTe{
        margin-top:.4rem;
        background:$fc;
        .myorder{
            padding-left:1.6rem;
            display:flex;
            align-items: center;
            aside{
                @include wh(.7rem,.7rem);
                margin-left:-.866667rem;
                margin-right:.266667rem;
                display:flex;
                align-items: center;
                svg{
                    @include wh(100%,100%);
                }
            }
            .myorder-div{
                width:100%;
                border-bottom:1px solid #f1f1f1;
                padding:.433333rem .266667rem .433333rem 0;
                @include sc(.7rem,#333);
                display:flex;
                justify-content:space-between;
                span{
                    display:block;
                }
                .myorder-divsvg{
                    @include wh(.46667rem,.466667rem);
                    svg{
                        @include wh(100%,100%);
                    }
                }
            }
        }
        .myorder:nth-of-type(3) .myorder-div{
            border:0;
        }
    }
    .router-slid-enter-active, .router-slid-leave-active {
        transition: all .4s;
    }
    .router-slid-enter, .router-slid-leave-active {
        transform: translateX(100%);
    }
</style>