<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase.php');?>
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/viewer/dist/viewer.min.css">
<div class="marauto" style="margin-top: 6px;margin-right: 5px;">
	<div class="searchParam" id="shop-index-ser-pa">
		<form method="get">
		<b>VIN：</b><input type="text"  class="form-control" name="vin" value="<?php echo $Params['vin'];?>" placeholder="vin号码">&nbsp;&nbsp;&nbsp;&nbsp;
		<b>状态：</b><select  class="form-control" name="status">
			<option value="">--所有--</option>
			<option <?php if($Params['status']=='-1'){echo 'selected';}?> value="-1">无效</option>
			<option <?php if($Params['status']==='0'){echo 'selected';}?> value="0">待核对</option>
			<option <?php if($Params['status']=='1'){echo 'selected';}?> value="1">有效</option>
		</select>&nbsp;&nbsp;&nbsp;&nbsp;
		<button type="submit" class="btn btn-primary"> 查 询 </button>&nbsp;&nbsp;&nbsp;&nbsp;
	</form>
	</div>
	<div class="pad10">
		<table id="shop-list-all" class="table table-bordered table-hover" style="margin-bottom: 10px;">
			<thead>
				<tr>
					<th width="30px"><input type="checkbox" onclick="Inverse('veidarr[]')"></th>
					<th width="80px">操作</th>
					<th class="center" width="60px">状态</th>
					<th class="center" width="150px">VIN</th>
					<th class="center" width="150px">型号</th>
					<th class="center" width="100px">发动机</th>
					<th class="center" width="50px">WMI</th>
					<th class="center" width="90px">VIN1-8</th>
					<th class="center" width="60px">VIN10</th>
					<th class="center" width="60px">VIN11</th>
					<th class="center" width="80px">VIN12-17</th>
					<th class="center" width="">图片</th>
					<th class="center" width="">备注</th>
					<th class="center" width="90px">反馈用户</th>
					<th class="center" width="130px">添加时间</th>
					<th class="center" >审核信息</th>
				</tr>
			</thead>
			<tbody>
				<?php if(!empty($lists)){ ?>
				<?php foreach($lists as $k => $v ){ ?>
					<tr>
						<td><input type="checkbox" name="veidarr[]" value="<?php echo $v['ve_id']?>"></td>
						<td>
							<!--<?php if(empty($v['ve_status'])){?>
							<a href="javascript:;" class="a_blue marr10 check_vin" data-id="<?php echo $v['ve_id'];?>">审核</a>
							<?php }?>-->
							<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>ypcCar/standModelAnyAdd?ve_id=<?php echo $v['ve_id'];?>" class="a_blue marr10" target="_blank">处理</a>
							<a href="javascript:;" class="red del_vin" data-id="<?php echo $v['ve_id'];?>">删除</a>
						</td>
						<td><?php echo $statusArr[$v['ve_status']];?></td>
						<td><a href="http://www.yiparts.com/vin?type=vin&keyword=<?php echo $v['ve_vin']?>" class="a_blue" target="_blank"><?php echo $v['ve_vin']?></a></td>
						<td><?php echo $smaArr[$v['ve_vin']]? $smaArr[$v['ve_vin']]['sma_gxb_code_show']: '';?></td>
						<td><?php echo $smaArr[$v['ve_vin']]? $smaArr[$v['ve_vin']]['sma_engine']: '';?></td>
						<td><?php echo substr($v['ve_vin'], 0, 3)?></td>
						<td><?php echo substr($v['ve_vin'], 0, 8)?></td>
						<td><?php echo substr($v['ve_vin'], 9, 1)?></td>
						<td><?php echo substr($v['ve_vin'], 10, 1)?></td>
						<td><?php echo substr($v['ve_vin'], 11, 6)?></td>
						<td>
							<?php if(!empty($v['imgArr'])){?>
								<?php foreach($v['imgArr'] as $vv){?>
									<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>ypcCar/standModelAnyAdd?ve_id=<?php echo $v['ve_id'];?>" class="a_blue marr10" target="_blank"><img style="max-width:200px;max-height:100px;" class="img_view" src="<?php echo mvc::$cfg['FILE_CENTER']['pjl']['url_get'];?>&c=oth&f=<?php echo $vv;?><?php echo mvc::$cfg['FILE_CENTER']['pjl']['get_uri'];?>"></a>
								<?php }?>
							<?php }?>
							<?php if(!empty($othimg[$v['ve_vin']])){?>
								<?php foreach($othimg[$v['ve_vin']] as $vv){?>
									<a href="<?php echo mvc::$cfg['ADMIN_URI'];?>ypcCar/standModelAnyAdd?ve_id=<?php echo $v['ve_id'];?>" class="a_blue marr10" target="_blank"><img style="max-width:200px;max-height:100px;" class="img_view" src="<?php echo mvc::$cfg['HOST']['vinimg_'.$vv['vii_imghost']].$vv['vii_img'];?>"></a>
								<?php }?>
							<?php }?>
						</td>
						<td><?php echo $v['ve_notice']?></td>
						<td><?php echo $userArr[$v['ve_uid']]['u_name'];?></td>
						<td><?php echo date('Y-m-d H:i:s',$v['ve_atime'])?></td>
						<td>
							<?php if(!empty($v['checkArr'])){?>
								<span>审核人：<?php echo $userArr[$v['checkArr']['uid']]['u_name'];?></span></br>
								<span>审核意见：<?php echo $v['checkArr']['remark'];?></span></br>
								<span>审核时间：<?php echo date('Y-m-d H:i',$v['checkArr']['time']);?></span></br>
							<?php }?>
						</td>
					</tr>
				<?php } ?>
				<?php }else{ ?>
				<tr>
					<td colspan="13"><div class="shoplist-error-msg">无相关记录！</div></td>
				</tr>
				<?php } ?>
			</tbody>
		</table>
	</div>
	<div style="padding-left: 10px;">
		<button type="button" class="btn btn-info" id="batchdelbtn" style="margin-top:10px;">批量删除</button>
		<?php echo $Page;?>
	</div>
