<template>
	<view class="the_reminder">
		<view class="reminder_item" v-for="(item,index) in list" :key="index" @click="jumpDetail(item)">
			<view class="item_con">
				<view class="item_left">
					<view class="iconfont icon-task"></view>
					<view>{{item.content}}</view>
				</view>
				<view class="circle_dot" v-if="item.status == 0"></view>
			</view>
			<view class="item_time">
				<view class="iconfont icon-clock"></view>
				<view class="lxs_time">{{item.send_time}}</view>
			</view>
		</view>
		<view style="height: 200rpx;"></view>
		<u-empty v-if="list.length == 0" text="暂无更多"></u-empty>
	</view>
</template>

<script>
	import { netMessageList } from '@/api/clues.js'
	
	export default {
		data() {
			return {
				page:1,
				limit:10,
				totalPage:1,
				list:[]
			}
		},
		onShow() {
			this.page = 1
			this.list = []
			this.getList()
		},
		onReachBottom() {
			if(this.page >= this.totalPage){
				return
			}
			this.page ++
			this.getList()
		},
		methods: {
			getList() {
				let params = {
					page: this.page,
					limit: this.limit
				}
				netMessageList(params).then(res=>{
					this.list = this.list.concat(res.data.data)
					this.totalPage = res.data.last_page
				})
			},
			//跳转详情页
			jumpDetail(item) {
				if(item.relation_type == 'examine'){
					//审批
					if(item.examine.relation_type == 'consume'){
						//费用
						let id = item.examine.relation_id
						uni.navigateTo({
							url: '/pages/index/groupCompany/cost/costDetail?id='+id
						})
					}else if(item.examine.relation_type == 'contract'){
						//合同
						let id = item.examine.relation_id
						uni.navigateTo({
							url: '/pagesB/contract/contractDetail?id=' + id
						})
					}else if(item.examine.relation_type == 'receivables'){
						//回款
						let id = item.examine.relation_id
						uni.navigateTo({
							url: '/pagesB/contract/paymentDetail?id='+id
						})
					}else if(item.examine.relation_type == 'achievement'){
						//目标金额
						let id = item.examine.relation_id
						uni.navigateTo({
							url: '/pagesA/crm/salesTarget/history_detail?id='+id
						})
					}else if(item.examine.relation_type == 'approval'){
						let id = item.examine.relation_id
						uni.navigateTo({
							url:'/pagesA/work/approve/approveDetail?id='+id
						})
					}else if(item.examine.relation_type == 'leave'){
						//请假
						let id = item.examine.relation_id
						uni.navigateTo({
							url:'/pagesA/punchclock/leave/detail?id='+id
						})
					}else if(item.examine.relation_type == 'card'){
						//补卡
						let id = item.examine.relation_id
						uni.navigateTo({
							url:'/pagesA/punchclock/card/detail?id='+id
						})
					}
					
				}else if(item.relation_type == 'consume'){
					//费用
					let id = item.relation_id
					uni.navigateTo({
						url: '/pages/index/groupCompany/cost/costDetail?id='+id
					})
				}else if(item.relation_type == 'record'){
					//跟进记录
					let id = item.relation_id
					uni.navigateTo({
						url:'/pagesA/crm/cluesManagement/followUpDetail/followUpDetail?id='+id,
					})
				}else if(item.relation_type == 'contract'){
					//合同
					let id = item.relation_id
					uni.navigateTo({
						url: '/pagesB/contract/contractDetail?id=' + id
					})
				}else if(item.relation_type == 'plan') {
					//回款 计划
					let id = item.relation_id
					uni.navigateTo({
						url: '/pagesB/contract/contractDetail?id=' + id
					})
				}else if(item.relation_type == 'receivables') {
					//回款
					let id = item.relation_id
					uni.navigateTo({
						url: '/pagesB/contract/paymentDetail?id='+id
					})
				}else if(item.relation_type == 'event') {
					//日程
					let id = item.relation_id
					uni.navigateTo({
						url:'/pages/index/dataList?type=2'
					})
				}else if(item.relation_type == 'customer') {
					//客户
					let id = item.relation_id
					uni.navigateTo({
						url: '/pages/index/groupCompany/groupCompany?id='+id
					})
				}else if(item.relation_type == 'sign') {
					//签到
					let id = item.relation_id
					uni.navigateTo({
						url: '/pages/signin/signin'
					})
				}else if(item.relation_type == 'achievement'){
					//目标金额
					let id = item.relation_id
					uni.navigateTo({
						url: '/pagesA/crm/salesTarget/history_detail?id='+id
					})
				}else if(item.relation_type == 'daily'){
					//工作报告详情
					let id = item.relation_id
					uni.navigateTo({
						url:'/pageB/workreport/workDetail?id='+id
					})
				}else if(item.relation_type == 'notice'){
					//公告
					let id = item.relation_id
					uni.navigateTo({
						url:'/pages/news/noticeDetail?id='+id
					})
				}else if(item.relation_type == 'approval'){
					//办公
					let id = item.relation_id
					uni.navigateTo({
						url:'/pagesA/work/approve/approveDetail?id='+id
					})
				}else if(item.relation_type == 'leave'){
					//请假
					let id = item.relation_id
					uni.navigateTo({
						url:'/pagesA/punchclock/leave/detail?id='+id
					})
				}else if(item.relation_type == 'card'){
					//补卡
					let id = item.relation_id
					uni.navigateTo({
						url:'/pagesA/punchclock/card/detail?id='+id
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.the_reminder {
		padding: 40rpx 20rpx 100rpx;

		.reminder_item {
			background-color: #fff;
			border-radius: 10rpx;
			padding: 0 30rpx;
			margin-bottom: 20rpx;

			.item_con {
				display: flex;
				padding: 20rpx 0;
				justify-content: space-between;
				.item_left{
					display: flex;
					justify-content: flex-start;
				}
				.icon-task {
					padding-right: 20rpx;
				}

				.circle_dot {
					width: 12rpx;
					height: 12rpx;
					background-color: #fb6260;
					margin: 11rpx 0 0 80rpx;
					border-radius: 10rpx;
				}

			}

			.item_time {
				display: flex;
				align-items: center;
				padding-bottom: 20rpx;
				color: #999;
				:last-child {
					margin-top: 5rpx;
				}
			}
		}
	}
	.lxs_time{
		padding-left: 5px;
		padding-top: 1px;
	}
</style>
