|
|
@@ -25,7 +25,7 @@
|
|
|
/>
|
|
|
<Select
|
|
|
v-if="isAdmin"
|
|
|
- v-model="searchForm.teamId"
|
|
|
+ v-model="searchForm.agentId"
|
|
|
:options="teamOptions"
|
|
|
optionLabel="label"
|
|
|
optionValue="value"
|
|
|
@@ -34,13 +34,6 @@
|
|
|
class="w-32"
|
|
|
:showClear="true"
|
|
|
/>
|
|
|
- <InputText
|
|
|
- v-model="searchForm.agentName"
|
|
|
- placeholder="代理"
|
|
|
- size="small"
|
|
|
- class="w-32"
|
|
|
- @keyup.enter="handleSearch"
|
|
|
- />
|
|
|
<Select
|
|
|
v-model="searchForm.incomeType"
|
|
|
:options="incomeTypeOptions"
|
|
|
@@ -105,27 +98,15 @@
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
- <Column v-if="isAdmin" field="teamId" header="团队" style="min-width: 120px">
|
|
|
+ <Column v-if="isAdmin" field="agentId" header="团队" style="min-width: 120px">
|
|
|
<template #body="slotProps">
|
|
|
- <span v-if="slotProps.data.teamId" class="text-sm team-name-text">
|
|
|
- {{ getTeamName(slotProps.data.teamId) }}
|
|
|
+ <span v-if="slotProps.data.agentId" class="text-sm team-name-text">
|
|
|
+ {{ getTeamName(slotProps.data.agentId) }}
|
|
|
</span>
|
|
|
<span v-else class="text-gray-400 text-sm">-</span>
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
- <Column field="agentName" header="代理" style="min-width: 130px">
|
|
|
- <template #body="slotProps">
|
|
|
- <span
|
|
|
- class="font-medium agent-name-text copyable-text"
|
|
|
- :title="slotProps.data.agentName"
|
|
|
- @click="copyToClipboard(slotProps.data.agentName)"
|
|
|
- >
|
|
|
- {{ slotProps.data.agentName }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </Column>
|
|
|
-
|
|
|
<Column
|
|
|
field="incomeAmount"
|
|
|
header="收入金额"
|
|
|
@@ -149,21 +130,9 @@
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
- <Column field="video" header="影片" style="min-width: 200px; max-width: 260px">
|
|
|
- <template #body="slotProps">
|
|
|
- <span
|
|
|
- class="video-text copyable-text"
|
|
|
- :title="slotProps.data.video"
|
|
|
- @click="copyToClipboard(slotProps.data.video)"
|
|
|
- >
|
|
|
- {{ slotProps.data.video }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </Column>
|
|
|
-
|
|
|
<Column
|
|
|
- field="price"
|
|
|
- header="价格"
|
|
|
+ field="orderPrice"
|
|
|
+ header="订单价格"
|
|
|
style="min-width: 100px"
|
|
|
:pt="{
|
|
|
columnHeaderContent: {
|
|
|
@@ -172,7 +141,7 @@
|
|
|
}"
|
|
|
>
|
|
|
<template #body="slotProps">
|
|
|
- <span class="price-text">{{ formatAmount(slotProps.data.price) }} </span>
|
|
|
+ <span class="price-text">{{ formatAmount(slotProps.data.orderPrice) }} </span>
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
@@ -184,14 +153,14 @@
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
- <Column field="tipOrderId" header="订单号" style="min-width: 120px">
|
|
|
+ <Column field="orderNo" header="订单号" style="min-width: 120px">
|
|
|
<template #body="slotProps">
|
|
|
<span
|
|
|
class="font-mono text-sm order-id-text copyable-text"
|
|
|
- :title="slotProps.data.tipOrderId"
|
|
|
- @click="copyToClipboard(slotProps.data.tipOrderId)"
|
|
|
+ :title="slotProps.data.orderNo"
|
|
|
+ @click="copyToClipboard(slotProps.data.orderNo)"
|
|
|
>
|
|
|
- {{ slotProps.data.tipOrderId }}
|
|
|
+ {{ slotProps.data.orderNo }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</Column>
|
|
|
@@ -216,14 +185,6 @@
|
|
|
</template>
|
|
|
</Column>
|
|
|
|
|
|
- <Column field="source" header="来源" style="min-width: 100px; max-width: 160px">
|
|
|
- <template #body="slotProps">
|
|
|
- <span class="source-text">
|
|
|
- {{ slotProps.data.source }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </Column>
|
|
|
-
|
|
|
<Column field="createdAt" header="创建时间" style="min-width: 150px">
|
|
|
<template #body="slotProps">
|
|
|
<span class="text-sm">
|
|
|
@@ -279,8 +240,16 @@
|
|
|
<div class="p-fluid">
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
|
<div class="field">
|
|
|
- <label for="edit-agentName" class="font-medium text-sm mb-2 block">代理</label>
|
|
|
- <InputText id="edit-agentName" v-model="editForm.agentName" class="w-full" />
|
|
|
+ <label for="edit-agentId" class="font-medium text-sm mb-2 block">团队</label>
|
|
|
+ <Select
|
|
|
+ id="edit-agentId"
|
|
|
+ v-model="editForm.agentId"
|
|
|
+ :options="teamOptions.filter((option) => option.value !== null)"
|
|
|
+ optionLabel="label"
|
|
|
+ optionValue="value"
|
|
|
+ placeholder="选择团队"
|
|
|
+ class="w-full"
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
<div class="field">
|
|
|
@@ -309,19 +278,14 @@
|
|
|
class="w-full"
|
|
|
/>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="field">
|
|
|
- <label for="edit-video" class="font-medium text-sm mb-2 block">影片</label>
|
|
|
- <InputText id="edit-video" v-model="editForm.video" class="w-full" />
|
|
|
- </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="grid grid-cols-2 gap-4 mt-4">
|
|
|
<div class="field">
|
|
|
- <label for="edit-price" class="font-medium text-sm mb-2 block">价格</label>
|
|
|
+ <label for="edit-orderPrice" class="font-medium text-sm mb-2 block">订单价格</label>
|
|
|
<InputNumber
|
|
|
- id="edit-price"
|
|
|
- v-model="editForm.price"
|
|
|
+ id="edit-orderPrice"
|
|
|
+ v-model="editForm.orderPrice"
|
|
|
mode="decimal"
|
|
|
:min-fraction-digits="2"
|
|
|
:max-fraction-digits="2"
|
|
|
@@ -345,8 +309,8 @@
|
|
|
|
|
|
<div class="grid grid-cols-2 gap-4 mt-4">
|
|
|
<div class="field">
|
|
|
- <label for="edit-tipOrderId" class="font-medium text-sm mb-2 block">订单号</label>
|
|
|
- <InputText id="edit-tipOrderId" v-model="editForm.tipOrderId" class="w-full" />
|
|
|
+ <label for="edit-orderNo" class="font-medium text-sm mb-2 block">订单号</label>
|
|
|
+ <InputText id="edit-orderNo" v-model="editForm.orderNo" class="w-full" />
|
|
|
</div>
|
|
|
|
|
|
<div class="field">
|
|
|
@@ -362,18 +326,6 @@
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="grid grid-cols-2 gap-4 mt-4">
|
|
|
- <div class="field">
|
|
|
- <label for="edit-payNo" class="font-medium text-sm mb-2 block">支付单号</label>
|
|
|
- <InputText id="edit-payNo" v-model="editForm.payNo" class="w-full" />
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="field">
|
|
|
- <label for="edit-source" class="font-medium text-sm mb-2 block">来源</label>
|
|
|
- <InputText id="edit-source" v-model="editForm.source" class="w-full" />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
|
|
|
<template #footer>
|
|
|
@@ -429,23 +381,20 @@ const editDialog = ref(false)
|
|
|
const editLoading = ref(false)
|
|
|
const editForm = ref({
|
|
|
id: null,
|
|
|
- agentName: null,
|
|
|
+ agentId: null,
|
|
|
incomeAmount: null,
|
|
|
incomeType: null,
|
|
|
orderType: null,
|
|
|
- price: null,
|
|
|
- tipOrderId: null,
|
|
|
+ orderPrice: null,
|
|
|
+ orderNo: null,
|
|
|
payChannel: null,
|
|
|
- payNo: null,
|
|
|
- video: null,
|
|
|
- source: null
|
|
|
+ payNo: null
|
|
|
})
|
|
|
|
|
|
// 搜索表单
|
|
|
const searchForm = ref({
|
|
|
id: null,
|
|
|
- teamId: null,
|
|
|
- agentName: null,
|
|
|
+ agentId: null,
|
|
|
incomeType: null,
|
|
|
orderType: null,
|
|
|
payChannel: null,
|
|
|
@@ -483,7 +432,7 @@ const teamOptions = computed(() => {
|
|
|
const options = [{ label: '全部团队', value: null }]
|
|
|
if (teamStore.teams && teamStore.teams.length > 0) {
|
|
|
teamStore.teams.forEach((team) => {
|
|
|
- options.push({ label: team.name, value: team.id })
|
|
|
+ options.push({ label: team.name, value: team.userId })
|
|
|
})
|
|
|
}
|
|
|
return options
|
|
|
@@ -508,6 +457,13 @@ const getOrderTypeText = (type) => {
|
|
|
return OrderType[type] || type
|
|
|
}
|
|
|
|
|
|
+// 获取团队名称
|
|
|
+const getTeamName = (agentId) => {
|
|
|
+ if (!agentId || !teamStore.teams) return ''
|
|
|
+ const team = teamStore.teams.find((t) => t.userId === agentId)
|
|
|
+ return team ? team.name : `-`
|
|
|
+}
|
|
|
+
|
|
|
// 获取支付渠道文本
|
|
|
const getPayChannelText = (channel) => {
|
|
|
const channelMap = {
|
|
|
@@ -518,13 +474,6 @@ const getPayChannelText = (channel) => {
|
|
|
return channelMap[channel] || channel
|
|
|
}
|
|
|
|
|
|
-// 获取团队名称
|
|
|
-const getTeamName = (teamId) => {
|
|
|
- if (!teamId || !teamStore.teams) return ''
|
|
|
- const team = teamStore.teams.find((t) => t.id === teamId)
|
|
|
- return team ? team.name : `团队${teamId}`
|
|
|
-}
|
|
|
-
|
|
|
// 格式化金额
|
|
|
const formatAmount = (amount) => {
|
|
|
if (!amount) return '0.00'
|
|
|
@@ -550,27 +499,22 @@ const formatDateTime = (dateString) => {
|
|
|
const fetchData = async () => {
|
|
|
loading.value = true
|
|
|
try {
|
|
|
- // 根据用户角色确定teamId
|
|
|
- let teamId = undefined
|
|
|
+ // 根据用户角色确定agentId
|
|
|
+ let agentId = undefined
|
|
|
const userRole = userStore.userInfo?.role
|
|
|
|
|
|
if (userRole === 'admin') {
|
|
|
- // 管理员使用选择的teamId
|
|
|
- teamId = searchForm.value.teamId || undefined
|
|
|
- } else if (userRole === 'team') {
|
|
|
- // 队长不传teamId,直接调用list接口
|
|
|
- teamId = undefined
|
|
|
- } else if (userRole === 'user') {
|
|
|
- // 队员不传teamId,直接调用list接口
|
|
|
- teamId = undefined
|
|
|
+ // 管理员使用选择的agentId
|
|
|
+ agentId = searchForm.value.agentId || undefined
|
|
|
}
|
|
|
|
|
|
const response = await listIncome(
|
|
|
tableData.value.metadata.page,
|
|
|
tableData.value.metadata.size,
|
|
|
- teamId,
|
|
|
- searchForm.value.agentName || undefined,
|
|
|
+ agentId,
|
|
|
searchForm.value.incomeType || undefined,
|
|
|
+ searchForm.value.orderType || undefined,
|
|
|
+ searchForm.value.payChannel || undefined,
|
|
|
searchForm.value.startDate ? formatDateForAPI(searchForm.value.startDate) : undefined,
|
|
|
searchForm.value.endDate ? formatDateForAPI(searchForm.value.endDate) : undefined
|
|
|
)
|
|
|
@@ -604,8 +548,7 @@ const handleSearch = () => {
|
|
|
const handleRefresh = () => {
|
|
|
searchForm.value = {
|
|
|
id: null,
|
|
|
- teamId: null,
|
|
|
- agentName: null,
|
|
|
+ agentId: null,
|
|
|
incomeType: null,
|
|
|
orderType: null,
|
|
|
payChannel: null,
|
|
|
@@ -625,7 +568,7 @@ const formatDateForAPI = (date) => {
|
|
|
// 确认删除
|
|
|
const confirmDelete = (income) => {
|
|
|
confirm.require({
|
|
|
- message: `确定要删除收入记录 "${income.agentName}" 吗?`,
|
|
|
+ message: `确定要删除收入记录 ID: ${income.id} 吗?`,
|
|
|
header: '确认删除',
|
|
|
icon: 'pi pi-exclamation-triangle',
|
|
|
accept: () => deleteIncomeRecord(income.id)
|
|
|
@@ -671,16 +614,14 @@ const copyToClipboard = async (text) => {
|
|
|
const openEditDialog = (income) => {
|
|
|
editForm.value = {
|
|
|
id: income.id,
|
|
|
- agentName: income.agentName || null,
|
|
|
+ agentId: income.agentId || null,
|
|
|
incomeAmount: income.incomeAmount || null,
|
|
|
incomeType: income.incomeType || null,
|
|
|
orderType: income.orderType || null,
|
|
|
- price: income.price || null,
|
|
|
- tipOrderId: income.tipOrderId || null,
|
|
|
+ orderPrice: income.orderPrice || null,
|
|
|
+ orderNo: income.orderNo || null,
|
|
|
payChannel: income.payChannel || null,
|
|
|
- payNo: income.payNo || null,
|
|
|
- video: income.video || null,
|
|
|
- source: income.source || null
|
|
|
+ payNo: income.payNo || null
|
|
|
}
|
|
|
editDialog.value = true
|
|
|
}
|
|
|
@@ -755,13 +696,6 @@ onMounted(async () => {
|
|
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
|
}
|
|
|
|
|
|
-.agent-name-text {
|
|
|
- word-wrap: break-word;
|
|
|
- word-break: break-all;
|
|
|
- white-space: normal;
|
|
|
- line-height: 1.4;
|
|
|
-}
|
|
|
-
|
|
|
.amount-text {
|
|
|
color: #059669;
|
|
|
font-weight: 600;
|
|
|
@@ -817,20 +751,6 @@ onMounted(async () => {
|
|
|
line-height: 1.4;
|
|
|
}
|
|
|
|
|
|
-.video-text {
|
|
|
- word-wrap: break-word;
|
|
|
- word-break: break-all;
|
|
|
- white-space: normal;
|
|
|
- line-height: 1.4;
|
|
|
-}
|
|
|
-
|
|
|
-.source-text {
|
|
|
- word-wrap: break-word;
|
|
|
- word-break: break-all;
|
|
|
- white-space: normal;
|
|
|
- line-height: 1.4;
|
|
|
-}
|
|
|
-
|
|
|
.font-medium {
|
|
|
font-weight: 500;
|
|
|
}
|