<?php
/**
 * 募捐活动审核-详情
 * $Id: donations_examine_input.php,v 1.1 2020/01/03 11:18:46  Exp $
 * @author lixq
 * @package manager.public_html
 **/

?>
<div id="change">
	<p class="edit_title">活动发布</p>
	<form id="form" name="donations_examine_input" action="donations_examine_result.php" method="post" enctype="multipart/form-data">
	<input type="hidden" name="id" value="<?=$id?>"/>
	<input type="hidden" name="status" value="NEW"/>
	<div class="edit_content">
		<p>活动发布人</p>
		<p class="begin_blank"><?=htmlspecialchars($donations_event_dat->author) ?></p>
		<p>宣传头图</p>
		<img src="<?=$donations_event_dat->front_image?>" height="300px" alt="" />
		<p>活动名称</p>
		<p class="begin_blank"><?=htmlspecialchars($donations_event_dat->title) ?></p>
		<p>活动介绍</p>
		<p class="begin_blank"><?=htmlspecialchars($donations_event_dat->comment) ?></p>
		<p>活动期限</p>
		<p class="begin_blank"><?=$donations_event_dat->start_time ." — ".$donations_event_dat->finish_time?></p>
    <p>最大募捐金额</p>
    <p class="begin_blank"><?=floatval($donations_event_dat->max_money) ?>元</p>
		<p>状态</p>
		<el-select v-model="status" size="small" style="margin-left: 10px;"@change="currentSel">
        <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="primary" @click="edit()" class="edit_btn">编辑</el-button>
		<el-button type="primary" @click="back()" class="edit_btn">返回</el-button>		
		<br/><br/>
	</div>
	</form>
</div>

<script type="text/javascript">
	var v = new Vue({
		el:'#change',
		data:{
		  status_list:[{"id":"NEW","title":"未审核"},{"id":"OK","title":"审核通过"},{"id":"NG","title":"审核不通过"}],
			status:'NEW',
			title:''
		},
		methods:{
		  edit:function(){
				if(this.title && this.title != "未审核"){
  			  this.$confirm('是否状态更改为'+this.title+'?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            $("input[name='status']").val(this.status);
            $('#form').submit();
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消更改!'
            });          
          });
				}
			},
		  currentSel(selVal) {
			  let obj = {};
			  obj = this.status_list.find((item)=>{
			  	return item.id === selVal;
			  });
			  this.title = obj.title;
			},
			back:function(){
			  window.history.go(-1);
			}
		}
	})
</script>
