平台配置增加feifei入口
This commit is contained in:
@@ -57,6 +57,7 @@ const platformConfigNavItems = computed<AdminNavItem[]>(() => {
|
||||
{ to: '/admin/platform-shops?tab=ninetyone', label: '91卡券', icon: Connection },
|
||||
{ to: '/admin/platform-shops?tab=notifications', label: '内部通知', icon: Bell },
|
||||
{ to: '/admin/platform-shops?tab=kuaishouEticket', label: '快手小店核销', icon: Tickets },
|
||||
{ to: '/admin/platform-shops?tab=kuaishouFeifei', label: 'kuaishou-feifei', icon: Tickets },
|
||||
{
|
||||
to: '/admin/platform-shops?tab=cloudtentacles',
|
||||
label: 'cloudtentacles',
|
||||
|
||||
@@ -6,11 +6,13 @@ import { RefreshRight } from '@element-plus/icons-vue'
|
||||
import AdminPageHeader from '@/components/admin/AdminPageHeader.vue'
|
||||
import {
|
||||
fetchAdminCloudtentaclesSourceConfig,
|
||||
fetchAdminKuaishouFeifeiConfig,
|
||||
fetchAdminKuaishouEticketSourceConfig,
|
||||
fetchAdminNotificationConfig,
|
||||
fetchAdminScheduledJobsConfig,
|
||||
} from '@/services/admin'
|
||||
import { hasAdminRole } from '@/utils/admin-auth'
|
||||
import AdminKuaishouFeifeiFulfillmentView from '../fulfillment/kuaishou-feifei/AdminKuaishouFeifeiFulfillmentView.vue'
|
||||
import AdminPlatformCloudtentaclesSection from './components/cloudtentacles/AdminPlatformCloudtentaclesSection.vue'
|
||||
import AdminPlatformNinetyoneSection from './components/AdminPlatformNinetyoneSection.vue'
|
||||
import AdminPlatformNotificationSection from './components/notification/AdminPlatformNotificationSection.vue'
|
||||
@@ -20,12 +22,19 @@ import { useAdminNinetyonePlatform } from './composables/useAdminNinetyonePlatfo
|
||||
import { useAdminNotificationPlatform } from './composables/useAdminNotificationPlatform'
|
||||
import { useAdminKuaishouEticketPlatform } from './composables/useAdminKuaishouEticketPlatform'
|
||||
import type { PlatformTab } from './composables/types'
|
||||
import type { AdminKuaishouFeifeiConfigResponse } from '@/types/admin'
|
||||
|
||||
const loading = ref(true)
|
||||
const errorMessage = ref('')
|
||||
const route = useRoute()
|
||||
|
||||
const platformTabs: PlatformTab[] = ['ninetyone', 'notifications', 'kuaishouEticket', 'cloudtentacles']
|
||||
const platformTabs: PlatformTab[] = [
|
||||
'ninetyone',
|
||||
'notifications',
|
||||
'kuaishouEticket',
|
||||
'kuaishouFeifei',
|
||||
'cloudtentacles',
|
||||
]
|
||||
|
||||
function normalizePlatformTab(value: unknown): PlatformTab {
|
||||
return typeof value === 'string' && platformTabs.includes(value as PlatformTab)
|
||||
@@ -34,6 +43,7 @@ function normalizePlatformTab(value: unknown): PlatformTab {
|
||||
}
|
||||
|
||||
const activePlatform = computed(() => normalizePlatformTab(route.query.tab))
|
||||
const kuaishouFeifeiConfig = ref<AdminKuaishouFeifeiConfigResponse | null>(null)
|
||||
|
||||
const {
|
||||
ninetyoneLoading,
|
||||
@@ -149,6 +159,17 @@ const {
|
||||
} = useAdminCloudtentaclesPlatform()
|
||||
|
||||
const overviewCards = computed(() => {
|
||||
const feifeiSource = kuaishouFeifeiConfig.value?.source
|
||||
const feifeiEffective = kuaishouFeifeiConfig.value?.effective
|
||||
const feifeiEnabledRuleCount = (feifeiSource?.productRules || []).filter(
|
||||
(rule) => rule.enabled !== false,
|
||||
).length
|
||||
const feifeiReady = Boolean(
|
||||
feifeiEffective?.enabled &&
|
||||
feifeiEffective.hasAppKey &&
|
||||
feifeiEffective.hasAppSecret &&
|
||||
feifeiEnabledRuleCount > 0,
|
||||
)
|
||||
const cards = [
|
||||
{
|
||||
key: 'notifications',
|
||||
@@ -181,6 +202,17 @@ const overviewCards = computed(() => {
|
||||
}`,
|
||||
status: kuaishouEticketStats.value.cookieReadyCount > 0 ? '已就绪' : '待配置',
|
||||
},
|
||||
{
|
||||
key: 'kuaishouFeifei',
|
||||
label: 'kuaishou-feifei',
|
||||
tag: '补充发货平台',
|
||||
value: feifeiEnabledRuleCount,
|
||||
unit: '启用规则',
|
||||
meta: `API ${
|
||||
feifeiEffective?.hasAppKey && feifeiEffective?.hasAppSecret ? '已配置' : '待补全'
|
||||
} · 总规则 ${feifeiSource?.productRules.length || 0} 条`,
|
||||
status: feifeiReady ? '已就绪' : '待配置',
|
||||
},
|
||||
{
|
||||
key: 'cloudtentacles',
|
||||
label: 'cloudtentacles',
|
||||
@@ -216,17 +248,20 @@ async function loadConfigs() {
|
||||
notificationResponse,
|
||||
scheduledJobsResponse,
|
||||
kuaishouEticketResponse,
|
||||
kuaishouFeifeiResponse,
|
||||
cloudtentaclesResponse,
|
||||
] = await Promise.all([
|
||||
fetchAdminNotificationConfig(),
|
||||
fetchAdminScheduledJobsConfig(),
|
||||
fetchAdminKuaishouEticketSourceConfig(),
|
||||
fetchAdminKuaishouFeifeiConfig(),
|
||||
fetchAdminCloudtentaclesSourceConfig(),
|
||||
])
|
||||
|
||||
hydrateNotificationConfig(notificationResponse.data)
|
||||
hydrateScheduledJobsConfig(scheduledJobsResponse.data)
|
||||
hydrateKuaishouEticketConfig(kuaishouEticketResponse.data)
|
||||
kuaishouFeifeiConfig.value = kuaishouFeifeiResponse.data
|
||||
hydrateCloudtentaclesConfig(cloudtentaclesResponse.data)
|
||||
await loadNinetyoneOrders(1)
|
||||
} catch (error) {
|
||||
@@ -357,6 +392,10 @@ onMounted(loadConfigs)
|
||||
:handle-kuaishou-eticket-consume="handleKuaishouEticketConsume"
|
||||
/>
|
||||
|
||||
<AdminKuaishouFeifeiFulfillmentView
|
||||
v-else-if="activePlatform === 'kuaishouFeifei'"
|
||||
/>
|
||||
|
||||
<AdminPlatformCloudtentaclesSection
|
||||
v-else-if="activePlatform === 'cloudtentacles'"
|
||||
:cloudtentacles-file-path="cloudtentaclesFilePath"
|
||||
|
||||
@@ -2,6 +2,7 @@ export type PlatformTab =
|
||||
| 'notifications'
|
||||
| 'ninetyone'
|
||||
| 'kuaishouEticket'
|
||||
| 'kuaishouFeifei'
|
||||
| 'cloudtentacles'
|
||||
|
||||
export type EditableKuaishouEticketShop = {
|
||||
|
||||
Reference in New Issue
Block a user