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成员账单列表 // 查询BD成员账单列表
export const getBdMemberBillList = async (type) => { export const getBdMemberBillList = async (type) => {
try { try {
@ -72,37 +83,26 @@ export const getBdMemberBillList = async (type) => {
} }
} }
// 查询BD成员账单明细 // 查询BD历史记录
export const getBdMemberBillDetailList = async (teamId) => { export const getBdHistory = async () => {
try { try {
const response = await get(`/team/bd/member-bill/detail-list`, { teamId }) const response = await get(`/team/bd/history`)
return response return response
} catch (error) { } 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) console.error('error:' + error.response.errorMsg)
throw error throw error
} }
} }
// 查询BD团队月度收入汇总 // 查询BD Leader历史记录
export const getBdMonthlyIncome = async (bdUserId) => { export const getBdLeaderHistory = async () => {
try { try {
const response = await get(`/team/bd/monthly-income`, { bdUserId }) const response = await get(`/team/bd/leader/history`)
return response return response
} catch (error) { } 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) console.error('error:' + error.response.errorMsg)
throw error 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> <span>正在连接APP...</span>
</div> </div>
<!-- 用户信息 -->
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<div <div
style=" style="
@ -74,6 +75,7 @@
</div> </div>
</div> </div>
<!-- 可用收入 -->
<div <div
style=" style="
display: flex; display: flex;
@ -112,7 +114,7 @@
</div> </div>
</div> </div>
<!-- 收入 --> <!-- BD团队列表 & 收入 -->
<div <div
style=" style="
background-color: white; background-color: white;
@ -131,7 +133,7 @@
> >
<div style="font-weight: 700">BD</div> <div style="font-weight: 700">BD</div>
<div style="display: flex; justify-content: space-between; align-items: center"> <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 <img
src="../assets/icon/records.png" src="../assets/icon/records.png"
alt="" alt=""
@ -140,12 +142,14 @@
/> />
</div> </div>
<div style="font-size: 0.8em; font-weight: 600"> <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>
<!-- 成员列表 --> <!-- 成员列表 -->
<div <div
v-for="value in 3" v-for="BDInfo in BDData.memberBillList"
style=" style="
background-color: white; background-color: white;
padding: 16px; padding: 16px;
@ -169,7 +173,7 @@
" "
> >
<img <img
:src="''" :src="BDInfo.agentAvatar || ''"
alt="" alt=""
style=" style="
display: block; display: block;
@ -191,18 +195,22 @@
white-space: nowrap; white-space: nowrap;
" "
> >
aaaaa {{ BDInfo.agentName }}
</div> </div>
<div style="color: rgba(0, 0, 0, 0.4); font-size: 0.8em; font-weight: 500"> <div style="color: rgba(0, 0, 0, 0.4); font-size: 0.8em; font-weight: 500">
ID: 321654 ID: {{ BDInfo.agentAccount }}
</div> </div>
</div> </div>
<div <div
style="width: 40%; display: flex; flex-direction: column; justify-content: space-around" 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">
<div style="font-size: 0.8em; font-weight: 500">Recharge: $500</div> Salary: ${{ BDInfo.teamSalaryAmount }}
<div style="font-size: 0.8em; font-weight: 500">Host:8</div> </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> </div>
</div> </div>
@ -241,8 +249,12 @@
> >
<div> <div>
<div style="display: grid; gap: 4px"> <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">
<div style="font-size: 0.9em; font-weight: 600">Previous period income:$1000</div> Total income:${{ BDSalary.totalIncome }}
</div>
<div style="font-size: 0.9em; font-weight: 600">
Previous period income:${{ BDSalary.previousPeriodIncome }}
</div>
</div> </div>
</div> </div>
</div> </div>
@ -259,22 +271,28 @@
</div> </div>
</template> </template>
</historySalary> --> </historySalary> -->
<historySalary type="In Progress" long="true"> <historySalary
<template v-slot:content> v-for="income in BDSalary.incomeDetails"
<div>2025.10.16-2025.10.31:</div> type="In Progress"
<div style="font-size: 0.9em">Number of teams: 5</div> 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="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 style="font-size: 0.9em">BD income (salary): $12 (3%)</div>
</div> </div>
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between">
<div style="font-size: 0.9em">Team salary: $400</div> <div style="font-size: 0.9em">
<div style="font-size: 0.9em">BD income (salary): $12 (3%)</div> Team top-up: ${{ income.teamRechargeAmount }}
</div>
<div style="font-size: 0.9em">BD income (top-up): $12 (3%)</div>
</div> </div>
</template> </template>
</historySalary>
<historySalary type="Completed" v-for="value in 5" @showMore="showReportDetail()"> <template v-else v-slot:content>
<template v-slot:content>
<div>2025.10.16-2025.10.31:</div> <div>2025.10.16-2025.10.31:</div>
<div style="font-size: 0.9em">Number Of Teams: 5</div> <div style="font-size: 0.9em">Number Of Teams: 5</div>
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between">
@ -283,6 +301,16 @@
</div> </div>
</template> </template>
</historySalary> </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> </div>
</div> </div>
@ -381,12 +409,13 @@
<script setup> <script setup>
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue' import MobileHeader from '@/components/MobileHeader.vue'
import { getAgentMonthLastTarget, getAgentMonthTarget, getBdAgentList } from '../api/teamBill.js' import { getAgentMonthLastTarget, getAgentMonthTarget, getBdAgentList } from '@/api/teamBill.js'
import { getBdMemberBillList, getBdHistory } from '@/api/bdCenter.js'
import { getTeamId } from '@/utils/userStore.js' import { getTeamId } from '@/utils/userStore.js'
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js' import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
import { isInApp } from '@/utils/appBridge.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 maskLayer from '@/components/MaskLayer.vue'
import historySalary from '@/components/historySalary.vue' import historySalary from '@/components/historySalary.vue'
@ -396,6 +425,8 @@ const router = useRouter()
const teamMemberCount = ref(0) const teamMemberCount = ref(0)
const showHistory = ref(false) // const showHistory = ref(false) //
const showMore = ref(false) // const showMore = ref(false) //
const BDSalary = ref({}) //BD
const BDData = ref({}) //BD
const defaultAvatarUrl = (e) => { const defaultAvatarUrl = (e) => {
console.log('头像资源出错') console.log('头像资源出错')
@ -451,8 +482,38 @@ const { appConnected, userInfo, salaryInfo, handleImageError, getAvatarPlacehold
onDataLoaded: () => {}, 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(() => { onMounted(() => {
clearSelectedPayee() // clearSelectedPayee() //
initData()
}) })
</script> </script>