feat(BD中心): 对接BD成员账单接口和历史接口

This commit is contained in:
hzj 2025-10-30 22:15:53 +08:00
parent 4ee7b18476
commit 695e750841
2 changed files with 105 additions and 44 deletions

View File

@ -60,6 +60,17 @@ export const cancelInvite = async (userId) => {
}
}
// 提交提现申请
export const withdrawApply = async (data) => {
try {
const response = await post('/team/bd/withdraw/apply', data)
return response
} catch (error) {
console.error('Failed to fetch withdraw apply:', error)
throw error
}
}
// 查询BD成员账单列表
export const getBdMemberBillList = async (type) => {
try {
@ -72,37 +83,26 @@ export const getBdMemberBillList = async (type) => {
}
}
// 查询BD成员账单明细
export const getBdMemberBillDetailList = async (teamId) => {
// 查询BD历史记录
export const getBdHistory = async () => {
try {
const response = await get(`/team/bd/member-bill/detail-list`, { teamId })
const response = await get(`/team/bd/history`)
return response
} catch (error) {
console.error('Failed to fetch BD member bill detail list:', error)
console.error('Failed to fetch BD history:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 查询BD团队月度收入汇总
export const getBdMonthlyIncome = async (bdUserId) => {
// 查询BD Leader历史记录
export const getBdLeaderHistory = async () => {
try {
const response = await get(`/team/bd/monthly-income`, { bdUserId })
const response = await get(`/team/bd/leader/history`)
return response
} catch (error) {
console.error('Failed to fetch BD monthly income:', error)
console.error('Failed to fetch BD leader history:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}
// 提交提现申请
export const withdrawApply = async (data) => {
try {
const response = await post('/team/bd/withdraw/apply', data)
return response
} catch (error) {
console.error('Failed to fetch withdraw apply:', error)
throw error
}
}

View File

@ -29,6 +29,7 @@
<span>正在连接APP...</span>
</div>
<!-- 用户信息 -->
<div style="display: flex; align-items: center">
<div
style="
@ -74,6 +75,7 @@
</div>
</div>
<!-- 可用收入 -->
<div
style="
display: flex;
@ -112,7 +114,7 @@
</div>
</div>
<!-- 收入 -->
<!-- BD团队列表 & 收入 -->
<div
style="
background-color: white;
@ -131,7 +133,7 @@
>
<div style="font-weight: 700">BD</div>
<div style="display: flex; justify-content: space-between; align-items: center">
<div style="font-weight: 600">2025.10.01-2025.10.15:</div>
<div style="font-weight: 600">{{ BDData.billTitle }}</div>
<img
src="../assets/icon/records.png"
alt=""
@ -140,12 +142,14 @@
/>
</div>
<div style="font-size: 0.8em; font-weight: 600">
Team total recharge: $400 Team total salary: $400
Team total recharge: ${{ BDData.totalRecharge }} Team total salary: ${{
BDData.totalSalary
}}
</div>
<!-- 成员列表 -->
<div
v-for="value in 3"
v-for="BDInfo in BDData.memberBillList"
style="
background-color: white;
padding: 16px;
@ -169,7 +173,7 @@
"
>
<img
:src="''"
:src="BDInfo.agentAvatar || ''"
alt=""
style="
display: block;
@ -191,18 +195,22 @@
white-space: nowrap;
"
>
aaaaa
{{ BDInfo.agentName }}
</div>
<div style="color: rgba(0, 0, 0, 0.4); font-size: 0.8em; font-weight: 500">
ID: 321654
ID: {{ BDInfo.agentAccount }}
</div>
</div>
<div
style="width: 40%; display: flex; flex-direction: column; justify-content: space-around"
>
<div style="font-size: 0.8em; font-weight: 500">Salary: $100</div>
<div style="font-size: 0.8em; font-weight: 500">Recharge: $500</div>
<div style="font-size: 0.8em; font-weight: 500">Host:8</div>
<div style="font-size: 0.8em; font-weight: 500">
Salary: ${{ BDInfo.teamSalaryAmount }}
</div>
<div style="font-size: 0.8em; font-weight: 500">
Recharge: ${{ BDInfo.teamRechargeAmount }}
</div>
<div style="font-size: 0.8em; font-weight: 500">Host:{{ BDInfo.teamMemberCount }}</div>
</div>
</div>
</div>
@ -241,8 +249,12 @@
>
<div>
<div style="display: grid; gap: 4px">
<div style="font-size: 0.9em; font-weight: 600">Total income:$1000</div>
<div style="font-size: 0.9em; font-weight: 600">Previous period income:$1000</div>
<div style="font-size: 0.9em; font-weight: 600">
Total income:${{ BDSalary.totalIncome }}
</div>
<div style="font-size: 0.9em; font-weight: 600">
Previous period income:${{ BDSalary.previousPeriodIncome }}
</div>
</div>
</div>
</div>
@ -259,22 +271,28 @@
</div>
</template>
</historySalary> -->
<historySalary type="In Progress" long="true">
<template v-slot:content>
<div>2025.10.16-2025.10.31:</div>
<div style="font-size: 0.9em">Number of teams: 5</div>
<historySalary
v-for="income in BDSalary.incomeDetails"
type="In Progress"
long="true"
@showMore="showReportDetail()"
>
<template v-if="income.statusText == 'In Progress'" v-slot:content>
<div>{{ income.billTitle }}:</div>
<div style="font-size: 0.9em">Number of teams: {{ income.agencyNumber }}</div>
<div style="display: flex; justify-content: space-between">
<div style="font-size: 0.9em">Team salary: $400</div>
<div style="font-size: 0.9em">Team salary: ${{ income.teamSalaryAmount }}</div>
<div style="font-size: 0.9em">BD income (salary): $12 (3%)</div>
</div>
<div style="display: flex; justify-content: space-between">
<div style="font-size: 0.9em">Team salary: $400</div>
<div style="font-size: 0.9em">BD income (salary): $12 (3%)</div>
<div style="font-size: 0.9em">
Team top-up: ${{ income.teamRechargeAmount }}
</div>
<div style="font-size: 0.9em">BD income (top-up): $12 (3%)</div>
</div>
</template>
</historySalary>
<historySalary type="Completed" v-for="value in 5" @showMore="showReportDetail()">
<template v-slot:content>
<template v-else v-slot:content>
<div>2025.10.16-2025.10.31:</div>
<div style="font-size: 0.9em">Number Of Teams: 5</div>
<div style="display: flex; justify-content: space-between">
@ -283,6 +301,16 @@
</div>
</template>
</historySalary>
<!-- <historySalary type="Completed" v-for="value in 5" @showMore="showReportDetail()">
<template v-slot:content>
<div>2025.10.16-2025.10.31:</div>
<div style="font-size: 0.9em">Number Of Teams: 5</div>
<div style="display: flex; justify-content: space-between">
<div style="font-size: 0.9em">Number Of Teams: 5</div>
<div style="font-size: 0.9em">BD income (salary): $60 (6%)</div>
</div>
</template>
</historySalary> -->
</div>
</div>
</div>
@ -381,12 +409,13 @@
<script setup>
import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue'
import { getAgentMonthLastTarget, getAgentMonthTarget, getBdAgentList } from '../api/teamBill.js'
import MobileHeader from '@/components/MobileHeader.vue'
import { getAgentMonthLastTarget, getAgentMonthTarget, getBdAgentList } from '@/api/teamBill.js'
import { getBdMemberBillList, getBdHistory } from '@/api/bdCenter.js'
import { getTeamId } from '@/utils/userStore.js'
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
import { isInApp } from '@/utils/appBridge.js'
import { clearSelectedPayee } from '../utils/payeeStore.js'
import { clearSelectedPayee } from '@/utils/payeeStore.js'
import maskLayer from '@/components/MaskLayer.vue'
import historySalary from '@/components/historySalary.vue'
@ -396,6 +425,8 @@ const router = useRouter()
const teamMemberCount = ref(0)
const showHistory = ref(false) //
const showMore = ref(false) //
const BDSalary = ref({}) //BD
const BDData = ref({}) //BD
const defaultAvatarUrl = (e) => {
console.log('头像资源出错')
@ -451,8 +482,38 @@ const { appConnected, userInfo, salaryInfo, handleImageError, getAvatarPlacehold
onDataLoaded: () => {},
})
// BD
const apiGetBdMemberBillList = async () => {
const res = await getBdMemberBillList('BD')
if (res.status && res.body) {
//
// console.log('BD member bill list:', res.body)
BDData.value = res.body || {}
}
}
// BD
const apiGetBdHistory = async () => {
const res = await getBdHistory()
if (res.status && res.body) {
//
console.log('BD History:', res.body)
BDSalary.value = res.body || {}
}
}
//
const initData = async () => {
//
apiGetBdMemberBillList() //BD
apiGetBdHistory() //BD
// apiGetBdMemberBillDetailList(456)
// apiGetBdMonthlyIncome(789)
}
onMounted(() => {
clearSelectedPayee() //
initData()
})
</script>