<style>
	.salesApproval{padding-top: 30px;}
	.salesApproval .salesApprovalNav{width: 232px; height: 52px;}
	.salesApproval .salesApprovalNav>li{float: left; width: 116px; height: 52px; color: #666; text-align: center; line-height: 52px; background: #E9E9E9; cursor: pointer;}
	.salesApproval .salesApprovalNav>li.active{background: #fff; color: #333;}
	.salesApproval .salesApprovalNav .divActive{margin: 0 auto; width: 26px; height: 3px; background: #E95252;}
	.salesApproval .salesApprovalList{width: 100%; height: auto; background: #fff; padding: 15px 30px; overflow: hidden;}
	.salesApproval .salesApprovalList>ul{padding: 20px 0;}
	.salesApproval .salesApprovalList>ul li{float: left; width: 160px; height: 206px; border-radius: 10px; border:1px solid #ccc; margin:0 20px 20px 0; cursor: pointer; text-align: center;}
	.salesApproval .salesApprovalList>ul li>img{width: 48px; height: 48px; margin:20px 0 5px;  border-radius: 24px;}
	.salesApproval .salesApprovalList>ul li>p.style{font-size: 12px; color: #999; margin:2px 0 5px;}
	.salesApproval .salesApprovalList>ul li>p.style1{width: 120px; cursor: pointer; height: 24px; line-height: 24px; font-size: 14px; background: #E4EFFF; color: #257BF1; display: inline-block; border-radius: 4px; margin: 10px 0;}
	.salesApproval .salesApprovalList>ul li>p.style2{width: 120px; cursor: pointer; height: 24px; line-height: 24px; font-size: 14px; background: #E6E6E6; color: #666666; display: inline-block; border-radius: 4px;}
    .salesApproval .salesApprovalListWork{width: 100%; height: auto; background: #fff; padding: 15px 30px; overflow: hidden;}
	.salesApproval .salesApprovalListWork>ul{padding: 20px 0;}
	.salesApproval .salesApprovalListWork>ul li{float: left; width: 160px; height: 206px; border-radius: 10px; border:1px solid #ccc; margin:0 20px 20px 0; cursor: pointer; text-align: center;
	position: relative;}
	.salesApproval .salesApprovalListWork>ul li>img{width: 48px; height: 48px; margin:20px 0 5px; border-radius: 24px;}
	.salesApproval .salesApprovalListWork>ul li>p.style{font-size: 12px; color: #999; margin:2px 0 15px;}
	.salesApproval .salesApprovalListWork>ul li>p.style1{font-size: 14px; color: #666; margin: 5px 0; text-align: left; text-indent:28px;}
	.salesApproval .salesApprovalListWork>ul li>em{position: absolute; left: -1px; top: -1px;
	 font-size: 12px; color: #fff; background: #257BF1; width: 54px; text-align: center; line-height: 20px; height: 20px;
	 border-radius: 10px 10px 10px 0;}
	

</style>
<template>
	<div class="salesApproval">
		<div class="salesApprovalNav">
			<li :class="{active:type==1}" @click="type=1">
				{{$t('salesModule.Personnel')}}
				<div class="divActive" v-show="type==1"></div>
			</li>
			<li :class="{active:type==2}"  @click="type=2">
				{{$t('salesModule.WorkPlan')}}
				<div class="divActive" v-show="type==2"></div>
			</li>
		</div>
		<div class="salesApprovalList" v-loading='loading' v-show="type==1">
			<!--<div class="query-box">
				<ul class="user_time_picker">
					<li><span><em>提交时间</em><el-date-picker value-format="yyyy-MM-dd" type="date"></el-date-picker></span></li>
					<li><span><em>员工姓名</em><el-input></el-input></span></li>
					<li style="margin-right: 0;">
						<input type="button" class="hollowFixedBtn"  value="查询"/>
					</li>
				</ul>	
			</div>-->
			<ul>
				<li v-for="item in  list" @click="goUrl('salesApprovalDetail',item.CreateBy)">
					<img v-if='!item.Photo' src="../../assets/img/litheader.png"/>
				    <img v-if='item.Photo' :onerror="defaultImg" :src='item.Photo'/>	
					<p class="fz14 color333">{{item.AccountName}}</p>
					<p class="style">{{item.CreateTime}}</p>
					<p class="style1" >{{$t('salesModule.Pending')}}：{{item.WaringAudit}}</p>
					<p class="style2" >{{$t('salesModule.YSP')}}：{{item.Audited}}</p>
				</li>
				<p v-show="list.length==0" class="alcenter fz14 color333">{{$t('system.content_noData')}}</p>
			</ul>
		</div>
		<el-pagination
			v-show="type==1"
			background
			@current-change="handleCurrentChange"
			:current-page.sync="currentPage"
			layout="total,prev, pager, next, jumper" 
			:page-size=msg.pageSize 
			:total=total>
		</el-pagination>
		<div class="salesApprovalListWork" v-loading='loading' v-show="type==2">
			<div class="query-box">
				<ul class="user_time_picker">
					<li><span><em>{{$t('salesModule.SaveTime')}}</em><el-date-picker v-model='msg1.ExpectVisitDateTime' value-format="yyyy-MM-dd" type="date"></el-date-picker></span></li>
					<li style="margin-right: 0; top:0!important">
						<input type="button" class="hollowFixedBtn"  :value="$t('pub.searchBtn')" @click="getList1()"/>
					</li>
				</ul>	
			</div>
			<ul>
				<li v-for="item in  list1"  @click="goUrl('salesApprovalDetail',item.createBy)">
					<em v-show="item.isAdvertising=='0'" style="background:#257BF1;">{{$t('salesModule.Pending')}}</em>
					<em v-show="item.isAdvertising!='0'" style="background:#0ED6A0;">{{$t('salesModule.YSP')}}</em>
					<img v-if='!item.createPhoto' src="../../assets/img/litheader.png"/>
				    <img v-if='item.createPhoto' :onerror="defaultImg" :src='item.createPhoto'/>	
					<p class="fz14 color333">{{item.emName}}</p>
					<p class="style">{{msg1.ExpectVisitDateTime}}</p>
					<p class="style1" >1.{{$t('salesModule.addCustomer')}}{{item.addNewCustomerCount}}{{$t('salesModule.TheName')}}；</p>
					<p class="style1" >2.{{$t('salesModule.VisitOldCustomer')}}{{item.visitOldCustomerCount}}{{$t('salesModule.TheName')}}。</p>
				</li>
				<p v-show="list1.length==0" class="alcenter fz14 color333">{{$t('system.content_noData')}}</p>
			</ul>
		</div>
		<el-pagination
			v-show="type==2"
			background
			@current-change="handleCurrentChange1"
			:current-page.sync="currentPage1"
			layout="total,prev, pager, next, jumper" 
			:page-size=msg1.pageSize 
			:total=total1>
		</el-pagination>
	</div>
</template>
<script>
	export default {
		data() 
		{
			return { 
				tomorrowDate:'',
				type:1,
				loading:true,
				defaultImg: 'this.src="' + require("../../assets/img/litheader.png") + '"',
				msg:{
					pageIndex:1,
					pageSize:20,
				},
				msg1:{
					pageIndex:1,
					pageSize:20,
					ExpectVisitDateTime:''
				},
				currentPage:1,
				currentPage1:1,
				total:0,
				total1:0,
				list:[],
				list1:[],
				
			}
		},
		methods:{
			getList(){
				this.loading=true
				this.apipost('app_customer_GetPlanAuditForEmployee',this.msg,res=>{
					if(res.data.resultCode==1){
						this.list=res.data.data.pageData
						this.total=res.data.data.count
						this.loading=false
					}else{
						this.$message.error(res.data.message)
					}
				},err=>{})
			},
			getList1(){
				this.loading=true
				if(this.msg1.ExpectVisitDateTime==''||this.msg1.ExpectVisitDateTime==null){
					this.msg1.ExpectVisitDateTime=this.tomorrowDate
				}
				this.apipost('app_today_visit_GetEmployeeVisitList',this.msg1,res=>{
					if(res.data.resultCode==1){
						this.list1=res.data.data.pageData
						this.total1=res.data.data.count
						this.loading=false
					}else{
						this.$message.error(res.data.message)
					}
				},err=>{})
			},
			goUrl(path,id){
            	this.$router.push({name: path,query:{"id":id}});
			},
			addDate(date,days){ 
		       let d=new Date(date); 
		       d.setDate(d.getDate()+days); 
		       let month=d.getMonth()+1>9?d.getMonth()+1:'0'+(d.getMonth()+1); 
		       let day=d.getDate()>9?d.getDate():'0'+d.getDate(); 
		       return d.getFullYear()+'-'+month+'-'+day; 
		     }, 
			handleCurrentChange(val) {
				this.msg.pageIndex = val;
				this.getList()				
			},
			handleCurrentChange1(val) {
				//this.msg.pageIndex = val;
				//this.getList()				
			},
			resetPageIndex() {
				this.msg.pageIndex = 1;
				this.currentPage = 1
			},	
		},
		mounted(){
		   this.getList()
		   this.getList1()
		   let d=new Date(); 
	       let month=d.getMonth()+1>9?d.getMonth()+1:'0'+(d.getMonth()+1); 
	       let day=d.getDate()>9?d.getDate():'0'+d.getDate(); 
	       let today=d.getFullYear()+'-'+month+'-'+day; 
	       
		   this.tomorrowDate=this.addDate(today,1)
		   this.msg1.ExpectVisitDateTime=this.addDate(today,1)
		}
		
	}
</script>
