Просмотр исходного кода

Merge branch 'DuGuYang' into develop

lcl 3 лет назад
Родитель
Сommit
ba4ded85ab

+ 6 - 2
Areas/Admin/Controllers/MainServer/PosMachinesTwoController.cs

@@ -168,6 +168,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["StoreIdName"] = storeid_StoreHouse.StoreName;
                 dic.Remove("StoreId");
                 //产品类型
+                var BId = int.Parse(dic["BrandId"].ToString());
                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
                 //参加活动
                 dic["ActivityList"] = RelationClass.GetProfitObjectsActivesList(dic["ActivityList"].ToString());
@@ -202,7 +203,8 @@ namespace MySystem.Areas.Admin.Controllers
 
                 //实际押金
                 string SeoKeyword = dic["SeoKeyword"].ToString();
-                if (SeoKeyword.Length > 3)
+                var brand = db.KqProducts.FirstOrDefault(m => m.Id == BId) ?? new KqProducts();
+                if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                 {
                     SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                 }
@@ -846,6 +848,7 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["StoreIdName"] = storeid_StoreHouse.StoreName;
                 dic.Remove("StoreId");
                 //产品类型
+                var BId = int.Parse(dic["BrandId"].ToString());
                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
                 decimal ScanQrTrade = decimal.Parse(dic["ScanQrTrade"].ToString());
                 var brandInfo = dic["BrandId"].ToString();
@@ -904,7 +907,8 @@ namespace MySystem.Areas.Admin.Controllers
 
                 //实际押金
                 string SeoKeyword = dic["SeoKeyword"].ToString();
-                if (SeoKeyword.Length > 2)
+                var brand = db.KqProducts.FirstOrDefault(m => m.Id == BId) ?? new KqProducts();
+                if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                 {
                     SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                 }

+ 128 - 26
Areas/Admin/Controllers/MainServer/PosMerchantInfoListController.cs

@@ -16,6 +16,7 @@ using Microsoft.Extensions.Options;
 using MySystem.Models;
 using Library;
 using LitJson;
+using System.Text.RegularExpressions;
 using MySystemLib;
 
 namespace MySystem.Areas.Admin.Controllers
@@ -262,17 +263,11 @@ namespace MySystem.Areas.Admin.Controllers
                 var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == KqSnNo) ?? new PosMachinesTwo();
 
                 //实际押金
-                string SeoKeyword = "0";
-                if (!string.IsNullOrEmpty(pos.SeoKeyword))
+                string SeoKeyword = pos.SeoKeyword;
+                var brand = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
+                if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                 {
-                    if (pos.BrandId != 2 && pos.BrandId != 7 && pos.BrandId != 10 && pos.BrandId != 11 && pos.BrandId != 12)
-                    {
-                        SeoKeyword = (decimal.Parse(pos.SeoKeyword) / 100).ToString();
-                    }
-                    else
-                    {
-                        SeoKeyword = pos.SeoKeyword;
-                    }
+                    SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                 }
                 dic["SeoKeyword"] = SeoKeyword;
 
@@ -299,11 +294,12 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                     string KqSnNo = item["KqSnNo"].ToString();
                     var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == KqSnNo) ?? new PosMachinesTwo();
+                    var brand = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
                     if (!string.IsNullOrEmpty(pos.SeoKeyword))
                     {
-                        if (pos.BrandId != 2 && pos.BrandId != 7 && pos.BrandId != 10 && pos.BrandId != 11 && pos.BrandId != 12)
+                        if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(pos.SeoKeyword))
                         {
-                            ReturnAmount += decimal.Parse(pos.SeoKeyword) / 100;
+                            ReturnAmount += (decimal.Parse(pos.SeoKeyword) / 100);
                         }
                         else
                         {
@@ -376,17 +372,10 @@ namespace MySystem.Areas.Admin.Controllers
                 dic.Remove("UserId");
 
                 //实际押金
-                string SeoKeyword = "0";
-                if (!string.IsNullOrEmpty(pos.SeoKeyword))
+                string SeoKeyword = pos.SeoKeyword;
+                if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                 {
-                    if (pos.BrandId != 2 && pos.BrandId != 7 && pos.BrandId != 10 && pos.BrandId != 11 && pos.BrandId != 12)
-                    {
-                        SeoKeyword = (decimal.Parse(pos.SeoKeyword) / 100).ToString();
-                    }
-                    else
-                    {
-                        SeoKeyword = pos.SeoKeyword;
-                    }
+                    SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                 }
                 dic["SeoKeyword"] = SeoKeyword;
             }
