无关风月
2024-08-20 9f88b12d16c83963dad8fb8f79d9eeba2c311518
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
/**
 * 角色管理的单例
 */
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: '会员ID', field: 'memberid', align: 'center', valign: 'middle', width: '180px'},
        {title: '会员手机号', field: 'phone', align: 'center', valign: 'middle', width: '150px'},
        {title: '操作时间', field: 'lastTime', align: 'center', valign: 'middle', width: '150px'},
        {title: '状态', field: 'state', align: 'center', valign: 'middle', width: '150px',
            formatter: function (value, row) {
                if(value == 1){
                    return "成功";
                }else if(value == 2 ){
                    return "失败";
                }else if(value == 3 ){
                    return  "发券失败";
                }else if(value == 4 ){
                    return "不符合参与条件";
                }
            }
        },
        {title: '积分', field: 'integral', align: 'center', valign: 'middle', width: '150px'},
        {title: '金额', field: 'money', align: 'center', valign: 'middle', width: '150px'},
    ]
    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.exportStatistics = function(){
    const code = $("#code").val();
    const time = $("#time").val();
    const name = $("#name").val();
    const state = $("#state").val();
    const couponActivityId = $("#couponActivityId").val();
    let url = Feng.ctxPath + "/statistics/exportCouponActivityInfoStatistics?";
    if(null != code && '' != code){
        url += "code=" + code + "&";
    }
    if(null != time && '' != time){
        url += "time=" + time + "&";
    }
    if(null != name &&  '' != name){
        url += "name=" + name + "&";
    }
    if(null != state  &&  '' != state){
        url += "state=" + state + "&";
    }
    if(null != couponActivityId  &&  '' != couponActivityId){
        url += "couponActivityId=" + couponActivityId + "&";
    }
    console.log(url);
    window.location.href = url;
}
 
 
/**
 * 搜索
 */
Statistics.search = function () {
    var queryData = {};
    queryData['code'] = $("#code").val();
    queryData['time'] = $("#time").val();
    queryData['name'] = $("#name").val();
    queryData['state'] = $("#state").val();
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
/**
 * 重置
 */
Statistics.resetSearch = function(){
    var queryData = {};
    $("#code").val('');
    $("#time").val('');
    $("#name").val('');
    $("#state").val('');
    Statistics.table.setQueryParams({});
    Statistics.table.refresh({query: queryData});
}
 
 
$(function () {
    var defaultColunms = Statistics.initColumn();
    var table = new BSTable(Statistics.id, "/statistics/queryCouponActivityInfo?couponActivityId="+$("#couponActivityId").val(), defaultColunms);
    table.setPaginationType("server");
    Statistics.table = table.init();
 
});