DuGuYang 3 年 前
コミット
340413ec83

+ 65 - 1
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;
 using MySystem.Models;
+using System.Data;
 using Library;
 using LitJson;
 using MySystemLib;
@@ -4064,7 +4065,7 @@ namespace MySystem.Areas.Admin.Controllers
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
-            
+
             CustomTagSet set = db.CustomTagSet.FirstOrDefault(m => m.Tags == "CashWithoutUser") ?? new CustomTagSet();
             ViewBag.set = set;
 
@@ -4801,5 +4802,68 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 直营团队数据导出
+
+        public IActionResult Team1Info(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+        #endregion
+
+        #region 直营团队数据导出
+        public JsonResult Team1InfoDo(string MakerCode, string BindingTime, string ActivationTime, string PosFee, string BrandId, int page = 1, int limit = 30)
+        {
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+
+            }
+            DataTable dt = OtherMySqlConn.dtable("select wname,k.`Name`,PosSnType,PosSn,tb.SeoKeyword,TransferTime,BindingTime,ActivationTime,PrizeParams from (select (select Name from BusinessPartner where Id=(select PartnerId from BusinessPartnerPos where PosId=pos.Id and `Status`>-1 limit 1)) wname,BrandId,PosSnType,PosSn,(CASE WHEN BrandId not in(2,7,10,11) THEN ROUND(CAST(SeoKeyword AS DECIMAL)/100, 2) ELSE SeoKeyword end) SeoKeyword,TransferTime,BindingTime,ActivationTime,PrizeParams from PosMachinesTwo pos where BindingState=1 and `Status`>=-1 and BindingTime<'2023-06-12 00:00:00' and BuyUserId=135158 and Id in (select PosId from BusinessPartnerPos)) tb left join KqProducts k on tb.BrandId=k.Id");
+            foreach (DataRow item in dt.Rows)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                curData.Add("wname", item["TradeDate"]); //伙伴名称
+                curData.Add("Name", item["TradeDate"]); //机具品牌
+                curData.Add("PosSn", item["TradeDate"]); //机具Sn
+                curData.Add("SeoKeyword", item["TradeDate"]); //押金
+                curData.Add("BindingTime", item["TradeDate"]); //绑定时间
+                curData.Add("ActivationTime", item["TradeDate"]); //激活时间
+                dataList.Add(curData);
+            }
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            obj.Add("code", 0);
+            obj.Add("msg", "");
+            obj.Add("count", dataList.Count);
+            obj.Add("data", dataList);
+            return Json(obj);
+        }
+
+        #endregion
+
+
+        // #region 快捷导出Excel
+        // public IActionResult QuickExportExcel(string right)
+        // {
+        //     ViewBag.RightInfo = RightInfo;
+        //     ViewBag.right = right;
+
+        //     return View();
+        // }
+
+        // [HttpPost]
+        // public string QuickExportExcelDo(string UserIdMakerCode, string SourceMakerCode, string RemarkSelect, string CreateDateData, string SeoKeyword)
+        // { 
+        //     var Sql = "SELECT c.MakerCode '创客编号',c.RealName '创客姓名',DATE_FORMAT(c.CreateDate,'%Y-%m-%d %H:%i:%s') '创建时间',c.Remark '变动类型',c.Type1Num '电签兑换券张数',c.Type2Num '大POS兑换券张数',d.LeaderBalanceAmount '可提现余额',c.ChangeAmt '使用额度',c.BeforeAmt '使用前剩余额度',c.AfterAmt '使用后剩余额度' FROM(SELECT a.*,b.MakerCode,b.RealName FROM(SELECT Id,UserId,CreateDate,ChangeAmt,BeforeAmt,AfterAmt,Remark,REPLACE (JSON_EXTRACT (SeoTitle, '$[0].Num'),'\\\"','') AS 'Type1Num', REPLACE (JSON_EXTRACT (SeoTitle, '$[1].Num'),'\\\"','') AS 'Type2Num' FROM LeaderReserveRecord WHERE 1=1 " + SqlString + ") a LEFT JOIN Users b ON a.UserId=b.Id) c LEFT JOIN UserAccount d ON c.UserId=d.Id";
+        //     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/LeaderReserveRecord/Index.cshtml

