accountFlow.vue 2.8 KB
<template>
	<view class="">
		<image  class="bg" src="/static/takeMoneyBg.png" mode=""></image>
		<view class="top">
			<view >账户余额:</view>
			<view > <text style="32rpx">¥</text> {{money}}</view>
		</view>
		<scroll-view scroll-y="true" class="center" @scrolltolower="scrolltolower">
			<view class="item flexA" v-for="item in list" :key="item.id">
				<view class="left">
					<view class="">{{item.memo}}</view>
					<view class="">{{item.createtime_text}}</view>
				</view>
				<view class="right">
					<view class="">{{item.money}}</view>
				</view>
			</view>
			
		</scroll-view >
	</view>
</template>

<script>
	import { getUserInfo } from '@/api/mine.js'
	import { moneyLog } from '@/api/mine.js'
	export default{
		data() {
			return {
				list:[],
				money:'',
				page:1,
				lastPage:1
			}
		},
		onShow() {
			this.getUserInfo()
			this.moneyLog()
		},
		methods: {
			async getUserInfo(){
			  try {
			    const res = await getUserInfo()
				this.money = res.user.money
			    console.log('getUserInfo', res)
			    // 保存数据
			  } catch (err) {
			 	uni.showToast({ title:err,icon:'none' })
			    console.log('getUserInfo', err)
			  }
			},
			async moneyLog(){
			  try {
			    const res = await moneyLog(this.page)
				this.list = this.list.concat(res.list.data)
				this.lastPage = res.list.last_page
			    // console.log('moneyLog', res)
			    // 保存数据
			  } catch (err) {
			 	uni.showToast({ title:err,icon:'none' })
			    console.log('moneyLog', err)
			  }
			},
			scrolltolower(){
				if(this.page >= this.lastPage) return
				this.page=this.page+1 
				this.moneyLog()
			}
		},
	}
</script>

<style lang="less">
	page {
		background: #f6f6f6;
	}
	.bg {
		overflow: hidden;
		position: absolute;
		left: 0;
		top: 0;
		width: 100%;
		height: 366rpx;
	}
	.top {
		position: absolute;
		left: 32rpx;
		top: 64rpx;
		view:nth-child(1) {
			 color: rgba(0,0,0,0.4);
			 font-size: 28rpx;
		}
		view:nth-child(2) {
			 color: rgba(0,0,0,0.9);
			 font-size: 64rpx;
			 font-weight: 700;
		}
	}
.center {
		position: absolute;
		width: 100%;
		left: 50%;
		top: 220rpx;
		height: calc(100vh - 220rpx);
		border-radius: 24rpx;
		padding: 40rpx 30rpx;
		transform: translateX(-50%);
		background: #fff;
		box-sizing: border-box; 
		.item {
			justify-content: space-between;
			height: 144rpx;
			border-bottom: 1px solid rgba(238,239,240,1);;
			.left {
				view:nth-child(1){
					 color: rgba(50,50,51,1);
					 font-size: 28rpx;
					 margin-bottom: 8rpx;
				}
				view:nth-child(2){
					 color: rgba(200,201,204,1);
					 font-size: 24rpx;
				}
			}
			.right {
				 color: rgba(230,61,39,1);
				 font-size: 28rpx;
				 font-weight: 500;
			}
		}
	}
</style>