From 025bf51f2316dafd184c938293609a056cb4c250 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Sat, 08 Apr 2023 11:33:39 +0800
Subject: [PATCH] 设置内转开关

---
 src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java    |   24 ++++++++++++
 src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java         |    2 +
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java |   11 +++++
 src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html |   28 ++++++++++++++
 4 files changed, 65 insertions(+), 0 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
index dbd1b5e..5d46eb0 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
@@ -81,6 +81,30 @@
         return mallMemberService.openAccount(id);
     }
 
+    /**
+     * 会员列表---禁止
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("insideWithYes/{id}")
+    @ControllerEndpoint(operation = "会员列表---禁止", exceptionMessage = "禁止失败")
+    public FebsResponse insideWithYes(@NotNull(message = "{required}") @PathVariable Long id) {
+        return mallMemberService.insideWithType(id,1);
+    }
+
+    /**
+     * 会员列表---开启
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("insideWithNo/{id}")
+    @ControllerEndpoint(operation = "会员列表---开启", exceptionMessage = "开启失败")
+    public FebsResponse insideWithNo(@NotNull(message = "{required}") @PathVariable Long id) {
+        return mallMemberService.insideWithType(id,2);
+    }
+
     @GetMapping("changeIdentityYes/{type}/{id}")
     public FebsResponse changeIdentityYes(@PathVariable("type") Integer type, @PathVariable("id") Long id) {
         mallMemberService.changeIdentity(type, id, 1);
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
index 819fd08..db8c637 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
@@ -110,4 +110,6 @@
     IPage<MallScoreAchieveRelease> gerAchieveReleaseList(AdminRoleReleaseDto roleReleaseDto, QueryRequest request);
 
     IPage<MallMoneyFlow> achieveReleaseChild(QueryRequest request, MallScoreAchieveRelease mallScoreAchieveRelease);
+
+    FebsResponse insideWithType(Long id, int i);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index b2112cd..0fa3510 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -741,6 +741,17 @@
         return mallMoneyFlowIPage;
     }
 
+    @Override
+    public FebsResponse insideWithType(Long id, int i) {
+        MallMember mallMember = mallMemberMapper.selectById(id);
+        if(ObjectUtil.isEmpty(mallMember)) {
+            return new FebsResponse().fail().message("会员信息不存在");
+        }
+        mallMember.setInsideWith(i);
+        mallMemberMapper.updateById(mallMember);
+        return new FebsResponse().success();
+    }
+
     private String refererIds(String parentId) {
         boolean flag = false;
         if (StrUtil.isBlank(parentId)) {
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html b/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
index 1fcd344..f0c866a 100644
--- a/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
+++ b/src/main/resources/templates/febs/views/modules/mallMember/mallMemberList.html
@@ -103,6 +103,13 @@
     <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchPartner">
     {{# } }}
 </script>
+<script type="text/html" id="switchInsideWith">
+    {{# if(d.insideWith === 1) { }}
+    <input type="checkbox" value={{d.id}} lay-text="是|否" checked lay-skin="switch" lay-filter="switchInsideWith">
+    {{# } else { }}
+    <input type="checkbox" value={{d.id}} lay-text="是|否" lay-skin="switch" lay-filter="switchInsideWith">
+    {{# } }}
+</script>
 <style>
     .layui-form-onswitch {
         background-color: #5FB878 !important;
@@ -192,6 +199,18 @@
             }
 
         });
+        function insideWithYes(id) {
+            febs.get(ctx + 'admin/mallMember/insideWithYes/' + id, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+        function insideWithNo(id) {
+            febs.get(ctx + 'admin/mallMember/insideWithNo/' + id, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
         function closeAccount(id) {
             febs.get(ctx + 'admin/mallMember/closeAccount/' + id, null, function () {
                 febs.alert.success('禁用成功');
@@ -264,6 +283,7 @@
                     {field: 'director', title: '代理商', templet:'#switchDirector', minWidth: 120,align:'left' },
                     {field: 'creater', title: '联创', templet:'#switchCreate', minWidth: 120,align:'left' },
                     {field: 'partner', title: '合伙人', templet:'#switchPartner', minWidth: 120,align:'left' },
+                    {field: 'insideWith', title: '是否内转', templet:'#switchInsideWith', minWidth: 120,align:'left' },
                     {field: 'accountType', title: '账号类型',
                         templet: function (d) {
                             if (d.accountType === 2) {
@@ -452,6 +472,14 @@
             };
         }
 
+        form.on('switch(switchInsideWith)', function (data) {
+            if (data.elem.checked) {
+                insideWithYes(data.value);
+            } else {
+                insideWithNo(data.value);
+            }
+        })
+
         form.on('switch(switchStatus)', function (data) {
             if (data.elem.checked) {
                 openAccount(data.value);

--
Gitblit v1.9.1