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 {
id: number
name: string
billing_type: string
recharge_type: string
price: number
}
@@ -103,11 +103,10 @@ const enabledCardTypesCount = computed(() => {
return form.value.card_types.filter(ct => ct.can_generate).length
})
function getBillingTypeText(type: string) {
function getRechargeTypeText(type: string) {
const map: Record<string, string> = {
subscription: '订阅',
time: '计时',
point: '点卡',
balance: '余额充值',
subscription: '订阅充值',
}
return map[type] || type
}
@@ -246,7 +245,7 @@ onMounted(() => {
<UiTableRow>
<UiTableHead class="w-12" />
<UiTableHead>卡类名称</UiTableHead>
<UiTableHead>计费类型</UiTableHead>
<UiTableHead>充值类型</UiTableHead>
<UiTableHead>原价</UiTableHead>
<UiTableHead>授权价格</UiTableHead>
</UiTableRow>
@@ -271,21 +270,20 @@ onMounted(() => {
</UiTableCell>
<UiTableCell>
<UiBadge variant="outline">
{{ getBillingTypeText(cardTypes[index]?.billing_type || '') }}
{{ getRechargeTypeText(cardTypes[index]?.recharge_type || '') }}
</UiBadge>
</UiTableCell>
<UiTableCell>
¥{{ cardTypes[index]?.price || 0 }}
</UiTableCell>
<UiTableCell @click.stop>
<UiInput
v-model.number="ct.price"
type="number"
step="0.01"
min="0"
class="w-24 h-8"
@click.stop
/>
<UiNumberField v-model="ct.price" :min="0" class="w-28">
<UiNumberFieldContent>
<UiNumberFieldDecrement />
<UiNumberFieldInput />
<UiNumberFieldIncrement />
</UiNumberFieldContent>
</UiNumberField>
</UiTableCell>
</UiTableRow>
</UiTableBody>
+6 -15
View File
@@ -1,5 +1,5 @@
<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 { useRouter } from 'vue-router'
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(() => {
fetchData()
})
@@ -261,25 +252,25 @@ onMounted(() => {
<UiDropdownMenu>
<UiDropdownMenuTrigger as-child>
<UiButton variant="ghost" size="sm">
<span class="i-lucide-more-horizontal h-4 w-4" />
<MoreHorizontal class="h-4 w-4" />
</UiButton>
</UiDropdownMenuTrigger>
<UiDropdownMenuContent align="end">
<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 @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 @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>
<UiDropdownMenuSeparator />
<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>
</UiDropdownMenuContent>