<template>
	<uv-popup ref="popup" :round="30">
		<view class="content">
			<scroll-view
			scroll-y="true" 
			style="height: 100%;"
			@scrolltolower="loadMoreData">
				<view class="item"
				v-for="(item, index) in list"
				:key="item.id"
				>
					<contractManageItem 
					@click="send(item)"
					:item="item"/>
				</view>
			</scroll-view>
		</view>
	</uv-popup>
</template>

<script>
	import mixinList from '@/mixins/list.js'
	import contractManageItem from './contractManageItem'
	export default {
		components : {
			contractManageItem,
		},
		mixins : [mixinList],
		data() {
			return {
				mixinsListApi : 'queryContractTemplateList',
				uid : 0,
			}
		},
		methods: {
			open(id){
				this.uid = id
				this.getData()
				this.$refs.popup.open('bottom')
			},
			send(item){
				uni.showModal({
					title: `确认发送${item.title}合同吗？`,
					success : e => {
						if(e.confirm){
							this.$api('addContract', {
								bossPage : item.bossPage,
								bossPosition : item.bossPosition,
								bossStatus : 0,
								employeePage : item.employeePage,
								employeePosition : item.employeePosition,
								template : item.template,
								contract : item.contract,
								employeeStatus : 0,
								employeeId : this.uid,
								title : item.title,
							}).then(res => {
								if(res.code == 200){
									uni.showToast({
										title: '发送成功',
										icon: 'none'
									})
									this.$refs.popup.close()
								}
							})
						}
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
.content{
	height: 60vh;
	width: 100%;
	padding-top: 30rpx;
	.item{
		
	}
}
</style>
