Browse Source

调整个人中心

master
453530270@qq.com 2 years ago
parent
commit
c87f88912e
  1. 208
      pages/user/index.vue

208
pages/user/index.vue

@ -6,24 +6,18 @@
<!-- 用户信息 -->
<view v-if="isLogin" class="user-info">
<view class="user-avatar" @click="handlePersonal()">
<avatar-image :url="userInfo.avatar_url" :width="100" />
<avatar-image :url="userInfo.avatar" :width="100" />
</view>
<view class="user-content">
<!-- 会员昵称 -->
<view class="nick-name oneline-hide" @click="handlePersonal()">{{ userInfo.nick_name }}</view>
<!-- 会员等级 -->
<view v-if="userInfo.grade_id > 0 && userInfo.grade" class="user-grade">
<view class="user-grade_icon">
<image class="image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAA0lBMVEUAAAD/tjL/tzH/uDP/uC7/tjH/tzH/tzL/tTH+tTL+tjP/tDD/tTD+tzD/tjL/szD/uDH/tjL/tjL+tjD/tjT/szb/tzL/tTL+uTH+tjL/tjL/tjL/tTT/tjL/tjL+tjH/uTL/vDD/tjL/tjH/tzL9uS//tTL/nBr/sS7/tjH/ujL/szD/uTv+rzf/tzL+tzH+vDP+uzL+tjP+ry7+tDL9ki/7szf/sEX/tTL/tjL+tjL/tTH/tTT/tzH/tzL/tjP/sTX/uTP/wzX+rTn/vDX9vC8m8ckhAAAAOXRSTlMAlnAMB/vjxKWGMh0S6drMiVxPRkEY9PLy0ru0sKagmo5+dGtgVCMgBP716eXWyMGxqJGRe2o5KSmFNjaYAAABP0lEQVQ4y8XS13KDMBAF0AWDDe4t7r3ETu9lVxJgJ/n/X8rKAzHG5TE+Twz3zki7I/g/KXdghIbGJewrU4yzn08Ebgl6TuZzzuOC6W5es3HX6qsSz3NFShRU0MpucytDmOSpu3yULx3CA9RD1HjVedc0jSjqm6ZzhUjDsFDQhSp/OKj5GQvg0+ZCOixsbtDLAeTTOm/yGi8GyIphIVsgH737FEDV44LJa88IRKK/SetrwT9G/GUIr6vXjoy4GXn7+RboVXnghuSjaoGecwQxL2su3CwAKlO+QFoqxI4FMctHQhQd2OhxTu184jWUlI+rMTBTn1/IQcJHQ6GQdZ7pWiDaNdhTt330efISeiqYwQEzQpTlsURJLhzkEmpCPsERfeIUVyXr6MNuIyp5uziW6xURtt7hhGwzmMNJExfO4Bd9X0ZPqAxdNwAAAABJRU5ErkJggg==">
</image>
</view>
<view class="user-grade_name">
<text>{{ userInfo.grade.name }}</text>
</view>
</view>
<view class="nick-name oneline-hide" @click="handlePersonal()">{{ userInfo.username }}</view>
<!-- 会员无等级时显示手机号 -->
<view v-else class="mobile">{{ userInfo.mobile }}</view>
<view class="mobile">{{ userInfo.cellPhone }} ({{ userInfo.username }}) </view>
<!-- 会员类型 -->
<view class="utype">{{userInfo.userType}}</view>
</view>
</view>
<!-- 未登录 -->
<view v-else class="user-info" @click="handleLogin">
@ -37,57 +31,6 @@
</view>
</view>
<!-- 操作日志 -->
<view class="oplog">
<view class="log-list">
<view v-for="(item, index) in oplist" :key="index" class="log-item">
<view class="item-left flex-box">
<view class="rec-status">
<text>{{ item.operation }}</text>
</view>
<view class="rec-time">
<text>{{ item.createTime }}</text>
</view>
</view>
<view class="item-right col-green col-6">
<text>{{ 11 }}</text>
</view>
</view>
</view>
</view>
<!-- 我的钱包 -->
<view class="my-asset">
<view class="asset-left flex-box dis-flex flex-x-around">
<view class="asset-left-item" style="max-width: 200rpx;" @click="onTargetWallet">
<view class="item-value dis-flex flex-x-center">
<text>{{ isLogin ? assets.balance : '--' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text class="oneline-hide">账户余额</text>
</view>
</view>
<view class="asset-left-item" @click="onTargetMyCoupon">
<view class="item-value dis-flex flex-x-center">
<text class="oneline-hide">{{ isLogin ? assets.coupon : '--' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text>优惠券</text>
</view>
</view>
</view>
<view class="asset-right">
<view class="asset-right-item" @click="onTargetWallet">
<view class="item-icon dis-flex flex-x-center">
<text class="iconfont icon-qianbao"></text>
</view>
<view class="item-name dis-flex flex-x-center">
<text>我的钱包</text>
</view>
</view>
</view>
</view>
<!-- 订单操作 -->
<view class="order-navbar">
@ -103,30 +46,22 @@
</view>
</view>
<!-- 我的服务 -->
<view class="my-service">
<view class="service-title">我的服务</view>
<view class="service-content clearfix">
<block v-for="(item, index) in service" :key="index">
<view v-if="item.type == 'link'" class="service-item" @click="handleService(item)">
<view class="item-icon">
<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
<!-- 操作日志 -->
<view class="oplog">
<view class="log-list">
<view v-for="(item, index) in oplist" :key="index" class="log-item">
<view class="item-left flex-box">
<view class="rec-status">
<text>{{ item.operation }}</text>
</view>
<view class="item-name">{{ item.name }}</view>
<view class="item-badge" v-if="item.count && item.count > 0">
<text v-if="item.count <= 99" class="text">{{ item.count }}</text>
<text v-else class="text">99+</text>
<view class="rec-time">
<text>{{ item.createTime }}</text>
</view>
</view>
<view v-if="item.type == 'button' && platform == 'MP-WEIXIN'" class="service-item">
<button class="btn-normal" :open-type="item.openType">
<view class="item-icon">
<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
<view class="item-right col-6">
<text>{{ item.content }}</text>
</view>
<view class="item-name">{{ item.name }}</view>
</button>
</view>
</block>
</view>
</view>
@ -150,28 +85,15 @@
import * as OrderApi from '@/api/order'
import { checkLogin } from '@/core/app'
//
//
const orderNavbar = [
{ id: 'all', name: '全部订单', icon: 'qpdingdan' },
{ id: 'payment', name: '待支付', icon: 'daifukuan', count: 0 },
{ id: 'delivery', name: '待发货', icon: 'daifahuo', count: 0 },
{ id: 'received', name: '待收货', icon: 'daishouhuo', count: 0 },
{ id: 'all', name: '我的认证', icon: 'qpdingdan' },
{ id: 'payment', name: '买入订单', icon: 'daifukuan', count: 0 },
{ id: 'delivery', name: '卖出订单', icon: 'order-c', count: 0 },
{ id: 'received', name: '发票管理', icon: 'daishouhuo', count: 0 },
]
/**
* 我的服务
* id: 标识; name: 标题名称; icon: 图标; type 类型(link和button); url: 跳转的链接
*/
const service = [
{ id: 'address', name: '收货地址', icon: 'shouhuodizhi', type: 'link', url: 'pages/address/index' },
{ id: 'coupon', name: '领券中心', icon: 'lingquan', type: 'link', url: 'pages/coupon/index' },
{ id: 'myCoupon', name: '优惠券', icon: 'youhuiquan', type: 'link', url: 'pages/my-coupon/index' },
{ id: 'contact', name: '在线客服', icon: 'kefu', type: 'button', openType: 'contact' },
{ id: 'points', name: '我的积分', icon: 'jifen', type: 'link', url: 'pages/points/log' },
{ id: 'refund', name: '退换/售后', icon: 'shouhou', type: 'link', url: 'pages/refund/index', count: 0 },
{ id: 'orderCenter', name: '订单中心', icon: 'order-c', type: 'link', url: 'pages/order/center' },
{ id: 'help', name: '我的帮助', icon: 'bangzhu', type: 'link', url: 'pages/help/index' },
]
export default {
components: {
@ -191,10 +113,6 @@
setting: {},
//
userInfo: {},
//
assets: { balance: '--', points: '--', coupon: '--' },
//
service,
//
oplist:[],
//
@ -230,11 +148,9 @@
getPageData(callback) {
const app = this
app.isLoading = true
Promise.all([/*app.getUserInfo(), app.getUserAssets(), */app.getOplogs()])
Promise.all([app.getUserInfo(), app.getOplogs()])
.then(result => {
app.isFirstload = false
//
app.initService()
//
app.initOrderTabbar()
//
@ -244,23 +160,6 @@
.finally(() => app.isLoading = false)
},
//
initService() {
const app = this
const newService = []
service.forEach(item => {
if (item.id === 'points') {
item.name = '我的' + app.setting[SettingKeyEnum.POINTS.value].points_name
}
//
if (item.count != undefined) {
item.count = app.todoCounts[item.id]
}
newService.push(item)
})
app.service = newService
},
//
initOrderTabbar() {
const app = this
@ -278,21 +177,11 @@
//
getUserInfo() {
const app = this
return new Promise((resolve, reject) => {
!app.isLogin ? resolve(null) : UserApi.info({}, { load: app.isFirstload })
.then(result => {
app.userInfo = result.data.userInfo
resolve(app.userInfo)
})
.catch(err => {
if (err.result && err.result.status == 401) {
app.isLogin = false
resolve(null)
} else {
reject(err)
// storage
if(app.isLogin){
app.userInfo = uni.getStorageSync("cuser")
}
})
})
},
//
@ -452,7 +341,7 @@
font-size: 28rpx;
}
.user-grade {
.utype {
align-self: baseline;
display: flex;
align-items: center;
@ -460,19 +349,6 @@
margin-top: 12rpx;
border-radius: 10rpx;
padding: 4rpx 12rpx;
.user-grade_icon .image {
display: block;
width: 32rpx;
height: 32rpx;
}
.user-grade_name {
margin-left: 5rpx;
font-size: 26rpx;
color: #EEE0C3;
}
}
.login-tips {
@ -482,9 +358,12 @@
}
}
}
}
//
.oplog{
background-color: #fff;
}
.log-list {
padding: 0 30rpx;
}
@ -549,23 +428,6 @@
}
}
//
.my-service {
margin: 22rpx auto 22rpx auto;
padding: 22rpx 0;
width: 94%;
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
border-radius: 5rpx;
background: #fff;
.service-title {
padding-left: 24rpx;
margin-bottom: 20rpx;
font-size: 30rpx;
}
}
// 退
.my-logout {
display: flex;

Loading…
Cancel
Save