channelUserList.html 14.9 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>
    <style>
        .div_search input { margin-top: 20px; }
        .div_search .textbox { margin-top: 20px; }
        .div_search .easyui-linkbutton { margin-top: 20px; }
    </style>
    <div style="margin-left: 30px;" class="div_search">
        <form id="searchForm" method="post" accept-charset="utf-8">
        <input id="channelSourceCombobox" name="channelSource" class="easyui-combobox" data-options="
		valueField: 'id',
		editable: false,
		multiple: true,
		textField: 'text',
		prompt:'选择泛渠道来源',
		data: [
            { id: '5', text: '淘宝B店订单' },
            { id: '8', text: '淘宝C店订单' },
            { id: '9', text: '淘宝LAL店订单' },
            { id: '10', text: '一号店订单' },
            { id: '11', text: '京东订单' },
            { id: '12', text: '京东闪购店' },
            { id: '13', text: '京东LAL闪购店' },
            { id: '14', text: '物色' },
            { id: '15', text: 'bj天猫店' },
            { id: '16', text: 'intotherainbow旗舰店' },
            { id: '23', text: '苏宁' }
        ]"/>
        <input id="channelOrderCodeText" name="channelOrderCode" class="easyui-textbox" data-options="prompt:'泛渠道订单号'"/>
        <input name="beginChannelOrderTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'泛渠道订单开始时间'">
        <input name="endChannelOrderTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'泛渠道订单结束时间'">
        <input name="uid" class="easyui-textbox" data-options="prompt:'有货 UID'"/>
        <input name="hasUid" class="easyui-combobox" data-options="
		valueField: 'id',
		editable: false,
		textField: 'text',
		data: [
            { id: '', text: '是否有货会员' },
            { id: '1', text: '是' },
            { id: '0', text: '否' }
        ]"/>
        <input name="hasYHOrder" class="easyui-combobox" data-options="
		valueField: 'id',
		editable: false,
		textField: 'text',
		data: [
            { id: '', text: '是否存在有货订单' },
            { id: '1', text: '是' },
            { id: '0', text: '否' }
        ]"/>
        <input name="yhOrderCode" class="easyui-textbox" data-options="prompt:'有货订单号'"/>
        <input name="beginYHOrderTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'有货订单开始时间'">
        <input name="endYHOrderTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'有货订单结束时间'">
        <input name="unionCode" class="easyui-textbox" data-options="prompt:'渠道号'"/>
        <input name="userChannel" class="easyui-combobox" data-options="
		valueField: 'id',
		editable: false,
		textField: 'text',
		data: [
            { id: '', text: '注册终端' },
            { id: '0', text: 'PC' },
            { id: '1', text: 'WAP' },
            { id: '3', text: 'IOS' },
            { id: '4', text: 'Android' }
        ]"/>
        <input name="beginRegisterTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'注册开始时间'">
        <input name="endRegisterTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'注册结束时间'">
        <input name="beginSmsTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'短信发送开始时间'">
        <input name="endSmsTime" class="easyui-datetimebox" data-options="editable: false,showSeconds:false,prompt:'短信发送结束时间'">
        <a id="searchButton" class="easyui-linkbutton btn-info" data-options="iconCls:'icon-search'">查询</a>
        <a id="allButton" 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>
        <a id="createGroupButton" 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="consultTable"></table>
    </div>
