Browse Source

Merge branch 'DuGuYang' into develop

lcl 3 years ago
parent
commit
c1573f3c3a

+ 320 - 0
Areas/Admin/Controllers/MainServer/ExportExcelsController.cs

@@ -0,0 +1,320 @@
+/*
+ * excel导出数据
+ */
+
+using System;
+using System.Web;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using MySystem.Models;
+using Library;
+using LitJson;
+using MySystemLib;
+
+namespace MySystem.Areas.Admin.Controllers
+{
+    [Area("Admin")]
+    [Route("Admin/[controller]/[action]")]
+    public class ExportExcelsController : BaseController
+    {
+        public ExportExcelsController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+        {
+            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+        }
+
+        #region excel导出数据列表
+
+        /// <summary>
+        /// 根据条件查询excel导出数据列表
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Index(ExportExcels data, string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询excel导出数据列表
+
+        /// <summary>
+        /// excel导出数据列表
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult IndexData(ExportExcels data, string CreateDateData, int page = 1, int limit = 30)
+        {
+
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            // Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("FileName", "1"); //文件名
+            Fields.Add("FileUrl", "1"); //文件路径
+
+            string condition = " and Status>-1 and SysId=" + SysId;
+            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("ExportExcels", 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)
+            {
+
+            }
+            return Json(obj);
+        }
+
+        #endregion
+
+        #region 增加excel导出数据
+
+        /// <summary>
+        /// 增加或修改excel导出数据信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Add(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            return View();
+        }
+
+        #endregion
+
+        #region 增加excel导出数据
+
+        /// <summary>
+        /// 增加或修改excel导出数据信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Add(ExportExcels data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("FileName", data.FileName); //文件名
+            Fields.Add("FileUrl", data.FileUrl); //文件路径
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ExportExcels", Fields, 0);
+            AddSysLog(data.Id.ToString(), "ExportExcels", "add");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 修改excel导出数据
+
+        /// <summary>
+        /// 增加或修改excel导出数据信息
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult Edit(string right, int Id = 0)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+
+            ExportExcels editData = db.ExportExcels.FirstOrDefault(m => m.Id == Id) ?? new ExportExcels();
+            ViewBag.data = editData;
+            return View();
+        }
+
+        #endregion
+
+        #region 修改excel导出数据
+
+        /// <summary>
+        /// 增加或修改excel导出数据信息
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        public string Edit(ExportExcels data)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+            Fields.Add("FileName", data.FileName); //文件名
+            Fields.Add("FileUrl", data.FileUrl); //文件路径
+
+            Fields.Add("SeoTitle", data.SeoTitle);
+            Fields.Add("SeoKeyword", data.SeoKeyword);
+            Fields.Add("SeoDescription", data.SeoDescription);
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ExportExcels", Fields, data.Id);
+            AddSysLog(data.Id.ToString(), "ExportExcels", "update");
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 删除excel导出数据信息
+
+        /// <summary>
+        /// 删除excel导出数据信息
+        /// </summary>
+        /// <returns></returns>
+        public string Delete(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "ExportExcels", "del");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", -1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ExportExcels", Fields, id);
+            }
+            db.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
+        #region 开启
+
+        /// <summary>
+        /// 开启
+        /// </summary>
+        /// <returns></returns>
+        public string Open(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "ExportExcels", "open");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ExportExcels", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 关闭
+
+        /// <summary>
+        /// 关闭
+        /// </summary>
+        /// <returns></returns>
+        public string Close(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "ExportExcels", "close");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("Status", 0);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ExportExcels", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 排序
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <param name="Id"></param>
+        public string Sort(int Id, int Sort)
+        {
+            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ExportExcels", Sort, Id);
+
+            AddSysLog(Id.ToString(), "ExportExcels", "sort");
+            return "success";
+        }
+        #endregion
+
+        #region 导入数据
+        /// <summary>
+        /// 导入数据
+        /// </summary>
+        /// <param name="ExcelData"></param>
+        public string Import(string ExcelData)
+        {
+            ExcelData = HttpUtility.UrlDecode(ExcelData);
+            JsonData list = JsonMapper.ToObject(ExcelData);
+            for (int i = 1; i < list.Count; i++)
+            {
+                JsonData dr = list[i];
+
+                db.ExportExcels.Add(new ExportExcels()
+                {
+                    CreateDate = DateTime.Now,
+                    UpdateDate = DateTime.Now,
+
+                });
+                db.SaveChanges();
+            }
+            AddSysLog("0", "ExportExcels", "Import");
+            return "success";
+        }
+        #endregion
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(ExportExcels data)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+            Fields.Add("CreateDate", "3"); //时间
+            Fields.Add("FileName", "1"); //文件名
+            Fields.Add("FileUrl", "1"); //文件路径
+
+
+            string condition = " and Status>-1";
+
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ExportExcels", Fields, "Id desc", "0", 1, 20000, condition, "", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+
+            }
+
+            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>();
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "ExportExcels", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
+    }
+}

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

