goods_new.html 1.9 KB
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li ><a href="{:url('Goods/goods_list')}">商品列表</a></li>
        <li class="active"><a href="#">推荐新品</a></li>
    </ul>
    <table class="table table-bordered" style="margin-top: 10px;">
        <thead>
        <tr>
            <th>选择</th>
            <th>序号</th>
            <th>商品名称</th>
            <th>分类</th>
            <th>价钱</th>
            <th>销量</th>
            <th>创建时间</th>
        </tr>
        </thead>
        <tbody>
        <volist name="data" id="vo">
            <tr>
                <td>
                    <if condition="$vo.recommend_new eq 1">
                        <input type="checkbox" name="choice" class="choice" checked value="{$vo.id}">
                    <else/>
                        <input type="checkbox" name="choice" class="choice" value="{$vo.id}">
                    </if>
                </td>
                <td>{$vo.id}</td>
                <td>{$vo.book_name}</td>
                <td>{$vo.classify_name|default='为空'}</td>
                <td>{$vo.price}</td>
                <td>{$vo.sales}</td>
                <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
            </tr>
        </volist>
        </tbody>
    </table>
    <button type="button" class="btn btn-default" onclick="baocun()">保存</button>
<script>
    function baocun(){
        num = $(".choice:checked");
        arr = [];
        if(num.length == 3){
            for(i=0;i<num.length;i++){
                arr[i] = num.eq(i).val();
            }
            ids = arr.join(',');
            $.post("{:url('Goods/goods_new')}",{ids:ids},function(data){
                alert('推荐成功');
            });
        }else{
            alert('推荐新品为三个!');
        }
    }
</script>
</div>
</body>
</html>