<template>
	<view class="content">
		<!-- <view class="top">
			<view class="Search-box">
				<view class="Search-box-size">
					<image class="box-img" src="../../static/images/img01.png"></image>
					<input type="text" class="box-word" placeholder="请输入关键字" v-model="keyword"  />
				</view>
				<view class="Search-box-sort" @click="messagesearch">搜索</view>
			</view>
		</view> -->
		<!-- <view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item.id)">
			<view class="box-left">
				<image :src="$store.state.baseURL + item.image" mode="" class="left-img"></image>
			</view>
			<view class="box-right">
				<view class="right-top word1_ellipsis">
					{{item.title}}
				</view>
				<view class="right-center">
					{{item.synopsis}}
				</view>

			</view>
		</view> -->
		<view class="list-box" v-for="(item,index) in science" :key='index' @click="Jump(item.id,item.plan_id)">
			<view class="box-left">
				<image :src="$store.state.baseURL + item.image" mode="" class="left-img"></image>
			</view>
			<view class="box-right">
				<view class="right-top word1_ellipsis">
					{{item.order_name}}
				</view>
				<view class="right-center">
					每月捐款金额:{{item.price}}
				</view>
				<view class="right-foot">
					当前状态：{{item.is_signing == 0 ?'进行中': '已停止'}}
				</view>
			</view>
		</view>
		<!-- <view class="xq" v-for="item in science" @click="Jump(item.id)">
			<view class="line flex">
				<image src="../../static/icon/dk1.png" mode=""></image>
				<view class="name">
					捐款项目
				</view>
				<view class="val">
					{{item.order_name}}
				</view>
			</view>
			<view class="line flex">
				<image src="../../static/icon/dk2.png" mode=""></image>
				<view class="name">
					每月捐款金额
				</view>
				<view class="val">
					{{item.price}}元
				</view>
			</view>
			<view class="line flex">
				<image src="../../static/icon/dk3.png" mode=""></image>
				<view class="name">
					支付方式
				</view>
				<view class="val">
					微信支付
				</view>
			</view>
		</view> -->
		<!-- <uni-load-more :status="loadingType"></uni-load-more> -->
	</view>
</template>

<script>
	import { getArticList} from '@/api/index.js';
	import { getMyPlan} from '@/api/money.js';
	export default{
		data(){
			return{
				keyword:'',
				science:[],
				page: 1,
				limit: 10,
				loadingType:'more'
			}
		},
		onLoad() {
			this.loadData();
		},
		onReachBottom() {
			this.loadData()
		},
		filters: {
			time(val) {
				let arr = val.split(' ')
				return arr[0]
			}
		},
		methods:{
			messagesearch() {
				let keyword = this.keyword;
				console.log(keyword);
				let arrlist = [];
				for (let i = 0; i < this.science.length; i++) {
					if (this.science[i].title.indexOf(keyword) != -1) {
						arrlist.push(this.science[i]);
					}
				}
				this.science = arrlist;
				if (keyword == '') {
					this.loadData();
				}
			},
			loadData(){
				let obj = this;
				if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
					return
				}
				obj.loadingType = 'loading'
				getMyPlan({
					page: obj.page,
					limit: obj.limit
				}).then(({ data }) => {
					obj.science = obj.science.concat(data.data);
					obj.page++
					if(obj.limit == data.data.length) {
						obj.loadingType = 'more'
					}else {
						obj.loadingType = 'noMore'
					}
				});
			},
			Jump(id,plan_id) {
				uni.navigateTo({
					url:"/pages/index/dk?id="+id + '&plan_id=' + plan_id
				})	
			},
			
		}
	}
</script>

<style lang="scss">
	//搜索框
	.Search-box {
		padding-left: 20rpx;
		padding-right: 20rpx;
		height: 100rpx;
		background: #ffffff;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.Search-box-sort {
			font-size: 30rpx;
	
			font-weight: 500;
			color: rgba(102, 102, 102, 1);
	
			.sort-text {
				width: 57rpx;
				height: 29rpx;
				font-size: 30rpx;
				font-weight: 500;
				color: rgba(51, 51, 51, 1);
				line-height: 58rpx;
				margin-right: 19rpx;
			}
			.sort-img {
				width: 21rpx;
				height: 11rpx;
				margin-bottom: 4rpx;
			}
		}
	
		.Search-box-size {
			width: 630rpx;
			height: 65rpx;
			border-radius: 32rpx;
			background-color: #f1f1f1;
			padding-left: 36rpx;
			display: flex;
			align-items: center;
	
			.box-img {
				height: 32rpx;
				width: 32rpx;
				margin-right: 16rpx;
			}
			.box-word {
				width: 100%;
				font-size: 22rpx;
				font-weight: 500;
				color: rgba(205, 203, 203, 1);
				line-height: 55rpx;
			}
		}
	}

    .content{
		line-height: 1;
		.list-box{
			width: 725rpx;
			height: 200rpx;
			margin: 20rpx auto 0;
			background: #FFFFFF;
			box-shadow: 0px 5rpx 5rpx 0px rgba(35, 24, 21, 0.06);
			border-radius: 7rpx;
			padding:0 20rpx;
			display: flex;
			align-items: center;
			.box-left{
				width: 230rpx;
				height: 145rpx;
				margin-right: 20rpx;
				.left-img{
					width: 230rpx;
					height: 145rpx;
				}
			}
			.box-right{
				width: 430rpx;
				height: 145rpx;
				position: relative;
				.right-top{
					font-size: 25rpx;
					font-weight: bold;
					color: #333333;
					margin-bottom: 24rpx;
				}
				.right-center{
					width: 362rpx;
					// height: 53rpx;
					font-size: 21rpx;
					font-weight: bold;
					color: #999999;
					line-height: 33rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;//在第几行显示...
					-webkit-box-orient: vertical;
				}
				.right-foot{
					font-size: 21rpx;
					font-weight: bold;
					color: #999999;
					line-height: 31rpx;
					text-align: right;
					// margin-top: 13rpx;
					position: absolute;
					right: 0;
					bottom: 0;
				}
			}
		}
	}
.xq {
		margin: 20rpx 0;
		background-color: #fff;
		padding: 45rpx  0;
		.line {
			align-items: center;
			padding: 30rpx 27rpx 30rpx 33rpx;
			* {
				flex-shrink: 0;
			}
			image {
				width: 34rpx;
				height: 34rpx;
			}
			.name {
				font-weight: bold;
				font-size: 30rpx;
				color: #333333;
				padding-left: 12rpx;
			}
			.val {
				flex-grow: 1;
				font-size: 26rpx;
				color: #666666;
				text-align: right;
			}
		}
	}
</style>