@@ -172,5 +172,166 @@ 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 SourceMakerCode, string RemarkSelect, string CreateDateData, string SeoKeyword)
+        {
+
+            string SqlString = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                SqlString += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //购券创客
+            if (!string.IsNullOrEmpty(SourceMakerCode))
+            {
+                SqlString += " and SourceUserId in (select UserId from UserForMakerCode where MakerCode='" + SourceMakerCode + "')";
+            }
+            //变动类型
+            if (!string.IsNullOrEmpty(RemarkSelect))
+            {
+                SqlString += " and Remark='" + RemarkSelect + "'";
+            }
+            //创建时间
+            if (!string.IsNullOrEmpty(CreateDateData))
+            {
+                string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+                string start = datelist[0];
+                string end = datelist[1];
+                SqlString += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+            }
+            //订单编号
+            if (!string.IsNullOrEmpty(SeoKeyword))
+            {
+                SqlString += " and SeoKeyword=" + 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
+
+        #region 导出Excel
+
+        /// <summary>
+        /// 导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult ExportExcel(LeaderReserveRecord data, string UserIdMakerCode, string SourceMakerCode, string RemarkSelect, string CreateDateData, string SeoKeyword)
+        {
+            Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+            string condition = " and Status>-1";
+            //创客编号
+            if (!string.IsNullOrEmpty(UserIdMakerCode))
+            {
+                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + UserIdMakerCode + "')";
+            }
+            //购券创客
+            if (!string.IsNullOrEmpty(SourceMakerCode))
+            {
+                condition += " and SourceUserId in (select UserId from UserForMakerCode where MakerCode='" + SourceMakerCode + "')";
+            }
+            //变动类型
+            if (!string.IsNullOrEmpty(RemarkSelect))
+            {
+                condition += " and Remark='" + RemarkSelect + "'";
+            }
+            //创建时间
+            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(SeoKeyword))
+            {
+                condition += " and SeoKeyword='" + SeoKeyword + "'";
+            }
+
+            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("LeaderReserveRecord", Fields, "Id desc", "0", 1, 20000, condition, "Id", false);
+            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+            foreach (Dictionary<string, object> dic in diclist)
+            {
+
+                int Id = int.Parse(function.CheckInt(dic["Id"].ToString()));
+                var leaderReserveRecord = db.LeaderReserveRecord.FirstOrDefault(m => m.Id == Id) ?? new LeaderReserveRecord();
+                dic["BeforeAmount"] = leaderReserveRecord.BeforeAmt;
+                dic["AfterAmount"] = leaderReserveRecord.AfterAmt;
+
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == leaderReserveRecord.UserId) ?? new Users();
+                var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == leaderReserveRecord.UserId) ?? new UserAccount();
+                dic["MakerCode"] = userid_Users.MakerCode;
+                dic["RealName"] = userid_Users.RealName;
+                dic["LeaderBalanceAmount"] = userAccount.LeaderBalanceAmount;
+
+                dic["Remark"] = leaderReserveRecord.Remark;
+                dic["CreateDate"] = leaderReserveRecord.CreateDate;
+
+                // //盟主等级
+                // int LeaderLevel = userid_Users.LeaderLevel;
+                // if (LeaderLevel == 1) dic["LeaderLevel"] = "小盟主";
+                // if (LeaderLevel == 2) dic["LeaderLevel"] = "大盟主";
+                // if (LeaderLevel == 0) dic["LeaderLevel"] = "";
+
+                //订单信息
+                dic["dPosCoupons"] = "";
+                dic["bPosCoupons"] = "";
+                if (!string.IsNullOrEmpty(leaderReserveRecord.SeoTitle))
+                {
+                    JsonData ApplyList = JsonMapper.ToObject(leaderReserveRecord.SeoTitle);//申请数据
+                    for (int i = 0; i < ApplyList.Count; i++)
+                    {
+                        int num = Convert.ToInt32(ApplyList[i]["Num"].ToString());
+                        int type = Convert.ToInt32(ApplyList[i]["Type"].ToString());
+                        if (type == 1)
+                        {
+                            dic["dPosCoupons"] = num + "张";
+                        }
+                        else
+                        {
+                            dic["bPosCoupons"] = num + "张";
+                        }
+                    }
+                }
+                dic.Remove("Id");
+            }
+            // 导出表格包含创客姓名、创客编号、创建时间、变动类型、电签兑换券张数、大POS兑换券张数、可提现余额、使用前剩余额度、使用后剩余额度
+            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("MakerCode", "创客编号");
+            ReturnFields.Add("RealName", "创客姓名");
+            ReturnFields.Add("CreateDate", "创建时间");
+            ReturnFields.Add("Remark", "变动类型");
+            ReturnFields.Add("dPosCoupons", "电签兑换券张数");
+            ReturnFields.Add("bPosCoupons", "大POS兑换券张数");
+            ReturnFields.Add("LeaderBalanceAmount", "可提现余额");
+            ReturnFields.Add("BeforeAmount", "使用前剩余额度");
+            ReturnFields.Add("AfterAmount", "使用后剩余额度");
+
+            result.Add("Fields", ReturnFields);
+            AddSysLog("0", "LeaderReserveRecord", "ExportExcel");
+            return Json(result);
+        }
+
+        #endregion
+
     }
     }
 }
 }

+ 253 - 0
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -1394,6 +1394,61 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                 {
                     CustomerSqlConn.op("insert into PosMerchantInfo select * from PosMerchantInfoBak where KqMerNo='" + MerNo + "'", MysqlConn.connstr);
                     CustomerSqlConn.op("insert into PosMerchantInfo select * from PosMerchantInfoBak where KqMerNo='" + MerNo + "'", MysqlConn.connstr);
                 }
                 }
+
+                if (oldpos.OpId > 0)
+                {
+                    if (oldpos.ActivationState == 0)
+                    {
+                        var opUserAccount = opdb.UserAccount.FirstOrDefault(m => m.Sort > 0 && m.Id == oldpos.OpId && m.UserId == oldpos.OpId) ?? new OpModels.UserAccount();
+                        decimal TotalAmount = opUserAccount.ValidAmount + opUserAccount.TotalAmt + opUserAccount.ValidForGetAmount;//旧的总金额
+                        opUserAccount.ValidAmount += oldpos.OpReserve3;
+                        opUserAccount.ValidForGetAmount += oldpos.OpReserve2;
+                        opUserAccount.TotalAmt += oldpos.OpReserve1;
+
+                        var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
+                        {
+                            CreateDate = DateTime.Now,
+                            UserId = oldpos.OpId,
+                            SeoDescription = "机具换绑",
+                            OperateType = 1,
+                            UseAmount = oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                            BeforeAmount = TotalAmount,
+                            AfterAmount = TotalAmount + oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                        }).Entity;
+
+                        oldpos.OpReserve1 = 0;
+                        oldpos.OpReserve2 = 0;
+                        oldpos.OpReserve3 = 0;
+                    }
+                    else
+                    {
+                        if (newpos.OpId > 0)
+                        {
+                            var opUserAccount = opdb.UserAccount.FirstOrDefault(m => m.Sort > 0 && m.Id == newpos.OpId && m.UserId == newpos.OpId) ?? new OpModels.UserAccount();
+                            decimal TotalAmount = opUserAccount.ValidAmount + opUserAccount.TotalAmt + opUserAccount.ValidForGetAmount;//旧的总金额
+                            opUserAccount.ValidAmount += newpos.OpReserve3;
+                            opUserAccount.ValidForGetAmount += newpos.OpReserve2;
+                            opUserAccount.TotalAmt += newpos.OpReserve1;
+
+                            var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
+                            {
+                                CreateDate = DateTime.Now,
+                                UserId = newpos.OpId,
+                                SeoDescription = "机具换绑",
+                                OperateType = 1,
+                                UseAmount = newpos.OpReserve3 + newpos.OpReserve2 + newpos.OpReserve1,
+                                BeforeAmount = TotalAmount,
+                                AfterAmount = TotalAmount + newpos.OpReserve3 + newpos.OpReserve2 + newpos.OpReserve1,
+                            }).Entity;
+
+                            newpos.OpReserve1 = 0;
+                            newpos.OpReserve2 = 0;
+                            newpos.OpReserve3 = 0;
+                        }
+                    }
+                }
+                opdb.SaveChanges();
+
                 merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerNo) ?? new PosMerchantInfo();
                 merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerNo) ?? new PosMerchantInfo();
                 newpos.BindMerchantId = merchant.Id;
                 newpos.BindMerchantId = merchant.Id;
                 newpos.BuyUserId = oldpos.BuyUserId;
                 newpos.BuyUserId = oldpos.BuyUserId;
