From d15481638e21ccc610f5e36577497cb6279839b9 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期二, 30 四月 2024 09:51:58 +0800 Subject: [PATCH] 修改计划订单 --- CoreCms.Net.Web.Admin/wwwroot/static/jihuageshi/上传计划订单.xlsx | 0 CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs | 90 ++++- CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs | 38 ++ CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/index.html | 126 ++++++- CoreCms.Net.Repository/Order/CoreCmsPlanOrderRepository.cs | 16 CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/details.html | 78 ++++ CoreCms.Net.IServices/Order/ICoreCmsPlanOrderServices.cs | 2 CoreCms.Net.Web.WebApi/Controllers/OrderController.cs | 2 CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs | 148 ++++++++ CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/edit.html | 327 ++++++++++++++++-- CoreCms.Net.Services/Order/CoreCmsPlanOrderServices.cs | 114 +++++ CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrder.cs | 71 ++++ CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrderItem.cs | 8 13 files changed, 892 insertions(+), 128 deletions(-) diff --git a/CoreCms.Net.IServices/Order/ICoreCmsPlanOrderServices.cs b/CoreCms.Net.IServices/Order/ICoreCmsPlanOrderServices.cs index 41ec920..77887fb 100644 --- a/CoreCms.Net.IServices/Order/ICoreCmsPlanOrderServices.cs +++ b/CoreCms.Net.IServices/Order/ICoreCmsPlanOrderServices.cs @@ -111,7 +111,7 @@ /// <param name="itemIds">鏄庣粏id</param> /// <param name="itemNums">鏄庣粏鏁伴噺</param> /// <returns></returns> - Task<WebApiCallBack> ToUpdate(string orderId ,int userId, string userName, int status, string itemIds, string itemNums); + Task<WebApiCallBack> ToUpdate(string orderId ,int userId, string userName, int status, string itemIds, string itemNums,string houtai = ""); /// <summary> /// 鍒涘缓璁″垝璁㈠崟 diff --git a/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrder.cs b/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrder.cs index 4631c2e..cea3557 100644 --- a/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrder.cs +++ b/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrder.cs @@ -39,6 +39,65 @@ /// <summary> + /// 鐪両d + /// </summary> + [Display(Name = "鐪両d")] + + + + public System.Int32 shengId { get; set; } + + + /// <summary> + /// 甯侷d + /// </summary> + [Display(Name = "甯侷d")] + + + + public System.Int32 shiId { get; set; } + + + + /// <summary> + /// 甯� + /// </summary> + [Display(Name = "甯�")] + + + + public System.String shi { get; set; } + + + /// <summary> + /// 鍖哄幙Id + /// </summary> + [Display(Name = "鍖哄幙Id")] + + + + public System.Int32 quxianId { get; set; } + + + /// <summary> + /// 鍖哄幙鍚嶇О + /// </summary> + [Display(Name = "鍖哄幙鍚嶇О")] + + + + public System.String quxian { get; set; } + + + /// <summary> + /// 鐗囧尯 + /// </summary> + [Display(Name = "鐗囧尯")] + + + public System.String pianqu { get; set; } + + /// <summary> /// 璋冩暣璁㈠崟閲戦 /// </summary> [Display(Name = "璋冩暣璁㈠崟閲戦")] @@ -94,7 +153,6 @@ [StringLength(maximumLength: 50, ErrorMessage = "{0}涓嶈兘瓒呰繃{1}瀛�")] - public System.String shipName { get; set; } @@ -110,10 +168,17 @@ public System.String shipMobile { get; set; } - + + /// <summary> + /// 鏀惰揣鍦板潃 + /// </summary> + [Display(Name = "鏀惰揣鍦板潃")] + + [StringLength(maximumLength: 200, ErrorMessage = "{0}涓嶈兘瓒呰繃{1}瀛�")] + + public System.String shouhuoAddress { get; set; } - diff --git a/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrderItem.cs b/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrderItem.cs index d68e022..82038bb 100644 --- a/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrderItem.cs +++ b/CoreCms.Net.Model/Entities/Order/CoreCmsPlanOrderItem.cs @@ -86,7 +86,13 @@ [Required(ErrorMessage = "璇疯緭鍏0}")] public System.Decimal amount { get; set; } + /// <summary> + /// 鏄惁鍘熷璁㈠崟 + /// </summary> + [SugarColumn(ColumnDescription = "鏄惁鍘熷璁㈠崟")] + public bool isOld { get; set; } = false; - + + } } diff --git a/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs b/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs index d44c1bb..022be77 100644 --- a/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs +++ b/CoreCms.Net.Model/ViewModels/DTO/OrderDTO.cs @@ -174,6 +174,15 @@ /// 璺熻釜ID锛屾湁鏁堟湡鍗佸垎閽燂紝浼氬奖鍝嶄富鎾綊鍥犮�佸垎浜憳褰掑洜绛夛紝闇�鍒涘缓璁㈠崟鍓嶈皟鐢紝璋冪敤鐢熸垚璁㈠崟 api 鏃堕渶浼犲叆璇ュ弬鏁� /// </summary> public string traceId { get; set; } + /// <summary> + /// 鏄庣粏ids + /// </summary> + public int[] itemIdarray { get; set; } + + /// <summary> + /// 鏄庣粏鏁伴噺 + /// </summary> + public int[] itemNumarray { get; set; } } @@ -516,6 +525,13 @@ public System.String shipMobile { get; set; } + /// <summary> + /// 鏀惰揣鍦板潃 + /// </summary> + + + + public System.String shouhuoAddress { get; set; } @@ -532,16 +548,32 @@ + /// <summary> + /// quxian + /// </summary> - + public System.String shi { get; set; } - + + /// <summary> + /// quxian + /// </summary> + + public System.String quxian { get; set; } + + + /// <summary> + /// 鐗囧尯 + /// </summary> + + public System.String pianqu { get; set; } + /// <summary> /// 鍟嗗搧鍚嶇О /// </summary> - + public System.String name { get; set; } diff --git a/CoreCms.Net.Repository/Order/CoreCmsPlanOrderRepository.cs b/CoreCms.Net.Repository/Order/CoreCmsPlanOrderRepository.cs index a6a3b9f..4ecbd45 100644 --- a/CoreCms.Net.Repository/Order/CoreCmsPlanOrderRepository.cs +++ b/CoreCms.Net.Repository/Order/CoreCmsPlanOrderRepository.cs @@ -194,7 +194,13 @@ createBy = p.createBy, upDataBy = p.upDataBy, isdelete = p.isdelete, - + shengId = p.shengId, + shiId = p.shiId, + shi = p.shi, + quxian = p.quxian, + quxianId = p.quxianId, + pianqu = p.pianqu, + shouhuoAddress = p.shouhuoAddress, }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); } else @@ -217,7 +223,13 @@ createBy = p.createBy, upDataBy = p.upDataBy, isdelete = p.isdelete, - + shiId = p.shiId, + shi = p.shi, + quxian = p.quxian, + quxianId = p.quxianId, + pianqu = p.pianqu, + shouhuoAddress = p.shouhuoAddress, + }).ToPageListAsync(pageIndex, pageSize, totalCount); } var list = new PageList<CoreCmsPlanOrder>(page, pageIndex, pageSize, totalCount); diff --git a/CoreCms.Net.Services/Order/CoreCmsPlanOrderServices.cs b/CoreCms.Net.Services/Order/CoreCmsPlanOrderServices.cs index 0464b05..a4525c3 100644 --- a/CoreCms.Net.Services/Order/CoreCmsPlanOrderServices.cs +++ b/CoreCms.Net.Services/Order/CoreCmsPlanOrderServices.cs @@ -35,6 +35,7 @@ using CoreCms.Net.Model.Entities.baifenbingfa.Promote; using static SKIT.FlurlHttpClient.Wechat.Api.Models.ScanProductAddV2Request.Types.Product.Types; using NPOI.SS.Formula.Functions; +using CoreCms.Net.Model.FromBody; namespace CoreCms.Net.Services @@ -48,17 +49,20 @@ private readonly IUnitOfWork _unitOfWork; private readonly ICoreCmsPlanOrderItemRepository _itemDal; private readonly ICoreCmsUserServices _coreCmsUserServices; + private readonly ICoreCmsUserServices _userServices; public CoreCmsPlanOrderServices(IUnitOfWork unitOfWork, ICoreCmsPlanOrderRepository dal , ICoreCmsPlanOrderItemRepository itemDal - , ICoreCmsUserServices coreCmsUserServices) + , ICoreCmsUserServices coreCmsUserServices + , ICoreCmsUserServices userServices) { this._dal = dal; base.BaseDal = dal; _unitOfWork = unitOfWork; _itemDal = itemDal; _coreCmsUserServices = coreCmsUserServices; - } + _userServices =userServices; + } #region 瀹炵幇閲嶅啓澧炲垹鏀规煡鎿嶄綔========================================================== @@ -163,6 +167,8 @@ } if (userId > 0) { + //var user = await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Where(x => x.id == userId).FirstAsync(); + where = where.And(p => p.userId == userId); } var list = await _dal.QueryPageAsync(where, p => p.createTime, OrderByType.Desc, page, limit); @@ -201,8 +207,9 @@ /// <param name="status">璁″垝璁㈠崟鐘舵��</param> /// <param name="itemIds">鏄庣粏id</param> /// <param name="itemNums">鏄庣粏鏁伴噺</param> + /// <param name="houtai">鏄惁鍚庡彴缂栬緫</param> /// <returns></returns> - public async Task<WebApiCallBack> ToUpdate(string orderId, int userId, string userName, int status, string itemIds, string itemNums) + public async Task<WebApiCallBack> ToUpdate(string orderId, int userId, string userName, int status, string itemIds, string itemNums, string houtai = "") { var jm = new WebApiCallBack() { methodDescription = "淇敼璁″垝璁㈠崟" }; try @@ -210,7 +217,15 @@ //寮�濮嬩簨鍔″鐞� _unitOfWork.BeginTran(); var order = await _dal.QueryByIdAsync(orderId); - + + var oldorderAmount = order.orderAmount; + if (order.status == 2 && string.IsNullOrEmpty(houtai)) + { + _unitOfWork.RollbackTran(); + jm.status = false; + jm.otherData = "璁㈠崟宸茬粡鎻愪氦涓嶈兘淇敼"; + return jm; + } order.upDataBy = userName; order.upDataTime = DateTime.Now; @@ -240,20 +255,24 @@ { _unitOfWork.RollbackTran(); jm.status = false; - jm.otherData = "鍙敤浣欓涓嶈兘涓鸿礋"; + jm.otherData = "璁㈠崟閲戦瓒呭嚭璁″垝閲戦"; + return jm; } + + var keYongAmount = oldorderAmount - orderAmount; if (status == 2) { order.status = 2; - - if (order.keYongAmount > 0) + if (keYongAmount != 0) { //淇敼鐢ㄦ埛浣欓 - var jmsss = await _coreCmsUserServices.UpdateBalance(order.userId, order.keYongAmount, "鐢ㄦ埛璁″垝璁㈠崟娆鹃」缁撲綑"); + var jmsss = await _coreCmsUserServices.UpdateBalance(order.userId, keYongAmount, "鐢ㄦ埛璁″垝璁㈠崟"+ order.orderId + "娆鹃」缁撲綑"); } + + } @@ -305,7 +324,15 @@ order.status = 1; order.shipMobile = jiHuaOrders[0].shipMobile; order.shipAddress = jiHuaOrders[0].shipAddress; - order.shipName = jiHuaOrders[0].shipName; ; + order.shipName = jiHuaOrders[0].shipName; + order.shouhuoAddress = jiHuaOrders[0].shouhuoAddress; + if (string.IsNullOrEmpty(order.shipMobile)) + { + //鎵句笉鍒扮敤鎴峰氨娉ㄥ唽鐢ㄦ埛 + jm.code = 1; + jm.msg = order.shipMobile + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖"; + return jm; + } var user = await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Where(x => x.mobile == order.shipMobile && x.isDelete == false && x.status == 1).FirstAsync(); if (user != null) { @@ -313,9 +340,30 @@ } else { - jm.code = 1; - jm.msg = order.shipMobile + "娌℃湁鎵惧埌鐢ㄦ埛"; - return jm; + + var data = new FMWxAccountCreate + { + mobile = order.shipMobile, + invitecode = 0, + sessionAuthId = "" + }; + + var jms = await _userServices.SmsLogin(data); + user = await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Where(x => x.mobile == order.shipMobile && x.isDelete == false && x.status == 1).FirstAsync(); + if (user != null) + { + order.userId = user.id; + } + else + { + + //鎵句笉鍒扮敤鎴峰氨娉ㄥ唽鐢ㄦ埛 + jm.code = 1; + jm.msg = order.shipMobile + "鑱旂郴鐢佃瘽涓嶆纭�"; + return jm; + + } + } order.createBy = userName; @@ -323,10 +371,29 @@ order.upDataBy = userName; order.upDataTime = DateTime.Now; order.isdelete = false; - + var shi = await _unitOfWork.GetDbClient().Queryable<CoreCmsArea>().Where(x => x.name == jiHuaOrders[0].shi).FirstAsync(); + if(shi == null) + { + jm.code = 1; + jm.msg = order.shipMobile + "娌℃湁鎵惧埌甯�"; + return jm; + } + var quxian = await _unitOfWork.GetDbClient().Queryable<CoreCmsArea>().Where(x => x.name == jiHuaOrders[0].quxian && x.parentId == shi.id).FirstAsync(); + if (shi == null) + { + jm.code = 1; + jm.msg = order.shipMobile + "娌℃湁鎵惧埌鍖哄幙"; + return jm; + } + order.shengId = 510000; + order.shi = jiHuaOrders[0].shi; + order.shiId = shi.id; + order.quxianId = quxian.id; + order.quxian = jiHuaOrders[0].quxian; + order.pianqu = jiHuaOrders[0].pianqu; decimal orderAmount = 0; @@ -344,8 +411,18 @@ item.upDataBy = userName; item.upDataTime = DateTime.Now; item.isdelete = false; + item.isOld = true; var jms = await _itemDal.InsertAsync(item); orderAmount += item.amount; + + + item.isOld = false; + jms = await _itemDal.InsertAsync(item); + if (jms.code == 1) + { + + return jms; + } } order.orderAmount = orderAmount; @@ -353,9 +430,16 @@ order.keYongAmount = 0; //鏍¢獙鍚庡啀鍒涘缓璁㈠崟 - var jmss = await _dal.InsertAsync(order); + var sss = await _unitOfWork.GetDbClient().Insertable<CoreCmsPlanOrder>(order).ExecuteCommandAsync(); + //var jmss = await _dal.InsertAsync(order); + + //if (jmss.code == 1) + //{ + + // return jmss; + //} @@ -374,7 +458,7 @@ catch (Exception e) { _unitOfWork.RollbackTran(); - jm.code = 0; + jm.code = 1; jm.otherData = e.ToString(); } return jm; diff --git a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs index e4aa7f1..a6f48b9 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs @@ -39,6 +39,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; @@ -433,70 +434,105 @@ IRow row = sheet.GetRow(i); if (row == null) continue; // 璺宠繃绌鸿 + + ICell cell0 = row.GetCell(0); + if (cell0 == null) + { + jm.msg = "绗�" + (i + 1) + "甯備笉鑳戒负绌�"; + return jm; + } + hang.shi = getcellvalue(cell0); + ICell cell1 = row.GetCell(1); if (cell1 == null) { - jm.msg ="绗�" +(i+1) + "瀛︽牎涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鍖哄幙涓嶈兘涓虹┖"; return jm; } - hang.shipAddress = getcellvalue(cell1); + hang.quxian = getcellvalue(cell1); ICell cell2 = row.GetCell(2); if (cell2 == null) { - jm.msg = "绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�"; + jm.msg ="绗�" +(i+1) + "鐗囧尯涓嶈兘涓虹┖"; return jm; } - hang.shipName = getcellvalue(cell2); + hang.pianqu = getcellvalue(cell2); ICell cell3 = row.GetCell(3); if (cell3 == null) { - jm.msg = "绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "瀛︽牎涓嶈兘涓虹┖"; return jm; } - hang.shipMobile = getcellvalue(cell3); + hang.shipAddress = getcellvalue(cell3); ICell cell4 = row.GetCell(4); if (cell4 == null) { - jm.msg = "绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�"; return jm; } - hang.name = getcellvalue(cell4); + hang.shipName = getcellvalue(cell4); ICell cell5 = row.GetCell(5); if (cell5 == null) { - jm.msg = "绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖"; return jm; } - hang.specification = getcellvalue(cell5); + hang.shipMobile = getcellvalue(cell5); ICell cell6 = row.GetCell(6); if (cell6 == null) { - jm.msg = "绗�" + (i + 1) + "鍗曚环锛堝厓锛変笉鑳戒负绌�"; + jm.msg = "绗�" + (i + 1) + "鏀惰揣鍦板潃涓嶈兘涓虹┖"; return jm; } - hang.price = decimal.Parse(getcellvalue(cell6)); + hang.shouhuoAddress = getcellvalue(cell6); ICell cell7 = row.GetCell(7); if (cell7 == null) { + jm.msg = "绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖"; + return jm; + } + hang.name = getcellvalue(cell7); + + ICell cell8 = row.GetCell(8); + if (cell8 == null) + { + jm.msg = "绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖"; + return jm; + } + hang.specification = getcellvalue(cell8); + + + ICell cell9 = row.GetCell(9); + if (cell9 == null) + { + jm.msg = "绗�" + (i + 1) + "鍗曚环锛堝厓锛変笉鑳戒负绌�"; + return jm; + } + hang.price = decimal.Parse(getcellvalue(cell9)); + + + ICell cell10 = row.GetCell(10); + if (cell10 == null) + { jm.msg = "绗�" + (i + 1) + "鏁伴噺涓嶈兘涓虹┖"; return jm; } - hang.nums = int.Parse(getcellvalue(cell7)); ; + hang.nums = int.Parse(getcellvalue(cell10)); lie.Add(hang); } } - lie = lie.OrderBy(x => x.shipAddress).ThenBy(x => x.specification).ToList(); + // lie = lie.OrderBy(x => x.shipAddress).ThenBy(x => x.specification).ToList(); string url = string.Empty; url = "121212"; - + string pianqu = ""; if (lie!=null && lie.Count > 0) { var order = new List<JiHuaOrder>(); @@ -504,7 +540,9 @@ { if (i == 0 ) { + order.Add(lie[i]); + pianqu = lie[i].pianqu; //if(lie.Count == 1) //{ // //淇濆瓨璁㈠崟 @@ -517,19 +555,35 @@ } else { - if(lie[i].shipAddress == lie[i - 1].shipAddress) + if(string.IsNullOrEmpty(lie[i].shipAddress)) { order.Add(lie[i]); } else { //淇濆瓨璁㈠崟 - jm = await _coreCmsPlanOrderServices.ToAddJiHua(lie, _user.ID, _user.Name); + jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name); if (jm.code == 1) { return jm; } order = new List<JiHuaOrder>(); + if (string.IsNullOrEmpty(lie[i].shi)) + { + lie[i].shi = lie[0].shi; + } + if (string.IsNullOrEmpty(lie[i].quxian)) + { + lie[i].quxian = lie[0].quxian; + } + if (string.IsNullOrEmpty(lie[i].pianqu)) + { + lie[i].pianqu = pianqu; + } + else + { + pianqu = lie[i].pianqu; + } order.Add(lie[i]); } } @@ -537,7 +591,7 @@ if (i == lie.Count - 1) { //淇濆瓨璁㈠崟 - jm = await _coreCmsPlanOrderServices.ToAddJiHua(lie, _user.ID, _user.Name); + jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name); if (jm.code == 1) { return jm; diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs index 78894d6..31daf60 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs @@ -34,6 +34,15 @@ using CoreCms.Net.Model.Entities.Order; using CoreCms.Net.Services; using System.Threading; +using MathNet.Numerics.Distributions; +using CoreCms.Net.Model.ViewModels.DTO; +using CoreCms.Net.Auth.HttpContextUser; +using MathNet.Numerics; +using Org.BouncyCastle.Asn1.Cmp; +using static CoreCms.Net.Configuration.GlobalEnumVars; +using static SKIT.FlurlHttpClient.Wechat.Api.Models.CardCreateRequest.Types.MembershipCard.Types.Base.Types; +using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressDeliveryOpenMessageGetDeliveryListResponse.Types; +using System.Threading.Channels; namespace CoreCms.Net.Web.Admin.Controllers { @@ -52,6 +61,9 @@ private readonly ICoreCmsPlanOrderItemServices _planOrderItemServices; private readonly ICoreCmsSettingServices _coreCmsSettingServices; private readonly SemaphoreSlim _semaphore; + private readonly IHttpContextUser _user; + private readonly ICoreCmsPlanOrderServices _planOrderServices; + private readonly ICoreCmsAreaServices _areaServices; /// <summary> @@ -61,12 +73,18 @@ ,ICoreCmsPlanOrderServices CoreCmsPlanOrderServices , ICoreCmsPlanOrderItemServices planOrderItemServices , ICoreCmsSettingServices coreCmsSettingServices + , IHttpContextUser user + , ICoreCmsPlanOrderServices planOrderServices + , ICoreCmsAreaServices areaServices ) { _webHostEnvironment = webHostEnvironment; _CoreCmsPlanOrderServices = CoreCmsPlanOrderServices; _planOrderItemServices = planOrderItemServices; _coreCmsSettingServices = coreCmsSettingServices; + _user = user; + _planOrderServices = planOrderServices; + _areaServices = areaServices; } #region 鑾峰彇鍒楄〃============================================================ @@ -108,8 +126,26 @@ { where = where.And(p => p.orderId.Contains(orderId)); } - //璋冩暣璁㈠崟閲戦 decimal - var orderAmount = Request.Form["orderAmount"].FirstOrDefault().ObjectToDecimal(0); + //甯� varchar + var shi = Request.Form["shi"].FirstOrDefault().ObjectToInt(0); + if (shi>0) + { + where = where.And(p => p.shiId == shi); + } + //鍖哄幙 varchar + var quxian = Request.Form["quxian"].FirstOrDefault().ObjectToInt(0); ; + if (quxian>0) + { + where = where.And(p => p.quxianId == quxian); + } + //鏀惰揣鍦板潃 varchar + var shouhuoAddress = Request.Form["shouhuoAddress"].FirstOrDefault(); + if (!string.IsNullOrEmpty(shouhuoAddress)) + { + where = where.And(p => p.shouhuoAddress.Contains(shouhuoAddress)); + } + //璋冩暣璁㈠崟閲戦 decimal + var orderAmount = Request.Form["orderAmount"].FirstOrDefault().ObjectToDecimal(0); if (orderAmount > 0) { where = where.And(p => p.orderAmount == orderAmount); @@ -244,10 +280,37 @@ /// <returns></returns> [HttpPost] [Description("棣栭〉鏁版嵁")] - public AdminUiCallBack GetIndex() + public async Task<AdminUiCallBack> GetIndex() { //杩斿洖鏁版嵁 var jm = new AdminUiCallBack { code = 0 }; + + var shi = await _areaServices.QueryListByClauseAsync(p=>p.parentId == 510000); + + jm.data = shi; + + return jm; + } + #endregion + + + #region 閫夋嫨甯�============================================================ + // POST: Api/CoreCmsPlanOrder/GetIndex + /// <summary> + /// 閫夋嫨甯� + /// </summary> + /// <returns></returns> + [Description("閫夋嫨甯�")] + [AllowAnonymous] + public async Task<AdminUiCallBack> GetAreaId(int cityid = 0) + { + //杩斿洖鏁版嵁 + var jm = new AdminUiCallBack { code = 0 }; + + var shi = await _areaServices.QueryListByClauseAsync(p => p.parentId == cityid); + + jm.data = shi; + return jm; } #endregion @@ -293,7 +356,7 @@ /// <returns></returns> [HttpPost] [Description("缂栬緫鏁版嵁")] - public async Task<AdminUiCallBack> GetEdit([FromBody]FMIntId entity) + public async Task<AdminUiCallBack> GetEdit([FromBody]FMStringId entity) { var jm = new AdminUiCallBack(); @@ -303,8 +366,22 @@ jm.msg = "涓嶅瓨鍦ㄦ淇℃伅"; return jm; } + //鑾峰彇鐩稿叧鐘舵�佹弿杩拌鏄庤浆鎹� + model.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(model.status); + + + var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == true, p => p.specification, OrderByType.Asc); + + var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == false, p => p.specification, OrderByType.Asc); + + jm.data = new + { + model, + modelItem1, + modelItem2 + }; jm.code = 0; - jm.data = model; + // jm.data = model; return jm; } @@ -319,10 +396,59 @@ /// <returns></returns> [HttpPost] [Description("缂栬緫鎻愪氦")] - public async Task<AdminUiCallBack> DoEdit([FromBody]CoreCmsPlanOrder entity) + public async Task<AdminUiCallBack> DoEdit([FromBody] CreateOrder entity) { - var jm = await _CoreCmsPlanOrderServices.UpdateAsync(entity); + var jm = new AdminUiCallBack(); + + + + try + { + + + if (entity.itemIdarray ==null || entity.itemIdarray.Length==0) + { + jm.data = 10000; + jm.msg = GlobalErrorCodeVars.Code10000; + return jm; + } + string itemIds = string.Join(",", entity.itemIdarray); + + string itemNums = string.Join(",", entity.itemNumarray); + + + // jm = await _CoreCmsPlanOrderServices.UpdateAsync(new CoreCmsPlanOrder()); + var jms = await _planOrderServices.ToUpdate(entity.orderId, _user.ID, _user.Name, 2, itemIds, itemNums,"shi"); + if (jms.status) + { + jm.code = 0; + jm.data = jms.data; + jm.msg = "淇敼鎴愬姛"; + } + else + { + jm.code = 1; + jm.data = jms.data; + jm.msg = jms.otherData.ToString(); + } + + + + + + } + catch (Exception e) + { + jm.msg = "鏁版嵁澶勭悊寮傚父"; + jm.otherData = e; + } + + return jm; + + + + } #endregion @@ -391,11 +517,15 @@ model.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(model.status); - var modelItem = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id, p => p.specification, OrderByType.Asc); + var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == true, p => p.specification, OrderByType.Asc); + + var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == false, p => p.specification, OrderByType.Asc); + jm.data = new { model, - modelItem, + modelItem1, + modelItem2 }; jm.code = 0; //jm.data = model; diff --git "a/CoreCms.Net.Web.Admin/wwwroot/static/jihuageshi/\344\270\212\344\274\240\350\256\241\345\210\222\350\256\242\345\215\225.xlsx" "b/CoreCms.Net.Web.Admin/wwwroot/static/jihuageshi/\344\270\212\344\274\240\350\256\241\345\210\222\350\256\242\345\215\225.xlsx" index 877b4a2..bf054cd 100644 --- "a/CoreCms.Net.Web.Admin/wwwroot/static/jihuageshi/\344\270\212\344\274\240\350\256\241\345\210\222\350\256\242\345\215\225.xlsx" +++ "b/CoreCms.Net.Web.Admin/wwwroot/static/jihuageshi/\344\270\212\344\274\240\350\256\241\345\210\222\350\256\242\345\215\225.xlsx" Binary files differ diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/details.html b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/details.html index fc0958e..76a3cc6 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/details.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/details.html @@ -16,16 +16,43 @@ <td width="25%"> <label for="shipAddress">瀛︽牎</label> </td> - <td width="25%"> + <td width="25%"> {{ d.params.data.model.shipAddress || '' }} </td> </tr> + <tr> + <td> + <label for="shi">甯�</label> + </td> + <td> + {{ d.params.data.model.shi || '' }} + </td> + <td> + <label for="quxian">鍖哄幙</label> + </td> + <td> + {{ d.params.data.model.quxian || '' }} + </td> + </tr> - + <tr> + <td> + <label for="pianqu">鐗囧尯</label> + </td> + <td> + {{ d.params.data.model.pianqu || '' }} + </td> + <td> + <label for="quxian">鏀惰揣鍦板潃</label> + </td> + <td> + {{ d.params.data.model.shouhuoAddress || '' }} + </td> + </tr> <tr> <td> @@ -88,7 +115,12 @@ </td> </tr> + <tr> + <td style="background-color:lightsteelblue;" colspan="4"> + 鍘熻鍗� + </td> + </tr> <tr> <td style="background-color:lightsteelblue;"> 鍟嗗搧鍚嶇О @@ -99,12 +131,12 @@ <td style="background-color:lightsteelblue;"> 鏁伴噺 </td> - <td style="background-color:lightsteelblue;" > + <td style="background-color:lightsteelblue;"> 鎬讳环锛堝厓锛� </td> </tr> - {{# layui.each(d.params.data.modelItem, function(index, item){ }} + {{# layui.each(d.params.data.modelItem1, function(index, item){ }} <tr> <td> {{ item.name }} {{ item.specification }} @@ -123,6 +155,44 @@ + <tr> + <td style="background-color:lightsteelblue;" colspan="4"> + 淇敼璁㈠崟 + </td> + + </tr> + <tr> + <td style="background-color:lightsteelblue;"> + 鍟嗗搧鍚嶇О + </td> + <td style="background-color:lightsteelblue;"> + 鍗曚环锛堝厓锛� + </td> + <td style="background-color:lightsteelblue;"> + 鏁伴噺 + </td> + <td style="background-color:lightsteelblue;"> + 鎬讳环锛堝厓锛� + </td> + </tr> + + {{# layui.each(d.params.data.modelItem2, function(index, item){ }} + <tr> + <td> + {{ item.name }} {{ item.specification }} + </td> + <td> + {{ item.price }} + </td> + <td> + {{ item.nums }} + </td> + <td> + {{ item.amount }} + </td> + </tr> + {{# }); }} + </tbody> </table> </script> diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/edit.html b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/edit.html index ec5212b..e26c624 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/edit.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/edit.html @@ -1,110 +1,346 @@ <script type="text/html" template lay-done="layui.data.sendParams(d);"> <div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsPlanOrder-editForm" id="LAY-app-CoreCmsPlanOrder-editForm"> - - <div class="layui-form-item"> - <label for="orderId" class="layui-form-label layui-form-required">璁㈠崟鍙�</label> - <div class="layui-input-block"> - <input name="orderId" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ヨ鍗曞彿" lay-reqText="璇疯緭鍏ヨ鍗曞彿" value="{{d.params.data.orderId || '' }}" /> - </div> - </div> - - <div class="layui-form-item"> - <label for="orderAmount" class="layui-form-label layui-form-required">璋冩暣璁㈠崟閲戦</label> - <div class="layui-input-block"> - <input name="orderAmount" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ヨ皟鏁磋鍗曢噾棰�" lay-reqText="璇疯緭鍏ヨ皟鏁磋鍗曢噾棰�" value="{{d.params.data.orderAmount || '' }}" /> - </div> - </div> - - <div class="layui-form-item"> + <input type="hidden" name="orderId" id="orderId" value="{{d.params.data.model.orderId || '' }}"> + <table class="layui-table layui-form"> + <colgroup> + <col width="100"> + <col> + </colgroup> + <tbody> + + <tr> + <td width="25%"> + <label for="orderId">璁㈠崟鍙�</label> + </td> + <td width="25%"> + {{ d.params.data.model.orderId || '' }} + </td> + <td width="25%"> + <label for="shipAddress">瀛︽牎</label> + </td> + <td width="25%"> + {{ d.params.data.model.shipAddress || '' }} + </td> + </tr> + + + + <tr> + <td> + <label for="shi">甯�</label> + </td> + <td> + {{ d.params.data.model.shi || '' }} + </td> + <td> + <label for="quxian">鍖哄幙</label> + </td> + <td> + {{ d.params.data.model.quxian || '' }} + </td> + </tr> + + + <tr> + <td> + <label for="pianqu">鐗囧尯</label> + </td> + <td> + {{ d.params.data.model.pianqu || '' }} + </td> + <td> + <label for="quxian">鏀惰揣鍦板潃</label> + </td> + <td> + {{ d.params.data.model.shouhuoAddress || '' }} + </td> + </tr> + + <tr> + <td> + <label for="shipName">鑱旂郴浜�</label> + </td> + <td> + {{ d.params.data.model.shipName || '' }} + </td> + <td> + <label for="shipMobile">鑱旂郴鐢佃瘽</label> + </td> + <td> + {{ d.params.data.model.shipMobile || '' }} + </td> + </tr> + + <tr> + <td> + <label for="oldOrderAmount">璁″垝閲戦</label> + </td> + <td > + <input id="oldOrderAmount" name="oldOrderAmount" type="number" class="layui-input" value="{{ d.params.data.model.oldOrderAmount || '' }}" readonly="readonly" /> + </td> + <td> + <label for="orderAmount">璋冩暣閲戦</label> + </td> + <td> + <input id="orderAmount" name="orderAmount" type="number" class="layui-input" value="{{ d.params.data.model.orderAmount || '' }}" readonly="readonly" /> + </td> + </tr> + + + <tr> + <td > + <label for="keYongAmount">鍙敤浣欓</label> + </td> + <td> + <input id="keYongAmount" name="keYongAmount" type="number" class="layui-input" value="{{ d.params.data.model.keYongAmount || '' }}" readonly="readonly" /> + </td> + <td> + <label for="status">璁㈠崟鐘舵��</label> + </td> + <td> + {{ d.params.data.model.statusText || '' }} + </td> + </tr> + + <tr> + <td> + <label for="createTime">寤虹珛鏃堕棿</label> + </td> + <td> + {{ d.params.data.model.createTime || '' }} + </td> + <td> + <label for="upDataTime">淇敼鏃堕棿</label> + </td> + <td> + {{ d.params.data.model.upDataTime || '' }} + </td> + </tr> + + <tr> + <td style="background-color:lightsteelblue;" colspan="4"> + 鍘熻鍗� + </td> + + </tr> + <tr> + <td style="background-color:lightsteelblue;"> + 鍟嗗搧鍚嶇О + </td> + <td style="background-color:lightsteelblue;"> + 鍗曚环锛堝厓锛� + </td> + <td style="background-color:lightsteelblue;"> + 鏁伴噺 + </td> + <td style="background-color:lightsteelblue;"> + 鎬讳环锛堝厓锛� + </td> + </tr> + + {{# layui.each(d.params.data.modelItem1, function(index, item){ }} + <tr> + <td> + {{ item.name }} {{ item.specification }} + </td> + <td> + {{ item.price }} + </td> + <td> + {{ item.nums }} + </td> + <td> + {{ item.amount }} + </td> + </tr> + {{# }); }} + + + + <tr> + <td style="background-color:lightsteelblue;" colspan="4"> + 淇敼璁㈠崟 + </td> + + </tr> + <tr> + <td style="background-color:lightsteelblue;"> + 鍟嗗搧鍚嶇О + </td> + <td style="background-color:lightsteelblue;"> + 鍗曚环锛堝厓锛� + </td> + <td style="background-color:lightsteelblue;"> + 鏁伴噺 + </td> + <td style="background-color:lightsteelblue;"> + 鎬讳环锛堝厓锛� + </td> + </tr> + + {{# layui.each(d.params.data.modelItem2, function(index, item){ }} + <tr> + <td> + <input type="hidden" name="itemIdarray" value="{{item.id || '' }}"> + {{ item.name }} {{ item.specification }} + </td> + <td> + {{ item.price }} + <input type="hidden" name="price" value="{{item.price || '' }}"> + </td> + <td> + <input name="itemNumarray" lay-verType="tips" type="number" min="0" max="99999999" lay-verify="required|number" class="layui-input" placeholder="璇疯緭鍏ユ暟閲�" lay-reqText="璇疯緭鍏ユ暟閲�" value="{{ item.nums }}" onchange="changenum('{{ index }}')" /> + </td> + <td> + + + <input name="amount" type="number" class="layui-input" value="{{ item.amount }}" readonly="readonly" /> + </td> + </tr> + {{# }); }} + + </tbody> + </table> + + + + <!--<div class="layui-form-item"> <label for="status" class="layui-form-label layui-form-required">璁㈠崟鐘舵��</label> <div class="layui-input-block"> <input type="number" min="0" max="999999" name="status" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.status || '' }}" placeholder="璇疯緭鍏ヨ鍗曠姸鎬�" lay-reqText="璇疯緭鍏ヨ鍗曠姸鎬佸苟涓烘暟瀛�" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="userId" class="layui-form-label layui-form-required">鐢ㄦ埛ID 鍏宠仈user.id</label> <div class="layui-input-block"> <input type="number" min="0" max="999999" name="userId" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.userId || '' }}" placeholder="璇疯緭鍏ョ敤鎴稩D 鍏宠仈user.id" lay-reqText="璇疯緭鍏ョ敤鎴稩D 鍏宠仈user.id骞朵负鏁板瓧" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="shipAddress" class="layui-form-label layui-form-required">瀛︽牎</label> <div class="layui-input-block"> <input name="shipAddress" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ュ鏍�" lay-reqText="璇疯緭鍏ュ鏍�" value="{{d.params.data.shipAddress || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="shipName" class="layui-form-label layui-form-required">鑱旂郴浜�</label> <div class="layui-input-block"> <input name="shipName" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ヨ仈绯讳汉" lay-reqText="璇疯緭鍏ヨ仈绯讳汉" value="{{d.params.data.shipName || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="shipMobile" class="layui-form-label layui-form-required">鏀惰揣鐢佃瘽</label> <div class="layui-input-block"> <input name="shipMobile" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ユ敹璐х數璇�" lay-reqText="璇疯緭鍏ユ敹璐х數璇�" value="{{d.params.data.shipMobile || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="oldOrderAmount" class="layui-form-label layui-form-required">璁″垝璁㈠崟閲戦</label> <div class="layui-input-block"> <input name="oldOrderAmount" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ヨ鍒掕鍗曢噾棰�" lay-reqText="璇疯緭鍏ヨ鍒掕鍗曢噾棰�" value="{{d.params.data.oldOrderAmount || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="keYongAmount" class="layui-form-label layui-form-required">鍙敤浣欓</label> <div class="layui-input-block"> <input name="keYongAmount" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ュ彲鐢ㄤ綑棰�" lay-reqText="璇疯緭鍏ュ彲鐢ㄤ綑棰�" value="{{d.params.data.keYongAmount || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="createTime" class="layui-form-label layui-form-required">寤虹珛鏃堕棿</label> <div class="layui-input-block"> <input name="createTime" id="editTime-CoreCmsPlanOrder-createTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="璇疯緭鍏ュ缓绔嬫椂闂�" lay-reqText="璇疯緭鍏ュ缓绔嬫椂闂�" value="{{d.params.data.createTime || '' }}"/> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="upDataTime" class="layui-form-label layui-form-required">淇敼鏃堕棿</label> <div class="layui-input-block"> <input name="upDataTime" id="editTime-CoreCmsPlanOrder-upDataTime" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="璇疯緭鍏ヤ慨鏀规椂闂�" lay-reqText="璇疯緭鍏ヤ慨鏀规椂闂�" value="{{d.params.data.upDataTime || '' }}"/> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="createBy" class="layui-form-label layui-form-required">鍒涘缓浜�</label> <div class="layui-input-block"> <input name="createBy" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ュ垱寤轰汉" lay-reqText="璇疯緭鍏ュ垱寤轰汉" value="{{d.params.data.createBy || '' }}" /> </div> </div> - - <div class="layui-form-item"> + + <div class="layui-form-item"> <label for="upDataBy" class="layui-form-label layui-form-required">淇敼浜�</label> <div class="layui-input-block"> <input name="upDataBy" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="璇疯緭鍏ヤ慨鏀逛汉" lay-reqText="璇疯緭鍏ヤ慨鏀逛汉" value="{{d.params.data.upDataBy || '' }}" /> </div> </div> - - <div class="layui-form-item" pane> + + <div class="layui-form-item" pane> <label for="isdelete" class="layui-form-label layui-form-required">鍒犻櫎鏍囧織</label> <div class="layui-input-block"> <input type="checkbox" lay-filter="switch" name="isdelete" {{ d.params.data.isdelete ? 'checked' : '' }} lay-skin="switch" lay-text="寮�鍚瘄鍏抽棴"> </div> - </div> - + </div>--> + <div class="layui-form-item text-right core-hidden"> <input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsPlanOrder-editForm-submit" id="LAY-app-CoreCmsPlanOrder-editForm-submit" value="纭缂栬緫"> </div> </div> + + </script> <script> + + function changenum(index) { + //alert($("input[name='itemNumarray']:eq(" + index + ")").val()); + + //alert($("input[name='price']:eq(" + index + ")").val()); + + + //alert($("input[name='amount']:eq(" + index + ")").val()); + + //alert($('#oldOrderAmount').val()); + //alert($('#orderAmount').val()); + //alert($('#keYongAmount').val()); + + + var itemNumarray = $("input[name='itemNumarray']:eq(" + index + ")").val(); + var price = $("input[name='price']:eq(" + index + ")").val(); + + + + $("input[name='amount']:eq(" + index + ")").val((itemNumarray * price).toFixed(2)); + + + var zongjia = 0; + + for (v = 0; v < $("input[name='amount']").size(); v++) { + + zongjia = zongjia + parseFloat($("input[name='amount']:eq(" + v + ")").val()); + + + } + + $('#orderAmount').val(zongjia); + + + + var yue = (parseFloat($('#oldOrderAmount').val()) - zongjia).toFixed(2); + $('#keYongAmount').val(yue); + + + if (yue < 0) { + layer.msg("璁㈠崟閲戦瓒呭嚭璁″垝閲戦"); + } + + } + var debug= layui.setter.debug; layui.data.sendParams = function (d) { //寮�鍚皟璇曟儏鍐典笅鑾峰彇鎺ュ彛璧嬪�兼暟鎹� @@ -119,16 +355,7 @@ , cropperImg = layui.cropperImg , coreHelper = layui.coreHelper; - laydate.render({ - elem: '#editTime-CoreCmsPlanOrder-createTime', - type: 'datetime', - fullPanel: true - }); - laydate.render({ - elem: '#editTime-CoreCmsPlanOrder-upDataTime', - type: 'datetime', - fullPanel: true - }); + form.verify({ }); diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/index.html index 3286391..1646ddf 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/corecmsplanorder/index.html @@ -33,24 +33,47 @@ <input type="text" name="orderAmount" placeholder="璇疯緭鍏ヨ皟鏁磋鍗曢噾棰�" class="layui-input"> </div> </div>--> - + <div class="layui-inline"> <label class="layui-form-label" for="status">璁㈠崟鐘舵��</label> - <div class="layui-input-inline"> - <select name="status"> - <option value="">璇烽�夋嫨</option> - <option value="1">鏈彁浜�</option> - <option value="2">宸叉彁浜�</option> - </select> - </div> - </div> + <div class="layui-input-inline"> + <select name="status"> + <option value="">璇烽�夋嫨</option> + <option value="1">鏈彁浜�</option> + <option value="2">宸叉彁浜�</option> + </select> + </div> + </div> <!--<div class="layui-inline"> <label class="layui-form-label" for="userId">鐢ㄦ埛ID 鍏宠仈user.id</label> <div class="layui-input-inline"> <input type="text" name="userId" placeholder="璇疯緭鍏ョ敤鎴稩D 鍏宠仈user.id" class="layui-input"> </div> </div>--> + <div class="layui-inline"> + <label class="layui-form-label" for="shi">甯�</label> + <div class="layui-input-inline"> + <!--<input type="text" name="shi" placeholder="璇疯緭鍏ュ競" class="layui-input">--> + + <select name="shi" id="shi" lay-filter="cityFilter" > + <option value="0">璇烽�夋嫨</option> + {{# layui.each(indexData, function(index, item){ }} + <option value="{{ item.id }}">{{ item.name }}</option> + {{# }); }} + </select> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label" for="quxian">鍖哄幙</label> + <div class="layui-input-inline"> + <!--<input type="text" name="quxian" placeholder="璇疯緭鍏ュ尯鍘�" class="layui-input">--> + <select name="quxian" id="quxian" lay-filter="quxian"> + + + </select> + </div> + </div> <div class="layui-inline"> <label class="layui-form-label" for="shipAddress">瀛︽牎</label> <div class="layui-input-inline"> @@ -67,6 +90,12 @@ <label class="layui-form-label" for="shipMobile">鑱旂郴鐢佃瘽</label> <div class="layui-input-inline"> <input type="text" name="shipMobile" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" class="layui-input"> + </div> + </div> + <div class="layui-inline"> + <label class="layui-form-label" for="shouhuoAddress">鏀惰揣鍦板潃</label> + <div class="layui-input-inline"> + <input type="text" name="shouhuoAddress" placeholder="鏀惰揣鍦板潃" class="layui-input"> </div> </div> <!--<div class="layui-inline"> @@ -135,8 +164,8 @@ <script type="text/html" id="LAY-app-CoreCmsPlanOrder-tableBox-bar"> <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">鏌ョ湅</a> - <!--<a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a> - <a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsPlanOrderTbDelDrop{{d.LAY_INDEX}}" no-shade="true">鍒犻櫎</a>--> + <a class="layui-btn layui-btn-xs" lay-event="edit">缂栬緫</a> + <!--<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsPlanOrderTbDelDrop{{d.LAY_INDEX}}" no-shade="true">鍒犻櫎</a>--> <div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsPlanOrderTbDelDrop{{d.LAY_INDEX}}" style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;"> <div class="dropdown-anchor"></div> @@ -152,6 +181,7 @@ </script> <script> + var indexData; var debug= layui.setter.debug; layui.data.done = function (d) { @@ -181,6 +211,38 @@ //鎵ц閲嶈浇 table.reloadData('LAY-app-CoreCmsPlanOrder-tableBox',{ where: field }); }); + // 鐩戝惉鎻愪氦浜嬩欢 + form.on('select(cityFilter)', function (data) { + var city = $("#shi").val(); + $.ajax({ + type: "GET", + url: layui.setter.apiUrl + 'Api/CoreCmsPlanOrder/GetAreaId?cityid=' + city, + dataType: "json", + global: false, + data: "", + success: function (data) { + console.log(data.data); + var quxian = $("#quxian"); + quxian.find('option').remove(); + var aaa = '<option value="0">璇烽�夋嫨</option>'; + quxian.append(aaa); + if (data.data.length > 0) { + for (var i = 0; i < data.data.length; i++) { + + var o = '<option value="' + data.data[i].id + '" >' + data.data[i].name + '</option>'; + quxian.append(o); + } + // 浣跨敤form.render鏂规硶閲嶆柊娓叉煋select + form.render('select'); + } + }, + error: function () { + + + parent.layer.msg('澶辫触', { icon: 5 }); + } + }); + }); //鏁版嵁缁戝畾 table.render({ elem: '#LAY-app-CoreCmsPlanOrder-tableBox', @@ -199,12 +261,14 @@ [ { type: "checkbox", fixed: "left" }, { field: 'orderId', title: '璁㈠崟鍙�', sort: false,width: 115 }, - - + { field: 'shi', title: '甯�', sort: false, width: 50 }, + { field: 'quxian', title: '鍖哄幙', sort: false, width: 50 }, + { field: 'pianqu', title: '鐗囧尯', sort: false, width: 115 }, /* { field: 'userId', title: '鐢ㄦ埛ID 鍏宠仈user.id', sort: false,width: 105 },*/ - { field: 'shipAddress', title: '瀛︽牎', sort: false,width: 335 }, + { field: 'shipAddress', title: '瀛︽牎', sort: false, width: 115 }, { field: 'shipName', title: '鑱旂郴浜�', sort: false,width: 115 }, - { field: 'shipMobile', title: '鑱旂郴鐢佃瘽', sort: false,width: 115 }, + { field: 'shipMobile', title: '鑱旂郴鐢佃瘽', sort: false, width: 115 }, + { field: 'shouhuoAddress', title: '鏀惰揣鍦板潃', sort: false, width: 115 }, { field: 'oldOrderAmount', title: '璁″垝閲戦', sort: false, width: 115 }, { field: 'orderAmount', title: '璋冩暣閲戦', sort: false, width: 115 }, { field: 'keYongAmount', title: '鍙敤浣欓', sort: false,width: 115 }, @@ -309,7 +373,7 @@ } //鎵ц缂栬緫鎿嶄綔 function doEdit(obj){ - coreHelper.Post("Api/CoreCmsPlanOrder/GetEdit", {id:obj.data.id}, function (e) { + coreHelper.Post("Api/CoreCmsPlanOrder/GetEdit", { id: obj.data.orderId }, function (e) { if (e.code === 0) { admin.popup({ shadeClose: false, @@ -317,15 +381,31 @@ area: ['1200px', '90%'], id: 'LAY-popup-CoreCmsPlanOrder-edit', success: function (layero, index) { - view(this.id).render('base/CoreCmsPlanOrder/edit', { data: e.data }).done(function () { + view(this.id).render('CoreCmsPlanOrder/edit', { data: e.data }).done(function () { //鐩戝惉鎻愪氦 form.on('submit(LAY-app-CoreCmsPlanOrder-editForm-submit)', function(data) { var field = data.field; //鑾峰彇鎻愪氦鐨勫瓧娈� - - field.isdelete = field.isdelete == 'on'; + + //field.isdelete = field.isdelete == 'on'; + delete field["itemNumarray"]; + var newarray = Array(); + for (v = 0; v < $("input[name='itemNumarray']").size(); v++) { + newarray.push($("input[name='itemNumarray']:eq("+v+")").val()) + } + field["itemNumarray"] = newarray; + + + delete field["itemIdarray"]; + var newarray = Array(); + for (v = 0; v < $("input[name='itemIdarray']").size(); v++) { + newarray.push($("input[name='itemIdarray']:eq(" + v + ")").val()) + } + field["itemIdarray"] = newarray; + if (debug) { console.log(field); } //寮�鍚皟璇曡繑鍥炴暟鎹� + console.log(field); //鎻愪氦 Ajax 鎴愬姛鍚庯紝鍏抽棴褰撳墠寮瑰眰骞堕噸杞借〃鏍� coreHelper.Post("Api/CoreCmsPlanOrder/DoEdit", field, function (e) { console.log(e) @@ -340,7 +420,7 @@ }); }) // 绂佹寮圭獥鍑虹幇婊氬姩鏉� - $(layero).children('.layui-layer-content').css('overflow', 'visible'); + /* $(layero).children('.layui-layer-content').css('overflow', 'visible');*/ } , btn: ['纭畾', '鍙栨秷'] , yes: function (index, layero) { @@ -366,7 +446,7 @@ form.render(); }); // 绂佹寮圭獥鍑虹幇婊氬姩鏉� - $(layero).children('.layui-layer-content').css('overflow', 'visible'); + /* $(layero).children('.layui-layer-content').css('overflow', 'visible');*/ } }); } else { @@ -486,6 +566,10 @@ form.render(); }); }; + + + + </script> <!--璁剧疆鍒犻櫎鏍囧織--> diff --git a/CoreCms.Net.Web.WebApi/Controllers/OrderController.cs b/CoreCms.Net.Web.WebApi/Controllers/OrderController.cs index fb89f0c..2d20428 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/OrderController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/OrderController.cs @@ -417,7 +417,7 @@ //鑾峰彇鐩稿叧鐘舵�佹弿杩拌鏄庤浆鎹� model.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(model.status); - var modelItem = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id, p => p.specification, OrderByType.Asc); + var modelItem = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == false, p => p.specification, OrderByType.Asc); jm.code = 0; jm.status = true; -- Gitblit v1.9.1