<!DOCTYPE html>
<html>
	<?php echo $this->fetch('head.html'); ?>
	<body>
		<?php echo $this->fetch('b2b_product/nav.html'); ?>
		<div class="main-body">
			<form class="search-form" action="/moduleadmin.php" autocomplete="off">
				<input type="hidden" name="m" value="b2b_product">
				ID <input type="text"  class="w50" name="id" value="<?php echo intval($_GET['id']); ?>" />
				名称 <input type="text" class="w150" name="title" value="<?php echo $_GET['title']; ?>" />
			 
				分类 
				<select name="catid" class="w100">
					<option value="0">请选择</option>
					<?php $_from = $this->_var['catlist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
						<option value="<?php echo $this->_var['c']['catid']; ?>" <?php if (get ( "catid" ) == $this->_var['c']['catid']): ?>selected<?php endif; ?>><?php echo $this->_var['c']['title']; ?></option>
						<?php if ($this->_var['c']['child']): ?>
						<?php $_from = $this->_var['c']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'cc');if (count($_from)):
    foreach ($_from AS $this->_var['cc']):
?>
						<option value="<?php echo $this->_var['cc']['catid']; ?>" <?php if (get ( "catid" ) == $this->_var['cc']['catid']): ?>selected<?php endif; ?>>|--<?php echo $this->_var['cc']['title']; ?></option>
						<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						<?php endif; ?>
					<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
				</select>
				创建时间 <input name="stime" type="text" id="stime" value="<?php echo $_GET['stime']; ?>" class="w100" /> 到 <input  class="w100" type="text"  name="etime" id="etime"  value="<?php echo $_GET['etime']; ?>" /> 
				<button type="submit" class="btn" >搜索</button>
				 
			</form>
			<form id="cForm">
			<table class="tbs">
				<thead>
					<tr>
						<td>id<input type="checkbox" class="chkall"  /></td>
						<td>名称</td>
						<td>分类</td>
						 
						<td>图片</td>
						<td>价格</td>
						<td>促销价</td>
					 
						<td>月销</td>
						<td>状态</td> 
						<td>最新</td>
						<td>最热</td>
						<td>推荐</td>
						<td>库存</td>
						<td>销量</td>
						
						 
						
						<td>操作</td>
					</tr>
					</tr>
				</thead> <?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']):
?>
				<tr>
					<td><input type="checkbox" class="ids"  name="ids[]" value="<?php echo $this->_var['c']['id']; ?>" /><?php echo $this->_var['c']['id']; ?> </td>
					<td><?php echo $this->_var['c']['title']; ?></td>
					<td><?php echo $this->_var['c']['catid_name']; ?></td>
				 
					<td><img src="<?php echo $this->_var['c']['imgurl']; ?>.100x100.jpg" width="60" /> </td>
					<td><?php echo $this->_var['c']['price']; ?></td>
					<td><?php echo $this->_var['c']['lower_price']; ?></td>
					 
					 
					<td><?php echo $this->_var['c']['month_buy_num']; ?></td>
					<td><div class="<?php if ($this->_var['c']['status'] == 1): ?>yes<?php else: ?>no<?php endif; ?> js-toggle-status" url="/moduleadmin.php?m=b2b_product&a=status&id=<?php echo $this->_var['c']['id']; ?>&ajax=1" ></div></td>
					<td><div class="<?php if ($this->_var['c']['isnew'] == 1): ?>yes<?php else: ?>no<?php endif; ?> js-toggle-status" url="/moduleadmin.php?m=b2b_product&a=new&id=<?php echo $this->_var['c']['id']; ?>&ajax=1" ></div></td>
					<td><div class="<?php if ($this->_var['c']['ishot'] == 1): ?>yes<?php else: ?>no<?php endif; ?> js-toggle-status" url="/moduleadmin.php?m=b2b_product&a=hot&id=<?php echo $this->_var['c']['id']; ?>&ajax=1" ></div></td>
					<td><div class="<?php if ($this->_var['c']['isrecommend'] == 1): ?>yes<?php else: ?>no<?php endif; ?> js-toggle-status" url="/moduleadmin.php?m=b2b_product&a=recommend&id=<?php echo $this->_var['c']['id']; ?>&ajax=1" ></div></td>
					<td><?php echo $this->_var['c']['total_num']; ?></td>
					<td><?php echo $this->_var['c']['buy_num']; ?></td>
					
					 
			 
					 
					<td>
						<a href="/moduleadmin.php?m=b2b_product_ks&productid=<?php echo $this->_var['c']['id']; ?>">款式</a>
						<a href="/moduleadmin.php?m=b2b_product&a=add&id=<?php echo $this->_var['c']['id']; ?>">编辑</a> <br />
					<a target="_blank" href="/module.php?m=b2b_product&a=show&id=<?php echo $this->_var['c']['id']; ?>">查看</a>
					<a href="javascript:;" class="js-delete" url="/moduleadmin.php?m=b2b_product&a=delete&id=<?php echo $this->_var['c']['id']; ?>">删除</a></td>
				</tr>
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			</table>
			
			<div class="flex pd-10">
				 <input type="checkbox" class="chkall"  />&nbsp;
				聚合：
				<select name="gid" class="w100 mgr-5">
					<option value="0">请选择</option>
					<?php $_from = $this->_var['groupList']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
					<option value="<?php echo $this->_var['c']['gid']; ?>"><?php echo $this->_var['c']['title']; ?></option>
					<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
				</select>
				<div  class="btn"  id="changeGroup">聚合产品</div>
			</div>
			</form>
			<div><?php echo $this->_var['pagelist']; ?></div>
		</div>
		<?php echo $this->fetch('footer.html'); ?>
		<script src="/plugin/laydate/laydate.js"></script>
		<script>
			laydate.render({
				elem:"#stime"
			})
			laydate.render({
				elem:"#etime"
			});
			$(".chkall").click(function(){
				if($(this).prop("checked")==true){
					$(".ids").prop("checked",true);
				}else{
					$(".ids").prop("checked",false);
				}
			});
			$(document).on("click","#changeGroup",function(){
				$.post("/moduleadmin.php?m=b2b_product&a=group&ajax=1",$("#cForm").serialize(),function(res){
					skyToast(res.message);
					if(!res.error){
						window.location.reload();
					}
				},"json");
			})
		</script>
	</body>
</html>
