• 商品的上架


    1.前台页面

    <script type="text/javascript">
    function isShow(pageNo,name,brandId,isShow) {
    	if(Pn.checkedCount('ids')<=0) {
    		alert("请至少选择一个!");
    		return;
    	}
    	if(!confirm("确定上架吗?")) {
    		return;
    	}
        $("#jvForm").attr("action","isShow.do?pageNo="+pageNo+"&name="+name+"&brandId="+brandId+"&isShow="+isShow); //jquery方式
    	$("#jvForm").submit();
    }
    </script>

      

    <form method="post" id="jvForm">
    <!-- <input type="hidden" value="" name="pageNo"/>
    <input type="hidden" value="" name="queryName"/> -->
    <table cellspacing="1" cellpadding="0" width="100%" border="0" class="pn-ltable">
        <thead class="pn-lthead">
            <tr>
                <th width="20"><input type="checkbox" onclick="Pn.checkbox('ids',this.checked)"/></th>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>图片</th>
                <th width="4%">新品</th>
                <th width="4%">热卖</th>
                <th width="4%">推荐</th>
                <th width="4%">上下架</th>
                <th width="12%">操作选项</th>
            </tr>
        </thead>
        <tbody class="pn-ltbody">
        <c:forEach items="${pagniation.list }" var="entry">
            <tr bgcolor="#ffffff" onmouseover="this.bgColor='#eeeeee'" onmouseout="this.bgColor='#ffffff'">
                <td><input type="checkbox" name="ids" value="${entry.id }"/></td>
                <td>${entry.id }--${entry.no }</td>
                <td align="center">${entry.name }</td>
                <td align="center"><img width="50" height="50" src="${entry.img.allUrl }"/></td>
                <td align="center"></td>
                <td align="center"></td>
                <td align="center"></td>
                <td align="center">
                   <c:if test="${entry.isShow==0 }">下架</c:if>
                   <c:if test="${entry.isShow==1 }" >上架</c:if>
                </td>
                <td align="center">
                <a href="#" class="pn-opt">查看</a> | <a href="#" class="pn-opt">修改</a> | <a href="#" onclick="if(!confirm('您确定删除吗?')) {return false;}" class="pn-opt">删除</a> | <a href="../sku/list.jsp" class="pn-opt">库存</a>
                </td>
            </tr>
        </c:forEach>    
        </tbody>
    </table>
    <div class="page pb15"><span class="r inb_a page_b">
        <span  class="r inb_a page_b">
            <c:forEach items="${pagniation.pageView}" var="page">
                ${page }
            </c:forEach>
        </span>
            
    </div>
    <div style="margin-top:15px;"><input class="del-button" type="button" value="删除" onclick="optDelete();"/><input class="add" type="button" value="上架" onclick="isShow('${pagniation.pageNo }','${name}','${brandId }','${isShow }');"/><input class="del-button" type="button" value="下架" onclick="optDelete();"/></div>
    </form>

    2.controller层

        @RequestMapping(value="/product/isShow.do")
        public String isShow(Integer[]ids,Integer pageNo,String name ,Integer brandId ,Integer isShow ,ModelMap model){
            Product product = new Product();
            product.setIsShow(1);
            if(null!=ids&& ids.length>0){
                for(Integer id:ids){
                    product.setId(id);  
                    productService.updateProductByKey(product);//修改上架状态
                }
            }
            if(null!=pageNo){
                model.addAttribute("pageNo",pageNo);
            }
            if(null!=name){
                model.addAttribute("name",name);
            }
            if(null!=brandId){
                model.addAttribute("brandId",brandId);
            }
            if(isShow!=null){
                model.addAttribute("isShow",isShow);
            }
            
            return "redirect:/product/list.do";    
        }
  • 相关阅读:
    【halcon】学习记录
    【QT】常用类
    【QT】宏
    机器视觉名词解释
    单元测试
    【MFC】VS2017新建完MFC后,没有界面,只有代码
    【MFC】学习与问题整合
    函数重载(overload)和函数重写(override)
    工作记录+反思
    【转】MapReduce:默认Counter的含义
  • 原文地址:https://www.cnblogs.com/menbo/p/9810737.html
Copyright © 2020-2023  润新知