<template>
		<view class="mainBox">
			<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="单据来源" @clickLeft="back">
				<!--右菜单-->
				<template slot="float">
					<view class="nav-icon-caozuo rightNav" @click="getsure"><u-button type="success" size="small" class="u-reset-button" text="确定"></u-button></view>
				</template>
			</uni-nav-bar>
			
			<view class="listBox">
						
				<view class="itemBox" v-for="(item, index) in listData" :key="index" @click="cleanchecked(index)">
					  <view class="chooseBox"> <uni-icons :type="choose===index?'checkbox-filled':'circle'" size="28" :color="choose===index?'#19be6b':'#eee'"></uni-icons></view>
					  <view class="infoBox">
						  <view class="tit u-line-1">配置采购  {{item.title}}</view>
						  <text class="tip">{{item.name}}  {{item.department}}</text>
					  </view>
					  <view class="stateBox">
						  <view class="tit">{{item.state==1?'已创建':'未创建'}}</view>
						  <text class="tip">{{item.time}}</text>
					  </view>
				</view>
				
			</view>
			
		</view>
</template>

<script>
	import { post } from "@/utils/api.js";
	
	export default {
		name:"DocumentSource",
		data() {
			return {
				listData:[
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					},
					{
						title:'YQ56336325222001',
						name:'张三',
						department:'省事务管理局',
						state:1,
						time:'2021-11-06 18:00'
					}
				], //列表数据
				screenHeight:'',       //设备高度
				choose:'',             //选择id
				chooseItem:{}         //传参信息
			};
		},
		onLoad(){
			 // 获取屏幕高度
			uni.getSystemInfo({
				success(res) {
					this.screenHeight = (res.screenHeight * (750 / res.windowWidth));
				}
		    });
		},
		//加载更多
		onReachBottom(){
			console.log("加载更多");
		},
		methods: {
		    //确定
			getsure() {
				console.log("点击确定");
				uni.$emit('updateData', this.chooseItem);
				uni.navigateBack({
					delta: 1
				})
				
			},
			cleanchecked(e){
				this.choose = e;
				this.chooseItem = this.listData[e];
			},
				
		}
		
		
		
	}
	
</script>

<style lang="scss" scoped>
	.itemBox{
		padding:30rpx 20rpx;
		display: flex;
		font-size: $uni-font-size-base;
		border-bottom: 1px #f2f2f2 solid;
		.chooseBox{
			margin-right: 20rpx;
		}
		.infoBox{
			.tit{max-width:100%;overflow: hidden;}
			.tip{
				color: #999;
				font-size: $uni-font-size-sm;
			}
		}
		.stateBox{
			margin-left: auto;
			text-align: right;
			.tit{
				
			}
			.tip{
				color: #999;
				font-size: $uni-font-size-sm;
			}
		}
	}

</style>