<template>
	<view class="content">
		<view class="nav flex">
			<view class="item" v-for="(item,index) in navList" :class="{action: current == index}" @click="changeCurrent(index)">
				{{item.tit}}
			</view>
		</view>
		<swiper :current="current" class="swiper-box" :style="{'height': height}">
			<swiper-item v-for="item in navList">
				<scroll-view scroll-y="true" :style="{'height': height}">
					<empty v-if="item.loaded === true && item.list.length === 0"></empty>
					<view class="order-item" v-for="items in item.list" >
						<view class="item-top flex">
							<view class="order-type">
								预约订单
							</view>
							<view class="order-id">
								订单编号:9876543211025666
							</view>
							<view class="order-status">
								待服务
							</view>
						</view>
						<view class="item-user flex">
							<image src="../../static/icon/where.png" mode="" class="where"></image>
							<view class="">
								<view class="">
									山西省太原市小店区谢涛清真羊肉汤(并州东街店)
								</view>
								<view class="phone">
									陈琪137****58343
								</view>
							</view>
						</view>
						<view class="item-user flex">
							<image src="../../static/icon/time.png" mode="" class="where"></image>
							<view class="">
								<view class="">
									山西省太原市小店区谢涛清真羊肉汤(并州东街店)
									山西省太原市小店区谢涛清真羊肉汤(并州东街店)
								</view>
							</view>
						</view>
						<view class="item-yg">
							<view class="" style="padding-bottom: 15rpx;">
								服务类型：<text>洗衣</text>
							</view>
							<view class="">
								代理人：<text>李丹丹</text>
							</view>
						</view>
						<view class="item-btm flex">
							下单时间：2024/12/15
						</view>
					</view>
					<uni-load-more :status="item.loadingType" v-if="!(item.loaded === true && item.list.length === 0)"></uni-load-more>
				</scroll-view>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import empty from '@/components/empty';
	export default {
		components: {
			empty,
			uniLoadMore
		},
		data() {
			return {
				height: '',
				current: 0,
				navList: [
					{
						tit: '待服务',
						status: 0,
						list: [],
						loading: 'more',
						loaded: true,
						page: 1,
						limit: 10
					},
					{
						tit: '进行中',
						status: 1,
						list: [1,2,2,2,2,2],
						loading: 'more',
						loaded: false,
						page: 1,
						limit: 10
					},
					{
						tit: '已完成',
						status: 2,
						list: [],
						loading: 'more',
						loaded: false,
						page: 1,
						limit: 10
					}
				]
			}
		},
		onLoad() {
			
		},
		onShow() {
			
		},
		onReachBottom() {
			
		},
		onReady(res) {
					var that = this;
					uni.getSystemInfo({
						success: resu => {
							const query = uni.createSelectorQuery();
							query.select('.swiper-box').boundingClientRect();
							query.exec(function(res) {
								that.height = resu.windowHeight - res[0].top + 'px';
							});
						},
						fail: res => {}
					});
				},
		methods: {
			changeCurrent(index) {
				if(index == this.current) return;
				this.current = index;
				this.getOrderList()
			},
			getOrderList() {
				let that = this;
				let item = that.navList[that.current];
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding-top: 20rpx;
	}
	.nav {
		width: 690rpx;
		height: 64rpx;
		background: $base-color;
		border-radius: 30rpx;
		margin: auto;
		justify-content: space-around;
		margin-bottom: 30rpx;
		.item {
			width: 209rpx;
			line-height: 56rpx;
			border-radius: 28rpx;
			text-align: center;
			color: #FFFFFF;
		}
		.action {
			color: $base-color;
			background: #FFFFFF;
			// font-weight: bold;
		}
	}
	.swiper-box {
	}
	.order-item {
		padding:0 20rpx;
		background-color: #fff;
		width: 700rpx;
		margin: 0 auto 20rpx;
		border-radius: 20rpx;
		&:last-of-type {
			margin-bottom: 0;
		}
		.item-top {
			height: 92rpx;
			border-bottom: #f5f5f5 3rpx solid;
			font-weight: 500;
			.order-type {
				// padding: 10;
				padding: 8rpx 10rpx;
				
				background: #ffeae5;
				border-radius: 0rpx 10rpx 0rpx 10rpx;
				font-size: 20rpx;
				color: #FF4E00;
			}
			.order-id {
				flex-grow: 1;
				font-size: 22rpx;
				color: #A3A8BB;
				padding-left: 10rpx;
			}
			.order-status {
				font-size: 26rpx;
				color: #FF4E00;
			}
		}
		.item-yg {
			width: 660rpx;
			height: 122rpx;
			background: #F5F5F5;
			font-size: 24rpx;
			color: #666666;
			padding: 25rpx 0 0 20rpx;
			margin-bottom: 24rpx;
			text {
				font-weight: bold;
				color: #333333;
			}
		}
		.item-btm {
			height: 92rpx;
			font-size: 24rpx;
			color: #A3A8BB;
			border-top: #f5f5f5 3rpx solid;
		}
		.item-user {
			justify-content: flex-start;
			align-items: flex-start;
			font-weight: bold;
			font-size: 26rpx;
			color: #000000;
			margin: 30rpx 0;
			.where {
				width: 24rpx;
				height: 28rpx;
				margin-right: 23rpx;
			}
			.time {
				width: 24rpx;
				height: 24rpx;
				
			}
			image {
				flex-shrink: 0;
				margin-top:5rpx;
			}
			.phone {
				padding-top: 15rpx;
				font-size: 23rpx;
				color: #666666;
			}
		}
	}
</style>