From 49f84e6ea4973a7db64be3258b503dfdb8030f85 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 21 Aug 2023 18:05:32 +0800
Subject: [PATCH] 后台修改

---
 src/main/resources/templates/febs/views/dapp/member.html |  319 ++++++++++++++++++++++++-----------------------------
 1 files changed, 145 insertions(+), 174 deletions(-)

diff --git a/src/main/resources/templates/febs/views/dapp/member.html b/src/main/resources/templates/febs/views/dapp/member.html
index 48e75f2..f60a86d 100644
--- a/src/main/resources/templates/febs/views/dapp/member.html
+++ b/src/main/resources/templates/febs/views/dapp/member.html
@@ -8,40 +8,24 @@
                             <div class="layui-col-md10">
                                 <div class="layui-form-item">
                                     <div class="layui-inline">
-                                        <div class="layui-input-inline">
-                                            <input type="text" name="inviteId" autocomplete="off" placeholder="输入地址或邀请码"  class="layui-input">
-                                        </div>
-                                    </div>
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">状态</label>
-                                        <div class="layui-input-inline">
-                                            <select name="accountStatus">
-                                                <option value=""></option>
-                                                <option value="2">禁用</option>
-                                                <option value="1">有效</option>
-                                            </select>
+                                        <label class="layui-form-label">地址邀请码:</label>
+                                        <div class="layui-input-inline"><input type="text" name="inviteId" autocomplete="off" placeholder="输入地址或邀请码"  class="layui-input">
                                         </div>
                                     </div>
 <!--                                    <div class="layui-inline">-->
-<!--                                        <label class="layui-form-label layui-form-label-sm">可兑换</label>-->
+<!--                                        <label class="layui-form-label layui-form-label-sm">状态</label>-->
 <!--                                        <div class="layui-input-inline">-->
-<!--                                            <select name="changeAble">-->
+<!--                                            <select name="accountType">-->
 <!--                                                <option value=""></option>-->
-<!--                                                <option value="2">否</option>-->
-<!--                                                <option value="1">是</option>-->
+<!--                                                <option value="MEMBER">MEMBER</option>-->
+<!--                                                <option value="NODE_1">NODE_1</option>-->
+<!--                                                <option value="NODE_2">NODE_2</option>-->
+<!--                                                <option value="NODE_3">NODE_3</option>-->
+<!--                                                <option value="NODE_4">NODE_4</option>-->
+<!--                                                <option value="NODE_5">NODE_5</option>-->
 <!--                                            </select>-->
 <!--                                        </div>-->
 <!--                                    </div>-->
-                                    <div class="layui-inline">
-                                        <label class="layui-form-label layui-form-label-sm">可提现</label>
-                                        <div class="layui-input-inline">
-                                            <select name="withdrawAble">
-                                                <option value=""></option>
-                                                <option value="2">否</option>
-                                                <option value="1">是</option>
-                                            </select>
-                                        </div>
-                                    </div>
                                 </div>
                             </div>
                             <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
@@ -74,74 +58,25 @@
     }}
     <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
 </script>