@@ -1478,6 +1533,11 @@ namespace MySystem.Areas.Admin.Controllers
 
 
                 }));
                 }));
             }
             }
+            if (BackStore.UserId != OutStore.UserId)
+            {
+                RedisDbconn.Instance.AddList("ResetStoreReserveQueue", BackStore.UserId);
+                RedisDbconn.Instance.AddList("ResetStoreReserveQueue", OutStore.UserId);
+            }
             return "success";
             return "success";
         }
         }
         #endregion
         #endregion
@@ -1589,6 +1649,36 @@ namespace MySystem.Areas.Admin.Controllers
                     storeFromUserAcount.ValidAmount += amount;
                     storeFromUserAcount.ValidAmount += amount;
                     storeBackUserAcount.ValidAmount -= amount;
                     storeBackUserAcount.ValidAmount -= amount;
 
 
+                    if (oldpos.OpId > 0)
+                    {
+                        if (newpos.OpId > 0)
+                        {
+                            var opUserAccount = opdb.UserAccount.FirstOrDefault(m => m.Sort > 0 && m.Id == oldpos.OpId && m.UserId == oldpos.OpId) ?? new OpModels.UserAccount();
+                            decimal TotalAmount = opUserAccount.ValidAmount + opUserAccount.TotalAmt + opUserAccount.ValidForGetAmount;//旧的总金额
+                            opUserAccount.ValidAmount += oldpos.OpReserve3;
+                            opUserAccount.ValidForGetAmount += oldpos.OpReserve2;
+                            opUserAccount.TotalAmt += oldpos.OpReserve1;
+
+                            var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
+                            {
+                                CreateDate = DateTime.Now,
+                                UserId = oldpos.OpId,
+                                SeoDescription = "坏机换新",
+                                OperateType = 1,
+                                UseAmount = oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                                BeforeAmount = TotalAmount,
+                                AfterAmount = TotalAmount + oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                            }).Entity;
+                        }
+                        if (newpos.OpId == 0)
+                        {
+                            newpos.OpReserve1 = oldpos.OpReserve1;
+                            newpos.OpReserve2 = oldpos.OpReserve3;
+                            newpos.OpReserve3 = oldpos.OpReserve1;
+                            newpos.OpId = oldpos.OpId;
+                        }
+                    }
+
                     newpos.BuyUserId = oldpos.BuyUserId;
                     newpos.BuyUserId = oldpos.BuyUserId;
                     newpos.UserId = oldpos.UserId;
                     newpos.UserId = oldpos.UserId;
                     newpos.RecycEndDate = oldpos.RecycEndDate;
                     newpos.RecycEndDate = oldpos.RecycEndDate;
@@ -1660,6 +1750,7 @@ namespace MySystem.Areas.Admin.Controllers
                     oldpos.Status = -1;
                     oldpos.Status = -1;
                     PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     db.SaveChanges();
                     db.SaveChanges();
+                    opdb.SaveChanges();
 
 
                     PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == newpos.BindMerchantId);
                     PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == newpos.BindMerchantId);
                     if (merchant != null)
                     if (merchant != null)
@@ -1809,6 +1900,35 @@ namespace MySystem.Areas.Admin.Controllers
                     {
                     {
                         opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
                         opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
                     }
                     }
+                    if (oldpos.OpId > 0)
+                    {
+                        if (newpos.OpId > 0)
+                        {
+                            var opUserAccount = opdb.UserAccount.FirstOrDefault(m => m.Sort > 0 && m.Id == oldpos.OpId && m.UserId == oldpos.OpId) ?? new OpModels.UserAccount();
+                            decimal TotalAmount = opUserAccount.ValidAmount + opUserAccount.TotalAmt + opUserAccount.ValidForGetAmount;//旧的总金额
+                            opUserAccount.ValidAmount += oldpos.OpReserve3;
+                            opUserAccount.ValidForGetAmount += oldpos.OpReserve2;
+                            opUserAccount.TotalAmt += oldpos.OpReserve1;
+
+                            var amoutRecord = opdb.AmountRecord.Add(new OpModels.AmountRecord
+                            {
+                                CreateDate = DateTime.Now,
+                                UserId = oldpos.OpId,
+                                SeoDescription = "坏机换新",
+                                OperateType = 1,
+                                UseAmount = oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                                BeforeAmount = TotalAmount,
+                                AfterAmount = TotalAmount + oldpos.OpReserve3 + oldpos.OpReserve2 + oldpos.OpReserve1,
+                            }).Entity;
+                        }
+                        if (newpos.OpId == 0)
+                        {
+                            newpos.OpReserve1 = oldpos.OpReserve1;
+                            newpos.OpReserve2 = oldpos.OpReserve3;
+                            newpos.OpReserve3 = oldpos.OpReserve1;
+                            newpos.OpId = oldpos.OpId;
+                        }
+                    }
 
 
                     oldpos.StoreId = storeBack.Id;
                     oldpos.StoreId = storeBack.Id;
                     oldpos.QueryCount = 0;
                     oldpos.QueryCount = 0;
@@ -1853,6 +1973,7 @@ namespace MySystem.Areas.Admin.Controllers
                     oldpos.Status = -1;
                     oldpos.Status = -1;
                     PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     db.SaveChanges();
                     db.SaveChanges();
