<template>
	<view class="query-wrap">
		<view class="title-cont">
			<view class="search-view">
				<uni-easyinput prefixIcon="search" :value="value" placeholder="请输入订单号"
				 @input="input">
				</uni-easyinput>
			</view>
			<v-tabs v-model="index" :tabs="tabList" @change="changeTab" :scroll="false"></v-tabs>
		</view>
		<z-paging ref="paging" @query="queryList" v-model="dataList" :use-page-scroll="true">
			<view class="inner-item" v-for="(item,index) in dataList" :key="index" @click="itemDetails(item)">
				<view class="item-stats">
					<span>{{item.stas}}</span>
				</view>
				<view class="inventory-item">
					<view class="shuo-item-name">
						<view class="shuo-label">
							订单号:
						</view>
						<view class="shuo-unit">
							{{item.ordNo}}
						</view>
					</view>
				</view>
				<view class="inventory-item">
					<view class="shuo-item">
						<view class="shuo-label">
							申领品种数:
						</view>
						<view class="shuo-cont">
							{{item.catCnt}}
						</view>
					</view>
					<view class="shuo-item">
						<view class="shuo-label">
							申领总数量:
						</view>
						<view class="shuo-cont">
							{{item.sumCnt}}
						</view>
					</view>
				</view>
				<view class="inventory-item">
					<view class="shuo-item">
						<view class="shuo-label">
							手术名称:
						</view>
						<view class="shuo-cont">
							{{item.oprnName}}
						</view>
					</view>
					<view class="shuo-item">
						<view class="shuo-label">
							手术间:
						</view>
						<view class="shuo-cont">
							{{item.oprtRoom}}
						</view>
					</view>
				</view>
				<view class="inventory-item">
					<view class="shuo-item">
						<view class="shuo-label">
							主治医生:
						</view>
						<view class="shuo-cont">
							{{item.atddr}}
						</view>
					</view>
					<view class="shuo-item">
						<view class="shuo-label">
							患者名称:
						</view>
						<view class="shuo-cont">
							{{item.patn}}
						</view>
					</view>
				</view>
				<view class="inventory-item">
					<view class="shuo-item-name">
						<view class="shuo-label">
							手术日期:
						</view>
						<view class="shuo-cont">
							{{item.oprtTime}}
						</view>
					</view>
				</view>
				<view class="inventory-item">
					<view class="shuo-item">
						<view class="shuo-label">
							申领人:
						</view>
						<view class="shuo-cont">
							{{item.crteUsrName}}
						</view>
					</view>
					<view class="shuo-item">
						<view class="shuo-label">
							申领时间:
						</view>
						<view class="shuo-cont">
							{{forMatTime(item.crteTime)}}
						</view>
					</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>
<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex';
	import {
		debounce
	} from 'lodash';
	import moment from "moment";
	import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin.js';
	export default {
		mixins: [ZPMixin],
		data() {
			return {
				index: 0,
				value: "",
				dataList: [],
				inputVal: "",
				codeVal: "",
				confirmVal: "",
				changeVal: "",
				classes: [],
				listData: [],
				tabList: ['待清台', '已清台'],
				valueList: 0,
				beforeClose: true,
				datetimesingle: [],
			}
		},
		computed: {
			// ...mapState(['groundData'])
		},
		onShow() {
			uni.$once('update', function(data) {
				// uni.redirectTo({
				// 	url: '/pages/grounding/grounding' //写你的路径
				// });
			})
		},
		mounted() {
			var pages = getCurrentPages();
			let currentRoute = pages[pages.length - 1].route
		},
		methods: {
			...mapActions(['getFollowData']),
			...mapMutations(['setAcceptDetaData']),
			async queryList(pageNo, pageSize) {
				await this.getFollowData({
					pam: {
						current: pageNo,
						size: pageSize,
						ordNo: this.value,
						stas: this.index == '0' ? 'C' : 'D'
					},
					that: this
				});
			},
			//日期格式化
			forMatTime(time) {
				return moment(time).format("YYYY-MM-DD");
			},
			//跳转清台详情	 
			itemDetails(item) {
				uni.setStorage({
					key: 'followplatdetail',
					data: {
						form: item,
						type: '3'
					}
				});
				uni.navigateTo({
					url: '/pages/followplatdetail/index',
					success: function(res) {
						console.log(res, "res")
					}
				});
			},
			input:debounce(function(e) {
				this.value = e;
				this.getFollowData({
					pam: {
						ordNo: this.value,
						stas: this.index == '0' ? 'C' : 'D'
					},
					that: this
				});

			},500),
			changeTab(index) {
				this.index = index;
				this.$refs.paging.reload();
			},
		},
		watch: {

		}

	}
</script>

<style lang="scss" scoped>
	.query-wrap {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		background-color: #F1F1F1;
		overflow-y: scroll;
		overflow-x: hidden;

		.time-view {
			height: 350rpx;
			background-color: #fff;
			padding: 50rpx 50rpx 0 50rpx;
			box-sizing: border-box;

			.btn-view {
				width: 100%;
				height: 100rpx;
				margin-top: 100rpx;
				display: flex;
				justify-content: space-around;
			}
		}

		.title-cont {
			padding-top: 10rpx;
			width: 100%;
			background-color: #fff;

			.search-view {
				width: 100%;
				height: 100rpx;
				display: flex;
				align-items: center;
				padding: 0rpx 20rpx 0rpx 20rpx;
				box-sizing: border-box;

				.filter-text {
					width: 72rpx;
					height: 50rpx;
					line-height: 50rpx;
					color: rgba(1, 169, 146, 1);
					font-size: 36rpx;
					font-family: PingFangSC-bold;
					padding-left: 20rpx;
				}
			}
		}
	}

	uni-page-body {
		width: 100%;
		height: 100%;
	}
</style>