2025-10-29 09:05:59 +08:00
|
|
|
<script lang="ts" setup>
|
2025-11-03 17:02:19 +08:00
|
|
|
import { computed, onMounted } from 'vue'
|
|
|
|
|
import { useWxStore } from '@/pinia/stores/wx'
|
|
|
|
|
import { useAb98UserStore } from '@/pinia/stores/ab98-user'
|
|
|
|
|
import { storeToRefs } from 'pinia'
|
2025-11-04 16:11:38 +08:00
|
|
|
import { toHttpsUrl } from '@/utils'
|
2025-10-29 09:05:59 +08:00
|
|
|
|
|
|
|
|
definePage({
|
|
|
|
|
style: {
|
|
|
|
|
navigationBarTitleText: '我的',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
const wxStore = useWxStore()
|
|
|
|
|
const ab98UserStore = useAb98UserStore()
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
const { balance, useBalance, balanceLimit, name: qyName, ab98User } = storeToRefs(wxStore)
|
|
|
|
|
const { name: userName, sex: userSex, face_img } = storeToRefs(ab98UserStore)
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
const name = computed(() => {
|
|
|
|
|
return userName.value || qyName.value || '未知用户'
|
|
|
|
|
})
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-04 16:34:57 +08:00
|
|
|
const userAvatar = computed(() => face_img.value ? toHttpsUrl(face_img.value) : '/static/favicon.ico')
|
2025-11-03 17:02:19 +08:00
|
|
|
|
|
|
|
|
const ab98BalanceInYuan = computed(() => {
|
|
|
|
|
if (ab98User.value && ab98User.value.ab98Balance !== undefined) {
|
|
|
|
|
return (ab98User.value.ab98Balance / 100).toFixed(2)
|
|
|
|
|
}
|
|
|
|
|
return '0.00'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const handleLogout = () => {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '退出登录',
|
|
|
|
|
content: '确定要退出当前账号吗?',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
ab98UserStore.clearUserInfo()
|
|
|
|
|
uni.switchTab({
|
|
|
|
|
url: '/pages/index/index'
|
|
|
|
|
})
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
2025-11-03 17:02:19 +08:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
// 统一的页面跳转函数
|
|
|
|
|
const navigateToPage = (pagePath: string, options: { type?: 'navigateTo' | 'switchTab' | 'redirectTo' } = {}) => {
|
|
|
|
|
const { type = 'navigateTo' } = options
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'switchTab':
|
|
|
|
|
uni.switchTab({ url: pagePath })
|
|
|
|
|
break
|
|
|
|
|
case 'redirectTo':
|
|
|
|
|
uni.redirectTo({ url: pagePath })
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
uni.navigateTo({ url: pagePath })
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
} catch (error) {
|
2025-11-03 17:02:19 +08:00
|
|
|
console.error('页面跳转失败:', error)
|
2025-10-29 09:05:59 +08:00
|
|
|
uni.showToast({
|
2025-11-03 17:02:19 +08:00
|
|
|
title: '页面跳转失败',
|
2025-10-29 09:05:59 +08:00
|
|
|
icon: 'none'
|
2025-11-03 17:02:19 +08:00
|
|
|
})
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
wxStore.refreshBalance()
|
|
|
|
|
})
|
2025-10-29 09:05:59 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-11-03 17:02:19 +08:00
|
|
|
<view class="me-page">
|
|
|
|
|
<!-- 用户卡片 -->
|
|
|
|
|
<view class="user-card">
|
|
|
|
|
<view class="user-info">
|
2025-10-29 09:05:59 +08:00
|
|
|
<view class="avatar-wrapper">
|
2025-11-03 17:02:19 +08:00
|
|
|
<image
|
|
|
|
|
class="avatar"
|
|
|
|
|
:src="userAvatar"
|
|
|
|
|
mode="aspectFill"
|
|
|
|
|
@click="handleLogout"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="user-details">
|
|
|
|
|
<view class="user-name">{{ name }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 余额区域 -->
|
|
|
|
|
<view class="balance-card">
|
|
|
|
|
<view class="section-title">借呗信息</view>
|
|
|
|
|
<view class="balance-content-wrapper">
|
|
|
|
|
<view class="balance-item">
|
|
|
|
|
<view class="balance-icon">
|
|
|
|
|
<wd-icon name="money-circle" size="28px" color="#FFD700"></wd-icon>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="balance-content">
|
|
|
|
|
<view class="balance-label">借呗总额</view>
|
|
|
|
|
<view class="balance-value">{{ balanceLimit }}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="balance-item">
|
|
|
|
|
<view class="balance-content">
|
|
|
|
|
<view class="balance-label">未还借呗</view>
|
|
|
|
|
<view class="balance-value">{{ useBalance }}</view>
|
2025-10-29 09:05:59 +08:00
|
|
|
</view>
|
2025-11-03 17:02:19 +08:00
|
|
|
</view>
|
|
|
|
|
<view class="balance-item">
|
|
|
|
|
<view class="balance-content">
|
|
|
|
|
<view class="balance-label">剩余借呗</view>
|
|
|
|
|
<view class="balance-value">{{ balance }}</view>
|
2025-10-29 09:05:59 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-11-03 17:02:19 +08:00
|
|
|
|
|
|
|
|
<!-- 个人中心按钮 -->
|
|
|
|
|
<view class="button-group">
|
|
|
|
|
<view class="section-title">个人中心</view>
|
|
|
|
|
<view class="button-row">
|
2025-11-04 17:51:35 +08:00
|
|
|
<!-- <view class="button-item" @click="navigateToPage('/pages/order/index')">
|
2025-11-03 17:02:19 +08:00
|
|
|
<wd-icon name="list" size="20px" color="#fff"></wd-icon>
|
|
|
|
|
<text>订单列表</text>
|
2025-11-04 17:51:35 +08:00
|
|
|
</view> -->
|
2025-11-05 09:34:04 +08:00
|
|
|
<view class="button-item" @click="navigateToPage('/pages/rental/index')">
|
2025-11-03 17:02:19 +08:00
|
|
|
<wd-icon name="star" size="20px" color="#fff"></wd-icon>
|
|
|
|
|
<text>我的柜子</text>
|
|
|
|
|
</view>
|
2025-11-04 17:51:35 +08:00
|
|
|
<view class="button-placeholder"></view>
|
|
|
|
|
<view class="button-placeholder"></view>
|
|
|
|
|
<!-- <view v-if="wxStore.isCabinetAdmin" class="button-item" @click="navigateToPage('/pages/cabinet/index')">
|
2025-11-03 17:02:19 +08:00
|
|
|
<wd-icon name="tools" size="20px" color="#fff"></wd-icon>
|
|
|
|
|
<text>柜机管理</text>
|
2025-11-04 17:51:35 +08:00
|
|
|
</view> -->
|
2025-10-29 09:05:59 +08:00
|
|
|
</view>
|
2025-11-04 17:51:35 +08:00
|
|
|
<!-- <view class="button-row">
|
2025-11-03 17:02:19 +08:00
|
|
|
<view v-if="wxStore.isCabinetAdmin" class="button-item" @click="navigateToPage('/pages/approval/list/index')">
|
|
|
|
|
<wd-icon name="secured" size="20px" color="#fff"></wd-icon>
|
|
|
|
|
<text>审批中心</text>
|
2025-10-29 09:05:59 +08:00
|
|
|
</view>
|
2025-11-03 17:02:19 +08:00
|
|
|
<view v-if="wxStore.isCabinetAdmin" class="button-item" @click="navigateToPage('/pages/approvalAsset/list/index')">
|
|
|
|
|
<wd-icon name="edit-1" size="20px" color="#fff"></wd-icon>
|
|
|
|
|
<text>耗材核销</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="button-placeholder"></view>
|
2025-11-04 17:51:35 +08:00
|
|
|
</view> -->
|
2025-10-29 09:05:59 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.me-page {
|
|
|
|
|
background: #f7f8fa;
|
|
|
|
|
min-height: 100%;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.user-card {
|
|
|
|
|
margin: 12px;
|
|
|
|
|
padding: 20px 16px;
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
|
|
|
position: relative;
|
2025-10-29 09:05:59 +08:00
|
|
|
overflow: hidden;
|
2025-11-03 17:02:19 +08:00
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
background: linear-gradient(135deg, rgba(64, 158, 255, 0.02) 0%, rgba(102, 126, 234, 0.02) 100%);
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
&:active {
|
|
|
|
|
transform: translateY(2px);
|
|
|
|
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-info {
|
2025-10-29 09:05:59 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-11-03 17:02:19 +08:00
|
|
|
position: relative;
|
|
|
|
|
z-index: 2;
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.avatar-wrapper {
|
|
|
|
|
margin-right: 16px;
|
|
|
|
|
position: relative;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.avatar {
|
|
|
|
|
width: 60px;
|
|
|
|
|
height: 60px;
|
2025-10-29 09:05:59 +08:00
|
|
|
border-radius: 50%;
|
2025-11-03 17:02:19 +08:00
|
|
|
border: 3px solid rgba(64, 158, 255, 0.2);
|
|
|
|
|
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.avatar:active {
|
|
|
|
|
transform: scale(0.95);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.user-details {
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
.user-name {
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
2025-11-03 17:02:19 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.balance-card {
|
|
|
|
|
margin: 12px;
|
|
|
|
|
padding: 20px 16px;
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
|
|
|
|
|
|
|
|
.section-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
padding-left: 8px;
|
|
|
|
|
position: relative;
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
width: 3px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
background: linear-gradient(135deg, #409EFF 0%, #66B1FF 100%);
|
|
|
|
|
border-radius: 2px;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-11-03 17:02:19 +08:00
|
|
|
|
|
|
|
|
.balance-content-wrapper {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.balance-item {
|
2025-10-29 09:05:59 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2025-11-03 17:02:19 +08:00
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
padding: 0 8px;
|
|
|
|
|
font-weight: 500;
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
&:first-child {
|
|
|
|
|
padding-left: 0;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
&:last-child {
|
|
|
|
|
padding-right: 0;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.balance-icon {
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.balance-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
text-align: center;
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.balance-label {
|
|
|
|
|
font-size: 12px;
|
2025-10-29 09:05:59 +08:00
|
|
|
color: #666;
|
2025-11-03 17:02:19 +08:00
|
|
|
margin-bottom: 6px;
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.balance-value {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
line-height: 1.2;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.button-group {
|
|
|
|
|
margin: 12px;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
background: white;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.section-title {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #1a1a1a;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
padding-left: 8px;
|
|
|
|
|
position: relative;
|
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
width: 3px;
|
|
|
|
|
height: 16px;
|
|
|
|
|
background: linear-gradient(135deg, #409EFF 0%, #66B1FF 100%);
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.button-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: 8px;
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
&:last-child {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.button-item {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 80px;
|
|
|
|
|
background: linear-gradient(135deg, #409EFF 0%, #66B1FF 100%);
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 12px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
position: relative;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
margin-right: 0;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
&::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: -100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
|
|
|
|
transition: left 0.5s ease;
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
wd-icon {
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
text {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: white;
|
|
|
|
|
margin-top: 8px;
|
2025-10-29 09:05:59 +08:00
|
|
|
font-weight: 500;
|
2025-11-03 17:02:19 +08:00
|
|
|
position: relative;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-03 17:02:19 +08:00
|
|
|
.button-placeholder {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 80px;
|
|
|
|
|
}
|
2025-10-29 09:05:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|