@@ -557,10 +546,11 @@ namespace MySystem.Areas.Admin.Controllers
                 foreach (DataRow item in dt.Rows)
                 {
                     var BindMerchantId = item["BindMerchantId"].ToString();
-                    var BrandId = item["BrandId"].ToString();
+                    var BrandId = int.Parse(item["BrandId"].ToString());
                     var PosSn = item["PosSn"].ToString();
                     var SeoKeyword = item["SeoKeyword"].ToString();
-                    if (BrandId != "2" && BrandId != "7" && BrandId != "10" && BrandId != "11" && BrandId != "12")
+                    var brand = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                    if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                     {
                         SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                     }
@@ -647,10 +637,11 @@ namespace MySystem.Areas.Admin.Controllers
                 foreach (DataRow item in dt.Rows)
                 {
                     var BindMerchantId = item["BindMerchantId"].ToString();
-                    var BrandId = item["BrandId"].ToString();
+                    var BrandId = int.Parse(item["BrandId"].ToString());
                     var PosSn = item["PosSn"].ToString();
                     var SeoKeyword = item["SeoKeyword"].ToString();
-                    if (BrandId != "2" && BrandId != "7" && BrandId != "10" && BrandId != "11" && BrandId != "12")
+                    var brand = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
+                    if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(SeoKeyword))
                     {
                         SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
                     }
@@ -1078,6 +1069,117 @@ namespace MySystem.Areas.Admin.Controllers
 
 
 
+        #region 首台机具查询
+
+        /// <summary>
+        /// 根据条件查询首台机具查询
+        /// </summary>
+        /// <returns></returns>
+        public IActionResult FirstPosIndex(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+            return View();
+        }
+
+        #endregion
+
+        #region 根据条件查询首台机具查询
+
+        /// <summary>
+        /// 首台机具查询
+        /// </summary>
+        /// <returns></returns>
+        public JsonResult FirstPosIndexData(string PosSn, int page = 1, int limit = 30)
+        {
+            // string condition = " and Id=0";
+            // 机具sn、商户姓名、商户手机号、商户身份证号、绑定时间、激活时间、是否为首台机具、是否已变更、变更时间
+            string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+            List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
+            if (!string.IsNullOrEmpty(PosSn))
+            {
+                var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Status > -1 && m.PosSn == PosSn) ?? new PosMachinesTwo();
+                if (pos.BindMerchantId > 0)
+                {
+                    var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
+                    if (mer.Id > 0)
+                    {
+                        string MerchantName = Regex.Replace(mer.MerchantName, @"\d|\W|[A-Za-z]", "");
+                        var posMerchants = db.PosMerchantInfo.Where(m => m.MerIdcardNo.ToUpper().StartsWith(mer.MerIdcardNo.ToUpper().Substring(0, 6)) && m.MerIdcardNo.ToUpper().EndsWith(mer.MerIdcardNo.ToUpper().Substring(mer.MerIdcardNo.Length - 4, 4)) && m.MerchantName.Contains(MerchantName)).ToList();
+                        foreach (var item in posMerchants)
+                        {
+                            Dictionary<string, object> curData = new Dictionary<string, object>();
+                            var posInfo = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == item.KqSnNo) ?? new PosMachinesTwo();
+                            int IsFirst = int.Parse(posInfo.IsFirst.ToString());
+                            var IsFirstName = "";
+                            if (IsFirst == 1) IsFirstName = "首台";
+                            if (IsFirst == 0) IsFirstName = "非首台";
+                            curData.Add("PosSn", posInfo.PosSn); //机具Sn
+                            curData.Add("MerchantName", item.MerchantName); //商户名称
+                            curData.Add("MerchantMobile", item.MerchantMobile); //商户手机号
+                            curData.Add("MerIdcardNo", item.MerIdcardNo); //商户身份证号
+                            curData.Add("IsFirstName", IsFirstName); //是否首台
+                            curData.Add("IsFirst", IsFirst);
+                            curData.Add("BindingTime", string.IsNullOrEmpty(posInfo.BindingTime.ToString()) ? "" : Convert.ToDateTime(posInfo.BindingTime).ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
+                            curData.Add("ActivationTime", string.IsNullOrEmpty(posInfo.ActivationTime.ToString()) ? "" : Convert.ToDateTime(posInfo.ActivationTime).ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
+                            dataList.Add(curData);
+                        }
+                    }
+                }
+            }
+            Dictionary<string, object> obj = new Dictionary<string, object>();
+            obj.Add("code", 0);
+            obj.Add("msg", "");
+            obj.Add("count", dataList.Count);
+            obj.Add("data", dataList);
+            return Json(obj);
+        }
+
+        #endregion
+
+
+
+        #region 设置为首台机具
+
+        /// <summary>
+        /// 设置为首台机具
+        /// </summary>
+        /// <returns></returns>
+        public string SetFirstPos(string PosSn)
+        {
+            Dictionary<string, object> Fields = new Dictionary<string, object>();
+            var mer = db.PosMerchantInfo.FirstOrDefault(m => m.KqSnNo == PosSn) ?? new PosMerchantInfo();
+            string MerchantName = Regex.Replace(mer.MerchantName, @"\d|\W|[A-Za-z]", "");
+            var posMerchants = db.PosMerchantInfo.Where(m => m.MerIdcardNo.ToUpper().StartsWith(mer.MerIdcardNo.ToUpper().Substring(0, 6)) && m.MerIdcardNo.ToUpper().EndsWith(mer.MerIdcardNo.ToUpper().Substring(mer.MerIdcardNo.Length - 4, 4)) && m.MerchantName.Contains(MerchantName) && m.KqSnNo != PosSn).ToList();
+            var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn) ?? new PosMachinesTwo();
+            var thisdate = pos.BindingTime;
+            var otherdate = pos.BindingTime;
+            var changeFlag = 0;
+            foreach (var item in posMerchants)
+            {
+                Dictionary<string, object> curData = new Dictionary<string, object>();
+                var posInfo = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == item.KqSnNo) ?? new PosMachinesTwo();
+                otherdate = posInfo.BindingTime;
+                if (thisdate < otherdate)
+                {
+                    changeFlag = 1;
+                    posInfo.IsFirst = 0;
+                }
+                else
+                {
+                    return "不符合设置条件";
+                }
+            }
+            if (changeFlag == 1)
+            {
+                AddSysLog(PosSn, "PosMachinesTwo", "SetFirstPos");
+                pos.IsFirst = 1;
+                db.SaveChanges();
+            }
+            return "success";
+        }
+        #endregion
+
 
 
         #region 同步交易额

+ 2 - 0
Areas/Admin/Controllers/MainServer/StoreChangeHistoryController.cs

@@ -133,6 +133,8 @@ namespace MySystem.Areas.Admin.Controllers
                 if (TransType == 3) dic["TransType"] = "退货";
                 if (TransType == 4) dic["TransType"] = "驳回";
                 if (TransType == 5) dic["TransType"] = "回仓退款";
+                if (TransType == 6) dic["TransType"] = "换机出仓";
+                if (TransType == 7) dic["TransType"] = "换机回仓";
                 if (TransType == 0) dic["TransType"] = "采购";
                 //SN机具类型
                 int SnType = int.Parse(dic["SnType"].ToString());

+ 2 - 0
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -620,6 +620,8 @@ namespace MySystem.Areas.Admin.Controllers
                     if (BrandId == 9) FromStoreId = 4832;
                     if (BrandId == 10) FromStoreId = 5512;
                     if (BrandId == 11) FromStoreId = 5513;
+                    if (BrandId == 12) FromStoreId = 5907;
+                    if (BrandId == 13) FromStoreId = 6381;
                     if (PosSnList.Contains(SnNo))
                     {
                         error += "以下操作失败" + SnNo + ',' + "该机具重复发货" + '\n';

+ 649 - 35
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -590,6 +590,286 @@ namespace MySystem.Areas.Admin.Controllers
             db.SaveChanges();
             return "success";
         }
