fix: 修复计费类型显示、授权价格组件和操作图标问题

This commit is contained in:
2026-05-07 00:48:51 +08:00
parent b2295b3c38
commit d9f4574f33
2 changed files with 19 additions and 30 deletions
+13 -15
View File
@@ -24,7 +24,7 @@ interface Application {
interface CardType { interface CardType {
id: number id: number
name: string name: string
billing_type: string recharge_type: string
price: number price: number
} }
@@ -103,11 +103,10 @@ const enabledCardTypesCount = computed(() => {
return form.value.card_types.filter(ct => ct.can_generate).length return form.value.card_types.filter(ct => ct.can_generate).length
}) })
function getBillingTypeText(type: string) { function getRechargeTypeText(type: string) {
const map: Record<string, string> = { const map: Record<string, string> = {
subscription: '订阅', balance: '余额充值',
time: '计时', subscription: '订阅充值',
point: '点卡',
} }
return map[type] || type return map[type] || type
} }
@@ -246,7 +245,7 @@ onMounted(() => {
<UiTableRow> <UiTableRow>
<UiTableHead class="w-12" /> <UiTableHead class="w-12" />
<UiTableHead>卡类名称</UiTableHead> <UiTableHead>卡类名称</UiTableHead>
<UiTableHead>计费类型</UiTableHead> <UiTableHead>充值类型</UiTableHead>
<UiTableHead>原价</UiTableHead> <UiTableHead>原价</UiTableHead>
<UiTableHead>授权价格</UiTableHead> <UiTableHead>授权价格</UiTableHead>
</UiTableRow> </UiTableRow>
@@ -271,21 +270,20 @@ onMounted(() => {
</UiTableCell> </UiTableCell>
<UiTableCell> <UiTableCell>
<UiBadge variant="outline"> <UiBadge variant="outline">
{{ getBillingTypeText(cardTypes[index]?.billing_type || '') }} {{ getRechargeTypeText(cardTypes[index]?.recharge_type || '') }}
</UiBadge> </UiBadge>
</UiTableCell> </UiTableCell>
<UiTableCell> <UiTableCell>
¥{{ cardTypes[index]?.price || 0 }} ¥{{ cardTypes[index]?.price || 0 }}
</UiTableCell> </UiTableCell>
<UiTableCell @click.stop> <UiTableCell @click.stop>
<UiInput <UiNumberField v-model="ct.price" :min="0" class="w-28">
v-model.number="ct.price" <UiNumberFieldContent>
type="number" <UiNumberFieldDecrement />
step="0.01" <UiNumberFieldInput />
min="0" <UiNumberFieldIncrement />
class="w-24 h-8" </UiNumberFieldContent>
@click.stop </UiNumberField>
/>
</UiTableCell> </UiTableCell>
</UiTableRow> </UiTableRow>
</UiTableBody> </UiTableBody>
+6 -15
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { CheckCircle, Key, Plus, Share2, Wallet, XCircle } from 'lucide-vue-next' import { CheckCircle, Edit, Key, MoreHorizontal, Plus, Share2, Trash2, Wallet, XCircle } from 'lucide-vue-next'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { toast } from 'vue-sonner' import { toast } from 'vue-sonner'
@@ -80,15 +80,6 @@ async function handleRemove() {
} }
} }
function getBillingTypeText(type: string) {
const map: Record<string, string> = {
subscription: '订阅',
time: '计时',
point: '点卡',
}
return map[type] || type
}
onMounted(() => { onMounted(() => {
fetchData() fetchData()
}) })
@@ -261,25 +252,25 @@ onMounted(() => {
<UiDropdownMenu> <UiDropdownMenu>
<UiDropdownMenuTrigger as-child> <UiDropdownMenuTrigger as-child>
<UiButton variant="ghost" size="sm"> <UiButton variant="ghost" size="sm">
<span class="i-lucide-more-horizontal h-4 w-4" /> <MoreHorizontal class="h-4 w-4" />
</UiButton> </UiButton>
</UiDropdownMenuTrigger> </UiDropdownMenuTrigger>
<UiDropdownMenuContent align="end"> <UiDropdownMenuContent align="end">
<UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/edit`)"> <UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/edit`)">
<span class="i-lucide-edit mr-2 h-4 w-4" /> <Edit class="mr-2 h-4 w-4" />
编辑授权 编辑授权
</UiDropdownMenuItem> </UiDropdownMenuItem>
<UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/card-types`)"> <UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/card-types`)">
<span class="i-lucide-key mr-2 h-4 w-4" /> <Key class="mr-2 h-4 w-4" />
卡密权限 卡密权限
</UiDropdownMenuItem> </UiDropdownMenuItem>
<UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/recharge`)"> <UiDropdownMenuItem @click="router.push(`/admin/agent-apps/${item.id}/recharge`)">
<span class="i-lucide-wallet mr-2 h-4 w-4" /> <Wallet class="mr-2 h-4 w-4" />
充值余额 充值余额
</UiDropdownMenuItem> </UiDropdownMenuItem>
<UiDropdownMenuSeparator /> <UiDropdownMenuSeparator />
<UiDropdownMenuItem class="text-destructive" @click="confirmRemove(item)"> <UiDropdownMenuItem class="text-destructive" @click="confirmRemove(item)">
<span class="i-lucide-trash-2 mr-2 h-4 w-4" /> <Trash2 class="mr-2 h-4 w-4" />
移除授权 移除授权
</UiDropdownMenuItem> </UiDropdownMenuItem>
</UiDropdownMenuContent> </UiDropdownMenuContent>