<template>
	<view class='container'>
		<u-tabs :list="tabList" lineHeight="0" :current="currentTab" @click="onChangeTab" :scrollable="true"
			lineColor="#FFF" :inactiveStyle="{'font-size': '28rpx', 'color': '#878787'}"
			:activeStyle="{'font-size': '32rpx', 'color': '#FFFFFF'}"></u-tabs>
		<view class="list">
			<scroll-view scroll-y @scrolltolower="scrolltolower" style="height: 100%;">
				<view v-for="(item,index) in list" :key="index">
					<view class="item" style="position: relative;" @click="onItem(item)">
						<text
							style="position:absolute;top: 0;right: 0;width: 130rpx;height: 48rpx;line-height: 48rpx;text-align: center; background: #0F0F0F;border-radius: 0rpx 20rpx 0rpx 4rpx;color:#FE42C2;">
							{{item.state=='2'?'已完成':'进行中'}}
						</text>
						<image class="wh-190 br-20" :src="$config.cdnUrl+splitList(item.image)[0]"></image>
						<view class="flex-between-center ml-10" style="flex: 1;">
							<view class="flex-column fs-24 pad-15"
								style="flex: 1;height: 100%; justify-content:space-around;color: white;">
								<text>{{item.name}}</text>
								<text>{{item.startTime}}</text>
								<text>{{item.address}}</text>
								<text>类型：{{item.type==1?'定卡':'拼卡'}}</text>
							</view>
						</view>
					</view>
				</view>
				<emptydata v-if="list.length == 0"></emptydata>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: false,
				currentTab: 0,
				tabList: [{
						name: '全部',
					},
					{
						name: '定卡',
					},
					{
						name: '拼卡',
					}
				],
				list: [],
				data: {},
				yqhImg: ''
			};
		},
		onLoad(options) {
			this.getList()
		},
		methods: {
			splitList(data) {
				if (data == null) {
					return []
				}
				return data.split(',')
			},
			onChangeTab(e) {
				this.currentTab = e.index
				this.getList()
			},
			getList() {
				const params = {
					url: '/system/member/listParty',
					method: "GET",
					data: {
						type: this.currentTab
					}
				}
				this.$request(params).then(res => {
					this.list = res.rows
				})
			},
			onItem(item) {
				this.show = true
				this.data = item
				this.$wskj.to('/pagesMain/pages/ddxq?orderId=' + item.orderId)
			},

		},
	};
</script>

<style scoped>
	.container {
		height: 100%;
		height: 100%;
		background: #0F0F0F;
		display: flex;
		flex-direction: column;
	}

	.list {
		overflow: hidden;
		height: calc(100% - 60rpx);
	}

	.item {
		display: flex;
		background: #2F2128;
		border-radius: 20rpx;
		margin: 0 24rpx;
		margin-bottom: 40rpx;
		padding: 20rpx;

	}
</style>