+                    opdb.SaveChanges();
 
 
                     BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
                     BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
                     {
                     {
@@ -4548,5 +4669,137 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
         #endregion
 
 
 
 
+
+        #region 指定文件Excel导出
+
+        public IActionResult ExportExcel(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string ExportExcelDo(string FileName, string Operator, string Sql, int Number = 0)
+        {
+            if (string.IsNullOrEmpty(FileName))
+            {
+                return "请输入文件名";
+            }
+            if (string.IsNullOrEmpty(Operator))
+            {
+                return "请输入后台操作人";
+            }
+            if (string.IsNullOrEmpty(Sql))
+            {
+                return "请输入SQL语句";
+            }
+            var SqlString = "";
+            if (Number == 0)
+            {
+                SqlString = Sql;
+            }
+            if (Number > 0)
+            {
+                SqlString = Sql + " LIMIT " + Number;
+            }
+            string[] Operators = Operator.Replace("\r", "").Replace("\n", ",").Split(',');
+            foreach (var item in Operators)
+            {
+                var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == item && m.Status > -1);
+                string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + SqlString + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"" + Number + "\"}";
+                RedisDbconn.Instance.AddList("ExportQueue", SendData);
+            }
+
+            return "success";
+        }
+
+        #endregion
+
+
+        #region 服务费返现注册查询
+
+        public IActionResult SeeMerchantAuthInfo(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+        #endregion
+
+        #region 服务费返现注册查询
+        public JsonResult SeeMerchantAuthInfoDo(string RealName, string Mobile, string CertId, int page = 1, int limit = 30)
+        {
+            var query = db.UserFamilyMember.Where(m => m.Status > -1);
+            if (string.IsNullOrEmpty(RealName) && string.IsNullOrEmpty(Mobile) && string.IsNullOrEmpty(CertId))
+            {
+                Dictionary<string, object> objs = new Dictionary<string, object>();
+                return Json(objs);
+            }
+            else
+            {
+                if (!string.IsNullOrEmpty(RealName))
+                {
+                    query = query.Where(m => m.Name == RealName);
+                }
+                if (!string.IsNullOrEmpty(Mobile))
+                {
+                    query = query.Where(m => m.Mobile == Mobile);
+                }
+                if (!string.IsNullOrEmpty(CertId))
+                {
+                    query = query.Where(m => m.IdCardNo.ToUpper() == CertId.ToUpper());
+                }
+            }
+
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            foreach (var subdata in query.ToList())
+            {
+                Dictionary<string, object> data = new Dictionary<string, object>();
+                if (subdata.Id > 0)
+                {
+                    data["IsRegist"] = "已注册";
+                    if (subdata.Status == 1)
+                    {
+                        data["IsAuth"] = "已认证";
+                        data["Name"] = subdata.Name;
+                        data["Mobile"] = subdata.Mobile;
+                        data["IdcardNo"] = subdata.IdCardNo;
+                        var linkCount = db.PosMerchantInfo.Count(m => m.MerRealName == subdata.Name && m.MerchantMobile == subdata.Mobile && m.MerIdcardNo.ToUpper() == subdata.IdCardNo.ToUpper());
+                        data["Count"] = linkCount;
+                    }
+                    else
+                    {
+                        data["IsAuth"] = "未认证";
+                        data["Name"] = "";
+                        data["Mobile"] = subdata.Mobile;
+                        data["IdcardNo"] = "";
+                        data["Count"] = "";
+                    }
+                }
+                else
+                {
+                    data["IsRegist"] = "未注册";
+                    data["IsAuth"] = "未认证";
+                    data["Name"] = "";
+                    data["Mobile"] = "";
+                    data["IdcardNo"] = "";
+                    data["Count"] = "";
+                }
+                dataList.Add(data);
+            }
+            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
+
+
     }
     }
 }
 }

+ 215 - 0
Areas/Admin/Views/MainServer/ExportExcels/Add.cshtml

@@ -0,0 +1,215 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+    
+}
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>excel导出数据(增加)</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">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+</head>
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        
+        <div class="layui-card">
+          <div class="layui-card-body">
+            <div class="layui-tab" lay-filter="mytabbar">
+                <ul class="layui-tab-title">
+                    <li class="layui-this" lay-id="1">基本信息</li>
+                </ul>
+                <div class="layui-tab-content mt20">
+                    <div class="layui-tab-item layui-show">
+<div class="layui-form-item">
+<label class="layui-form-label">文件名</label>
+<div class="layui-input-inline">
+<input class="layui-input" type="text" id="FileName" name="FileName" maxlength="50" lay-verify="required|" autocomplete="off" placeholder="请输入文件名">
+</div>
+</div>
+<div class="layui-form-item">
+<label class="layui-form-label">文件路径</label>
+<div class="layui-input-inline">
+<input class="layui-input" type="text" id="FileUrl" name="FileUrl" maxlength="500" lay-verify="required|" autocomplete="off" placeholder="请输入文件路径">
+</div>
+</div>
+
+</div>
+
+                </div>
+            </div>
+            <div class="layui-form-item layui-hide">
+                <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
+            </div>
+          </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        
+                    
+        //编辑器
+        KindEditor.ready(function (K) {
+            
+        });
+
+        var ids = "";
+        function getChildren(obj) {
+            $.each(obj, function (index, value) {
+                var id = obj[index].id;
+                ids += id + ",";
+                var children = obj[index].children;
+                if (children) {
+                    getChildren(children);
+                }
+            });
+        }
+
+        function AreasProvinceInit(tagId, areasVal, form) {
+            for (var i = 0; i < provs_data.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(provs_data[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
+            }
+            form.render();
+        }
+
+        function AreasProvinceSelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "City").html('<option value="">市</option>');
+            var list = citys_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasCitySelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            var list = dists_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasAreaSelected(tagId, form) {
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+        function movePrev(obj, tagId) {
+            $(obj).parent().prev().insertAfter($(obj).parent());
+            checkPics(tagId);
+        }
+        function moveNext(obj, tagId) {
+            $(obj).parent().next().insertBefore($(obj).parent());
+            checkPics(tagId);
+        }
+        function deletePic(obj, tagId) {
+            $(obj).parent().remove();
+            checkPics(tagId);
+        }
+        function checkPics(tagId) {
+            var pics = "";
+            var texts = "";
+            $("#" + tagId + "Image div img").each(function (i) {
+                pics += $(this).attr("src").replace(osshost, '') + "|";
+            });
+            $("#" + tagId + "Image div input").each(function (i) {
+                texts += $(this).val() + "|";
+            });
+            if (pics == "") {
+                $("#" + tagId).val("");
+            } else {
+                pics = pics.substring(0, pics.length - 1);
+                texts = texts.substring(0, pics.length - 1);
+                $("#" + tagId).val(pics + "#cut#" + texts);
+            }
+        }
+        function checkBox(tagId) {
+            var text = "";
+            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
+                text += $(this).val() + ",";
+            });
+            $("#" + tagId).val(text);
+        }
+        function showBigPic(picpath) {
+            parent.layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 0,
+                shadeClose: true,
+                area: ['auto', 'auto'],
+                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
+            });
+        }
+
+        
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+        
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+    
+            //日期
+            
+
+            //上传文件
+            
+
+            //穿梭框
+            
+
+            //TreeView,比如权限管理
+            
+
+            //省市区
+            
+        })
+
+    </script>
+</body>
+</html>

+ 149 - 0
Areas/Admin/Views/MainServer/ExportExcels/Index.cshtml

