<?php
/**
 * 领导机构-二维码编辑
 * $Id: government_qr_edit.inc,v 1.1 2015/10/08 11:18:53 Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 **/

?>
<div id="change">
	<p class="edit_title">领导机构-二维码编辑</p>
	<form id="government_qr_edit" action="government_qr_edit_result.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" value="<?=$id?>"/>
	<input type="hidden"  name="government_title" value="<?=$government_title?>"/>
	<input type="hidden"  name="government_id" value="<?=$government_id?>"/>
	<input type="hidden" name="action_type" value="<?=$action_type?>"/>
	<div class="edit_content">
		<p>教育管局名称</p>
		<p class="begin_blank"><?=htmlspecialchars($government_title) ?></p>
    <p>最大使用次数</p>
			<el-input v-model="max_count" type="number" name="max_count" class="input_200"></el-input>
    <p>已使用次数</p>
		<p class="begin_blank"><?=empty($use_count)?'0':$use_count?>&nbsp;</p>
		<p>截止使用时间</p>
		<el-date-picker  v-model="limit_date" name="limit_date"id="limit_date" type="date"  align="right"  ></el-date-picker>
  	<p>二维码</p>
  	<img v-if="qr_image != ''" src="<?=$qr_image?>"/>
    <br/>
		<br/>
		<el-button  v-if="!qr_image"type="danger" @click="edit()" class="edit_btn">编辑并生成二维码</el-button>
		<el-button  v-if="qr_image"type="danger" @click="edit()" class="edit_btn">编辑</el-button>
		<el-button type="danger" @click="back()" class="edit_btn">返回</el-button>
		<br/><br/>
	</div>
	</form>
</div>


<script type="text/javascript">
	
	new Vue({
		el:'#change',
		data:{
		  action_type:'<?=$action_type?>',
		  max_count:'<?=$max_count?>',
		  limit_date:'<?=$limit_date?>',
		  qr_image:'<?=$qr_image?>'
			
		},
		methods:{
		  back:function(){
			  window.history.go(-1);
			},
			clearDate(){
				$('#limit_date').val('');
			},
			edit:function(){
				if(!this.max_count){
					this.$message({
		            type: 'error',
		            message: '请输入最大使用次数!'
		          });
		      return;
				}
				if(!isNumber(this.max_count)){
					this.$message({
		            type: 'error',
		            message: '最大使用次数请输入数字!'
		          });
		      return;
				}
				if(!$('#limit_date').val()){
					this.$message({
		            type: 'error',
		            message: '选择截止使用时间!'
		          });
		      return;
				}
				$('#government_qr_edit').submit();
			}
		}
	})
</script>
