<!DOCTYPE html>
<html>
<?php echo $this->fetch('head.html'); ?>
<style>
	.btn-mini{
		background:none;
		border:1px solid #007AFF;
		color: #666;
	}
	.btn-status{
		font-size: 12px;
		padding: 2px;
		border-radius: 5px;
		background:none;
		border:1px solid #007AFF;
		color: #f60;
		margin-right:5px;
	}
</style>
<body>
<div class="header">
	<div class="header-back"></div>
	<div class="header-title">我的发布</div>
</div>
<div class="header-row"></div>
<div class="main-body">
  <?php $_from = $this->_var['list']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
  <div class="bg-white pd-10 mgb-5">
	  <div gourl="/module.php?m=fenlei&a=show&id=<?php echo $this->_var['c']['id']; ?>" class="c1 f16 mgb-5"><?php echo $this->_var['c']['title']; ?></div>
	  <div class=" mgb-5 flex">
	  		  <div class="flex-1 flex">
				  <div class="btn-status"><?php if ($this->_var['c']['status'] == 1): ?>已上线<?php else: ?>未上线<?php endif; ?></div>
				  <?php if ($this->_var['c']['hb_on']): ?>
				  <div class="btn-status">红包</div>
				 <?php endif; ?>
			  </div>
	  		  <div class=" flex">
				  <div class="btn-status mgr-10"><?php if ($this->_var['c']['ispay'] == 1): ?>已支付<?php else: ?>未支付<?php endif; ?>  </div>
				  <div class="flex-1"></div>
					<div class="cl-money">￥<?php echo $this->_var['c']['paymoney']; ?></div>
			   </div>
	  </div>
	  
	  
	  <div class="cl2 mgb-5">
		  <?php echo $this->_var['c']['description']; ?>
	  </div>
	  <div class="mgb-10 flex">
		  <div class="flex-1 cl-money"> <?php echo $this->_var['c']['money']; ?>元</div>
		  <div>查看 <?php echo $this->_var['c']['view_num']; ?>次</div>
	  </div>
	  <div class="flex flex-jc-center">
		  <?php if (! $this->_var['c']['ispay']): ?>
		  <div gourl="/module.php?m=fenlei&a=pay&id=<?php echo $this->_var['c']['id']; ?>" class="btn-mini js-pageHide mgr-5">去支付</div>
		  <?php endif; ?>
		  <?php if ($this->_var['flConfig'] [ "hb_on" ] && ! $this->_var['c']['hb_on']): ?>
		 <div class="mgr-5 btn-mini js-hb" v="<?php echo $this->_var['c']['id']; ?>">红包</div> 
		 <?php endif; ?>
		 <div class="mgr-5 btn-mini js-update" data-id="<?php echo $this->_var['c']['id']; ?>">更新</div>
		  <div class="mgr-5 btn-mini js-ding-cat" data-id="<?php echo $this->_var['c']['id']; ?>">置顶分类</div>
		  <div class="mgr-5 btn-mini js-ding-index" data-id="<?php echo $this->_var['c']['id']; ?>">置顶首页</div>
		 <div gourl="/module.php?m=fenlei&a=add&id=<?php echo $this->_var['c']['id']; ?>" class="btn-mini js-pageHide">编辑</div>
	  </div>
  </div>
  <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
<div><?php echo $this->_var['pagelist']; ?></div>
  
</div>
<div class="modal-group" id="hb-modal">
	<div class="modal-mask"></div>
	<div class="footerFix" style="z-index: 9999;">
		<div class="row-box">
			<div class="cl2 text-center">请选择红包金额</div>
		</div>
		<div class="row-box">
			<?php $_from = $this->_var['hbList']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
			<div v="<?php echo $this->_var['c']['id']; ?>" class="row-item-text pointer js-hb-pay"><?php echo $this->_var['c']['hb_money']; ?>元分<?php echo $this->_var['c']['hb_num']; ?>包</div>
			<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			 
		</div>
		
		<div class="row-box pointer">
			<div class="text-center">取消</div>
		</div>
	</div>
</div>

<?php echo $this->fetch('ftnav.html'); ?>
<?php echo $this->fetch('footer.html'); ?>
<script>
	var fid=0;
	$(function(){
		$(document).on("click",".js-update",function(){
			if(!postCheck.canPost()){
				return false;
			}
			var id=$(this).attr("data-id");
			$.get("/module.php?m=fenlei&a=updatetime&ajax=1&id="+id,function(res){
				skyToast(res.message);
			},"json")
		})
		
		$(document).on("click",".js-ding-cat",function(){
			if(!postCheck.canPost()){
				return false;
			}
			var id=$(this).attr("data-id");
			$.get("/module.php?m=fenlei&a=dingcat&ajax=1&id="+id,function(res){
				skyToast(res.message);
				if(!res.error){
					window.location=res.data.payurl;
				}
			},"json")
		})
		
		$(document).on("click",".js-ding-index",function(){
			if(!postCheck.canPost()){
				return false;
			}
			var id=$(this).attr("data-id");
			$.get("/module.php?m=fenlei&a=dingindex&ajax=1&id="+id,function(res){
				skyToast(res.message);
				if(!res.error){
					window.location=res.data.payurl;
				}
			},"json")
		})
		
		$(document).on("click",".js-hb",function(){
			fid=$(this).attr("v");
			$("#hb-modal").show();
		})
		$(document).on("click",".js-hb-pay",function(){
			if(!postCheck.canPost()){
				return false;
			}
			var hbid=$(this).attr("v");
			$.ajax({
				url:"/module.php?m=fenlei&a=hbpay&ajax=1",
				dataType:"json",
				data:{
					id:fid,
					hbid:hbid
				},
				success:function(res){
					skyToast(res.message);
					if(res.error){
						return false;						
					}
					if(res.data.action=='finish'){
						window.location.reload();
					}else{
						window.location=res.data.payurl;
					}
				}
			})
		})
	})
</script>
</body>
</html>