{echo:JS::import('dialog?skin=brief');}
{echo:JS::import('dialogtools');}
{echo:JS::import('form');}
<form action="" method="post">
<div class="tools_bar clearfix">
    <a class="icon-checkbox-checked icon-checkbox-unchecked" href="javascript:;" onclick="tools_select('id[]',this)" title="全选" data="true"> 全选 </a>
    <a  class="icon-remove-2" href="javascript:;" onclick="tools_submit({action:'{url:/goods/goods_del}',msg:'删除后无法恢复，你真的删除吗？'})" title="删除"> 删除</a>
    <a href='{url:/goods/goods_edit}'  class="icon-plus" > 添加</a>
    <a href='javascript:;' onclick="tools_submit({action:'{url:/goods/set_online/status/0}'});" class="icon-point-up" > 上架</a>
    <a href='javascript:;' onclick="tools_submit({action:'{url:/goods/set_online/status/1}'});" class="icon-point-down" > 下架</a>
    <a class="icon-delicious" href="{url:/goods/goods_list}"> 全部商品</a>

    <span class="fr"><a href='javascript:;' id="condition" class="icon-search" style="" > 筛选条件</a><input id="condition_input" type="hidden" name="condition" value="{$condition}"></span>
</div>
<table class="default" >
    <tr>
        <th style="width:30px;">选择</th>
        <th style="width:70px;">操作</th>
        <th >商品名称</th>
        <th style="width:80px;">产品编号</th>
        <th style="width:100px;">所属分类</th>
        <th style="width:60px;">零售价</th>
        <th style="width:60px;">成本价</th>
        <th style="width:60px;">市场价</th>
        <th style="width:60px;">排序</th>
        <th style="width:60px;">库存</th>
        <th style="width:60px;">状态</th>
    </tr>
    {query:name=goods_category /}
    {set:$category_name=array();$category="";}
    {list:}
        {set:$category_name[$item['id']]=$item['name']}
        {set:$category.=$item['id'].':'."'".$item['name']."',"}
    {/list}
    {set:$category=trim($category,',');}
    {query:name=goods id=$obj where=$where order=is_online,id deac page=1 order=id desc}
        <tr ><td style="width:30px;"><input type="checkbox" name="id[]" value="{$item['id']}"></td>
        <td style="width:70px" class="btn_min"><div class="operat hidden"><a  class="icon-cog action" href="javascript:;"> 处理</a><div class="menu_select"><ul>
                <li><a class="icon-point-up" href="{url:/goods/set_online/status/0/id/$item[id]}"> 上架</a></li>
                <li><a class="icon-point-down" href="{url:/goods/set_online/status/1/id/$item[id]}"> 下架</a></li>
                <li><a class="icon-pencil" href="{url:/goods/goods_edit/id/$item[id]}"> 编辑</a></li>
                <li><a class="icon-remove-2" href="javascript:;" onclick="confirm_action('{url:/goods/goods_del/id/$item[id]}')"> 删除</a></li>
               </ul></div></div></td>
        <td><a href="{url:/index/product/id/$item[id]}" target="_blank">{echo:TString::msubstr($item['name'],0,24)}</a></td><td style="width:80px;">{$item['goods_no']}</td><td style="width:100px;">{$category_name[$item['category_id']]}</td><td style="width:60px;">{$item['sell_price']}</td><td style="width:60px;">{$item['cost_price']}</td>
        <td style="width:60px;">{$item['market_price']}</td><td style="width:60px;">{$item['sort']}</td><td style="width:60px;" {if:$item['store_nums']<=$item['warning_line']}class="red"{/if}><b>{$item['store_nums']}</b></td><td style="width:60px;">{if:$item['is_online']==0}<b class="green">在售</b>{else:}<b class="red">下架</b>{/if}</td></tr>
    {/query}
</table>
</form>
<div class="page_nav">
{echo:$obj->pageBar()}
</div>
<script type="text/javascript">
    var form =  new Form();
    form.setValue('s_type','{$s_type}');
    $("#condition").on("click",function(){
        $("body").Condition({input:"#condition_input",okVal:'高级搜索',callback:function(data){tools_submit({action:'{url:/goods/goods_list}',method:'get'});},data:{name:{name:'商品名称'},store_nums:{name:'库存'},sell_price:{name:'零售价'},goods_no:{name:'产品编号'},'category_id':{name:'商品分类',values:{{$category}}},'is_online':{name:'状态',values:{0:'在售',1:'下架'}}
    }});
});
</script>
