userOrders.html 11.3 KB
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Yoho!Buy运营平台</title>
    <script src="/union/js/include.js"></script>
    <script src="/union/js/ajaxfileupload.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div region="north" style="padding-bottom: 35px; height: auto;">
    <script>
        document.write(addHead('市场报表管理', '联盟订单管理'));
    </script>
    <form id="searchForm" method="post" accept-charset="utf-8">
    <div style="margin-left: 10px;margin-top: 10px">

    <label>开始时间:</label>
    <input class="easyui-datetimebox" id="beginTime" name="beginTime">
    </input>

    <label>结束时间:</label>
    <input class="easyui-datetimebox" id="endTime" name="endTime">
    </input>

    <label>订单号:</label>
    <input class="easyui-textbox" id="orderCode" name="orderCode">
    </input>

    <label>联盟用户ID:</label>
    <input class="easyui-textbox" id="unionId" name="unionId">
    </input>

    <label>渠道:</label>
    <input class="easyui-textbox" id="unionType" name="unionType">
    </input>

        <a id="searchBtn" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">查询</a>
        <a id="exportButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">导出</a>
        <a id="exportAllButton" style="margin-left: 20px" class="easyui-linkbutton btn-primary" data-options="iconCls:'icon-more'">全部导出</a>
    </div>
    </form>
</div>
<div region="center">
    <div style="margin-left: 30px;margin-top: 20px; height: 500px;">
        <table id="userOrdersTable"></table>
    </div>
