diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsAreaServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsAreaServices.cs index fbe8d695..def332db 100644 --- a/CoreCms.Net.IServices/Shop/ICoreCmsAreaServices.cs +++ b/CoreCms.Net.IServices/Shop/ICoreCmsAreaServices.cs @@ -40,11 +40,14 @@ namespace CoreCms.Net.IServices /// 获取最终地区ID /// /// 省 + /// 省序列 /// 市 + /// 市序列 /// 县 + /// 县序列 /// 邮编 /// - Task GetThreeAreaId(string provinceName, string cityName, string countyName, string postalCode); + Task GetThreeAreaId(string provinceName, int provinceId, string cityName, int cityId, string countyName, int countyId, string postalCode); /// /// 根据areaId获取三级区域名称 @@ -64,11 +67,14 @@ namespace CoreCms.Net.IServices /// 获取最终地区ID /// /// 省 + /// 省序列 /// 市 + /// 市序列 /// 县 + /// 县序列 /// 邮编 /// - Task GetAreaId(string provinceName, string cityName, string countyName, string postalCode); + Task GetAreaId(string provinceName, int provinceId, string cityName, int cityId, string countyName, int countyId, string postalCode); #region 重写增删改查操作=========================================================== diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml index 46cf11ce..52d41244 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.xml +++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml @@ -12303,16 +12303,31 @@ 市/区 + + + 市区序列号 + + + + + 县序列 + + + + + 省序列 + + 邮编 diff --git a/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs b/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs index 0612bdcd..584e0a55 100644 --- a/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs +++ b/CoreCms.Net.Model/ViewModels/DTO/UserDto.cs @@ -21,7 +21,7 @@ namespace CoreCms.Net.Model.ViewModels.DTO { public int availablePoint { get; set; } = 0; public decimal pointExchangeMoney { get; set; } = 0; - + public int @switch { get; set; } = 1; public int point { get; set; } = 0; @@ -75,16 +75,32 @@ namespace CoreCms.Net.Model.ViewModels.DTO /// public string cityName { get; set; } + /// + /// 市区序列号 + /// + public int cityId { get; set; } + /// /// 县 /// public string countyName { get; set; } + /// + /// 县序列 + /// + public int countyId { get; set; } + + /// /// 省 /// public string provinceName { get; set; } + /// + /// 省序列 + /// + public int provinceId { get; set; } + /// /// 邮编 /// diff --git a/CoreCms.Net.Services/Shop/CoreCmsAreaServices.cs b/CoreCms.Net.Services/Shop/CoreCmsAreaServices.cs index 5b1849c8..9e8bdcee 100644 --- a/CoreCms.Net.Services/Shop/CoreCmsAreaServices.cs +++ b/CoreCms.Net.Services/Shop/CoreCmsAreaServices.cs @@ -299,11 +299,14 @@ namespace CoreCms.Net.Services.Basic /// 获取最终地区ID /// /// 省 + /// 省序列 /// 市 + /// 市序列 /// 县 + /// 县序列 /// 邮编 /// - public async Task GetAreaId(string provinceName, string cityName, string countyName, string postalCode) + public async Task GetAreaId(string provinceName, int provinceId, string cityName, int cityId, string countyName, int countyId, string postalCode) { var jm = new WebApiCallBack(); @@ -313,10 +316,12 @@ namespace CoreCms.Net.Services.Basic return jm; } + var areaId = await GetThreeAreaId(provinceName, provinceId, cityName, cityId, countyName, countyId, postalCode); + jm = new WebApiCallBack { - status = true, - data = await GetThreeAreaId(provinceName, cityName, countyName, postalCode) + status = areaId > 0, + data = areaId }; return jm; } @@ -325,109 +330,32 @@ namespace CoreCms.Net.Services.Basic /// 获取最终地区ID /// /// 省 + /// 省序列 /// 市 + /// 市序列 /// 县 + /// 县序列 /// 邮编 /// - public async Task GetThreeAreaId(string provinceName, string cityName, string countyName, string postalCode) + public async Task GetThreeAreaId(string provinceName, int provinceId, string cityName, int cityId, string countyName, int countyId, string postalCode) { var areaData = await GetCaChe(); var id = 0; - var countyList = areaData.Where(p => p.depth == (int)GlobalEnumVars.AreaDepth.County && p.name == countyName).ToList(); - if (countyList.Any()) + //获取县 + var county = areaData.FirstOrDefault(p => p.depth == (int)GlobalEnumVars.AreaDepth.County && p.name == countyName && p.id == countyId); + //获取市 + var city = areaData.FirstOrDefault(p => p.depth == (int)GlobalEnumVars.AreaDepth.City && p.name == cityName && p.id == cityId); + //获取省 + var province = areaData.FirstOrDefault(p => p.depth == (int)GlobalEnumVars.AreaDepth.Province && p.name == provinceName && p.id == provinceId); + + //必须三个都满足,证明才正常 + if (province != null && city != null && county != null) { - if (countyList.Count > 1) - { - var cityModel = areaData.Find(p => p.depth == (int)GlobalEnumVars.AreaDepth.City && p.name == cityName); - if (cityModel != null) - { - //foreach (var item in countyList) - //{ - // if (item.parentId == cityModel.id) - // { - // id = item.id; - // } - //} - var result = countyList.Find(p => p.parentId == cityModel.id); - return result?.id ?? 0; - } - } - else - { - id = countyList[0].id; - } + id = county.id; } else { - //var cityModel = areaData.Find(p => p.depth == (int)GlobalEnumVars.AreaDepth.City && p.name == cityName); - //if (cityModel != null) - //{ - // //创建区域 - // var area = new CoreCmsArea(); - // area.depth = (int)GlobalEnumVars.AreaDepth.County; - // area.name = countyName; - // area.postalCode = postalCode; - // area.parentId = cityModel.id; - // area.sort = 100; - // id = await base.InsertAsync(area); - - // await UpdateCaChe(); - - //} - //else - //{ - // var province = areaData.Find(p => p.depth == (int)GlobalEnumVars.AreaDepth.Province && p.name == provinceName); - // if (province != null) - // { - // //创建城市 - // var areaCity = new CoreCmsArea(); - // areaCity.depth = (int)GlobalEnumVars.AreaDepth.City; - // areaCity.name = cityName; - // //areaCity.postalCode = postalCode; - // areaCity.parentId = province.id; - // areaCity.sort = 100; - // var cityId = await base.InsertAsync(areaCity); - - // //创建区域 - // var areaCounty = new CoreCmsArea(); - // areaCounty.depth = (int)GlobalEnumVars.AreaDepth.County; - // areaCounty.name = countyName; - // areaCounty.postalCode = postalCode; - // areaCounty.parentId = cityId; - // areaCounty.sort = 100; - // id = await base.InsertAsync(areaCounty); - // } - // else - // { - // //创建省 - // var areaProvince = new CoreCmsArea(); - // areaProvince.depth = (int)GlobalEnumVars.AreaDepth.Province; - // areaProvince.name = cityName; - // //areaCity.postalCode = postalCode; - // areaProvince.parentId = (int)GlobalEnumVars.AreaDepth.ProvinceParentId; - // areaProvince.sort = 100; - // var provinceId = await base.InsertAsync(areaProvince); - - // //创建城市 - // var areaCity = new CoreCmsArea(); - // areaCity.depth = (int)GlobalEnumVars.AreaDepth.City; - // areaCity.name = cityName; - // //areaCity.postalCode = postalCode; - // areaCity.parentId = provinceId; - // areaCity.sort = 100; - // var cityId = await base.InsertAsync(areaCity); - - // //创建区域 - // var areaCounty = new CoreCmsArea(); - // areaCounty.depth = (int)GlobalEnumVars.AreaDepth.County; - // areaCounty.name = countyName; - // areaCounty.postalCode = postalCode; - // areaCounty.parentId = cityId; - // areaCounty.sort = 100; - // id = await base.InsertAsync(areaCounty); - // } - // await UpdateCaChe(); - //} + id = 0; } return id; diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue index e786c2b1..b9dfae21 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/address/index/index.vue @@ -256,15 +256,18 @@ export default { // #endif }, onConfirm(e) { - console.log(e); + //console.log(e); let provinceName = e[0].label; let cityName = e[1].label; let countyName = e[2].label; this.pickerValue = e[0].label + " " + e[1].label + " " + e[2].label let data = { provinceName: provinceName, + provinceId: e[0].value, cityName: cityName, - countyName: countyName + cityId: e[1].value, + countyName: countyName, + countyId: e[2].value, } this.$u.api.getAreaId(data).then(res => { if (res.status) { diff --git a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml index 5fbe58f7..9f3fce93 100644 --- a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml +++ b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml @@ -2677,6 +2677,13 @@ + + + 取消订单并退款 + + + + 批量删除订单 diff --git a/CoreCms.Net.Web.Admin/NLog.config b/CoreCms.Net.Web.Admin/NLog.config index eca2cace..42eb752b 100644 --- a/CoreCms.Net.Web.Admin/NLog.config +++ b/CoreCms.Net.Web.Admin/NLog.config @@ -14,7 +14,7 @@ dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456" --> - + INSERT INTO SysNLogRecords (LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs index bf9ab583..ab32041a 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs @@ -860,7 +860,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers [HttpPost] public async Task GetAreaId([FromBody] GetAreaIdPost entity) { - var jm = await _areaServices.GetAreaId(entity.provinceName, entity.cityName, entity.countyName, entity.postalCode); + var jm = await _areaServices.GetAreaId(entity.provinceName, entity.provinceId, entity.cityName, entity.cityId, entity.countyName, entity.countyId, entity.postalCode); return jm; }