+
+
+        public IActionResult CheckMachineForTeam1(string right)//直营团队机具补录
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string CheckMachineForTeam1Do(string MakerCode, string PosSn, int AddActPrize = 0, int IsSend = 0)
+        {
+            if (string.IsNullOrEmpty(MakerCode))
+            {
+                return "请输入创客编号";
+            }
+            if (string.IsNullOrEmpty(PosSn))
+            {
+                return "请输入机具SN";
+            }
+
+            var MerNo = "";
+            PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
+            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId);
+            if (pos == null)
+            {
+                return "机具SN不存在";
+            }
+            Users user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode);
+            if (user == null)
+            {
+                return "创客编号不存在";
+            }
+            if (pos.PreUserId > 0)
+            {
+                if (pos.BuyUserId == 0)
+                {
+                    pos.BuyUserId = user.Id;
+                }
+                if (pos.UserId == 0)
+                {
+                    pos.UserId = user.Id;
+                }
+            }
+            if (pos.BindingState == 0)
+            {
+                SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerSnNo == PosSn);
+                if (bind != null)
+                {
+                    pos.BindingState = 1;
+                    pos.BindingTime = bind.CreateTime;
+                    db.SaveChanges();
+                    MerNo = bind.MerNo;
+                }
+            }
+            decimal CreditTrade = 0;
+            string BindingTime = pos.BindingTime == null ? DateTime.Now.AddMonths(-1).ToString("yyyyMM") : pos.BindingTime.Value.ToString("yyyyMM");
+            string SpTradeRecordId = function.ReadInstance("/PublicParams/SpTradeRecordId" + BindingTime + ".txt");
+            int StartId = int.Parse(function.CheckInt(SpTradeRecordId));
+            bool check = spdb.TradeRecord.Any(m => m.Id > StartId && m.TradeSnNo == pos.PosSn);
+            if (check)
+            {
+                if (pos.BrandId == 1)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "1" && m.SerEntryMode != "N" && m.MerNo.StartsWith("M700")).Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 2)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "2").Sum(m => m.TradeAmount);
+                }
+                else if (pos.BrandId == 3)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "1" && m.SerEntryMode != "N" && m.MerNo.StartsWith("M900")).Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 4 || pos.BrandId == 5)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "4").Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 6)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "6").Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 7)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "7" && m.TradeStatus == "00").Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 8)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "8").Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 9)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "9").Sum(m => m.TradeAmount) / 100;
+                }
+                else if (pos.BrandId == 10 || pos.BrandId == 11)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "10").Sum(m => m.TradeAmount);
+                }
+                else if (pos.BrandId == 12)
+                {
+                    CreditTrade = spdb.TradeRecord.Where(m => m.Id > StartId && m.TradeSnNo == pos.PosSn && m.ProductType == "12").Sum(m => m.TradeAmount);
+                }
+                pos.CreditTrade = CreditTrade;
+                db.SaveChanges();
+            }
+            if (AddActPrize == 1)
+            {
+                if (pos.BuyUserId == 0)
+                {
+                    return "机具未划拨,无法补录激活奖励";
+                }
+                if (string.IsNullOrEmpty(pos.SeoKeyword) || pos.SeoKeyword == "0")
+                {
+                    bool has = spdb.ActivateRecord.Any(m => m.SnNo == pos.PosSn);
+                    if (has)
+                    {
+                        SpModels.ActivateRecord chkAct = spdb.ActivateRecord.Where(m => m.SnNo == pos.PosSn).OrderByDescending(m => m.Id).FirstOrDefault() ?? new SpModels.ActivateRecord();
+                        pos.SeoKeyword = chkAct.SeoTitle;
+                        db.SaveChanges();
+                    }
+                }
+                if (pos.BindingTime != null && pos.ActivationTime != null)
+                {
+                    // TimeSpan ts = pos.ActivationTime.Value - pos.BindingTime.Value;
+                    // if (ts.TotalDays <= 30 || SysUserName == "admin")
+                    // {
+                    //     AddAct(pos.Id);
+                    // }
+
+                    AddAct(pos.Id);
+                }
+            }
+            decimal CheckMoney = 1000;
+            if (pos.BrandId == 6)
+            {
+                CheckMoney = 5000;
+            }
+            if (pos.BuyUserId > 0)
+            {
+                if (pos.CreditTrade < CheckMoney)
+                {
+                    return "该机具贷记卡累计交易不足" + CheckMoney;
+                }
+                // if (pos.BindingTime != null && pos.ActivationTime != null)
+                // {
+                //     TimeSpan ts = pos.ActivationTime.Value - pos.BindingTime.Value;
+                //     if (ts.TotalDays > 30 && SysUserName != "admin")
+                //     {
+                //         return "机具划拨后已超过30天";
+                //     }
+                // }
+                if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0)
+                {
+                    pos.ActivationState = 1;
+                    pos.ActivationTime = DateTime.Now;
+                    PosMerchantInfo mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                    if (pos.ActivationState == 1 && mer != null)
+                    {
+                        mer.ActiveStatus = 1;
+                        mer.MerStandardDate = DateTime.Now;
+                    }
+                }
+                else if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 1)
+                {
+                    if (AddActPrize == 1)
+                    {
+                        if (IsSend == 1)
+                        {
+                            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                            {
+                                UserId = pos.BuyUserId, //接收创客
+                                MsgType = 2,
+                                Title = "补录成功通知", //标题
+                                Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
+                                CreateDate = DateTime.Now,
+
+                            }));
+                        }
+                        return "激活奖励已补录";
+                    }
+                    else
+                    {
+                        return "数据正常,无需补录";
+                    }
+                }
+                db.SaveChanges();
+                return "success";
+            }
+            pos.UserId = user.Id;
+            pos.BuyUserId = user.Id;
+            // if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && (pos.BindingTime > DateTime.Now.AddDays(-30) || SysUserName == "admin"))
+            if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0)
+            {
+                pos.ActivationState = 1;
+                pos.ActivationTime = DateTime.Now;
+            }
+            PosMerchantInfo merchant = new PosMerchantInfo();
+
+            if (!string.IsNullOrEmpty(MerNo))
+            {
+                merchant = db.PosMerchantInfo.FirstOrDefault(m => m.KqMerNo == MerNo);
+                if (merchant == null)
+                {
+                    int TopUserId = 0;
+                    if (!string.IsNullOrEmpty(user.ParentNav))
+                    {
+                        TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
+                    }
+                    SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerNo == MerNo);
+                    if (bind == null)
+                    {
+                        return "该机具尚未绑定";
+                    }
+                    SpModels.Merchants Mer = spdb.Merchants.FirstOrDefault(m => m.MerNo == MerNo);
+                    if (Mer == null)
+                    {
+                        return "该机具尚未绑定";
+                    }
+                    PosMerchantInfo add = db.PosMerchantInfo.Add(new PosMerchantInfo()
+                    {
+                        CreateDate = Mer.CreateTime,
+                        UpdateDate = Mer.UpdateTime,
+                        TopUserId = TopUserId,
+                        MerUserType = user.MerchantType,
+                        BrandId = int.Parse(Mer.ProductType),
+                        SnStoreId = pos.StoreId,
+                        SnType = pos.PosSnType,
+                        UserId = user.Id,
+                        MgrName = Mer.AgentName,
+                        MerStatus = 1,
+                        KqSnNo = Mer.SnNo,
+                        KqMerNo = Mer.MerNo,
+                        MerIdcardNo = Mer.MerIdcardNo,
+                        MerRealName = Mer.MerRealName,
+                        MerchantMobile = Mer.MerMobile,
+                        MerchantName = Mer.MerName,
+                        MerchantNo = Mer.MerNo,
+                    }).Entity;
+                    MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Mer.MerNo);
+                    if (forMerNo == null)
+                    {
+                        forMerNo = db.MachineForMerNo.Add(new MachineForMerNo()
+                        {
+                            MerNo = Mer.MerNo,
+                            SnId = pos.Id,
+                        }).Entity;
+                    }
+                    else
+                    {
+                        forMerNo.SnId = pos.Id;
+                    }
+                }
+            }
+            else
+            {
+                if (pos.BindMerchantId > 0)
+                {
+                    merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                }
+                else
+                {
+                    return "找不到机具所属商户";
+                }
+            }
+            merchant.UserId = user.Id;
+            if (pos.ActivationState == 1)
+            {
+                merchant.ActiveStatus = 1;
+                merchant.MerStandardDate = DateTime.Now;
+            }
+            if (pos.BindMerchantId == 0)
+            {
+                pos.BindMerchantId = merchant.Id;
+            }
+            db.SaveChanges();
+            function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize, "机具补录日志");
+            return "success";
+        }
+
         public void AddAct(int posid = 0)
         {
             WebCMSEntities db = new WebCMSEntities();
@@ -804,11 +1084,11 @@ namespace MySystem.Areas.Admin.Controllers
                 return "请输入商户编号";
             }
             PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
-            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId);
             if (pos == null)
             {
                 return "机具SN不存在";
             }
+            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId);
             Users user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode);
             if (user == null)
             {
@@ -886,11 +1166,11 @@ namespace MySystem.Areas.Admin.Controllers
                 return "请输入机具SN";
             }
             PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == PosSn);
-            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId);
             if (pos == null)
             {
                 return "机具SN不存在";
             }
+            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId);
             Users user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode);
             if (user == null)
             {
@@ -1360,8 +1640,8 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "请输入商户编号";
             }
-            string[] OldSnList = OldSn.Split('\n');
-            string[] NewSnList = NewSn.Split('\n');
+            string[] OldSnList = OldSn.Replace("\r", "").Split('\n');
+            string[] NewSnList = NewSn.Replace("\r", "").Split('\n');
             if (OldSnList.Length != NewSnList.Length)
             {
                 return "原机具SN数量和新机具SN数量不一致";
@@ -1613,8 +1893,8 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                     return "请输入坏机退回仓库编号";
                 }
-                OldSnList = OldSn.Split('\n');
-                NewSnList = NewSn.Split('\n');
+                OldSnList = OldSn.Replace("\r", "").Split('\n');
+                NewSnList = NewSn.Replace("\r", "").Split('\n');
                 if (OldSnList.Length != NewSnList.Length)
                 {
                     return "原机具SN数量和新机具SN数量不一致";
@@ -1729,7 +2009,6 @@ namespace MySystem.Areas.Admin.Controllers
                     newpos.BindMerchantId = oldpos.BindMerchantId;
 
                     newpos.StoreId = oldpos.StoreId;
-                    newpos.UserId = oldpos.UserId;
                     newpos.PreUserId = oldpos.PreUserId;
 
                     if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
@@ -1851,8 +2130,8 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                     return "请输入坏机退回仓库编号";
                 }