@@ -94,7 +94,7 @@
                             @if (RightInfo.Contains("," + right + "_export,"))
                             {
                                 <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>
                             }
                         </div>
                     </div>

+ 103 - 0
Areas/Admin/Views/MainServer/SysTools/Team1nfo.cshtml

@@ -0,0 +1,103 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+}
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>直营团队数据列表</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <style>
+        .layui-input-inline {
+            width: 175px !important;
+        }
+
+        .layui-form-label {
+            width: 85px !important;
+        }
+
+        .layui-inline {
+            margin-right: 0px !important;
+        }
+
+        .w100 {
+            width: 100px !important;
+        }
+
+        .ml50 {
+            margin-left: 50px !important;
+        }
+    </style>
+</head>
+
+<body>
+    <div class="layui-fluid">
+        <div class="layui-card">
+            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
+                <div class="layui-form-item">
+                    <div class="layui-form-item">
+                        <div class="layui-inline">
+                            <label class="layui-form-label">创客编号</label>
+                            <div class="layui-input-inline">
+                                <input class="layui-input" type="text" name="RealName" id="RealName" autocomplete="off" lay-verify="required|">
+                            </div>
+                        </div>
+                        <div class="layui-inline">
+                            <label class="layui-form-label">绑定时间</label>
+                            <div class="layui-input-inline">
+                                <input class="layui-input" type="text" readonly name="BindingTimeData" id="BindingTime" lay-verify="required|"
+                                    placeholder="" autocomplete="off">
+                            </div>
+                        </div>
+                        <div class="layui-inline">
+                              <label class="layui-form-label">激活时间</label>
+                            <div class="layui-input-inline">
+                        <input class="layui-input" type="text" readonly name="ActivationTimeData" id="ActivationTime" lay-verify="required|"
+                                    placeholder="" autocomplete="off">
+                            </div>
+                        </div>
+                        @{
+                            Dictionary<string, string> ProfitObjectsActivesDic = new MySystem.DictionaryClass().getKqProductBrandDic();
+                        }
+                        <div class="layui-inline">
+                            <label class="layui-form-label">品牌</label>
+                            <div class="layui-input-inline">
+                                <select id="BrandId" name="BrandId" lay-search="">
+                                    <option value="">全部...</option>
+                                    @foreach (string key in ProfitObjectsActivesDic.Keys)
+                                    {
+                                        <option value="@key">@ProfitObjectsActivesDic[key]</option>
+                                    }
+                                </select>
+                            </div>
+                        </div>
+                        <div class="layui-inline ml50">
+                            <button class="layui-btn" lay-submit lay-filter="LAY-list-front-search">
+                                <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-card-body">
+                <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
+            </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/layuiadmin/modules_main/Team1Info_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script>
+    </script>
+</body>
+
+</html>

+ 197 - 0
wwwroot/layuiadmin/modules_main/Team1Info_Admin.js

