<template>
	<view class="content">
		<view class="top">
			<view class="text1">我的余额（元）</view>
			<view class="hflex acenter " style="box-sizing: border-box;padding: 0 28rpx 20rpx;">
				<view class="money">{{money}}</view>
				<view class="money_btn" @click="toWithdraw">提现</view>
			</view>
			<view class="bottom hflex acenter jbetween" @click="toBank">
				<view class="bottom_left">银行卡（张）<span class="bottom_num">{{bankNum?bankNum:''}} </span></view>
				<u-icon name="arrow-right" color="#fff" size="16"></u-icon>
			</view>
		</view>
		<view class="list">
			<view class="list_title">收支明细</view>
			<block v-for="(item,index) in pageList" :key="index">
				<view class="list_item hflex acenter jbetween">
					<view class="vflex">
						<view class="text_style1">{{item.title}}</view>
						<view class="text_style2">{{item.create_at}}</view>
					</view>
					<view class="text_style3">-{{item.change}}</view>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	import $api from '@/static/js/api.js'
	var that = ''
	export default {
		data() {
			return {
				money: '0.00',
				pageList: [],
				bankNum:'',
				page: 1,
				total: 1
			}
		},
		onLoad() {
			that = this
			that.getList()
		},
		methods: {
			getList() {
				$api.req({
					url: '/data/api.business.User/user_amount',
					// method: 'POST',
					data: {
						page: that.page
					}
				}, function(res) {
					if(res.code == 1) {
						that.money = res.data.money
						that.pageList = res.data.list
						that.total = res.data.page.total
						that.bankNum = res.data.bank_nunm
					}
				}) 
			},
			// 去提现
			toWithdraw() {
				$api.jump('/pages/mine/wallet/withdraw')
			},
			toBank() {
				$api.jump('/pages/mine/wallet/bankList')
			}
		},
	}
</script>

<style lang="scss" scoped>
	.content {
		padding: 20rpx 30rpx 0;
		.top {
			width: 100%;
			height: 284rpx;
			box-sizing: border-box;
			padding: 25rpx 0;
			background: url('/static/images/mine/amount_bg.png') no-repeat;
			background-size: 100% 100%;
			.text1 {
				box-sizing: border-box;
				padding: 0 28rpx ;
				font-size: 24rpx;
				color: #fff;
				margin-bottom: 24rpx;
			}
			.money {
				font-size: 52rpx;
				color: #fff;
				margin-right: 36rpx;
			}
			.money_btn {
				width: 132rpx;
				height: 48rpx;
				border-radius: 34rpx;
				border: 1rpx solid #fff;
				text-align: center;
				line-height: 48rpx;
				font-size: 26rpx;
				color: #fff;
			}
			.bottom {
				padding: 28rpx 28rpx 0;
				border-top: 1rpx solid #fff;
				.bottom_left {
					font-size: 26rpx;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 36rpx;
				}
				.bottom_num {
					font-size: 46rpx;
					font-weight: bold;
					color: #FFFFFF;
					line-height: 36rpx;
				}
			}
		}
		.list {
			width: 100%;
			margin-top: 36rpx;
			.list_title {
				font-size: 30rpx;
				color: #333;
			}
			.list_item {
				width: 100%;
				box-sizing: border-box;
				padding: 28rpx 0;
				border-bottom: 1rpx solid #f4f4f4;
				.text_style1 {
					font-size: 26rpx;
					color: #666;
					margin-bottom: 8rpx;
				} 
				.text_style2 {
					font-size: 22rpx;
					color: #bfbfbf;
				}
				.text_style3 {
					color: #ff2626;
					font-size: 30rpx;
				}
			}
			.list_item:nth-last-child(1) {
				border-bottom: none;
			}
		}
	}
</style>