yanghb
2023-04-10 b2f678ad387ca24e05a11100ea4583f0f2f730f0
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
/**
 * 通知管理初始化
 */
var PaymentRecord = {
    id: "PaymentRecordTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
PaymentRecord.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '充值时间', field: 'insertTime', align: 'center', valign: 'middle'},
        {title: '流水ID', field: 'code', align: 'center', valign: 'middle'},
        {title: '用户ID', field: 'userId', align: 'center', valign: 'middle'},
        {title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
        {title: '用户手机号', field: 'phone', align: 'center', valign: 'middle'},
        {title: '充值金额', field: 'amount', align: 'center', valign: 'middle'},
        {title: '充值方式', field: 'payType', align: 'center', valign: 'middle',
            formatter: function (value,row) {
                switch (value) {
                    case 1:
                        return "微信";
                    case 2:
                        return "支付宝";
                }
            }
        },
        {title: '状态', field: 'state', align: 'center', valign: 'middle',
            formatter: function (value,row) {
                switch (value) {
                    case 1:
                        return "失败";
                    case 2:
                        return "成功";
                }
            }
        }
    ];
};
 
/**
 * 检查是否选中
 */
PaymentRecord.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if (selected.length == 0) {
        Feng.info("请先选中表格中的某一记录!");
        return false;
    } else {
        PaymentRecord.seItem = selected[0];
        return true;
    }
};
 
 
/**
 * 删除
 */
PaymentRecord.delete = function(){
    if (this.check()){
        var operation = function(){
            var ajax = new $ax(Feng.ctxPath + "/paymentRecord/delete", function (data) {
                Feng.success("删除成功!");
                PaymentRecord.table.refresh();
            }, function (data) {
                Feng.error("删除失败!" + data.responseJSON.message + "!");
            });
            ajax.set("paymentRecordId", PaymentRecord.seItem.id);
            ajax.start();
        };
        Feng.confirm("是否删除充值记录?", operation);
    }
};
 
 
///  导出
PaymentRecord.excel = function(){
    var arr = $("#insertTime").val().split(" - ");
    window.location.href = Feng.ctxPath + "/paymentRecord/exportRecord?userName=" + $("#userName").val()
        + "&phone=" + $("#phone").val() + "&code=" + $("#code").val() + "&startTime=" + arr[0] + "&endTime=" + arr[1];
};
 
 
/**
 * 查询通知列表
 */
PaymentRecord.search = function () {
    var queryData = {};
    queryData['userName'] = $("#userName").val();
    queryData['phone'] = $("#phone").val();
    queryData['code'] = $("#code").val();
    var arr = $("#insertTime").val().split(" - ");
    queryData['startTime'] = arr[0];
    queryData['endTime'] = arr[1];
    PaymentRecord.table.refresh({query: queryData});
};
 
 
PaymentRecord.resetSearch = function () {
    $("#userName").val("");
    $("#phone").val("");
    $("#userId").val("");
    $("#insertTime").val("");
    PaymentRecord.search();
};
 
$(function () {
    var defaultColunms = PaymentRecord.initColumn();
    var table = new BSTable(PaymentRecord.id, "/paymentRecord/list", defaultColunms);
    table.setPaginationType("server");
    PaymentRecord.table = table.init();
});