{extend name="main"}
{block name="style"}
<style type="text/css">
	.flex-lable{width: 100px;color: #6c757d;text-align: right;padding-right: 10px;}
</style>
{/block}
{block name="body"}
<div class="bg-white p-3">
	<div class="py-3 small">
		<div class="flex pb-3">
			<div class="flex-lable">姓名：</div>
			<div>{{Resume.name}}</div>
			<div class="flex-lable">基本信息：</div>
			<div>
	        	{{Resume.age}}岁/
				<span v-if="Resume.sex==1">男</span>
				<span v-else-if="Resume.sex==2">女</span>
				<span v-else="Resume.sex">未设置</span>
	        	/{{Resume.educational_background}}/{{Resume.work_experience_time}}年经验
	        </div>
		</div>
		<div class="border-top pt-3">
			<div class="flex pb-3">
				<div class="flex-lable">期望职位：</div>
				<div>{{ResumeEmploymentIntention.jobs_cate1}}/{{ResumeEmploymentIntention.jobs_cate2}}/{{ResumeEmploymentIntention.jobs_cate3}}</div>
			</div>
			<div class="flex pb-3">
				<div class="flex-lable">期望行业：</div>
				<div>{{ResumeEmploymentIntention.industry}}</div>
			</div>
			<div class="flex pb-3">
				<div class="flex-lable">期望薪资：</div>
				<div>
					<span v-if="ResumeEmploymentIntention.min_salary>0">
						{{ResumeEmploymentIntention.min_salary}}~{{ResumeEmploymentIntention.max_salary}}K/月
					</span>
					<span v-else>面议</span>
					<span v-if="ResumeEmploymentIntention.area_city">| 想在{{ResumeEmploymentIntention.area_city}}工作</span>
				</div>
			</div>
			<div class="flex pb-3">
				<div class="flex-lable">求职状态：</div>
				<div>{{Resume.job_status}}</div>
			</div>
		</div>
	</div>
	<div class="table-responsive">
		<el-table
			ref="tableList"
	      	:data="tableData"
    		v-loading="search.ajax"
    		style="width: 100%;"
    		header-cell-class-name="table-header-DDE6FB">
	      <el-table-column
	        label="职位/发布企业"
	        min-width="200">
		      <template slot-scope="scope">
		      	<div>
		      	<el-link type="primary" :href="'{:config('web.url')}/jobs/'+scope.row.id+'.html'" target="_blank" :underline="false">{{scope.row.title}}</el-link>
		      	</div>
		      	<el-link type="info" :href="'{:config('web.url')}/company/'+scope.row.company_id+'.html'" target="_blank" :underline="false">{{scope.row.company_name}}</el-link>
		      </template>
	      </el-table-column>
	      <el-table-column
	      	prop="jobs_city"
	        label="地区"
	        width="180">
	      </el-table-column>
	      <el-table-column
	      	prop="industry"
	        label="行业"
	        width="180">
	      </el-table-column>
	      <el-table-column
	        label="学历/经验要求"
	        width="180">
		      <template slot-scope="scope">
				<span class="text-secondary">{{scope.row.education}}丨{{scope.row.exp_level}}</span>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="薪资待遇"
	        width="180">
		      <template slot-scope="scope">
					<span v-if="scope.row.salary_min>0">{{scope.row.salary_min}}-{{scope.row.salary_max}}K</span>
					<span v-else>面议</span>
		      </template>
	      </el-table-column>
	      <el-table-column
	      	prop="friendly_create_time"
	        label="刷新时间"
	        width="180">
	      </el-table-column>
	      <el-table-column
	        label="/"
	        width="80">
		      <template slot-scope="scope">
		        <el-button
		            type="primary"
		            plain
		            round
		            size="minism"
		            @click="deliveryResume(scope.row)"
		            v-if="scope.row.is_delivery===0">
		            投递
		        </el-button>
		        <el-button
		            type="info"
		            plain
		            round
		            size="minism"
		            v-else>
		            已投递
		        </el-button>
		      </template>
	      </el-table-column>
	    </el-table>
	</div>
	<div class="table-responsive py-3 text-center">
		<el-pagination
		  background
	      @size-change="handleSizeChange"
	      @current-change="handleCurrentChange"
	      :current-page="search.page"
	      :page-sizes="[10,50,100,200]"
	      :page-size="search.pageSize"
	      layout="total, sizes, prev, pager, next, jumper"
	      :total="search.total">
	    </el-pagination>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
	{empty name="Resume"}
	var Resume={};
	{else/}
	var Resume={:json_encode($Resume,JSON_UNESCAPED_UNICODE)};
	{/empty}
	{empty name="ResumeEmploymentIntention"}
	var ResumeEmploymentIntention={};
	var jobs_city='';
	var jobscate='';
	{else/}
	var ResumeEmploymentIntention={:json_encode($ResumeEmploymentIntention,JSON_UNESCAPED_UNICODE)};
	var jobs_city='';
	var jobscate='';
	if (ResumeEmploymentIntention.job_area2)
	jobs_city=ResumeEmploymentIntention.job_area2;
	if (ResumeEmploymentIntention.jobscate1
		&&ResumeEmploymentIntention.jobscate2
		&&ResumeEmploymentIntention.jobscate3)
	jobscate=[ResumeEmploymentIntention.jobscate1,ResumeEmploymentIntention.jobscate2,ResumeEmploymentIntention.jobscate3];
	{/empty}
</script>
<script type="text/javascript">
	var vm=new Vue({
		el:'#app',
		data:{
			view:XYBase.view,
			Resume:Resume,
			ResumeEmploymentIntention:ResumeEmploymentIntention,
			confirm:false,
			search:{
				salary_min:ResumeEmploymentIntention.salary_min,
				salary_max:ResumeEmploymentIntention.salary_max,
				cid:jobscate,
				city:jobs_city,
				industry:ResumeEmploymentIntention.industry_id?ResumeEmploymentIntention.industry_id:'',
				jobs_type:ResumeEmploymentIntention.nature_of_work,
				ajax:false,
				page:1,
				total:0,
				pageSize:10
			},
			tableData:[],
		},
		watch:{
		    view:XYBase.viewWatch,
		},
		created(){
			XYBase.created(this);
          	this.initHtml();
		},
	    methods: {
			handleSizeChange(val) {
				this.search.page=1;
				this.search.pageSize=val;
	          	this.initHtml();
			},
			handleCurrentChange(val) {
				this.search.page=val;
	          	this.initHtml();
			},
			deliveryResume(row){
				var _this=this;
				const loading=XYBase.openloading();
				$.getJSON('/resume/deliveryResume/{$Resume.id}/'+row.id+'?confirm='+_this.confirm,function(ret) {
		        	_this.confirm=0;
					loading.close();
					if (ret) {
						if (ret.code === 0) {
							row.is_delivery=1;
							XYBase.success(ret.msg);
						}else if(ret.code === 200){
							_this.$confirm(ret.msg, '提示', {
								dangerouslyUseHTMLString:true,
					          	confirmButtonText: '确定',
					          	cancelButtonText: '取消',
					          	type: 'warning'
					        }).then(() => {
					        	_this.confirm=1;
					        	_this.deliveryResume(row);
					        }).catch(() => {
					        });
						}else if(ret.code === -600){
							_this.$confirm(ret.msg, '提示', {
					          confirmButtonText: '确定',
					          cancelButtonText: '取消',
					          type: 'warning'
					        }).then(() => {
					        }).catch(() => {
					        	XYBase.msg('已取消');
					        });
						}else{
							XYBase.msg(ret.msg);
						}
					}
				});
			},
	      	initHtml() {
	      		var _this=this;
	      		_this.search.ajax=true;
				$.ajax({
					url:'/resume/matching/{$Resume.id}',
					type:'get',
					data:_this.search,
					dataType:'json',
					error:function(err){
	      				_this.search.ajax=false;
						XYBase.error(XYBase.config.system_network_error);
					},
					success:function(ret){
	      				_this.search.ajax=false;
						if (ret) {
							if (ret.code === 0) {
								_this.search.total=ret.data.total;
								_this.tableData=ret.data.data;
							}else{
								XYBase.msg(ret.msg);
							}
						}else{
							XYBase.error(XYBase.config.system_network_error);
						}
					}
				});
			}
	    }
	});
</script>
{/block}