爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

335 lines
8.1 KiB

<template>
<view class="user-detail-container">
<!-- 顶部导航栏 -->
<view class="navbar" :style="navbarStyle">
<view class="nav-left" @tap="goBack">
<uni-icons type="back" size="24" color="#222" />
</view>
<view class="nav-title">用户管理详情</view>
<view class="nav-right">
<!-- <uni-icons type="more-filled" size="24" color="#222" style="margin-right: 16rpx;" />
<uni-icons type="scan" size="24" color="#222" /> -->
</view>
</view>
<view class="main-content">
<!-- 个人信息卡片 -->
<view class="info-card info-card-personal">
<view class="card-title-row">
<view class="card-title">个人信息</view>
<text v-if="user.role==='推广官'" class="role-tag">推广官</text>
</view>
<view v-if="user.blocked" class="blocked-tag">已拉黑</view>
<view class="info-row">
<text class="label">姓名</text>
<text class="value">{{ user.name }}</text>
</view>
<view class="divider"></view>
<view class="info-row">
<text class="label">电话</text>
<text class="value">{{ user.phone }}</text>
</view>
<view class="divider"></view>
<view class="info-row avatar-row">
<text class="label">头像</text>
<image class="avatar" :src="user.avatar" mode="aspectFill" />
</view>
</view>
<!-- 平台信息卡片 -->
<view class="info-card">
<view class="card-title">平台信息</view>
<view class="info-row">
<text class="label">回收总次数</text>
<text class="value">{{ user.recycleCount }}</text>
</view>
<view class="divider"></view>
<view class="info-row">
<text class="label">总件数</text>
<text class="value">{{ user.totalItems }}</text>
</view>
<view class="divider"></view>
<view class="info-row">
<text class="label">回收总额</text>
<text class="value">{{ user.totalAmount }}元</text>
</view>
<view class="divider"></view>
<view class="info-row address-row">
<text class="label">用户下单地址</text>
<text class="value address">{{ user.address }}</text>
</view>
<view class="divider"></view>
<view class="info-row order-row">
<text class="label">历史订单</text>
<text class="value link" @tap="viewOrders">点击查看</text>
</view>
</view>
</view>
<!-- 底部操作栏 -->
<view class="bottom-bar">
<button v-if="user.blocked" class="action-btn danger" @tap="unblockUser">解除拉黑</button>
<template v-else>
<button class="action-btn danger" @tap="blockUser">拉黑</button>
<button v-if="user.role!=='推广官'" class="action-btn primary" @tap="upgradeUser">升级推广官</button>
</template>
</view>
</view>
</template>
<script>
import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
export default {
mixins: [pullRefreshMixin],
data() {
return {
user: {
name: '赵莫艳',
phone: '15888977617',
avatar: 'https://img1.baidu.com/it/u=1234567890,1234567890&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400',
recycleCount: 2412,
totalItems: 32,
totalAmount: '8273.99',
address: '海南省海口市秀英区秀英街道5单元183室',
},
statusBarHeight: 0,
}
},
computed: {
navbarStyle() {
return `padding-top: ${this.statusBarHeight}px;`;
}
},
onLoad(options) {
// 这里可以通过 options 传递用户id并请求详情
uni.getSystemInfo({
success: (res) => {
this.statusBarHeight = res.statusBarHeight || 20;
}
});
// 获取上个页面传递的用户信息
const eventChannel = this.getOpenerEventChannel && this.getOpenerEventChannel();
if (eventChannel) {
eventChannel.on('userDetail', (user) => {
this.user = Object.assign({}, this.user, user);
});
}
},
methods: {
goBack() {
uni.navigateBack();
},
blockUser() {
uni.showToast({ title: '已拉黑', icon: 'none' });
},
upgradeUser() {
uni.showToast({ title: '已升级为推广官', icon: 'none' });
},
viewOrders() {
uni.navigateTo({
url: '/pages/manager/order?historyOrder=true'
});
},
unblockUser() {
uni.showToast({ title: '已解除拉黑', icon: 'none' });
this.user.blocked = false;
},
refreshData() {
// TODO: 实现用户详情刷新逻辑,如重新请求接口
},
async onRefresh() {
await this.refreshData && this.refreshData()
}
},
onPullDownRefresh() {
this.refreshData && this.refreshData()
uni.stopPullDownRefresh()
}
}
</script>
<style lang="scss" scoped>
.user-detail-container {
min-height: 100vh;
background: #f7f7f7;
padding-bottom: 160rpx;
}
.navbar {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100rpx;
background: #fff;
z-index: 10;
display: flex;
align-items: flex-end;
justify-content: space-between;
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
padding: 0 32rpx;
.nav-left {
flex: 0 0 48rpx;
display: flex;
align-items: center;
height: 100%;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 36rpx;
font-weight: bold;
color: #222;
line-height: 100rpx;
}
.nav-right {
flex: 0 0 80rpx;
display: flex;
align-items: center;
justify-content: flex-end;
height: 100%;
}
}
.main-content {
margin-top: 120rpx;
margin-bottom: 40rpx;
}
.info-card {
background: #fff;
border-radius: 40rpx;
margin: 0 32rpx 32rpx 32rpx;
padding: 40rpx 36rpx 36rpx 36rpx;
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
}
.card-title-row {
display: flex;
align-items: center;
margin-bottom: 32rpx;
}
.card-title {
font-size: 32rpx;
font-weight: bold;
color: #222;
margin-right: 18rpx;
}
.role-tag {
font-size: 26rpx;
color: #ff8917;
border: 2rpx solid #ff8917;
border-radius: 12rpx;
padding: 2rpx 18rpx;
font-weight: 400;
background: #fff7f0;
display: inline-block;
vertical-align: middle;
}
.info-row {
display: flex;
align-items: center;
min-height: 60rpx;
margin-bottom: 0;
.label {
font-size: 26rpx;
color: #b3b3b3;
width: 180rpx;
font-weight: 400;
}
.value {
font-size: 30rpx;
color: #222;
font-weight: 500;
flex: 1;
word-break: break-all;
}
.link {
color: #ff8917;
font-size: 30rpx;
font-weight: 500;
text-decoration: underline;
margin-left: 0;
}
}
.avatar-row {
align-items: flex-start;
.avatar {
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
margin-top: 8rpx;
margin-left: 0;
object-fit: cover;
}
}
.address-row {
align-items: flex-start;
.address {
font-size: 28rpx;
color: #222;
font-weight: 400;
margin-top: 0;
line-height: 1.5;
}
}
.order-row {
.link {
color: #ff8917;
font-size: 30rpx;
font-weight: 500;
text-decoration: underline;
margin-left: 0;
}
}
.divider {
height: 2rpx;
background: #f3f3f3;
margin: 18rpx 0 18rpx 0;
border: none;
}
.bottom-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: space-around;
align-items: center;
background: #f7f7f7;
padding-bottom: env(safe-area-inset-bottom);
padding-top: 24rpx;
padding-bottom: 24rpx;
z-index: 20;
}
.action-btn {
flex: 1;
margin: 0 32rpx;
height: 80rpx;
border-radius: 40rpx;
font-size: 30rpx;
font-weight: 500;
border: 2rpx solid #ffd36d;
background: #fffbe6;
color: #ffb800;
box-shadow: 0 2rpx 8rpx rgba(255, 156, 0, 0.03);
}
.action-btn.primary {
color: #ffb800;
border: 2rpx solid #ffd36d;
background: #fffbe6;
}
.action-btn.danger {
color: #ffb800;
border: 2rpx solid #ffd36d;
background: #fffbe6;
}
.info-card-personal {
position: relative;
}
.blocked-tag {
position: absolute;
right: 0;
top: 0;
background: #ffeaea;
color: #ff5b5b;
font-size: 28rpx;
border-radius: 0 0 0 20rpx;
padding: 12rpx 32rpx 12rpx 32rpx;
font-weight: 400;
z-index: 2;
}
</style>