-                OldSnList = OldSn.Split('\n');
-                NewSnList = NewSn.Split('\n');
+                OldSnList = OldSn.Replace("\r", "").Split('\n');
+                NewSnList = NewSn.Replace("\r", "").Split('\n');
                 if (OldSnList.Length != NewSnList.Length)
                 {
                     return "原机具SN数量和新机具SN数量不一致";
@@ -2053,6 +2332,295 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 创客跨品牌换机
+
+        public IActionResult ChangePosCrossBrand(string right)
+        {
+            ViewBag.RightInfo = RightInfo;
+            ViewBag.right = right;
+
+            return View();
+        }
+
+        [HttpPost]
+        public string ChangePosCrossBrandDo(string MakerCode, string OldSn, string BackStoreNo, string NewSn, string FromStoreNo, int IsSend = 0)
+        {
+            string[] OldSnList;
+            string[] NewSnList;
+            decimal amount = 0;
+            List<string> opData = new List<string>();
+            if (string.IsNullOrEmpty(MakerCode))
+            {
+                return "请输入创客编号";
+            }
+            if (string.IsNullOrEmpty(OldSn))
+            {
+                return "请输入旧机SN";
+            }
+            if (string.IsNullOrEmpty(BackStoreNo))
+            {
+                return "请输入旧机退回仓库编号";
+            }
+            if (string.IsNullOrEmpty(NewSn))
+            {
+                return "请输入新机SN";
+            }
+            if (string.IsNullOrEmpty(FromStoreNo))
+            {
+                return "请输入新机发货仓库编号";
+            }
+            OldSnList = OldSn.Replace("\r", "").Replace("\n", ",").Split(',');
+            NewSnList = NewSn.Replace("\r", "").Replace("\n", ",").Split(',');
+            if (OldSnList.Length != NewSnList.Length)
+            {
+                return "原机具SN数量和新机具SN数量不一致";
+            }
+
+            var ChangeRecordNo = "KPHJ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //变更记录单号
+            for (int i = 0; i < OldSnList.Length; i++)
+            {
+                string OldSnNum = OldSnList[i];
+                string NewSnNum = NewSnList[i];
+                UserForMakerCode userForMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
+                var userInfo = db.Users.FirstOrDefault(m => m.Id == userForMakerCode.UserId) ?? new Users();
+                if (userInfo.Id == 0)
+                {
+                    return MakerCode + "不存在或关联信息缺失";
+                }
+                StoreForCode storeForCodeFrom = db.StoreForCode.FirstOrDefault(m => m.Code == FromStoreNo) ?? new StoreForCode();
+                if (storeForCodeFrom.StoreId == 0)
+                {
+                    return "您输入的新机发货仓库编号不存在";
+                }
+                StoreForCode storeForCodeBack = db.StoreForCode.FirstOrDefault(m => m.Code == BackStoreNo) ?? new StoreForCode();
+                if (storeForCodeBack.StoreId == 0)
+                {
+                    return "您输入的旧机退回仓库编号不存在";
+                }
+                MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
+                if (oldForSnNo.SnId == 0)
+                {
+                    return OldSnNum + "不存在或关联信息缺失";
+                }
+                MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
+                if (newForSnNo.SnId == 0)
+                {
+                    return NewSnNum + "不存在或关联信息缺失";
+                }
+                PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId && m.BindingState == 0 && m.ActivationState == 0 && m.BuyUserId == userForMakerCode.UserId) ?? new PosMachinesTwo();
+                if (oldpos.Id == 0)
+                {
+                    return "您输入的旧机SN不存在或者不在" + MakerCode + "名下";
+                }
+                PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId && m.BindingState == 0 && m.ActivationState == 0 && m.BuyUserId == 0 && m.UserId == 0 && m.PreUserId == 0) ?? new PosMachinesTwo();
+                if (newpos.Id == 0)
+                {
+                    return "您输入的新机SN不存在或不满足条件";
+                }
+                StoreHouse storeFrom = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeFrom.StoreId);
+                if (Convert.ToInt32(storeFrom.BrandId) != Convert.ToInt32(newpos.BrandId))
+                {
+                    return "您输入的新机发货仓库不符新机机具对应品牌";
+                }
+                if (newpos.StoreId != storeFrom.Id)
+                {
+                    return "您输入的新机SN不在新机发货仓库";
+                }
+                StoreHouse storeBack = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeBack.StoreId);
+                if (Convert.ToInt32(storeBack.BrandId) != Convert.ToInt32(oldpos.BrandId))
+                {
+                    return "您输入的旧机退回仓库不符旧机机具对应品牌";
+                }
+                var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
+                var brandNew = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
+                if (brandInfo.Kind != brandNew.Kind)
+                {
+                    return "原机具和新机具不是同种机型(电签或大POS)";
+                }
+                if (brandInfo.Name.Contains("大POS"))
+                {
+                    amount = 300;
+                }
+                if (brandInfo.Name.Contains("电签"))
+                {
+                    amount = 200;
+                }
+                var storeFromUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeFrom.UserId) ?? new UserAccount();
+                var storeBackUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeBack.UserId) ?? new UserAccount();
+                storeFromUserAcount.ValidAmount += amount;
+                storeBackUserAcount.ValidAmount -= amount;
+                storeFrom.LaveNum -= 1;
+                storeBack.LaveNum += 1;
+
+                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;
+                    }
+                }
+
+                //发出方
+                db.StoreChangeHistory.Add(new StoreChangeHistory()
+                {
+                    CreateDate = DateTime.Now,
+                    UserId = userInfo.Id, //创客
+                    BrandId = newpos.BrandId,//产品类型
+                    ChangeRecordNo = ChangeRecordNo, //变更记录单号
+                    TransType = 6, //交易类型(0 采购 1 调拨 2 出货 3 退货 4 驳回 5 回仓退款 6 换机出库 7 换机入库)
+                    SnNo = newpos.PosSn, //SN编号
+                    SnType = newpos.PosSnType, //SN机具类型
+                    StockOpDirect = 1, //库存操作方向(0 入库 1 出库)
+                    DeviceVendor = newpos.DeviceName, //设备厂商
+                    DeviceModel = newpos.DeviceKind, //设备型号
+                    DeviceType = newpos.DeviceType, //设备类型
+                    // FromUserId = storeFrom.UserId, //出货创客
+                    StoreId = storeFrom.Id,//出货仓库
+                    FromDate = DateTime.Now, //出库时间
+                    FromRemark = "跨品牌换机,出库", //出库备注
+                    SourceStoreId = newpos.SourceStoreId, //源仓库
+                    ToUserId = userInfo.Id,//收货创客
+                });
+                //接收方
+                db.StoreChangeHistory.Add(new StoreChangeHistory()
+                {
+                    CreateDate = DateTime.Now,
+                    UserId = userInfo.Id, //创客
+                    BrandId = oldpos.BrandId,//产品类型
+                    ChangeRecordNo = ChangeRecordNo, //变更记录单号
+                    TransType = 7, //交易类型(0 采购 1 调拨 2 出货 3 退货 4 驳回 5 回仓退款 6 换机出库 7 换机入库)
+                    SnNo = oldpos.PosSn, //SN编号
+                    SnType = oldpos.PosSnType, //SN机具类型
+                    StockOpDirect = 0, //库存操作方向(0 入库 1 出库)
+                    DeviceVendor = oldpos.DeviceName, //设备厂商
+                    DeviceModel = oldpos.DeviceKind, //设备型号
+                    DeviceType = oldpos.DeviceType, //设备类型
+                    StoreId = oldpos.StoreId,//出货仓库
+                    FromDate = DateTime.Now, //出库时间
+                    FromRemark = "跨品牌换机,入库", //出库备注
+                    SourceStoreId = oldpos.SourceStoreId, //源仓库
+                    ToStoreId = storeBack.Id,//收货仓库
+                });
+
+                newpos.BuyUserId = oldpos.BuyUserId;
+                newpos.UserId = oldpos.UserId;
+                newpos.RecycEndDate = oldpos.RecycEndDate;
+                newpos.ScanQrTrade = oldpos.ScanQrTrade;
+                newpos.DebitCardTrade = oldpos.DebitCardTrade;
+                newpos.CreditTrade = oldpos.CreditTrade;
+                newpos.PosSnType = oldpos.PosSnType;
+                newpos.TransferTime = oldpos.TransferTime;
+                newpos.IsPurchase = oldpos.IsPurchase;
+                newpos.BindingState = oldpos.BindingState;
+                newpos.ActivationState = oldpos.ActivationState;
+                newpos.BindingTime = oldpos.BindingTime;
+                newpos.ActivationTime = oldpos.ActivationTime;
+                newpos.IsFirst = oldpos.IsFirst;
+                newpos.SeoKeyword = oldpos.SeoKeyword;
+                newpos.PrizeParams = oldpos.PrizeParams;
+                newpos.LeaderUserId = oldpos.LeaderUserId;
+                newpos.BindMerchantId = oldpos.BindMerchantId;
+
+                newpos.PreUserId = oldpos.PreUserId;
+
+                if (!opData.Contains(newpos.BuyUserId + ":" + newpos.BrandId))
+                {
+                    opData.Add(newpos.BuyUserId + ":" + newpos.BrandId);
+                }
+                if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
+                {
+                    opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
+                }
+
+                oldpos.StoreId = storeBack.Id;
+                oldpos.QueryCount = 0;
+                oldpos.UpdateDate = null;
+                oldpos.ActivityList = null;
+                oldpos.SeoKeyword = null;
+                oldpos.SeoDescription = null;
+                oldpos.OrderId = 0;
+                oldpos.RecycEndDate = null;
+                oldpos.RecycBackCount = 0;
+                oldpos.PrizeParams = null;
+                oldpos.ScanQrTrade = 0;
+                oldpos.BindMerchantId = 0;
+                oldpos.CreditTrade = 0;
+                oldpos.DebitCardTrade = 0;
+                oldpos.IsVip = 0;
+                oldpos.UserNav = null;
+                oldpos.TransferTime = null;
+                oldpos.IsPurchase = 0;
+                oldpos.Detail = null;
+                oldpos.BindingTime = null;
+                oldpos.BindingState = 0;
+                oldpos.ActivationTime = null;
+                oldpos.ActivationState = 0;
+                oldpos.LeaderUserId = 0;
+                oldpos.PreUserId = 0;
+                oldpos.IsFirst = 0;
+                oldpos.DownFeeMan = null;
+                oldpos.DownFeeFlag = 0;
+                oldpos.DownFeeDate = null;
+                oldpos.UpFeeMan = null;
+                oldpos.UpFeeFlag = 0;
+                oldpos.UpFeeDate = null;
+                oldpos.OpReserve1 = 0;
+                oldpos.OpReserve2 = 0;
+                oldpos.OpReserve3 = 0;
+                oldpos.OpId = 0;
+                oldpos.RecycStartDate = null;
+                oldpos.SourcePosSn = null;
+                oldpos.BuyUserId = 0;
+                oldpos.UserId = 0;
+
+                PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
+                db.SaveChanges();
+                opdb.SaveChanges();
+                if (IsSend == 1)
+                {
+                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                    {
+                        UserId = userForMakerCode.UserId, //接收创客
+                        MsgType = 2,
+                        Title = "创客跨品牌换机", //标题
+                        Summary = "您的旧机 " + brandInfo.Name + " SN:" + OldSnNum + "已经成功为您换为" + brandNew.Name + "SN:" + NewSnNum + "。",
+                        CreateDate = DateTime.Now,
+
+                    }));
+                }
+            }
+            foreach (string sub in opData)
+            {
+                string[] datalist = sub.Split(":");
+                PublicFunction.SycnMachineCount(int.Parse(datalist[0]), int.Parse(datalist[1]));
+            }
+            return "success";
+        }
+        #endregion
+
+
 
         #region 机具解绑
 
