<template>
	<NavBar />
	<view class="container">
		<view class="title">
			<PageTitle :title="$t('menu.capital')" />
		</view>
		<view class="content">
			<view class="mtSection">
				<image src="/static/capital/mtSectionBg.png" mode="aspectFill" class="sectionBg"></image>
				<view class="capitalItem mtDeposit" @click="() => toTarget('/pages/capital/deposit/index')">
					<image src="/static/capital/mtDeposit.svg" mode="aspectFit" class="capitalIcon"></image>
					<text>{{ $t('home.goldin') }}</text>
				</view>
				<view class="mtWithdrawAndmtTransfer">
					<view class="capitalItem" @click="() => toTarget('/pages/capital/withdraw/index')">
						<image src="/static/capital/mtWithdraw.svg" mode="aspectFit" class="capitalIcon"></image>
						<text style="white-space: nowrap">{{ $t('home.goldout') }}</text>
					</view>
					<view class="capitalItem" @click="() => toTarget('/pages/capital/transfer/index')">
						<image src="/static/capital/mtTransfer.svg" mode="aspectFit" class="capitalIcon"></image>
						<text>{{ $t('home.transfer') }}</text>
					</view>
				</view>
			</view>
			<view class="ibSection" v-if="isIb()">
				<image src="/static/capital/ibSectionBg.png" mode="aspectFill" class="sectionBg"></image>
				<view class="ibSectionContent">
					<view class="capitalItem" @click="() => toTarget('/pages/capital/ibTransfer/index')">
						<image src="/static/capital/ibTransfer.svg" mode="aspectFit" class="capitalIcon"></image>
						<text>{{ $t('ib.dailyFunds.crmTransfer') }}</text>
					</view>
					<view class="divider"></view>
					<view class="capitalItem" @click="() => toTarget('/pages/capital/ibWithdraw/index')">
						<image src="/static/capital/ibWithdraw.svg" mode="aspectFit" class="capitalIcon"></image>
						<text>{{ $t('ib.dailyFunds.crmGoldOut') }}</text>
					</view>
				</view>
			</view>
			<view class="recordBtn" @click="() => toTarget('/pages/capital/mtSubsidy/index')">
				{{ $t('home.subsidy') }}
				<image src="/static/capital/capitalRightArrow.png" mode="aspectFit" style="width: 4px; height: 8px"></image>
			</view>
			<view class="recordBtn" @click="() => toTarget('/pages/capital/tradeRecord/index')">
				{{ $t('common.viewTradeRecord') }}
				<image src="/static/capital/capitalRightArrow.png" mode="aspectFit" style="width: 4px; height: 8px"></image>
			</view>
		</view>
	</view>
</template>

<script>
import { useUserStore } from '@/stores/user';
export default {
	name: '',
	data() {
		return {
			targets: [
				{ title: this.$t('home.goldin'), target: '/pages/capital/deposit/index' },
				{ title: this.$t('home.goldout'), target: '/pages/capital/withdraw/index' },
				{ title: this.$t('home.transfer'), target: '/pages/capital/transfer/index' },
				{ title: this.$t('ib.dailyFunds.crmGoldOut'), target: '/pages/capital/ibWithdraw/index' },
				{ title: this.$t('ib.dailyFunds.crmTransfer'), target: '/pages/capital/ibTransfer/index' }
			]
		};
	},
	methods: {
		toTarget(target) {
			uni.navigateTo({
				url: target
			});
		},
		isIb() {
			const userStore = useUserStore();
			return Number(userStore.userInfo.user_type) === 1;
		}
	}
};
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>
