<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>申请开店认证</title>
<link rel="stylesheet" type="text/css" href="<{$__PUBLIC__}>css/common_uqcms.css"> 
<link rel="stylesheet" type="text/css" href="<{$__APP__}>public/css/member.css"> 
<script type="text/javascript"src="<{$__PUBLIC__}>js/jquery.min.js"></script> 
<script type="text/javascript" src="<{$__PUBLIC__}>js/ajaxfileupload.js"></script> 
<!--datapiker-->
<script type="text/javascript" src="<{$__PUBLIC__}>plug/laydate/laydate.js"></script>
<link rel="stylesheet" type="text/css" href="<{$__PUBLIC__}>plug/laydate/need/laydate.css"> 
<link rel="stylesheet" type="text/css" href="<{$__PUBLIC__}>plug/laydate/skins/default/laydate.css"> 
<!--data end---> 
<style type="text/css"> 
html{ background:#f8f8f8; }
.header_bar{ width:100%; height:70px; background:#f8f8f8; float:left;}
.header{ width:820px; margin:0 auto;}
.header .logo{ width:330px; padding:26px 0 0 0; float:left; } 
.header .logo .img{ height:35px; margin:0 10px 0 0; float:left; }
.header .logo span{ padding:5px 0 0 0; font-size:16px; color:#333333; float: left;}
.header .back{ padding:35px 5px 0 0; float:right;}

.reg_main_bar{ width:100%; float:left;}
.reg_main{ width:820px; margin:0 auto;}
.reg_shop_box{background:#fff; margin:20px 0 20px 0; border-radius:5px; padding:20px 50px 50px 80px;  float:left;} 
table tr td.reg_name{ padding:5px 0 0 10px; font-size:16px; text-align:left; float:left;} 
table tr td span{ padding:5px 10px; float:left;}
table tr td span.red{ padding:8px 10px 0 5px; color:#FF0000; font-weight:bold; float:left;}
table tr td span.llong{ padding:5px 0 0 10px; float:left; } 
table tr td span.llong em{ font-style:inherit; padding:2px 0 0 0; float:left; }
td:first-child{ color:#999999;}

.companyBox{ display:none; }
.auth_status_msg{ width:700px; height:380px; line-height:380px; padding:25px 0px 10px; text-align:center; font-size:16px; float:left; }

/* 上传按钮 */
.img_box{ width:80px; height:110px; margin-right:10px; float:left;}
.img_show{ width:80px; height:80px; border:1px solid #f8f8f8; background:#f8f8f8;  float:left;}
.img_show img{ width:80px; height:80px; background:url(<{$__PUBLIC__}>images/noimg.png) center center no-repeat;  float:left; }
.img_add{ width:80px; padding:10px 0 0 0; float:left;}
.img_add a{ width:80px; padding:0; text-align:center; } 
</style> 
</head> 
<body> 
<div class="header_bar">
	<div class="header">
		<div class="logo">
			<div class="img"><a href="index.php"><img src="<{$__IMG__}><{$UQCMS.site_logo}>"/></a></div>
			<span>店铺申请</span>
		</div> 
		<div class="back"><a href="member.php">会员中心</a></div>
	</div>
</div> 
<div class="reg_main_bar">
	<div class="reg_main">
		<div class="reg_shop_box">
		<{if $UQCMS.shop_apply}>
			<{if $row.status == '0'}> 
				<div class="auth_status_msg">已经提交，等待小二审核！</div>
			<{elseif $row.status == '1'}>
				<div class="auth_stauts_msg">
					<span>已经认证通过</span>
					<a href="member.php?m=shop">已经认证通过，进入店铺中心。</a>
				</div> 
			<{else}>  
				<{if $row.status == '2'}>
					<div class="astatus">认证结果：<{$row.auth_reason}></div>
				<{/if}>
				<form id="form" method="post"> 
					<table class="etable" width="100%">
						<tr>
							<td colspan="2" class="reg_name">申请类型</td> 
						</tr> 
						<tr>
							<td width="160">申请类型：</td>
							<td>
								<label><input type="radio" name="type" class="chtype" value="1" checked="checked"/>个人</label>
								<label><input type="radio" name="type" class="chtype" value="2"/>企业</label> 
							</td>
						</tr>
					</table>	
					<table class="etable" width="100%" class="persionBox">
						<tr>
							<td colspan="2" class="persionName reg_name">个人身份证</td> 
						</tr> 
						<tr>
							<td width="160">证件人姓名：</td>
							<td><input type="text" name="id_name" size="38" id="id_name" value="<{$row.id_name}>"/><span class="red">*</span></td>
						</tr>
						<tr>
							<td>证件类型：</td>
							<td style="text-align:left;">
								<select name="id_type" id="id_type">
									<{uqcms m="category" c="common:card_type" v="id_type"}>
									<{foreach item=i key=k from=$id_type}>		
										<option value="<{$k}>" <{if $k == $row.id_type}>selected="selected"<{/if}>><{$i}></option> 
									<{/foreach}>			
								</select>
								<span class="red">*</span>
							</td>
						</tr>
						<tr>
							<td>证件号码：</td>
							<td><input type="text" name="id_code" size="38" id="id_code" value="<{$row.id_code}>"/><span class="red">*</span></td>
						</tr> 
						<tr>
							<td valign="top" style="padding-top:10px;">证件照：</td>
							<td> 
								<div class="img_box">
									<div class="img_show"><img src="<{if $row.id_img_up}><{$__IMG__}><{$row.id_img_up|img_size:80x80}><{/if}>"/></div>
									<div class="img_add">
										<a href="javascript:;" class="file">
											正面照上传<input type="file" name="id_img_up" class="upload_button" id="id_img_up"/>
										</a>
									</div>
									<input type="hidden" name="id_img_up" class="id_img_up" value=""/>
								</div>
								<div class="img_box">
									<div class="img_show"><img src="<{if $row.id_img_down}><{$__IMG__}><{$row.id_img_down|img_size:80x80}><{/if}>"/></div>
									<div class="img_add">
										<a href="javascript:;" class="file">
											反面照上传<input type="file" name="id_img_down" class="upload_button" id="id_img_down"/>
										</a>
									</div>
									<input type="hidden" name="id_img_down" class="id_img_down" value=""/>
								</div>
								<div class="img_box">
									<div class="img_show"><img src="<{if $row.holder_img}><{$__IMG__}><{$row.holder_img|img_size:80x80}><{/if}>"/></div>
									<div class="img_add">
										<a href="javascript:;" class="file">
											手持照上传<input type="file" name="holder_img" class="upload_button" id="holder_img"/>
										</a>
									</div>
									<input type="hidden" name="holder_img" class="holder_img" value=""/>
								</div>
							</td>
						</tr> 
					</table>  
				
					<table class="etable companyBox">
						<tr>
							<td colspan="2" class="reg_name">营业执照</td> 
						</tr> 
						<tr>
							<td width="160">营业执照注册号：</td>
							<td><input type="text" name="license_code" size="38" id="license_code" value="<{$row.license_code}>"/><span class="red">*</span></td>
						</tr>
						<tr>
							<td>营业期限：</td>
							<td>
								<input type="text" name="license_start_time" size="18" id="license_start_time" value="<{$row.license_start_time}>"/>
								<span>至</span>
								<input type="text" name="license_end_time" size="18" id="license_end_time" value="<{if $row.license_long_time == '0'}><{$row.license_end_time}><{/if}>"/>
								<span class="llong"><label><input type="checkbox" value="1" name="license_long_time" <{if $row.license_long_time == '1'}>checked="checked"<{/if}>/><em>长期</em></label></span>
							</td>
						</tr>
						<tr>
							<td>营业执照影印件：</td>
							<td> 
								<div class="img_box">
									<div class="img_show"><img src="<{if $row.license_img}><{$__IMG__}><{$row.license_img|img_size:80x80}><{/if}>"/></div>
									<div class="img_add">
										<a href="javascript:;" class="file">
										营业执照上传<input type="file" name="license_img" class="upload_button" id="license_img"/>
										</a>
									</div>
									<input type="hidden" name="license_img" class="license_img" value=""/>
								</div>
							</td>
						</tr> 
					</table> 
					<table class="etable" width="100%"> 
						<tr>
							<td width="160">&nbsp;</td>
							<td><input type="submit" name="submit" class="submit" value="申请开店"/><span>开通之后不能修改</span></td>
						</tr>  
					</table>
				</form>
			<{/if}> 
		<{else}>
			<div class="auth_status_msg">未开通申请</div>
		<{/if}>	
		</div> 
	</div>	
</div>	
</body>
</html>
<script type="text/javascript">
laydate({ elem: '#license_start_time', event: 'focus' });
laydate({ elem: '#license_end_time', event: 'focus' }); 
$(function(){
	$(".chtype").click(function(){ 
		checked = $(this).val();
		checkStatus(checked); 
	}); 
	<{if $row.shop_type == '2' || $smarty.get.type == '2'}>
		checkStatus('<{$row.shop_type}>'); 
	<{/if}>
	function checkStatus(checked){ 
		if(checked == '2'){
			$(".companyBox").show();
			$(".persionName").html('法人身份证');
		}else{
			$(".persionBox").show();
			$(".companyBox").hide();
			$(".persionName").html('个人身份证');
		}
	}
	// Ajax提交
	$("form").submit(function(){ 
		$.ajax({
			type:'POST',
			url:'?m=user&a=reg_shop_save',
			data:$("#form").serialize(), 
			success:function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					alert('申请成功');
					location.reload();
				}else{
					alert(data.msg);
					return false;
				}
			},
			error:function(){
				alert('系统错误');
			} 
		}); 
		return false;
	}); 
	// 上传文件
	$(document).on('change',".upload_button",function(){ 
		var $this = $(this);
		var $fid = $this.attr('id'); 
		$.ajaxFileUpload({
		   	url:'?m=album&a=upload&path=secret', 
		   	secureuri:false,
		   	fileElementId:$fid, 
		   	dataType: 'json',			//text json
		   	success: function(data){ 
				if(data.error == '0'){
					$('#'+$fid).parents('.img_add').prev('.img_show').children('img').attr('src',data.url);
					$('.'+$fid).val(data.name);
				}else if(data.error == '1'){
					alert(data.msg);
				}else{
					alert('系统繁忙');
				}
			}
		});
	});
});
 
</script>