|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div class="rounded-lg p-4 bg-[var(--p-content-background)]">
|
|
|
<DataTable
|
|
|
+ v-if="isAdmin"
|
|
|
:value="tableData.content"
|
|
|
:paginator="true"
|
|
|
paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown JumpToPageInput"
|
|
|
@@ -116,6 +117,31 @@
|
|
|
</Column>
|
|
|
</DataTable>
|
|
|
|
|
|
+ <div v-else-if="isTeam && teamData" class="flex flex-col items-center justify-center py-4">
|
|
|
+ <div class="w-full max-w-xl p-10">
|
|
|
+ <div class="text-2xl font-extrabold mb-2 text-center text-blue-700 tracking-wide">我的团队信息</div>
|
|
|
+ <div class="border-b border-gray-200 mb-6"></div>
|
|
|
+ <div class="grid grid-cols-2 gap-y-6 gap-x-4">
|
|
|
+ <div class="flex flex-col items-start">
|
|
|
+ <span class="text-gray-500 text-base font-medium mb-1">团队名称</span>
|
|
|
+ <span class="text-lg font-bold text-gray-900">{{ teamData.name }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="flex flex-col items-start">
|
|
|
+ <span class="text-gray-500 text-base font-medium mb-1">佣金比例</span>
|
|
|
+ <span class="text-lg font-bold text-purple-700">{{ teamData.commissionRate }}%</span>
|
|
|
+ </div>
|
|
|
+ <div class="flex flex-col items-start">
|
|
|
+ <span class="text-gray-500 text-base font-medium mb-1">总营收</span>
|
|
|
+ <span class="text-2xl font-extrabold text-blue-600">¥{{ formatAmount(teamData.totalRevenue) }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="flex flex-col items-start">
|
|
|
+ <span class="text-gray-500 text-base font-medium mb-1">今日营收</span>
|
|
|
+ <span class="text-2xl font-extrabold text-green-600">¥{{ formatAmount(teamData.todayRevenue) }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
|
<Dialog
|
|
|
v-model:visible="editDialog"
|
|
|
@@ -181,8 +207,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, onMounted } from 'vue'
|
|
|
-import { useDateFormat } from '@vueuse/core'
|
|
|
+import { ref, onMounted, inject, computed } from 'vue'
|
|
|
import Button from 'primevue/button'
|
|
|
import Column from 'primevue/column'
|
|
|
import DataTable from 'primevue/datatable'
|
|
|
@@ -197,6 +222,9 @@ import { listTeams, createTeam, updateTeam, deleteTeam } from '@/services/api'
|
|
|
const toast = useToast()
|
|
|
const confirm = useConfirm()
|
|
|
|
|
|
+const isAdmin = inject('isAdmin')
|
|
|
+const isTeam = inject('isTeam')
|
|
|
+
|
|
|
// 表格数据
|
|
|
const tableData = ref({
|
|
|
content: [],
|
|
|
@@ -434,6 +462,8 @@ const saveEdit = async () => {
|
|
|
onMounted(() => {
|
|
|
fetchData()
|
|
|
})
|
|
|
+
|
|
|
+const teamData = computed(() => tableData.value?.content?.[0] || null)
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|