DuGuYang 3 anni fa
parent
commit
52e0035fbf

+ 12 - 0
Areas/Admin/Controllers/MainServer/LeaderReserveRecordController.cs

@@ -106,6 +106,12 @@ namespace MySystem.Areas.Admin.Controllers
                     dic["SourceMakerCode"] = sourceUser.MakerCode;
                     dic["SourceMakerCode"] = sourceUser.MakerCode;
                     dic.Remove("SourceUserId");
                     dic.Remove("SourceUserId");
                 }
                 }
+
+                //变动类型
+                int ChangeType = int.Parse(function.CheckInt(dic["ChangeType"].ToString()));
+                if (ChangeType == 1) dic["ChangeTypeName"] = "增加";
+                if (ChangeType == 2) dic["ChangeTypeName"] = "减少";
+
                 // else
                 // else
                 // {
                 // {
                 //     int OrderId = int.Parse(function.CheckInt(dic["OrderId"].ToString()));
                 //     int OrderId = int.Parse(function.CheckInt(dic["OrderId"].ToString()));
@@ -282,6 +288,11 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["Remark"] = leaderReserveRecord.Remark;
                 dic["Remark"] = leaderReserveRecord.Remark;
                 dic["CreateDate"] = leaderReserveRecord.CreateDate;
                 dic["CreateDate"] = leaderReserveRecord.CreateDate;
 
 
+                //变动类型
+                int ChangeType = leaderReserveRecord.ChangeType;
+                if (ChangeType == 1) dic["ChangeTypeName"] = "增加";
+                if (ChangeType == 2) dic["ChangeTypeName"] = "减少";
+
                 // //盟主等级
                 // //盟主等级
                 // int LeaderLevel = userid_Users.LeaderLevel;
                 // int LeaderLevel = userid_Users.LeaderLevel;
                 // if (LeaderLevel == 1) dic["LeaderLevel"] = "小盟主";
                 // if (LeaderLevel == 1) dic["LeaderLevel"] = "小盟主";
@@ -320,6 +331,7 @@ namespace MySystem.Areas.Admin.Controllers
             ReturnFields.Add("RealName", "创客姓名");
             ReturnFields.Add("RealName", "创客姓名");
             ReturnFields.Add("CreateDate", "创建时间");
             ReturnFields.Add("CreateDate", "创建时间");
             ReturnFields.Add("Remark", "变动类型");
             ReturnFields.Add("Remark", "变动类型");
+            ReturnFields.Add("ChangeTypeName", "操作类型");
             ReturnFields.Add("dPosCoupons", "电签兑换券张数");
             ReturnFields.Add("dPosCoupons", "电签兑换券张数");
             ReturnFields.Add("bPosCoupons", "大POS兑换券张数");
             ReturnFields.Add("bPosCoupons", "大POS兑换券张数");
             ReturnFields.Add("LeaderBalanceAmount", "可提现余额");
             ReturnFields.Add("LeaderBalanceAmount", "可提现余额");

+ 103 - 3
Areas/Admin/Controllers/MainServer/LeadersController.cs

@@ -569,13 +569,13 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// 导出Excel
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public JsonResult ExportExcel(Leaders data, string UserIdMakerCode, string CreateDateData, string LeaderLevelSelect)
+        public JsonResult ExportExcel(Leaders data, string UserIdMakerCode, string LeaderLevelSelect, string LeaderStatusSelect, string LastBuyDateData, string ExpiredDateData, string CreateDateData)
         {
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Dictionary<string, string> Fields = new Dictionary<string, string>();
 
 
 
 
             string condition = " and Status>-1";
             string condition = " and Status>-1";
-            //创客创客编号
+            //创客编号
             if (!string.IsNullOrEmpty(UserIdMakerCode))
             if (!string.IsNullOrEmpty(UserIdMakerCode))
             {
             {
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
@@ -585,7 +585,20 @@ namespace MySystem.Areas.Admin.Controllers
             {
             {
                 condition += " and LeaderLevel=" + LeaderLevelSelect;
                 condition += " and LeaderLevel=" + LeaderLevelSelect;
             }
             }
-            //创建时间
+            //状态
+            if (!string.IsNullOrEmpty(LeaderStatusSelect))
+            {
+                var time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                if (LeaderStatusSelect == "0")
+                {
+                    condition += " and ExpiredDate>'" + time + "'";
+                }
+                else
+                {
+                    condition += " and ExpiredDate<='" + time + "'";
+                }
+            }
+            //首次购买时间
             if (!string.IsNullOrEmpty(CreateDateData))
             if (!string.IsNullOrEmpty(CreateDateData))
             {
             {
                 string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
@@ -593,6 +606,22 @@ namespace MySystem.Areas.Admin.Controllers
                 string end = datelist[1];
                 string end = datelist[1];
                 condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
                 condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
             }
             }
+            //最后购买时间
+            if (!string.IsNullOrEmpty(LastBuyDateData))
+            {
+                string[] datelist = LastBuyDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and LastBuyDate>='" + start + " 00:00:00' and LastBuyDate<='" + end + " 23:59:59'";
+            }
+            //盟主到期时间
+            if (!string.IsNullOrEmpty(ExpiredDateData))
+            {
+                string[] datelist = ExpiredDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and ExpiredDate>='" + start + " 00:00:00' and ExpiredDate<='" + end + " 23:59:59'";
+            }
 
 
 
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Leaders", Fields, "Id desc", "0", 1, 20000, condition, "UserId,LeaderLevel,CreateDate", false);
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Leaders", Fields, "Id desc", "0", 1, 20000, condition, "UserId,LeaderLevel,CreateDate", false);
@@ -630,5 +659,76 @@ namespace MySystem.Areas.Admin.Controllers
 
 
         #endregion
         #endregion
 
 
+
+        #region 快捷导出Excel
+        public IActionResult QuickExportExcel(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string QuickExportExcelDo(string UserIdMakerCode, string LeaderLevelSelect, string LeaderStatusSelect, string LastBuyDateData, string ExpiredDateData, string CreateDateData)
+        {
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //盟主等级
+            if (!string.IsNullOrEmpty(LeaderLevelSelect))
+            {
+                condition += " and LeaderLevel=" + LeaderLevelSelect;
+            }
+            //状态
+            if (!string.IsNullOrEmpty(LeaderStatusSelect))
+            {
+                var time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                if (LeaderStatusSelect == "0")
+                {
+                    condition += " and ExpiredDate>'" + time + "'";
+                }
+                else
+                {
+                    condition += " and ExpiredDate<='" + time + "'";
+                }
+            }
+            //首次购买时间
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            //最后购买时间
+            if (!string.IsNullOrEmpty(LastBuyDateData))
+            {
+                string[] datelist = LastBuyDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and LastBuyDate>='" + start + " 00:00:00' and LastBuyDate<='" + end + " 23:59:59'";
+            }
+            //盟主到期时间
+            if (!string.IsNullOrEmpty(ExpiredDateData))
+            {
+                string[] datelist = ExpiredDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                condition += " and ExpiredDate>='" + start + " 00:00:00' and ExpiredDate<='" + end + " 23:59:59'";
+            }
+            var Sql = "";
+            var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
+            var FileName = "盟主记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
+            RedisDbconn.Instance.AddList("ExportQueue", SendData);
+            return "success";
+        }
+        #endregion
+
     }
     }
 }
 }

