123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- <template>
- <view class="content">
- <view class="title-box">
- <view class="yue-box">
- <view class="yue-top">我的余额(元)</view>
- <view class="yue-bottom">{{ money || 0 }}</view>
- </view>
- <view class="box">
- <view class="cz" @click="navTo('/pages/money/recharge')">充值</view>
- <view class="cz" @click="navTo('/pages/money/withdrawal')">提现</view>
- </view>
- </view>
- <view class="center-box">
- <view class="centet-left">
- <view class="top">{{ userInfo.recharge || 0 }}</view>
- <view class="bottom">历史充值(元)</view>
- </view>
- <view class="" style="width: 2rpx;height: 54rpx;background: #EEEEEE;"></view>
- <view class="centet-left">
- <view class="top">{{ userInfo.extraxt || 0 }}</view>
- <view class="bottom">历史提现(元)</view>
- </view>
- </view>
- <scroll-view class="good-content" scroll-y @scrolltolower="loadData" :style="{ height: height }">
- <!-- 空白页 -->
- <!-- <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty> -->
- <!-- 订单列表 -->
- <view class="detail" v-for="item in orderList">
- <view class="det-left">
- <view class="det-top">{{ item.title }}</view>
- <view class="det-bottom">{{ item.add_time }}</view>
- </view>
- <view class="det-right">{{ (item.pm == 0 ? '-' : '+') + item.number }}</view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </scroll-view>
- </view>
- </template>
- <script>
- import { mapState, mapMutations } from 'vuex';
- import { getUserInfo } from '@/api/user.js';
- import { spreadCommission, userBalance } from '@/api/wallet.js';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import empty from '@/components/empty';
- export default {
- components: {
- empty,
- uniLoadMore
- },
- data() {
- return {
- tabCurrentIndex: 0,
- height: '',
- state: 0,
- loadingType: 'more',
- orderList: [],
- page: 1, //当前页数
- limit: 10, //每次信息条数
- money: '',
- cz: '', //历史充值
- tx: '' //历史提现
- };
- },
- onReady(res) {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.good-content').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- console.log(obj.height);
- });
- },
- fail: res => {}
- });
- },
- onLoad() {
- this.loadData();
- this.getUserInfo();
- },
- methods: {
- ...mapState('user', ['hasLogin', 'userInfo']),
- getUserInfo() {
- getUserInfo().then(res => {
- this.money = res.data.now_money * 1;
- });
- },
- navTo(url) {
- uni.navigateTo({
- url
- });
- },
- //获取收入支出信息
- async loadData(source) {
- let obj = this;
- if (obj.loadingType === 'loading' || obj.loadingType === 'noMore') {
- //防止重复加载
- return;
- }
- // 修改当前对象状态为加载中
- obj.loadingType = 'loading';
- spreadCommission(
- {
- page: obj.page,
- limit: obj.limit
- },
- obj.state
- )
- .then(({ data }) => {
- if (data.length > 0) {
- obj.orderList = obj.orderList.concat(data[0].list);
- console.log(obj.orderList);
- obj.page++;
- }
- if (obj.limit == data.length) {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- obj.loadingType = 'more';
- return;
- } else {
- //判断是否还有数据, 有改为 more, 没有改为noMore
- obj.loadingType = 'noMore';
- }
- uni.hideLoading();
- this.$set(obj, 'loaded', true);
- })
- .catch(e => {
- console.log(e);
- });
- },
- //swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.target.current;
- this.loadData('tabChange');
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index;
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- height: 100%;
- width: 750rpx;
- // background: #111111;
- .title-box {
- padding-left: 30rpx;
- // margin-top: 100rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .yue-box {
- display: flex;
- flex-direction: column;
- .yue-top {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #999999;
- }
- .yue-bottom {
- font-size: 60rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #fdd58a;
- }
- }
- .box {
- .cz {
- margin: 20rpx 0;
- text-align: center;
- font-size: 30rpx;
- font-weight: bold;
- color: #ffffff;
- width: 140rpx;
- height: 64rpx;
- border: 2rpx solid #ffffff;
- border-radius: 32rpx 0px 0px 32rpx;
- line-height: 64rpx;
- }
- }
- }
- .center-box {
- display: flex;
- justify-content: space-around;
- align-items: center;
- margin: 30rpx 25rpx;
- height: 120rpx;
- background: #181818;
- border-radius: 10rpx;
- .centet-left {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .top {
- font-size: 32rpx;
- font-weight: 400;
- color: #ffffff;
- line-height: 48rpx;
- }
- .bottom {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #666666;
- line-height: 48rpx;
- }
- }
- }
- .detail {
- display: flex;
- height: 120rpx;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx solid #f0f0f0;
- margin: 0 25rpx;
- .det-left {
- display: flex;
- flex-direction: column;
- .det-top {
- line-height: 40rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #ffffff;
- }
- .det-bottom {
- line-height: 40rpx;
- font-size: 22rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #999999;
- }
- }
- .det-right {
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #fdd58a;
- }
- }
- .navbar {
- display: flex;
- height: 40px;
- padding: 0 5px;
- background: #fff;
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
- position: relative;
- z-index: 10;
- .nav-item {
- flex: 1;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- font-size: 15px;
- color: $font-color-dark;
- position: relative;
- &.current {
- color: $base-color;
- &:after {
- content: '';
- position: absolute;
- left: 50%;
- bottom: 0;
- transform: translateX(-50%);
- width: 44px;
- height: 0;
- border-bottom: 2px solid $base-color;
- }
- }
- }
- }
- </style>
|