<template>
	<view :class="[AppTheme]" class="container">
		<!-- 头部切换 -->
		<!-- #ifdef APP-PLUS || MP-WEIXIN -->
		<u-sticky offsetTop="0" style="z-index: 10;">
			<!-- #endif -->
			<!-- #ifdef H5 -->
			<u-sticky offsetTop="-44" style="z-index: 10;">
				<!-- #endif -->
				<view class="head_fixation">
					<u-tabs :scrollable="false" ref="uTabs" :list="navList" lineWidth="30" :lineColor="primary"
						:activeStyle="{
			        color: primary,
			        transform: 'scale(1.05)'
			    }" :inactiveStyle="{
			        color: '#606266', 
			        transform: 'scale(1)'
			    }" :current="current" @click="tabsChange">
					</u-tabs>
				</view>
			</u-sticky>
			<!-- 订单列表 -->
			<view class="order_list">
				<view v-if="orderlist.length" class="order_item" v-for="(item, index) in orderlist" :key="index">
					<view class="model_one">
						<view class="model_two">
							  <view></view>
							<view class="model_two_1">{{item.title}}</view>
							<view class="model_two_2">{{item.status}}</view>
						</view>
						<view class="model_three">
							<view class="model_three_1">
								<image :src="item.img"></image>
							</view>
							<view class="model_three_2">
								
								<view class="model_three_3">操作类型:   {{item.operator_deatil}}</view>
								<view class="model_three_3">操作内容:  {{item.content}}</view>
								<view class="model_three_3">备注:  {{item.remark}}</view>
							</view>
						</view>

						<view class="model_four">
							<view  class="model_four_1">
								<view  class="model_four_2">操作对象</view>
								<view class="model_four_2">操作费用</view>
								<view class="model_four_2">操作员</view>
							</view>
							<view  class="model_four_3">
								<view class="model_four_4">{{item.seed_name}}({{item.seed_num}}m²)</view>
								<view class="model_four_4">{{item.order_money}}</view>
								<view class="model_four_4" v-if="item.username">{{item.username}}</view>
								<view class="model_four_4" v-else>--</view>
							</view>

						</view>
					</view>



				</view>
				<u-loadmore v-if="orderlist.length" :line="true" :status="status" :dashed='false' />
				<view class="footer_bottom"></view>
				<!-- 订单为空显示 -->
				<view v-if="orderlist.length==0">
					<u-empty text="暂无订单" mode="order" margin-top="100" custom-style="#fff">
					</u-empty>
				</view>
			</view>


			<!-- 回到顶部 -->
			<u-back-top :scroll-top="scrollTop" :custom-style="customstyle"></u-back-top>

	</view>
</template>

<script>
	import Landapi from '@/api/land/index.js';
	import Mallapi from '@/api/mall/index.js';
	export default {
		data() {
			return {
				status: 'loadmore',
				primary: this.$theme.primary,
				settingFile: getApp().globalData.siteinfo,
				// 当前排序方式视图
				nowsetyindex: 1,
				// 订单列表
				orderlist: [],
				//顶部距离
				scrollTop: 0,
				modalshow: false,
				content: '该订单还未支付,是否先支付?',
				seorder: {},
				nowindex: 1, //当前列表分页
				customstyle: {
					background: '#F4F6F8'
				},
				navList: [{
						name: '待处理'
					},
					{
						name: '进行中'
					},
					{
						name: '已完成'
					}
				],
				current: 0,
				swiperCurrent: 0,
				nomorelist: false,

			};
		},
		onLoad() {
			this.getorderlist(this.swiperCurrent+1, this.nowindex);

		},
		onPullDownRefresh() {
			console.log('下拉刷新了')
			this.nowindex = 1
			this.getorderlist(this.swiperCurrent, this.nowindex);
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1500)
		},
		onReachBottom() {
			console.log('上拉加载了')
			this.nowindex++
			let parms = {
				p: this.nowindex,
				type: this.swiperCurrent
			};
			this.status = 'loading'
			Landapi.getoperator(parms).then(res => {
				if (res.status == 1) {
					if (res.data !== null && res.data !== undefined && res.data.length > 0) {
						// 获取服务套餐详情集合
						this.status = 'nomore'
						res.data.forEach(item => {
							that.orderlist.push(item);
						});
						if (res.data.length == 10) {
							this.status = 'loadmore'
						} else {
							this.status = 'nomore'
						}
					}
				} else {
					this.nowindex--
					this.status = "nomore"
				}
			})
		},
		onShow() {},
		methods: {

			// tabs通知swiper切换
			tabsChange(e) {
				this.nomorelist = false;
				this.nowindex = 1;
				if (this.swiperCurrent === e.index) {
					return;
				} else {
					this.swiperCurrent = e.index;
					this.orderlist = [];
					this.getorderlist(this.swiperCurrent + 1, this.nowindex);
				}
			},

			//获取订单列表
			getorderlist(type, p) {
				var that = this;
				let parms = {
					p: p,
					type: type
				};
				if (!this.nomorelist) {
					Landapi.getoperator(parms).then(res => {
						if (res.status == 1) {
							if (res.data !== null && res.data !== undefined && res.data.length > 0) {
								// 获取服务套餐详情集合
								this.orderlist = []
								res.data.forEach(item => {
									that.orderlist.push(item);
								});
								this.nowindex = p;
								this.status = 'nomore'
								if (res.data.length == 10) {
									this.status = 'loadmore'
								} else {
									this.status = 'nomore'
								}
							}
						} else {
							this.status = 'nomore'
							this.nomorelist = true;
						}
					});
				}
			},


		}
	};
