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-12-05 21:51:39 +08:00
|
|
|
<view class="user-info" @click="pageRouter('/pages/profile/profile')">
|
|
|
|
<u-avatar size="60" shape="square" :src="userInfo.avatar"></u-avatar>
|
|
|
|
<view class="info-text">
|
2022-12-14 00:58:25 +08:00
|
|
|
<view class="user-nickname">{{ hasLogin ? userInfo.nickname || '会员用户' : '匿名用户' }}</view>
|
2022-12-05 21:51:39 +08:00
|
|
|
<view class="user-mobile">{{ hasLogin ? userInfo.mobile || ' ' : '登录/注册' }}</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="user-setting">
|
|
|
|
<u-icon v-if="hasLogin" name="setting" color="#939393" size="22" @click="pageRouter('/pages/setting/setting')"></u-icon>
|
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>
|
2022-12-05 21:51:39 +08:00
|
|
|
<view class="see-all" @click="pageRouter(orderPage, -1)">
|
2022-04-10 01:21:21 +08:00
|
|
|
<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">
|
2022-12-14 00:58:25 +08:00
|
|
|
<u-grid-item v-for="(item, index) in orderStatusList" :key="index" @click="pageRouter(orderPage, item.status)">
|
2022-04-16 22:04:02 +08:00
|
|
|
<u-icon :name="item.icon" :size="32"></u-icon>
|
2022-12-14 00:58:25 +08:00
|
|
|
<text class="grid-title">{{ item.name }}</text>
|
2022-04-16 22:04:02 +08:00
|
|
|
</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-12-14 00:58:25 +08:00
|
|
|
<u-grid :border="false" col="3">
|
|
|
|
<u-grid-item v-for="(item, index) in statList" :key="index">
|
2022-04-16 22:04:02 +08:00
|
|
|
<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-12-05 21:51:39 +08:00
|
|
|
<u-cell class="fun-item" :border="false" icon="map" title="收货地址" @click="pageRouter('/pages/address/list')" isLink></u-cell>
|
2022-04-10 01:21:21 +08:00
|
|
|
</u-cell-group>
|
2022-04-16 22:04:02 +08:00
|
|
|
</view>
|
2022-04-10 01:21:21 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-12-14 00:58:25 +08:00
|
|
|
import orderStatus from '@/common/orderStatus'
|
|
|
|
|
2022-04-16 22:04:02 +08:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2022-12-14 00:58:25 +08:00
|
|
|
orderPage: '/pages/order/list',
|
2022-04-16 22:04:02 +08:00
|
|
|
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-12-14 00:58:25 +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-12-14 00:58:25 +08:00
|
|
|
computed: {
|
|
|
|
userInfo() {
|
|
|
|
return this.$store.getters.userInfo
|
|
|
|
},
|
|
|
|
hasLogin() {
|
|
|
|
return this.$store.getters.hasLogin
|
|
|
|
},
|
|
|
|
orderStatusList() {
|
|
|
|
let orderStatusList = []
|
|
|
|
for (let status in orderStatus) {
|
|
|
|
if (status !== '40') {
|
|
|
|
orderStatusList.push({ name: orderStatus[status].name, status: status, icon: orderStatus[status].icon })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return orderStatusList
|
|
|
|
}
|
|
|
|
},
|
2022-04-16 22:04:02 +08:00
|
|
|
methods: {
|
2022-12-05 21:51:39 +08:00
|
|
|
pageRouter(pageUrl, param) {
|
2022-04-20 03:08:59 +08:00
|
|
|
if (!this.hasLogin) {
|
2022-05-05 19:09:04 +08:00
|
|
|
uni.$u.route('/pages/login/social')
|
2022-12-05 21:51:39 +08:00
|
|
|
} else if (pageUrl === this.orderPage) {
|
|
|
|
uni.$u.route(this.orderPage, {
|
|
|
|
status: param
|
2022-12-14 00:58:25 +08:00
|
|
|
})
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2022-04-16 22:04:02 +08:00
|
|
|
}
|
|
|
|
}
|
2022-04-10 01:21:21 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.user-header {
|
2022-12-05 21:51:39 +08:00
|
|
|
background-color: #fff;
|
|
|
|
@include flex-space-between;
|
|
|
|
padding: 30rpx;
|
|
|
|
height: 200rpx;
|
|
|
|
|
2022-04-10 01:21:21 +08:00
|
|
|
.user-info {
|
2022-12-05 21:51:39 +08:00
|
|
|
@include flex-left;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
.info-text {
|
|
|
|
margin-left: 20rpx;
|
|
|
|
|
|
|
|
.user-nickname {
|
|
|
|
font-size: 30rpx;
|
|
|
|
font-weight: 700;
|
|
|
|
line-height: 50rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.user-mobile {
|
|
|
|
font-size: 24rpx;
|
|
|
|
font-weight: 700;
|
|
|
|
color: #939393;
|
|
|
|
line-height: 50rpx;
|
|
|
|
}
|
2022-04-10 01:21:21 +08:00
|
|
|
}
|
|
|
|
}
|
2022-12-05 21:51:39 +08:00
|
|
|
|
|
|
|
.user-setting {
|
|
|
|
margin-right: 5rpx;
|
|
|
|
}
|
2022-04-10 01:21:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
.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;
|
|
|
|
}
|
2022-12-14 00:58:25 +08:00
|
|
|
|
2022-04-10 01:21:21 +08:00
|
|
|
.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
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|