<template>
	<view class="center">
		<view class="box" v-for="(item, index) in list" :key="index">
			<view class="box-top flex">
				<view class="title">上级用户收款信息(上{{ index + 1 }}级)</view>
				<view class="type">{{ item.status == '1' ? '成功' : item.status == '2' ? '失败' : item.status == '0' && item.voucherimages != null ? '审核中' : '' }}</view>
			</view>
			<view class="main flex" style="border-bottom: 1px solid #F0F0F0;">
				<view class="left flex">
					<view class="avtor" v-if="item.system_get == 0"><image :src="item.checker.avatar || '../../static/error/missing-face.png'" mode=""></image></view>
					<view class="main-info">
						<view class="name" v-if="item.system_get == 1">系统平台</view>
						<view class="name" v-else>{{ item.checker.nickname || 'null' }}</view>
						<view class="phone" v-if="item.system_get == 0">{{ item.checker.mobile }}</view>
					</view>
				</view>
				<view class="right" v-if="item.system_get == 0">援助金额：￥{{ item.money * 1 }}</view>
				<view class="right" v-if="item.system_get == 1">援助金额：{{ item.money * 1 }}U</view>
			</view>
			<view class="main flex" v-if="item.system_get == 0">
				<view class="left flex">
					<!-- <view class="bank"><image src="../../static/img/bank.png" mode=""></image></view>
					<view class="main-info">
						<view class="name">{{ item.checker.bank_of_deposit || '暂无' }}</view>
						<view class="name">{{ item.checker.bank_card_no || '暂无' }}</view>
					</view> -->
					<view class="right-box" @click="navTo('/pages/index/male')" style="width: 228rpx;">援助付款信息</view>
				</view>
				<view class="right"><view class="right-box" @click="nav(item)">上传凭证</view></view>
			</view>
			<view class="" v-if="item.system_get == 1">
				<view class="change">
					请选择TRC20
				</view>
				<view class="erweima">
					<tki-qrcode
						:cid="cid"
						ref="qrcode"
						:val="num"
						:size="size"
						:unit="unit"
						:background="background"
						:foreground="foreground"
						:pdground="pdground"
						:iconSize="iconSize"
						:lv="lv"
						:onval="onval"
						:loadMake="loadMake"
						:usingComponents="usingComponents"
					/>
				</view>
				<view class="address">{{ num }}</view>
				<view class="btn" style="margin-top: 50rpx;" @click="setData">复制充币地址</view>
				<view class="btn" @click="nav(item.id)">上传凭证</view>
			</view>
		</view>

		<view class="tishi">*请线下援助并保存截图相关凭证并上传</view>
	</view>
</template>

<script>
import { activity } from '@/api/active.js';
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
export default {
	data() {
		return {
			list: [],
			id: '',
			cid: 'cid',
			size: 150,
			unit: '150',
			background: '#000000',
			foreground: '#FFFFFF',
			pdground: '#FFFFFF',
			icon: '',
			num: '',
			iconSize: 40,
			lv: 3,
			onval: true,
			loadMake: true,
			usingComponents: true
		};
	},
	onLoad(option) {
		this.id = option.id;
		this.loadData();
	},
	methods: {
		loadData() {
			const obj = this;
			activity({}, this.id).then(e => {
				console.log(e);
				if (e.data.check) {
					this.list = e.data.check;
					this.list.forEach(e => {
						console.log(e);
						if (e.checker.usdt_address) {
							obj.num = e.checker.usdt_address;
						}
					});
				} else {
					uni.showToast({
						title: e.msg,
						duration: 1500,
						mask: false,
						icon: 'none'
					});
				}
			});
		},
		nav(item) {
			if (item.voucherimages) {
				uni.showModal({
					title: '提示',
					content: '已上传凭证，是否重新上传',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							uni.navigateTo({
								url: '/pages/upload/upload?id=' + item.id
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			}else {
				uni.navigateTo({
					url: '/pages/upload/upload?id=' + item.id
				});
			}
		},
		navTo(url) {
			uni.navigateTo({
				url
			})
		},
		setData() {
			// #ifdef APP-PLUS
			uni.setClipboardData({
				data: this.num,
				success: e => {
					uni.showToast({
						title: '复制成功！'
					});
				},
				fail(e) {
					uni.showToast({
						title: '复制失败',
						icon: false
					});
					console.log(e);
				}
			});
			// #endif
		}
	}
};
</script>

<style lang="scss">
.box {
	padding-top: 10rpx;
	color: #fad6b0;
	.box-top {
		border-bottom: 1px solid #f0f0f0;
		padding: 10rpx 10rpx 10rpx 20rpx;
		color: #fff;
		font-size: 28rpx;
		.title {
			font-family: PingFang SC;
			font-weight: 500;
			color: #ffffff;
		}
	}

	.main {
		width: 90%;
		margin: 0 auto;
		padding: 20rpx;
		align-items: center;
		.left {
			justify-content: flex-start;
			.bank {
				margin-left: 10rpx;
				width: 48rpx;
				height: 40rpx;
				image {
					width: 100%;
					height: 100%;
				}
			}
			.avtor {
				background: #fff;
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				image {
					border-radius: 50%;
					width: 100%;
					height: 100%;
				}
			}
			.main-info {
				margin-left: 16rpx;
				.name {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #fad6b0;
				}
				.phone {
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: 400;
					color: #fad6b0;
					opacity: 0.8;
				}
			}
		}
		.right {
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #fad6b0;
		}
		.right-box {
			width: 188rpx;
			height: 56rpx;
			background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
			border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
			box-shadow: 3rpx 4rpx 5rpx 0px rgba(151, 118, 74, 0.5);
			border-radius: 28rpx;
			font-size: 30rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #643912;
			text-align: center;
			line-height: 56rpx;
		}
	}
}
.tishi {
	padding: 20rpx 0 120rpx 24rpx;
	color: #fff;
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #ffffff;
}
.change {
	padding: 10rpx 0 0 40rpx;
	font-size: 30rpx;
}
.erweima {
	margin: 16rpx auto 0;
	width: 300rpx;
	height: 300rpx;
	image {
		width: 100%;
		height: 100%;
	}
}
.address {
	margin-top: 20rpx;
	text-align: center;
}
.btn {
	margin: 20rpx auto 0;
	width: 500rpx;
	height: 60rpx;
	background: linear-gradient(-74deg, #ce9c6d, #ffecd6);
	border-image: linear-gradient(115deg, #feebd5, #ffffff, #e1ad7d) 1 1;
	border-radius: 30px;
	line-height: 60rpx;
	text-align: center;
	font-size: 26rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #643912;
}
</style>
