<template>
	<view class="index">
		<view class="index-top">
			<view class="index-top-tit">
				<view class="index-top-tit-lef">
					<view class="">
						{{walletInfo.expect}}
					</view>
					<view class="">
						预计收入(元)
					</view>
				</view>
				<view class="index-top-tit-lef">
					<view class="">
						{{walletInfo.balance}}
					</view>
					<view class="">
						我的钱包(元)
					</view>
				</view>
			</view>
		</view>
		<view class="index-cet">
			<view class="index-cet-tp">
				<view @click="clickDj(0)" :class="particulars == 0?'xz':'wxz'" style="margin-right: 60rpx;">
					预计收入明细
				</view>
				<view @click="clickDj(1)" :class="particulars == 1?'xz':'wxz'">
					余额明细
				</view>
			</view>
			<view v-if="particulars == 0">
				<view class="index-cet-ct" v-for="(v,index) in balanceList" :key="index">
					<view class="">
						<view class="index-cet-ct-tit">
							{{v.balanceType}}
						</view>
						<view class="index-cet-ct-tim">
							{{v.createTime}}
						</view>
					</view>
					<view class="index-cet-ct-mony">
						{{v.amountTx}}
					</view>
				</view>
			</view>
			<view class="" v-else>
				<view class="" v-for="(v,index) in balanceList" :key="index">
					<view class="index-cet-ct" :style="{'margin-bottom':v==1? '8rpx':'30rpx'}">
						<view class="">
							<view class="index-cet-ct-tit">
								{{v.balanceType}}
							</view>
							<view class="index-cet-ct-tim">
								{{v.createTime}}
							</view>
						</view>
						<view class="index-cet-ct-mony">
							{{v.amountTx}}
						</view>
					</view>
					<view class="yy" v-if="v.rejection">
						驳回原因: {{v.rejection}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import apiBaseConfig from '@/config/index.js';
	import {
		walletGET,
		balanceGET
	} from '@/api/workbench/index.js';
	export default {
		data() {
			return {
				imgBgUrl: apiBaseConfig.imgBgUrl,
				globalData: getApp().globalData,
				particulars: 0,
				walletInfo:{},
				balanceList:[]
			};
		},
		onLoad() {},
		onShow() {
			this.wallet()
			this.balance()
		},
		methods: {
			wallet(){
				walletGET().then((res)=>{
					this.walletInfo = res.data
				})
			},
			balance(){
				this.balanceList = []
				balanceGET({
					particularsType:this.particulars
				}).then((res)=>{
					this.balanceList = res.data
				})
			},
			clickDj(v) {
				this.particulars = v
				this.balance()
			},
			// 申请提现
			jump() {
				this.$uniGo.navigateTo({
					url: `/my/withdrawal/index?balance=${this.walletInfo.balance}`
				});
			}
		}
	};
</script>

<style>
	page {
		background: #fff;
	}
</style>
<style lang="scss" scoped>
	.index {
		&-top {
			background: #1572FF;
			padding: 80rpx 120rpx 100rpx;

			&-tit {
				display: flex;
				align-items: center;
				justify-content: space-between;

				&-lef {
					font-weight: 600;
					font-size: 48rpx;
					color: #FFFFFF;
					text-align: center;

					>view:nth-child(2) {
						font-weight: 400;
						font-size: 24rpx;
						color: #FFFFFF;
						margin-top: 8rpx;
					}
				}
			}

			&-cent {
				background: #FFFFFF;
				border-radius: 26rpx;
				width: 148rpx;
				height: 52rpx;
				font-weight: 500;
				font-size: 24rpx;
				color: #1572FF;
				text-align: center;
				line-height: 52rpx;
				margin-top: 52rpx;
			}
		}

		&-cet {
			position: relative;
			top: -38rpx;
			background-color: #FFFFFF;
			border-radius: 40rpx 40rpx 0rpx 0rpx;
			padding: 40rpx 50rpx;

			&-tp {
				display: flex;
				align-items: flex-end;
				margin-bottom: 40rpx;
			}

			&-ct {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 30rpx;

				&-tit {
					font-weight: 600;
					font-size: 30rpx;
					color: #242424;
				}

				&-tim {
					font-weight: 400;
					font-size: 24rpx;
					color: #BCBCBC;
					line-height: 48rpx;
					margin-top: 8rpx;
				}

				&-mony {
					font-weight: 600;
					font-size: 32rpx;
					color: #242424;
				}
			}
		}
	}

	.yy {
		font-weight: 400;
		font-size: 24rpx;
		color: #FF3141;
		margin-bottom: 30rpx;
	}

	.xz {
		font-weight: 500;
		font-size: 28rpx;
		color: #333333;
	}

	.wxz {
		font-weight: 400;
		font-size: 28rpx;
		color: #666666;
	}
</style>