puzhibing
2023-11-28 7b726d5ff439e7b8bb66369ecc5881e370286bc8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
 * 角色管理的单例
 */
var Statistics = {
    id: "StatisticsTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
Statistics.initColumn = function () {
    var columns = [
        {field: 'select_item', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '活动ID', field: 'code', align: 'center', valign: 'middle', width: '150px'},
        {title: '活动名称', field: 'name', align: 'center', valign: 'middle', width: '150px'},
        {title: '支付模式', field: 'payType', align: 'center', valign: 'middle', width: '200px',
            // formatter: function (value, row) {
            //     if(row.activityType != 1 ){
            //         if(value !=null){
            //             return value.replace(1,"免费").replace(2,"积分").replace(3,"微信").replace(4,"积分+微信");
            //         }
            //     }
            // }
        },
        {title: '活动浏览pv', field: 'browse_pv', align: 'center', valign: 'middle', width: '150px'},
        {title: '活动浏览uv', field: 'browse_uv', align: 'center', valign: 'middle', width: '150px'},
        {title: '活动抢购点击pv', field: 'click_pv', align: 'center', valign: 'middle', width: '150px'},
        {title: '活动抢购点击uv', field: 'click_uv', align: 'center', valign: 'middle', width: '150px'},
        {title: '领取数量', field: 'draw_uv', align: 'center', valign: 'middle', width: '150px'},
        {title: '购买人数', field: 'pay_uv', align: 'center', valign: 'middle', width: '150px'},
        {title: '积分汇总', field: 'integral', align: 'center', valign: 'middle', width: '150px'},
        {title: '金额汇总', field: 'money', align: 'center', valign: 'middle', width: '150px'},
        {title: '详情', field: '', align: 'center', valign: 'middle', width: '150px',
            formatter: function (value, row) {
                return '<a href="#" style="color: #337ab7;" onclick="Statistics.openCouponActivityInfo(\'' + row.id + '\')">查看 </a>';
            }
        },
    ]
    return columns;
};
 
 
/**
 * 检查是否选中
 */
Statistics.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        Statistics.seItem = selected[0];
        return true;
    }
};
 
Statistics.openCouponActivityInfo = function (id){
    var index = layer.open({
        type: 2,
        title: '领券活动详情',
        area: ['80%', '90%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/statistics/showCouponActivityInfo?id=' + id
    });
    this.layerIndex = index;
}
 
 
Statistics.exportStatistics = function(){
    const code = $("#code").val();
    const time = $("#time").val();
    const name = $("#name").val();
    const payMethod = $("#payMethod").val();
    let url = Feng.ctxPath + "/statistics/exportCouponActivityStatistics?";
    if(null != code && '' != code){
        url += "code=" + code + "&";
    }
    if(null != time && '' != time){
        url += "time=" + time + "&";
    }
    if(null != name &&  '' != name){
        url += "name=" + name + "&";
    }
    if(null != payMethod  &&  '' != payMethod){
        url += "payMethod=" + payMethod + "&";
    }
    window.location.href = url;
}
 
 
/**
 * 搜索
 */
Statistics.search = function () {
    var queryData = {};
    queryData['code'] = $("#code").val();
    queryData['time'] = $("#time").val();
    queryData['name'] = $("#name").val();
    queryData['payMethod'] = $("#payMethod").val();
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
/**
 * 重置
 */
Statistics.resetSearch = function(){
    var queryData = {};
    $("#code").val('');
    $("#time").val('');
    $("#name").val('');
    $("#payMethod").val('');
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
 
$(function () {
    var defaultColunms = Statistics.initColumn();
    var table = new BSTable(Statistics.id, "/statistics/queryCouponActivityStatistics", defaultColunms);
    table.setPaginationType("server");
    Statistics.table = table.init();
 
});