Files
RentWeAppFront/pages/center/center.vue

495 lines
11 KiB
Vue
Raw Normal View History

2025-11-14 11:39:33 +08:00
<template>
2026-01-15 17:18:24 +08:00
<view class="user-center" :style="{backgroundImage: `url(${staticHost + bgPath1})`}">
<customNavbar title="个人中心" ref="navbar" :is-transparent="navbarStyle.isTransparent"
:bg-color="navbarStyle.bgColor" :text-color="navbarStyle.textColor" :opacity="navbarStyle.opacity"
:extra-icons="navbarStyle.extraIcons" :show-home="false" :show-back="false" />
2025-11-14 11:39:33 +08:00
<!-- 顶部用户信息 -->
2025-12-29 16:56:48 +08:00
<view class="user-header">
<u-avatar :src="avatar" size="133"></u-avatar>
<view class="user-info">
<view class="user-name">
2026-01-15 17:18:24 +08:00
<text class="name-text">{{user.userName || '用户0564'}}</text>
<text class="auth-tag">{{user.oaAuth ? '已认证' : '未认证'}}</text>
2025-12-29 16:56:48 +08:00
</view>
2026-01-15 17:18:24 +08:00
<view class="user-type">用户类型{{user.userType ==='0' ? '个人' : '组织'}}</view>
2025-11-14 11:39:33 +08:00
</view>
<view class="msg-setting">
2026-01-15 17:18:24 +08:00
<view class="u-relative msg-icon" @click="toMessage()">
2025-12-29 16:56:48 +08:00
<u-icon name="chat" size="48" color="#333"></u-icon>
2026-01-15 17:18:24 +08:00
<view v-if="unreadMsgCount > 0" class="badge">
{{ unreadMsgCount > 99 ? '99+' : unreadMsgCount }}
</view>
2025-11-14 11:39:33 +08:00
</view>
2025-12-29 16:56:48 +08:00
<u-icon name="setting" size="48" color="#333" @click="toSetting()"></u-icon>
2025-11-14 11:39:33 +08:00
</view>
</view>
2026-01-15 17:18:24 +08:00
<view class="contract-view" :style="{backgroundImage: `url(${staticHost + bgPath2})`}">
2025-12-29 16:56:48 +08:00
<!-- 我的合同和我的预约 -->
<view class="contract-appointment">
2026-01-15 17:18:24 +08:00
<view class="card" @click="clickNav('/pages-biz/contract/contract')">
<view class="card-title">我的合同</view>
<view class="card-main">
<view class="card-content">
2026-01-15 17:18:24 +08:00
<view class="card-number">{{unsignContractNum}}</view>
<view class="card-type">份待签署合同</view>
</view>
<view class="card-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public' + '/static/icon/sign.png'" mode="widthFix"></image>
</view>
2025-12-29 16:56:48 +08:00
</view>
2025-12-25 08:26:09 +08:00
</view>
2026-01-15 17:18:24 +08:00
<view class="card" @click="clickNav('/pages-biz/reserve/reserveRecords')">
<view class="card-title">我的预约</view>
<view class="card-main">
<view class="card-content">
2026-01-15 17:18:24 +08:00
<view class="card-number">{{handlingReserveNum}}</view>
<view class="card-type">个预约中</view>
</view>
<view class="card-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public' + '/static/icon/sign.png'" mode="widthFix"></image>
</view>
2025-12-29 16:56:48 +08:00
</view>
2025-12-25 08:26:09 +08:00
</view>
2025-12-29 16:56:48 +08:00
</view>
2025-12-25 08:26:09 +08:00
2026-01-15 17:18:24 +08:00
<!-- 订单信息 -->
2025-12-29 16:56:48 +08:00
<view class="my-service">
2026-01-15 17:18:24 +08:00
<view class="service-title">订单信息</view>
2025-12-29 16:56:48 +08:00
<view class="service-list">
2026-01-15 17:18:24 +08:00
<view class="service-item" @click="clickNav('/pages-biz/bill/payHistory')">
2025-12-29 16:56:48 +08:00
<view class="service-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public' + '/static/icon/bill.png'"></image>
2025-12-29 16:56:48 +08:00
</view>
<view class="service-name">账单</view>
</view>
2026-01-15 17:18:24 +08:00
<view class="service-item" @click="clickNav('/pages-biz/myrent/myLease')">
2025-12-29 16:56:48 +08:00
<view class="service-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public' + '/static/icon/myrent.png'"></image>
2025-12-29 16:56:48 +08:00
</view>
<view class="service-name">租赁资产</view>
</view>
2026-01-15 17:18:24 +08:00
<view class="service-item" @click="clickNav('/pages-biz/wae/wae')">
<view class="service-icon badge-wrapper">
<image :src="staticHost + '/public' + '/static/icon/wae.png'"></image>
<view v-if="unpaidWaeCount > 0" class="badge">
{{ unpaidWaeCount > 99 ? '99+' : unpaidWaeCount }}
</view>
2025-12-29 16:56:48 +08:00
</view>
2026-01-15 17:18:24 +08:00
<view class="service-name">水电费待付</view>
2025-12-29 16:56:48 +08:00
</view>
2026-01-15 17:18:24 +08:00
<view class="service-item" @click="clickNav('/pages-biz/unpaid/unpaid')">
<view class="service-icon badge-wrapper">
<image :src="staticHost + '/public' + '/static/icon/unpaid.png'"></image>
<view v-if="unpaidRentCount > 0" class="badge">
{{ unpaidRentCount > 99 ? '99+' : unpaidRentCount }}
</view>
2025-12-29 16:56:48 +08:00
</view>
2026-01-15 17:18:24 +08:00
<view class="service-name">租金待付</view>
2025-12-29 16:56:48 +08:00
</view>
</view>
</view>
</view>
2026-01-15 17:18:24 +08:00
<!-- 辅助工具 -->
2025-12-29 16:56:48 +08:00
<view class="common-tools">
2026-01-15 17:18:24 +08:00
<view class="tools-title">辅助工具</view>
2025-12-29 16:56:48 +08:00
<view class="tools-list">
2026-01-15 17:18:24 +08:00
<view class="tool-item" @click="clickNav('/pages-assets/fallback/fallback')">
2025-12-29 16:56:48 +08:00
<view class="tool-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public' + '/static/icon/fallback.png'" mode="widthFix"></image>
2025-12-29 16:56:48 +08:00
</view>
<view class="tool-name">留言板</view>
</view>
2026-01-15 17:18:24 +08:00
<!-- 新增计算器 -->
<view class="tool-item" @click="clickNav('/pages-biz/tool/calculator')">
2025-12-29 16:56:48 +08:00
<view class="tool-icon">
2026-01-15 17:18:24 +08:00
<image :src="staticHost + '/public/static/icon/calculator.png'" mode="widthFix"></image>
</view>
<view class="tool-name">计算器</view>
2025-12-29 16:56:48 +08:00
</view>
</view>
2025-11-14 11:39:33 +08:00
</view>
</view>
</template>
<script>
2025-12-25 08:26:09 +08:00
import config from "@/common/config.js";
export default {
data() {
const life = uni.getStorageSync('lifeData') || {}
return {
2026-01-15 17:18:24 +08:00
user:{},
bgPath1: '/public/static/center/my-bg.png',
bgPath2: '/public/static/center/my-bg2.png',
unsignContractNum:0,
handlingReserveNum:0,
2025-12-30 11:25:41 +08:00
// 导航栏样式控制
2026-01-15 17:18:24 +08:00
unreadMsgCount: 0, // 未读消息
unpaidWaeCount: 0, // 水电费待付
unpaidRentCount: 0, // 租金待付
2025-12-30 11:25:41 +08:00
navbarStyle: {
isTransparent: true,
bgColor: '#ffffff',
textColor: '#000000',
opacity: 0,
extraIcons: [] // 右侧额外图标
2025-12-29 16:56:48 +08:00
},
2025-12-25 08:26:09 +08:00
}
},
computed: {
avatar() {
const life = uni.getStorageSync('lifeData') || {}
const user = life.vuex_user || {}
const raw = user.avatarUrl
if (!raw) return raw
return raw.includes(config.staticUrl) ?
raw :
config.staticUrl + raw
2026-01-15 17:18:24 +08:00
},
staticHost() {
return this.$config.staticUrl
2025-12-25 08:26:09 +08:00
}
2026-01-15 17:18:24 +08:00
2025-12-25 08:26:09 +08:00
},
onLoad() {
uni.$on('updateAvatar', () => {
this.updateAvatar();
})
2026-01-15 17:18:24 +08:00
2025-12-25 08:26:09 +08:00
},
onUnload() {
uni.$off('updateAvatar')
},
onShow() {
2026-01-15 17:18:24 +08:00
this.$checkToken(this.$getToken())
this.loadUserInfo()
this.countHandlingReserve()
this.countUnHandleContract()
2025-12-25 08:26:09 +08:00
},
methods: {
2026-01-15 17:18:24 +08:00
loadUserInfo(){
this.user = uni.getStorageSync('userInfo');
},
2025-12-25 08:26:09 +08:00
logout() {
this.$u.vuex('vuex_token', '');
this.$u.vuex('vuex_user', {});
2026-01-15 17:18:24 +08:00
this.$u.route('/pages/login/login');
uni.removeStorageSync('userInfo');
2025-12-25 08:26:09 +08:00
},
toMessage() {
2026-01-15 17:18:24 +08:00
this.$u.route('/pages-biz/message/message')
2025-12-25 08:26:09 +08:00
},
toSetting() {
2026-01-15 17:18:24 +08:00
this.$u.route('/pages-biz/profile/setting')
2025-12-25 08:26:09 +08:00
},
callPhoneNumber() {
uni.makePhoneCall({
phoneNumber: "18720989281"
});
},
clickNav(url) {
if (url) {
2026-01-15 17:18:24 +08:00
this.$u.route({
url
});
2025-12-25 08:26:09 +08:00
} else {
this.$mytip.toast('敬请期待')
}
},
updateAvatar() {
// 触发 computed 自动更新
this.$forceUpdate()
},
2026-01-15 17:18:24 +08:00
countUnHandleContract(){
this.$u.get(`/contract/countUnsign`, {},{
WT: this.$getToken()
}).then(res => {
if(res.flag){
this.unsignContractNum = res.data
}
})
2025-12-25 08:26:09 +08:00
},
2026-01-15 17:18:24 +08:00
countHandlingReserve(){
this.$u.get(`/reservate/countHandling`, {},{
WT: this.$getToken()
}).then(res => {
if(res.flag){
this.handlingReserveNum = res.data
2025-12-25 08:26:09 +08:00
}
2026-01-15 17:18:24 +08:00
})
2025-12-25 08:26:09 +08:00
},
2026-01-15 17:18:24 +08:00
countUnreadMsg(){
this.$u.get(`/messsage/countUnread`, {},{
WT: this.$getToken()
}).then(res => {
if(res.flag){
this.unreadMsgCount = res.data
}
})
},
countUnpayRentBills(){
this.$u.get(`/bill/countUnpayRentBills`, {},{
WT: this.$getToken()
}).then(res => {
if(res.flag){
this.unpaidRentCount = res.data
}
})
},
countUnpayWaeBills(){
this.$u.get(`/bill/countUnpayWaeBills`, {},{
WT: this.$getToken()
}).then(res => {
if(res.flag){
this.unpaidWaeCount = res.data
}
})
2025-12-25 08:26:09 +08:00
}
}
}
2025-11-14 11:39:33 +08:00
</script>
<style lang="scss" scoped>
2025-12-25 08:26:09 +08:00
.user-center {
2026-01-15 17:18:24 +08:00
padding-top: 175rpx;
background-color: #fff;
background-repeat: no-repeat;
background-size: 750rpx 731rpx;
min-height: 100vh;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
/* 用户信息头 */
.user-header {
padding: 20rpx 40rpx 40rpx;
display: flex;
align-items: center;
position: relative;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
.user-info {
margin-left: 37rpx;
flex: 1;
2025-11-14 11:39:33 +08:00
}
2025-12-25 08:26:09 +08:00
2025-12-29 16:56:48 +08:00
.user-name {
display: flex;
align-items: center;
2025-12-30 11:25:41 +08:00
margin-bottom: 10rpx;
2025-11-14 11:39:33 +08:00
}
2025-12-25 08:26:09 +08:00
2025-12-29 16:56:48 +08:00
.name-text {
2025-12-30 11:25:41 +08:00
font-size: 38rpx;
2025-12-29 16:56:48 +08:00
font-weight: 500;
color: #2D2B2C;
margin-right: 16rpx;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
.auth-tag {
2025-12-30 11:25:41 +08:00
font-size: 26rpx;
2025-12-29 16:56:48 +08:00
color: #86868C;
padding: 4rpx 12rpx;
}
2025-12-25 08:26:09 +08:00
2025-12-29 16:56:48 +08:00
.user-type {
2025-12-30 11:25:41 +08:00
font-size: 26rpx;
2025-12-29 16:56:48 +08:00
color: #86868C;
2025-11-14 11:39:33 +08:00
}
2025-12-25 08:26:09 +08:00
2025-12-29 16:56:48 +08:00
.msg-setting {
display: flex;
gap: 20rpx;
}
.contract-view {
2025-12-29 16:56:48 +08:00
width: 96%;
margin: 0 auto;
2025-12-30 11:25:41 +08:00
background-repeat: round;
2025-12-29 16:56:48 +08:00
border-radius: 10rpx;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
/* 合同和预约卡片 */
.contract-appointment {
display: flex;
gap: 30rpx;
padding: 20rpx;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
.card {
flex: 1;
background-color: #fff;
2025-12-30 11:25:41 +08:00
border-radius: 10rpx;
padding: 24rpx;
2025-12-25 08:26:09 +08:00
display: flex;
flex-direction: column;
2025-12-30 11:25:41 +08:00
}
.card-title {
font-size: 30rpx;
font-weight: 500;
color: #222222;
}
.card-main {
display: flex;
justify-content: space-between;
2025-12-25 08:26:09 +08:00
align-items: center;
2025-12-29 16:56:48 +08:00
position: relative;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
.card-content {
2025-12-30 11:25:41 +08:00
flex: 1;
2025-12-25 08:26:09 +08:00
}
2025-12-29 16:56:48 +08:00
.card-number {
font-size: 48rpx;
font-weight: 600;
2025-12-30 11:25:41 +08:00
color: #EC712E;
margin-bottom: 8rpx;
2025-11-14 11:39:33 +08:00
}
2025-12-29 16:56:48 +08:00
.card-type {
2025-12-30 11:25:41 +08:00
font-size: 26rpx;
color: #86868C;
2025-12-29 16:56:48 +08:00
}
.card-icon {
2025-12-30 11:25:41 +08:00
position: absolute;
right: 0;
bottom: -20rpx;
2025-12-29 16:56:48 +08:00
}
.card-icon image {
2025-12-30 11:25:41 +08:00
width: 120rpx;
height: 111rpx;
2025-12-29 16:56:48 +08:00
}
/* 我的服务 */
.my-service {
padding: 30rpx 40rpx;
margin-bottom: 30rpx;
}
.service-title {
font-size: 30rpx;
font-weight: 500;
color: #222222;
margin-bottom: 30rpx;
}
.service-list {
display: flex;
gap: 60rpx;
}
.service-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.service-icon {
2025-12-30 11:25:41 +08:00
// margin-bottom: 16rpx;
2025-12-29 16:56:48 +08:00
}
.service-icon image {
width: 80rpx;
height: 70rpx;
}
.service-name {
font-size: 24rpx;
color: #222222;
}
/* 常用工具 */
.common-tools {
width: 96%;
margin: 0 auto;
padding: 30rpx 40rpx;
}
.tools-title {
font-size: 30rpx;
font-weight: 500;
color: #222222;
margin-bottom: 30rpx;
}
.tools-list {
2025-12-30 11:25:41 +08:00
margin-top: 50rpx;
margin-left: -20rpx;
2025-12-29 16:56:48 +08:00
display: flex;
flex-flow: row wrap;
}
.tool-item {
width: 25%;
2025-12-30 11:25:41 +08:00
margin-bottom: 40rpx;
2025-12-29 16:56:48 +08:00
display: flex;
flex-direction: column;
align-items: center;
}
.tool-icon {
margin-bottom: 16rpx;
}
.tool-icon image {
width: 47rpx;
height: 47rpx;
}
.tool-name {
font-size: 24rpx;
color: #222222;
2026-01-15 17:18:24 +08:00
}
.badge-wrapper {
position: relative;
display: inline-block;
width: 80rpx; // 对应 image 尺寸
height: 70rpx; // 对应 image 尺寸
}
/* 红点角标 */
.badge {
position: absolute;
top: -10rpx;
right: -14rpx;
min-width: 32rpx;
height: 32rpx;
padding: 0 8rpx;
background-color: #ff3b30;
color: #fff;
font-size: 20rpx;
font-weight: 500;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
/* 消息图标特殊一点 */
.msg-icon {
position: relative;
2025-12-25 08:26:09 +08:00
}
2025-11-14 11:39:33 +08:00
</style>