FXXBL
2018-07-14 13:52
采纳率: 0%
浏览 820

Easyui 订单保存怎么设计

各位大侠,
有个问题想请大家帮忙,就是我用easyui做页面开发,设计了订单录入界面,有表单表头及订单明细,
就是我怎样设计这样页面,同时怎样将该页面的数据提交到controller,哪位好心的大侠能帮忙解答一下我该怎样设计并怎样进行数据的提交,最好有相应的代码,万分感谢!

1.下面是controller
@RequestMapping("/add")
@ResponseBody
public Json add(SaleList saleList) {
System.out.println("SaleList saleList---->");
Json j = new Json();
try {
saleListService.add(saleList);
j.setSuccess(true);
j.setMsg("添加成功!");
} catch (Exception e) {
j.setMsg(e.getMessage());
}
return j;
}

2.下面是页面
<body class="easyui-layout">
<div data-options="region:'north'" style="height: 135px;padding: 10px;border: 0px;padding-top: 20px">
    <fieldset style="border-color: #E7F0FF">
        <legend>单号:<span id="dh"></span></legend>
        <form id="fm" method="post">
            <table cellspacing="8px">
                <tr>
                    <td>
                    客&nbsp;户:
                    <select id="customerId" name="customerId"  class="easyui-combobox" style="width: 200px; height: 29px;" data-options="width:140,editable:false,panelHeight:'auto'">
                         <option value="">全部</option>
                         <c:forEach items="${customerList}" var="customer">
                             <option value="${customer.id}" >${customer.custName}</option>
                         </c:forEach>
                    </select>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;应付金额:<input type="text" id="amountPayable" name="amountPayable" class="easyui-validatebox" required="true" readonly="readonly" size="10"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;实付金额:<input type="text" id="amountPaid" name="amountPaid" class="easyui-validatebox" required="true"  size="10"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;销售日期:<input type="text" id="saleDate" name="saleDate" class="easyui-datebox" required="true" data-options="editable:false" size="18"/>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                               备&nbsp;注:<input type="text" id="remarks" name="remarks"   size="78"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;是否付款:<select class="easyui-combobox" id="state" name="state" style="width: 160px" editable=false panelHeight="auto">
                          <option value="1">已付</option>
                          <option value="2">未付</option>
                        </select>
                    </td>
                    <td>
                        <input type="hidden" id="saleNumber" name="saleNumber"/>
                        <input type="hidden" id="goodsJson" name="goodsJson"/>
                         &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:saveSaleGoods()" class="easyui-linkbutton" iconCls="icon-ok" >保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </fieldset>
</div>
<div data-options="region:'center'" style="padding: 10px;border: 1px">
    <table id="dg"  class="easyui-datagrid" style="height:1200px"
        fitColumns="true" rownumbers="true" singleSelect="true"
         fit="true" toolbar="#tb">
            <thead>
                <th field="code" width="30" align="center">商品编码</th>
                <th field="name" width="150" align="center">商品名称</th>
                <th field="model" width="50" align="center">商品型号</th>
                <th field="unitInfoId" hidden="true">单位ID</th>
                <th field="unitInfoName" width="50" align="center">单位</th>
                <th field="price" width="50" align="center">单价</th>
                <th field="num" width="50" align="center">数量</th>
                <th field="total" width="50" align="right">总金额</th>
            </thead>
        </table>

        <div id="tb">
            <div style="padding: 2px">
                <a href="javascript:openSaleListGoodsAddDialog()" class="easyui-linkbutton" iconCls="icon-add" plain="true">添加</a>
                <a href="javascript:openSaleListGoodsModifyDialog()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a>
                <a href="javascript:deleteSaleListGoods()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
            </div>
        </div>
</div>
</body>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • 点赞 打赏 评论
  • 零零零~ 2018-07-20 03:32

    添加js的方法 直接form数据传输到controller
    function saveSaleGoods(){
    $("#fm").form("submit",{
    url : "/add",
    onSubmit : function() {
    //这里可以做一点订单的检验 要是订单格式不符合 返回false不提交 return false
    return $(this).form("validate");
    },
    success : function(result) {

                    if (result.success) {
                        $.messager.alert("系统提示", "保存成功!");
    
                    } else {
                        $.messager.alert("系统提示", "保存失败!");
                        return;
                    }
                }
            不懂再问
    
    点赞 打赏 评论

相关推荐