feat(bd和bdleader): 更改获取可用余额的接口
This commit is contained in:
parent
3b0e5f7316
commit
3c48826050
@ -353,3 +353,18 @@ export const apiGetWithdrawRecords = async () => {
|
|||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前余额
|
||||||
|
* @returns {Promise} 返回当前的余额信息
|
||||||
|
*/
|
||||||
|
export const apiGetBankBalance = async (salaryType) => {
|
||||||
|
try {
|
||||||
|
const response = await get(`/wallet/salary-account/balance?salaryType=${salaryType}`)
|
||||||
|
return response
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch get all withdraw records:', error)
|
||||||
|
console.error('error:' + error.response.errorMsg)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
@click="gotoIncome"
|
@click="gotoIncome"
|
||||||
>
|
>
|
||||||
<span style="font-weight: 600; color: #1f2937">
|
<span style="font-weight: 600; color: #1f2937">
|
||||||
{{ t('available_salaries') }} ${{ salaryInfo.currentSalary }}
|
{{ t('available_salaries') }} ${{ salaryInfo?.availableBalance || 0 }}
|
||||||
</span>
|
</span>
|
||||||
<img
|
<img
|
||||||
src="../../assets/icon/arrow.png"
|
src="../../assets/icon/arrow.png"
|
||||||
@ -444,16 +444,17 @@
|
|||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
|
||||||
import { getAgentMonthLastTarget, getAgentMonthTarget, getBdAgentList } from '@/api/teamBill.js'
|
|
||||||
import { getBdMemberBillList, getBdHistory, getBdHistoryMore } from '@/api/bdCenter.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 { setDocumentDirection } from '@/locales/i18n'
|
||||||
|
|
||||||
|
import { getBdMemberBillList, getBdHistory, getBdHistoryMore } from '@/api/bdCenter.js'
|
||||||
|
import { apiGetBankBalance } from '@/api/wallet.js'
|
||||||
|
|
||||||
|
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||||
import maskLayer from '@/components/MaskLayer.vue'
|
import maskLayer from '@/components/MaskLayer.vue'
|
||||||
import historySalary from '@/components/historySalary.vue'
|
import historySalary from '@/components/historySalary.vue'
|
||||||
import { setDocumentDirection } from '@/locales/i18n'
|
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -470,6 +471,8 @@ const BDSalary = ref({}) //BD历史收入
|
|||||||
const BDSalaryMore = ref({}) //BD历史收入更多
|
const BDSalaryMore = ref({}) //BD历史收入更多
|
||||||
const BDData = ref({}) //BD成员数据
|
const BDData = ref({}) //BD成员数据
|
||||||
|
|
||||||
|
const salaryInfo = ref({}) //钱包信息
|
||||||
|
|
||||||
const defaultAvatarUrl = (e) => {
|
const defaultAvatarUrl = (e) => {
|
||||||
console.log('头像资源出错')
|
console.log('头像资源出错')
|
||||||
e.target.onerror = null //防止循环
|
e.target.onerror = null //防止循环
|
||||||
@ -513,9 +516,19 @@ const transfer = () => {
|
|||||||
router.push('/transfer')
|
router.push('/transfer')
|
||||||
}
|
}
|
||||||
|
|
||||||
const { appConnected, userInfo, salaryInfo, handleImageError, getAvatarPlaceholder } =
|
// 查询可用余额
|
||||||
|
const getBankBalance = async () => {
|
||||||
|
const res = await apiGetBankBalance('BD_SALARY')
|
||||||
|
if (res.status && res.body) {
|
||||||
|
// 处理返回的数据
|
||||||
|
salaryInfo.value = res.body || {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { appConnected, userInfo, handleImageError, getAvatarPlaceholder } =
|
||||||
usePageInitializationWithConfig('BD_CENTER', {
|
usePageInitializationWithConfig('BD_CENTER', {
|
||||||
needsTeamInfo: true,
|
needsTeamInfo: true,
|
||||||
|
needsBankBalance: false,
|
||||||
onDataLoaded: () => {},
|
onDataLoaded: () => {},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -557,6 +570,7 @@ const initData = async () => {
|
|||||||
// 示例调用方式
|
// 示例调用方式
|
||||||
apiGetBdMemberBillList() //BD成员账单列表
|
apiGetBdMemberBillList() //BD成员账单列表
|
||||||
apiGetBdHistory() //BD历史记录
|
apiGetBdHistory() //BD历史记录
|
||||||
|
getBankBalance() // 查询可用余额
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -87,7 +87,7 @@
|
|||||||
@click="gotoIncome"
|
@click="gotoIncome"
|
||||||
>
|
>
|
||||||
<span style="font-weight: 600; color: #1f2937">
|
<span style="font-weight: 600; color: #1f2937">
|
||||||
{{ t('available_salaries') }} ${{ salaryInfo.currentSalary }}
|
{{ t('available_salaries') }} ${{ salaryInfo?.availableBalance || 0 }}
|
||||||
</span>
|
</span>
|
||||||
<img
|
<img
|
||||||
src="../../assets/icon/arrow.png"
|
src="../../assets/icon/arrow.png"
|
||||||
@ -713,16 +713,19 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { setDocumentDirection } from '@/locales/i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import GeneralHeader from '@/components/GeneralHeader.vue'
|
|
||||||
import { isInApp } from '@/utils/appBridge.js'
|
import { isInApp } from '@/utils/appBridge.js'
|
||||||
import maskLayer from '@/components/MaskLayer.vue'
|
|
||||||
import { clearSelectedPayee } from '@/utils/payeeStore.js'
|
import { clearSelectedPayee } from '@/utils/payeeStore.js'
|
||||||
import historySalary from '@/components/historySalary.vue'
|
|
||||||
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
|
import { usePageInitializationWithConfig } from '@/utils/pageConfig.js'
|
||||||
|
|
||||||
import { getBdMemberBillList, getBdHistory, getBdHistoryMore } from '@/api/bdCenter.js'
|
import { getBdMemberBillList, getBdHistory, getBdHistoryMore } from '@/api/bdCenter.js'
|
||||||
import { getBdLeaderHistory, getBdLeaderHistoryMore } from '@/api/bdLeaderCenter'
|
import { getBdLeaderHistory, getBdLeaderHistoryMore } from '@/api/bdLeaderCenter'
|
||||||
import { setDocumentDirection } from '@/locales/i18n'
|
import { apiGetBankBalance } from '@/api/wallet.js'
|
||||||
|
|
||||||
|
import GeneralHeader from '@/components/GeneralHeader.vue'
|
||||||
|
import maskLayer from '@/components/MaskLayer.vue'
|
||||||
|
import historySalary from '@/components/historySalary.vue'
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -746,6 +749,7 @@ const BDLeaderData = ref({}) // BDLeader成员账单列表
|
|||||||
const BDSalary = ref({}) // BD Salary
|
const BDSalary = ref({}) // BD Salary
|
||||||
const BDLeaderSalary = ref({}) // BDLeader Salary
|
const BDLeaderSalary = ref({}) // BDLeader Salary
|
||||||
|
|
||||||
|
const salaryInfo = ref({}) //钱包信息
|
||||||
const SalaryMore = ref({}) // BD Salary More
|
const SalaryMore = ref({}) // BD Salary More
|
||||||
|
|
||||||
// 遮罩层显示状态
|
// 遮罩层显示状态
|
||||||
@ -862,9 +866,19 @@ const apiGetBdLeaderHistory = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { appConnected, userInfo, salaryInfo, handleImageError, getAvatarPlaceholder } =
|
// 查询可用余额
|
||||||
|
const getBankBalance = async () => {
|
||||||
|
const res = await apiGetBankBalance('BD_LEADER_SALARY')
|
||||||
|
if (res.status && res.body) {
|
||||||
|
// 处理返回的数据
|
||||||
|
salaryInfo.value = res.body || {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { appConnected, userInfo, handleImageError, getAvatarPlaceholder } =
|
||||||
usePageInitializationWithConfig('BD_LEADER_CENTER', {
|
usePageInitializationWithConfig('BD_LEADER_CENTER', {
|
||||||
needsTeamInfo: true,
|
needsTeamInfo: true,
|
||||||
|
needsBankBalance: false,
|
||||||
onDataLoaded: () => {},
|
onDataLoaded: () => {},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -874,6 +888,7 @@ const initData = () => {
|
|||||||
apiGetBdHistory() //BD历史记录
|
apiGetBdHistory() //BD历史记录
|
||||||
apiGetBdLeaderHistory() //BD Leader历史记录
|
apiGetBdLeaderHistory() //BD Leader历史记录
|
||||||
apiGetBdLeaderMemberBillList() //BD Leader成员账单
|
apiGetBdLeaderMemberBillList() //BD Leader成员账单
|
||||||
|
getBankBalance() // 查询可用余额
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user