</div>
<script type="text/javascript">
    var checkedItems = [];
        $(function () {
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            $('#beginTime').datetimebox('setValue', year + '-' + month + '-' + day);
            $('#endTime').datetimebox('setValue', year + '-' + month + '-' + day+" 23:59:59");
            var qups={};
            qups.beginTime = parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000);
            qups.endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000);
            $("#userOrdersTable").myDatagrid({
                fit: true,
                fitColumns: true,
               <!-- idField: "id",-->
                view: fileview,
                nowrap: false,
                queryParams: qups,
                onCheckAll: addcheckItem,
                onCheck: addcheckItem,
                onUncheckAll: removeAllItem,
                onUncheck: removeSingleItem,
                url: contextPath + "/UnionRest/queryUnionOrders",
                method: 'POST',
                loadFilter: function (data) {
                    var temp = defaultLoadFilter(data);
                    temp.rows = temp.list;
                    return temp;
                },
                columns: [[{
                    title: "ID",
                    field: "id",
                    idField:"id",
                    width: 170,
                    align: "center",
                    checkbox: true
                }, {
                    title: "联盟用户ID",
                    field: "unionId",
                    width: 170,
                    align: "center"
                }, {
                    title: "下单时间",
                    field: "orderTime",
                    width: 170,
                    align: "center"
                }, {
                    title: "订单号",
                    field: "orderCode",
                    width: 170,
                    align: "center"
                }, {
                    title: "订单用户ID",
                    field: "uid",
                    width: 170,
                    align: "center"
                }, {
                    title: "订单金额",
                    field: "orderAmount",
                    width: 170,
                    align: "center"
                }, {
                    title: "优惠券金额",
                    field: "couponAmount",
                    width: 170,
                    align: "center"
                }, {
                    title: "YOHO币",
                    field: "yohoCoinNum",
                    width: 170,
                    align: "center"
                }, {
                    title: "运费",
                    field: "shipmentAmount",
                    width: 170,
                    align: "center"
                }, {
                    title: "实付金额",
                    field: "realPayAmount",
                    width: 170,
                    align: "center"
                }, {
                    title: "订单状态",
                    field: "orderStatus",
                    width: 170,
                    align: "center"
                }, {
                    title: "渠道",
                    field: "unionType",
                    width: 170,
                    align: "center"
                }, {
                    title: "附加信息",
                    field: "exetInfmoation",
                    width: 170,
                    align: "center"
                }, {
                    title: "支付方式",
                    field: "payChannel",
                    width: 170,
                    align: "center"
                }, {
                    title: "是否新客",
                    field: "isNew",
                    width: 170,
                    align: "center"
                }
                ]],
                cache: false,
                pagination: true,
                pageSize: 10,
                pageList: [10],
                idField: "id",
                singleSelect: false,
                checkOnSelect: false,
                onLoadSuccess: function (data) {

                    $(this).myDatagrid("getPanel").find("a[role='delete']").linkbutton({
                        iconCls: "icon-more",
                        onClick: function () {
                            deleteBlack($(this).attr("dataId"));
                        }
                    });
                }
            });

            function getParam(table) {
                var paramsArray = $("#"+table+"").serializeArray();
                var params = {};
                for (var i = 0; i < paramsArray.length; i++) {
                    params[paramsArray[i].name] = paramsArray[i].value;
                }
                return params;
            }

            $("#searchBtn").linkbutton({
                iconCls : "icon-search",
                onClick : function() {
                    var param = {};
                        if ($("#beginTime").datetimebox('getValue')!='')
                    {
                        param.beginTime = parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000)
                    }
                        if ($("#endTime").datetimebox('getValue') != ''){
                            param.endTime = parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000)
                         }

                        param.orderCode = $("#orderCode").val(),
                       param.unionId = $("#unionId").val(),
                       param.unionType=$("#unionType").val(),
                            $("#userOrdersTable").myDatagrid("load", param);
                    }
            });

            function addcheckItem() {
                $("input[type='checkbox'][name='id']:checked").each(function () {
                    var k = findCheckedItem($(this).val());
                    if (k == -1) {
                        checkedItems.push($(this).val());
                    }
                });
            }

            var fileview = $.extend({}, $.fn.datagrid.defaults.view, { onAfterRender: function (target) { isCheckItem(); } });

            function isCheckItem() {
                for (var i = 0; i < checkedItems.length; i++) {
                    $("input[type='checkbox'][name='id'][value='"+checkedItems[i]+"']").attr("checked", "checked");
                }
            }

            function findCheckedItem(ID) {
                for (var i = 0; i < checkedItems.length; i++) {
                    if (checkedItems[i] == ID) return i;
                }
                return -1;
            }

            function findCheckedItem(ID) {
                for (var i = 0; i < checkedItems.length; i++) {
                    if (checkedItems[i] == ID) return i;
                }
                return -1;
            }

            function removeAllItem(rows) {
                $("input[type='checkbox'][name='id']").each(function () {
                    if (!this.checked) {
                        var k = findCheckedItem($(this).val());
                        if (k != -1) {
                            checkedItems.splice(k, 1);
                        }
                    }
                });
            }

            function removeSingleItem(rowIndex, rowData) {
                var k = findCheckedItem(rowData.id);
                if (k != -1) {
                    checkedItems.splice(k, 1);
                }
            }

            $("#exportButton").linkbutton({
                onClick : function() {
                    if (checkedItems.length == 0) {
                        $.messager.alert('提示','请选择要导出的数据');
                        return;
                    }
                    var params = {"ids": checkedItems.toString() };
                    window.open(contextPath + "/batch/export.do?type=userOrdersServiceImpl&queryConf=" + JSON.stringify(params));
                }
            });

            $("#exportAllButton").linkbutton({
                onClick : function() {
                    window.open(contextPath + "/batch/export.do?type=userOrdersServiceImpl&queryConf=" + JSON.stringify(getParams()));
                }
            });

            function getParams() {
                var paramsArray = $("#searchForm").serializeArray();
                var params = {};
                var orderCode = "";
                var beginTime="";
                var endTime="";
                for (var i = 0; i < paramsArray.length; i++ ) {
                    if (paramsArray[i].name == "orderCode") {
                        orderCode += paramsArray[i].value + ",";
                    }else if(paramsArray[i].name=="beginTime"){
                        beginTime += paramsArray[i].value + ",";
                    }else if(paramsArray[i].name=="endTime"){
                        endTime +=paramsArray[i].value+",";
                    } else {
                        params[paramsArray[i].name] = paramsArray[i].value;
                    }
                }
                if (orderCode.length != 0) {
                    params["orderCode"] = orderCode.substring(0, orderCode.length -1);
                }
                if(beginTime.length !=0){
                    params["beginTime"]= parseInt(new Date($("#beginTime").datetimebox('getValue')).getTime() / 1000)
                }
                if(endTime.length !=0){
                    params["endTime"]= parseInt(new Date($("#endTime").datetimebox('getValue')).getTime() / 1000)
                }

                return params;
            }




        });
</script>
</body>
</html>