</script>

<style lang="scss">
	.action-btn {
		width: 160upx;
		height: 60upx;
		margin: 0;
		margin-left: 24upx;
		padding: 0;
		text-align: center;
		line-height: 60upx;
		font-size: $font-sm + 2upx;
		background: #fff;
		border-radius: 100px;

		&:after {
			border-radius: 100px;
		}

		&.recom {
			background: #fff9f9;
			border-width: 1rpx;
			border-style: solid;
		}
	}

	.container {
		background: $page-color-base;
		height: 100%;
		box-sizing: border-box;
	}

	.nomorelist {
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 30rpx;
		color: #333;
		margin-bottom: 20rpx;
	}
	
	
	
	.model_one{
		  display: flex;
		  flex-direction: column;
		.model_two{
			 display: flex;
			 justify-content: space-between;
			  float: right;
			  padding: 0 20rpx;
			 
				 .model_two_1{
				 	color: #333;
				 	font-weight: 600;
				  
				 }
				.model_two_2{
					color: red;
					font-size: 30rpx;
				}  
		 
		}
		.model_three{
			  display: flex;
			  justify-content: flex-start;
			  align-items: center;
			  padding: 0 20rpx;
			.model_three_1{
				
				image{
					width: 150rpx;
					height: 150rpx;
				}
			}
			.model_three_2{
				 
				color: #999;
				padding: 20rpx;
					
				.model_three_3{
					padding: 10rpx 0;
					font-size: 28rpx;
				}
			}
			
		}
		.model_four{
			   display: flex;
			   flex-direction: column;
			.model_four_1{
				display: flex;
				justify-content: space-between;
				padding: 20rpx 50rpx;
				.model_four_2{
					color: #999;
					font-size: 28rpx;
				}
			}
			
			.model_four_3{
				display: flex;
				justify-content: space-between;
				padding: 20rpx 50rpx;
				 
				
				.model_four_4{
					font-size: 28rpx;
					text-align: center;
					height: 45rpx;
					line-height:45rpx;
					min-width: 15%;
					 
				}
			}
		}
	}
	
	
	
	
	
	

	.tabbom {
		// margin: 85rpx 0 0 0;
	}

	.swiper-box {
		height: calc(100vh - 44px);
		overflow-y: auto;
	}

	.footer_bottom {
		width: 100%;
		height: 40rpx;
	}

	.anjnaa {
		width: 100%;
		height: 1rpx;
	}

	.head_fixation {
		width: 100%;
		z-index: 11;
		background-color: #ffffff;
	}

	.data_display {
		padding: 0 17.5rpx;
		background-color: #ffffff;
		font-variant: common-ligatures;
	}

	.sort_set {
		display: flex;
		justify-content: space-around;
		align-items: center;
		height: 75rpx;
	}

	.order_list {
		overflow-y: auto;
		height: 100%;
	}

	.sort_item {
		font-size: 32rpx;
		color: #333;
		padding-bottom: 15rpx;
		border-bottom: 3px solid transparent;
	}

	.order_item {
		width: 97%;
		margin: 25rpx auto;
		padding: 30rpx 0 0 0;
		background-color: #ffffff;
		border-radius: 15rpx;
		box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.08);
	}

	.farm_name {
		font-size: 34rpx;
		color: #000;
		padding: 0 20rpx;
	}

	.bor_solp {
		background-color: #999;
		height: 1rpx;
		width: 100%;
		transform: scaleY(0.3);
		margin: 25rpx 0;
	}

	.order_detil {
		display: flex;
		justify-content: space-between;
		padding: 0 20rpx;
	}

	.seed_item_thumbnail {
		object-fit: cover;
		border-radius: 10rpx;
		width: 180rpx;
		height: 126rpx;
	}

	.right_deile {
		width: calc(100% - 215rpx);
	}

	.article_title_p1 {
		display: flex;
		justify-content: flex-start;
		align-items: center;

		.atintl_icon {
			border-radius: 0 10rpx 0 10rpx;
			padding: 5rpx 10rpx;
			font-size: 28rpx;
			color: #ffffff;
		}

		.astin_text {
			font-size: 28rpx;
			color: #000;
			margin-left: 15rpx;
		}
	}

	.article_title_p2 {
		font-size: 26rpx;
		color: #000;
		margin: 25rpx 0;
	}

	.article_title_p3 {
		font-size: 26rpx;
		color: #000;
	}

	.pay_status {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0 20rpx;
	}

	.pay_status_text {
		font-size: 28rpx;
	}

	.pay_status_button {
		border-radius: 40rpx;
		color: #ffffff;
		min-width: 90rpx;
		height: 40rpx;
		padding: 10rpx 25rpx 10rpx 25rpx;
		line-height: 40rpx;
		font-size: 28rpx;
		text-align: center;
		margin: 0 10rpx;
	}

	.nsnnsss {
		display: flex;
		justify-content: flex-start;
	}
</style>
