<template>
	<view class="content">
		<view class="in-bg">
			<image src="../../static/donate/in-tit.png" mode="" class="in-tit in-tit0"></image>
			<image src="../../static/donate/in-tit1.png" mode="" class="in-tit in-tit1"></image>
			<view class="line-donate">
				<view class="btn"  @click="goto()">
					
				</view>
			</view>
			<image src="../../static/donate/in-tip.png" mode="" class="in-tit tip"></image>
			<view class="in-love" style="padding-bottom: 20rpx;" @click="navto('/pages/index/love2')">
				<view class="empty"
					style="width: 100%;height: 100%;text-align: center;line-height: 220rpx;font-size: 32rpx;color: #ed4530;"
					v-if="loveList.length == 0">
					暂无捐款数据
				</view>
				<view class="" style="height: 260rpx;overflow: hidden;">
					<view class="tab-item flex" v-for="(item,index) in loveList" v-if="loveList.length > 0">
						<view class="tab-item-name clamp" style="width: 200rpx;">{{item.name || '佚名'}}</view>
						<view class="tab-item-time clamp" style="width: 180rpx;text-align: center;">
							{{item.paytime | getTime}}</view>
						<view class="tab-item-num clamp" style="width: 180rpx;text-align: right;">￥{{item.amount }}</view>
					</view>
				</view>
			</view>
			<image src="../../static/donate/in-tit2.png" mode="" class="in-tit in-tit1"></image>
			<view class="in-line2 flex">
				<image src="../../static/donate/in-line5.png" mode="" class="line-qr"></image>
			</view>
			<image src="../../static/donate/in-tit3.png" mode="" class="in-tit in-tit1"></image>
			<view class="in-contribute">
				<image src="../../static/donate/in-money.png" mode="" class="in-tit in-money"></image>
				<view class="in-info flex" v-for="item in info">
					<view class="name flex">
						<view class="" v-for="itemt in item.tit">
							{{itemt}}
						</view>
					</view>
					<view class="" style="padding-right: 10rpx;">
						:
					</view>
					<view class="val ">
						{{item.val}}
					</view>
				</view>
				
				<image src="../../static/donate/in-art.png" mode="" class="in-tit in-money"></image>
				<view class="in-info flex" v-for="item in infos">
					<view class="name flex">
						<view class="" v-for="itemt in item.tit">
							{{itemt}}
						</view>
					</view>
					<view class="" style="padding-right: 10rpx;">
						:
					</view>
					<view class="val " v-html="item.val">
						<!-- {{}} -->
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		loadIndexs,
		bannerlist,
		getListAED,
		getDistance,
		getListMechanism,
		getdis,
		tocall
	} from '@/api/index.js';
	import {
		saveUrl,
		interceptor
	} from '@/utils/loginUtils.js';
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {
		userinfo
	} from '@/api/user.js';
	import uniPopup from '@/components/uni-popup/uni-popup.vue';
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import empty from '@/components/empty';

	import {
		getLoca
	} from '@/utils/wxAuthorized.js';
	import {
		getcomAddress,
		loveList
	} from '@/api/index.js';
	import topTitle from '../../components/top-title/top-title.vue';
	import store from '@/store/index.js';
	export default {
		components: {
			uniPopup,
			uniLoadMore,
			topTitle,
			empty
		},
		filters: {
			getTime(val) {
				let date = new Date(val * 1000);
				let Y = date.getFullYear();
				let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
				let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
				return Y + '/' + M + '/' + D;
			},
		},
		data() {
			return {
				info: [
					{
						tit: '开户名',
						val: '黄石市红十字会'
					},
					{
						tit: '银行账户',
						val: '567765132978'
					},
					{
						tit: '开户行',
						val: '中国银行黄石分行营业部'
					},
				],
				infos: [
					{
						tit: '负责人',
						val: '陈博文'
					},
					{
						tit: '咨询电话',
						val: '0714-6221833'
					},
					{
						tit: '地址',
						val: '湖北省黄石市桂林南路10号'
					},
				],
				carouselList: [], //轮播
				loveList: [],
				loadingType: 'more',
				page: 1,
				limit: 30,
				timer: '',
			};
		},
		onShow() {
			saveUrl();
			console.log(11, this);

			if (!this.hasLogin) {
				// 登录拦截
				interceptor();
			}

		},
		onLoad() {
			uni.hideTabBar()
			saveUrl();
			this.getLoveList()
		},
		computed: {
			...mapState('user', ['userInfo', 'baseURL', 'hasLogin'])
		},
		// 下拉加载
		methods: {
			goto() {
				this.navto('/pages/applic/contribution')
			},
			gundong() {
				let obj = this;
				console.log('zhe')
				if (obj.timer) {
					clearTimeout(obj.timer)
				}
				try{
					obj.timer = setTimeout(() => {
						obj.loveList.push(obj.loveList.shift());
						console.log(obj.loveList)
						obj.gundong();
					}, 2000);
				}catch(e){
					console.log(e)
				}
				
			},
			navto(url) {
				uni.navigateTo({
					url,
					fail() {
						uni.switchTab({
							url
						})
					}
				})
			},
			// 获取爱心榜数据
			getLoveList() {
				let obj = this
				if (obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
					return
				}
				obj.loadingType = 'loading'
				loveList({
					page: obj.page,
					limit: obj.limit
				}).then(({
					data
				}) => {
					obj.loveList = obj.loveList.concat(data.data)
					obj.gundong()
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.content {
		position: relative;
	}

	.bg-img {
		position: absolute;
		top: 0;
		left: 0;
		width: 750rpx;
		height: 2323rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.over-content {
		position: relative;
		top: 669rpx;
	}

	.item-wrapper {
		width: 636rpx;
		margin: 0 auto 76rpx;
		border: 1px solid #C9101B;
		// background: #fff;
		border-radius: 10px;
		position: relative;

		.item-tit {
			width: 199rpx;
			height: 55rpx;
			background: linear-gradient(0, #C9101B, #F24D33);
			border-radius: 10rpx;
			text-align: center;
			line-height: 55rpx;
			font-size: 34rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			position: absolute;
			top: -28rpx;
			left: 64rpx;
		}

		.item-info {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #ed4530;
			line-height: 49rpx;
			// background: linear-gradient(0deg, #C9101B 0%, #F24D33 99.267578125%);
			// -webkit-background-clip: text;
			// -webkit-text-fill-color: transparent;
			width: 100%;
		}

		.item-btn {
			justify-content: center;
			align-items: center;
			height: 72rpx;
			position: absolute;
			bottom: 50rpx;
			width: 568rpx;

			.xcb {
				width: 80rpx;
				height: 50rpx;
			}

			.item-btn-btn {
				width: 303rpx;
				height: 72rpx;
				margin: 0 10rpx;
				background: linear-gradient(0deg, #C9101B, #F24D33);
				border-radius: 36rpx;
				line-height: 72rpx;
				text-align: center;
				font-size: 34rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}
		}

		.tab-wrap {
			padding: 53rpx 40rpx 28rpx 33rpx;
			height: 410rpx;

			.tab-item {
				line-height: 45rpx;
				height: 45rpx;
				align-items: center;
				justify-content: space-between;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #ed4530;
			}
		}

	}
	
	.in-bg {
		background-image: url('../../static/donate/in-bg.png');
		width: 750rpx;
		height: 2750rpx;
		background-size: 100% 100%;
		padding-top: 135rpx;
		.in-tit {
			display: block;
		}
		.in-tit0 {
			width: 556rpx;
			height: 100rpx;
			margin:0 auto 70rpx;
		}
		.in-tit1 {
			width: 489rpx;
			height: 115rpx;
			margin: auto;
		}
		.tip {
			width: 302rpx;
			height: 37rpx;
			margin:30rpx auto 38rpx;
		}
		.in-love {
			width: 656rpx;
			height: 403rpx;
			overflow: hidden;
			background-image: url('../../static/donate/in-love.png');
			background-size: 100% 100%;
			margin: 0 auto 56rpx;
			padding: 110rpx 27rpx 20rpx;
		}
		.line-donate {
			width: 717rpx;
			height: 361rpx;
			background-image: url('../../static/donate/in-ent.png');
			background-size: 100% 100%;
			margin:-30rpx auto 0;
			padding-top: 171rpx;
			.btn {
				height: 150rpx;
				width: 150rpx;
				margin: auto;
				border-radius: 50%;
			}
		}
		.in-line {
			width: 656rpx;
			height: 390rpx;
			background-image: url('../../static/donate/in-line.png');
			background-size: 100% 100%;
			margin:21rpx auto 51rpx;
			justify-content: space-between;
			padding: 27rpx 22rpx;
			.line-qr {
				width: 272rpx;
				height: 272rpx;
				background-color: #fff;
			}
		}
		.in-line2 {
			width: 656rpx;
			height: 390rpx;
			background-image: url('../../static/donate/in-line3.png');
			background-size: 100% 100%;
			margin:21rpx auto 51rpx;
			justify-content: center;
			padding: 27rpx 22rpx;
			.line-qr {
				display: block;
				width: 272rpx;
				height: 272rpx;
				// background-image: url('../../static/donate/line-ewm.jpg');
				// // background-color: #fff;
				// background-size: 100% 100%;
			}
		}
		.in-contribute {
			width: 656rpx;
			// height: 527rpx;
			background-color: rgba(255, 255, 255, 0.63);
			margin:15rpx auto;
			border: 1px solid #f07568;
			padding: 40rpx 0 40rpx 40rpx;
			.in-money {
				width: 231rpx;
				height: 32rpx;
				margin:20rpx auto;
			}
		}
		.in-info {
			font-size: 30rpx;
			font-weight: 500;
			color: #333333;
			padding: 10rpx 6rpx;
			font-weight: bold;
			line-height: 1.5;
			.name {
				width:130rpx;
				justify-content: space-between;
				// &::after {
				// 	content: ':';
				// }
			}
			.val {
				// padding-left: 10rpx;
				// &::before {
				// 	content: ':';
				// 	padding-right: 10rpx;
				// }
			}
			.copy {
				
			}
		}
	}
	.tab-item {
		line-height: 45rpx;
		height: 45rpx;
		align-items: center;
		justify-content: space-between;
		font-size: 30rpx;
		font-weight: bold;
		color: #ed4530;
	}
</style>
