KKSU
2024-07-15 4a347c0ab4b88fd792d24d30bed36b1fa769d3a2
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<div class="layui-fluid layui-anim febs-anim" id="febs-member" lay-title="用户列表">
    <div class="layui-row febs-container">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body febs-table-full">
                    <form class="layui-form layui-table-form" lay-filter="user-table-form">
                        <div class="layui-row">
                            <div class="layui-col-md10">
                                <div class="layui-form-item">
                                    <div class="layui-inline">
                                        <label class="layui-form-label layui-form-label-sm">地址</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="inviteId" autocomplete="off" placeholder="输入地址或邀请码"  class="layui-input">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
                                    <i class="layui-icon">&#xe848;</i>
                                </div>
                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
                                    <i class="layui-icon">&#xe79b;</i>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table lay-filter="memberTable" lay-data="{id: 'memberTable'}"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<style>
    .layui-table-cell {
        height: auto !important;
    }
</style>
<script type="text/html" id="switchPartner">
    {{# if(d.nodeType === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchPartner">
    {{# } else { }}
    <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchPartner">
    {{# } }}
</script>
<script type="text/html" id="switchAccountStatus">
    {{# if(d.accountStatus === 1) { }}
    <input type="checkbox" value={{d.id}} lay-text="正常|禁用" checked lay-skin="switch" lay-filter="switchAccountStatus">
    {{# } else { }}
    <input type="checkbox" value={{d.id}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchAccountStatus">
    {{# } }}
</script>
<script data-th-inline="none" type="text/javascript">
    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () {
        var $ = layui.jquery,
            laydate = layui.laydate,
            febs = layui.febs,
            form = layui.form,
            table = layui.table,
            dropdown = layui.dropdown,
            $view = $('#febs-member'),
            $query = $view.find('#query'),
            $reset = $view.find('#reset'),
            $searchForm = $view.find('form'),
            sortObject = {field: 'createTime', type: null},
            tableIns;
 
        form.render();
 
        initTable();
 
        table.on('tool(memberTable)', function (obj) {
            var data = obj.data,
                layEvent = obj.event;
 
        });
 
        table.on('sort(memberTable)', function (obj) {
            sortObject = obj;
            tableIns.reload({
                initSort: obj,
                where: $.extend(getQueryParams(), {
                    field: obj.field,
                    order: obj.type
                })
            });
        });
 
        $query.on('click', function () {
            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
            tableIns.reload({where: params, page: {curr: 1}});
        });
 
        $reset.on('click', function () {
            $searchForm[0].reset();
            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
        });
 
        function initTable() {
            tableIns = febs.table.init({
                elem: $view.find('table'),
                id: 'memberTable',
                url: ctx + 'member/list',
                totalRow: true ,// 开启合计行
                cols: [[
                    {field: 'address', title: '地址', minWidth: 400, totalRowText: '合计:'},
                    {field: 'availableAmount', title: '可用金额', minWidth: 80,totalRow: '{{= parseInt(d.availableAmount) }}'},
                    {field: 'usdtBalance', title: '额度', minWidth: 100,totalRow: '{{= parseInt(d.usdtBalance) }}'},
                    {field: 'inviteId', title: '邀请码', minWidth: 100},
                    {field: 'refererId', title: '上级邀请码', minWidth: 100},
                    {field: 'accountStatus', title: '状态', templet:'#switchAccountStatus', minWidth: 120},
                    {field: 'nodeType', title: '节点', templet:'#switchPartner', minWidth: 120},
                    {field: 'createTime', title: '创建时间', minWidth: 180},
                ]]
            });
        }
 
        function getQueryParams() {
            return {
                inviteId: $searchForm.find('input[name="inviteId"]').val(),
                nodeType: $searchForm.find("select[name='nodeType']").val(),
                invalidate_ie_cache: new Date()
            };
        }
 
        form.on('switch(switchAccountStatus)', function (data) {
            if (data.elem.checked) {
                changeAccountStatus(data.value);
            } else {
                changeAccountStatus(data.value);
            }
        })
 
        function changeAccountStatus(id) {
            febs.get(ctx + 'member/accountStatus/'+ id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
 
        form.on('switch(switchPartner)', function (data) {
            if (data.elem.checked) {
                changeIdentityYes(4, data.value);
            } else {
                changeIdentityNo(4, data.value);
            }
        })
 
        function changeIdentityYes(type, id) {
            febs.get(ctx + 'member/changeIdentityYes/' + type + "/" + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
        function changeIdentityNo(type, id) {
            febs.get(ctx + 'member/changeIdentityNo/' + type + "/" + id, null, function () {
                febs.alert.success('设置成功');
                $query.click();
            });
        }
 
    })
</script>