<template>
	<view class="container">

		<view class="box_">
			<view class="title_">
				Balance
			</view>
			<view class="d_lang">
				<view class="left_">My Balance </view>
				<view class="right_">
					<text>￥ {{wallet}}</text>

				</view>
			</view>
		</view>
		<view class="text_"> Converter: <text class="text_lv">$ 1 </text> =  <text class="text_lv">￥ {{money}} </text></view>
		<view class="lv_button" @click="goPay()">
			Recharge
		</view>

	</view>
</template>

<script>
	import tabbar from '../../components/tabbar/tabbar.vue'
	import request from '../../utils/request'

	export default {
		data() {
			return {
money:0,
				msg: "3",
				List: [],
				show: false,
				status: 'loading',
				wallet: 0.00,
				Mymoney:0
			}
		},
		onShow() {
			this.getmyInfo()
			this.getexchangeRate()
		},

		components: {

			tabbar
		},
		methods: {
			goPay() {
				uni.navigateTo({
					url: '/pages/my/pay'
				})
			},
			goback() {
				uni.navigateBack()
			},

			async getmyInfo() {
				let res = await request({
					url: 'system/user/getUserBaseInfo',
					method: 'get',
				})
				if (res.code == 200) {
					if (res.data.wallet) {
						this.wallet = res.data.wallet
						// this.getexchangeRates(res.data.wallet)
					}

				}
			},
			async getexchangeRate() {
				let res = await request({
					url: 'paymentController/exchange_rate',
					method: 'post',
					data:{
					money:1	
					}
				})
				this.money = res.toFixed(2)
			console.log("当前汇率",res);
			},
			async getexchangeRates(num) {
				let res = await request({
					url: 'paymentController/exchange_rate',
					method: 'post',
					data:{
					money:num
					}
				})
				this.wallet = res.toFixed(2)
			console.log("当前汇率",res);
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		height: 100vh;
		background: #f8f8f8;
	}

	.top_ {
		width: 100%;
		height: 170px;
		box-sizing: border-box;
		padding-top: 20px;

		background-color: #32714f;

	}

	.ds_ {
		width: 85%;
		margin: 15px auto;
		display: flex;
		align-items: center;
		color: #fff;

	}
	.text_{
		font-size: 14px;
		// color: #32714f;
		width: 90%;
		margin: 5px auto;
		font-size: 14px;
		font-weight: bold;
	}
	.text_lv{
		font-size: 16px;
		font-weight: bold;
		color: #32714f;
		margin: 0px 5px;
	}
	.user_t {
		width: 100px;
		height: 100px;
		border-radius: 50%;
		overflow: hidden;

		margin: 20px auto;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.user_title {
		font-weight: bold;
		font-size: 20px;
		color: #FFFFFF;
		margin-bottom: 10px;
	}

	.user_emil {
		font-weight: 500;
		font-size: 16px;
	}

	.box_ {
		width: 90%;
		background: #FFFFFF;
		box-sizing: border-box;

		box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);

		margin: 15px auto;
		margin-bottom: 0px;
	}

	.title_ {
		font-size: 16px;
		font-weight: bold;
		box-sizing: border-box;
		padding: 15px;
		padding-bottom: 0px;
	}

	.d_lang {
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #F2F2F2;
		box-sizing: border-box;
		padding: 10px 15px;
	}

	.f_ {
		width: 25%;
		font-weight: 500;
		font-size: 12px;
		color: #333333;
		text-align: center;
	}

	.icon_ {
		width: 22px;
		height: 22px;
		margin: 0 auto;
		margin-bottom: 5px;

		image {
			width: 100%;
			height: 100%;

		}
	}

	.left_ {
		font-weight: 500;
		font-size: 16px;
		color: #000000;
	}

	.right_ {
		display: flex;
		align-items: center;
		font-weight: 500;
		font-size: 16px;
		color: #333333;
	}

	.lv_button {
		width: 90%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #fff;
		margin: 25px auto;
		height: 48px;
		background: #32714F;
		border-radius: 6px 6px 6px 6px;
	}
</style>