<?php
/**
 * 用户申请证书编辑
 * $Id: certificate_apply_edit_input.inc,v 1.1 2015/10/08 11:18:53 wanggb Exp $
 * @author lixq
 * @access public
 * @package manager.templates
 **/

?>
<div id="change">
	<p class="edit_title">用户证书申请编辑</p>
	<form id="certificate_apply_edit" action="certificate_apply_edit_result.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" value="<?=$id?>"/>
	<input type="hidden"  name="status" value="<?=$status?>"/>
	<div class="edit_content">
		<p>申请人姓名</p>
		<p class="begin_blank"><?=htmlspecialchars($user_name) ?></p>
		<p>申请证书名称</p>
		<p class="begin_blank"><?=htmlspecialchars($certificate_title) ?></p>
		<p>收货人姓名</p>
		<el-input v-model="name" name="name" class="input_200"></el-input>
		<p>收货人号码</p>
		<el-input v-model="mobile" type="number" name="mobile" class="input_200"></el-input>
		<p>收货地址</p>
		<textarea v-model="address" name="address" rows="3"></textarea>
		<p>状态</p>
			<el-select v-model="status" size="small" style="width:100px;">
        <el-option
            v-for="item in status_list"
            :key="item.id"
            :label="item.title"
            :value="item.id">
        </el-option>
    	</el-select><br/>
		<br/>
		<el-button 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:{
		  name:'<?=htmlspecialchars($name) ?>',
		  mobile:'<?=$mobile?>',
		  status:'<?=$status?>',
		  address:'<?=$address?>',
		  status_list:[{"title":"制作中",id:"WAITING"},{"title":"配送中",id:"SENDING"},{"title":"已签收",id:"FINISH"}]
		},
		methods:{
		  back:function(){
			  window.history.go(-1);
			},
			edit:function(){
				if(!this.name){
					this.$message({
		            type: 'error',
		            message: '请输入收货人姓名!'
		          });
		      return;
				}
				if(!this.mobile){
					this.$message({
		            type: 'error',
		            message: '请输入收货人号码!'
		          });
		      return;
				}
				if(!this.address){
					this.$message({
		            type: 'error',
		            message: '请输入收货人地址!'
		          });
		      return;
				}
				$("input[name='status']").val(this.status);
				$('#certificate_apply_edit').submit();
			}
		}
	})
</script>