@@ -2093,10 +2661,10 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "机具未绑定,不支持解绑";
             }
-            if (pos.BindingTime < DateTime.Now.AddDays(-30) && SysUserName != "admin")
-            {
-                return "机具绑定已超过30天,不支持解绑";
-            }
+            // if (pos.BindingTime < DateTime.Now.AddDays(-30) && SysUserName != "admin")
+            // {
+            //     return "机具绑定已超过30天,不支持解绑";
+            // }
             if (pos.CreditTrade > 0 || !string.IsNullOrEmpty(pos.SeoKeyword))
             {
                 return "该机具已交易,无法解绑";
@@ -2187,7 +2755,7 @@ namespace MySystem.Areas.Admin.Controllers
             });
             pos.BindMerchantId = 0;
             pos.BindingState = 0;
-            pos.BindingTime = DateTime.Parse("1900-01-01");
+            pos.BindingTime = null;
             pos.UserId = pos.BuyUserId;
             string IdBrand = pos.BuyUserId + "_" + pos.BrandId;
             db.SaveChanges();
@@ -2234,7 +2802,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "创客不存在";
             }
-            string[] SnList = Coupons.Split('\n');
+            string[] SnList = Coupons.Replace("\r", "").Split('\n');
             foreach (var item in SnList)
             {
                 var coupos = db.PosCoupons.FirstOrDefault(m => m.ExchangeCode == item && m.LeaderUserId == 0);
@@ -2279,7 +2847,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 return "创客不存在";
             }
-            string[] SnList = PosSn.Split('\n');
+            string[] SnList = PosSn.Replace("\r", "").Split('\n');
             foreach (var item in SnList)
             {
                 var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == item && m.LeaderUserId == 0);
@@ -3170,7 +3738,7 @@ namespace MySystem.Areas.Admin.Controllers
                 return "请输入机具号";
             }
             string result = SysUserName + "设置\n";
-            string[] PosSnList = PosSns.Split('\n');
+            string[] PosSnList = PosSns.Replace("\r", "").Split('\n');
             int total = PosSnList.Length;
             int index = 0;
             foreach (string SubPosSn in PosSnList)
@@ -3629,7 +4197,7 @@ namespace MySystem.Areas.Admin.Controllers
                 FeeType = "0.63";
             }
 
-            string[] PosSnList = PosSn.Split('\n');
+            string[] PosSnList = PosSn.Replace("\r", "").Split('\n');
             var PosId = "";
             var RecordId = "";
             var error = "";
