<template>
|
<view class="mine-page">
|
<view class="top-bg"></view>
|
<view class="nav-wrap">
|
<view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
|
<view :style="{ width: '100%', height: navHeight + 'px' }"></view>
|
</view>
|
<view class="page-scroll">
|
<view class="page-content">
|
<view class="profile-card">
|
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber">授权手机号</button>
|
<image class="avatar" :src="userInfo.fullCoverImage ? userInfo.fullCoverImage : '/static/image/tx@2x.png'" mode="widthFix"></image>
|
<view class="profile-copy">
|
<text class="login-text">{{ userInfo.nickName || '点击登录' }}</text>
|
</view>
|
<view v-if="userInfo" class="profile-tools">
|
<view class="tool-item" @click="toSetting">
|
<image class="tool-icon" src="/static/icon/ic_option@2x.png" mode="aspectFit"></image>
|
</view>
|
<view class="tool-item has-badge">
|
<image class="tool-icon" src="/static/icon/ic_notice@2x.png" mode="aspectFit"></image>
|
<view class="tool-badge" v-if="userInfo.hasMessage"></view>
|
</view>
|
</view>
|
</view>
|
|
<view class="order-card section-card">
|
<view class="section-head">
|
<text class="section-title">我的订单</text>
|
<view class="more-wrap" @click="toAllOrders">
|
<text class="more-text">全部订单</text>
|
<u-icon name="arrow-right" size="13" color="#999999"></u-icon>
|
</view>
|
</view>
|
<view class="order-grid">
|
<view v-for="(item, index) in orderMenus" :key="index" class="order-item" @click="toOrderDetail(item.label)">
|
<image class="order-icon" :src="item.url" mode="widthFix"></image>
|
<view v-if="item.badge" class="order-badge">{{ item.badge }}</view>
|
<text class="order-label">{{ item.label }}</text>
|
</view>
|
</view>
|
</view>
|
|
<view class="banner-card">
|
<image class="banner-image" src="/static/image/share@2x.png" mode="widthFix"></image>
|
</view>
|
|
<view class="menu-card section-card">
|
<view v-for="item in menuList" :key="item.label" class="menu-row">
|
<text class="menu-label">{{ item.label }}</text>
|
<u-icon name="arrow-right" size="18" color="#B5BBC5"></u-icon>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { mapState } from 'vuex'
|
|
export default {
|
computed: {
|
...mapState(['navHeight', 'statusbarHeight', 'openid', 'userInfo'])
|
},
|
data() {
|
return {
|
userName: '',
|
orderMenus: [
|
{ label: '待支付', url: '/static/icon/mine_ic_daifukuan@2x.png', badge: 0 },
|
{ label: '待收货', url: '/static/icon/mine_ic_daishouhuo@2x.png', badge: 0 },
|
{ label: '退款/售后', url: '/static/icon/mine_ic_tuikuan@2x.png', badge: 0 }
|
],
|
menuList: [
|
{ label: '门店入驻' },
|
{ label: '我的门店' },
|
{ label: '规范须知' },
|
{ label: '在线客服' },
|
{ label: '关于我们' }
|
]
|
}
|
},
|
async onShow() {
|
await this.$onLaunched
|
this.getOrderNum()
|
},
|
methods: {
|
toAllOrders() {
|
uni.navigateTo({
|
url: '/pages/orders/orders'
|
})
|
},
|
toOrderDetail(label) {
|
uni.navigateTo({
|
url: '/pages/orders/orders?status=' + label
|
})
|
},
|
toSetting() {
|
uni.navigateTo({
|
url: '/pages/settings/settings'
|
})
|
},
|
getOrderNum() {
|
this.$u.api.getMemberInfo({}).then(res => {
|
if (res.code === 200) {
|
this.$store.commit('setUserInfo', res.data)
|
this.orderMenus.forEach(item => {
|
if (item.label === '待支付') {
|
item.badge = res.data.waitPayCount
|
} else if (item.label === '待收货') {
|
item.badge = res.data.waitReceiveCount
|
} else if (item.label === '退款/售后') {
|
item.badge = res.data.refundingCount
|
}
|
})
|
}
|
})
|
},
|
// 授权手机号
|
getphonenumber(e) {
|
var that = this;
|
if (e.detail.errMsg === 'getPhoneNumber:ok') {
|
uni.login({
|
provider: 'weixin',
|
success: async function (loginRes) {
|
let { code } = loginRes;
|
let res = await that.$u.api.wxLogin({ code })
|
if (res.code === 200) {
|
that.$u.api.wxAuthPhone({
|
code: e.detail.code,
|
openid: 'oKKHU5IFKpss_DIbFX1lqghFJOEg'
|
}).then(res => {
|
if (res.code === 200) {
|
that.$store.commit('setUserInfo', res.data.member)
|
that.$store.commit('setToken', res.data.token)
|
}
|
})
|
}
|
}
|
});
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.mine-page {
|
position: relative;
|
min-height: 100vh;
|
background: #f6f8fb;
|
}
|
|
.top-bg {
|
position: absolute;
|
left: 0;
|
top: 0;
|
width: 100%;
|
height: 450rpx;
|
background: linear-gradient(180deg, #B9E9FF 0%, #ffffff 100%);
|
z-index: 0;
|
}
|
|
.page-scroll {
|
position: relative;
|
z-index: 1;
|
}
|
|
.page-content {
|
padding: 30rpx;
|
box-sizing: border-box;
|
}
|
|
.profile-card {
|
display: flex;
|
align-items: center;
|
margin-bottom: 30rpx;
|
position: relative;
|
button {
|
position: absolute;
|
bottom: 0;
|
left: 0;
|
width: 100%;
|
height: 100%;
|
opacity: 0;
|
}
|
}
|
|
.avatar {
|
width: 108rpx;
|
height: 108rpx;
|
border-radius: 50%;
|
overflow: hidden;
|
margin-right: 24rpx;
|
}
|
|
.login-text {
|
font-weight: 600;
|
font-size: 36rpx;
|
color: #111111;
|
}
|
|
.profile-copy {
|
flex: 1;
|
min-width: 0;
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
}
|
|
.user-name {
|
margin-top: 12rpx;
|
font-weight: 400;
|
font-size: 26rpx;
|
color: #7d8792;
|
}
|
|
.profile-tools {
|
display: flex;
|
align-items: center;
|
gap: 20rpx;
|
}
|
|
.tool-item {
|
position: relative;
|
width: 40rpx;
|
height: 40rpx;
|
}
|
|
.tool-icon {
|
width: 100%;
|
height: 100%;
|
}
|
|
.tool-badge {
|
position: absolute;
|
right: -4rpx;
|
top: -4rpx;
|
width: 12rpx;
|
height: 12rpx;
|
border-radius: 50%;
|
background: #ff3b30;
|
}
|
|
.section-card {
|
background: #ffffff;
|
border-radius: 18rpx;
|
}
|
|
.order-card {
|
padding: 30rpx;
|
box-sizing: border-box;
|
}
|
|
.section-head {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 30rpx;
|
}
|
|
.section-title {
|
font-size: 34rpx;
|
font-weight: 600;
|
color: #222222;
|
}
|
|
.more-wrap {
|
display: flex;
|
align-items: center;
|
gap: 4rpx;
|
}
|
|
.more-text {
|
font-size: 24rpx;
|
color: #b5bbc5;
|
}
|
|
.order-grid {
|
display: flex;
|
align-items: center;
|
justify-content: space-around;
|
padding: 8rpx 14rpx 0;
|
}
|
|
.order-item {
|
position: relative;
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
}
|
|
.order-badge {
|
position: absolute;
|
top: -6rpx;
|
right: -15rpx;
|
min-width: 28rpx;
|
height: 28rpx;
|
padding: 0 6rpx;
|
border-radius: 14rpx;
|
background: #ff2d55;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
font-size: 18rpx;
|
line-height: 1;
|
color: #ffffff;
|
box-sizing: border-box;
|
}
|
|
.order-icon {
|
width: 60rpx;
|
height: 60rpx;
|
}
|
|
.order-label {
|
margin-top: 8rpx;
|
font-weight: 400;
|
font-size: 24rpx;
|
color: #333333;
|
}
|
|
.banner-card {
|
position: relative;
|
margin-top: 30rpx;
|
width: 100%;
|
overflow: hidden;
|
}
|
|
.banner-image {
|
width: 100%;
|
}
|
|
.menu-card {
|
margin-top: 30rpx;
|
padding: 0 30rpx;
|
box-sizing: border-box;
|
}
|
|
.menu-row {
|
height: 100rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 1rpx solid #E5E5E5;
|
}
|
|
.menu-row:last-child {
|
border-bottom: none;
|
}
|
|
.menu-label {
|
font-weight: 400;
|
font-size: 30rpx;
|
color: #222222;
|
}
|
</style>
|