refactor: 移除佣金比例字段,将developer统一为admin
This commit is contained in:
@@ -84,15 +84,15 @@ function onApplicationChange() {
|
||||
|
||||
async function handleGenerate() {
|
||||
if (!form.value.application_id) {
|
||||
toast.error(t('developer.cards.create.selectAppFirst'))
|
||||
toast.error(t('admin.cards.create.selectAppFirst'))
|
||||
return
|
||||
}
|
||||
if (!form.value.card_type_id) {
|
||||
toast.error(t('developer.cards.create.selectCardTypeFirst'))
|
||||
toast.error(t('admin.cards.create.selectCardTypeFirst'))
|
||||
return
|
||||
}
|
||||
if (form.value.count < 1 || form.value.count > 1000) {
|
||||
toast.error(t('developer.cards.create.countRange'))
|
||||
toast.error(t('admin.cards.create.countRange'))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -103,12 +103,12 @@ async function handleGenerate() {
|
||||
card_type_id: Number(form.value.card_type_id),
|
||||
count: form.value.count,
|
||||
})
|
||||
toast.success(t('developer.cards.create.generateSuccess', { count: form.value.count }))
|
||||
router.push('/developer/cards')
|
||||
toast.success(t('admin.cards.create.generateSuccess', { count: form.value.count }))
|
||||
router.push('/admin/cards')
|
||||
}
|
||||
catch (error: any) {
|
||||
console.error('生成卡密失败:', error)
|
||||
toast.error(error.message || t('developer.cards.create.generateFailed'))
|
||||
toast.error(error.message || t('admin.cards.create.generateFailed'))
|
||||
}
|
||||
finally {
|
||||
saving.value = false
|
||||
@@ -123,11 +123,11 @@ onMounted(() => {
|
||||
|
||||
<template>
|
||||
<BasicPage
|
||||
:title="t('developer.cards.create.title')"
|
||||
:description="t('developer.cards.create.description')"
|
||||
:title="t('admin.cards.create.title')"
|
||||
:description="t('admin.cards.create.description')"
|
||||
:breadcrumbs="[
|
||||
{ title: t('developer.cards.title'), href: '/developer/cards' },
|
||||
{ title: t('developer.cards.create.title') },
|
||||
{ title: t('admin.cards.title'), href: '/admin/cards' },
|
||||
{ title: t('admin.cards.create.title') },
|
||||
]"
|
||||
sticky
|
||||
>
|
||||
@@ -138,18 +138,18 @@ onMounted(() => {
|
||||
<UiCardHeader>
|
||||
<UiCardTitle class="flex items-center gap-2">
|
||||
<Icon icon="lucide:settings-2" class="size-5" />
|
||||
{{ t('developer.cards.create.config') }}
|
||||
{{ t('admin.cards.create.config') }}
|
||||
</UiCardTitle>
|
||||
<UiCardDescription>{{ t('developer.cards.create.configDesc') }}</UiCardDescription>
|
||||
<UiCardDescription>{{ t('admin.cards.create.configDesc') }}</UiCardDescription>
|
||||
</UiCardHeader>
|
||||
<UiCardContent class="space-y-6">
|
||||
<div class="space-y-2">
|
||||
<UiLabel for="application">
|
||||
{{ t('developer.cards.create.application') }}
|
||||
{{ t('admin.cards.create.application') }}
|
||||
</UiLabel>
|
||||
<UiSelect v-model="form.application_id" @update:model-value="onApplicationChange">
|
||||
<UiSelectTrigger>
|
||||
<UiSelectValue :placeholder="t('developer.cards.create.selectApplication')" />
|
||||
<UiSelectValue :placeholder="t('admin.cards.create.selectApplication')" />
|
||||
</UiSelectTrigger>
|
||||
<UiSelectContent>
|
||||
<UiSelectItem v-for="app in applications" :key="app.id" :value="String(app.id)">
|
||||
@@ -161,11 +161,11 @@ onMounted(() => {
|
||||
|
||||
<div class="space-y-2">
|
||||
<UiLabel for="cardType">
|
||||
{{ t('developer.cards.create.cardType') }}
|
||||
{{ t('admin.cards.create.cardType') }}
|
||||
</UiLabel>
|
||||
<UiSelect v-model="form.card_type_id" :disabled="!form.application_id">
|
||||
<UiSelectTrigger>
|
||||
<UiSelectValue :placeholder="t('developer.cards.create.selectCardType')" />
|
||||
<UiSelectValue :placeholder="t('admin.cards.create.selectCardType')" />
|
||||
</UiSelectTrigger>
|
||||
<UiSelectContent>
|
||||
<UiSelectItem v-for="type in filteredCardTypes" :key="type.id" :value="String(type.id)">
|
||||
@@ -174,13 +174,13 @@ onMounted(() => {
|
||||
</UiSelectContent>
|
||||
</UiSelect>
|
||||
<p v-if="form.application_id && filteredCardTypes.length === 0" class="text-xs text-muted-foreground">
|
||||
{{ t('developer.cards.create.noCardType') }}
|
||||
{{ t('admin.cards.create.noCardType') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<UiLabel for="count">
|
||||
{{ t('developer.cards.create.count') }}
|
||||
{{ t('admin.cards.create.count') }}
|
||||
</UiLabel>
|
||||
<div class="flex items-center gap-4">
|
||||
<UiNumberField v-model="form.count" :min="1" :max="1000" class="flex-1 max-w-[200px]">
|
||||
@@ -206,7 +206,7 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
{{ t('developer.cards.create.maxCount') }}
|
||||
{{ t('admin.cards.create.maxCount') }}
|
||||
</p>
|
||||
</div>
|
||||
</UiCardContent>
|
||||
@@ -218,30 +218,30 @@ onMounted(() => {
|
||||
<UiCardHeader>
|
||||
<UiCardTitle class="flex items-center gap-2">
|
||||
<Icon icon="lucide:receipt" class="size-5" />
|
||||
{{ t('developer.cards.create.preview') }}
|
||||
{{ t('admin.cards.create.preview') }}
|
||||
</UiCardTitle>
|
||||
</UiCardHeader>
|
||||
<UiCardContent class="space-y-4">
|
||||
<div class="space-y-3">
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-muted-foreground">{{ t('developer.cards.create.app') }}</span>
|
||||
<span class="text-muted-foreground">{{ t('admin.cards.create.app') }}</span>
|
||||
<span>{{ applications.find(a => String(a.id) === form.application_id)?.name || '-' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-muted-foreground">{{ t('developer.cards.create.type') }}</span>
|
||||
<span class="text-muted-foreground">{{ t('admin.cards.create.type') }}</span>
|
||||
<span>{{ selectedCardType?.name || '-' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-muted-foreground">{{ t('developer.cards.create.unitPrice') }}</span>
|
||||
<span class="text-muted-foreground">{{ t('admin.cards.create.unitPrice') }}</span>
|
||||
<span>¥{{ selectedCardType?.price?.toFixed(2) || '0.00' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-muted-foreground">{{ t('developer.cards.create.quantity') }}</span>
|
||||
<span>{{ form.count }} {{ t('developer.cards.create.units') }}</span>
|
||||
<span class="text-muted-foreground">{{ t('admin.cards.create.quantity') }}</span>
|
||||
<span>{{ form.count }} {{ t('admin.cards.create.units') }}</span>
|
||||
</div>
|
||||
<div class="border-t pt-3 mt-3">
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-muted-foreground">{{ t('developer.cards.create.totalAmount') }}</span>
|
||||
<span class="text-muted-foreground">{{ t('admin.cards.create.totalAmount') }}</span>
|
||||
<span class="text-xl font-bold text-primary">¥{{ totalCost.toFixed(2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -260,14 +260,14 @@ onMounted(() => {
|
||||
>
|
||||
<Icon v-if="saving" icon="lucide:loader-2" class="mr-2 h-4 w-4 animate-spin" />
|
||||
<Icon v-else icon="lucide:sparkles" class="mr-2 h-4 w-4" />
|
||||
{{ t('developer.cards.create.generateNow') }}
|
||||
{{ t('admin.cards.create.generateNow') }}
|
||||
</UiButton>
|
||||
<UiButton
|
||||
variant="outline"
|
||||
class="w-full"
|
||||
@click="router.back()"
|
||||
>
|
||||
{{ t('developer.cards.create.cancel') }}
|
||||
{{ t('admin.cards.create.cancel') }}
|
||||
</UiButton>
|
||||
</div>
|
||||
</UiCardContent>
|
||||
|
||||
Reference in New Issue
Block a user