208 lines
5.1 KiB
Vue
208 lines
5.1 KiB
Vue
|
|
<script setup lang="ts">
|
|||
|
|
import { ref, onMounted } from "vue";
|
|||
|
|
import { useRoute } from "vue-router";
|
|||
|
|
import { Ab98UserDetailDTO, type Ab98UserDTO, getAb98UserDetailApi } from "@/api/ab98/user";
|
|||
|
|
|
|||
|
|
defineOptions({
|
|||
|
|
name: "Ab98UserDetail"
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
const route = useRoute();
|
|||
|
|
const userInfo = ref<Ab98UserDetailDTO>({});
|
|||
|
|
const loading = ref(false);
|
|||
|
|
|
|||
|
|
// 基础信息
|
|||
|
|
const basicInfo = ref({
|
|||
|
|
registerTime: "2023-01-15",
|
|||
|
|
lastLogin: "2023-06-20",
|
|||
|
|
loginCount: 42,
|
|||
|
|
device: "iPhone 13"
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 订单记录
|
|||
|
|
const orderRecords = ref([
|
|||
|
|
]);
|
|||
|
|
|
|||
|
|
const activeTab = ref('basic');
|
|||
|
|
|
|||
|
|
async function fetchUserDetail() {
|
|||
|
|
try {
|
|||
|
|
loading.value = true;
|
|||
|
|
const userId = route.query.id;
|
|||
|
|
const { data } = await getAb98UserDetailApi(Number(userId));
|
|||
|
|
userInfo.value = data;
|
|||
|
|
} finally {
|
|||
|
|
loading.value = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
onMounted(() => {
|
|||
|
|
fetchUserDetail();
|
|||
|
|
});
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<template>
|
|||
|
|
<div class="detail-container">
|
|||
|
|
<div class="flex-container">
|
|||
|
|
<el-card class="user-info-card">
|
|||
|
|
<div class="user-header">
|
|||
|
|
<el-avatar :size="100" :src="userInfo.faceImg" fit="cover" shape="square">
|
|||
|
|
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|||
|
|
<circle cx="50" cy="50" r="48" fill="#f5f5f5" stroke="#e0e0e0" stroke-width="1" />
|
|||
|
|
<circle cx="50" cy="40" r="12" fill="#9e9e9e" />
|
|||
|
|
<rect x="40" y="52" width="20" height="30" rx="2" fill="#9e9e9e" />
|
|||
|
|
</svg>
|
|||
|
|
</el-avatar>
|
|||
|
|
<div class="user-name">{{ userInfo.name }}</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<el-divider />
|
|||
|
|
|
|||
|
|
<div class="user-details">
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">性别  :</span>
|
|||
|
|
<span class="value">{{ userInfo.sex }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">手机号 :</span>
|
|||
|
|
<span class="value">{{ userInfo.tel }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">身份证号:</span>
|
|||
|
|
<span class="value">{{ userInfo.idnum }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">住址  :</span>
|
|||
|
|
<span class="value">{{ userInfo.address }}</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</el-card>
|
|||
|
|
<el-card class="info-card">
|
|||
|
|
<div class="tab-header">
|
|||
|
|
<el-tabs type="card" v-model="activeTab">
|
|||
|
|
<el-tab-pane label="基础信息" name="basic"></el-tab-pane>
|
|||
|
|
|
|||
|
|
<el-tab-pane label="订单记录" name="orders"></el-tab-pane>
|
|||
|
|
</el-tabs>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="info-details" v-if="activeTab === 'basic'">
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">微信openid:</span>
|
|||
|
|
<span class="value">{{ userInfo.openid }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">注册时间:</span>
|
|||
|
|
<span class="value">{{ userInfo.createTime }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">最后登录:</span>
|
|||
|
|
<span class="value">{{ basicInfo.lastLogin }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">登录次数:</span>
|
|||
|
|
<span class="value">{{ basicInfo.loginCount }}</span>
|
|||
|
|
</div>
|
|||
|
|
<div class="detail-item">
|
|||
|
|
<span class="label">常用设备:</span>
|
|||
|
|
<span class="value">{{ basicInfo.device }}</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<div class="info-details" v-if="activeTab === 'orders'">
|
|||
|
|
<div class="order-item" v-for="order in orderRecords" :key="order.id">
|
|||
|
|
<div class="order-id">订单号:{{ order.id }}</div>
|
|||
|
|
<div class="order-detail">
|
|||
|
|
<span>日期:{{ order.date }}</span>
|
|||
|
|
<span>金额:¥{{ order.amount.toFixed(2) }}</span>
|
|||
|
|
<span>状态:{{ order.status }}</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</el-card>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<style scoped lang="scss">
|
|||
|
|
.detail-container {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
height: 100%;
|
|||
|
|
|
|||
|
|
.flex-container {
|
|||
|
|
display: flex;
|
|||
|
|
flex: 1;
|
|||
|
|
gap: 20px;
|
|||
|
|
min-height: 0;
|
|||
|
|
|
|||
|
|
.user-info-card {
|
|||
|
|
width: 20%;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.info-card {
|
|||
|
|
width: 80%;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.user-info-card,
|
|||
|
|
.shop-info-card {
|
|||
|
|
height: 100%;
|
|||
|
|
min-height: 85vh;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.user-header {
|
|||
|
|
display: flex;
|
|||
|
|
flex-direction: column;
|
|||
|
|
align-items: center;
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
|
|||
|
|
.user-name {
|
|||
|
|
margin-top: 15px;
|
|||
|
|
font-size: 20px;
|
|||
|
|
font-weight: bold;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.tab-header {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.order-item {
|
|||
|
|
margin-bottom: 20px;
|
|||
|
|
padding: 10px;
|
|||
|
|
background-color: #f9f9f9;
|
|||
|
|
border-radius: 4px;
|
|||
|
|
|
|||
|
|
.order-id {
|
|||
|
|
font-weight: bold;
|
|||
|
|
margin-bottom: 8px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.order-detail {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
font-size: 13px;
|
|||
|
|
color: #666;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.detail-item {
|
|||
|
|
margin: 15px 0;
|
|||
|
|
font-size: 14px;
|
|||
|
|
|
|||
|
|
.label {
|
|||
|
|
color: #606266;
|
|||
|
|
margin-right: 10px;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.value {
|
|||
|
|
color: #303133;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|