<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>KGCMS企业应用管理平台 - Powered by KGCMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<!-- <meta http-equiv="cache-control" content="no-siteapp" /> -->
<link rel="stylesheet" href="{{ kg['tpl_url'] }}style/product_manage.css">
<script src="{{ kg['tpl_url'] }}script/jquery.min.js"></script>
<script src="{{ kg['server']['HTTP_HOST'] }}/tools/amazeui/js/amazeui.min.js"></script>
<script src="{{kg['tpl_url']}}script/common.js"></script>
<script src="{{ kg['tpl_url'] }}script/product_manage.js"></script>
</head>
<body data-type="generalComponents">
	{% include 'component_header.tpl' %}
	<div class="tpl-page-container tpl-page-header-fixed">
		<div class="scrollbar-wrap">
		{% include 'component_left.tpl' %}
		<div class="tpl-content-wrapper">
			<div class="tpl-content-page-title">
				商品与产品管理
			</div>
			<ol class="am-breadcrumb">
				<li><a href="./" class="am-icon-home">首页</a></li>
				{% if trash == 1 %}
				<li><a href="product_manage">商品列表</a></li>
				<li class="am-active">回收站</li>
				{% else %}
				<li class="am-active">商品与产品管理</li>
				{% endif %}
			</ol>
			<div class="tpl-portlet-components">
				<div class="portlet-title">
					<div class="caption font-green bold">
						<span class="am-icon-code"></span> 商品与产品管理
					</div>
					<ul class="list-inline ngsty-boxR">
						<li>
							<div class="ng-width-box am-no-marginbtm am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{searchBox: 1}" class="" style="display: none;" id="selected-searchs">
									{% set cate = category|length %}
									{% if cate > 1 %}
									{% for row in category %}
									{% if row['id'] == cid %}
									<option selected="selected" value="product_manage?{{url['category']}}cid={{row['id']}}">
										{%- if row['level'] > 1 -%}
										├
										{%- for i in range(row['level']-1) -%}
										───
										{%- endfor -%}
										{%- endif -%}
										{{row['title']}}</option>
									{% else %}
									<option value="product_manage?{{url['category']}}cid={{row['id']}}">
										{%- if row['level'] > 1 -%}
										├
										{%- for i in range(row['level']-1) -%}
										───
										{%- endfor -%}
										{%- endif -%}
										{{row['title']}}</option>
									{% endif %}
									{% endfor %}
									{% endif %}
								</select>
							</div>
						</li>
						<li>
							<div class="am-select-hover am-no-marginbtm am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{sbtnSize: 'sm'}">
									<option {% if sort==0 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=0">发布日期降序</option>
									<option {% if sort==1 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=1">发布日期升序</option>
									<option {% if sort==2 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=2">浏览次数降序</option>
									<option {% if sort==3 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=3">浏览次数升序</option>
									<option {% if sort==4 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=4">评论人数降序</option>
									<option {% if sort==5 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=5">评论人数升序</option>
									<option {% if sort==6 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=6">销售价格降序</option>
									<option {% if sort==7 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=7">销售价格升序</option>
									<option {% if sort==8 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=8">库存数量降序</option>
									<option {% if sort==9 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=9">库存数量升序</option>
									<option {% if sort==10 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=10">已售出数量降序</option>
									<option {% if sort==11 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=11">已售出数量升序</option>
									<option {% if sort==12 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=12">收藏人数降序</option>
									<option {% if sort==13 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=13">收藏人数升序</option>
									<option {% if sort==14 %} selected="selected" {% endif %} value="product_manage?{{url['sort']}}sort=14">自定义排序值降序</option>
								</select>
							</div>
						</li>
						<li>
							<div class="am-select-hover am-no-marginbtm am-no-outline">
								<select onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-am-selected="{btnSize: 'sm'}">
									<option {% if filter==0 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=0">数据筛选</option>
									<option {% if filter==1 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=1">推荐的商品</option>
									<option {% if filter==2 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=2">不推荐的商品</option>
									<option {% if filter==3 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=3">已发布的商品</option>
									<option {% if filter==4 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=4">草稿</option>
									<option {% if filter==5 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=5">已审核的商品</option>
									<option {% if filter==6 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=6">未审核的商品</option>
									<option {% if filter==7 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=7">允许评论的内容</option>
									<option {% if filter==8 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=8">不允许评论的内容</option>
									<option {% if filter==9 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=9">停止销售的商品</option>
									<option {% if filter==10 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=10">销售中的商品</option>
									<option {% if filter==11 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=11">实物商品</option>
									<option {% if filter==12 %} selected="selected" {% endif %} value="product_manage?{{url['filter']}}filter=12">虚拟商品</option>
								</select>
							</div>
						</li>
						<li>
							<div class="portlet-input input-small input-inline">
								<form action="#" method="get" id="search">
									<div class="input-icon right">
										<i class="am-icon-search log-search"></i>
										<input type="text" class="ngar-Vxiugai-radius form-control am-hover form-control-solid ngco-Alo-Noborder" placeholder="搜索..." name="word" value="{{word}}" id="word">
									</div>
								</form>
							</div>
						</li>
						<li>
							<div class="portlet-input input-small input-inline">
								<form action="#" method="get" id="search">
									<div class="input-icon right">
										<i class="am-icon-search log-search"></i>
										<input type="text" class="ngar-Vxiugai-radius form-control am-hover form-control-solid ngco-Alo-Noborder" placeholder="搜索..." name="word" value="{{word}}" id="word">
									</div>
								</form>
							</div>
						</li>
						<li>
							<div class="am-btn-group am-btn-group-xs"> 
								<a href="product_manage?{{ kg['run_start_time'][1] }}" class="am-btn am-btn-secondary ng-add-hightB"><span class="am-icon-search"></span> 刷新</a>
								<a class="am-btn am-btn-default am-btn-warning" href="product_update"><span class="am-icon-plus"></span> 添加商品</a>
								<a class="am-btn am-btn-default am-btn-success" href="product_manage?trash=1"><span class="am-icon-recycle"></span> 回收站</a>
							</div>
						</li>
					</ul>
					
				</div>
				<div class="tpl-block ngALL-AFenyeFu-marginT">
					<div class="am-g">
						<div class="am-u-sm-12 ngco-No-paddingR">
							<form class="am-form" action="#" method="post" id="am-form">
								<table class="am-table am-table-striped am-table-hover table-main ngco-Esz-mgibdr">
									<thead>
										<tr>
											<th class="table-check"><input type="checkbox" name="all" id="all" onclick="kg.select_all(this.form);" class="tpl-table-fz-check checkbox-middle"></th>
											<th class="table-id">ID</th>
											<th class="table-title">商品名</th>
											<th class="table-type">类别</th>
											<th class="table-author am-hide-sm-only">浏览/评论/已售</th>
											<th class="table-date am-hide-sm-only">创建时间</th>
											<th class="table-set">操作</th>
										</tr>
									</thead>

									<tbody>

										{% for row in data %}
										<tr>
											<td><input type="checkbox"  class="ty-id checkbox-middle" value="{{row['id']}}" name="id[]"></td>
											<td>{{row['id']}}</td>
											{% if word %}
											<td><a href="#">{{ row['cut_title']|replace(word,'<b style="color:red">'+word+'</b>') }}</a></td>
											{% else %}
											<td><a href="#">{{ row['cut_title'] }}</a></td>
											{% endif %}
											<td>{{row['category_title']}}</td>
											<td class="am-hide-sm-only">{{row['click']}}/{{row['commenttotal']}}/{{row['sales']}}</td>
											<td class="am-hide-sm-only">{{row['addtime']}}</td>
											<td>
												{% if trash == 1 %}
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<a href="product_manage?{{url['button']}}action=recovery&id={{row['id']}}" title="修改文章内容" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span>&nbsp;还原</a>
														<a href="product_manage?action=del_true&id={{row['id']}}" title="删除文章内容" class="am-btn am-btn-default am-btn-xs am-text-danger ngro-Jclick-shanchubi"><span class="am-icon-trash-o"></span>&nbsp;删除</a>
													</div>
												</div>
												{% else %}
												<div class="am-btn-toolbar">
													<div class="am-btn-group am-btn-group-xs">
														<a href="product_update?id={{row['id']}}" title="修改商品内容" class="am-btn am-btn-default am-btn-xs am-text-secondary title2div"><span class="am-icon-pencil-square-o"></span>&nbsp;编辑</a>
														{% if row['published'] ==1 %}
														<a href="product_manage?{{url['button']}}action=unpublished&id={{row['id']}}" title="已发布，点击设置为草稿" class="am-btn am-btn-default am-btn-xs am-publish-bright title2div"><span class="am-icon-archive"></span>&nbsp;发布</a>
														{% else %}
														<a href="product_manage?{{url['button']}}action=published&id={{row['id']}}" title="还没有发布，点击发布" class="am-btn am-btn-default am-btn-xs am-button-dark title2div"><span class="am-icon-archive"></span>&nbsp;草稿</a>
														{% endif %}
														{% if row['recom'] == 1 %}
														<a href="product_manage?{{url['button']}}action=unrecom&id={{row['id']}}" title="已经推荐，点击取消推荐" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-recom-bright title2div"><span class="am-icon-star-o "></span>&nbsp;推荐</a>
														{% else %}
														<a href="product_manage?{{url['button']}}action=recom&id={{row['id']}}" title="还没有推荐，点击设置为推荐" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-button-dark title2div"><span class="am-icon-star-o "></span>&nbsp;取消</a>
														{% endif %}
														{% if row['audit'] == 1 %}
														<a href="product_manage?{{url['button']}}action=unaudit&id={{row['id']}}" title="已经审核，点击取消审核" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-audit-bright title2div"><span class="am-icon-pencil "></span>&nbsp;审核</a>
														{% else %}
														<a href="product_manage?{{url['button']}}action=audit&id={{row['id']}}" title="未通过审核，点击设置为审核" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-button-dark title2div"><span class="am-icon-pencil "></span>&nbsp;取消</a>
														{% endif %}
														{% if row['status'] %}
														<a href="product_manage?{{url['button']}}action=unsale&id={{row['id']}}" title="正在销售，点击停止销售" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-recom-bright title2div"><span class="am-icon-star-o "></span>&nbsp;上架</a>
														{% else %}
														<a href="product_manage?{{url['button']}}action=sale&id={{row['id']}}" title="未上架，点击上架商品" class="am-btn am-btn-default am-btn-xs am-hide-sm-only am-text-warning am-button-dark title2div"><span class="am-icon-star-o "></span>&nbsp;下架</a>
														{% endif %}
														<a href="product_manage?action=del&id={{row['id']}}" title="删除商品" class="am-btn am-btn-default am-btn-xs am-text-danger ngro-Jclick-shanchubi title2div">
															<span class="am-icon-trash-o"></span>&nbsp;删除
														</a>
													</div>
												</div>
												{% endif %}
											</td>
										</tr>
										{% endfor %}
										<input type="hidden" name="action" id="action" value="">
									</tbody>
								</table>
								{% if not data %}<div class="no-data"><ul>没有相关数据</ul></div>{% endif %}
								{% if page_data['total_rows'] %}
								<div class="am-u-sm-12 am-u-md-6">
									<div class="am-btn-toolbar ng-xno-borderL" id="select-handle">
										<span class="am-input-group-btn add-span">
											<a class="add am-btn am-btn-default am-select am-back ngco-Ono-radiusR all-select" href="javascript:;">全选</a>
										</span>
										<select class="am-select-hover" data-am-selected="{btnSize: 'sm', dropUp: 1, maxHeight: 155}" style="display: none;">
											<option selected="selected" value='0'>将选中项：</option>
											{% if trash == 1 %}
											<option value="recovery">还原</option>
											<option value="del_true">彻底删除</option>
											{% else %}
											<option value="published">发布商品</option>
											<option value="unpublished">设为草稿</option>
											<option value="recom">推荐</option>
											<option value="unrecom">取消推荐</option>
											<option value="audit">审核</option>
											<option value="unaudit">取消审核</option>
											<option value="sale">上架</option>
											<option value="unsale">取消上架</option>
											<option value="del">删除</option>
											<option value="del_true">彻底删除</option>
											{% endif %}
										</select>
									</div>
								</div>
								{% endif %}
								{% if page_data['total_page'] > 1 %}
								{{branch}}
								{% endif %}
							</form>
						</div>
					</div>
				</div>
			</div>
			{% include 'component_footer.tpl' %}
		</div>
		</div><!-- /.scrollbar-wrap -->
	</div>
	<script>
		 kg.title2div('title2div');	 //调用此方法， 把该元素的title属性替换成div
	</script>
</body>
</html>