@@ -0,0 +1,197 @@
+var ExcelData, ExcelKind;
+var excel;
+layui.config({
+    base: '/layuiadmin/' //静态资源所在路径
+}).extend({
+    myexcel: 'layui/lay/modules/excel',
+    index: 'lib/index' //主入口模块
+}).use(['index', 'table', 'excel', 'laydate'], function () {
+    var $ = layui.$,
+        form = layui.form,
+        table = layui.table;
+
+    //- 筛选条件-日期
+    var laydate = layui.laydate;
+    var layActivationTime = laydate.render({
+        elem: '#ActivationTime',
+        type: 'date',
+        range: true,
+        trigger: 'click',
+        change: function (value, date, endDate) {
+            var op = true;
+            if (date.year == endDate.year && endDate.month - date.month <= 1) {
+                if (endDate.month - date.month == 1 && endDate.date > date.date) {
+                    op = false;
+                    layActivationTime.hint('日期范围请不要超过1个月');
+                    setTimeout(function () {
+                        $(".laydate-btns-confirm").addClass("laydate-disabled");
+                    }, 1);
+                }
+            } else {
+                op = false;
+                layActivationTime.hint('日期范围请不要超过1个月');
+                setTimeout(function () {
+                    $(".laydate-btns-confirm").addClass("laydate-disabled");
+                }, 1);
+            }
+            if (op) {
+                $('#ActivationTime').val(value);
+            }
+        }
+    });
+
+    var layBindingTime = laydate.render({
+        elem: '#BindingTime',
+        type: 'date',
+        range: true,
+        trigger: 'click',
+        change: function (value, date, endDate) {
+            var op = true;
+            if (date.year == endDate.year && endDate.month - date.month <= 1) {
+                if (endDate.month - date.month == 1 && endDate.date > date.date) {
+                    op = false;
+                    layBindingTime.hint('日期范围请不要超过1个月');
+                    setTimeout(function () {
+                        $(".laydate-btns-confirm").addClass("laydate-disabled");
+                    }, 1);
+                }
+            } else {
+                op = false;
+                layBindingTime.hint('日期范围请不要超过1个月');
+                setTimeout(function () {
+                    $(".laydate-btns-confirm").addClass("laydate-disabled");
+                }, 1);
+            }
+            if (op) {
+                $('#BindingTime').val(value);
+            }
+        }
+    });
+
+
+    //excel导入
+    excel = layui.excel;
+    $('#ExcelFile').change(function (e) {
+        var files = e.target.files;
+        excel.importExcel(files, {}, function (data) {
+            ExcelData = data[0].Sheet1;
+        });
+    });
+
+    //监听单元格编辑
+    table.on('edit(LAY-list-manage)', function (obj) {
+        var value = obj.value //得到修改后的值
+            ,
+            data = obj.data //得到所在行所有键值
+            ,
+            field = obj.field; //得到字段
+        if (field == "Sort") {
+            $.ajax({
+                type: "POST",
+                url: "/Admin/StoreHouse/Sort?r=" + Math.random(1),
+                data: "Id=" + data.Id + "&Sort=" + value,
+                dataType: "text",
+                success: function (data) { }
+            });
+        }
+    });
+
+    //列表数据
+    table.render({
+        elem: '#LAY-list-manage'
+        , url: '/Admin/SysTools/Team1InfoDo' //模拟接口
+        , cols: [[
+            { type: 'checkbox', fixed: 'left' }
+            , { field: 'wname', width: 200, title: '伙伴名称', sort: true }
+            , { field: 'Name', width: 200, title: '机具品牌', sort: true }
+            , { field: 'PosSn', width: 200, title: '机具Sn', sort: true }
+            , { field: 'SeoKeyword', width: 200, title: '押金', sort: true }
+            , { field: 'BindingTime', width: 200, title: '绑定时间', sort: true }
+            , { field: 'ActivationTime', width: 200, title: '激活时间', sort: true }
+        ]]
+        , where: {
+        }
+        , page: true
+        , limit: 30
+        , height: 'full-' + String($('.layui-card-header').height() + 130)
+        , text: '对不起,加载出现异常!'
+        , done: function (res, curr, count) {
+            $(".layui-none").text("无数据");
+        }
+    });
+
+    $('.layui-btn').on('click', function () {
+        var type = $(this).data('type');
+        active[type] ? active[type].call(this) : '';
+    });
+
+    //监听工具条
+    table.on('tool(LAY-list-manage)', function (obj) {
+        var data = obj.data;
+    });
+
+
+    //监听搜索
+    form.on('submit(LAY-list-front-search)', function (data) {
+        var field = data.field;
+
+        //执行重载
+        table.reload('LAY-list-manage', {
+            where: field,
+            page: {
+                curr: 1
+            }
+        });
+    });
+    form.on('submit(LAY-list-front-searchall)', function (data) {
+        table.reload('LAY-list-manage', {
+            where: null,
+            page: {
+                curr: 1
+            }
+        });
+    });
+
+    //事件
+    var active = {
+        ExportExcel: function () {
+            var userdata = '';
+            $(".layuiadmin-card-header-auto input").each(function (i) {
+                userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
+            });
+            $(".layuiadmin-card-header-auto select").each(function (i) {
+                userdata += $(this).attr('name') + '=' + encodeURIComponent($(this).val()) + '&';
+            });
+            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);
+                        }
+                    }
+                });
+            });
+        },
+    };
+
+    $('.layui-btn').on('click', function () {
+        var type = $(this).data('type');
+        active[type] ? active[type].call(this) : '';
+    });
+});