</div>
<script type="text/javascript">
    var checkedItems = [];
    var smsId;
    $(function () {
        // 列表
        var grid = $("#consultTable");
        grid.myDatagrid({
            fit: true,
            fitColumns: false,
            nowrap: false,
            url: contextPath + "/channel/user_list",
            method: 'POST',
            queryParams: getParams(),
            rownumbers: true,
            idField: "id",
            view: fileview,
            onCheckAll: addcheckItem,
            onCheck: addcheckItem,
            onUncheckAll: removeAllItem,
            onUncheck: removeSingleItem,
            loadFilter: function (data) {
                var temp = defaultLoadFilter(data);
                temp.rows = temp.list;
                return temp;
            },
            columns: [[{
                title: "全选",
                field: "id",
                idField:"id",
                width: 10,
                align: "center",
                checkbox: true
            }, {
                title: "手机号",
                field: "mobile",
                width: 100,
                align: "center"
            }, {
                title: "渠道来源",
                field: "channelSource",
                width: 100,
                align: "center"
            }, {
                title: "泛渠道购买次数",
                field: "channelPurchasesNumber",
                width: 120,
                align: "center"
            }, {
                title: "泛渠道最近订单",
                field: "channelOrderCode",
                width: 170,
                align: "center"
            }, {
                title: "泛渠道最近订单创建时间",
                field: "channelOrderTime",
                width: 165,
                align: "center"
            }, {
                title: "泛渠道订单金额",
                field: "channelOrderAmount",
                width: 120,
                align: "center"
            }, {
                title: "有货 UID",
                field: "uid",
                width: 120,
                align: "center"
            }, {
                title: "有货购买次数",
                field: "yhPurchasesNumber",
                width: 120,
                align: "center"
            }, {
                title: "有货最近订单",
                field: "yhOrderCode",
                width: 120,
                align: "center"
            }, {
                title: "有货最近订单金额",
                field: "yhOrderAmount",
                width: 120,
                align: "center"
            }, {
                title: "有货最近订单创建时间",
                field: "yhOrderTime",
                width: 165,
                align: "center"
            }, {
                title: "渠道号",
                field: "unionCode",
                width: 100,
                align: "center"
            }, {
                title: "注册终端",
                field: "userChannel",
                width: 80,
                align: "center"
            }, {
                title: "注册时间",
                field: "registerTime",
                width: 80,
                align: "center"
            }, {
                title: "短信次数",
                field: "smsNumber",
                width: 80,
                align: "center",
                formatter: function (value, rowData, rowIndex) {
                    if(value > 0){
                        var str = "<a id='" + rowData.id + "' name='id' style='margin-left:10px'>"+value+"</a>";
                        return str;
                    }else{
                        return "-"
                    }
                }
            }, {
                title: "最近一次短信时间",
                field: "smsTime",
                width: 165,
                align: "center"
            }]],
            cache: false,
            pagination: true,
            pageSize: 10,
            pageList: [10],
            idField: "id",
            singleSelect: false,
            checkOnSelect: false,
            onLoadSuccess: function (data) {
                $("a[name='id']").click(function () {
                    showMessageDetails(this.id);
                    return false;
                });
            }
        });

        function getParams() {
            var paramsArray = $("#searchForm").serializeArray();
            var params = {};
            var channelSource = "";
            for (var i = 0; i < paramsArray.length; i++ ) {
                if (paramsArray[i].name == "channelSource") {
                    channelSource += paramsArray[i].value + ",";
                } else {
                    params[paramsArray[i].name] = paramsArray[i].value;
                }
            }
            if (channelSource.length != 0) {
                params["channelSource"] = channelSource.substring(0, channelSource.length -1);
            }
            return params;
        }

        $("#searchButton").linkbutton({
            onClick: function () {
                grid.datagrid('reload', getParams());
            }
        });

        $("#allButton").linkbutton({
            onClick: function () {
                window.location.reload();
            }
        });

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

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

        $("#createGroupButton").linkbutton({
            onClick: function () {
                var div = $("<div>").appendTo($(window.self.document.body));
                window.self.$(div).myDialog({
                    modal : true,
                    collapsible : true,
                    cache : false,
                    title : "创建分组",
                    width: 400,
                    height: 200,
                    href: contextPath + "/html/channel/createGroup.html",
                    buttons : [{
                        text : "保存",
                        id : "saveUserBtn",
                        iconCls : "icon-save",
                        handler : function() {
                            var param = getParams();
                            var groupName = $.trim($("#groupName").val());
                            if (groupName.length == 0) {
                                window.self.$.messager.alert("提示消息", "请输入分组名称");
                                return;
                            }
                            param['groupName'] = groupName;
                            $.ajax({
                                type: "POST",
                                contentType: "application/json",
                                url: contextPath + '/channel/addGroup',
                                data: JSON.stringify(param),
                                dataType: 'json',
                                success: function(result) {
                                    window.self.$.messager.alert("提示消息",result.message, "", function () {
                                        window.location.href = contextPath + "/html/channel/channelGroupList.html";
                                    });
                                    window.self.$(div).dialog('close');
                                }
                            });
                        }
                    }, {
                        id : "closeBtn",
                        text : "关闭",
                        iconCls : "icon-cancel",
                        handler : function() {
                            window.self.$(div).dialog('close');
                        }
                    }],

                });
            }
        });



    });

    function showMessageDetails(id) {
        smsId = id;
        var div = $("<div>").appendTo($(window.self.document.body));
        window.self.$(div).myDialog({
            modal : true,
            collapsible : true,
            cache : false,
            title : "短信列表",
            width: 600,
            height: 600,
            href: contextPath + "/html/channel/messageDetails.html?mobile="+id,
            buttons : [{
                id : "closeBtn",
                text : "关闭",
                iconCls : "icon-cancel",
                handler : function() {
                    window.self.$(div).dialog('close');
                }
            }]
        });
    }

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

    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);
        }
    }

</script>

</body>
</html>