From d1cb75947e47e62f2eb35e4ad2cd017a8c825e03 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 12 Oct 2023 11:15:56 +0800
Subject: [PATCH] redbagprod

---
 src/main/resources/templates/febs/views/modules/chat/userList.html |  118 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 96 insertions(+), 22 deletions(-)

diff --git a/src/main/resources/templates/febs/views/modules/chat/userList.html b/src/main/resources/templates/febs/views/modules/chat/userList.html
index 8f7e381..9b5c0c4 100644
--- a/src/main/resources/templates/febs/views/modules/chat/userList.html
+++ b/src/main/resources/templates/febs/views/modules/chat/userList.html
@@ -14,9 +14,9 @@
                                         </div>
                                     </div>
                                     <div class="layui-inline">
-                                        <label class="layui-form-label">微聊号:</label>
+                                        <label class="layui-form-label">邀请码:</label>
                                         <div class="layui-input-inline">
-                                            <input type="text" placeholder="微聊号" name="chatNo" autocomplete="off" class="layui-input">
+                                            <input type="text" placeholder="邀请码" name="inviteId" autocomplete="off" class="layui-input">
                                         </div>
                                     </div>
                                     <div class="layui-inline">
@@ -62,6 +62,20 @@
     <input type="checkbox" value={{d.userId}} lay-text="正常|禁用" lay-skin="switch" lay-filter="switchStatus">
     {{# } }}
 </script>
+<script type="text/html" id="switchIsRobot">
+    {{# if(d.isRobot === 1) { }}
+    <input type="checkbox" value={{d.userId}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchIsRobot">
+    {{# } else { }}
+    <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchIsRobot">
+    {{# } }}
+</script>
+<script type="text/html" id="switchModelType">
+    {{# if(d.modelType === 1) { }}
+    <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" checked lay-skin="switch" lay-filter="switchModelType">
+    {{# } else { }}
+    <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" lay-skin="switch" lay-filter="switchModelType">
+    {{# } }}
+</script>
 <style>
     .layui-form-onswitch {
         background-color: #5FB878 !important;
@@ -69,7 +83,7 @@
 </style>
 <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
-<!--        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registMember">添加会员</button>-->
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registerMember">添加会员</button>
         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="balance">拨付余额</button>
     </div>
 </script>
@@ -110,7 +124,7 @@
         function getQueryParams() {
             return {
                 nickName: $searchForm.find('input[name="nickName"]').val().trim(),
-                chatNo: $searchForm.find('input[name="chatNo"]').val().trim(),
+                inviteId: $searchForm.find('input[name="inviteId"]').val().trim(),
                 status: $searchForm.find("select[name='status']").val()
             };
         }
@@ -125,12 +139,15 @@
                 totalRow: true ,// 开启合计行
                 cols: [[
                     {type: 'checkbox'},
-                    {field: 'userId', title: '标识', minWidth: 150,align:'left', totalRowText: '合计:',align:'center'},
-                    {field: 'nickName', title: '昵称', minWidth: 100,align:'left',align:'center'},
-                    {field: 'chatNo', title: '微聊号', minWidth: 150,align:'left',align:'center'},
+                    {field: 'userId', title: '标识', minWidth: 150,align:'left'},
+                    {field: 'nickName', title: '昵称', minWidth: 100,align:'left', totalRowText: '合计:',align:'center'},
+                    {field: 'inviteId', title: '邀请码', minWidth: 100,align:'left',align:'center'},
+                    {field: 'phone', title: '注册号码', minWidth: 150,align:'left',align:'center'},
                     {field: 'totalAmount', title: '账户总额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.totalAmount) }}',align:'center'},
                     {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'},
                     {field: 'status', title: '账号状态', templet: '#switchStatus', minWidth: 80,align:'center'},
+                    {field: 'isRobot', title: '机器人', templet: '#switchIsRobot', minWidth: 80,align:'center'},
+                    {field: 'modelType', title: '模式', templet: '#switchModelType', minWidth: 80,align:'center'},
                     {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'},
                 ]]
             });
@@ -140,27 +157,32 @@
             var data = obj.data,
                 layEvent = obj.event;
 
-            // if (layEvent === 'registMember') {
-            //     febs.modal.open( '添加会员', 'modules/mallMember/addMember', {
-            //         btn: ['提交', '取消'],
-            //         yes: function (index, layero) {
-            //             $('#member-add').find('#submit').trigger('click');
-            //         },
-            //         btn2: function () {
-            //             layer.closeAll();
-            //         }
+            // if (layEvent === 'registerMember') {
+            //     febs.get(ctx + 'admin/chat/registerMember/', null, function () {
+            //         febs.alert.success('操作成功');
+            //         $query.click();
             //     });
-            //
-            //     return;
             // }
 
-            var checkData = table.checkStatus('userChatTable').data;
-            if (checkData.length <= 0) {
-                febs.alert.warn('请选择需要的用户');
-                return;
+            if (layEvent === 'registerMember') {
+                var checkData = table.checkStatus('userChatTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                    return;
+                }
+                registerMember("添加会员", checkData[0].inviteId, 1);
             }
 
             if (layEvent === 'balance') {
+                var checkData = table.checkStatus('userChatTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
                 if (checkData.length > 1) {
                     febs.alert.warn('请选择一个用户');
                     return;
@@ -168,6 +190,18 @@
                 systemPay("修改余额", checkData[0].userId, 1);
             }
         });
+
+        function registerMember(text, inviteId, type) {
+            febs.modal.open(text, 'modules/chat/mallRegisterMember/'+ inviteId, {
+                btn: ['提交', '取消'],
+                yes: function (index, layero) {
+                    $('#chat-register-member').find('#submit').trigger('click');
+                },
+                btn2: function () {
+                    layer.closeAll();
+                }
+            });
+        }
 
         function systemPay(text, userId, type) {
             febs.modal.open(text, 'modules/chat/mallSystemPay/'+ userId, {
@@ -178,6 +212,26 @@
                 btn2: function () {
                     layer.closeAll();
                 }
+            });
+        }
+
+        form.on('switch(switchModelType)', function (data) {
+            if (data.elem.checked) {
+                openModelType(data.value);
+            } else {
+                closeModelType(data.value);
+            }
+        })
+        function openModelType(userId) {
+            febs.get(ctx + 'admin/chat/openModelType/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+        function closeModelType(userId) {
+            febs.get(ctx + 'admin/chat/closeModelType/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
             });
         }
 
@@ -201,5 +255,25 @@
             });
         }
 
+        form.on('switch(switchIsRobot)', function (data) {
+            if (data.elem.checked) {
+                openSwitchIsRobot(data.value);
+            } else {
+                closeSwitchIsRobot(data.value);
+            }
+        })
+        function openSwitchIsRobot(userId) {
+            febs.get(ctx + 'admin/chat/openSwitchIsRobot/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+        function closeSwitchIsRobot(userId) {
+            febs.get(ctx + 'admin/chat/closeSwitchIsRobot/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+
     })
 </script>
\ No newline at end of file

--
Gitblit v1.9.1