Browse Source

把盟主提现区分开

lichunlei 3 năm trước cách đây
mục cha
commit
ae0ce6c4a3

+ 220 - 2
Areas/Admin/Controllers/MainServer/UserCashRecordController.cs

@@ -69,7 +69,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("CashOrderNo", "1"); //提现单号
             Fields.Add("TradeType", "0"); //交易类型
 
-            string condition = " and Status>-1";
+            string condition = " and Status>-1 and TradeType<3";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -371,7 +371,7 @@ namespace MySystem.Areas.Admin.Controllers
             Fields.Add("CreateDate", "3"); //创建时间
             Fields.Add("TradeType", "0"); //交易类型
 
-            string condition = " and Status>-1";
+            string condition = " and Status>-1 and TradeType<3";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -462,6 +462,224 @@ namespace MySystem.Areas.Admin.Controllers
 
 
 
+        
+        #region 盟主提现记录列表
+
+        /// <summary>
+        /// 根据条件查询盟主提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult LeaderIndex(UserCashRecord data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            string Condition = "";
+            Condition += "CashOrderNo:\"" + data.CashOrderNo + "\",";
+            Condition += "TradeType:\"" + data.TradeType + "\",";
+
+            if (!string.IsNullOrEmpty(Condition))
+            {
+                Condition = Condition.TrimEnd(',');
+                Condition = ", where: {" + Condition + "}";
+            }
+            ViewBag.Condition = Condition;
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询盟主提现记录列表
+
+        /// <summary>
+        /// 盟主提现记录列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult LeaderIndexData(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string QueryCountSelect, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+
+            string condition = " and Status>-1 and TradeType=3";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+                // condition += " and UserId in (select Id from Users where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            if (!string.IsNullOrEmpty(data.CashOrderNo))
+            {
+                condition += " and CashOrderNo='" + data.CashOrderNo + "'";
+            }
+            if (data.TradeType > 0)
+            {
+                condition += " and TradeType=" + data.TradeType;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(QueryCountSelect))
+            {
+                condition += " and QueryCount=" + QueryCountSelect;
+            }
+            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'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", page, limit, condition);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+            }
+            Dictionary<string, object> other = new Dictionary<string, object>();
+
+            string WaitAmount = "0.00";//待处理总金额
+            string SuccessAmount = "0.00";//提现成功总金额
+            string FailAmount = "0.00";//提现失败总金额
+            DataTable dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=0" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                WaitAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=1" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                SuccessAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            dt = OtherMySqlConn.dtable("select sum(TradeAmount) from UserCashRecord where Status=2" + condition);
+            if (dt.Rows.Count > 0)
+            {
+                FailAmount = decimal.Parse(function.CheckNum(dt.Rows[0][0].ToString())).ToString("f2");
+            }
+            other.Add("WaitAmount", WaitAmount);
+            other.Add("SuccessAmount", SuccessAmount);
+            other.Add("FailAmount", FailAmount);
+            obj.Add("other", other);
+            return Json(obj);
+        }
+
+        #endregion
+        
+        #region 导出盟主Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult LeaderExportExcel(UserCashRecord data, string MakerCode, string RealName, string StatusSelect, string PayStatus)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CashOrderNo", "1"); //提现单号
+            Fields.Add("CreateDate", "3"); //创建时间
+
+            string condition = " and Status>-1 and TradeType=3";
+            //创客编号
+            if (!string.IsNullOrEmpty(MakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+            }
+            //创客名称
+            if (!string.IsNullOrEmpty(RealName))
+            {
+                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+            }
+            //提现状态
+            if (!string.IsNullOrEmpty(StatusSelect))
+            {
+                condition += " and Status=" + StatusSelect;
+            }
+            //提交到代付状态
+            if (!string.IsNullOrEmpty(PayStatus))
+            {
+                int QueryCount = int.Parse(function.CheckInt(PayStatus));
+                if (QueryCount == 2)
+                {
+                    QueryCount = 0;
+                }
+                condition += " and QueryCount=" + QueryCount;
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserCashRecord", Fields, "Id desc", "0", 1, 20000, condition, "CashOrderNo,UserId,IdCardNo,ActualTradeAmount,Remark,Status,QueryCount,CreateDate", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+                int UserId = int.Parse(dic["UserId"].ToString());
+                Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                dic["MakerCode"] = user.MakerCode;
+                dic["RealName"] = user.RealName;
+                dic["Mobile"] = user.Mobile;
+                dic["SettleBankName"] = user.SettleBankName;
+                dic["SettleBankCardNo"] = user.SettleBankCardNo;
+                dic.Remove("UserId");
+                // dic["TradeType"] = RelationClassForConst.GetTradeTypeInfo(int.Parse(dic["TradeType"].ToString()));
+                int Status = int.Parse(dic["Status"].ToString());
+                if (Status == 0) dic["StatusName"] = "处理中";
+                if (Status == 1) dic["StatusName"] = "成功";
+                if (Status == 2) dic["StatusName"] = "失败";
+                dic.Remove("Status");
+
+                int QueryCount = int.Parse(dic["QueryCount"].ToString());
+                if (QueryCount == 0) dic["LockName"] = "待提交";
+                if (QueryCount == 1) dic["LockName"] = "已提交";
+                dic.Remove("QueryCount");
+            }
+
+            Dictionary<string, object> result = new Dictionary<string, object>();
+            result.Add("Status", "1");
+            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+            result.Add("Obj", diclist);
+            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+            ReturnFields.Add("CashOrderNo", "提现单号");
+            ReturnFields.Add("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "灵工姓名");
+            ReturnFields.Add("Mobile", "手机号");
+            ReturnFields.Add("IdCardNo", "身份证号");
+            ReturnFields.Add("SettleBankName", "开户行名称");
+            ReturnFields.Add("SettleBankCardNo", "开户行卡号");
+            ReturnFields.Add("ActualTradeAmount", "发佣金额(单位:元)");
+            ReturnFields.Add("LockName", "代付标记");
+            ReturnFields.Add("StatusName", "状态");
+            ReturnFields.Add("Remark", "备注");
+            ReturnFields.Add("CreateDate", "创建时间");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "UserCashRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+
+
+
+
 
 
         #region 提交代付平台

+ 2 - 3
Areas/Admin/Views/MainServer/UserCashRecord/Index.cshtml

@@ -81,7 +81,6 @@
                                 <option value="">全部...</option>
                                 <option value="1">消费代付</option>
                                 <option value="2">用户提现</option>
-                                <option value="3">盟主提现</option>
                             </select>
                         </div>
                     </div>
@@ -111,8 +110,8 @@
                         </button>
                         @if (RightInfo.Contains("," + right + "_reduce,"))
                         {
-                            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reduce"><i
-                                class="layui-icon layui-icon-edit"></i>驳回</a>
+                            <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reduce"><i
+                                class="layui-icon layui-icon-edit"></i>驳回</button>
                         }
                         @if (RightInfo.Contains("," + right + "_export,"))
                         {

+ 142 - 0
Areas/Admin/Views/MainServer/UserCashRecord/LeaderIndex.cshtml

@@ -0,0 +1,142 @@
+@{
+    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-inline">
+                        <label class="layui-form-label">提现单号</label>
+                        <div class="layui-input-inline">
+                            <input class="layui-input" type="text" name="CashOrderNo" 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" name="MakerCode" 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" name="RealName" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="layui-inline">
+                        <label class="layui-form-label">提现状态</label>
+                        <div class="layui-input-inline">
+                            <select id="StatusSelect" name="StatusSelect" lay-search="">
+                                <option value="">全部...</option>
+                                <option value="0">处理中</option>
+                                <option value="2">失败</option>
+                                <option value="1">成功</option>
+                            </select>
+                        </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="CreateDateData" id="CreateDate"
+                                placeholder="创建时间" autocomplete="off">
+                        </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>
+                        <button class="layui-btn" lay-submit lay-filter="LAY-list-front-searchall">
+                            <i class="layui-icon layui-icon-list layuiadmin-button-btn"></i>全部
+                        </button>
+                        @if (RightInfo.Contains("," + right + "_reduce,"))
+                        {
+                            <button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reduce"><i
+                                class="layui-icon layui-icon-edit"></i>驳回</button>
+                        }
+                        @if (RightInfo.Contains("," + right + "_export,"))
+                        {
+                            <button class="layui-btn" data-type="ExportExcel"><i
+                                class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
+                        }
+                        @if (RightInfo.Contains("," + right + "_import,"))
+                        {
+                            <button class="layui-btn" data-type="ImportData"><i
+                                class="layui-icon layui-icon-upload layuiadmin-button-btn"></i>提现结果导入</button>
+                        }
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-card-body">
+                <blockquote class="layui-elem-quote layui-text">
+                    待处理总金额(元):<span style="color: #f00;" id="WaitAmount">0.00</span> | 提现成功总金额(元):<span
+                        style="color: #f00;" id="SuccessAmount">0.00</span> | 提现失败总金额(元):<span style="color: #f00;"
+                        id="FailAmount">0.00</span>
+                </blockquote>
+                <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
+                <script type="text/html" id="StatusTpl">
+                    {{# if(d.Status == 2) { }}
+                    {{ d.StatusName }} <a href="javascript:;" style="color:cornflowerblue" onclick="layer.msg('{{ d.Remark }}')">点击查看原因</a>
+                    {{# } else { }}
+                    {{ d.StatusName }}
+                    {{# } }}
+                </script>
+                <script type="text/html" id="table-list-tools">
+                    {{# if(d.Status == 0) { }}
+                    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reduce"><i class="layui-icon layui-icon-edit"></i>驳回</a>
+                    {{# } }}
+                    {{# if(d.QueryCount == 1 && d.Status == 2) { }}
+                    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="cancel"><i class="layui-icon layui-icon-edit"></i>解冻</a>
+                    {{# } }}
+                </script>
+            </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/layuiadmin/modules_main/UserCashLeaderRecord_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script>
+
+    </script>
+</body>
+
+</html>

+ 11 - 0
Models/HelpProfitMerIds.cs

@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models
+{
+    public partial class HelpProfitMerIds
+    {
+        public int MerchantId { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 3 - 0
Models/PosCoupons.cs

@@ -20,5 +20,8 @@ namespace MySystem.Models
         public string ExchangeCode { get; set; }
         public int UserId { get; set; }
         public int LeaderUserId { get; set; }
+        public int HelpProfitMerchantId { get; set; }
+        public int HelpProfitStatus { get; set; }
+        public ulong HelpProfitFlag { get; set; }
     }
 }

+ 20 - 2
Models/WebCMSEntities.cs

@@ -52,6 +52,7 @@ namespace MySystem.Models
         public virtual DbSet<HelpProfitAccountRecord> HelpProfitAccountRecord { get; set; }
         public virtual DbSet<HelpProfitExchange> HelpProfitExchange { get; set; }
         public virtual DbSet<HelpProfitExchangeDetail> HelpProfitExchangeDetail { get; set; }
+        public virtual DbSet<HelpProfitMerIds> HelpProfitMerIds { get; set; }
         public virtual DbSet<HelpProfitMerTradeSummay> HelpProfitMerTradeSummay { get; set; }
         public virtual DbSet<HelpProfitMerchantForUser> HelpProfitMerchantForUser { get; set; }
         public virtual DbSet<HelpProfitRebateDetail> HelpProfitRebateDetail { get; set; }
@@ -235,8 +236,7 @@ namespace MySystem.Models
         {
             if (!optionsBuilder.IsConfigured)
             {
-#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
-                optionsBuilder.UseMySql("server=47.109.31.237;port=3306;user=KxsMainServer2;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer2;charset=utf8", x => x.ServerVersion("5.7.28-mysql"));
+                optionsBuilder.UseMySql(Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString(), x => x.ServerVersion("5.7.17-mysql"));
             }
         }
 
@@ -2819,6 +2819,16 @@ namespace MySystem.Models
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<HelpProfitMerIds>(entity =>
+            {
+                entity.HasKey(e => e.MerchantId)
+                    .HasName("PRIMARY");
+
+                entity.Property(e => e.MerchantId).HasColumnType("int(11)");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
             modelBuilder.Entity<HelpProfitMerTradeSummay>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -7524,6 +7534,14 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.HelpProfitFlag)
+                    .HasColumnType("bit(1)")
+                    .HasDefaultValueSql("b'0'");
+
+                entity.Property(e => e.HelpProfitMerchantId).HasColumnType("int(11)");
+
+                entity.Property(e => e.HelpProfitStatus).HasColumnType("int(11)");
+
                 entity.Property(e => e.IsLock)
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");

+ 7 - 7
Startup.cs

@@ -133,11 +133,11 @@ namespace MySystem
                     pattern: "{controller=Home}/{action=Index}/{Id?}");
             });
 
-            ResetUserTradeService.Instance.Start();
-            ResetMerchantTradeService.Instance.Start();
-            SycnProfitServiceV2.Instance.Start();
-            ExcelHelper.Instance.Start();
-            TestHelper.Instance.Start();
+            // ResetUserTradeService.Instance.Start();
+            // ResetMerchantTradeService.Instance.Start();
+            // SycnProfitServiceV2.Instance.Start();
+            // ExcelHelper.Instance.Start();
+            // TestHelper.Instance.Start();
         }
 
 
@@ -152,11 +152,11 @@ namespace MySystem
         {
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
-            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'");
+            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer2'");
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             {
                 Dictionary<string, string> Columns = new Dictionary<string, string>();
-                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
+                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer2' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 {
                     string datatype = column["DATA_TYPE"].ToString();

+ 618 - 0
wwwroot/layuiadmin/modules_main/UserCashLeaderRecord_Admin.js

@@ -0,0 +1,618 @@
+var ExcelData;
+
+function ConfirmImport() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/UserCashRecord/Import?r=" + Math.random(1),
+        data: "ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
+        dataType: "text",
+        success: function (data) {
+            if (data == "success") {
+                layer.msg("导入成功", {
+                    time: 2000
+                }, function () {
+                    window.location.reload();
+                });
+            } else {
+                layer.msg(data);
+            }
+        }
+    });
+}
+
+function CheckImport(table, key, loadindex, index) { 
+    $.ajax({
+        url: "/Admin/UserCashRecord/CheckImport?r=" + Math.random(1),
+        data: "key=" + key,
+        dataType: "text",
+        success: function (data) {
+            if (data.indexOf('success') == 0) {
+                layer.msg("成功操作" + data.split('|')[1] + "笔提现申请", { time: 2000 }, function () {
+                    layer.close(index); //关闭弹层
+                    layer.close(loadindex);
+                    table.reload('LAY-list-manage'); //数据刷新
+                });
+            } else {
+                layer.msg(data, { time: 1000 }, function () {
+                    CheckImport(table, key, loadindex, index);
+                });
+            }
+        }
+    });
+}
+
+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 layCreateDate = laydate.render({
+        elem: '#CreateDate',
+        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;
+                    layCreateDate.hint('日期范围请不要超过1个月');
+                    setTimeout(function () {
+                        $(".laydate-btns-confirm").addClass("laydate-disabled");
+                    }, 1);
+                }
+            } else {
+                op = false;
+                layCreateDate.hint('日期范围请不要超过1个月');
+                setTimeout(function () {
+                    $(".laydate-btns-confirm").addClass("laydate-disabled");
+                }, 1);
+            }
+            if (op) {
+                $('#CreateDate').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/UserCashRecord/Sort?r=" + Math.random(1),
+                data: "Id=" + data.Id + "&Sort=" + value,
+                dataType: "text",
+                success: function (data) {}
+            });
+        }
+    });
+
+    //列表数据
+    table.render({
+        elem: '#LAY-list-manage',
+        url: '/Admin/UserCashRecord/LeaderIndexData' //模拟接口
+            ,
+        cols: [
+            [{
+                    type: 'checkbox',
+                    fixed: 'left'
+                }, {
+                    field: 'CashOrderNo',
+                    width: 200,
+                    title: '提现单号',
+                    sort: true
+                }, {
+                    field: 'MakerCode',
+                    width: 200,
+                    title: '创客编码',
+                    sort: true
+                }, {
+                    field: 'RealName',
+                    width: 200,
+                    title: '创客名称',
+                    sort: true
+                }, {
+                    field: 'IdCardNo',
+                    width: 200,
+                    title: '身份证号',
+                    sort: true
+                }, {
+                    field: 'SettleBankCardNo',
+                    width: 200,
+                    title: '提现卡号',
+                    sort: true
+                }, {
+                    field: 'SettleBankName',
+                    width: 200,
+                    title: '银行名称',
+                    sort: true
+                }, {
+                    field: 'TradeType',
+                    width: 200,
+                    title: '交易类型',
+                    sort: true
+                }, {
+                    field: 'TradeAmount',
+                    width: 200,
+                    title: '提现金额(元)',
+                    sort: true
+                }, {
+                    field: 'ActualTradeAmount',
+                    width: 200,
+                    title: '发佣金额(元)',
+                    sort: true
+                }, {
+                    field: 'StatusName',
+                    width: 200,
+                    title: '订单状态',
+                    templet: '#StatusTpl',
+                    sort: true
+                }, {
+                    field: 'LockName',
+                    width: 200,
+                    title: '提现标记',
+                    sort: true
+                }, {
+                    field: 'ReturnCode',
+                    width: 200,
+                    title: '提现服务返回编码',
+                    sort: true
+                }, {
+                    field: 'ReturnMsg',
+                    width: 200,
+                    title: '提现服务返回信息',
+                    sort: true
+                }, {
+                    field: 'CreateDate',
+                    width: 200,
+                    title: '创建时间',
+                    sort: true
+                }, { title: '操作', align: 'center', width: 300, fixed: 'right', toolbar: '#table-list-tools' }
+
+            ]
+        ],
+        where: {
+
+        },
+        page: true,
+        limit: 30,
+        height: 'full-' + String($('.layui-card-header').height() + 130),
+        text: '对不起,加载出现异常!',
+        done: function (res, curr, count) {
+            $("#SuccessAmount").text(res.other.SuccessAmount);
+            $("#FailAmount").text(res.other.FailAmount);
+            $("#WaitAmount").text(res.other.WaitAmount);            
+            $(".layui-none").text("无数据");
+        }
+    });
+
+    //监听工具条
+    table.on('tool(LAY-list-manage)', function (obj) {
+        var data = obj.data;
+        if (obj.event === 'del') {
+            var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/UserCashRecord/Delete?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        if (data == "success") {
+                            obj.del();
+                            layer.close(index);
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
+        } else if (obj.event === 'cancel') {
+            var index = layer.confirm('确定要解除吗?操作后不能恢复!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/UserCashRecord/Cancel?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            parent.layer.msg('已解除');
+                            table.reload('LAY-list-manage'); //数据刷新
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
+        } else if (obj.event === 'edit') {
+            var tr = $(obj.tr);
+            var perContent = layer.open({
+                type: 2,
+                title: '提现记录-编辑',
+                content: 'Edit?Id=' + data.Id + '',
+                maxmin: true,
+                area: ['500px', '450px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+                    setTimeout(function () {
+                        layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
+                            var errObj = $(this).find('.layui-form-danger');
+                            if (errObj.length > 0) {
+                                iframeWindow.element.tabChange('mytabbar', String(i + 1));
+                                submit.click();
+                            }
+                        });
+                    }, 300);
+
+
+
+
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/UserCashRecord/Edit?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                layer.close(index); //关闭弹层
+                                if (data == "success") {
+                                    table.reload('LAY-list-manage'); //数据刷新
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                },
+                success: function (layero, index) {
+
+                }
+            });
+            layer.full(perContent);
+        } else if (obj.event === 'reduce') {
+            var tr = $(obj.tr);
+            var perContent = layer.open({
+                type: 2,
+                title: '拒绝处理',
+                content: 'Reduce?Id=' + data.Id + '',
+                maxmin: true,
+                area: ['500px', '450px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+                    setTimeout(function () {
+                        layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
+                            var errObj = $(this).find('.layui-form-danger');
+                            if (errObj.length > 0) {
+                                iframeWindow.element.tabChange('mytabbar', String(i + 1));
+                                submit.click();
+                            }
+                        });
+                    }, 300);
+
+
+
+
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/UserCashRecord/ReduceDo?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                layer.close(index); //关闭弹层
+                                if (data == "success") {
+                                    table.reload('LAY-list-manage'); //数据刷新
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                },
+                success: function (layero, index) {
+
+                }
+            });
+        }
+    });
+
+
+    //监听搜索
+    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 = {
+        batchdel: function () {
+            var checkStatus = table.checkStatus('LAY-list-manage'),
+                data = checkStatus.data; //得到选中的数据
+            if (data.length < 1) {
+                parent.layer.msg("请选择要删除的项");
+            } else {
+                var ids = "";
+                $.each(data, function (index, value) {
+                    ids += data[index].Id + ",";
+                });
+                ids = ids.substring(0, ids.length - 1);
+                var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
+                    $.ajax({
+                        type: "POST",
+                        url: "/Admin/UserCashRecord/Delete?r=" + Math.random(1),
+                        data: "Id=" + ids,
+                        dataType: "text",
+                        success: function (data) {
+                            layer.close(index);
+                            if (data == "success") {
+                                table.reload('LAY-list-manage');
+                            } else {
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        },
+        add: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '提现记录-添加',
+                content: 'Add',
+                maxmin: true,
+                area: ['500px', '450px'],
+                btn: ['确定', '取消'],
+                yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index],
+                        submitID = 'LAY-list-front-submit',
+                        submit = layero.find('iframe').contents().find('#' + submitID);
+
+                    setTimeout(function () {
+                        layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
+                            var errObj = $(this).find('.layui-form-danger');
+                            if (errObj.length > 0) {
+                                iframeWindow.element.tabChange('mytabbar', String(i + 1));
+                                submit.click();
+                            }
+                        });
+                    }, 300);
+
+
+
+
+
+
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/UserCashRecord/Add?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                layer.close(index); //关闭弹层
+                                if (data == "success") {
+                                    table.reload('LAY-list-manage'); //数据刷新
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                }
+            });
+            layer.full(perContent);
+        },
+        ImportData: function () {
+            var perContent = layer.open({
+                type: 2
+                , title: '提现结果导入'
+                , content: 'Import'
+                , maxmin: true
+                , area: ['650px', '350px']
+                , btn: ['确定', '取消']
+                , yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index]
+                        , submitID = 'LAY-list-front-submit'
+                        , submit = layero.find('iframe').contents().find('#' + submitID);
+
+                    
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+                        var loadindex = layer.load(1, {
+                            shade: [0.5, '#000']
+                        });
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/UserCashRecord/ImportPost?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                if (data.indexOf("success") == 0) {
+                                    var datalist = data.split('|');
+                                    var key = datalist[1];
+                                    CheckImport(table, key, loadindex, index);
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                }
+            });
+        },
+        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()) + '&';
+            });
+            $.ajax({
+                type: "GET",
+                url: "/Admin/UserCashRecord/LeaderExportExcel?r=" + Math.random(1),
+                data: userdata,
+                dataType: "json",
+                success: function (data) {
+                    data.Obj.unshift(data.Fields);
+                    excel.exportExcel(data.Obj, data.Info, 'xlsx');
+                }
+            });
+        },
+        Open: function () {
+            var checkStatus = table.checkStatus('LAY-list-manage'),
+                data = checkStatus.data; //得到选中的数据
+            if (data.length < 1) {
+                parent.layer.msg("请选择要开启的项");
+            } else {
+                var ids = "";
+                $.each(data, function (index, value) {
+                    ids += data[index].Id + ",";
+                });
+                ids = ids.substring(0, ids.length - 1);
+                var index = layer.confirm('确定要开启吗?', function (index) {
+                    $.ajax({
+                        type: "POST",
+                        url: "/Admin/UserCashRecord/Open?r=" + Math.random(1),
+                        data: "Id=" + ids,
+                        dataType: "text",
+                        success: function (data) {
+                            layer.close(index);
+                            if (data == "success") {
+                                table.reload('LAY-list-manage');
+                            } else {
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        },
+        Close: function () {
+            var checkStatus = table.checkStatus('LAY-list-manage'),
+                data = checkStatus.data; //得到选中的数据
+            if (data.length < 1) {
+                parent.layer.msg("请选择要关闭的项");
+            } else {
+                var ids = "";
+                $.each(data, function (index, value) {
+                    ids += data[index].Id + ",";
+                });
+                ids = ids.substring(0, ids.length - 1);
+                var index = layer.confirm('确定要关闭吗?', function (index) {
+                    $.ajax({
+                        type: "POST",
+                        url: "/Admin/UserCashRecord/Close?r=" + Math.random(1),
+                        data: "Id=" + ids,
+                        dataType: "text",
+                        success: function (data) {
+                            layer.close(index);
+                            if (data == "success") {
+                                table.reload('LAY-list-manage');
+                            } else {
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        },
+    };
+
+    $('.layui-btn').on('click', function () {
+        var type = $(this).data('type');
+        active[type] ? active[type].call(this) : '';
+    });
+});