@@ -0,0 +1,149 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+
+}
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>excel导出数据</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" readonly name="CreateDateData" id="CreateDate"
+                                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" name="FileName" 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" name="FileUrl" 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>
+                    </div>
+                </div>
+            </div>
+
+            <div class="layui-card-body">
+                <div style="padding-bottom: 10px;">
+                    @if (RightInfo.Contains("," + right + "_add,"))
+                    {
+                        <button class="layui-btn" data-type="add"><i
+                            class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>添加</button>
+                    }
+                    @if (RightInfo.Contains("," + right + "_delete,"))
+                    {
+                        <button class="layui-btn" data-type="batchdel"><i
+                            class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>
+                    }
+                    @if (RightInfo.Contains("," + right + "_edit,"))
+                    {
+
+                    }
+                </div>
+
+                <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
+                <script type="text/html" id="FileUrlTpl">
+                    <a href="{{d.FileUrl}}">{{d.FileUrl}}</a>
+                </script>
+                <script type="text/html" id="table-list-tools">
+                    @if (RightInfo.Contains("," + right + "_edit,"))
+                    {
+                        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
+                    }
+                    @if (RightInfo.Contains("," + right + "_delete,"))
+                    {
+                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
+                    }
+                    @if (RightInfo.Contains("," + right + "_edit,"))
+                    {
+
+                    }
+                </script>
+            </div>
+        </div>
+    </div>
+    <div id="excelForm" style="display:none; padding:20px;">
+        <div class="layui-tab-item layui-show">
+            <div class="layui-form-item">
+                <label class="layui-form-label">模板下载</label>
+                <div class="layui-form-mid layui-word-aux" id="excelTemp">
+                </div>
+            </div>
+            <div class="layui-form-item">
+                <label class="layui-form-label">excel文件</label>
+                <div class="layui-form-mid layui-word-aux">
+                    <div class="layui-upload">
+                        <input type="file" id="ExcelFile" name="ExcelFile" value="">
+                    </div>
+                    <div class="mt10" id="ExcelFileList">
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="layui-form-item ml10">
+            <div class="layui-input-block">
+                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+            </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/layuiadmin/modules_main/ExportExcels_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script>
+
+    </script>
+</body>
+
+</html>

+ 62 - 76
Areas/Admin/Views/MainServer/LeaderReserveRecord/Index.cshtml

@@ -70,99 +70,85 @@
                                 <option value="购机奖励">购机奖励</option>
                                 <option value="购机奖励">购机奖励</option>
                             </select>
                             </select>
                         </div>
                         </div>
-                    <div class="layui-inline">
-                        <label class="layui-form-label">订单编号</label>
-                        <div class="layui-input-inline">
-                            <input class="layui-input" type="text" name="SeoKeyword" autocomplete="off">
+                        <div class="layui-inline">
+                            <label class="layui-form-label">订单编号</label>
+                            <div class="layui-input-inline">
+                                <input class="layui-input" type="text" name="SeoKeyword" autocomplete="off">
+                            </div>
                         </div>
                         </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 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>
-                    </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>
+                        <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 + "_export,"))
+                            {
+                                <button class="layui-btn" data-type="ExportExcel"><i
+                                    class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
+                            }
+                        </div>
                     </div>
                     </div>
                 </div>
                 </div>
-            </div>
-
-            <div class="layui-card-body">
-                <div style="padding-bottom: 10px;">
-                    @if (RightInfo.Contains("," + right + "_add,"))
-                    {
-                        <button class="layui-btn" data-type="add"><i
-                            class="layui-icon layui-icon-add-1 layuiadmin-button-btn"></i>新增</button>
-                    }
-                    @if (RightInfo.Contains("," + right + "_delete,"))
-                    {
-                        <button class="layui-btn" data-type="batchdel"><i
-                            class="layui-icon layui-icon-delete layuiadmin-button-btn"></i>删除</button>
-                    }
-                    @if (RightInfo.Contains("," + right + "_edit,"))
-                    {
-                        <button class="layui-btn" data-type="ExportExcel"><i
-                            class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出</button>
-
-                    }
-                </div>
 
 
-                <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
-                <script type="text/html" id="table-list-tools">
-                    @* @if (RightInfo.Contains("," + right + "_edit,"))
-                    {
-                        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
-                    }
-                    @if (RightInfo.Contains("," + right + "_delete,"))
-                    {
-                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
-                    }
-                    @if (RightInfo.Contains("," + right + "_edit,"))
-                    {
+                <div class="layui-card-body">
+                    <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
+                    <script type="text/html" id="table-list-tools">
+                        @* @if (RightInfo.Contains("," + right + "_edit,"))
+                            {
+                            <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
+                            }
+                            @if (RightInfo.Contains("," + right + "_delete,"))
+                            {
+                            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
+                            }
+                            @if (RightInfo.Contains("," + right + "_edit,"))
+                            {
 
 
-                    } *@
+                            } *@
                 </script>
                 </script>
-            </div>
-        </div>
-    </div>
-    <div id="excelForm" style="display:none; padding:20px;">
-        <div class="layui-tab-item layui-show">
-            <div class="layui-form-item">
-                <label class="layui-form-label">模板下载</label>
-                <div class="layui-form-mid layui-word-aux" id="excelTemp">
                 </div>
                 </div>
             </div>
             </div>
-            <div class="layui-form-item">
-                <label class="layui-form-label">excel文件</label>
-                <div class="layui-form-mid layui-word-aux">
-                    <div class="layui-upload">
-                        <input type="file" id="ExcelFile" name="ExcelFile" value="">
+        </div>
+        <div id="excelForm" style="display:none; padding:20px;">
+            <div class="layui-tab-item layui-show">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">模板下载</label>
+                    <div class="layui-form-mid layui-word-aux" id="excelTemp">
                     </div>
                     </div>
-                    <div class="mt10" id="ExcelFileList">
+                </div>
+                <div class="layui-form-item">
+                    <label class="layui-form-label">excel文件</label>
+                    <div class="layui-form-mid layui-word-aux">
+                        <div class="layui-upload">
+                            <input type="file" id="ExcelFile" name="ExcelFile" value="">
+                        </div>
+                        <div class="mt10" id="ExcelFileList">
+                        </div>
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-        </div>
-        <div class="layui-form-item ml10">
-            <div class="layui-input-block">
-                <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+            <div class="layui-form-item ml10">
+                <div class="layui-input-block">
+                    <button type="button" class="layui-btn" onclick="ConfirmImport()">立即导入</button>
+                </div>
             </div>
             </div>
         </div>
         </div>
