| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <template>
- <view class="notice-container">
- <cwg-dropdown ref="dropdownRef" :menu-list="[]" @menuClick="handleMenuClick">
- <view class="pc-header-btn pc-payment-btn" v-if="mode === 'customer'">
- <cwg-icon name="crm-payment" color="#97A1C0" />
- <text class="balance-text">{{ formattedBalance }} USD</text>
- </view>
- <view class="pc-header-btn pc-payment-btn" v-if="mode === 'ib'">
- <cwg-icon name="crm-payment" color="#97A1C0" />
- <text class="balance-text">{{ ibBalance }} USD</text>
- </view>
- <view class="pc-header-btn pc-payment-btn" v-if="mode === 'follow'">
- <cwg-icon name="crm-payment" color="#97A1C0" />
- <text class="balance-text">{{ followBalance }} USD</text>
- </view>
- <template #btn>
- <view class="right-drawer custom-payment-drawer" v-if="mode === 'customer'">
- <view class="drawer-header">
- <text class="drawer-title">{{t('vu.item21')}}</text>
- <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
- </view>
- <view class="drawer-content">
- <view class="balance-amount">{{ formattedBalance }} USD</view>
- <view class="cursor-pointer" @click="toPaymentHistory">
- <view class="account-number">${{ formattedPendingWithdrawAmount }}</view>
- <view class="account-type" v-t="'wallet.pendingWithdraw1'"></view>
- </view>
- </view>
- <view class="drawer-actions">
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goPages(1)" v-t="'wallet.item6'"></button>
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goPages(2)" v-t="'wallet.item7'"></button>
- </view>
- </view>
- <view class="right-drawer custom-payment-drawer" v-if="mode === 'ib'">
- <view class="drawer-header">
- <text class="drawer-title">{{t('vu.item21')}}</text>
- <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
- </view>
- <view class="drawer-content">
- <view class="balance-amount">{{ ibBalance }} USD</view>
- <view>
- <view class="account-number">${{ ibTotalBalance }}</view>
- <view class="account-type" v-t="'Ib.Index.TotalRevenue'"></view>
- </view>
- </view>
- <view class="drawer-actions">
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goIbPages(1)" v-t="'Custom.Index.Withdrawals'"></button>
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goIbPages(2)" v-t="'Home.page_ib.item4'"></button>
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goIbPages(3)" v-t="'Ib.Transfer.CommissionIssue'"></button>
- </view>
- </view>
- <view class="right-drawer custom-payment-drawer" v-if="mode === 'follow'">
- <view class="drawer-header">
- <text class="drawer-title">{{t('vu.item21')}}</text>
- <switch :checked="!isShow" @change="toggleShow" color="#6c8595" style="transform:scale(0.7)" />
- </view>
- <view class="drawer-content">
- <view class="balance-amount">{{ t('Documentary.console.item15') }}{{ followBalance }} USD</view>
- </view>
- <view class="drawer-actions">
- <button class="action-btn btn btn-outline-danger waves-effect waves-light" @click.stop="goFollowPages(1)" v-t="'Documentary.console.item17'"></button>
- </view>
- </view>
- </template>
- </cwg-dropdown>
- </view>
- </template>
- <script setup lang="ts">
- import { computed, ref, onMounted, onUnmounted, watch } from 'vue'
- import useRouter from '@/hooks/useRouter'
- import { drawApi } from '@/service/draw'
- import { useI18n } from 'vue-i18n'
- import { useMenuSplit } from '@/composables/useMenuSplit'
- import useUserStore from '@/stores/use-user-store'
- import { userToken } from '@/composables/config'
- import { ibApi } from '@/service/ib'
- import { documentaryApi } from '@/service/documentary'
- import { useFilters } from '@/composables/useFilters'
- const { numberDecimal } = useFilters()
- const { mode } = useMenuSplit()
- const { t, locale } = useI18n()
- const userStore = useUserStore()
- const isRed = ref(false)
- const dropdownRef = ref(null)
- const close = () => {
- dropdownRef.value.close()
- }
- const router = useRouter()
- const menuList = []
- const ibData = ref({})
- const walletData = ref({})
- const handleMenuClick = ({ value }) => {
- goPages(value)
- }
- const NumberDesensitization = (value) => {
- let realVal = ''
- if (!isNaN(value) && value !== '') {
- value = value.toString()
- realVal = '*****'
- } else {
- realVal = '--'
- }
- return realVal
- }
- const isShow = ref(true)
- const walletbalance = ref(0)
- const pendingWithdrawAmount = ref(0)
- const formattedBalance = computed(() => {
- const value = walletbalance.value || '0'
- const decimalValue = numberDecimal(value)
- return isShow.value ? decimalValue : NumberDesensitization(decimalValue)
- })
- const formattedPendingWithdrawAmount = computed(() => {
- const value = pendingWithdrawAmount.value || '0'
- const decimalValue = numberDecimal(value)
- return isShow.value ? decimalValue : NumberDesensitization(decimalValue)
- })
- //ib金额
- const ibBalance = computed(() => {
- const value = numberDecimal(ibData.value?.balance || 0)
- return isShow.value ? value : NumberDesensitization(value)
- })
- const ibTotalBalance = computed(() => {
- const value = numberDecimal(ibData.value?.all || 0)
- return isShow.value ? value : NumberDesensitization(value)
- })
- // 跟单
- const followBalance = computed(() => {
- const value = numberDecimal(walletData.value?.walletAmount || 0)
- return isShow.value ? value : NumberDesensitization(value)
- })
- const getWalletList = async () => {
- let res = await drawApi.walletbalance({})
- if (res.code == 200) {
- if (res.data != null) {
- walletbalance.value = res.data
- }
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- }
- //获取处理中出金金额
- const getPendingWithdrawAmount = async () => {
- let res = await drawApi.pendingWithdrawAmount({})
- if (res.code == 200) {
- if (res.data != null) {
- pendingWithdrawAmount.value = res.data
- }
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- }
- const toggleShow = (e) => {
- isShow.value = !e.detail.value
- }
- //跟单金额
- const getMoneyList = async () => {
- let res = await documentaryApi.followWalletSingle({})
- if (res.code == 200) {
- if (res.data != null) {
- walletData.value = res.data
- }
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- })
- }
- }
- const goPages = (type) => {
- let path
- if (type == 1) {
- path = '/pages/customer/wallet-transfer'
- } else if (type == 2) {
- path = '/pages/customer/wallet-history' // 此处根据实际“出金”路由修改
- }
- router.push(path)
- close()
- }
- const goFollowPages = (type) => {
- // let path
- router.push('/pages/follow/transfer')
- close()
- }
- const goIbPages = (type) => {
- let path, query
- if (type == 1) {
- path = '/pages/ib/withdraw-select'
- } else if (type == 2) {
- path = '/pages/ib/transfer'
- } else if (type == 3) {
- path = '/pages/ib/transfer'
- query = { tab: 2 }
- }
- router.push({ path, query })
- close()
- }
- const toPaymentHistory = () => {
- router.push({ path: '/pages/customer/payment-history', query: { fromPending: 'true' } })
- }
- const getIbData = async () => {
- const res = await ibApi.IbData()
- if (res.code === 200) {
- if (res.data != null)
- ibData.value = res.data
- } else {
- uni.showToast({ title: res.msg, icon: 'none' })
- }
- }
- const getPay = (newMode) => {
- if (newMode == 'customer') {
- getWalletList()
- getPendingWithdrawAmount()
- } else if (newMode == 'ib') {
- getIbData()
- } else if (newMode == 'follow') {
- getMoneyList()
- }
- }
- watch(() => mode.value, (newMode) => {
- if (!userToken.value) return
- console.log(newMode, 'mode')
- getPay(newMode)
- },
- { immediate: true })
- onMounted(() => {
- uni.$on('updatePayment', () => {
- getPay(mode.value)
- })
- })
- onUnmounted(() => {
- uni.$off('updatePayment')
- })
- </script>
- <style scoped lang="scss">
- @import "@/uni.scss";
- .notice-container {
- :deep(.cwg-dropdown-menu-container) {
- //left: px2rpx(-280) !important;
- //right: px2rpx(0) !important;
- }
- @media screen and (max-width: 991px) {
- :deep(.cwg-dropdown-menu-container) {
- left: px2rpx(-270) !important;
- //max-width: px2rpx(400);
- }
- }
- .pc-header-btn {
- position: relative;
- width: fit-content;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 0 px2rpx(12);
- &.has-dot::after {
- content: '';
- position: absolute;
- top: px2rpx(4);
- right: px2rpx(4);
- width: px2rpx(8);
- height: px2rpx(8);
- background-color: #f56c6c;
- border-radius: 50%;
- }
- }
- .pc-payment-btn {
- border-radius: px2rpx(4);
- padding: px2rpx(4) px2rpx(12);
- height: px2rpx(36);
- cursor: pointer;
- .balance-text {
- margin-left: px2rpx(6);
- font-size: px2rpx(14);
- font-weight: 500;
- color: var(--bs-heading-color);
- }
- }
- .custom-payment-drawer {
- width: px2rpx(320);
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- padding: 0;
- border-radius: px2rpx(8);
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
- .drawer-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: px2rpx(12) px2rpx(16);
- border-bottom: 1px solid var(--bs-border-color);
- .drawer-title {
- font-size: px2rpx(14);
- color: var(--bs-heading-color);
- }
- }
- .drawer-content {
- padding: px2rpx(20) px2rpx(16);
- //cursor: pointer;
- .balance-amount {
- font-size: px2rpx(18);
- font-weight: bold;
- color: var(--bs-heading-color);
- margin-bottom: px2rpx(8);
- }
- .account-type {
- font-size: px2rpx(13);
- color: var(--cwg-placeholder-color);
- margin-bottom: px2rpx(4);
- }
- .account-number {
- font-size: px2rpx(13);
- color: var(--cwg-placeholder-color);
- }
- }
- .drawer-actions {
- display: flex;
- gap: px2rpx(10);
- padding: 0 px2rpx(16) px2rpx(20);
- .action-btn {
- flex: 1;
- height: px2rpx(36);
- line-height: px2rpx(36);
- font-size: px2rpx(13);
- margin: 0;
- padding: 0 px2rpx(8);
- &::after {
- border: none;
- }
- }
- }
- }
- .notification-list {
- width: 100%;
- }
- .notification-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: px2rpx(12) px2rpx(16);
- border-bottom: 1px solid var(--bs-border-color);
- cursor: pointer;
- transition: all 0.3s;
- &:hover {
- background-color: rgba(0, 0, 0, 0.05);
- }
- .item-content {
- flex: 1;
- .item-title {
- font-size: px2rpx(14);
- color: var(--bs-heading-color);
- line-height: 1.4;
- margin-bottom: px2rpx(4);
- }
- .item-time {
- font-size: px2rpx(12);
- color: var(--bs-heading-color);
- }
- }
- .item-badge {
- margin-left: px2rpx(12);
- .dot {
- width: px2rpx(8);
- height: px2rpx(8);
- background-color: #f56c6c;
- border-radius: 50%;
- }
- }
- }
- .logout-wrap {
- margin-top: auto;
- padding: 20px 16px;
- margin-bottom: 20px;
- }
- .logout-btn {
- height: 44px;
- background: #f4eadf;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 8px;
- color: #fff;
- font-weight: 600;
- cursor: pointer;
- }
- }
- </style>
|