<template>
	<view class="content">
		<view class="vheight"></view>
		<view class="top1 flex">
			<image @click="back()" class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
			<image @click="navTo('/pages/user/myrg')" class="top-icon2" src="../../static/img/cb1.png" mode=""></image>
		</view>
		<view class="top"><image :src="'' + banner" mode=""></image></view>
		<view class="main" v-for="(item, index) in list" @click="navTo('/pages/index/rgDetail?id=' + item.id)">
			<view class="main-top flex">
				<view class="main-icon"><image :src="item.imgs" mode=""></image></view>
				<view class="main-top-info">
					<view class="main-title clamp">{{ item.name }}</view>
					<view class="main-btype">{{ $t('rg.rgbz') }}：{{ item.coinname.toLocaleUpperCase() }}</view>
					<view class="main-time">{{ $t('rg.kssj') }}：{{ item.starttime }}</view>
					<view class="main-time">{{ $t('rg.jssj') }}：{{ item.finishtime }}</view>
				</view>
			</view>
			<view class="xian"><u-line-progress active-color="#2979ff" :percent="((item.num * 1 - item.sellnum * 1) / (item.num * 1)) * 100"></u-line-progress></view>
			<view class="main-bottom flex">
				<view class="main-bottom-item first">
					<view class="main-bottom-item-font">{{ $t('rg.fxzl') }}</view>
					<view class="main-bottom-item-num">{{ item.num }}</view>
				</view>
				<view class="main-bottom-item">
					<view class="main-bottom-item-font">{{ $t('rg.rgdj') }}</view>
					<view class="main-bottom-item-num">{{ item.price }} {{ item.buycoin.toLocaleUpperCase() }}</view>
				</view>
				<view class="main-bottom-item">
					<view class="main-bottom-item-font">{{ $t('rg.scsj') }}</view>
					<view class="main-bottom-item-num">{{ item.lockday }}{{ $t('rg.t') }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { index } from '@/api/wallet.js';
export default {
	data() {
		return {
			list: [],
			banner: ''
		};
	},
	onLoad() {},
	onShow() {
		this.loadData();
	},
	methods: {
		back() {
			uni.navigateBack();
		},
		loadData() {
			index({ page: 1, limit: 1000 }).then(({ data }) => {
				this.list = data.list;
				this.banner = data.webissue;
			});
		},
		navTo(url) {
			uni.navigateTo({
				url
			});
		}
	}
};
</script>

<style lang="scss">
.vheight {
	height: var(--status-bar-height);
}
.top1 {
	padding: 20rpx 40rpx;
	.top-icon1 {
		width: 52rpx;
		height: 36rpx;
	}
	.top-icon2 {
		width: 48rpx;
		height: 48rpx;
	}
}
.top {
	margin: auto;
	width: 750rpx;
	height: 300rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
.main {
	background: #fff;
	margin-top: 20rpx;
	padding: 16rpx 20rpx 24rpx;
	.main-top {
		justify-content: flex-start;
		align-items: center;
		.main-icon {
			width: 250rpx;
			height: 250rpx;
			image {
				width: 100%;
				height: 100%;
			}
		}
		.main-top-info {
			margin-left: 10rpx;
			.main-title {
				font-size: 32rpx;
				font-weight: bold;
				color: #707a8a;
			}
			.main-btype {
				margin-top: 6rpx;
				font-size: 28rpx;
				color: #707a8a;
			}
			.main-time {
				margin-top: 6rpx;
				font-size: 28rpx;
				color: #707a8a;
			}
		}
	}
	.xian {
		margin-top: 20rpx;
	}
	.main-bottom {
		padding: 28rpx 16rpx;
		.first {
			align-items: flex-start !important;
		}
		.main-bottom-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			.main-bottom-item-font {
				font-size: 28rpx;
				color: #707a8a;
			}
			.main-bottom-item-num {
				margin-top: 10rpx;
				font-size: 28rpx;
				color: #707a8a;
			}
		}
	}
}
</style>