-    </div>
-
-    <script src="/layuiadmin/layui/layui.js"></script>
-    <script src="/layuiadmin/modules_main/LeaderReserveRecord_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
-    <script>
 
 
-    </script>
+        <script src="/layuiadmin/layui/layui.js"></script>
+        <script
+            src="/layuiadmin/modules_main/LeaderReserveRecord_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+        <script>
+        </script>
 </body>
 </body>
 
 
 </html>
 </html>

+ 290 - 0
Areas/Admin/Views/MainServer/SysTools/ExportExcel.cshtml

@@ -0,0 +1,290 @@
+@{
+    string RightInfo = ViewBag.RightInfo as string;
+    string right = ViewBag.right as string;
+
+}
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>指定文件Excel导出</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">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+</head>
+
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        <form class="layui-form" id="confirmFrm">
+            <div class="layui-card">
+                <div class="layui-card-body">
+                    <div class="layui-tab" lay-filter="mytabbar">
+                        <ul class="layui-tab-title">
+                            <li class="layui-this" lay-id="1">基本信息</li>
+                        </ul>
+                        <div class="layui-tab-content mt20">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">文件名</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="FileName" name="FileName"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入文件名">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">后台操作人</label>
+                                    <div class="layui-input-block">
+                                        <textarea class="layui-textarea" lay-verify="required|" name="Operator" id="Operator"
+                                            placeholder="请输入后台操作人,多个用回车隔开"></textarea>
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">SQL语句</label>
+                                    <div class="layui-input-block">
+                                        <textarea class="layui-textarea" lay-verify="required|" name="Sql" id="Sql"
+                                            placeholder="请输入SQL语句"></textarea>
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">返回数量</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="number" id="Number" name="Number" value="0"
+                                            maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入返回数量">
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="layui-form-item ml10">
+                        <div class="layui-input-block">
+                            <button type="button" class="layui-btn" onclick="save()">提交</button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script
+        src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        function save() {
+            var FileName = $('#FileName').val();
+            var Operator = $('#Operator').val();
+            var Sql = $('#Sql').val();
+            var Number = $('#Number').val();
+            if (FileName == '') {
+                layer.msg('请输入文件名');
+            }
+            else if (Operator == '') {
+                layer.msg('请输入后台操作人');
+            }
+            else if (Sql == '') {
+                layer.msg('请输入SQL语句');
+            }
+            else if (Number == '') {
+                layer.msg('请输入返回数量');
+            }
+            else {
+                var index = layer.confirm('确定发送吗?', function (index) {
+                    var indexs = layer.load(1, {
+                        shade: [0.5, '#000']
+                    });
+                    var userdata = $("#confirmFrm").serialize();
+                    $.ajax({
+                        type: "POST",
+                        url: "/Admin/SysTools/ExportExcelDo?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 if (data.indexOf("Warning") == 0) {
+                                var datalist = data.split('|');
+                                layer.close(indexs); //关闭弹层
+                                layer.alert(datalist[1], { time: 20000 }, function () {
+                                    window.location.reload();
+                                });
+                            } else {
+                                layer.close(indexs); //关闭弹层
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        }
+
+
+        //编辑器
+        KindEditor.ready(function (K) {
+
+        });
+
+        var ids = "";
+        function getChildren(obj) {
+            $.each(obj, function (index, value) {
+                var id = obj[index].id;
+                ids += id + ",";
+                var children = obj[index].children;
+                if (children) {
+                    getChildren(children);
+                }
+            });
+        }
+
+        function AreasProvinceInit(tagId, areasVal, form) {
+            for (var i = 0; i < provs_data.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(provs_data[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
+            }
+            form.render();
+        }
+
+        function AreasProvinceSelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "City").html('<option value="">市</option>');
+            var list = citys_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasCitySelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            var list = dists_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasAreaSelected(tagId, form) {
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+        function movePrev(obj, tagId) {
+            $(obj).parent().prev().insertAfter($(obj).parent());
+            checkPics(tagId);
+        }
+        function moveNext(obj, tagId) {
+            $(obj).parent().next().insertBefore($(obj).parent());
+            checkPics(tagId);
+        }
+        function deletePic(obj, tagId) {
+            $(obj).parent().remove();
+            checkPics(tagId);
+        }
+        function checkPics(tagId) {
+            var pics = "";
+            var texts = "";
+            $("#" + tagId + "Image div img").each(function (i) {
+                pics += $(this).attr("src").replace(osshost, '') + "|";
+            });
+            $("#" + tagId + "Image div input").each(function (i) {
+                texts += $(this).val() + "|";
+            });
+            if (pics == "") {
+                $("#" + tagId).val("");
+            } else {
+                pics = pics.substring(0, pics.length - 1);
+                texts = texts.substring(0, pics.length - 1);
+                $("#" + tagId).val(pics + "#cut#" + texts);
+            }
+        }
+        function checkBox(tagId) {
+            var text = "";
+            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
+                text += $(this).val() + ",";
+            });
+            $("#" + tagId).val(text);
+        }
+        function showBigPic(picpath) {
+            parent.layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 0,
+                shadeClose: true,
+                area: ['auto', 'auto'],
+                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
+            });
+        }
+
+
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+
+            //日期
+
+
+            //上传文件
+
+
+            //穿梭框
+
+
+            //TreeView,比如权限管理
+
+
+            //省市区
+
+        })
+
+    </script>
+</body>
+
+</html>

+ 86 - 0
Areas/Admin/Views/MainServer/SysTools/SeeMerchantAuthInfo.cshtml

@@ -0,0 +1,86 @@
+@{
+    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">
+                            </div>
+                        </div>
+                        <div class="layui-inline">
+                            <label class="layui-form-label">商户手机号</label>
+                            <div class="layui-input-inline">
+                                <input class="layui-input" type="text" name="Mobile" id="Mobile" 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="CertId" id="CertId" 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>
+                        </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/SeeMerchantAuthInfo.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script>
+    </script>
+</body>
+
+</html>

+ 251 - 0
Areas/Admin/Views/MainServer/SysTools/SeeMerchantAuthInfos.cshtml

@@ -0,0 +1,251 @@
+@{
+    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">
+    <script src="/admin/js/jquery-1.10.1.min.js"></script>
+    <script src="/admin/js/LAreaData2.js"></script>
+</head>
+
+<body>
+
+    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
+        <form class="layui-form" id="confirmFrm">
+            <div class="layui-card">
+                <div class="layui-card-body">
+                    <div class="layui-tab" lay-filter="mytabbar">
+                        <ul class="layui-tab-title">
+                            <li class="layui-this" lay-id="1">基本信息</li>
+                        </ul>
+                        <div class="layui-tab-content mt20">
+                            <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户姓名</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="RealName" name="RealName"
+                                            maxlength="50" lay-verify="" autocomplete="off" placeholder="请输入商户姓名">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户手机号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="Mobile" name="Mobile" maxlength="50"
+                                            lay-verify="" autocomplete="off" placeholder="请输入商户手机号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">商户身份证号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="CertId" name="CertId" maxlength="50"
+                                            lay-verify="" autocomplete="off" placeholder="请输入商户身份证号">
+                                    </div>
+                                </div>
+                            </div>
+
+                        </div>
+                    </div>
+                    <div class="layui-form-item ml10">
+                        <div class="layui-input-block">
+                            <button type="button" class="layui-btn" onclick="save()">查询</button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </form>
+        <div class="layui-card-body">
+            <table id="LAY-list-manage" lay-filter="LAY-list-manage"></table>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/layuiadmin/modules_main/Loop_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script
+        src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+    <script src="/other/mybjq/kindeditor-min.js"></script>
+    <script src="/other/mybjq/lang/zh_CN.js"></script>
+    <script>
+        function save() {
+            var index = layer.load(1, {
+                shade: [0.5, '#000']
+            });
+            var userdata = $("#confirmFrm").serialize();
+            $.ajax({
+                type: "POST",
+                url: "/Admin/SysTools/SeeMerchantAuthInfoDo?r=" + Math.random(1),
+                data: userdata,
+                dataType: "text",
+                success: function (data) {
+                    layer.close(index);
+                    layer.alert(data.replace(/\n/g, '<br />'), { area: ['300px', '450px'] });
+                }
+            });
+        }
+
+
+        //编辑器
+        KindEditor.ready(function (K) {
+
+        });
+
+        var ids = "";
+        function getChildren(obj) {
+            $.each(obj, function (index, value) {
+                var id = obj[index].id;
+                ids += id + ",";
+                var children = obj[index].children;
+                if (children) {
+                    getChildren(children);
+                }
+            });
+        }
+
+        function AreasProvinceInit(tagId, areasVal, form) {
+            for (var i = 0; i < provs_data.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(provs_data[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
+            }
+            form.render();
+        }
+
+        function AreasProvinceSelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "City").html('<option value="">市</option>');
+            var list = citys_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasCitySelected(tagId, areasVal, form, value) {
+            $("#" + tagId + "Area").html('<option value="">县/区</option>');
+            var list = dists_data[value];
+            for (var i = 0; i < list.length; i++) {
+                var sel = "";
+                if (areasVal.indexOf(list[i].text) > -1) {
+                    sel = " selected=selected";
+                }
+                $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
+            }
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+
+        function AreasAreaSelected(tagId, form) {
+            form.render();
+            $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
+        }
+        function movePrev(obj, tagId) {
+            $(obj).parent().prev().insertAfter($(obj).parent());
+            checkPics(tagId);
+        }
+        function moveNext(obj, tagId) {
+            $(obj).parent().next().insertBefore($(obj).parent());
+            checkPics(tagId);
+        }
+        function deletePic(obj, tagId) {
+            $(obj).parent().remove();
+            checkPics(tagId);
+        }
+        function checkPics(tagId) {
+            var pics = "";
+            var texts = "";
+            $("#" + tagId + "Image div img").each(function (i) {
+                pics += $(this).attr("src").replace(osshost, '') + "|";
+            });
+            $("#" + tagId + "Image div input").each(function (i) {
+                texts += $(this).val() + "|";
+            });
+            if (pics == "") {
+                $("#" + tagId).val("");
+            } else {
+                pics = pics.substring(0, pics.length - 1);
+                texts = texts.substring(0, pics.length - 1);
+                $("#" + tagId).val(pics + "#cut#" + texts);
+            }
+        }
+        function checkBox(tagId) {
+            var text = "";
+            $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
+                text += $(this).val() + ",";
+            });
+            $("#" + tagId).val(text);
+        }
+        function showBigPic(picpath) {
+            parent.layer.open({
+                type: 1,
+                title: false,
+                closeBtn: 0,
+                shadeClose: true,
+                area: ['auto', 'auto'],
+                content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
+            });
+        }
+
+
+        var tree;
+        var element;
+        var upload;
+        layui.config({
+            base: '/layuiadmin/' //静态资源所在路径
+        }).extend({
+            index: 'lib/index' //主入口模块
+        }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
+            var $ = layui.$
+                , form = layui.form
+                , layer = layui.layer
+                , layedit = layui.layedit
+                , laydate = layui.laydate
+                , croppers = layui.croppers
+                , transfer = layui.transfer
+                , util = layui.util;
+            tree = layui.tree;
+            element = layui.element;
+            upload = layui.upload;
+
+            //Hash地址的定位
+            var layid = location.hash.replace(/^#test=/, '');
+            element.tabChange('test', layid);
+            element.on('tab(test)', function (elem) {
+                location.hash = 'test=' + $(this).attr('lay-id');
+            });
+
+            //日期
+
+
+            //上传文件
+
+
+            //穿梭框
+
+
+            //TreeView,比如权限管理
+
+
+            //省市区
+
+        })
+
+    </script>
+</body>
+
+</html>

+ 405 - 0
wwwroot/layuiadmin/modules_main/ExportExcels_Admin.js

@@ -0,0 +1,405 @@
+var ExcelData, ExcelKind;
+function ConfirmImport() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/ExportExcels/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);
+            }
+        }
+    });
+}
+
+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: 'datetime',
+        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/ExportExcels/Sort?r=" + Math.random(1),
+                data: "Id=" + data.Id + "&Sort=" + value,
+                dataType: "text",
+                success: function (data) {
+                }
+            });
+        }
+    });
+
+    //列表数据
+    table.render({
+        elem: '#LAY-list-manage'
+        , url: '/Admin/ExportExcels/IndexData' //模拟接口
+        , cols: [[
+            { type: 'checkbox', fixed: 'left' }
+            , { field: 'Id', fixed: 'left', title: 'ID', width: 80, sort: true, unresize: true }
+            , { field: 'CreateDate', width: 200, title: '创建时间', sort: true }
+            , { field: 'FileName', width: 200, title: '文件名', sort: true }
+            , { field: 'FileUrl', width: 500, title: '文件路径', sort: true, templet: '#FileUrlTpl' }
+            // , { title: '操作', align: 'center', fixed: 'right', toolbar: '#table-list-tools' }
+        ]]
+        , where: {
+
+        }
+        , page: true
+        , limit: 30
+        , height: 'full-220'
+        , text: '对不起,加载出现异常!'
+        , done: function (res, curr, count) {
+            $(".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/ExportExcels/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 === 'edit') {
+            var tr = $(obj.tr);
+            var perContent = layer.open({
+                type: 2
+                , title: 'excel导出数据-编辑'
+                , 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/ExportExcels/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);
+        }
+    });
+
+
+    //监听搜索
+    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/ExportExcels/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: 'excel导出数据-添加'
+                , 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/ExportExcels/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 () {
+            ExcelKind = 1;
+            layer.open({
+                type: 1,
+                title: '导入',
+                maxmin: false,
+                area: ['460px', '280px'],
+                content: $('#excelForm'),
+                cancel: function () {
+                }
+            });
+            $("#excelTemp").html('<a href="/excelfile/模板文件.xlsx">点击下载模板文件</a>');
+        }
+        , 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/ExportExcels/ExportExcel?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/ExportExcels/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/ExportExcels/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) : '';
+    });
+});

