fetch(modify):修复API的URL
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m1s

This commit is contained in:
sexygoat
2026-02-03 10:04:59 +08:00
parent 06cde977ad
commit 2c6fe4375b
17 changed files with 225 additions and 205 deletions

View File

@@ -12,7 +12,7 @@
<!-- 表格 -->
<ArtTable
ref="tableRef"
row-key="id"
row-key="ID"
:loading="loading"
:data="accountList"
height="60vh"
@@ -24,7 +24,7 @@
@current-change="handleCurrentChange"
>
<template #default>
<ElTableColumn v-for="col in columns" :key="col.prop || col.type" v-bind="col" />
<ElTableColumn v-for="col in columns" :key="col.prop || (col as any).type" v-bind="col" />
</template>
</ArtTable>
</ElDialog>
@@ -33,23 +33,25 @@
<script setup lang="ts">
import { h } from 'vue'
import { ElMessage, ElTag } from 'element-plus'
import { CustomerAccountService } from '@/api/modules'
import { AccountService } from '@/api/modules'
import type { SearchFormItem } from '@/types'
import type { PlatformAccount } from '@/types/api'
import { formatDateTime } from '@/utils/business/format'
interface CustomerAccount {
id: number
username: string
phone: string
user_type: number
user_type_name: string
shop_id: number | null
shop_name: string
enterprise_id: number | null
enterprise_name: string
status: number
status_name: string
created_at: string
// 用户类型映射
const getUserTypeName = (type: number): string => {
const typeMap: Record<number, string> = {
1: '超级管理员',
2: '平台用户',
3: '代理账号',
4: '企业账号'
}
return typeMap[type] || '未知'
}
// 状态名称映射
const getStatusName = (status: number): string => {
return status === 1 ? '启用' : '禁用'
}
const props = defineProps<{
@@ -69,7 +71,7 @@
const loading = ref(false)
const tableRef = ref()
const accountList = ref<CustomerAccount[]>([])
const accountList = ref<PlatformAccount[]>([])
// 搜索表单初始值
const initialSearchState = {
@@ -160,40 +162,38 @@
width: 130
},
{
prop: 'user_type_name',
prop: 'user_type',
label: '用户类型',
width: 110,
formatter: (row: CustomerAccount) => {
return h(ElTag, { type: getUserTypeTag(row.user_type) }, () => row.user_type_name)
formatter: (row: PlatformAccount) => {
return h(ElTag, { type: getUserTypeTag(row.user_type) }, () => getUserTypeName(row.user_type))
}
},
{
prop: 'shop_name',
label: '店铺名称',
minWidth: 150,
showOverflowTooltip: true,
formatter: (row: CustomerAccount) => row.shop_name || '-'
prop: 'shop_id',
label: '店铺ID',
width: 100,
formatter: (row: PlatformAccount) => row.shop_id || '-'
},
{
prop: 'enterprise_name',
label: '企业名称',
minWidth: 150,
showOverflowTooltip: true,
formatter: (row: CustomerAccount) => row.enterprise_name || '-'
prop: 'enterprise_id',
label: '企业ID',
width: 100,
formatter: (row: PlatformAccount) => row.enterprise_id || '-'
},
{
prop: 'status',
label: '状态',
width: 100,
formatter: (row: CustomerAccount) => {
return h(ElTag, { type: getStatusTag(row.status) }, () => row.status_name)
formatter: (row: PlatformAccount) => {
return h(ElTag, { type: getStatusTag(row.status) }, () => getStatusName(row.status))
}
},
{
prop: 'created_at',
prop: 'CreatedAt',
label: '创建时间',
width: 180,
formatter: (row: CustomerAccount) => formatDateTime(row.created_at)
formatter: (row: PlatformAccount) => formatDateTime(row.CreatedAt)
}
])
@@ -213,7 +213,7 @@
try {
const params: any = {
page: pagination.page,
page_size: pagination.pageSize,
pageSize: pagination.pageSize,
username: searchForm.username || undefined,
phone: searchForm.phone || undefined,
user_type: searchForm.user_type,
@@ -235,7 +235,7 @@
}
})
const res = await CustomerAccountService.getCustomerAccounts(params)
const res = await AccountService.getAccounts(params)
if (res.code === 0) {
accountList.value = res.data.items || []
pagination.total = res.data.total || 0