feat: 完善15- 角色默认信用与店铺实际额度管理
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m8s

This commit is contained in:
luo
2026-07-25 11:55:44 +08:00
parent 9289a6e940
commit ee508c3e1e
16 changed files with 457 additions and 100 deletions

View File

@@ -7,6 +7,7 @@
:items="searchFormItems"
show-expand
@reset="handleReset"
label-width="100px"
@search="handleSearch"
></ArtSearchBar>
@@ -203,9 +204,9 @@
>
<ElOption
v-for="role in defaultRoleList"
:key="role.ID"
:key="role.id"
:label="role.role_name"
:value="role.ID"
:value="role.id"
>
<div
style="display: flex; align-items: center; justify-content: space-between"
@@ -238,16 +239,6 @@
</template>
</ElDialog>
<ElDialog v-model="detailDialogVisible" title="店铺详情" width="500px">
<ElDescriptions v-if="detailShop" :column="1" border>
<ElDescriptionsItem label="店铺名称">{{ detailShop.shop_name }}</ElDescriptionsItem>
<ElDescriptionsItem label="店铺编号">{{ detailShop.shop_code }}</ElDescriptionsItem>
<ElDescriptionsItem label="平台业务员">
{{ formatBusinessOwner(detailShop) }}
</ElDescriptionsItem>
</ElDescriptions>
</ElDialog>
<!-- 店铺默认角色管理对话框 -->
<ElDialog
v-model="defaultRolesDialogVisible"
@@ -337,8 +328,9 @@
} from '@/types/api'
import { RoleType, RoleStatus } from '@/types/api'
import { formatDateTime } from '@/utils/business/format'
import { CommonStatus, getStatusText, STATUS_SELECT_OPTIONS } from '@/config/constants'
import { regionData } from '@/utils/constants/regionData'
import { CommonStatus, getStatusText, STATUS_SELECT_OPTIONS } from '@/config/constants'
import { regionData } from '@/utils/constants/regionData'
import { RoutesAlias } from '@/router/routesAlias'
defineOptions({ name: 'Shop' })
@@ -354,8 +346,6 @@
const defaultRoleList = ref<any[]>([])
const salespersonLoading = ref(false)
const salespersonOptions = ref<ShopBusinessOwnerCandidate[]>([])
const detailDialogVisible = ref(false)
const detailShop = ref<ShopResponse | null>(null)
// 级联选择相关
const parentShopCascadeOptions = ref<any[]>([])
@@ -445,20 +435,13 @@
: shop.business_owner_username
}
const showDetail = async (row: ShopResponse) => {
try {
const response = await ShopService.getShopDetail(row.id)
if (response.code !== 0 || !response.data) {
ElMessage.error(response.msg || '获取店铺详情失败')
return
}
detailShop.value = response.data
} catch (error: any) {
ElMessage.error(error?.message || '获取店铺详情失败')
return
}
detailDialogVisible.value = true
}
const handleNameClick = (row: ShopResponse) => {
if (hasAuth('shop:detail')) {
void router.push(`${RoutesAlias.ShopDetail}/${row.id}`)
} else {
ElMessage.warning('您没有查看详情的权限')
}
}
// 定义表单搜索初始值
const initialSearchState = {
@@ -685,11 +668,29 @@
// 动态列配置
const { columnChecks, columns } = useCheckedColumns(() => [
{
prop: 'shop_name',
label: '店铺名称',
width: 160,
showOverflowTooltip: true
{
prop: 'shop_name',
label: '店铺名称',
width: 160,
showOverflowTooltip: true,
formatter: (row: ShopResponse) => {
const hasPermission = hasAuth('shop:detail')
return h(
'span',
{
style: hasPermission
? 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;'
: '',
onClick: hasPermission
? (event: MouseEvent) => {
event.stopPropagation()
handleNameClick(row)
}
: undefined
},
row.shop_name
)
}
},
{
prop: 'shop_code',
@@ -768,12 +769,6 @@
const getActions = (row: ShopResponse) => {
const actions: any[] = []
actions.push({
label: '详情',
handler: () => showDetail(row),
type: 'primary'
})
if (hasAuth('shop:look_customer')) {
actions.push({
label: '账号列表',
@@ -860,10 +855,10 @@
const searchDefaultRoles = async (query: string) => {
defaultRoleLoading.value = true
try {
const params: any = {
page: 1,
pageSize: 20,
role_type: RoleType.CUSTOMER, // 仅客户角色
const params: any = {
page: 1,
page_size: 20,
role_type: RoleType.CUSTOMER, // 仅客户角色
status: RoleStatus.ENABLED // 仅启用的角色
}
if (query) {
@@ -1129,7 +1124,7 @@
// 将 PlatformRole 转换为与 ShopRoleResponse 兼容的格式
availableRoles.value = (res.data.items || []).map((role) => ({
...role,
role_id: role.ID,
role_id: role.id ?? role.ID,
role_name: role.role_name,
role_desc: role.role_desc,
role_type: role.role_type,