<template>
	<view class="assets">
		<view class="header">
			<view class="img"><image :src="userInfo.avatar" mode=""></image></view>
			{{ userInfo.nickname }}
		</view>
		<!-- <view class="numerical">
			<view class="value">
				<text>8555</text>
				<br />
				贡献值
			</view>
			<view class="l"></view>
			<view class="value">
				<text>788</text>
				<br />
				诚信值
			</view>
		</view> -->
		<view class="main">
			<view class="btn" @click="nav('/pages/money/wallet')">
				<image src="../../static/icon/assent1.png"></image>
				<text>{{ userInfo.brokerage_price * 1 }}</text>
				佣金
			</view>
			<!-- <view class="btn" @click="nav('/pages/money/award')">
				<image src="../../static/icon/assent2.png"></image>
				<text>{{ candy || 0 }}</text>
				糖果
			</view> -->
			<view class="btn" @click="nav('/pages/money/integralShopping')">
				<image src="../../static/icon/assent3.png"></image>
				<text>{{ userInfo.now_money * 1 }}</text>
				货款
			</view>
			<view class="btn" @click="nav('/pages/money/mallPoints')">
				<image src="../../static/icon/assent4.png"></image>
				<text>{{ scjf || 0 }}</text>
				商城积分
			</view>
			<!-- <view class="btn" @click="nav('/pages/money/integralP')">
				<image src="../../static/icon/assent5.png"></image>
				<text>{{ jf || 0 }}</text>
				拼团积分
			</view> -->
			<!-- <view class="btn" @click="nav('/pages/money/frozen')">
				<image src="../../static/icon/assent6.png"></image>
				<text>{{ ptdjjf || 0 }}</text>
				拼团冻结积分
			</view> -->
			<view class="btn" @click="nav('/pages/money/publicWelfare')">
				<image src="../../static/icon/assent7.png"></image>
				<text>{{ gyjf || 0 }}</text>
				福利积分
			</view>
			<!-- <view class="btn" @click="nav('/pages/money/publicPing')">
				<image src="../../static/icon/assent8.png"></image>
				<text>{{ ptb || 0 }}</text>
				拼团币
			</view> -->
			<view class="btn" @click="nav('/pages/money/publicW')">
				<image src="../../static/icon/assent9.png"></image>
				<text>{{ wjb || 0 }}</text>
				系统文件
			</view>
		</view>
	</view>
</template>

<script>
import { wallet } from '@/api/finance.js';
import { mapState, mapMutations } from 'vuex';
export default {
	data() {
		return {
			candy: '',
			jf: '',
			ptdjjf: '',
			scjf: '',
			gyjf: '',
			ptb:'',
			wjb:''
		};
	},
	onLoad() {
		this.getWallet();
	},
	methods: {
		getWallet() {
			uni.showLoading({
				title: '加载中'
			});
			wallet({}).then(({ data }) => {
				console.log(data);
				const obj = this;
				const arr = Object.keys(data.back);
				console.log(arr);
				let ar = [];
				arr.forEach(e => {
					console.log(e, '11111');
					if (e == 'LALA') {
						obj.candy = (data.back[e].money.money * 1).toFixed(0);
					}
					if (e == 'USDC') {
						obj.jf = data.back[e].money.money * 1;
					}
					if (e == 'USDL') {
						obj.ptdjjf = data.back[e].money.money * 1;
					}
					if (e == 'SCJF') {
						obj.scjf = data.back[e].money.money * 1;
					}
					if (e == 'FLJF') {
						console.log(e,'123456')
						obj.gyjf = data.back[e].money.money * 1;
					}
					if (e == 'USDT') {
						obj.ptb = data.back[e].money.money * 1;
					}
					if (e == 'FIL') {
						obj.wjb = data.back[e].money.money * 1;
					}
				});
				uni.hideLoading();
			});
		},
		nav(url) {
			uni.navigateTo({
				url: url,
				fail() {
					uni.switchTab({
						url: url
					});
				}
			});
		}
	},
	computed: {
		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
	}
};
</script>

<style lang="scss" scoped>
.assets {
	.header {
		height: 400rpx;
		background: linear-gradient(180deg, #32c6ff 0%, #2e58ff 100%);
		color: #fff;
		font-size: 35rpx;
		text-align: center;
		font-family: PingFang-SC-Medium;
		padding-top: 100rpx;
		.img {
			margin-bottom:10rpx;
			image {
				border-radius: 50%;
				width: 150rpx;
				height: 150rpx;
				border: solid 6rpx #fff;
			}
		}
	}
	.numerical {
		box-shadow: 0 5rpx 10rpx 1rpx #e6e6e6;
		margin: 30rpx;
		color: #666666;
		display: flex;
		text-align: center;
		background-color: #fff;
		padding: 30rpx;
		border-radius: 20rpx;
		position: relative;
		top: -120rpx;
		.l {
			background-color: #f8f8f8;
			width: 5rpx;
			height: 70rpx;
			margin: auto 0;
		}
		.value {
			flex: 1;
		}
		text {
			font-size: 40rpx;
			color: #333333;
		}
	}
	.main {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		text-align: center;
		margin: 20rpx;
		.btn {
			padding: 40rpx;
			box-shadow: 0 5rpx 10rpx 1rpx #e6e6e6;
			border-radius: 20rpx;
			width: calc(50% - 20rpx);
			height: 240rpx;
			background-color: #fff;
			margin: 10rpx;
			display: grid;
			align-content: space-around;
			color: #666666;
			font-family: PingFang-SC-Medium;
			image {
				margin: 10rpx auto;
				width: 80rpx;
				height: 80rpx;
			}
			text {
				color: #333333;
				font-size: 35rpx;
			}
		}
	}
}
</style>