@@ -4731,33 +5299,79 @@ namespace MySystem.Areas.Admin.Controllers
                 var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
                 if (mer.Id > 0)
                 {
+                    var info = "";
+                    var IsFirst = "";//是否首台机具
+                    if (function.CheckNull(mer.MerIdcardNo).Contains("*") || function.CheckNull(mer.MerchantMobile).Contains("*") || function.CheckNull(mer.MerRealName).Contains("*") || string.IsNullOrEmpty(mer.MerRealName))
+                    {
+                        info = "机具" + PosSn + "所对应的商户未认证";
+                    }
+                    var merchantId = db.PosMerchantInfo.Where(m => m.MerIdcardNo == mer.MerIdcardNo && m.MerRealName == mer.MerRealName && m.MerchantMobile == mer.MerchantMobile).Min(m => m.Id);
+                    if (mer.Id <= merchantId)
+                    {
+                        IsFirst = "首台";
+                    }
+                    else
+                    {
+                        IsFirst = "非首台";
+                    }
+                    var depositRreturn = db.MerchantDepositReturns.Where(m => m.MerchantId == mer.Id).OrderByDescending(m => m.CreateDate).FirstOrDefault() ?? new MerchantDepositReturns();
                     var IsOk = "";//是否达标
                     var timeInfo = "";
-                    if (mer.StandardMonths == 10)
+                    if (mer.StandardStatus == -2)
                     {
-                        IsOk = "已达标";
+                        IsOk = "人工已退";
                     }
                     else
                     {
-                        IsOk = "未达标";
+                        if (mer.StandardMonths < 10)
+                        {
+                            IsOk = "未达标";
+                        }
+                        if (mer.StandardMonths == 10)
+                        {
+                            IsOk = "已达标";
+                        }
+                        if (mer.StandardMonths >= 0 && mer.StandardStatus == -1)
+                        {
+                            IsOk = "达标失败";
+                        }
+                        if (mer.StandardStatus == 1 && depositRreturn.Status == 1)
+                        {
+                            IsOk = "已返还";
+                        }
+                        if (mer.StandardStatus == 101)
+                        {
+                            IsOk = "待领取达标奖";
+                        }
+                        if (mer.StandardStatus == 1 && depositRreturn.Status == 0)
+                        {
+                            IsOk = "达标奖发放中";
+                        }
                     }
+                    result += info + "\n";
+                    result += IsFirst + "\n";
                     result += IsOk + "\n";
-                    result += "开机时间:" + DateTime.Parse(pos.BindingTime.ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "\n";
-                    result += "激活时间:" + DateTime.Parse(pos.ActivationTime.ToString()).ToString("yyyy-MM-dd HH:mm:ss") + "\n";
+                    var BindingTime = pos.BindingTime == null ? "" : pos.BindingTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
+                    var ActivationTime = pos.ActivationTime == null ? "" : pos.BindingTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
+                    result += "开机时间:" + BindingTime + "\n";
+                    result += "激活时间:" + ActivationTime + "\n";
                     result += "商户姓名:" + mer.MerRealName + "\n";
-                    result += "明细:\n";
-                    for (int i = 0; i < 12; i++)
-                    {
-                        var time = DateTime.Parse(pos.ActivationTime.ToString()).AddMonths(i + 1).ToString("yyyyMM");//达标计算开始时间
-                        timeInfo += "," + time;
-                    }
-                    timeInfo = timeInfo + ",";
-                    var merTradeInfo = db.PosMerchantTradeSummay.Where(m => m.MerchantId == mer.Id && timeInfo.Contains("," + m.TradeMonth + ",")).ToList();
-                    string[] month = timeInfo.TrimStart(',').TrimEnd(',').Split(',');
-                    foreach (var item in month)
+                    if (pos.ActivationTime != null)
                     {
-                        var tradeAmount = merTradeInfo.Where(m => m.TradeMonth == item).Sum(m => m.TradeAmount);
-                        result += item + "交易额:" + tradeAmount + "\n";
+                        result += "明细:\n";
+                        for (int i = 0; i < 12; i++)
+                        {
+                            var time = pos.ActivationTime.Value.AddMonths(i + 1).ToString("yyyyMM");//达标计算开始时间
+                            timeInfo += "," + time;
+                        }
+                        timeInfo = timeInfo + ",";
+                        var merTradeInfo = db.PosMerchantTradeSummay.Where(m => m.MerchantId == mer.Id && timeInfo.Contains("," + m.TradeMonth + ",")).ToList();
+                        string[] month = timeInfo.TrimStart(',').TrimEnd(',').Split(',');
+                        foreach (var item in month)
+                        {
+                            var tradeAmount = merTradeInfo.Where(m => m.TradeMonth == item).Sum(m => m.TradeAmount);
+                            result += item + "交易额:" + tradeAmount + "\n";
+                        }
                     }
                 }
                 else

+ 14 - 18
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -2552,16 +2552,14 @@ namespace MySystem.Areas.Admin.Controllers
                             var ThirdMakerCode = ""; //次次顶级创客编号
                             var ThirdRealName = ""; //次次顶级创客姓名
                             var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
-                            if (!string.IsNullOrEmpty(pos.SeoKeyword))
+                            var brand = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
+                            if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(pos.SeoKeyword))
                             {
-                                if (pos.BrandId != 2 && pos.BrandId != 7 && pos.BrandId != 10 && pos.BrandId != 11)
-                                {
-                                    SeoKeyword = (decimal.Parse(pos.SeoKeyword) / 100).ToString();
-                                }
-                                else
-                                {
-                                    SeoKeyword = pos.SeoKeyword;
-                                }
+                                SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
+                            }
+                            else
+                            {
+                                SeoKeyword = pos.SeoKeyword;
                             }
                             var user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
                             var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == user.Id) ?? new UserAccount();
@@ -2637,16 +2635,14 @@ namespace MySystem.Areas.Admin.Controllers
                             var ThirdMakerCode = ""; //次次顶级创客编号
                             var ThirdRealName = ""; //次次顶级创客姓名
                             var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == mer.KqSnNo) ?? new PosMachinesTwo();
-                            if (!string.IsNullOrEmpty(pos.SeoKeyword))
+                            var brand = db.KqProducts.FirstOrDefault(m => m.Id == pos.BrandId) ?? new KqProducts();
+                            if (brand.Id > 0 && brand.SingleDepositApi == 0 && !string.IsNullOrEmpty(pos.SeoKeyword))
                             {
-                                if (pos.BrandId != 2 && pos.BrandId != 7 && pos.BrandId != 10 && pos.BrandId != 11)
-                                {
-                                    SeoKeyword = (decimal.Parse(pos.SeoKeyword) / 100).ToString();
-                                }
-                                else
-                                {
-                                    SeoKeyword = pos.SeoKeyword;
-                                }
+                                SeoKeyword = (decimal.Parse(SeoKeyword) / 100).ToString();
+                            }
+                            else
+                            {
+                                SeoKeyword = pos.SeoKeyword;
                             }
                             var user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
                             var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == user.Id) ?? new UserAccount();

+ 80 - 0
Areas/Admin/Views/MainServer/PosMerchantInfoList/FirstPosIndex.cshtml

@@ -0,0 +1,80 @@
+@{
+    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">
+                <input class="layui-input" type="hidden" name="ShowFlag" autocomplete="off">
+                <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="PosSn" 
+                                placeholder="请输入机具号" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="layui-inline ml50">
+                        <button class="layui-btn" lay-submit lay-filter="LAY-list-front-search">
+                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
+                        </button>
+                        <button class="layui-btn" lay-submit lay-filter="LAY-list-front-searchall">
+                            <i class="layui-icon layui-icon-list layuiadmin-button-btn"></i>全部
+                        </button>
+                        @if (RightInfo.Contains("," + right + "_export,"))
+                        {
+                            <button class="layui-btn" data-type="ExportExcel">
+                                <i class="layui-icon layui-icon-export layuiadmin-button-btn"></i>导出
+                            </button>
+                        }
+                    </div>
+                </div>
+            </div>
+            <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 + "_open,"))
+                    {
+                        @("{{#if (d.IsFirst == 0){ }}")
+                        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="SetFirstPos"><i class="layui-icon layui-icon-edit"></i>设为首台</a>
+                        @("{{#} }}")
+                    }
+                </script>
+            </div>
+        </div>
+    </div>
+
+    <script src="/layuiadmin/layui/layui.js"></script>
+    <script src="/layuiadmin/modules_main/FirstPosIndex_Admin.js?r=@DateTime.Now.ToString("yyyyMMddHHmmss")"></script>
+</body>
+</html>

+ 3 - 1
Areas/Admin/Views/MainServer/StoreChangeHistory/Index.cshtml

