<style>
	.activeSearch {
		display: flex;
		margin: 10px;
		width: 100%;
		justify-content: space-between;
	}

	.active_Search {
		width: 60px;
		height: 34px;
		background-color: #000450;
		color: #fff;
		text-align: center;
		line-height: 34px;
		border-radius: 2px;
		margin-right: 20px;
		display: inline-block;
	}

	.activeContent {
		margin: 15px;
	}

	.activeList {
		display: flex;
		border-bottom: 1px solid #F4F4F4;
		position: relative;
		padding-bottom:15px;
	}

	.active_Left {
		width: 153px;
		height: 115px;
		flex-shrink: 0;
	}

	.active_Left img {
		width: 100%;
		height: 100%;
	}

	.activeName {
		color: #404040;
		font-size: 14px;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
	}

	.activeTime {
		position: absolute;
		color: #B9B9B9;
		bottom: 0;
		font-size: 13px;
		bottom: 10px;
		color: #B9B9B9;
	}

	.active_gight {
		margin-left: 10px;
	}
</style>
<template>
	<view class="activeInner">
		<view class="activeSearch">
			<u-search placeholder="输入商品名称" style="width:81%;" :show-action="false" v-model="keyword"></u-search>
			<view class="active_Search">搜索</view>
		</view>
		<u-empty v-if="dataList.length==0" text="暂无数据" mode="data"></u-empty>
		<scroll-view v-else :scroll-y="true" :enable-back-to-top="true" :enable-flex="true"
		 @scrolltolower="lower" :style="{ 'height': `calc(100%)`}">
			<view class="activeContent">
				<view class="activeList" v-for="(item,index) in dataList" :key="index">
					<view class="active_Left">
						<img :src="item.CoverImg" alt="" />
					</view>
					<view class="active_gight">
						<view class="activeName">{{item.ActivityName}}</view>
						<view class="activeTime">{{item.StartTimeStr}}</view>
					</view>
				</view>
			</view>
			<view style="padding:10px 0;">
				<u-loadmore :status="status" :load-text="loadText" :font-size="24" :margin-top="0" :margin-bottom="0" />
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: '',
				msg: {
					pageIndex: 1,
					pageSize: 10,
					ActivityType: 1
				},
				dataList:[],
				pageCount: 1,
				loadText: {
					loadmore: "轻轻上拉，加载更多",
					loading: "努力加载中",
					nomore: "没有更多了",
				},
			}
		},
		created() {},
		mounted() {},
		onLoad(option) {
			this.msg.ActivityType = option.Id;
			this.getData(1);
		},
		methods: {
			getData(num){
				if (num == 1) {
					this.dataList = [];
				}
				this.request2({
						url: "/api/AppletTrade/GetCommerceActivityPage",
						data: this.msg,
					},
					(res) => {
						if (res.resultCode == 1) {
							console.log(res, '数据');
							this.dataList = this.dataList.concat(res.data.pageData);
							this.pageCount = res.data.pageCount;
						}
					}
				);
			},
			//滚动加载
			lower(e) {
				if (this.msg.pageIndex < this.pageCount) {
					this.msg.pageIndex++;
					this.status = "loading";
					this.getData();
				} else {
					this.status = "nomore";
				}
			},
		}
	}
</script>
