From 0422df5552adc1b31d5e4d0567d6daca815c8a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=81=B0=E7=81=B0?= Date: Sat, 3 Dec 2022 01:44:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E6=95=B4=E3=80=91=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E5=90=8E=E5=8F=B0=E8=AE=BE=E7=BD=AE=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=BB=91=E5=AE=9A=E6=89=8B=E6=9C=BA=E5=8F=B7?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E8=AE=BE=E7=BD=AE=E3=80=82=20=E3=80=90?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=91=E6=96=B0=E5=A2=9E=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=89=8D=E7=AB=AF=E5=95=86=E5=AE=B6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=95=86?= =?UTF-8?q?=E5=AE=B6=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AF=E4=BB=A5=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=95=86=E5=AE=B6=E4=B8=AD=E5=BF=83=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=89=80=E6=9C=89=E4=BF=A1=E6=81=AF=E3=80=82=20=E3=80=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=91=E5=95=86=E5=AE=B6=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=8C=89=E9=97=A8=E5=BA=97=E8=BF=9B=E8=A1=8C=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E8=B4=A7=E5=8D=95=EF=BC=8C=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=88=B8=EF=BC=8C=E8=AE=A2=E5=8D=95=E7=AD=89=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=8F=AA=E8=83=BD=E5=A4=84=E7=90=86=E6=9C=AC?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E4=B8=9A=E5=8A=A1=E5=8F=8A=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=9B=B8=E5=BA=94=E6=95=B0=E6=8D=AE=E3=80=82=20=E3=80=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=91=E5=90=8E=E5=8F=B0=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A7=BB=E9=99=A4=E3=80=90=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E3=80=91tab=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E3=80=90=E5=95=86=E5=AE=B6=E8=AE=BE=E7=BD=AE=E3=80=91tab?= =?UTF-8?q?=EF=BC=8C=E5=B0=86=E5=95=86=E5=AE=B6=E7=9B=B8=E5=85=B3=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=BD=92=E9=9B=86=E5=88=B0=E4=B8=80=E8=B5=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SystemSettingConstVars.cs | 12 +- .../SystemSettingDictionary.cs | 17 +- .../Shop/ICoreCmsStoreRepository.cs | 3 +- .../Bill/ICoreCmsBillLadingServices.cs | 2 +- ...erServicesTicketVerificationLogServices.cs | 2 +- .../Shop/ICoreCmsClerkServices.cs | 2 +- .../Shop/ICoreCmsStoreServices.cs | 3 +- .../Shop/CoreCmsStoreRepository.cs | 7 +- .../Bill/CoreCmsBillLadingServices.cs | 74 +++++++-- ...erServicesTicketVerificationLogServices.cs | 43 +++++- .../Shop/CoreCmsClerkServices.cs | 36 +++-- .../Shop/CoreCmsStoreServices.cs | 5 +- .../CoreShop/common/request/http.api.js | 3 + .../CoreShop/pages/index/member/member.vue | 31 +++- .../pages/member/merchant/detail/detail.vue | 5 +- .../pages/member/merchant/index/index.vue | 56 ++++--- .../pages/member/merchant/search/index.vue | 4 +- .../merchant/serviceVerification/list.vue | 9 +- .../member/merchant/storeList/storeList.vue | 35 +++-- .../member/merchant/takeDelivery/list.vue | 11 +- .../wwwroot/views/shop/setting/index.html | 84 +++++----- .../Controllers/OrderController.cs | 24 ++- .../Controllers/ServiceController.cs | 42 ++--- .../Controllers/StoreController.cs | 145 ++++++++++++++++-- 24 files changed, 471 insertions(+), 184 deletions(-) diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs index 4d1f82bb..54959b54 100644 --- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs +++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs @@ -56,6 +56,11 @@ namespace CoreCms.Net.Configuration /// public const string ShopMobile = "shopMobile"; + /// + /// 商家管理员手机号 + /// + public const string ShopManagerMobile = "shopManagerMobile"; + /// /// 开启门店自提 /// @@ -469,13 +474,6 @@ namespace CoreCms.Net.Configuration public const string InvoiceSwitch = "invoiceSwitch"; - //第三方的登陆的时候,是否需要绑定手机号码,强烈建议用户开启,除非只在微信小程序内使用============================================================================ - //1绑定,2不绑定 - /// - /// 绑定手机号码 - /// - public const string IsBindMobile = "isBindMobile"; - //支付宝小程序appid============================================================================ /// diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs index 6e70bc03..94f494c5 100644 --- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs +++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs @@ -72,10 +72,15 @@ namespace CoreCms.Net.Configuration di.Add(SystemSettingConstVars.ShareTitle, new DictionaryKeyValues() { sKey = "分享标题", sValue = "优质好店邀您共享" }); di.Add(SystemSettingConstVars.ShareDesc, new DictionaryKeyValues() { sKey = "分享描述", sValue = "" }); - //会员设置 + //商家信息 di.Add(SystemSettingConstVars.ShopMobile, new DictionaryKeyValues() { sKey = "商家手机号", sValue = "" }); - //1绑定,2不绑定-第三方的登陆的时候,是否需要绑定手机号码,强烈建议用户开启,除非只在微信小程序内使用 - di.Add(SystemSettingConstVars.IsBindMobile, new DictionaryKeyValues() { sKey = "绑定手机号码", sValue = "1" }); + di.Add(SystemSettingConstVars.ShopManagerMobile, new DictionaryKeyValues() { sKey = "商家管理员手机号", sValue = "" }); + di.Add(SystemSettingConstVars.ReshipName, new DictionaryKeyValues() { sKey = "退货联系人", sValue = "" }); + di.Add(SystemSettingConstVars.ReshipMobile, new DictionaryKeyValues() { sKey = "退货联系方式", sValue = "" }); + di.Add(SystemSettingConstVars.ReshipAreaId, new DictionaryKeyValues() { sKey = "商家区域", sValue = "" }); + di.Add(SystemSettingConstVars.ReshipAddress, new DictionaryKeyValues() { sKey = "商家详细地址", sValue = "" }); + di.Add(SystemSettingConstVars.ReshipCoordinate, new DictionaryKeyValues() { sKey = "商家坐标", sValue = "" }); + //商品设置 di.Add(SystemSettingConstVars.GoodsStocksWarn, new DictionaryKeyValues() { sKey = "库存警报数量", sValue = "10" }); @@ -85,11 +90,7 @@ namespace CoreCms.Net.Configuration di.Add(SystemSettingConstVars.OrderAutoSignTime, new DictionaryKeyValues() { sKey = "订单确认收货时间", sValue = "20" }); di.Add(SystemSettingConstVars.OrderAutoEvalTime, new DictionaryKeyValues() { sKey = "订单自动评价时间", sValue = "30" }); di.Add(SystemSettingConstVars.RemindOrderTime, new DictionaryKeyValues() { sKey = "订单提醒付款时间", sValue = "1" }); - di.Add(SystemSettingConstVars.ReshipName, new DictionaryKeyValues() { sKey = "商家联系人", sValue = "" }); - di.Add(SystemSettingConstVars.ReshipMobile, new DictionaryKeyValues() { sKey = "商家联系方式", sValue = "" }); - di.Add(SystemSettingConstVars.ReshipAreaId, new DictionaryKeyValues() { sKey = "商家区域", sValue = "" }); - di.Add(SystemSettingConstVars.ReshipAddress, new DictionaryKeyValues() { sKey = "商家详细地址", sValue = "" }); - di.Add(SystemSettingConstVars.ReshipCoordinate, new DictionaryKeyValues() { sKey = "商家坐标", sValue = "" }); + di.Add(SystemSettingConstVars.StoreOrderAutomaticDelivery, new DictionaryKeyValues() { sKey = "门店自提自动发货", sValue = "2" }); diff --git a/CoreCms.Net.IRepository/Shop/ICoreCmsStoreRepository.cs b/CoreCms.Net.IRepository/Shop/ICoreCmsStoreRepository.cs index 7489d86b..ecf26a89 100644 --- a/CoreCms.Net.IRepository/Shop/ICoreCmsStoreRepository.cs +++ b/CoreCms.Net.IRepository/Shop/ICoreCmsStoreRepository.cs @@ -59,8 +59,9 @@ namespace CoreCms.Net.IRepository /// 根据用户序列获取单个门店数据 /// /// 用户序列 + /// 门店序列 /// 是否使用WITH(NOLOCK) /// - Task GetStoreByUserId(int userId, bool blUseNoLock = false); + Task GetStoreByUserId(int userId, int storeId, bool blUseNoLock = false); } } \ No newline at end of file diff --git a/CoreCms.Net.IServices/Bill/ICoreCmsBillLadingServices.cs b/CoreCms.Net.IServices/Bill/ICoreCmsBillLadingServices.cs index 05de5f43..a7d87e79 100644 --- a/CoreCms.Net.IServices/Bill/ICoreCmsBillLadingServices.cs +++ b/CoreCms.Net.IServices/Bill/ICoreCmsBillLadingServices.cs @@ -39,7 +39,7 @@ namespace CoreCms.Net.IServices /// 获取店铺提货单列表 /// /// - Task GetStoreLadingList(int userId, int page, int limit); + Task GetStoreLadingList(int userId, int storeId, int page, int limit); /// diff --git a/CoreCms.Net.IServices/Service/ICoreCmsUserServicesTicketVerificationLogServices.cs b/CoreCms.Net.IServices/Service/ICoreCmsUserServicesTicketVerificationLogServices.cs index 051c361b..a83d7c22 100644 --- a/CoreCms.Net.IServices/Service/ICoreCmsUserServicesTicketVerificationLogServices.cs +++ b/CoreCms.Net.IServices/Service/ICoreCmsUserServicesTicketVerificationLogServices.cs @@ -24,7 +24,7 @@ namespace CoreCms.Net.IServices /// 店铺核销的服务券列表 /// /// - Task GetVerificationLogs(int userId, int page, int limit); + Task GetVerificationLogs(int userId, int storeId, int page, int limit); /// diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsClerkServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsClerkServices.cs index 33e0efa6..53706c06 100644 --- a/CoreCms.Net.IServices/Shop/ICoreCmsClerkServices.cs +++ b/CoreCms.Net.IServices/Shop/ICoreCmsClerkServices.cs @@ -24,7 +24,7 @@ namespace CoreCms.Net.IServices public interface ICoreCmsClerkServices : IBaseServices { /// - /// 判断是不是店员 + /// 判断是否是商家,店员,开启商家中心 /// /// /// diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsStoreServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsStoreServices.cs index 266620a5..6e969575 100644 --- a/CoreCms.Net.IServices/Shop/ICoreCmsStoreServices.cs +++ b/CoreCms.Net.IServices/Shop/ICoreCmsStoreServices.cs @@ -60,8 +60,9 @@ namespace CoreCms.Net.IServices /// 根据用户序列获取单个门店数据 /// /// 用户序列 + /// 门店序列 /// 是否使用WITH(NOLOCK) /// - Task GetStoreByUserId(int userId, bool blUseNoLock = false); + Task GetStoreByUserId(int userId, int storeId, bool blUseNoLock = false); } } \ No newline at end of file diff --git a/CoreCms.Net.Repository/Shop/CoreCmsStoreRepository.cs b/CoreCms.Net.Repository/Shop/CoreCmsStoreRepository.cs index c4c06d26..e53a0d67 100644 --- a/CoreCms.Net.Repository/Shop/CoreCmsStoreRepository.cs +++ b/CoreCms.Net.Repository/Shop/CoreCmsStoreRepository.cs @@ -209,9 +209,10 @@ namespace CoreCms.Net.Repository /// 根据用户序列获取单个门店数据 /// /// 用户序列 + /// 门店序列 /// 是否使用WITH(NOLOCK) /// - public async Task GetStoreByUserId(int userId, bool blUseNoLock = false) + public async Task GetStoreByUserId(int userId, int storeId, bool blUseNoLock = false) { CoreCmsStore obj; if (blUseNoLock) @@ -219,7 +220,7 @@ namespace CoreCms.Net.Repository obj = await DbClient.Queryable((p, clerks) => new JoinQueryInfos( JoinType.Left, p.id == clerks.storeId )) - .Where((p, clerks) => clerks.userId == userId) + .Where((p, clerks) => clerks.userId == userId && p.id == storeId) .Select((p, clerks) => new CoreCmsStore { id = p.id, @@ -243,7 +244,7 @@ namespace CoreCms.Net.Repository obj = await DbClient.Queryable((p, clerks) => new JoinQueryInfos( JoinType.Left, p.id == clerks.storeId )) - .Where((p, clerks) => clerks.userId == userId) + .Where((p, clerks) => clerks.userId == userId && p.id == storeId) .Select((p, clerks) => new CoreCmsStore { id = p.id, diff --git a/CoreCms.Net.Services/Bill/CoreCmsBillLadingServices.cs b/CoreCms.Net.Services/Bill/CoreCmsBillLadingServices.cs index fc9a776d..2ec3773a 100644 --- a/CoreCms.Net.Services/Bill/CoreCmsBillLadingServices.cs +++ b/CoreCms.Net.Services/Bill/CoreCmsBillLadingServices.cs @@ -18,9 +18,12 @@ using CoreCms.Net.IRepository.UnitOfWork; using CoreCms.Net.IServices; using CoreCms.Net.Loging; using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.Entities.Expression; using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Helper; +using Microsoft.Extensions.DependencyInjection; using SqlSugar; +using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinUserInfoBatchGetResponse.Types; namespace CoreCms.Net.Services @@ -36,13 +39,20 @@ namespace CoreCms.Net.Services private readonly ICoreCmsOrderItemRepository _orderItemRepository; private readonly ICoreCmsUserRepository _userRepository; private readonly IUnitOfWork _unitOfWork; - public CoreCmsBillLadingServices(IUnitOfWork unitOfWork, ICoreCmsBillLadingRepository dal, ICoreCmsClerkRepository clerkRepository, ICoreCmsStoreRepository storeRepository, ICoreCmsOrderItemRepository orderItemRepository, ICoreCmsUserRepository userRepository) + private readonly ICoreCmsSettingServices _settingServices; + + private readonly IServiceProvider _serviceProvider; + + + public CoreCmsBillLadingServices(IUnitOfWork unitOfWork, ICoreCmsBillLadingRepository dal, ICoreCmsClerkRepository clerkRepository, ICoreCmsStoreRepository storeRepository, ICoreCmsOrderItemRepository orderItemRepository, ICoreCmsUserRepository userRepository, IServiceProvider serviceProvider, ICoreCmsSettingServices settingServices) { this._dal = dal; _clerkRepository = clerkRepository; _storeRepository = storeRepository; _orderItemRepository = orderItemRepository; _userRepository = userRepository; + _serviceProvider = serviceProvider; + _settingServices = settingServices; base.BaseDal = dal; _unitOfWork = unitOfWork; } @@ -95,13 +105,39 @@ namespace CoreCms.Net.Services /// 获取店铺提货单列表 /// /// - public async Task GetStoreLadingList(int userId, int page, int limit) + public async Task GetStoreLadingList(int userId, int storeId, int page, int limit) { var jm = new WebApiCallBack(); - var clerks = await _clerkRepository.QueryListByClauseAsync(p => p.userId == userId); - var storeIds = clerks.Select(p => p.storeId).ToList(); - var ladingList = await _dal.QueryPageAsync(p => storeIds.Contains(p.storeId) && p.isDel == false, p => p.createTime, OrderByType.Desc, page, limit); + var where = PredicateBuilder.True(); + + using var container = _serviceProvider.CreateScope(); + var _userServices = container.ServiceProvider.GetService(); + + var allConfigs = await _settingServices.GetConfigDictionaries(); + var shopManagerMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopManagerMobile); + + var user = await _userServices.QueryByClauseAsync(p => p.id == userId); + if (user == null) + { + jm.status = false; + jm.msg = "用户获取失败"; + return jm; + } + var isManager = !string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(user.mobile); + if (isManager) + { + where = storeId == 0 ? where.And(p => p.isDel == false) : where.And(p => p.isDel == false && p.storeId == storeId); + } + else + { + where = where.And(p => p.isDel == false && p.storeId == storeId); + //var clerks = await _clerkRepository.QueryListByClauseAsync(p => p.userId == userId); + //var storeIds = clerks.Select(p => p.storeId).ToList(); + //where = where.And(p => storeIds.Contains(p.storeId) && p.isDel == false); + } + + var ladingList = await _dal.QueryPageAsync(where, p => p.createTime, OrderByType.Desc, page, limit); jm.status = true; @@ -186,17 +222,29 @@ namespace CoreCms.Net.Services var data = new List(); if (list != null) { - if (userId > 0) + var userInfo = await _userRepository.QueryByClauseAsync(p => p.id == userId); + if (userInfo != null) { - var clerks = await _clerkRepository.QueryListByClauseAsync(p => p.userId == userId); - if (clerks != null && clerks.Any()) + var allConfigs = await _settingServices.GetConfigDictionaries(); + var shopManagerMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopManagerMobile); + + var isManager = !string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(userInfo.mobile); + if (isManager) { - var storeIds = clerks.Select(p => p.storeId).ToList(); - foreach (var item in list) + data = list; + } + else + { + var clerks = await _clerkRepository.QueryListByClauseAsync(p => p.userId == userId); + if (clerks != null && clerks.Any()) { - if (storeIds.Contains(item.storeId)) + var storeIds = clerks.Select(p => p.storeId).ToList(); + foreach (var item in list) { - data.Add(item); + if (storeIds.Contains(item.storeId)) + { + data.Add(item); + } } } } @@ -209,7 +257,7 @@ namespace CoreCms.Net.Services item.statusName = EnumHelper.GetEnumDescriptionByValue(statusInt); if (item.clerkId > 0) { - var userInfo = await _userRepository.QueryByClauseAsync(p => p.id == userId); + if (userInfo != null) { item.clerkIdName = !string.IsNullOrEmpty(userInfo.nickName) diff --git a/CoreCms.Net.Services/Service/CoreCmsUserServicesTicketVerificationLogServices.cs b/CoreCms.Net.Services/Service/CoreCmsUserServicesTicketVerificationLogServices.cs index c267405b..911390a8 100644 --- a/CoreCms.Net.Services/Service/CoreCmsUserServicesTicketVerificationLogServices.cs +++ b/CoreCms.Net.Services/Service/CoreCmsUserServicesTicketVerificationLogServices.cs @@ -17,8 +17,10 @@ using CoreCms.Net.IRepository.UnitOfWork; using CoreCms.Net.IServices; using CoreCms.Net.Loging; using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.Entities.Expression; using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Helper; +using Microsoft.Extensions.DependencyInjection; using SqlSugar; @@ -33,13 +35,19 @@ namespace CoreCms.Net.Services private readonly ICoreCmsServicesServices _servicesServices; private readonly ICoreCmsUserServicesTicketServices _userServicesTicketServices; private readonly ICoreCmsClerkServices _clerkServices; + private readonly ICoreCmsSettingServices _settingServices; + private readonly IServiceProvider _serviceProvider; + + private readonly IUnitOfWork _unitOfWork; - public CoreCmsUserServicesTicketVerificationLogServices(IUnitOfWork unitOfWork, ICoreCmsUserServicesTicketVerificationLogRepository dal, ICoreCmsClerkServices clerkServices, ICoreCmsServicesServices servicesServices, ICoreCmsUserServicesTicketServices userServicesTicketServices) + public CoreCmsUserServicesTicketVerificationLogServices(IUnitOfWork unitOfWork, ICoreCmsUserServicesTicketVerificationLogRepository dal, ICoreCmsClerkServices clerkServices, ICoreCmsServicesServices servicesServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsSettingServices settingServices, IServiceProvider serviceProvider) { this._dal = dal; _clerkServices = clerkServices; _servicesServices = servicesServices; _userServicesTicketServices = userServicesTicketServices; + _settingServices = settingServices; + _serviceProvider = serviceProvider; base.BaseDal = dal; _unitOfWork = unitOfWork; } @@ -48,18 +56,38 @@ namespace CoreCms.Net.Services /// 店铺核销的服务券列表 /// /// - public async Task GetVerificationLogs(int userId, int page, int limit) + public async Task GetVerificationLogs(int userId, int storeId, int page, int limit) { - var jm = new WebApiCallBack(); + using var container = _serviceProvider.CreateScope(); + var _userServices = container.ServiceProvider.GetService(); - var clerk = await _clerkServices.QueryByClauseAsync(p => p.userId == userId); - if (clerk == null) + var jm = new WebApiCallBack(); + var where = PredicateBuilder.True(); + + var allConfigs = await _settingServices.GetConfigDictionaries(); + var shopManagerMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopManagerMobile); + + var user = await _userServices.QueryByClauseAsync(p => p.id == userId); + if (user == null) { - jm.msg = "未查询到用户门店"; + jm.status = false; + jm.msg = "用户获取失败"; return jm; } + var isManager = !string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(user.mobile); + if (isManager) + { + where = storeId == 0 ? where.And(p => p.isDel == false) : where.And(p => p.isDel == false && p.storeId == storeId); + } + else + { + where = where.And(p => p.isDel == false && p.storeId == storeId); + //var stroes = await _clerkServices.QueryListByClauseAsync(p => p.userId == userId); + //var stroeIds = stroes.Select(p => p.storeId).ToList(); + //where = where.And(p => stroeIds.Contains(p.storeId) && p.isDel == false); + } - var logs = await _dal.QueryPageAsync(p => p.storeId == clerk.storeId && p.isDel == false, p => p.verificationTime, OrderByType.Desc, page, limit); + var logs = await _dal.QueryPageAsync(where, p => p.verificationTime, OrderByType.Desc, page, limit); if (logs != null && logs.Any()) { @@ -78,6 +106,7 @@ namespace CoreCms.Net.Services jm.msg = "获取成功"; } + jm.status = true; jm.data = logs; jm.otherData = new { diff --git a/CoreCms.Net.Services/Shop/CoreCmsClerkServices.cs b/CoreCms.Net.Services/Shop/CoreCmsClerkServices.cs index 37e34959..d2a717af 100644 --- a/CoreCms.Net.Services/Shop/CoreCmsClerkServices.cs +++ b/CoreCms.Net.Services/Shop/CoreCmsClerkServices.cs @@ -23,6 +23,7 @@ using CoreCms.Net.Model.ViewModels.Basics; using CoreCms.Net.Model.ViewModels.UI; using CoreCms.Net.Utility.Extensions; using CoreCms.Net.Utility.Helper; +using Microsoft.IdentityModel.Tokens; using SqlSugar; @@ -49,7 +50,7 @@ namespace CoreCms.Net.Services } /// - /// 判断是不是店员 + /// 判断是否是商家,店员,开启商家中心 /// /// /// @@ -58,21 +59,32 @@ namespace CoreCms.Net.Services var jm = new WebApiCallBack(); var allConfigs = await _settingServices.GetConfigDictionaries(); + var shopManagerMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopManagerMobile); - var storeSwitch = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.StoreSwitch).ObjectToInt(2); - if (storeSwitch == 1) + var user = await _userServices.QueryByClauseAsync(p => p.id == userId); + if (user == null) { - var bl = await base.ExistsAsync(p => p.userId == userId); - jm.status = true; - jm.data = bl; - jm.msg = bl ? "是店员" : "不是店员"; + jm.status = false; + jm.msg = "用户获取失败"; + jm.data = new + { + storeId = 0, + isShopManager = false, + isClerk = false, + }; + return jm; } - else + + var store = await _dal.QueryByClauseAsync(p => p.userId == userId); + jm.status = true; + jm.data = new { - jm.status = true; - jm.data = false; - jm.msg = "未开启到店自提"; - } + storeId = store?.storeId ?? 0, + isShopManager = !string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(user.mobile), + isClerk = store != null || (!string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(user.mobile)), + }; + jm.otherData = store != null || + (!string.IsNullOrEmpty(shopManagerMobile) && shopManagerMobile.Contains(user.mobile)); return jm; } diff --git a/CoreCms.Net.Services/Shop/CoreCmsStoreServices.cs b/CoreCms.Net.Services/Shop/CoreCmsStoreServices.cs index 4bb64d6f..59dea138 100644 --- a/CoreCms.Net.Services/Shop/CoreCmsStoreServices.cs +++ b/CoreCms.Net.Services/Shop/CoreCmsStoreServices.cs @@ -83,11 +83,12 @@ namespace CoreCms.Net.Services /// 根据用户序列获取单个门店数据 /// /// 用户序列 + /// 门店序列 /// 是否使用WITH(NOLOCK) /// - public async Task GetStoreByUserId(int userId, bool blUseNoLock = false) + public async Task GetStoreByUserId(int userId, int storeId, bool blUseNoLock = false) { - return await _dal.GetStoreByUserId(userId, blUseNoLock); + return await _dal.GetStoreByUserId(userId, storeId, blUseNoLock); } } diff --git a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js index 26c03d1e..f7186b31 100644 --- a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js +++ b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js @@ -204,6 +204,8 @@ const install = (Vue, vm) => { let storeList = (params, config = {}) => http.post('/Api/Store/GetStoreList', params, { custom: { methodName: 'store.getstorelist', needToken: false } }); //根据用户序列获取门店数据 let getStoreByUserId = (params, config = {}) => http.post('/Api/Store/GetStoreByUserId', params, { custom: { methodName: 'store.getStoreByUserId', needToken: true } }); + //获取单个用户能管理的门店列表 + let getStoreListForUser = (params, config = {}) => http.post('/Api/Store/GetStoreListForUser', params, { custom: { methodName: 'store.GetStoreListForUser', needToken: true } }); //根据序列获取门店数据 let getStoreById = (params, config = {}) => http.post('/Api/Store/GetStoreById', params, { custom: { methodName: 'store.getStoreByUserId', needToken: false } }); //获取门店订单列表 @@ -500,6 +502,7 @@ const install = (Vue, vm) => { storeList, getStoreByUserId, + getStoreListForUser, getStoreById, getOrderPageByMerchant, getOrderPageByMerchantSearch, diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue index f68878ff..a1477938 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue @@ -149,7 +149,7 @@ - + @@ -227,7 +227,10 @@ data() { return { afterSaleNums: 0, //售后数量 - isClerk: false,//显示商家管理 + isClerk: false,//是否门店人员 + isShopManager: false,//是否商家管理员 + storeId: 0,//关联门店 + isDistribution: false,//显示分销中心 isAgent: false,//显示代理中心 @@ -532,7 +535,9 @@ }) //判断是否是店员 _this.$u.api.isStoreUser().then(res => { - this.isClerk = res.data + this.isClerk = res.data.isClerk; + this.isShopManager = res.data.isShopManager + this.storeId = res.data.storeId; }) } }) @@ -540,13 +545,31 @@ this.hasLogin = false } }, + goMerchant() { + uni.showLoading({ + title: '跳转中...' + }); + if (!this.hasLogin) { + console.log('未登录'); + this.$store.commit('showLoginTip', true); + uni.hideLoading(); + return false; + } + uni.hideLoading(); + this.$u.route({ + url: '/pages/member/merchant/index/index', + params: { + storeId: this.storeId, + isShopManager: this.isShopManager + } + }) + }, navigateToHandle(pageUrl) { uni.showLoading({ title: '跳转中...' }); if (!this.hasLogin) { console.log('未登录'); - //getApp().globalData.showLoginTip = true; this.$store.commit('showLoginTip', true); uni.hideLoading(); return false; diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/member/merchant/detail/detail.vue b/CoreCms.Net.Uni-App/CoreShop/pages/member/merchant/detail/detail.vue index c8976e00..ca00a5b2 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/member/merchant/detail/detail.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/member/merchant/detail/detail.vue @@ -351,11 +351,10 @@ - +