participation.vue 4.44 KB
<template>
	<!-- 活动参与 -->
	<view class="page">
		<view class="more page-box" @click="toMyAdd">
			<u-section :bold="false" title="我的活动申请" sub-title='' :show-line="false" color="#0FBB59" >
				<view slot="right">
					<u-icon name="arrow-rightward" color="#0FBB59" size="28"></u-icon>
				</view>
			</u-section>
		</view>
		<!-- 搜索 -->
		<view class="head-search">
			<u-search bg-color="#fff" placeholder="请输入关键词" v-model="query.activityName" :show-action="false" @search="search"></u-search>
			<u-button type="success" @click="search">搜索</u-button>
		</view>
		<view class="screen-list">
			<u-dropdown menu-icon="arrow-down-fill" :title-size="24" :height="40">
				<u-dropdown-item v-model="query.sortType" title="时间排序" :options="sortTypeOptions" @change="search"></u-dropdown-item>
				<u-dropdown-item v-model="query.status" title="活动状态" :options="statusOptions" @change="search"></u-dropdown-item>
			</u-dropdown>
		</view>
		<!-- 订单列表 -->
		<view class="goods-data">
			<u-row gutter="16" class="goods-list">
				<u-col span="6" v-for="(item,index) in datalist" :key="index"  @click="toDetail(item.id, '/pages/activityDetail/activityDetail')" >
					<view class="demo-layout good-item">
						<image :src="item.coverImage" style="width: 315rpx; height: 315rpx; border-radius: 10rpx;"></image>
						<view class="info">
							<view class="title">{{item.activityName}}</view>
							<view class="huo-card-item">活动日期:<span>{{item.startTime}}至{{item.endTime}}</span></view>
							<view class="huo-card-item">参与人数:<span>{{item.maxParticipants}}</span></view>
							<u-tag text="进行中" type="success" mode="dark" />
						</view>
					</view>
				</u-col>
				<u-loadmore :status="status" @loadmore='loading' style="width: 100%; text-align: center;"/>
			</u-row>
		</view>
		<view style="height: 120rpx;"></view>
		<view class="page-footer">
			<u-button type="success" @click="toAdd">活动申请</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: 'loadmore',
				datalist: [],
				total: 1,
				query: {
					activityName: '', // 搜索项
					sortType: '', // 排序方式
					status: '', // 活动状态
					pageNumber: 1,
					pageSize: 10,
				},
				sortTypeOptions: [
					{ label: '默认排序', value: 1 },
					{ label: '正序', value: 2 },
					{ label: '倒序', value: 3 },
				],
				statusOptions: [
					{ label: '进行中', value: 1 },
					{ label: '已结束', value: 2 },
					{ label: '未开始', value: 3 },
				],
				pageIndex :{
					pageNumber: 1,
					pageSize: 10,
				}
			}
		},
		onLoad() {
			this.status = 'nomore';
		},
		onPullDownRefresh(e) {
			let that = this
			that.status = 'loading';
			this.page = 0;
			setTimeout(() => {
				that.list = 1;
				that.status = that.list >= that.total ? 'nomore' : 'loadmore';
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom(e) {
			this.loading();
		},
		mounted() {
			this.getAll()
		},
		methods: {
			getAll(val){
				this.pageIndex.createUser  =uni.getStorageSync('shopId')
				this.$http.sendRequest('/cereActivityApplication/queryByPage', 'POST',this.pageIndex,1).then(res => {
				   this.datalist = res.data.data.content
				}).catch(err => {
					console.log(err)
					//请求失败
				})
			},
			toMyAdd() {
				// 跳转我的活动申请
				uni.navigateTo({
					url: '/pages/mycreated/mycreated'
				})
			},
			search() {
				this.query.createUser  =uni.getStorageSync('shopId')
				this.$http.sendRequest('/cereActivityApplication/queryByPage', 'POST',this.query,1).then(res => {
				   this.datalist = res.data.data.content
				   this.query ={
					   	activityName: '', // 搜索项
					   	sortType: '', // 排序方式
					   	status: '', // 活动状态
					   	pageNumber: 1,
					   	pageSize: 10,
					   
				   }
				})
			},
			loading() {
				let that = this
				if(that.status == 'nomore') return;
				that.status = 'loading';
				that.page = ++that.page;
				setTimeout(() => {
					that.list += 10;
					that.status = that.list >= that.total ? 'nomore' : 'loadmore';
				}, 300)
			},
			join(){
				uni.navigateTo({
					url: '/pages/mycreated/mycreated?id=1'
				})
			},
			toAdd() {
				uni.navigateTo({	
					url: '/pages/activityAdd/activityAdd'
				})
			},
			toDetail(item, path) {
				
				uni.navigateTo({
					url: `${path}?item=${item}`
				})
				
			},
		}
	}
</script>

<style scoped lang="scss">
	@import 'participation.scss';
</style>