feat(主播中心、代理中心): 获取提现权限状态,用于提现按钮的显隐

This commit is contained in:
hzj 2026-03-20 17:22:01 +08:00
parent 59bf3aaaca
commit 249121585a
2 changed files with 42 additions and 5 deletions

View File

@ -360,7 +360,8 @@
</button> </button>
<!-- 提现按钮 --> <!-- 提现按钮 -->
<!-- <button <button
v-if="withdrawEnabled"
class="action-btn" class="action-btn"
style=" style="
background: linear-gradient(135deg, #a6f1b2 2.82%, #2fff3d 99.15%), #fff; background: linear-gradient(135deg, #a6f1b2 2.82%, #2fff3d 99.15%), #fff;
@ -370,7 +371,7 @@
@click="goToWithdraw" @click="goToWithdraw"
> >
{{ t('withdraw') }} {{ t('withdraw') }}
</button> --> </button>
</div> </div>
</div> </div>
@ -454,6 +455,7 @@ import {
getUserIdentity, getUserIdentity,
getBankCardList, // 使 getBankCardList, // 使
getWithdrawInfoList, // getWithdrawInfoList, //
apiGetWithdrawEnabled, //
} from '@/api/wallet.js' } from '@/api/wallet.js'
import GeneralHeader from '@/components/GeneralHeader.vue' import GeneralHeader from '@/components/GeneralHeader.vue'
@ -466,6 +468,7 @@ const router = useRouter()
// //
locale.value && setDocumentDirection(locale.value) locale.value && setDocumentDirection(locale.value)
const withdrawEnabled = ref(false) //
const maskLayerShow = ref(false) // const maskLayerShow = ref(false) //
const totalSalary = ref('0') // const totalSalary = ref('0') //
@ -795,6 +798,19 @@ const getWithdrawInfoListData = async () => {
} }
} }
//
const getWithdrawEnabled = async () => {
try {
const resWithdrawEnabled = await apiGetWithdrawEnabled()
if (resWithdrawEnabled.body && resWithdrawEnabled.status) {
withdrawEnabled.value = resWithdrawEnabled.body
}
} catch (error) {
console.error('获取提现信息列表失败:', error)
showError(error.response?.errorMsg)
}
}
const { userInfo, salaryInfo, taskInfo } = usePageInitializationWithConfig('AGENCY_CENTER', { const { userInfo, salaryInfo, taskInfo } = usePageInitializationWithConfig('AGENCY_CENTER', {
needsTeamInfo: true, needsTeamInfo: true,
forceRefresh: true, // forceRefresh: true, //
@ -808,6 +824,7 @@ const { userInfo, salaryInfo, taskInfo } = usePageInitializationWithConfig('AGEN
onMounted(() => { onMounted(() => {
getBankCards() // 使 getBankCards() // 使
getWithdrawInfoListData() // getWithdrawInfoListData() //
getWithdrawEnabled() //
underlineStyle.value // underlineStyle.value //

View File

@ -179,7 +179,7 @@
></workReportBox> ></workReportBox>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; margin: 0 1%"> <div style="display: flex; align-items: center; gap: 2vw; margin: 0 1%">
<!-- 兑换按钮 --> <!-- 兑换按钮 -->
<button <button
class="action-btn" class="action-btn"
@ -199,13 +199,14 @@
</button> </button>
<!-- 提现按钮 --> <!-- 提现按钮 -->
<!-- <button <button
v-if="withdrawEnabled"
class="action-btn" class="action-btn"
style="background: linear-gradient(135deg, #a6f1b2 2.82%, #2fff3d 99.15%), #fff" style="background: linear-gradient(135deg, #a6f1b2 2.82%, #2fff3d 99.15%), #fff"
@click="goToWithdraw" @click="goToWithdraw"
> >
{{ t('withdraw') }} {{ t('withdraw') }}
</button> --> </button>
</div> </div>
</div> </div>
@ -291,6 +292,7 @@ import {
getWithdrawInfoList, // getWithdrawInfoList, //
useBankCard, // useBankCard, //
withdrawApply, // withdrawApply, //
apiGetWithdrawEnabled, //
} from '@/api/wallet.js' } from '@/api/wallet.js'
import GeneralHeader from '@/components/GeneralHeader.vue' import GeneralHeader from '@/components/GeneralHeader.vue'
@ -327,6 +329,7 @@ const checkStatus = computed(() => {
return bankCardInfo.value == null || usedBankCard.value == null return bankCardInfo.value == null || usedBankCard.value == null
}) })
const withdrawEnabled = ref(false) //
const maskLayerShow = ref(false) // const maskLayerShow = ref(false) //
// TeamBillView // TeamBillView
@ -481,6 +484,19 @@ const getWithdrawInfoListData = async () => {
} }
} }
//
const getWithdrawEnabled = async () => {
try {
const resWithdrawEnabled = await apiGetWithdrawEnabled()
if (resWithdrawEnabled.body && resWithdrawEnabled.status) {
withdrawEnabled.value = resWithdrawEnabled.body
}
} catch (error) {
console.error('获取提现信息列表失败:', error)
showError(error.response?.errorMsg)
}
}
const { appConnected, userInfo, salaryInfo, taskInfo, handleImageError, getAvatarPlaceholder } = const { appConnected, userInfo, salaryInfo, taskInfo, handleImageError, getAvatarPlaceholder } =
usePageInitializationWithConfig('HOST_CENTER', { usePageInitializationWithConfig('HOST_CENTER', {
needsTeamInfo: true, needsTeamInfo: true,
@ -494,6 +510,7 @@ onMounted(() => {
clearSelectedPayee() // clearSelectedPayee() //
getBankCards() // 使 getBankCards() // 使
getWithdrawInfoListData() // getWithdrawInfoListData() //
getWithdrawEnabled() //
}) })
</script> </script>
@ -576,6 +593,9 @@ onMounted(() => {
} }
.action-btn { .action-btn {
flex: 1;
min-width: 0;
border-radius: 4px; border-radius: 4px;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25); box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
color: white; color: white;