+ 28 - 9
wwwroot/layuiadmin/modules_main/LeaderReserveRecord_Admin.js

@@ -339,15 +339,34 @@ 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/LeaderReserveRecord/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: "GET",
+                    // url: "/Admin/LeaderReserveRecord/ExportExcel?r=" + Math.random(1),
+                    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);
+                        }
+                        // data.Obj.unshift(data.Fields);
+                        // excel.exportExcel(data.Obj, data.Info, 'xlsx');
+                    }
+                });
             });
             });
         }
         }
         , Open: function () {
         , Open: function () {

+ 730 - 0
wwwroot/layuiadmin/modules_main/SeeMerchantAuthInfo.js

@@ -0,0 +1,730 @@
+var ExcelData, ExcelKind;
+
+function ConfirmImport() {
+    var index = layer.load(1, {
+        shade: [0.5, '#000']
+    });
+    $.ajax({
+        type: "POST",
+        url: "/Admin/StoreHouse/Import?r=" + Math.random(1),
+        data: "Kind=" + ExcelKind + "&ExcelData=" + encodeURIComponent(JSON.stringify(ExcelData)),
+        dataType: "text",
+        success: function (data) {
+            layer.close(index);
+            if (data.indexOf("success") == 0) {
+                layer.msg("成功操作" + data.split('|')[1] + "部机具", {
+                    time: 2000
+                }, function () {
+                    window.location.reload();
+                });
+            } else {
+                layer.msg(data);
+            }
+        }
+    });
+}
+
+function CheckImport(table, key, loadindex, index) {
+    $.ajax({
+        url: "/Admin/StoreHouse/CheckImportV2?r=" + Math.random(1),
+        data: "key=" + key,
+        dataType: "json",
+        success: function (data) {
+            if (data.status == 1) {
+                layer.msg("成功操作" + data.data + "部机具", {
+                    time: 2000
+                }, function () {
+                    layer.close(index); //关闭弹层
+                    layer.close(loadindex);
+                    table.reload('LAY-list-manage'); //数据刷新
+                });
+            } else if (data.status == 2) {
+                layer.close(index); //关闭弹层
+                layer.close(loadindex);
+                var content = '';
+                for (var i = 0; i < data.errList.length; i++) {
+                    content += data.errList[i] + '<br/>'
+                }
+                layer.alert(content);
+            } else {
+                layer.msg(data.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/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/SeeMerchantAuthInfoDo' //模拟接口
+        , cols: [[
+            { type: 'checkbox', fixed: 'left' }
+            , { field: 'Name', width: 200, title: '商户姓名', sort: true }
+            , { field: 'Mobile', width: 200, title: '商户手机号', sort: true }
+            , { field: 'IdcardNo', width: 200, title: '商户身份证号', sort: true }
+            // , { field: 'IsRegist', width: 200, title: '是否已注册', sort: true }
+            , { field: 'IsAuth', width: 200, title: '是否已认证', sort: true }
+            , { field: 'Count', 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;
+        if (obj.event === 'del') {
+            var index = layer.confirm('确定要删除吗?删除后不能恢复!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreHouse/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 === 'sycn') {
+            var index = layer.confirm('确定要同步该仓库的库存数据吗?', function (index) {
+                layer.close(index);
+                var loadindex = layer.load(1, {
+                    shade: [0.5, '#000']
+                });
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreHouse/SycnData?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(loadindex);
+                        if (data == "success") {
+                            layer.msg('同步成功');
+                            table.reload('LAY-list-manage');
+                        } else {
+                            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: ['800px', '650px'],
+                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/StoreHouse/Edit?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                if (data == "success") {
+                                    layer.close(index); //关闭弹层
+                                    table.reload('LAY-list-manage'); //数据刷新
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                },
+                success: function (layero, index) {
+
+                }
+            });
+        } else if (obj.event === 'edits') {
+            var tr = $(obj.tr);
+            var perContent = layer.open({
+                type: 2,
+                title: '一键新建仓库',
+                content: 'Edits?Id=' + data.Id + '',
+                maxmin: true,
+                area: ['860px', '650px'],
+                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/StoreHouse/Edits?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                if (data == "success") {
+                                    layer.close(index); //关闭弹层
+                                    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/StoreHouse/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: ['950px', '650px'],
+                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/StoreHouse/Add?r=" + Math.random(1),
+                            data: userdata,
+                            dataType: "text",
+                            success: function (data) {
+                                if (data == "success") {
+                                    layer.close(index); //关闭弹层
+                                    table.reload('LAY-list-manage'); //数据刷新
+                                } else {
+                                    layer.msg(data);
+                                }
+                            }
+                        });
+                    });
+
+                    submit.trigger('click');
+                }
+            });
+        },
+        ImportMachine: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '机具入库',
+                content: 'Import?ExcelKind=1',
+                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/StoreHouse/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');
+                }
+            });
+        },
+        ImportChange: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '仓库调拨',
+                content: 'Import?ExcelKind=2',
+                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/StoreHouse/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');
+                }
+            });
+        },
+        ImportSend: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '仓库发货至创客',
+                content: 'Import?ExcelKind=3',
+                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/StoreHouse/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');
+                }
+            });
+        },
+        ImportBack: function () {
+            var perContent = layer.open({
+                type: 2,
+                title: '机具回仓库',
+                content: 'Import?ExcelKind=4',
+                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/StoreHouse/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/StoreHouse/ExportExcel?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/StoreHouse/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/StoreHouse/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);
+                            }
+                        }
+                    });
+                });
+            }
+        },
+        SycnData: function () {
+            var index = layer.confirm('确定要同步所有仓库的库存数据吗?', function (index) {
+                layer.close(index);
+                var loadindex = layer.load(1, {
+                    shade: [0.5, '#000']
+                });
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/StoreHouse/SycnData?r=" + Math.random(1),
+                    data: "Id=0",
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(loadindex);
+                        if (data == "success") {
+                            layer.msg('同步成功');
+                            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) : '';
+    });
+});