-<script type="text/html" id="change-able">
-    {{#
-    var status = {
-    1: {title: '是', color: 'green'},
-    2: {title: '否', color: 'volcano'}
-    }[d.changeAble];
-    }}
-    <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
+<script type="text/html" id="switchActiveStatus">
+    {{# if(d.activeStatus === 1) { }}
+    <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchActiveStatus">
+    {{# } else { }}
+    <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchActiveStatus">
+    {{# } }}
 </script>
-<script type="text/html" id="withdraw-able">
-    {{#
-    var status = {
-    1: {title: '是', color: 'green'},
-    2: {title: '否', color: 'volcano'}
-    }[d.withdrawAble];
-    }}
-    <span class="layui-badge febs-bg-{{status.color}}">{{ status.title }}</span>
+<script type="text/html" id="tableMemberBar">
+    <div class="layui-btn-container">
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="coinAmount">拨付余额</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="scoreAmount">拨付赠送积分</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="balance">拨付资产包</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="balanceSystem">资产强制卖出</button>
+    </div>
 </script>
-<script type="text/html" id="user-sex">
-    {{#
-    var sex = {
-    2: {title: '保密'},
-    1: {title: '女'},
-    0: {title: '男'}
-    }[d.sex];
-    }}
-    <span>{{ sex.title }}</span>
-</script>
-<script type="text/html" id="balance">
-    <span name="balance">{{ d.balance }}</span></br>
-    <span><a lay-event="freshBalance">刷新</a></span>
-    <span><a shiro:hasPermission="member:showMeMoney" lay-event="changeMoney">提现</a></span>
-</script>
-<!--<script type="text/html" id="approve-list">-->
-<!--    {{# if(d.chainType == 'TRX') { }}-->
-<!--    <a href="https://tronscan.io/#/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>-->
-<!--    {{# } else if (d.chainType == 'ETH') { }}-->
-<!--    <a href="https://etherscan.io/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>-->
-<!--    {{# } else if (d.chainType == 'BSC') { }}-->
-<!--    <a href="https://bscscan.com/address/{{d.address}}" target="_blank">{{d.approveCnt}}</a>-->
-<!--    {{# } else { }}-->
-<!--    <span>-</span>-->
-<!--    {{# } }}-->
-<!--</script>-->
-<script type="text/html" id="approve-list">
-    <a href="https://bscscan.com/address/{{d.address}}" target="_blank">{{d.address}}</a>
-</script>
-<script type="text/html" id="member-option">
-    {{#
-        var accountStatus = {
-            2: {title: '启用'},
-            1: {title: '禁用'}
-            }[d.accountStatus];
-        var changeAble = {
-            2: {title: '可兑换'},
-            1: {title: '不可兑换'}
-            }[d.changeAble];
-        var withdrawAble = {
-            2: {title: '可提现'},
-            1: {title: '不可提现'}
-            }[d.withdrawAble];
-    }}
-    <span shiro:lacksPermission="member:accountStatus,member:changeAble,member:withdrawAble">
-        <span class="layui-badge-dot febs-bg-orange"></span> 无权限
-    </span>
-    <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="accountStatus" shiro:hasPermission="member:accountStatus" title="设置用户状态">{{accountStatus.title}}</button>
-<!--    <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="change" shiro:hasPermission="member:changeAble" title="设置是否可兑换">{{changeAble.title}}</button>-->
-    <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="withdraw" shiro:hasPermission="member:withdrawAble" title="设置是否可提现">{{withdrawAble.title}}</button>
+
+<script type="text/html" id="mallmember-option">
+    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="agentLevel">设置会员级别</button>
+    <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="agentLevel:view" lay-event="memberFlow">个人流水</button>
 </script>
 <script data-th-inline="none" type="text/javascript">
     layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'febs', 'treeSelect'], function () {
@@ -165,64 +100,21 @@
         table.on('tool(memberTable)', function (obj) {
             var data = obj.data,
                 layEvent = obj.event;
-
-            if (layEvent === 'teamInfo') {
-                febs.modal.open( '团队详情', 'dappView/teamInfo/' + data.id, {
-                    maxmin: true,
-                });
-            }
-            if (layEvent === 'accountStatus') {
-                var text = "是否启用该用户?";
-                if (data.accountStatus === 1) {
-                    text = "是否禁用该用户"
-                }
-                febs.modal.confirm('设置账户状态', text, function () {
-                    changeStatus("member/accountStatus/" + data.id);
-                });
-            }
-
-            if (layEvent === 'withdraw') {
-                var text = "是否将该用户设置为可提现?";
-                if (data.accountStatus === 1) {
-                    text = "是否将该用户设置为不可提现?"
-                }
-                febs.modal.confirm('设置提现状态', text, function () {
-                    changeStatus("member/withdrawAble/" + data.id);
-                });
-            }
-
-            // if (layEvent === 'change') {
-            //     var text = "是否将该用户设置为可兑换?";
-            //     if (data.accountStatus === 1) {
-            //         text = "是否将该用户设置为不可兑换?"
-            //     }
-            //     febs.modal.confirm('设置兑换状态', text, function () {
-            //         changeStatus("member/changeAble/" + data.id);
-            //     });
-            // }
-
-            if (layEvent === 'changeMoney') {
-                febs.modal.confirm('提现', "是否提现该用户?", function () {
-                    febs.post(ctx + "member/changeMoney/" + data.chainType + "/" +data.address, null, function () {
-                        febs.alert.success('提现成功');
-                        $query.click();
-                    });
-                });
-            }
-
-            var rowIndex =  $(obj.tr).attr("data-index");
-            var balance =  $(obj.tr).find("[name='balance']");
-            if (layEvent === 'freshBalance') {
-                $.ajax({
-                    url : ctx + 'member/getBalanceByAddress/' + data.chainType + "/" + obj.data.address,
-                    type : 'get',
-                    async : true,
-                    success : function(data) {
-                        if (data.data >= 0) {
-                            balance.text(data.data);
-                            febs.alert.success('刷新成功');
-                        }
+            if (layEvent === 'agentLevel') {
+                febs.modal.open('设置代理级别', 'dappView/agentLevel/' + data.id, {
+                    btn: ['确认', '取消'],
+                    yes: function (index, layero) {
+                        $('#agent-level-set').find('#submit').trigger('click');
+                    },
+                    btn2: function () {
+                        layer.closeAll();
                     }
+                });
+            }
+
+            if (layEvent === 'memberFlow') {
+                febs.modal.open( '订单流水', 'dappView/memberFlow/' + data.id, {
+                    maxmin: true,
                 });
             }
         });
@@ -248,45 +140,124 @@
             tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
         });
 
+        form.on('switch(switchActiveStatus)', function (data) {
+            if (data.elem.checked) {
+                insideWithYes(data.value);
+            } else {
+                insideWithNo(data.value);
+            }
+        })
+        function insideWithYes(id) {
+            febs.get(ctx + 'member/insideWithYes/' + id, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+        function insideWithNo(id) {
+            febs.get(ctx + 'member/insideWithNo/' + id, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+
         function initTable() {
             tableIns = febs.table.init({
+
                 elem: $view.find('table'),
                 id: 'memberTable',
                 url: ctx + 'member/list',
-                totalRow: true,
+                toolbar:"#tableMemberBar",
+                totalRow: true ,// 开启合计行
                 cols: [[
-                    // {type: 'checkbox'},
-                    // {type: 'numbers'},
-                    {title: '代理级别',
-                        templet: function (d) {
-                            return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="teamInfo" shiro:hasPermission="teamInfo:view"><span>'+d.accountType+'</span></button>'
-                        },minWidth: 130,align:'center', totalRowText: '合计'},
-                    // {title: '地址', templet: '#approve-list', minWidth: 400},
-                    {field: 'address', title: '地址', minWidth: 400},
-                    {field: 'chainType', title: '所属链', minWidth: 130},
-                    {field: 'activeStatus', title: '加入动能',
-                        templet: function (d) {
-                            if (d.activeStatus === 1) {
-                                return '<span style="color:green;">'+d.systemProfitId+'</span>'
-                            } else{
-                                return ''
-                            }
-                        }, minWidth: 80,align:'center'},
-                    {field: 'directProfit', title: '直推收益', minWidth: 100, totalRow: true},
-                    {field: 'levelProfit', title: '层级收益', minWidth: 100, totalRow: true},
-                    {field: 'luckyProfit', title: '出局收益', minWidth: 100, totalRow: true},
-                    {field: 'inviteId', title: '邀请码', minWidth: 100},
+                    {type: 'checkbox'},
+                    // {title: '代理级别',
+                    //     templet: function (d) {
+                    //         return '<span class="layui-btn layui-btn-normal layui-btn-xs">'+d.accountType+'</span>'
+                    //     },minWidth: 130,align:'center'},
+                    {field: 'address', title: '地址', minWidth: 400, totalRowText: '合计'},
+                    {field: 'coinAmount', title: '余额', minWidth: 130},
+                    {field: 'scoreAmount', title: '赠送积分', minWidth: 130},
+                    {field: 'balance', title: '资产包', minWidth: 130},
+                    {field: 'myTeamAchieve', title: '团队业绩', minWidth: 130},
+                    {field: 'myShareAchieve', title: '共享业绩', minWidth: 130},
+                    {field: 'activeStatus', title: '是否激活', templet:'#switchActiveStatus', minWidth: 120},
+                    {field: 'accountType', title: '会员级别', minWidth: 130},
+                    // {field: 'directProfit', title: '直推收益', minWidth: 100, totalRow: true},
                     {field: 'refererId', title: '上级邀请码', minWidth: 100},
-                    {field: 'createTime', title: '创建时间', minWidth: 180}
+                    {field: 'inviteId', title: '邀请码', minWidth: 100},
+                    {field: 'chainType', title: '所属链', minWidth: 130},
+                    {field: 'createTime', title: '创建时间', minWidth: 180},
+                    {title: '操作', minWidth: 300 ,toolbar: '#mallmember-option',align:'left', fixed:'right'}
                 ]]
+            });
+        }
+        table.on('toolbar(memberTable)', function(obj){
+            var data = obj.data,
+                layEvent = obj.event;
+
+            if (layEvent === 'coinAmount') {
+                var checkData = table.checkStatus('memberTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                    return;
+                }
+                systemPay("余额", checkData[0].id, 1);
+            }
+
+            if (layEvent === 'scoreAmount') {
+                var checkData = table.checkStatus('memberTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                    return;
+                }
+                systemPay("赠送积分", checkData[0].id, 2);
+            }
+
+            if (layEvent === 'balance') {
+                var checkData = table.checkStatus('memberTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                    return;
+                }
+                systemPay("资产包", checkData[0].id, 3);
+            }
+
+            if (layEvent === 'balanceSystem') {
+                febs.get(ctx + 'member/balanceSystem/', null, function () {
+                    febs.alert.success('操作成功');
+                    $query.click();
+                });
+            }
+        });
+
+        function systemPay(text, id, type) {
+            febs.modal.open(text, 'dappView/mallSystemPay/' + type +'/'+ id, {
+                btn: ['确认', '取消'],
+                yes: function (index, layero) {
+                    $('#systemPay-update').find('#submit').trigger('click');
+                },
+                btn2: function () {
+                    layer.closeAll();
+                }
             });
         }
 
         function getQueryParams() {
             return {
                 inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
-                // changeAble: $searchForm.find("select[name='changeAble']").val(),
-                accountStatus: $searchForm.find("select[name='accountStatus']").val(),
+                accountType: $searchForm.find("select[name='accountType']").val(),
                 withdrawAble: $searchForm.find("select[name='withdrawAble']").val(),
                 invalidate_ie_cache: new Date()
             };

--
Gitblit v1.9.1