+ 1 - 1
Areas/Admin/Views/MainServer/Leaders/Index.cshtml

@@ -115,7 +115,7 @@
                         <button class="layui-btn" data-type="batchdel"><i
                         <button class="layui-btn" data-type="batchdel"><i
                             class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>
                             class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>
                     }
                     }
-                    @if (RightInfo.Contains("," + right + "_edit,"))
+                    @if (RightInfo.Contains("," + right + "_export,"))
                     {
                     {
                         <button class="layui-btn" data-type="ExportExcel"><i
                         <button class="layui-btn" data-type="ExportExcel"><i
                             class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
                             class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>

+ 1 - 0
wwwroot/layuiadmin/modules_main/LeaderReserveRecord_Admin.js

@@ -96,6 +96,7 @@ layui.config({
             , { field: 'UserIdRealName', width: 200, title: '真实姓名', sort: true }
             , { field: 'UserIdRealName', width: 200, title: '真实姓名', sort: true }
             , { field: 'CreateDate', width: 200, title: '创建时间', sort: true }
             , { field: 'CreateDate', width: 200, title: '创建时间', sort: true }
             , { field: 'Remark', width: 200, title: '变动类型', sort: true }
             , { field: 'Remark', width: 200, title: '变动类型', sort: true }
+            , { field: 'ChangeTypeName', width: 200, title: '操作类型', sort: true }
             , { field: 'SourceMakerCode', width: 200, title: '购券创客', sort: true }
             , { field: 'SourceMakerCode', width: 200, title: '购券创客', sort: true }
             , { field: 'SeoKeyword', width: 200, title: '订单编号', sort: true }
             , { field: 'SeoKeyword', width: 200, title: '订单编号', sort: true }
             , { field: 'dPosCoupons', width: 200, title: '电签兑换券', sort: true }
             , { field: 'dPosCoupons', width: 200, title: '电签兑换券', sort: true }

+ 34 - 9
wwwroot/layuiadmin/modules_main/Leaders_Admin.js

@@ -438,15 +438,40 @@ layui.config({
             $(".layuiadmin-card-header-auto select").each(function (i) {
             $(".layuiadmin-card-header-auto select").each(function (i) {
                 userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
                 userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
             });
             });
-            $.ajax({
-                type: "GET",
-                url: "/Admin/Leaders/ExportExcel?r=" + Math.random(1),
-                data: userdata,
-                dataType: "json",
-                success: function (data) {
-                    data.Obj.unshift(data.Fields);
-                    excel.exportExcel(data.Obj, data.Info, 'xlsx');
-                }
+            // $.ajax({
+            //     type: "GET",
+            //     url: "/Admin/Leaders/ExportExcel?r=" + Math.random(1),
+            //     data: userdata,
+            //     dataType: "json",
+            //     success: function (data) {
+            //         data.Obj.unshift(data.Fields);
+            //         excel.exportExcel(data.Obj, data.Info, 'xlsx');
+            //     }
+            // });
+            var index = layer.confirm('确定导出吗?', function (index) {
+                var indexs = layer.load(1, {
+                    shade: [0.5, '#000']
+                });
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/LeaderReserveRecord/QuickExportExcelDo?r=" + Math.random(1),
+                    data: userdata,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.close(indexs); //关闭弹层
+                            layer.msg('导出成功,请到我的下载中点击下载文件', {
+                                time: 1000
+                            }, function () {
+                                window.location.reload();
+                            });
+                        } else {
+                            layer.close(indexs); //关闭弹层
+                            layer.msg(data);
+                        }
+                    }
+                });
             });
             });
         }
         }
         , Open: function () {
         , Open: function () {