goodsAdd.html 3.63 KB
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
    <div  region="north" style="height: 60px;">
        <div style="margin-left: 20px;margin-top: 10px">
            <input class="easyui-textbox" id="sknsIpt" style="width: 340px">
            </input>
            <a id="searchProductBtn" class="btn-info" >搜索商品</a>
        </div>
    </div>
    <div region="center" id="productListDiv" style="margin-left: 20px">
        <table id="productListTable"></table>
    </div>
</div>
<script>
    $(function () {
        //用于页面刷新后的数据行定位
        var index ="";
        $("#sknsIpt").textbox({
            required:false,
            prompt: "输入SKN,多个SKN以逗号隔开"
        });

        $("#searchProductBtn").linkbutton({
            iconCls : "icon-search",
            onClick : function() {
                $("#productListTable").datagrid("load", {
                    skns: $("#sknsIpt").textbox("getValue")
                });
            }
        });

        $("#productListTable").myDatagrid({
            fit: true,
            fitColumns: true,
            striped: true,
            url: serverContextPath + "/grassGoods/searchProducts",
            method: 'POST',
            loadFilter: function (data) {
                var tmp = defaultLoadFilter(data);
                tmp.rows = tmp.list?tmp.list:[];
                return tmp;
            },
            columns: [[
                {
                    field: "ck",
                    checkbox:true,
                    align: "left"
                },
                {
                    title: "产品图片",
                    field: "default_images",
                    width: 15,
                    align: "center",
                    formatter: function (value, rowData, rowIndex) {
                        return "<img style='width: 80px; height: 80px'  src='"+value+"'/>";
                    }
                },
                {
                    title: "产品名称",
                    field: "product_name",
                    width: 30,
                    align: "left"
                },{
                    title: "SKN",
                    field: "product_skn",
                    width: 20,
                    align: "labelAmount"
                },
                {
                    title: "品牌",
                    field: "brand_name",
                    width: 20,
                    align: "labelAmount"
                },
                {
                    title: "现价",
                    field: "sales_price",
                    width: 20,
                    align: "labelAmount"
                },
                {
                    title: "吊牌价",
                    field: "market_price",
                    width: 20,
                    align: "labelAmount"
                },
                {
                    title: "预售(哪个?)",
                    field: "sales_num",
                    width: 20,
                    align: "labelAmount"
                },
                {
                    title: "库存",
                    field: "storage_num",
                    width: 20,
                    align: "labelAmount"
                }
            ]],
            cache: false,
            pagination: true,
            pageSize: 10,
            pageList: [10],
            idField: "product_skn",
            singleSelect: false,
            onLoadSuccess: function (data) {
                if(index != ""){
                    $(this).datagrid("scrollTo",index);
                    index = "";
                }
            }
        });
    });


</script>