This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
// ========== 资产类型枚举 ==========
|
||||
|
||||
// 资产类型
|
||||
type ExpiryBase = 'from_activation' | 'from_purchase'
|
||||
|
||||
export type AssetType = 'card' | 'device'
|
||||
|
||||
// 网络状态
|
||||
@@ -238,6 +240,10 @@ export interface AssetPackageUsageRecord {
|
||||
* 资产套餐列表分页响应
|
||||
* 对应接口:GET /api/admin/assets/:asset_type/:id/packages?page=1&page_size=50
|
||||
*/
|
||||
export interface AssetPackageUsageRecord {
|
||||
expiry_base?: ExpiryBase | null // 鍒版湡璁℃椂鍩哄噯
|
||||
}
|
||||
|
||||
export interface AssetPackageListResponse {
|
||||
total: number // 总记录数
|
||||
page: number // 当前页码
|
||||
|
||||
@@ -246,6 +246,7 @@
|
||||
defineOptions({ name: 'Account' }) // 定义组件名称,用于 KeepAlive 缓存控制
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canModifyAccountStatus = hasAuth('account:modify_status')
|
||||
const route = useRoute()
|
||||
|
||||
const dialogType = ref('add')
|
||||
@@ -399,7 +400,7 @@
|
||||
{ label: '账号类型', prop: 'user_type' },
|
||||
{ label: '店铺名称', prop: 'shop_name' },
|
||||
{ label: '企业名称', prop: 'enterprise_name' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canModifyAccountStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' }
|
||||
]
|
||||
|
||||
@@ -507,24 +508,27 @@
|
||||
return row.enterprise_name || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('account:modify_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canModifyAccountStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
defineOptions({ name: 'EnterpriseCustomer' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canUpdateEnterpriseCustomerStatus = hasAuth('enterprise_customer:status')
|
||||
const userStore = useUserStore()
|
||||
|
||||
const router = useRouter()
|
||||
@@ -344,7 +345,7 @@
|
||||
{ label: '登录手机号', prop: 'login_phone' },
|
||||
{ label: '所在地区', prop: 'address' },
|
||||
{ label: '归属店铺', prop: 'owner_shop_name' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdateEnterpriseCustomerStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
]
|
||||
@@ -457,24 +458,27 @@
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: EnterpriseItem) => row.owner_shop_name || '平台'
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: EnterpriseItem) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: 1,
|
||||
inactiveValue: 0,
|
||||
activeText: '启用',
|
||||
inactiveText: '禁用',
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('enterprise_customer:status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdateEnterpriseCustomerStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: EnterpriseItem) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: 1,
|
||||
inactiveValue: 0,
|
||||
activeText: '启用',
|
||||
inactiveText: '禁用',
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<!-- 操作按钮组 -->
|
||||
<div v-if="hasCardInfo" class="operation-button-group">
|
||||
<ElButton @click="handleRefresh" type="primary" :icon="Refresh" :disabled="refreshDisabled">
|
||||
刷新
|
||||
同步
|
||||
</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
|
||||
<template v-else-if="currentPackage">
|
||||
<!-- 流量使用情况 - 横向进度条卡片 -->
|
||||
<div class="flow-progress-card">
|
||||
<div v-if="shouldShowTrafficCard" class="flow-progress-card">
|
||||
<!-- 管理员视角:始终显示真流量和虚流量 -->
|
||||
<template v-if="isAdminOrPlatform">
|
||||
<div class="flow-stats-container">
|
||||
<!-- 真流量 -->
|
||||
<div class="flow-stat-section">
|
||||
<div v-if="canViewCurrentPackageRealUsage" class="flow-stat-section">
|
||||
<div class="flow-stat-label">真流量使用</div>
|
||||
<div class="flow-stat-row">
|
||||
<span class="stat-item">
|
||||
@@ -79,7 +79,7 @@
|
||||
/>
|
||||
</div>
|
||||
<!-- 虚流量 -->
|
||||
<div class="flow-stat-section">
|
||||
<div v-if="canViewCurrentPackageVirtualUsage" class="flow-stat-section">
|
||||
<div class="flow-stat-label">虚流量使用</div>
|
||||
<div class="flow-stat-row">
|
||||
<span class="stat-item">
|
||||
@@ -211,6 +211,9 @@
|
||||
<ElDescriptionsItem v-if="currentPackage.duration_days" label="套餐时长">
|
||||
{{ currentPackage.duration_days }}天
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="到期计时基准">
|
||||
{{ getExpiryBaseLabel(currentPackage.expiry_base) }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</template>
|
||||
|
||||
@@ -230,6 +233,7 @@
|
||||
ElAlert
|
||||
} from 'element-plus'
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import type { AssetPackageUsageRecord } from '@/types/api'
|
||||
@@ -238,17 +242,29 @@
|
||||
const {
|
||||
formatAmount,
|
||||
formatDataSize,
|
||||
getExpiryBaseLabel,
|
||||
getUsageProgress,
|
||||
getProgressColorByPercentage,
|
||||
formatProgressPercentage,
|
||||
getBreakpointMarkerStyle
|
||||
} = useAssetFormatters()
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
const { info: userInfo } = storeToRefs(userStore)
|
||||
const isAdminOrPlatform = computed(
|
||||
() => userInfo.value.user_type === 1 || userInfo.value.user_type === 2
|
||||
)
|
||||
const canViewCurrentPackageRealUsage = computed(() =>
|
||||
hasAuth('asset_info:view_current_package_real_usage')
|
||||
)
|
||||
const canViewCurrentPackageVirtualUsage = computed(() =>
|
||||
hasAuth('asset_info:view_current_package_virtual_usage')
|
||||
)
|
||||
const shouldShowTrafficCard = computed(() => {
|
||||
if (!isAdminOrPlatform.value) return true
|
||||
return canViewCurrentPackageRealUsage.value || canViewCurrentPackageVirtualUsage.value
|
||||
})
|
||||
|
||||
interface Props {
|
||||
currentPackage: AssetPackageUsageRecord | null
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
<ElTableColumn label="流量" min-width="450">
|
||||
<template #default="scope">
|
||||
<div class="traffic-progress">
|
||||
<template v-if="isAdminOrPlatform">
|
||||
<div class="progress-text">
|
||||
<template v-if="isAdminOrPlatform && shouldShowAdminTrafficBreakdown">
|
||||
<div v-if="canViewCurrentPackageRealUsage" class="progress-text">
|
||||
<span class="used"
|
||||
>已使用真流量: {{ formatDataSize(scope.row.real_used_mb || 0) }}</span
|
||||
>
|
||||
@@ -81,6 +81,7 @@
|
||||
>
|
||||
</div>
|
||||
<ElProgress
|
||||
v-if="canViewCurrentPackageRealUsage"
|
||||
style="margin-top: 4px"
|
||||
:percentage="
|
||||
getUsageProgress(scope.row.real_used_mb || 0, scope.row.real_total_mb || 0)
|
||||
@@ -91,7 +92,11 @@
|
||||
)
|
||||
"
|
||||
/>
|
||||
<div class="progress-text" style="margin-top: 8px">
|
||||
<div
|
||||
v-if="canViewCurrentPackageVirtualUsage"
|
||||
class="progress-text"
|
||||
:style="{ marginTop: canViewCurrentPackageRealUsage ? '8px' : '0' }"
|
||||
>
|
||||
<span class="used"
|
||||
>已使用虚流量: {{ formatDataSize(scope.row.virtual_used_mb || 0) }}</span
|
||||
>
|
||||
@@ -99,7 +104,7 @@
|
||||
>停机阈值: {{ formatDataSize(scope.row.virtual_total_mb || 0) }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="progress-wrapper">
|
||||
<div v-if="canViewCurrentPackageVirtualUsage" class="progress-wrapper">
|
||||
<div class="progress-track">
|
||||
<ElProgress
|
||||
style="margin-top: 4px"
|
||||
@@ -142,7 +147,7 @@
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-else-if="!isAdminOrPlatform">
|
||||
<div class="progress-text">
|
||||
<span class="used"
|
||||
>已使用: {{ formatDataSize(getDisplayedUsedMb(scope.row)) }}</span
|
||||
@@ -271,9 +276,19 @@
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
const { info: userInfo } = storeToRefs(userStore)
|
||||
const canViewCurrentPackageRealUsage = computed(() =>
|
||||
hasAuth('asset_info:view_current_package_real_usage')
|
||||
)
|
||||
const canViewCurrentPackageVirtualUsage = computed(() =>
|
||||
hasAuth('asset_info:view_current_package_virtual_usage')
|
||||
)
|
||||
const isAdminOrPlatform = computed(
|
||||
() => userInfo.value.user_type === 1 || userInfo.value.user_type === 2
|
||||
)
|
||||
const shouldShowAdminTrafficBreakdown = computed(() => {
|
||||
if (!isAdminOrPlatform.value) return true
|
||||
return canViewCurrentPackageRealUsage.value || canViewCurrentPackageVirtualUsage.value
|
||||
})
|
||||
|
||||
// 退款申请对话框
|
||||
const createRefundDialogVisible = ref(false)
|
||||
|
||||
@@ -196,6 +196,15 @@ export function useAssetFormatters() {
|
||||
return statusMap[status] || 'info'
|
||||
}
|
||||
|
||||
// 鑾峰彇鍒版湡璁℃椂鍩哄噯鏂囨
|
||||
const getExpiryBaseLabel = (expiryBase?: string | null) => {
|
||||
const map: Record<string, string> = {
|
||||
from_activation: '实名激活时起算',
|
||||
from_purchase: '购买时起算'
|
||||
}
|
||||
return map[expiryBase || ''] || '--'
|
||||
}
|
||||
|
||||
// 计算使用进度百分比
|
||||
const getUsageProgress = (cumulative: number, total: number): number => {
|
||||
if (!total || total <= 0) return 0
|
||||
@@ -255,6 +264,7 @@ export function useAssetFormatters() {
|
||||
getSwitchModeName,
|
||||
getTransactionTypeTag,
|
||||
getPaymentStatusType,
|
||||
getExpiryBaseLabel,
|
||||
getUsageProgress,
|
||||
getProgressColorByPercentage,
|
||||
formatProgressPercentage,
|
||||
|
||||
@@ -242,6 +242,7 @@ export function useAssetInfo() {
|
||||
reduction_pct: pkg.reduction_pct || 0,
|
||||
start_time: pkg.activated_at || '',
|
||||
expire_time: pkg.expires_at || '',
|
||||
expiry_base: pkg.expiry_base ?? null,
|
||||
status: pkg.status || 0,
|
||||
status_name: pkg.status_name,
|
||||
duration_days: undefined,
|
||||
|
||||
@@ -823,9 +823,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 套餐系列搜索相关
|
||||
// 搜索栏远程选项
|
||||
const shopOptions = ref<any[]>([])
|
||||
const searchSeriesOptions = ref<any[]>([])
|
||||
|
||||
// 搜索店铺(用于搜索栏)
|
||||
const handleSearchShops = async (query: string) => {
|
||||
try {
|
||||
const params: any = {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
}
|
||||
if (query) {
|
||||
params.shop_name = query
|
||||
}
|
||||
const res = await ShopService.getShops(params)
|
||||
if (res.code === 0) {
|
||||
shopOptions.value = res.data.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('搜索店铺失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索套餐系列(用于搜索栏)
|
||||
const handleSearchSeries = async (query: string) => {
|
||||
try {
|
||||
@@ -957,6 +977,7 @@
|
||||
msisdn: string
|
||||
virtual_no: string
|
||||
device_virtual_no: string
|
||||
shop_id: undefined | number
|
||||
series_id: undefined | number
|
||||
is_distributed: undefined | number
|
||||
is_standalone: undefined | boolean
|
||||
@@ -968,6 +989,7 @@
|
||||
msisdn: '',
|
||||
virtual_no: '',
|
||||
device_virtual_no: '',
|
||||
shop_id: undefined,
|
||||
series_id: undefined,
|
||||
is_distributed: undefined,
|
||||
is_standalone: undefined,
|
||||
@@ -1144,6 +1166,24 @@
|
||||
placeholder: '请输入绑定设备虚拟号'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '店铺名称',
|
||||
prop: 'shop_id',
|
||||
type: 'select',
|
||||
config: {
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
remoteMethod: handleSearchShops,
|
||||
loading: false,
|
||||
placeholder: '请选择或搜索店铺名称'
|
||||
},
|
||||
options: () =>
|
||||
shopOptions.value.map((shop) => ({
|
||||
label: shop.shop_name,
|
||||
value: shop.id
|
||||
}))
|
||||
},
|
||||
{
|
||||
label: '套餐系列',
|
||||
prop: 'series_id',
|
||||
|
||||
@@ -420,6 +420,8 @@
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
const router = useRouter()
|
||||
const canUpdatePackageShelfStatus = hasAuth('package:update_away')
|
||||
const canUpdatePackageStatus = hasAuth('package:update_status')
|
||||
|
||||
const currentUserType = computed(() => Number(userStore.info.user_type ?? 0))
|
||||
const isAgentAccount = computed(() => currentUserType.value === 3)
|
||||
@@ -617,8 +619,8 @@
|
||||
return map[row.expiry_base] || row.expiry_base || '-'
|
||||
}
|
||||
},
|
||||
{ label: '上架状态', prop: 'shelf_status' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdatePackageShelfStatus ? [{ label: '上架状态', prop: 'shelf_status' }] : []),
|
||||
...(canUpdatePackageStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' },
|
||||
{ label: '更新时间', prop: 'updated_at' }
|
||||
]
|
||||
@@ -862,41 +864,47 @@
|
||||
)
|
||||
}
|
||||
]),
|
||||
{
|
||||
prop: 'shelf_status',
|
||||
label: '上架状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageResponse) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.shelf_status === 1,
|
||||
activeText: getShelfStatusText(1),
|
||||
inactiveText: getShelfStatusText(2),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('package:update_away'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleShelfStatusChange(row, val ? 1 : 2)
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status ?? 0)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('package:update_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdatePackageShelfStatus
|
||||
? [
|
||||
{
|
||||
prop: 'shelf_status',
|
||||
label: '上架状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageResponse) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.shelf_status === 1,
|
||||
activeText: getShelfStatusText(1),
|
||||
inactiveText: getShelfStatusText(2),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleShelfStatusChange(row, val ? 1 : 2)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(canUpdatePackageStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status ?? 0)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'real_data_mb',
|
||||
label: '总流量',
|
||||
|
||||
@@ -408,6 +408,7 @@
|
||||
defineOptions({ name: 'PackageSeries' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canUpdatePackageSeriesStatus = hasAuth('package_series:update_status')
|
||||
const router = useRouter()
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
@@ -512,7 +513,7 @@
|
||||
prop: 'validity_type',
|
||||
formatter: (row: any) => row.one_time_commission_config?.validity_type || '-'
|
||||
},
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdatePackageSeriesStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' }
|
||||
]
|
||||
|
||||
@@ -720,25 +721,28 @@
|
||||
return validityType
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageSeriesResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('package_series:update_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdatePackageSeriesStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: PackageSeriesResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'description',
|
||||
label: '描述',
|
||||
|
||||
@@ -587,6 +587,7 @@
|
||||
defineOptions({ name: 'SeriesGrants' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canUpdateSeriesGrantStatus = hasAuth('series_grants:update_status')
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const { info: userInfo } = storeToRefs(userStore)
|
||||
@@ -743,7 +744,7 @@
|
||||
{ label: '一次性佣金金额', prop: 'one_time_commission_amount' },
|
||||
{ label: '强制充值', prop: 'force_recharge_enabled' },
|
||||
{ label: '套餐数量', prop: 'package_count' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdateSeriesGrantStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' }
|
||||
]
|
||||
|
||||
@@ -973,25 +974,28 @@
|
||||
label: '套餐数量',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: ShopSeriesGrantResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('series_grants:update_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdateSeriesGrantStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: ShopSeriesGrantResponse) => {
|
||||
const frontendStatus = apiStatusToFrontend(row.status)
|
||||
return h(ElSwitch, {
|
||||
modelValue: frontendStatus,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -449,6 +449,7 @@
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const router = useRouter()
|
||||
const canUpdateWechatConfigStatus = hasAuth('wechat_config:status')
|
||||
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
@@ -509,7 +510,7 @@
|
||||
{ label: '配置名称', prop: 'name' },
|
||||
{ label: '配置描述', prop: 'description' },
|
||||
{ label: '支付渠道类型', prop: 'provider_type' },
|
||||
{ label: '激活状态', prop: 'is_active' },
|
||||
...(canUpdateWechatConfigStatus ? [{ label: '激活状态', prop: 'is_active' }] : []),
|
||||
{ label: '商户号', prop: 'merchant_id' },
|
||||
{ label: '小程序AppID', prop: 'miniapp_app_id' },
|
||||
{ label: '公众号AppID', prop: 'oa_app_id' },
|
||||
@@ -668,21 +669,24 @@
|
||||
width: 130,
|
||||
formatter: (row: WechatConfig) => getProviderTypeText(row.provider_type)
|
||||
},
|
||||
{
|
||||
prop: 'is_active',
|
||||
label: '激活状态',
|
||||
width: 100,
|
||||
formatter: (row: WechatConfig) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.is_active,
|
||||
activeText: '已激活',
|
||||
inactiveText: '未激活',
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('wechat_config:status'),
|
||||
'onUpdate:modelValue': (val) => handleStatusChange(row, val)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdateWechatConfigStatus
|
||||
? [
|
||||
{
|
||||
prop: 'is_active',
|
||||
label: '激活状态',
|
||||
width: 100,
|
||||
formatter: (row: WechatConfig) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.is_active,
|
||||
activeText: '已激活',
|
||||
inactiveText: '未激活',
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val) => handleStatusChange(row, val)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'merchant_id',
|
||||
label: '商户号',
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
defineOptions({ name: 'Shop' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canModifyShopStatus = hasAuth('shop:modify_status')
|
||||
const router = useRouter()
|
||||
|
||||
const dialogType = ref('add')
|
||||
@@ -467,7 +468,7 @@
|
||||
{ label: '所在地区', prop: 'region' },
|
||||
{ label: '联系人', prop: 'contact_name' },
|
||||
{ label: '联系电话', prop: 'contact_phone' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canModifyShopStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' },
|
||||
{ label: '操作', prop: 'operation' }
|
||||
]
|
||||
@@ -596,24 +597,27 @@
|
||||
label: '联系电话',
|
||||
width: 130
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 80,
|
||||
formatter: (row: ShopResponse) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('shop:modify_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canModifyShopStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 80,
|
||||
formatter: (row: ShopResponse) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -165,6 +165,7 @@
|
||||
defineOptions({ name: 'CarrierManagement' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canUpdateCarrierStatus = hasAuth('carrier:update_status')
|
||||
const dialogVisible = ref(false)
|
||||
const loading = ref(false)
|
||||
const submitLoading = ref(false)
|
||||
@@ -234,7 +235,7 @@
|
||||
{ label: '运营商名称', prop: 'carrier_name' },
|
||||
{ label: '运营商类型', prop: 'carrier_type' },
|
||||
{ label: '运营商描述', prop: 'description' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdateCarrierStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'created_at' }
|
||||
]
|
||||
|
||||
@@ -332,24 +333,27 @@
|
||||
minWidth: 200,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('carrier:update_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdateCarrierStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
|
||||
@@ -241,6 +241,7 @@
|
||||
defineOptions({ name: 'Role' })
|
||||
|
||||
const { hasAuth } = useAuth()
|
||||
const canUpdateRoleStatus = hasAuth('role:update_status')
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const permissionDialogVisible = ref(false)
|
||||
@@ -322,7 +323,7 @@
|
||||
{ label: '角色名称', prop: 'role_name' },
|
||||
{ label: '角色描述', prop: 'role_desc' },
|
||||
{ label: '角色类型', prop: 'role_type' },
|
||||
{ label: '状态', prop: 'status' },
|
||||
...(canUpdateRoleStatus ? [{ label: '状态', prop: 'status' }] : []),
|
||||
{ label: '创建时间', prop: 'CreatedAt' }
|
||||
]
|
||||
|
||||
@@ -364,24 +365,27 @@
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
disabled: !hasAuth('role:update_status'),
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
},
|
||||
...(canUpdateRoleStatus
|
||||
? [
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: any) => {
|
||||
return h(ElSwitch, {
|
||||
modelValue: row.status,
|
||||
activeValue: CommonStatus.ENABLED,
|
||||
inactiveValue: CommonStatus.DISABLED,
|
||||
activeText: getStatusText(CommonStatus.ENABLED),
|
||||
inactiveText: getStatusText(CommonStatus.DISABLED),
|
||||
inlinePrompt: true,
|
||||
'onUpdate:modelValue': (val: string | number | boolean) =>
|
||||
handleStatusChange(row, val as number)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
prop: 'role_desc',
|
||||
label: '角色描述'
|
||||
|
||||
Reference in New Issue
Block a user