</div>

<div class="modal fade" id="changeStatusModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">审核意见</h4>
            </div>
            <div class="modal-body">
            	<form id="check_vin_form">
            		<input type="hidden" name="vId" >
	            	<div class="liuyan-wrap mar10" style="display: block;">
						<label class="radio-inline">
						  <input type="radio" name="status" id="inlineCheckbox1" value="-1">无效
						</label>
						<label class="radio-inline">
						  <input type="radio" name="status" id="inlineCheckbox2" value="0">待核对
						</label>
						<label class="radio-inline">
						  <input type="radio" name="status" id="inlineCheckbox3" value="1">有效
						</label>
					</div>
					<div class="liuyan-wrap" style="display: block;">
						<textarea placeholder="需要在此填写审核意见！" name="remark" class="form-control liuyan-textarea"></textarea>
						<div class="gray">谢谢您的建议，已处理。</div>
						<div class="gray">请提供行驶证或者车辆铭牌，便于核实，谢谢。</div>
					</div>
            	</form>
            </div>
            <div class="modal-footer center">
				
                <button type="button" id="finishStatusChange" class="btn btn-primary">提交</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/viewer/dist/viewer.min.js"></script>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footBase.php');?>
<script type="text/javascript">
	$(function(){
		/*var $image = $('.img_view');
		$image.viewer({
		  inline: false,
		  fullscreen:true,
		});*/
		$('.check_vin').click(function(){
			$('#check_vin_form input[name="vId"]').val($(this).data('id'))
			$('#changeStatusModel').modal('show');
		});
		$('#finishStatusChange').click(function(){
			if($('#check_vin_form input[name="status"]:checked').length<1){
				MESSAGE.alert('请选择审核状态');
				return ;
			}
			$.post(ADMIN_URI+'pjlShop/checkVin?isAjax=1',$('#check_vin_form').serialize(),function(res){
				if(MESSAGE.ajaxError(res)){
					window.location.reload();
				}
			},'json')
		});
		$('.del_vin').click(function(){
			MESSAGE.confirm('确定要删除该条记录？','del('+$(this).data('id')+')');
		})
		$("#batchdelbtn").click(function(){
			var veids = GetCheckboxVal('veidarr[]');
			if(veids.length < 1){
				MESSAGE.alert('请选择需要删除的记录');
				return false;
			}
			MESSAGE.confirm('确定要删除吗?', 'batchDel()')
		})
	})
	function del(vId){
		if(vId==undefined)
			return;
		$.post(ADMIN_URI+'pjlShop/delCheckVin?isAjax=1',{"vId":vId},function(res){
			if(MESSAGE.ajaxError(res)){
				window.location.reload();
			}
		},'json')
	}
	function batchDel(){
		var veids = GetCheckboxVal('veidarr[]');
		if(veids.length < 1){
			MESSAGE.alert('请选择需要删除的记录');
			return false;
		}
		$.post(ADMIN_URI+"pjlShop/batchDelVinError", {'veids': veids, 'isAjax':1},function(Data){
			if(MESSAGE.ajaxError(Data)){
				MESSAGE.alert('删除成功！');
				window.location.reload();
			}
		}, "json");
	}
</script>