|
|
<template> <view> <lf-nav title="余额" :showIcon="true" :spreadOut="false" bgColor="transparent" titleColor="#fff"></lf-nav> <view class="head"> <view class="bg-left"></view> <view class="bg-right"></view> <view class="head-content"> <view> <text class="lf-iconfont icon-yuebao lf-font-50"></text> </view> <view class="point"> <text>{{ balance }}</text> <text class="label">(元)</text> </view> </view> <view class="withdrawal" @click="$url('/pages/business/withdrawal/withdrawal')">提现</view> </view> <view class="tabs"> <view class="lf-flex lf-h-100"> <view class="tab" v-for="(item, index) in tab_list" :key="index" :class="{'active-tab': current == index}" @click="switchTab(index)">{{ item.name }} </view> </view> <picker mode='date' :value="date" @change="dateChange"> <view style="width: 340rpx; text-align: right;"> <text>{{ date || getDay }}</text> <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text> </view> </picker> </view> <view class="main" v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex" v-if="current == tabIndex"> <view class="item" v-for="(item, index) in tabItem.list" :key="index"> <view class="lf-row-between"> <text class="lf-font-36 lf-color-black lf-font-bold" style="width: 70%;" v-if="item.type == 'charge'">+¥{{ item.balance }}</text> <text class="lf-font-36 lf-font-bold" style="color: #F63434; width: 70%;" v-else>{{ item.balance }}</text> <text class="lf-font-24 lf-color-555">{{ item.note }}</text> </view> <view class="lf-row-between lf-m-t-20"> <text class="lf-font-24 lf-color-555">¥{{ item.current }}</text> <text class="lf-font-24 lf-color-777">{{ item.created_at }}</text> </view> </view> <lf-nocontent src="/static/images/empty.png" v-if="tabItem.list.length <= 0"></lf-nocontent> </view> <u-back-top :scrollTop="pageScrollTop"></u-back-top> </view></template>
<script> export default { data(){ return { date: '', current: 0, tab_list: [{ name: '余额明细', page: 1, isPage: true, list: [] },{ name: '提现明细', page: 1, isPage: true, list: [] }], balance: 0 } }, computed: { getDay(){ return this.$shared.recordTime(new Date(), '-', 'date'); } }, onLoad(){ this.getBalance(); }, methods: { // 时间筛选
dateChange(event){ this.date = event.detail.value; let tabItem = this.tab_list[this.current]; tabItem.page = 1; tabItem.isPage = true; this.getBalance(); }, // 切换tab
switchTab(index){ this.current = index; if(this.tab_list[index].list.length <= 0){ this.getBalance(); } }, getBalance(){ uni.showLoading({ title: '正在查询中' }) let token = this.$cookieStorage.get('store_token'); let tabItem = this.tab_list[this.current]; let par = { cash: this.current, page: tabItem.page } if(this.date){ par.date = this.date; } this.$http.get({ api: 'api/supplier/balance', data: par, header: { token: token } }).then(res => { if(res.data.code == 200){ let balance = res.data.data.balance; let list = res.data.data.list; this.balance = balance; tabItem.isPage = this.$shared.isRight(list.next_page_url); if(tabItem.page == 1){ tabItem.list = list.data; }else{ tabItem.list.push(...list.data); } } uni.hideLoading(); }).catch(err => uni.hideLoading()); } }, onReachBottom(){ let tabItem = this.tab_list[this.current]; if(tabItem.isPage){ tabItem.page = tabItem.page+1; this.getBalance(); }else{ this.$msg('没有更多啦~') } } }</script>
<style> page{ overflow-x: hidden; }</style><style lang="scss" scoped> .head{ width: 750rpx; height: 429rpx; background: linear-gradient(90deg, #1338B7 0%, #092788 100%); position: relative; overflow: hidden; display: flex; align-items: flex-end; box-sizing: border-box; padding: 60rpx 32rpx; color: #FFFFFF; .bg-left{ position: absolute; width: 196rpx; height: 196rpx; border-radius: 50%; background-color: rgba(255,255,255,0.04); left: -92rpx; bottom: 60rpx; } .bg-right{ position: absolute; width: 520rpx; height: 520rpx; border-radius: 50%; background-color: rgba(255,255,255,0.04); right: -168rpx; top: -122rpx; } .head-content{ width: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; &>view{ width: 100%; text-align: center; } .point{ font-size: 72rpx; letter-spacing: 2rpx; font-weight: bold; word-break: break-all; line-height: 1; margin-top: 10rpx; .label{ font-size: 36rpx; font-weight: initial; } } } .withdrawal{ position: absolute; right: 32rpx; bottom: 164rpx; width: 102rpx; height: 47rpx; border-radius: 24rpx; border: 1rpx solid #FFFFFF; font-size: 24rpx; color: #FFFFFF; display: flex; justify-content: center; align-items: center; z-index: 9; } } .tabs{ height: 100rpx; width: 750rpx; border: 1rpx solid #e5e5e5; display: flex; justify-content: space-between; align-items: center; padding: 0 32rpx; .tab{ width: 128rpx; height: 100%; display: flex; justify-content: center; align-items: center; font-size: 28rpx; color: #555555; &:nth-child(n+2){ margin-left: 50rpx; } } .active-tab{ font-size: 32rpx; color: #0D2E9A; position: relative; font-weight: bold; &::after{ content: ''; position: absolute; bottom: 0; left: calc(50% - 40rpx); width: 80rpx; height: 10rpx; background: #0D2E9A; border-radius: 8rpx 8rpx 0rpx 0rpx; } } } .main{ padding: 30rpx 32rpx; width: 750rpx; height: max-content; box-sizing: border-box; .item{ width: 686rpx; height: max-content; background: #F4F8F8; border-radius: 10rpx; margin-bottom: 26rpx; padding: 30rpx; box-sizing: border-box; line-height: 1; } }</style>
|