2025-05-13 08:03:00 +08:00
|
|
|
<script setup lang="ts">
|
2025-05-13 15:34:05 +08:00
|
|
|
import { ref, onMounted, watch } from "vue";
|
2025-05-13 08:03:00 +08:00
|
|
|
import { useRoute } from "vue-router";
|
2025-05-13 15:34:05 +08:00
|
|
|
import { type Ab98UserDetailDTO, getAb98UserDetailApi } from "@/api/ab98/user";
|
|
|
|
|
import { getOrderListApi, type OrderDTO } from "@/api/shop/order";
|
2025-05-13 08:03:00 +08:00
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 订单记录
|
2025-05-13 15:34:05 +08:00
|
|
|
const orderRecords = ref<OrderDTO[]>([]);
|
|
|
|
|
const pagination = ref({
|
|
|
|
|
pageSize: 5,
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
total: 0
|
|
|
|
|
});
|
|
|
|
|
const orderLoading = ref(false);
|
2025-05-13 08:03:00 +08:00
|
|
|
const activeTab = ref('basic');
|
|
|
|
|
|
2025-05-13 15:34:05 +08:00
|
|
|
async function fetchOrders() {
|
|
|
|
|
try {
|
|
|
|
|
orderLoading.value = true;
|
|
|
|
|
const { data } = await getOrderListApi({
|
|
|
|
|
openid: userInfo.value.openid,
|
|
|
|
|
pageSize: pagination.value.pageSize,
|
|
|
|
|
pageNum: pagination.value.currentPage
|
|
|
|
|
});
|
|
|
|
|
orderRecords.value = data.rows;
|
|
|
|
|
pagination.value.total = data.total;
|
|
|
|
|
} finally {
|
|
|
|
|
orderLoading.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(activeTab, (newVal) => {
|
|
|
|
|
if (newVal === 'orders') {
|
|
|
|
|
fetchOrders();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2025-05-13 08:03:00 +08:00
|
|
|
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 />
|
|
|
|
|
|
2025-05-13 15:34:05 +08:00
|
|
|
<el-descriptions class="user-details" :column="1" border>
|
|
|
|
|
<el-descriptions-item label="性别">{{ userInfo.sex }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="手机号">{{ userInfo.tel }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="身份证号">{{ userInfo.idnum }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="住址">{{ userInfo.address }}</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
2025-05-13 08:03:00 +08:00
|
|
|
</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>
|
|
|
|
|
|
2025-05-13 15:34:05 +08:00
|
|
|
<el-descriptions class="info-details" v-if="activeTab === 'basic'" :column="2" border>
|
|
|
|
|
<el-descriptions-item label="会员ID">{{ userInfo.ab98UserId }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="微信openid">{{ userInfo.openid }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="注册时间">{{ userInfo.createTime }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="最后登录">{{ basicInfo.lastLogin }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="登录次数">{{ basicInfo.loginCount }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="常用设备">{{ basicInfo.device }}</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
2025-05-13 08:03:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="info-details" v-if="activeTab === 'orders'">
|
2025-05-13 15:34:05 +08:00
|
|
|
<PureTableBar title="订单列表" @refresh="fetchOrders">
|
|
|
|
|
<el-table ref="tableRef" v-loading="orderLoading" :data="orderRecords" row-key="orderId" border>
|
|
|
|
|
<el-table-column label="订单ID" prop="orderId" width="120" />
|
|
|
|
|
<el-table-column label="商品名称" prop="goodsNames" width="180">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<span v-if="row.goodsNames">
|
|
|
|
|
{{ row.goodsNames.split(',').join(', ') }}
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="商品封面" prop="coverImgs" width="100">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<div v-if="row.coverImgs" class="flex gap-2">
|
|
|
|
|
<el-image v-for="(img, index) in row.coverImgs.split(',')" :key="index" :src="img"
|
|
|
|
|
:preview-src-list="row.coverImgs.split(',')" :z-index="9999" :preview-teleported="true"
|
|
|
|
|
:hide-on-click-modal="true" fit="cover" class="rounded" width="60" height="60" />
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="姓名" prop="name" width="120" />
|
|
|
|
|
<el-table-column label="手机号" prop="mobile" width="120" />
|
|
|
|
|
<el-table-column label="订单金额" prop="totalAmount" width="120">
|
|
|
|
|
<template #default="{ row }">{{ row.totalAmount }}元</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="订单状态" prop="status" width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-tag :type="row.status === 2 ? 'success' : row.status === 5 ? 'danger' : 'info'">
|
|
|
|
|
{{ { 1: '待付款', 2: '已付款', 3: '已发货', 4: '已完成', 5: '已取消' }[row.status] }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="支付状态" prop="payStatus" width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-tag :type="row.payStatus === 2 ? 'success' : 'info'">
|
|
|
|
|
{{ { 1: '未支付', 2: '已支付', 3: '退款中', 4: '已退款' }[row.payStatus] }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="支付方式" prop="paymentMethod" width="120">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ { wechat: '微信支付', balance: '余额支付' }[row.paymentMethod] || row.paymentMethod }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="支付时间" prop="payTime" width="180">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.payTime ? new Date(row.payTime).toLocaleString() : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<el-pagination v-model:current-page="pagination.currentPage" v-model:page-size="pagination.pageSize"
|
|
|
|
|
:page-sizes="[5, 10, 20, 50]" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
|
|
|
|
|
@size-change="fetchOrders" @current-change="fetchOrders" />
|
|
|
|
|
</PureTableBar>
|
2025-05-13 08:03:00 +08:00
|
|
|
</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>
|