2022-04-10 01:21:21 +08:00
|
|
|
<template>
|
2022-04-16 22:04:02 +08:00
|
|
|
<view class="container">
|
2022-04-10 01:21:21 +08:00
|
|
|
<view class="user-header">
|
2022-04-19 17:58:39 +08:00
|
|
|
<view class="user-info" @click="loginOrJump('/pages/profile/profile')">
|
2022-04-20 03:08:59 +08:00
|
|
|
<u-avatar size="80" :src="userInfo.avatar"></u-avatar>
|
2022-05-01 22:39:16 +08:00
|
|
|
<text class="nick-name">{{ hasLogin ? userInfo.nickname || '游客' : '登录/注册' }}</text>
|
2022-04-10 01:21:21 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
2022-04-11 23:02:08 +08:00
|
|
|
<u-gap height="10" bgColor="#f3f3f3"></u-gap>
|
2022-04-10 01:21:21 +08:00
|
|
|
|
|
|
|
<view>
|
|
|
|
<view class="order-header">
|
|
|
|
<text class="order-title">我的订单</text>
|
|
|
|
<view class="see-all">
|
|
|
|
<text>查看全部</text>
|
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
2022-04-11 23:02:08 +08:00
|
|
|
<view class="order-status-box">
|
2022-04-20 03:08:59 +08:00
|
|
|
<u-grid :border="false" :col="orderStatusList.length">
|
|
|
|
<u-grid-item v-for="(item, index) in orderStatusList" :key="index">
|
2022-04-16 22:04:02 +08:00
|
|
|
<u-icon :name="item.icon" :size="32"></u-icon>
|
|
|
|
<text class="grid-title">{{ item.title }}</text>
|
|
|
|
</u-grid-item>
|
2022-04-10 01:21:21 +08:00
|
|
|
</u-grid>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
2022-04-11 23:02:08 +08:00
|
|
|
<u-gap height="10" bgColor="#f3f3f3"></u-gap>
|
|
|
|
|
|
|
|
<view class="stat-box">
|
2022-04-16 22:04:02 +08:00
|
|
|
<u-grid :border="false" col="3"
|
|
|
|
><u-grid-item v-for="(item, index) in statList" :key="index">
|
|
|
|
<text class="grid-value">{{ item.value }}</text>
|
|
|
|
<text class="grid-title">{{ item.title }}</text>
|
|
|
|
</u-grid-item>
|
2022-04-10 01:21:21 +08:00
|
|
|
</u-grid>
|
|
|
|
</view>
|
|
|
|
|
2022-04-11 23:02:08 +08:00
|
|
|
<u-gap height="10" bgColor="#f3f3f3"></u-gap>
|
2022-04-10 01:21:21 +08:00
|
|
|
|
|
|
|
<u-cell-group class="fun-list">
|
|
|
|
<u-cell class="fun-item" :border="false" icon="gift" title="分销中心" isLink></u-cell>
|
|
|
|
<u-cell class="fun-item" :border="false" icon="tags" title="领券中心" isLink></u-cell>
|
|
|
|
<u-cell class="fun-item" :border="false" icon="coupon" title="我的优惠券" isLink></u-cell>
|
2022-04-20 03:08:59 +08:00
|
|
|
<u-cell class="fun-item" :border="false" icon="map" title="收货地址" @click="loginOrJump('/pages/address/list')" isLink></u-cell>
|
2022-04-10 01:21:21 +08:00
|
|
|
</u-cell-group>
|
|
|
|
|
2022-04-20 03:08:59 +08:00
|
|
|
<view v-if="hasLogin" class="logout-btn">
|
|
|
|
<u-button type="error" color="#ea322b" text="退出登录" @click="logout"></u-button>
|
2022-04-19 17:58:39 +08:00
|
|
|
</view>
|
2022-04-16 22:04:02 +08:00
|
|
|
</view>
|
2022-04-10 01:21:21 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-04-16 22:04:02 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
orderStatusList: [
|
|
|
|
{ icon: 'rmb-circle', title: '待支付' },
|
|
|
|
{ icon: 'car', title: '代发货' },
|
|
|
|
{ icon: 'order', title: '待收货' },
|
|
|
|
{ icon: 'integral', title: '已完成' }
|
|
|
|
],
|
|
|
|
statList: [
|
2022-04-19 17:58:39 +08:00
|
|
|
{ value: '0', title: '我的收藏' },
|
|
|
|
{ value: '0', title: '我的消息' },
|
|
|
|
{ value: '0', title: '我的足迹' }
|
2022-04-16 22:04:02 +08:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2022-04-21 00:01:24 +08:00
|
|
|
onLoad() {
|
2022-04-21 01:46:45 +08:00
|
|
|
if (this.hasLogin){
|
2022-05-02 16:53:56 +08:00
|
|
|
this.$store.dispatch('ObtainUserInfo')
|
2022-04-21 01:46:45 +08:00
|
|
|
}
|
2022-04-21 00:01:24 +08:00
|
|
|
},
|
2022-04-16 22:04:02 +08:00
|
|
|
methods: {
|
2022-04-20 03:08:59 +08:00
|
|
|
loginOrJump(pageUrl) {
|
|
|
|
if (!this.hasLogin) {
|
2022-05-05 19:09:04 +08:00
|
|
|
uni.$u.route('/pages/login/social')
|
2022-04-16 22:04:02 +08:00
|
|
|
} else {
|
2022-04-19 17:58:39 +08:00
|
|
|
uni.$u.route(pageUrl)
|
2022-04-10 01:21:21 +08:00
|
|
|
}
|
2022-04-20 03:08:59 +08:00
|
|
|
},
|
|
|
|
logout() {
|
|
|
|
uni.showModal({
|
|
|
|
title: '提示',
|
|
|
|
content: '您确定要退出登录吗',
|
|
|
|
success: res => {
|
|
|
|
if (res.confirm) {
|
2022-05-02 16:53:56 +08:00
|
|
|
this.$store.dispatch('Logout')
|
2022-04-20 03:08:59 +08:00
|
|
|
} else if (res.cancel) {
|
2022-05-01 22:39:16 +08:00
|
|
|
//console.log('用户点击取消')
|
2022-04-20 03:08:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
userInfo() {
|
2022-05-02 16:53:56 +08:00
|
|
|
return this.$store.getters.userInfo
|
2022-04-20 03:08:59 +08:00
|
|
|
},
|
|
|
|
hasLogin() {
|
|
|
|
return this.$store.getters.hasLogin
|
2022-04-16 22:04:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-04-10 01:21:21 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.user-header {
|
2022-04-16 22:04:02 +08:00
|
|
|
@include flex-center(column);
|
2022-04-10 01:21:21 +08:00
|
|
|
height: 280rpx;
|
|
|
|
.user-info {
|
2022-04-16 22:04:02 +08:00
|
|
|
@include flex-center(column);
|
2022-04-10 01:21:21 +08:00
|
|
|
.nick-name {
|
|
|
|
margin-top: 20rpx;
|
|
|
|
font-size: 32rpx;
|
|
|
|
font-weight: 700;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.order-header {
|
2022-04-16 22:04:02 +08:00
|
|
|
@include flex-space-between;
|
2022-04-10 01:21:21 +08:00
|
|
|
padding: 20rpx 30rpx;
|
2022-04-11 23:02:08 +08:00
|
|
|
border-bottom: $custom-border-style;
|
2022-04-10 01:21:21 +08:00
|
|
|
|
|
|
|
.order-title {
|
|
|
|
color: #333333;
|
|
|
|
font-size: 34rpx;
|
|
|
|
}
|
|
|
|
.see-all {
|
|
|
|
height: 40rpx;
|
2022-04-16 22:04:02 +08:00
|
|
|
@include flex-right;
|
2022-04-10 01:21:21 +08:00
|
|
|
color: #666666;
|
|
|
|
font-size: 26rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-11 23:02:08 +08:00
|
|
|
.order-status-box {
|
|
|
|
padding: 40rpx 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.stat-box {
|
|
|
|
padding: 20rpx 0;
|
|
|
|
}
|
|
|
|
|
2022-04-10 01:21:21 +08:00
|
|
|
.grid-title {
|
|
|
|
line-height: 50rpx;
|
|
|
|
font-size: 26rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.grid-value {
|
|
|
|
line-height: 50rpx;
|
|
|
|
font-size: 36rpx;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #2b85e4;
|
|
|
|
}
|
|
|
|
|
|
|
|
.fun-list {
|
|
|
|
.fun-item {
|
|
|
|
padding-top: 10rpx;
|
|
|
|
padding-bottom: 10rpx;
|
2022-04-11 23:02:08 +08:00
|
|
|
border-bottom: $custom-border-style;
|
2022-04-10 01:21:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.logout-btn {
|
2022-04-19 17:58:39 +08:00
|
|
|
margin: 60rpx auto 0;
|
|
|
|
width: 400rpx;
|
2022-04-10 01:21:21 +08:00
|
|
|
}
|
|
|
|
</style>
|