<template>
	<view>
		<image src="../../../static/img/activity1.png" class="width100 height150" mode="widthFix"></image>
		<view class="headtitle fcorfff font16 width90">{{accountInfo.merName}}</view>
		<view class="head_piece backcorfff width94">
			<view class="width90 mart10 fcor666 font14">商户简称: <text
					class="fcor333 margle">{{accountInfo.merAbbreviate}}</text></view>
			<view class="fotct mart10 font24 fontwig6">余额 : {{accountInfo.amount}}</view>
			<view class="width100 alijus mart10">
				<view class="rechargebtn backcor89 mart5 fcorfff fotct" @click="jumpRechange(accountInfo.amount)">去充值
				</view>
			</view>
			<view class="width100 alijus fotct mart10 height60">
				<view class="width50 ">
					<view class="width100 fcor999 font14">状态</view>
					<view class="width100 fcor089 font16 mart5" v-if="accountInfo.status == 1">可用</view>
					<view class="width100 fcoreb5 font16 mart5" v-if="accountInfo.status == 2">冻结</view>
				</view>
				<view style="width: 1px;height: 40px;" class="backcor9"></view>
				<view class="width49 fcor999 font14">
					<view class="width100 fcor999 font14">账户编号</view>
					<view class="width100 fcor333 font16 mart5">{{accountInfo.accountNumber}}</view>
				</view>
			</view>
		</view>
		<view class="width100 backcor9 height140" style="margin-top: -5px;"></view>
		<view class="width90 mart20 fontwig6 font14">我的工具</view>
		<view class="funcss" v-for="(item,index) in toolList" :key="index" @click="jumpfunc(item)">
			<image :src="item.img" mode="widthFix" class="funicon"></image>
			<view class=" font14 mart5">{{item.title}}</view>
		</view>
	</view>
</template>

<script>
	import {
		queryAccount
	} from '../../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				userInfo: app.globalData.userInfo, //用户信息
				accountInfo: '', //账户信息
				toolList: [{
					title: '活动列表',
					url: '/pages/index/activity_Funds_activityList/activity_Funds_activityList',
					img: '../../../static/img/home3.png'
				}, {
					title: '交易记录',
					url: '/pages/index/activity_Funds_transaction_records/activity_Funds_transaction_records',
					img: '../../../static/img/home3.png'
				}, {
					title: '充值记录',
					url: '/pages/index/activity_Funds_recharge_record/activity_Funds_recharge_record',
					img: '../../../static/img/home3.png'
				}]
			}
		},
		onShow() {
			this.queryAccount();
		},
		methods: {
			//查询商户信息
			queryAccount() {
				uni.showLoading({
					title: '加载中...'
				})
				let datas = {
					merNo: this.userInfo.mer.merNo
				}
				queryAccount(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						this.accountInfo = res.return_data;
					}
				});
			},
			//跳转功能
			jumpfunc(item) {
				if (item.title == '活动列表') {
					uni.navigateTo({
						url: '/pages/index/activity_Funds_activityList/activity_Funds_activityList?merNo=' +
							this.accountInfo.accountNumber
					})
					return;
				}

				if (item.title == '交易记录') {
					uni.navigateTo({
						url: '/pages/index/activity_Funds_transaction_records/activity_Funds_transaction_records?merNo=' +
							this.accountInfo.accountNumber
					})
					return;
				}

				if (item.title == '充值记录') {
					uni.navigateTo({
						url: '/pages/index/activity_Funds_recharge_record/activity_Funds_recharge_record?merNo=' +
							this.accountInfo.accountNumber
					})
					return;
				}
				uni.navigateTo({
					url: item.url
				})

			},
			//跳转充值活动
			jumpRechange(item) {
				uni.navigateTo({
					url: '/pages/index/recharge_balance/recharge_balance?merNo=' +
						this.accountInfo.accountNumber + '&price=' + item+'&type=1'
				})
			}
		}
	}
</script>

<style lang="scss">
	.headtitle {
		position: absolute;
		top: 80px;
	}

	.head_piece {
		height: 200px;
		position: absolute;
		top: 110px;
		border-radius: 8px
	}


	// 菜单
	.funcss {
		width: 33%;
		height: 90px;
		margin-top: 10px;
		text-align: center;
		border-right: 1px solid #e8e8e8;
		border-bottom: 1px solid #e8e8e8;
		display: inline-block;

		.funicon {
			width: 35px;
			padding-top: 8px;
		}
	}

	.rechargebtn {
		width: 90px;
		height: 30px;
		line-height: 30px;
		border-radius: 20px;
	}
</style>