@@ -93,12 +93,14 @@
                         <div class="layui-input-inline">
                             <select id="TransTypeSelect" name="TransTypeSelect" lay-search="">
                                 <option value="">全部...</option>
+                                <option value="0">采购</option>
                                 <option value="1">调拨</option>
                                 <option value="2">出货</option>
                                 <option value="3">退货</option>
-                                <option value="0">采购</option>
                                 <option value="4">驳回</option>
                                 <option value="5">回仓退款</option>
+                                <option value="6">换机出仓</option>
+                                <option value="7">换机回仓</option>
                             </select>
                         </div>
                     </div>

+ 1 - 1
Areas/Admin/Views/MainServer/SysTools/BadPosToStore.cshtml

@@ -34,7 +34,7 @@
                                     <label class="layui-form-label">坏机SN</label>
                                     <div class="layui-input-block">
                                         <textarea class="layui-textarea" lay-verify="required|" name="OldSn" id="OldSn"
-                                            placeholder="请输入坏机SN"></textarea>
+                                            placeholder="请输入坏机SN,多个SN用回车隔开"></textarea>
                                     </div>
                                 </div>
                             </div>

+ 11 - 5
Areas/Admin/Views/MainServer/SysTools/CancelMerAgent.cshtml

@@ -34,7 +34,7 @@
                                     <label class="layui-form-label">创客编号</label>
                                     <div class="layui-input-inline">
                                         <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
-                                            maxlength="10" lay-verify="required|" autocomplete="off"
+                                            maxlength="15" lay-verify="required|" autocomplete="off"
                                             placeholder="请输入创客编号">
                                     </div>
                                 </div>
@@ -85,12 +85,18 @@
                     dataType: "text",
                     success: function (data) {
                         layer.close(index); //关闭弹层
-                        layer.close(indexs); //关闭弹层
                         if (data == "success") {
-                            layer.msg("取消成功");
-                            window.location.reload();
+                            layer.msg('取消成功', {
+                                time: 2000
+                            }, function () {
+                                window.location.reload();
+                            });
                         } else {
-                            layer.msg(data);
+                            layer.msg(data, {
+                                time: 2000
+                            }, function () {
+                                table.reload('LAY-list-manage'); //数据刷新
+                            });
                         }
                     }
                 });

+ 2 - 2
Areas/Admin/Views/MainServer/SysTools/ChangeBadPos.cshtml

@@ -59,14 +59,14 @@
                                     <label class="layui-form-label">坏机SN</label>
                                     <div class="layui-input-block">
                                         <textarea class="layui-textarea" lay-verify="required|" name="OldSn" id="OldSn"
-                                            placeholder="请输入坏机SN"></textarea>
+                                            placeholder="请输入坏机SN,多个SN用回车隔开"></textarea>
                                     </div>
                                 </div>
                                 <div class="layui-form-item">
                                     <label class="layui-form-label">新机SN</label>
                                     <div class="layui-input-block">
                                         <textarea class="layui-textarea" lay-verify="required|" name="NewSn" id="NewSn"
-                                            placeholder="请输入新机SN"></textarea>
+                                            placeholder="请输入新机SN,多个SN用回车隔开"></textarea>
                                     </div>
                                 </div>
                                 <div class="layui-form-item">

+ 294 - 0
Areas/Admin/Views/MainServer/SysTools/ChangePosCrossBrand.cshtml

@@ -0,0 +1,294 @@
+@{
+    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" id="MakerCodeSelect">
+                                    <label class="layui-form-label">创客编号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入创客编号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">旧机SN</label>
+                                    <div class="layui-input-block">
+                                        <textarea class="layui-textarea" lay-verify="required|" name="OldSn" id="OldSn"
+                                            placeholder="请输入旧机SN,多个SN用回车隔开"></textarea>
+                                    </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="BackStoreNo" name="BackStoreNo"
+                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入旧机退回仓库编号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">新机SN</label>
+                                    <div class="layui-input-block">
+                                        <textarea class="layui-textarea" lay-verify="required|" name="NewSn" id="NewSn"
+                                            placeholder="请输入新机SN,多个SN用回车隔开"></textarea>
+                                    </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="FromStoreNo" name="FromStoreNo"
+                                            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">
+                                        <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
+                                            lay-filter="switchTest" title="开关">
+                                    </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 index = layer.load(1, {
+                shade: [0.5, '#000']
+            });
+            var userdata = $("#confirmFrm").serialize();
+            $.ajax({
+                type: "POST",
+                url: "/Admin/SysTools/ChangePosCrossBrandDo?r=" + Math.random(1),
+                data: userdata,
+                dataType: "text",
+                success: function (data) {
+                    layer.close(index); //关闭弹层
+                    if (data == "success") {
+                        layer.msg('更换成功', {
+                            time: 2000
+                        }, function () {
+                            window.location.reload();
+                        });
+                    } else {
+                        layer.msg(data, {
+                            time: 2000
+                        }, function () {
+                            table.reload('LAY-list-manage'); //数据刷新
+                        });
+                    }
+                }
+            });
+        }
+
+
+        //编辑器
+        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');
+            });
+
+            form.on('select(ChangeType)', function (data) {
+                if (data.value == '0') {
+                    $('#MakerCodeSelect').show();
+                    $('#StoreCodeSelect').hide();
+                } else if (data.value == '1') {
+                    $('#MakerCodeSelect').hide();
+                    $('#StoreCodeSelect').show();
+                }
+                form.render();
+            });
+
+            //日期
+
+
+            //上传文件
+
+
+            //穿梭框
+
+
+            //TreeView,比如权限管理
+
+
+            //省市区
+
+        })
+
+    </script>
+</body>
+
+</html>

+ 278 - 0
Areas/Admin/Views/MainServer/SysTools/CheckMachineForTeam1.cshtml

