平台配置增加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=ninetyone', label: '91卡券', icon: Connection },
|
||||||
{ to: '/admin/platform-shops?tab=notifications', label: '内部通知', icon: Bell },
|
{ to: '/admin/platform-shops?tab=notifications', label: '内部通知', icon: Bell },
|
||||||
{ to: '/admin/platform-shops?tab=kuaishouEticket', label: '快手小店核销', icon: Tickets },
|
{ 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',
|
to: '/admin/platform-shops?tab=cloudtentacles',
|
||||||
label: 'cloudtentacles',
|
label: 'cloudtentacles',
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import { RefreshRight } from '@element-plus/icons-vue'
|
|||||||
import AdminPageHeader from '@/components/admin/AdminPageHeader.vue'
|
import AdminPageHeader from '@/components/admin/AdminPageHeader.vue'
|
||||||
import {
|
import {
|
||||||
fetchAdminCloudtentaclesSourceConfig,
|
fetchAdminCloudtentaclesSourceConfig,
|
||||||
|
fetchAdminKuaishouFeifeiConfig,
|
||||||
fetchAdminKuaishouEticketSourceConfig,
|
fetchAdminKuaishouEticketSourceConfig,
|
||||||
fetchAdminNotificationConfig,
|
fetchAdminNotificationConfig,
|
||||||
fetchAdminScheduledJobsConfig,
|
fetchAdminScheduledJobsConfig,
|
||||||
} from '@/services/admin'
|
} from '@/services/admin'
|
||||||
import { hasAdminRole } from '@/utils/admin-auth'
|
import { hasAdminRole } from '@/utils/admin-auth'
|
||||||
|
import AdminKuaishouFeifeiFulfillmentView from '../fulfillment/kuaishou-feifei/AdminKuaishouFeifeiFulfillmentView.vue'
|
||||||
import AdminPlatformCloudtentaclesSection from './components/cloudtentacles/AdminPlatformCloudtentaclesSection.vue'
|
import AdminPlatformCloudtentaclesSection from './components/cloudtentacles/AdminPlatformCloudtentaclesSection.vue'
|
||||||
import AdminPlatformNinetyoneSection from './components/AdminPlatformNinetyoneSection.vue'
|
import AdminPlatformNinetyoneSection from './components/AdminPlatformNinetyoneSection.vue'
|
||||||
import AdminPlatformNotificationSection from './components/notification/AdminPlatformNotificationSection.vue'
|
import AdminPlatformNotificationSection from './components/notification/AdminPlatformNotificationSection.vue'
|
||||||
@@ -20,12 +22,19 @@ import { useAdminNinetyonePlatform } from './composables/useAdminNinetyonePlatfo
|
|||||||
import { useAdminNotificationPlatform } from './composables/useAdminNotificationPlatform'
|
import { useAdminNotificationPlatform } from './composables/useAdminNotificationPlatform'
|
||||||
import { useAdminKuaishouEticketPlatform } from './composables/useAdminKuaishouEticketPlatform'
|
import { useAdminKuaishouEticketPlatform } from './composables/useAdminKuaishouEticketPlatform'
|
||||||
import type { PlatformTab } from './composables/types'
|
import type { PlatformTab } from './composables/types'
|
||||||
|
import type { AdminKuaishouFeifeiConfigResponse } from '@/types/admin'
|
||||||
|
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const platformTabs: PlatformTab[] = ['ninetyone', 'notifications', 'kuaishouEticket', 'cloudtentacles']
|
const platformTabs: PlatformTab[] = [
|
||||||
|
'ninetyone',
|
||||||
|
'notifications',
|
||||||
|
'kuaishouEticket',
|
||||||
|
'kuaishouFeifei',
|
||||||
|
'cloudtentacles',
|
||||||
|
]
|
||||||
|
|
||||||
function normalizePlatformTab(value: unknown): PlatformTab {
|
function normalizePlatformTab(value: unknown): PlatformTab {
|
||||||
return typeof value === 'string' && platformTabs.includes(value as 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 activePlatform = computed(() => normalizePlatformTab(route.query.tab))
|
||||||
|
const kuaishouFeifeiConfig = ref<AdminKuaishouFeifeiConfigResponse | null>(null)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
ninetyoneLoading,
|
ninetyoneLoading,
|
||||||
@@ -149,6 +159,17 @@ const {
|
|||||||
} = useAdminCloudtentaclesPlatform()
|
} = useAdminCloudtentaclesPlatform()
|
||||||
|
|
||||||
const overviewCards = computed(() => {
|
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 = [
|
const cards = [
|
||||||
{
|
{
|
||||||
key: 'notifications',
|
key: 'notifications',
|
||||||
@@ -181,6 +202,17 @@ const overviewCards = computed(() => {
|
|||||||
}`,
|
}`,
|
||||||
status: kuaishouEticketStats.value.cookieReadyCount > 0 ? '已就绪' : '待配置',
|
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',
|
key: 'cloudtentacles',
|
||||||
label: 'cloudtentacles',
|
label: 'cloudtentacles',
|
||||||
@@ -216,17 +248,20 @@ async function loadConfigs() {
|
|||||||
notificationResponse,
|
notificationResponse,
|
||||||
scheduledJobsResponse,
|
scheduledJobsResponse,
|
||||||
kuaishouEticketResponse,
|
kuaishouEticketResponse,
|
||||||
|
kuaishouFeifeiResponse,
|
||||||
cloudtentaclesResponse,
|
cloudtentaclesResponse,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
fetchAdminNotificationConfig(),
|
fetchAdminNotificationConfig(),
|
||||||
fetchAdminScheduledJobsConfig(),
|
fetchAdminScheduledJobsConfig(),
|
||||||
fetchAdminKuaishouEticketSourceConfig(),
|
fetchAdminKuaishouEticketSourceConfig(),
|
||||||
|
fetchAdminKuaishouFeifeiConfig(),
|
||||||
fetchAdminCloudtentaclesSourceConfig(),
|
fetchAdminCloudtentaclesSourceConfig(),
|
||||||
])
|
])
|
||||||
|
|
||||||
hydrateNotificationConfig(notificationResponse.data)
|
hydrateNotificationConfig(notificationResponse.data)
|
||||||
hydrateScheduledJobsConfig(scheduledJobsResponse.data)
|
hydrateScheduledJobsConfig(scheduledJobsResponse.data)
|
||||||
hydrateKuaishouEticketConfig(kuaishouEticketResponse.data)
|
hydrateKuaishouEticketConfig(kuaishouEticketResponse.data)
|
||||||
|
kuaishouFeifeiConfig.value = kuaishouFeifeiResponse.data
|
||||||
hydrateCloudtentaclesConfig(cloudtentaclesResponse.data)
|
hydrateCloudtentaclesConfig(cloudtentaclesResponse.data)
|
||||||
await loadNinetyoneOrders(1)
|
await loadNinetyoneOrders(1)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -357,6 +392,10 @@ onMounted(loadConfigs)
|
|||||||
:handle-kuaishou-eticket-consume="handleKuaishouEticketConsume"
|
:handle-kuaishou-eticket-consume="handleKuaishouEticketConsume"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<AdminKuaishouFeifeiFulfillmentView
|
||||||
|
v-else-if="activePlatform === 'kuaishouFeifei'"
|
||||||
|
/>
|
||||||
|
|
||||||
<AdminPlatformCloudtentaclesSection
|
<AdminPlatformCloudtentaclesSection
|
||||||
v-else-if="activePlatform === 'cloudtentacles'"
|
v-else-if="activePlatform === 'cloudtentacles'"
|
||||||
:cloudtentacles-file-path="cloudtentaclesFilePath"
|
:cloudtentacles-file-path="cloudtentaclesFilePath"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ export type PlatformTab =
|
|||||||
| 'notifications'
|
| 'notifications'
|
||||||
| 'ninetyone'
|
| 'ninetyone'
|
||||||
| 'kuaishouEticket'
|
| 'kuaishouEticket'
|
||||||
|
| 'kuaishouFeifei'
|
||||||
| 'cloudtentacles'
|
| 'cloudtentacles'
|
||||||
|
|
||||||
export type EditableKuaishouEticketShop = {
|
export type EditableKuaishouEticketShop = {
|
||||||
|
|||||||
Reference in New Issue
Block a user