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
/**
 * 角色管理的单例
 */
var Task = {
    id: "TaskTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
Task.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'},
        {title: '奖品名称', field: 'name', align: 'center', valign: 'middle'},
        {title: '奖品类型', field: 'type', align: 'center', valign: 'middle',
            formatter:function (value,row){
                if(value==1){
                    return "优惠券";
                }else {
                    return "积分";
                }
            }
        },
        {title: '发放数量', field: 'number', align: 'center', valign: 'middle'},
        {title: '奖品图', field: 'prizeImg', align: 'center', valign: 'middle',
            formatter: function (value, row) {
                return '<img src="' + value + '" style="width: 100%;" onclick="showImg(this)"/>';
            }
        },
        {title: '已兑换数量', field: 'convertibleNum', align: 'center', valign: 'middle'},
        {title: '需要消耗集点数', field: 'pointsNum', align: 'center', valign: 'middle', width: '150px'},
        {title: '说明', field: 'prizeDescribe', align: 'center', valign: 'middle', width: '300px'}
    ]
    return columns;
};
 
 
/**
 * 检查是否选中
 */
Task.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        Task.seItem = selected[0];
        return true;
    }
};
 
 
 
 
 
/**
 * 搜索
 */
Task.search = function () {
    var queryData = {};
    Task.table.refresh({query: queryData});
}
 
$(function () {
    var defaultColunms = Task.initColumn();
    var table = new BSTable(Task.id, "/pointActivity/queryPrizeList", defaultColunms);
    table.setPaginationType("server");
    table.setQueryParams({
        id: $('#id').val(),
    })
    Task.table = table.init();
 
});