【新增】后台分销商列表,增加申请分销的用户等级展示及等级筛选功能。
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using CoreCms.Net.Model.Entities;
|
using CoreCms.Net.Model.Entities;
|
||||||
using CoreCms.Net.Model.ViewModels.Basics;
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
|
||||||
namespace CoreCms.Net.IRepository
|
namespace CoreCms.Net.IRepository
|
||||||
@@ -34,5 +35,23 @@ namespace CoreCms.Net.IRepository
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IPageList<DistributionRankingDTO>> QueryRankingPageAsync(int pageIndex = 1, int pageSize = 20);
|
Task<IPageList<DistributionRankingDTO>> QueryRankingPageAsync(int pageIndex = 1, int pageSize = 20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
new Task<IPageList<CoreCmsDistribution>> QueryPageAsync(
|
||||||
|
Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsDistribution, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,15 @@
|
|||||||
* Description: 暂无
|
* Description: 暂无
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CoreCms.Net.Model.Entities;
|
using CoreCms.Net.Model.Entities;
|
||||||
using CoreCms.Net.Model.ViewModels.Basics;
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
using CoreCms.Net.Model.ViewModels.UI;
|
|
||||||
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace CoreCms.Net.IServices
|
namespace CoreCms.Net.IServices
|
||||||
{
|
{
|
||||||
@@ -85,5 +88,24 @@ namespace CoreCms.Net.IServices
|
|||||||
/// <param name="pageSize">分布大小</param>
|
/// <param name="pageSize">分布大小</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IPageList<DistributionRankingDTO>> QueryRankingPageAsync(int pageIndex = 1, int pageSize = 20);
|
Task<IPageList<DistributionRankingDTO>> QueryRankingPageAsync(int pageIndex = 1, int pageSize = 20);
|
||||||
|
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
new Task<IPageList<CoreCmsDistribution>> QueryPageAsync(
|
||||||
|
Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsDistribution, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false);
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,5 +124,15 @@ namespace CoreCms.Net.Model.Entities
|
|||||||
[Display(Name = "店铺查询交互数据")]
|
[Display(Name = "店铺查询交互数据")]
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string Store { get; set; } = "";
|
public string Store { get; set; } = "";
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户等级
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "用户等级")]
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public int UserGradeId { get; set; } = 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,87 @@ namespace CoreCms.Net.Repository
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public new async Task<IPageList<CoreCmsDistribution>> QueryPageAsync(Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsDistribution, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false)
|
||||||
|
{
|
||||||
|
RefAsync<int> totalCount = 0;
|
||||||
|
List<CoreCmsDistribution> page;
|
||||||
|
if (blUseNoLock)
|
||||||
|
{
|
||||||
|
page = await DbClient.Queryable<CoreCmsDistribution>()
|
||||||
|
.Select(p => new CoreCmsDistribution
|
||||||
|
{
|
||||||
|
id = p.id,
|
||||||
|
userId = p.userId,
|
||||||
|
name = p.name,
|
||||||
|
gradeId = p.gradeId,
|
||||||
|
mobile = p.mobile,
|
||||||
|
weixin = p.weixin,
|
||||||
|
qq = p.qq,
|
||||||
|
storeName = p.storeName,
|
||||||
|
storeLogo = p.storeLogo,
|
||||||
|
storeBanner = p.storeBanner,
|
||||||
|
storeDesc = p.storeDesc,
|
||||||
|
verifyStatus = p.verifyStatus,
|
||||||
|
createTime = p.createTime,
|
||||||
|
updateTime = p.updateTime,
|
||||||
|
verifyTime = p.verifyTime,
|
||||||
|
isDelete = p.isDelete,
|
||||||
|
UserGradeId = SqlFunc.Subqueryable<CoreCmsUser>().Where(o => o.id == p.userId).Select(p => p.grade)
|
||||||
|
|
||||||
|
})
|
||||||
|
.MergeTable()
|
||||||
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page = await DbClient.Queryable<CoreCmsDistribution>()
|
||||||
|
.Select(p => new CoreCmsDistribution
|
||||||
|
{
|
||||||
|
id = p.id,
|
||||||
|
userId = p.userId,
|
||||||
|
name = p.name,
|
||||||
|
gradeId = p.gradeId,
|
||||||
|
mobile = p.mobile,
|
||||||
|
weixin = p.weixin,
|
||||||
|
qq = p.qq,
|
||||||
|
storeName = p.storeName,
|
||||||
|
storeLogo = p.storeLogo,
|
||||||
|
storeBanner = p.storeBanner,
|
||||||
|
storeDesc = p.storeDesc,
|
||||||
|
verifyStatus = p.verifyStatus,
|
||||||
|
createTime = p.createTime,
|
||||||
|
updateTime = p.updateTime,
|
||||||
|
verifyTime = p.verifyTime,
|
||||||
|
isDelete = p.isDelete,
|
||||||
|
UserGradeId = SqlFunc.Subqueryable<CoreCmsUser>().Where(o => o.id == p.userId).Select(p => p.grade)
|
||||||
|
})
|
||||||
|
.MergeTable()
|
||||||
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
|
.WhereIF(predicate != null, predicate)
|
||||||
|
.ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||||
|
}
|
||||||
|
var list = new PageList<CoreCmsDistribution>(page, pageIndex, pageSize, totalCount);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CoreCms.Net.Configuration;
|
using CoreCms.Net.Configuration;
|
||||||
using CoreCms.Net.IRepository;
|
using CoreCms.Net.IRepository;
|
||||||
@@ -19,12 +20,13 @@ using CoreCms.Net.IServices;
|
|||||||
using CoreCms.Net.Loging;
|
using CoreCms.Net.Loging;
|
||||||
using CoreCms.Net.Model.Entities;
|
using CoreCms.Net.Model.Entities;
|
||||||
using CoreCms.Net.Model.ViewModels.Basics;
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
using CoreCms.Net.Model.ViewModels.UI;
|
|
||||||
using CoreCms.Net.Model.ViewModels.DTO;
|
using CoreCms.Net.Model.ViewModels.DTO;
|
||||||
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
using CoreCms.Net.Model.ViewModels.DTO.Distribution;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
using CoreCms.Net.Utility.Extensions;
|
using CoreCms.Net.Utility.Extensions;
|
||||||
using CoreCms.Net.Utility.Helper;
|
using CoreCms.Net.Utility.Helper;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
|
||||||
namespace CoreCms.Net.Services
|
namespace CoreCms.Net.Services
|
||||||
@@ -93,6 +95,7 @@ namespace CoreCms.Net.Services
|
|||||||
//本月第一天时间
|
//本月第一天时间
|
||||||
DateTime dtFirst = dt.AddDays(1 - (dt.Day));
|
DateTime dtFirst = dt.AddDays(1 - (dt.Day));
|
||||||
dtFirst = new DateTime(dtFirst.Year, dtFirst.Month, dtFirst.Day, 0, 0, 0);
|
dtFirst = new DateTime(dtFirst.Year, dtFirst.Month, dtFirst.Day, 0, 0, 0);
|
||||||
|
|
||||||
//获得某年某月的天数
|
//获得某年某月的天数
|
||||||
int year = dt.Year;
|
int year = dt.Year;
|
||||||
int month = dt.Month;
|
int month = dt.Month;
|
||||||
@@ -510,7 +513,7 @@ namespace CoreCms.Net.Services
|
|||||||
var jm = new AdminUiCallBack();
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
var info = await _dal.QueryByClauseAsync(p => p.userId == userId);
|
var info = await _dal.QueryByClauseAsync(p => p.userId == userId);
|
||||||
if (info != null && info.gradeId > 0)
|
if (info is { gradeId: > 0 })
|
||||||
{
|
{
|
||||||
//找下有没有可以升级的分销商等级
|
//找下有没有可以升级的分销商等级
|
||||||
var grade = await _distributionGradeRepository.QueryByClauseAsync(p => p.id > info.gradeId && p.isAutoUpGrade == true);
|
var grade = await _distributionGradeRepository.QueryByClauseAsync(p => p.id > info.gradeId && p.isAutoUpGrade == true);
|
||||||
@@ -554,5 +557,26 @@ namespace CoreCms.Net.Services
|
|||||||
return await _dal.QueryRankingPageAsync(pageIndex, pageSize);
|
return await _dal.QueryRankingPageAsync(pageIndex, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public new async Task<IPageList<CoreCmsDistribution>> QueryPageAsync(Expression<Func<CoreCmsDistribution, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsDistribution, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false)
|
||||||
|
{
|
||||||
|
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
//分销等级 int
|
//分销等级 int
|
||||||
var gradeId = Request.Form["gradeId"].FirstOrDefault().ObjectToInt(0);
|
var gradeId = Request.Form["gradeId"].FirstOrDefault().ObjectToInt(0);
|
||||||
if (gradeId > 0) where = where.And(p => p.gradeId == gradeId);
|
if (gradeId > 0) where = where.And(p => p.gradeId == gradeId);
|
||||||
|
//用户等级 int
|
||||||
|
var userGradeId = Request.Form["userGradeId"].FirstOrDefault().ObjectToInt(0);
|
||||||
|
if (userGradeId > 0) where = where.And(p => p.UserGradeId == userGradeId);
|
||||||
//手机号 nvarchar
|
//手机号 nvarchar
|
||||||
var mobile = Request.Form["mobile"].FirstOrDefault();
|
var mobile = Request.Form["mobile"].FirstOrDefault();
|
||||||
if (!string.IsNullOrEmpty(mobile)) where = where.And(p => p.mobile.Contains(mobile));
|
if (!string.IsNullOrEmpty(mobile)) where = where.And(p => p.mobile.Contains(mobile));
|
||||||
@@ -232,10 +235,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
|||||||
var jm = new AdminUiCallBack { code = 0 };
|
var jm = new AdminUiCallBack { code = 0 };
|
||||||
var distributionVerifyStatus = EnumHelper.EnumToList<GlobalEnumVars.DistributionVerifyStatus>();
|
var distributionVerifyStatus = EnumHelper.EnumToList<GlobalEnumVars.DistributionVerifyStatus>();
|
||||||
var grades = await _distributionGradeServices.GetCaChe();
|
var grades = await _distributionGradeServices.GetCaChe();
|
||||||
|
var userGrades = await _userGradeServices.QueryAsync();
|
||||||
jm.data = new
|
jm.data = new
|
||||||
{
|
{
|
||||||
distributionVerifyStatus,
|
distributionVerifyStatus,
|
||||||
grades
|
grades,
|
||||||
|
userGrades
|
||||||
};
|
};
|
||||||
|
|
||||||
return jm;
|
return jm;
|
||||||
|
|||||||
@@ -68,6 +68,16 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="userGradeId">
|
||||||
|
<option value="">请选择用户等级</option>
|
||||||
|
{{# layui.each(indexData.userGrades, function(index, item){ }}
|
||||||
|
<option value="{{ item.id }}">{{ item.title }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsDistribution-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsDistribution-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||||
@@ -135,9 +145,18 @@
|
|||||||
//{ type: "checkbox", fixed: "left" },
|
//{ type: "checkbox", fixed: "left" },
|
||||||
{ field: 'id', title: '序列', width: 60, sort: false },
|
{ field: 'id', title: '序列', width: 60, sort: false },
|
||||||
{ field: 'userId', title: '用户序列', sort: false, width: 65 },
|
{ field: 'userId', title: '用户序列', sort: false, width: 65 },
|
||||||
|
{
|
||||||
|
field: 'userGradeId', title: '用户等级', sort: false, width: 90, templet: function (data) {
|
||||||
|
for (var i = 0; i < d.data.grades.length; i++) {
|
||||||
|
if (d.data.userGrades[i].id == data.userGradeId) {
|
||||||
|
return d.data.userGrades[i].title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{ field: 'name', title: '分销商名称', sort: false, width: 105 },
|
{ field: 'name', title: '分销商名称', sort: false, width: 105 },
|
||||||
{
|
{
|
||||||
field: 'gradeId', title: '分销等级', sort: false, width: 65, templet: function (data) {
|
field: 'gradeId', title: '分销等级', sort: false, width: 90, templet: function (data) {
|
||||||
for (var i = 0; i < d.data.grades.length; i++) {
|
for (var i = 0; i < d.data.grades.length; i++) {
|
||||||
if (d.data.grades[i].id == data.gradeId) {
|
if (d.data.grades[i].id == data.gradeId) {
|
||||||
return d.data.grades[i].name;
|
return d.data.grades[i].name;
|
||||||
@@ -146,8 +165,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
//{ field: 'gradeId', title: '分销等级', sort: false, width: 105 },
|
//{ field: 'gradeId', title: '分销等级', sort: false, width: 105 },
|
||||||
{ field: 'mobile', title: '手机号', sort: false, width: 90 },
|
{ field: 'mobile', title: '手机号', sort: false, width: 100 },
|
||||||
{ field: 'weixin', title: '微信号', sort: false, width: 90 },
|
{ field: 'weixin', title: '微信号', sort: false, width: 100 },
|
||||||
{ field: 'qq', title: 'qq号', sort: false, width: 90 },
|
{ field: 'qq', title: 'qq号', sort: false, width: 90 },
|
||||||
{ field: 'storeName', title: '店铺名称', sort: false },
|
{ field: 'storeName', title: '店铺名称', sort: false },
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user