@@ -0,0 +1,278 @@
+@{
+    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="MakerCode" name="MakerCode"
+                                            maxlength="10" lay-verify="required|" autocomplete="off"
+                                            placeholder="请输入创客编号">
+                                    </div>
+                                </div>
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">机具SN</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="PosSn" name="PosSn" maxlength="50"
+                                            lay-verify="required|" autocomplete="off" placeholder="请输入机具SN">
+                                    </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="MerNo"
+                                name="MerNo" maxlength="50" autocomplete="off" placeholder="请输入商户编号">
+                                </div>
+                                </div> *@
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">补激活奖励</label>
+                                    <div class="layui-input-block">
+                                        <input type="checkbox" id="AddActPrize" name="AddActPrize" value="1"
+                                            lay-skin="switch" lay-filter="switchTest" title="开关">
+                                    </div>
+                                </div>
+                                @* <div class="layui-form-item">
+                                <label class="layui-form-label">是否预发机</label>
+                                <div class="layui-input-block">
+                                <input type="checkbox" id="IsPre" name="IsPre" value="1"
+                                lay-skin="switch" lay-filter="switchTest" title="开关">
+                                </div>
+                                </div> *@
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">是否推送消息</label>
+                                    <div class="layui-input-block">
+                                        <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
+                                            lay-filter="switchTest" title="开关">
+                                    </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>
+        var clickflag = 0
+        function save() {
+            var index = layer.load(1, {
+                shade: [0.5, '#000']
+            });
+            var userdata = $("#confirmFrm").serialize();
+            if (clickflag == 0) {
+                clickflag = 1;
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/SysTools/CheckMachineForTeam1Do?r=" + Math.random(1),
+                    data: userdata,
+                    dataType: "text",
+                    success: function (data) {
+                        clickflag = 0;
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.msg("补录成功");
+                        } else {
+                            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>

+ 34 - 23
Areas/Admin/Views/MainServer/SysTools/SetMerAgent.cshtml

@@ -1,20 +1,23 @@
 @{
     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">
+    <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">
@@ -31,24 +34,22 @@
                                     <label class="layui-form-label">创客编号</label>
                                     <div class="layui-input-inline">
                                         <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
-                                            maxlength="10" lay-verify="required|" autocomplete="off"
+                                            maxlength="15" lay-verify="required|" autocomplete="off"
                                             placeholder="请输入创客编号">
                                     </div>
                                 </div>
                                 <div class="layui-form-item">
                                     <label class="layui-form-label">机具SN</label>
                                     <div class="layui-input-inline">
-                                        <input class="layui-input" type="text" id="PosSn"
-                                            name="PosSn" maxlength="50" lay-verify="required|"
-                                            autocomplete="off" placeholder="请输入机具SN">
+                                        <input class="layui-input" type="text" id="PosSn" name="PosSn" maxlength="50"
+                                            lay-verify="required|" autocomplete="off" placeholder="请输入机具SN">
                                     </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="MerNo"
-                                            name="MerNo" maxlength="50" lay-verify="required|"
-                                            autocomplete="off" placeholder="请输入商户编号">
+                                        <input class="layui-input" type="text" id="MerNo" name="MerNo" maxlength="50"
+                                            lay-verify="required|" autocomplete="off" placeholder="请输入商户编号">
                                     </div>
                                 </div>
                                 <div class="layui-form-item">
@@ -73,7 +74,8 @@
     </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/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>
@@ -90,18 +92,26 @@
                 success: function (data) {
                     layer.close(index); //关闭弹层
                     if (data == "success") {
-                        layer.msg("重置成功");
+                        layer.msg('设置成功', {
+                            time: 2000
+                        }, function () {
+                            window.location.reload();
+                        });
                     } else {
-                        layer.msg(data);
+                        layer.msg(data, {
+                            time: 2000
+                        }, function () {
+                            table.reload('LAY-list-manage'); //数据刷新
+                        });
                     }
                 }
             });
         }
-        
-                    
+
+
         //编辑器
         KindEditor.ready(function (K) {
-            
+
         });
 
         var ids = "";
@@ -207,7 +217,7 @@
             });
         }
 
-        
+
         var tree;
         var element;
         var upload;
@@ -227,30 +237,31 @@
             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>

+ 1 - 1
wwwroot/layuiadmin/modules/Advertisment_Admin.js

@@ -71,7 +71,7 @@ layui.config({
             , { field: 'PicPath', title: '图片', width: 60, templet: '#imgTpl', unresize: true }
 
             , { field: 'Sort', fixed: 'right', title: '排序', width: 80, edit: 'text' }
-            , { title: '操作', width: 220, align: 'center', fixed: 'right', toolbar: '#table-list-tools' }
+            , { title: '操作', width: 300, align: 'center', fixed: 'right', toolbar: '#table-list-tools' }
         ]]
         , page: true
         , limit: 30

+ 356 - 0
wwwroot/layuiadmin/modules_main/FirstPosIndex_Admin.js

@@ -0,0 +1,356 @@
+var ExcelData;
+function ConfirmImport() {
+    $.ajax({
+        type: "POST",
+        url: "/Admin/PosMerchantInfoList/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: '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/PosMerchantInfoList/Sort?r=" + Math.random(1),
+                data: "Id=" + data.Id + "&Sort=" + value,
+                dataType: "text",
+                success: function (data) {
+                }
+            });
+        }
+    });
+
+    //列表数据
+    table.render({
+        elem: '#LAY-list-manage'
+        , url: '/Admin/PosMerchantInfoList/FirstPosIndexData' //模拟接口
+        , cols: [[
+            { type: 'checkbox', fixed: 'left' }
+            , { field: 'PosSn', width: 200, title: '机具SN', sort: true }
+            , { field: 'MerchantName', width: 200, title: '商户名称', sort: true }
+            , { field: 'MerchantMobile', width: 200, title: '商户手机号', sort: true }
+            , { field: 'MerIdcardNo', width: 200, title: '商户身份证号', sort: true }
+            , { field: 'IsFirstName', width: 200, title: '是否首台', sort: true }
+            , { field: 'BindingTime', width: 200, title: '绑定时间', sort: true }
+            , { field: 'ActivationTime', width: 200, title: '激活时间', sort: true }
+            , { title: '操作', align: 'left', toolbar: '#table-list-tools', fixed: 'right' }
+        ]]
+        , where: {
+        }
+        , page: true
+        , limit: 30
+        , height: 'full-' + String($('.layui-card-header').height() + 130)
+        , 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/PosMerchantInfoList/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 === 'SetFirstPos') {
+            var index = layer.confirm('确定要设置为首台吗?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/PosMerchantInfoList/SetFirstPos?r=" + Math.random(1),
+                    data: "PosSn=" + data.PosSn,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            layer.msg("设置成功");
+                            table.reload('LAY-list-manage');
+                        } else {
+                            layer.msg(data);
+                        }
+                    }
+                });
+            });
+        }
+    });
+
+
+    //监听搜索
+    form.on('submit(LAY-list-front-search)', function (data) {
+        var field = data.field;
+
+        //执行重载
+        table.reload('LAY-list-manage', {
+            where: field,
+            page: {
+                curr: 1
+            }
+        });
+    });
+    form.on('submit(LAY-list-front-searchall)', function (data) {
+        table.reload('LAY-list-manage', {
+            where: null,
+            page: {
+                curr: 1
+            }
+        });
+    });
+
+    //事件
+    var active = {
+        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/PosMerchantInfoList/Delete?r=" + Math.random(1),
+                        data: "Id=" + ids,
+                        dataType: "text",
+                        success: function (data) {
+                            layer.close(index);
+                            if (data == "success") {
+                                table.reload('LAY-list-manage');
+                            } else {
+                                layer.msg(data);
+                            }
+                        }
+                    });
+                });
+            }
+        }
+        , add: function () {
+            var perContent = layer.open({
+                type: 2
+                , title: '商户-添加'
+                , content: 'Add'
+                , maxmin: true
+                , area: ['500px', '450px']
+                , btn: ['确定', '取消']
+                , yes: function (index, layero) {
+                    var iframeWindow = window['layui-layer-iframe' + index]
+                        , submitID = 'LAY-list-front-submit'
+                        , submit = layero.find('iframe').contents().find('#' + submitID);
+
+                    setTimeout(function () {
+                        layero.find('iframe').contents().find('.layui-tab-item').each(function (i) {
+                            var errObj = $(this).find('.layui-form-danger');
+                            if (errObj.length > 0) {
+                                iframeWindow.element.tabChange('mytabbar', String(i + 1));
+                                submit.click();
+                            }
+                        });
+                    }, 300);
+                    //监听提交
+                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
+                        var field = data.field; //获取提交的字段
+                        var userdata = "";
+                        for (var prop in field) {
+                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
+                        }
+                        //提交 Ajax 成功后,静态更新表格中的数据
+                        //$.ajax({});
+
+                        $.ajax({
+                            type: "POST",
+                            url: "/Admin/PosMerchantInfoList/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 () {
+            layer.open({
+                type: 1,
+                title: '导入',
+                maxmin: false,
+                area: ['460px', '180px'],
+                content: $('#excelForm'),
+                cancel: function () {
+                }
+            });
+        }
+        , 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/PosMerchantInfoList/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/PosMerchantInfoList/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/PosMerchantInfoList/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) : '';
+    });
+});

+ 2 - 2
wwwroot/layuiadmin/modules_main/StoreHouseStat_Admin.js

@@ -175,8 +175,8 @@ layui.config({
         where: {
 
         },
-        // page: true,
-        // limit: 30,
+        page: true,
+        limit: 30,
         height: 'full-' + String($('.layui-card-header').height() + 130),
         text: '对不起,加载出现异常!',
         done: function (res, curr, count) {