<template>
	<view class="">
		<view class="tab-container">
			<view class="back">
				<u-icon name="arrow-left" color="#fff" size="24" @click="back"></u-icon>
			</view>
			<view class='tab' style="margin-left: 80rpx;">賬號交易</view>
			<view class='tab' @click="totransactionrecords">交易記錄</view>
		</view>
		<view class="container">
			<view style="padding: 20rpx;">
				<view class="popular">
					<view class="all_top">
						<view class="title">
							全部賬號
						</view>
						<view class="filter">
							<view class="" @click="priceAccount" style="margin-right: 10rpx;">
								排序
							</view>
							<view class="icon">
								<u-icon name="arrow-up" color="#fff" size="9"></u-icon>
								<u-icon name="arrow-down" color="#fff" size="9"></u-icon>
							</view>
						</view>
					</view>
					<scroll-view scroll-y="true" style="height: 95%;">
						<view class="gameitem" v-for="item in accountDatas" :key="item.id" @click="tostrateydetails(item)">
							<view class="g_img">
								<image :src="publickUrl + item.img"></image>
							</view>
							<view class="g_rig">
								<view class="g_top">
									<view class="g_name" style="font-size: 26rpx;">
										{{item.desc_cn}}
									</view>
								</view>
								<view class="g_bottom">
									<view class="ga_cont">
										{{item.title_cn}}
									</view>
									<view class="ga_num">
										${{item.usdt || 0}}
									</view>
								</view>
							</view>
						</view>
					</scroll-view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {_getpubaccount} from "@/request/api.js"
	import { BASE_URL } from '@/request/config.js'
	export default {
		data() {
			return {
				publickUrl:"",
				accountDatas:[],
				search:{
					type_cn:"",
					page: 1,
					listrow: 9999,
					sort: 1,//1升序，0降序
				},
			};
		},
		onLoad(e) {
			if(e.type){
				this.search.type_cn = e.type;
			}
			this.publickUrl = BASE_URL;
		},
		mounted() {
			this.getaccountList();
		},
		methods: {
			priceAccount(){
				this.search.sort == 1 ? this.search.sort = 0 : this.search.sort = 1;
				this.getaccountList();
			},
			async getaccountList(){
				let res = await _getpubaccount(this.search);
				if(res.code === 1){
					this.accountDatas = res.data.data;
				}
			},
			tostrateydetails(item) {
				uni.navigateTo({
					url: '/pages/game/accountnumberdetails?id=' + item.id
				})
			},
			back() {
				uni.navigateBack()
			},
			totransactionrecords() {
				uni.navigateTo({
					url: '/pages/game/ransactionrecords'
				})
			}
		}
	}
</script>

<style lang="scss">
	.container {
		border-top: 1px solid dimgrey;
		width: 100vw;
		min-height: 100vh;
		padding: 10px;
		box-sizing: border-box;
		background: linear-gradient(to bottom, #000033, #51599b);

		image {
			width: 100%;
			height: 100%;
			border-radius: 20rpx;
		}

		.popular {
			background-color: #383d84;
			padding: 30rpx;
			border-radius: 20rpx;
			height: 90vh;
			color: #fff;
			width: 100%;
			box-sizing: border-box;

			.all_top {
				display: flex;
				justify-content: space-between;
				border-bottom: 1rpx solid #41468d;
				margin-bottom: 20rpx;
			}

			.title {
				border-bottom: 1rpx solid #41468d;
				margin-bottom: 20rpx;
			}

			.filter {
				font-size: 22rpx;
				display: flex;
				justify-content: center;
			}

			.p_top {
				display: flex;
				align-items: center;
				justify-content: space-between;
				background-color: #fdf7f2;
				width: 100%;
				height: 60rpx;
				font-size: 28rpx;
				border-radius: 20rpx;
				margin-bottom: 30rpx;
				padding: 0 20rpx;
				box-sizing: border-box;

				.tit {
					color: #EAA97D;
					font-size: 24rpx;
				}
			}

			.gameitem {
				width: 100%;
				height: 160rpx;
				display: flex;
				padding: 1rpx;
				align-items: center;
				margin-bottom: 35rpx;

				.g_img {
					width: 190rpx;
					height: 150rpx;
					background-color: #51599b;
					border-radius: 20rpx;
				}

				.g_rig {
					flex: 1;
					padding: 1rpx;
					margin-left: 10rpx;
					display: flex;
					justify-content: space-between;
					flex-direction: column;

					.g_top {
						display: flex;
						justify-content: space-between;
						margin-bottom: 10rpx;

						.g_name {
							display: -webkit-box;
							/* 将对象作为弹性伸缩盒子模型显示 */
							-webkit-box-orient: vertical;
							/* 从上到下垂直排列子元素 */
							-webkit-line-clamp: 3;
							/* 限制显示的行数为2行 */
							overflow: hidden;
							/* 溢出隐藏 */
							text-overflow: ellipsis;
						}

						.g_btn {
							width: 90rpx;
							height: 50rpx;
							background-color: #4f5ad6;
							display: flex;
							justify-content: center;
							align-items: center;
							border-radius: 40rpx;
							font-size: 26rpx;
						}
					}

					.g_bottom {
						display: flex;
						width: 100%;
						justify-content: space-between;
						align-items: center;

						.ga_cont {
							font-size: 22rpx;
							color: #D7D8E6;
						}

						.ga_num {
							color: #FD5C5C;
							font-weight: 600;
						}

					}


				}
			}
		}

		.accounts {
			width: 100%;
			font-size: 34rpx;
			border-bottom: 2rpx solid #f6f6f6;
			padding-bottom: 15rpx;
		}

		.type {
			display: flex;
			justify-content: space-around;
			margin-bottom: 40rpx;

			.titem {
				width: 200rpx;
				height: 60rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: #4f5ad8;
				color: #fff;
				border-radius: 30rpx;
			}
		}
	}

	.tab-container {
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: #000033;
		overflow: hidden;
		width: 100%;
		padding-right: 20rpx;
		box-sizing: border-box;
		padding-top: 60rpx;
	}

	.tab {
		text-align: center;
		padding: 15px 0;
		font-size: 16px;
		color: #ffffff;
	}

	.tab.active {
		background-color: rgba(0, 122, 255, 0.6);
		color: white;
	}
</style>