You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

359 lines
8.9 KiB

2 years ago
<!-- 我的钱包 -->
<template>
<view class="wallet-wrap">
<!-- 钱包卡片 -->
<view class="head_box u-flex u-row-center u-col-center">
<view class="card-box">
<view class="card-head u-flex u-col-center">
<view class="card-title u-m-r-10">可提现金额</view>
<view @tap="showMoney = !showMoney" class="u-iconfont"
2 years ago
:class="showMoney ? 'uicon-eye' : 'uicon-eye-off'" style="color: #030300;;font-size: 46rpx;"></view>
2 years ago
</view>
2 years ago
<view style="display: flex;align-items: center; padding-top: 50rpx; justify-content: space-between;">
<view class="money-num">{{ showMoney ? userInfo.money || '0.00' : '*****' }}</view>
<image src="../../../static/images/2.png" mode="widthFix" style="width: 76upx;height:auto"></image>
</view>
<!-- -->
<button class="u-reset-button topup-btn" v-if="initRecharge.enable ==='1'"
2 years ago
@tap="$Router.push('/pages/user/wallet/top-up')">充值</button>
<button class="u-reset-button withdraw-btn"
@tap="$Router.push('/pages/user/wallet/withdraw')">提现</button>
</view>
</view>
<!-- 筛选 -->
<u-sticky offset-top="0" :enable="true">
<view class="filter-box u-flex u-row-between">
<button class="u-reset-button date-btn u-flex" @tap="showCalendar = true">
{{ selDateText }}
2 years ago
<text class="u-iconfont uicon-arrow-down-fill u-m-l-20" style="color: #808292"></text>
2 years ago
</button>
<view class="total-box">收入{{ incomeMoney || '0.00' }} 支出{{ expendMoney || '0.00' }}</view>
</view>
<!-- 状态分类 -->
<view class="u-flex nav-box">
<view class="state-item u-flex-1 " v-for="(state, index) in statusList" :key="state.value"
@tap="onTab(state.value)">
<text class="state-title"
:class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
<text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
</view>
</view>
</u-sticky>
<!-- 钱包记录 -->
<view class="wallet-list u-flex" v-for="item in walletLog" :key="item.id">
2 years ago
<!-- <image class="head-img u-m-r-20" :src="item.avatar" mode=""></image> -->
2 years ago
<view class="list-content">
<view class="title-box u-flex u-row-between">
<text class="title u-ellipsis-1">{{ item.type_name }}{{ item.title ? '-' + item.title : '' }}</text>
<view class="money">
<text v-if="item.wallet >= 0" class="add font-OPPOSANS">+{{ item.wallet }}</text>
<text v-else class="minus font-OPPOSANS">{{ item.wallet }}</text>
</view>
</view>
<text class="time">{{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM') }}</text>
</view>
</view>
<!-- 空置页 -->
<shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/no_data.png'" tipText="暂无数据~">
</shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<!-- 日期选择 -->
<u-calendar v-model="showCalendar" ref="uCalendar" safeAreaInsetBottom mode="range" start-text="开始"
end-text="结束" active-bg-color="#7063d2" active-color="#fff" range-bg-color="#e5e2ff" range-color="#7063d2"
:customStyle="{ background: 'linear-gradient(90deg, #A36FFF, #5336FF)', boxShadow: '0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34)' }"
@change="selDate"></u-calendar>
</view>
</template>
<script>
import { mapState, mapActions, mapGetters } from 'vuex';
export default {
components: {},
data() {
return {
isEmpty: false,
stateCurrent: 'all', //默认
statusList: [{
name: '全部',
value: 'all'
},
{
name: '收入',
value: 'add'
},
{
name: '支出',
value: 'reduce'
}
],
showMoney: true,
//日期选择
showCalendar: false,
selDateText: '',
walletLog: [], //钱包记录
propsDate: '', //日期参数
incomeMoney: '', //收入
expendMoney: '', //支出
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'initRecharge'])
},
onShow() {
this.isLogin && this.getUserInfo();
this.getToday();
this.currentPage = 1;
this.lastPage = 1;
this.walletLog = [];
this.getWalletLog();
},
// 触底加载更多
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getWalletLog();
}
},
methods: {
...mapActions(['getUserInfo']),
// 今日
getToday() {
let now = new Date();
let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
this.propsDate = `${dateText}-${dateText}`;
},
// tab切换
onTab(state) {
if (this.stateCurrent !== state) {
this.stateCurrent = state;
this.currentPage = 1;
this.lastPage = 1;
this.walletLog = [];
this.getWalletLog();
}
},
// 日期选择
selDate(e) {
this.walletLog = [];
this.currentPage = 1;
this.lastPage = 1;
this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
this.propsDate = dateText;
this.getWalletLog();
this.$refs.uCalendar.init();
},
// 钱包明细
getWalletLog() {
let that = this;
that.loadStatus = 'loading';
that.$http('money.walletLog', {
wallet_type: 'money',
status: that.stateCurrent,
date: that.propsDate,
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.walletLog = [...that.walletLog, ...res.data.wallet_logs.data];
that.incomeMoney = res.data.income;
that.expendMoney = Math.abs(res.data.expend);
that.isEmpty = !that.walletLog.length;
that.lastPage = res.data.wallet_logs.last_page;
that.loadStatus = that.currentPage < res.data.wallet_logs.last_page ? 'loadmore' :
'nomore';
}
});
}
}
};
</script>
<style lang="scss">
// 钱包记录
.wallet-list {
2 years ago
// width: 750rpx;
padding: 30rpx 0;
margin:0 30rpx;
// background-color: #ffff;
border-bottom: 1rpx solid #333440;
2 years ago
.head-img {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
background: #ccc;
}
.list-content {
justify-content: space-between;
align-items: flex-start;
flex: 1;
.title {
2 years ago
font-size: 34rpx;
color: #FFFFFF;
2 years ago
width: 400rpx;
}
.time {
2 years ago
color: #808292;
font-size: 26rpx;
2 years ago
display: block;
margin-top:30rpx;
2 years ago
}
}
.money {
font-size: 28rpx;
font-weight: bold;
.add {
2 years ago
color: #DD5C3D;
2 years ago
}
.minus {
2 years ago
color: #FFFFFF;
2 years ago
}
}
}
// 钱包
.head_box {
width: 750rpx;
2 years ago
// background-color: #fff;
2 years ago
padding: 30rpx 0;
.card-box {
width: 690rpx;
min-height: 300rpx;
padding: 40rpx;
2 years ago
background: url('../../../static/images/bg.png') no-repeat;
2 years ago
background-size: 100% 100%;
box-shadow: 1rpx 5rpx 16rpx 0 rgba(94, 73, 195, 0.81);
border-radius: 30rpx;
overflow: hidden;
position: relative;
.card-head {
2 years ago
color: #030300;
2 years ago
font-size: 30rpx;
}
.money-num {
2 years ago
width: 116px;
height: 44px;
font-size: 60upx;
font-family: Alibaba PuHuiTi;
font-weight: 400;
color: #030300;
2 years ago
}
.reduce-num {
font-size: 26rpx;
font-weight: 400;
color: #ffffff;
}
.withdraw-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
2 years ago
background: #030300;
2 years ago
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
2 years ago
color: #F0D2A0;
2 years ago
position: absolute;
right: 30rpx;
top: 40rpx;
}
.topup-btn {
2 years ago
2 years ago
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
2 years ago
color: #030300;
background: rgba(3,3,0,0);
border: 1px solid #030300;
2 years ago
position: absolute;
right: 180rpx;
top: 40rpx;
}
}
}
// 筛选
.filter-box {
height: 120rpx;
padding: 0 30rpx;
2 years ago
background-color: #21222B;
2 years ago
.date-btn {
2 years ago
background-color: #333440;
2 years ago
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
2 years ago
color: #808292;
2 years ago
}
.total-box {
font-size: 24rpx;
font-weight: 500;
2 years ago
color: #FFFFFF;
2 years ago
}
}
// 分类
.state-item {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
2 years ago
background-color: #21222B;
// border-bottom: 1rpx solid rgba(#999, 0.5);
2 years ago
.state-title {
2 years ago
color: #FFFFFF;
2 years ago
font-weight: 500;
font-size: 28rpx;
line-height: 90rpx;
}
.title-active {
2 years ago
color: #F0D2A0;
2 years ago
}
.underline {
2 years ago
width: 66rpx;
height: 8rpx;
background: transparent;
border-radius: 4rpx;
2 years ago
display: block;
}
.underline-active {
2 years ago
width: 66rpx;
height: 8rpx;
background: #F0D2A0;
border-radius: 4rpx;
2 years ago
display: block;
}
}
</style>