<?php include $this->admin_tpl('meta', 'admin');?>
<title>会员中心设置 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 会员中心设置 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
	<form class="form form-horizontal" method="post" action="" onsubmit="return check_all(this)">
		<div id="tab_system" class="HuiTab">
			<div class="tabBar cl"><span>基本设置</span><span>其他设置</span></div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>会员中心模板风格：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box w_200">
						<select name="member_theme" class="select">
						<option value="">请选择模板</option>
						  <?php 
						      foreach($member_theme_list as $val){
									$str = $data["member_theme"]==$val ? ' selected="selected" ' : '';
									echo '<option value="'.$val.'" '.$str.'>'.$val.'</option>';
							  }
						  ?>
						</select>
						</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否开启会员注册：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<label class="label_radio"><input name="member_register" type="radio" <?php echo $data["member_register"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="member_register" type="radio" <?php echo $data["member_register"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>新会员注册邮件验证：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<label class="label_radio"><input name="member_email" type="radio" <?php echo $data["member_email"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="member_email" type="radio" <?php echo $data["member_email"]? '' : 'checked' ?> value="0"> 关闭</label>
						<span class="yzm-explain">需填写邮箱配置，且开启后会员注册审核功能无效</span>
					</div>		
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>会员注册需要管理员审核：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="member_check" type="radio" <?php echo $data["member_check"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="member_check" type="radio" <?php echo $data["member_check"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否开启会员登录验证码：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<label class="label_radio"><input name="member_yzm" type="radio" <?php echo $data["member_yzm"]? 'checked' : '' ?> value="1"> 开启</label>
						<label class="label_radio"><input name="member_yzm" type="radio" <?php echo $data["member_yzm"]? '' : 'checked' ?> value="0"> 关闭</label>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>1元人民币充值积分数量：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="rmb_point_rate" value="<?php echo $data["rmb_point_rate"];?>" class="input-text w_200">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>新会员默认积分：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="member_point" value="<?php echo $data["member_point"];?>" class="input-text w_200">
						<span class="yzm-explain">积分=经验，区别在于积分可以通过消费减少，经验只增不减，下同</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>每日登录奖励积分：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text"  name="login_point" value="<?php echo $data["login_point"];?>" class="input-text w_200">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>发布评论奖励积分：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text"  name="comment_point" value="<?php echo $data["comment_point"];?>" class="input-text w_200">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>投稿奖励积分：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text"  name="publish_point" value="<?php echo $data["publish_point"];?>" class="input-text w_200">
						<span class="yzm-explain">负数则为扣除积分</span>
					</div>
				</div>
			</div>
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">QQ登录 App ID：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="qq_app_id" value="<?php echo $data["qq_app_id"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">QQ登录 App key：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="qq_app_key" value="<?php echo $data["qq_app_key"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">QQ登录 回调地址：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="qq_callback" readonly value="<?php echo U('member/other/qq_login');?>" class="input-text disabled" style="width:50%">
						<span class="yzm-explain">QQ登录回调地址不可修改，请复制该地址到你的腾讯开放平台</span>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">微博登录 App Key：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="weibo_key" value="<?php echo $data["weibo_key"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">微博登录 App Secret：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" name="weibo_secret" value="<?php echo $data["weibo_secret"];?>" class="input-text" style="width:50%">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-2">微博登录 回调地址：</label>
					<div class="formControls col-xs-8 col-sm-9 yzm-explain-box">
						<input type="text" name="weibo_callback" readonly value="<?php echo U('member/other/weibo_login');?>" class="input-text disabled" style="width:50%">
						<span class="yzm-explain">微博登录回调地址不可修改，请复制该地址到你的新浪微博开放平台</span>
					</div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				
				<input type="submit" class="btn btn-primary radius" name="dosubmit" value="&nbsp;&nbsp;保 存&nbsp;&nbsp;">
				<input type="reset" class="btn btn-default radius" value="&nbsp;&nbsp;取 消&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>

<?php include $this->admin_tpl('footer', 'admin');?>

<script type="text/javascript">
function check_all(obj){
	if($("select[name='member_theme']").val()==''){
		layer.msg('请选择会员中心模板风格！', {icon:2});
		return false;
	}
	val = $("input[name='rmb_point_rate']").val();
	if(val=='' || !(/(^[1-9]\d*$)/.test(val))){
		layer.msg('人民币购买积分数量只能为正整数！', {icon:2});
		return false;
	}
	val = $("input[name='member_point']").val();
	if(val=='' || isNaN(val)){
		layer.msg('新会员默认积分只能为数字！', {icon:2});
		return false;
	}
	val = $("input[name='login_point']").val();
	if(val=='' || isNaN(val)){
		layer.msg('每日登录奖励积分只能为数字！', {icon:2});
		return false;
	}
	val = $("input[name='comment_point']").val();
	if(val=='' || isNaN(val)){
		layer.msg('发布评论奖励积分只能为数字！', {icon:2});
		return false;
	}
	val = $("input[name='publish_point']").val();
	if(val=='' || isNaN(val)){
		layer.msg('投稿奖励积分只能为数字！', {icon:2});
		return false;
	}
	layer.msg('正在保存数据……', { icon: 16, shade: 0.21, time:false });
	$.ajax({
		type: 'POST',
		url: '<?php echo U('admin/system_manage/save');?>', 
		data: $(obj).serialize(),
		dataType: "json", 
        success: function (msg) {
			if(msg.status){
				layer.msg(msg.message, {icon:1, time:2000});       
		    }else{
				layer.msg(msg.message, {icon:2});
			}
        }
	})	
	return false;	
}

$(function(){
	$.Huitab("#tab_system .tabBar span","#tab_system .tabCon","current","click","<?php echo isset($_GET['tab']) ? intval($_GET['tab']) : '0'?>");
});
</script>

</body>
</html>