| | |
| | | using System; |
| | | using CoreCms.Net.Model.Entities; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | /// <param name="s"></param> |
| | | /// <returns></returns> |
| | | Task<List<SearchUserData>> SearchUserData(string s); |
| | | |
| | | /// <summary> |
| | | /// 获取商品分类 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | Task<List<CoreCmsGoodsCategory>> GetGoodsCategory(); |
| | | /// <summary> |
| | | /// 检查用户是否是经销商 |
| | | /// </summary> |
| | |
| | | * Description: 暂无 |
| | | ***********************************************************************/ |
| | | |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using SqlSugar; |
| | | |
| | | namespace CoreCms.Net.Model.Entities |
| | |
| | | [Display(Name = "类别名称")] |
| | | [SugarColumn(IsIgnore = true)] |
| | | public string typeName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 子树 |
| | | /// </summary> |
| | | [SqlSugar.SugarColumn(IsIgnore = true)] |
| | | public List<CoreCmsGoodsCategory> children { get; set; } |
| | | } |
| | | } |
| | |
| | | [Display(Name = "商品分类")] |
| | | [SugarColumn(IsIgnore = true)] |
| | | public string Category { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 商品分类ID |
| | | /// </summary> |
| | | [Display(Name = "商品分类ID")] |
| | | [SugarColumn(IsIgnore = true)] |
| | | public int? CategoryID { get; set; } |
| | | } |
| | | } |
| | |
| | | page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts, CoreCmsGoodsCategory>((good, product, Category) => new JoinQueryInfos( |
| | | JoinType.Inner, good.id == product.goodsId |
| | | |
| | | , JoinType.Inner, good.goodsCategoryId == Category.id ) |
| | | , JoinType.Inner, good.goodsCategoryId == Category.id) |
| | | ) |
| | | .Select((good, product, Category) => new CoreCmsProducts |
| | | { |
| | |
| | | bn = good.bn, |
| | | isMarketable = good.isMarketable, |
| | | unit = good.unit, |
| | | distributionPrice = product.distributionPrice, |
| | | distributionPrice = product.distributionPrice, |
| | | cutMoney = product.cutMoney, |
| | | distributionCutMoney = product.distributionCutMoney, |
| | | Category = (SqlFunc.Subqueryable<CoreCmsGoodsCategory> ().Where(x=>x.id==Category.parentId).Select(x=>x.name)+"-"+ Category.name)?? Category.name, |
| | | CategoryID = Category.id, |
| | | Category = (SqlFunc.Subqueryable<CoreCmsGoodsCategory>().Where(x => x.id == Category.parentId).Select(x => x.name) + "-" + Category.name) ?? Category.name, |
| | | }).With(SqlWith.NoLock) |
| | | .MergeTable() |
| | | .OrderByIF(orderByExpression != null, orderByExpression, orderByType) |
| | |
| | | distributionPrice = product.distributionPrice, |
| | | cutMoney = product.cutMoney, |
| | | distributionCutMoney = product.distributionCutMoney, |
| | | CategoryID = Category.id, |
| | | Category = (SqlFunc.Subqueryable<CoreCmsGoodsCategory>().Where(x => x.id == Category.parentId).Select(x => x.name) + "-" + Category.name) ?? Category.name, |
| | | }) |
| | | .MergeTable() |
| | |
| | | distributionPrice = product.distributionPrice, |
| | | cutMoney = product.cutMoney, |
| | | distributionCutMoney = product.distributionCutMoney, |
| | | CategoryID = Category.id, |
| | | Category = (SqlFunc.Subqueryable<CoreCmsGoodsCategory>().Where(x => x.id == Category.parentId).Select(x => x.name) + "-" + Category.name) ?? Category.name, |
| | | }).With(SqlWith.NoLock) |
| | | .MergeTable() |
| | |
| | | distributionPrice = product.distributionPrice, |
| | | cutMoney = product.cutMoney, |
| | | distributionCutMoney = product.distributionCutMoney, |
| | | CategoryID = Category.id, |
| | | Category = (SqlFunc.Subqueryable<CoreCmsGoodsCategory>().Where(x => x.id == Category.parentId).Select(x => x.name) + "-" + Category.name) ?? Category.name, |
| | | }) |
| | | .MergeTable() |
| | |
| | | var ListData= await _unitOfWork.GetDbClient().Queryable<CoreCmsUser>().Where(x => x.isDelete == false).Select(x => new SearchUserData |
| | | { |
| | | Id = x.id, |
| | | name = x.mobile + "|" + x.userName + "|" + x.nickName, |
| | | name = x.mobile /*+ "|" + x.userName*/ + "|" + x.nickName, |
| | | |
| | | }).WithCache(50).ToListAsync(); |
| | | if (string.IsNullOrEmpty(s)) |
| | |
| | | return false; |
| | | |
| | | } |
| | | |
| | | public async Task<List<CoreCmsGoodsCategory>> GetGoodsCategory() |
| | | { |
| | | return await _unitOfWork.GetDbClient().Queryable<CoreCmsGoodsCategory>().Where(x=>x.isShow==true).WithCache(10).ToTreeAsync(x=>x.children, x=>x.parentId,0); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!string.IsNullOrEmpty(_weChatOptions.WxOpenAppId) && !string.IsNullOrEmpty(_weChatOptions.WxOpenAppSecret)) |
| | | { |
| | | var entity = await _weChatAccessTokenServices.QueryByClauseAsync(p => p.appId == _weChatOptions.WxOpenAppId && p.appType == (int)GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken); |
| | | |
| | | if (entity == null || entity.expireTimestamp <= DateTimeOffset.Now.ToUnixTimeSeconds()) |
| | | { |
| | | var client = _weChatApiHttpClientFactory.CreateWxOpenClient(); |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | |
| | | var value= await _redisOperationRepository.Get<WeChatAccessToken>( |
| | | GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken.ToString()); |
| | | if (value == null) |
| | | { |
| | | //重新设置key |
| | | await _redisOperationRepository.SetAsync( |
| | | GlobalEnumVars.AccessTokenEnum.WxOpenAccessToken.ToString(), entity, |
| | | TimeSpan.FromMinutes(120)); |
| | | } |
| | | //插入日志 |
| | | var model = new SysTaskLog |
| | | { |
| | |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取商品分类列表 已上架的 |
| | | /// </summary> |
| | | [HttpPost] |
| | | [Description("获取商品分类列表")] |
| | | [AllowAnonymous] |
| | | public async Task<AdminUiCallBack> GetGoodsCategory() |
| | | { |
| | | var ret = new AdminUiCallBack(); |
| | | var data = await _comapiservice.GetGoodsCategory(); |
| | | if (data != null) |
| | | { |
| | | ret.code = 0; |
| | | ret.data = data; |
| | | } |
| | | else |
| | | { |
| | | ret.msg = "读取用户数据失败"; |
| | | } |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.CodeAnalysis.Operations; |
| | | using NPOI.SS.Formula.Functions; |
| | | using SqlSugar; |
| | | using ZstdSharp.Unsafe; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | await _coreCmsDistributionServices.InsertAsync(model); |
| | | |
| | | _unitOfWork.CommitTran(); |
| | |
| | | jm.msg = GlobalConstVars.DataisNo; |
| | | return jm; |
| | | } |
| | | try |
| | | { |
| | | _unitOfWork.BeginTran(); |
| | | |
| | | //如果是取消审核 |
| | | |
| | | var bl = await _coreCmsDistributionServices.DeleteByIdAsync(entity.id); |
| | | jm.code = bl ? 0 : 1; |
| | | jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; |
| | | return jm; |
| | | var allConfigs = await _coreCmsSettingServices.GetConfigDictionaries(); |
| | | var kc = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.DictionaryUserGroupKey); |
| | | var group = await _userGradeServices.GetUserGradeByValueKey(kc); |
| | | var defgroup = await _userGradeServices.GetDefaultUserGrade(); |
| | | if (defgroup != null) |
| | | { |
| | | var olduser = await _userServices.QueryByIdAsync(model.userId); |
| | | if (olduser != null) |
| | | {//处理用户等级 |
| | | if (olduser.grade == group.id) |
| | | { |
| | | if (defgroup != null) |
| | | { |
| | | olduser.grade = defgroup.id; |
| | | } |
| | | else |
| | | { |
| | | |
| | | olduser.grade = 0; |
| | | } |
| | | |
| | | olduser.updataTime = DateTime.Now; |
| | | await _userServices.UpdateAsync(olduser); |
| | | |
| | | } |
| | | } |
| | | var store = await _coreCmsStoreServices.QueryByClauseAsync(x => x.userID == model.userId); |
| | | //处理店铺 取消已有店铺的使能 |
| | | if(store != null ) |
| | | |
| | | { |
| | | |
| | | |
| | | // var clerk= await _unitOfWork.GetDbClient().Queryable<CoreCmsClerk>().Where(x => x.storeId == store.id).ToListAsync(); |
| | | //删除店铺员工 |
| | | await _unitOfWork.GetDbClient().Deleteable<CoreCmsClerk>().Where(x=>x.storeId==store.id).ExecuteCommandAsync(); |
| | | //删除店铺 |
| | | await _coreCmsStoreServices.DeleteByIdAsync(store.id); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | var bl = await _coreCmsDistributionServices.DeleteByIdAsync(entity.id); |
| | | |
| | | _unitOfWork.CommitTran(); |
| | | jm.code = bl ? 0 : 1; |
| | | jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; |
| | | |
| | | return jm; |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | _unitOfWork.RollbackTran(); |
| | | jm.code = 1; |
| | | jm.msg = GlobalConstVars.DeleteFailure; |
| | | |
| | | return jm; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | using SqlSugar; |
| | | using CoreCms.Net.Web.Admin.Infrastructure; |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using NPOI.SS.Formula.PTG; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Services; |
| | | |
| | | namespace CoreCms.Net.Web.Admin.Controllers |
| | | { |
| | |
| | | { |
| | | private readonly IWebHostEnvironment _webHostEnvironment; |
| | | private readonly ICoreCmsbaifenProductsServices _CoreCmsProductsServices; |
| | | private readonly IBfbfComAPIService _fbfComAPIService; |
| | | private readonly ICoreCmsGoodsCategoryServices _coreCmsGoodsCategoryServices; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | ///</summary> |
| | | public CoreCmsbaifenProductsController(IWebHostEnvironment webHostEnvironment |
| | | ,ICoreCmsbaifenProductsServices CoreCmsProductsServices |
| | | ) |
| | | , IBfbfComAPIService bfbfComAPIService |
| | | , |
| | | ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices) |
| | | { |
| | | _webHostEnvironment = webHostEnvironment; |
| | | _CoreCmsProductsServices = CoreCmsProductsServices; |
| | | _fbfComAPIService = bfbfComAPIService; |
| | | _coreCmsGoodsCategoryServices= |
| | | _coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices; |
| | | } |
| | | |
| | | #region 获取列表============================================================ |
| | | // POST: Api/CoreCmsProducts/GetPageList |
| | | /// <summary> |
| | | /// <summary> |
| | | /// 获取列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | where = where.And(p => p.price == price); |
| | | } |
| | | //商品分类 decimal |
| | | var Category = Request.Form["category"].FirstOrDefault(); |
| | | if (!string.IsNullOrEmpty(Category)) |
| | | var Category = Request.Form["categoryId"].FirstOrDefault().ToInt32OrDefault(); |
| | | if (Category>0) |
| | | { |
| | | where = where.And(p => p.Category.Contains(Category)); |
| | | where = where.And(p => p.CategoryID== Category); |
| | | } |
| | | //货品成本价 decimal |
| | | var costprice = Request.Form["costprice"].FirstOrDefault().ObjectToDecimal(0); |
| | |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Description("首页数据")] |
| | | public AdminUiCallBack GetIndex() |
| | | public async Task< AdminUiCallBack> GetIndex() |
| | | { |
| | | //返回数据 |
| | | var jm = new AdminUiCallBack { code = 0 }; |
| | | |
| | | var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true); |
| | | jm.data = GoodsHelper.GetTree(categories, false); |
| | | return jm; |
| | | } |
| | | #endregion |
| | |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label" for="category">商品分类</label> |
| | | <div class="layui-input-inline"> |
| | | <input type="text" name="category" placeholder="请输入商品分类关键字" class="layui-input"> |
| | | |
| | | <div id="sel_category_ptindes555" class="ew-xmselect-tree" lay-reqText="请选择商品分类"></div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | |
| | | //开启调试情况下获取接口赋值数据 |
| | | if (debug) { console.log(d); } |
| | | |
| | | indexData = d.data; |
| | | layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'], |
| | | indexData = d.data .data |
| | | |
| | | |
| | | if (debug) { console.log(indexData); } |
| | | layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper','xmSelect'], |
| | | function () { |
| | | var $ = layui.$ |
| | | , admin = layui.admin |
| | |
| | | , laydate = layui.laydate |
| | | , setter = layui.setter |
| | | , coreHelper = layui.coreHelper |
| | | ,xmSelect = layui.xmSelect |
| | | , util = layui.util |
| | | , view = layui.view; |
| | | |
| | |
| | | //执行重载 |
| | | table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox',{ where: field }); |
| | | }); |
| | | |
| | | //数据绑定 |
| | | table.render({ |
| | | elem: '#LAY-app-CoreCmsbaifenProducts-tableBox', |
| | |
| | | ] |
| | | ] |
| | | }); |
| | | |
| | | xmSelect.render({ |
| | | el: '#sel_category_ptindes555', |
| | | height: '250px', |
| | | data: indexData, |
| | | //initValue: mData ? [mData.parentId] : [], |
| | | //model: { label: { type: 'text' } }, |
| | | name: 'categoryId', |
| | | prop: { |
| | | name: 'title', |
| | | value: 'id' |
| | | }, |
| | | radio: true, |
| | | clickClose: true, |
| | | tree: { |
| | | show: true, |
| | | indent: 15, |
| | | strict: false, |
| | | expandedKeys: true |
| | | } |
| | | }); |
| | | //监听排序事件 |
| | | table.on('sort(LAY-app-CoreCmsbaifenProducts-tableBox)', function(obj){ |
| | | table.reloadData('LAY-app-CoreCmsbaifenProducts-tableBox', { |
| | |
| | | title: "小卖部", |
| | | id: 103, |
| | | }, |
| | | { |
| | | title: "其他", |
| | | id: 104, |
| | | }, |
| | | ], |
| | | click: function (obj) { |
| | | this.elem.val(obj.title); |
| | |
| | | title: "小卖部", |
| | | id: 103, |
| | | }, |
| | | { |
| | | title: "其他", |
| | | id: 104, |
| | | }, |
| | | ], |
| | | click: function (obj) { |
| | | this.elem.val(obj.title); |
| | |
| | | title: "小卖部", |
| | | id: 103, |
| | | }, |
| | | { |
| | | title: "其他", |
| | | id: 104, |
| | | }, |
| | | ], |
| | | click: function (obj) { |
| | | this.elem.val(obj.title); |
| | |
| | | }, |
| | | { field: 'orderAmount', title: '订单总额', width: 120, align: 'center', templet: '#orderAmount', totalRow: true }, |
| | | { |
| | | field: 'item', title: '货品', align: 'center', width: 330, templet: "#orderItems" |
| | | field: 'item', title: '货品', align: 'center', width: 550, templet: "#orderItems" |
| | | }, |
| | | { |
| | | field: 'orderAmount', |
| | |
| | | templet: function (data) { |
| | | for (var i = 0; i < d.data.shipStatus.length; i++) { |
| | | if (data.shipStatus == d.data.shipStatus[i].value) { |
| | | return d.data.shipStatus[i].description; |
| | | if(d.data.shipStatus[i].description == "已发货") |
| | | return "√" |
| | | |
| | | return d.data.shipStatus[i].description; |
| | | } |
| | | } |
| | | return ""; |
| | |
| | | templet: function (data) { |
| | | for (var i = 0; i < d.data.confirmStatus.length; i++) { |
| | | if (data.confirmStatus == d.data.confirmStatus[i].value) { |
| | | return d.data.confirmStatus[i].description; |
| | | if(d.data.confirmStatus[i].description == "已确认收货") |
| | | return "√" |
| | | return d.data.confirmStatus[i].description; |
| | | } |
| | | } |
| | | return ""; |
| | |
| | | <div class="order-min-table"> |
| | | <table class="layui-table" lay-size="sm"> |
| | | <colgroup> |
| | | |
| | | <col width="500"> |
| | | <col width="40"> |
| | | <col width="200"> |
| | | <col width="300"> |
| | | <col width="40"> |
| | | <col width="40"> |
| | | <col width="40"> |
| | | </colgroup> |
| | | <thead> |
| | | <tr> |
| | | <th colspan="2" style="width: 200px;">货品</th> |
| | | <th colspan="1" style="width: 400px;">商品名称</th> |
| | | <th colspan="2" style="width: 300px;">货品</th> |
| | | <th style="width: 40px;">数量</th> |
| | | <th style="width: 40px;">单价</th> |
| | | <th style="width: 40px;">优惠</th> |
| | |
| | | </thead> |
| | | <tbody> |
| | | {{# layui.each(d.items, function(index, item){ }} |
| | | |
| | | <tr lay-tips="{{item.name}}"> |
| | | <td > |
| | | {{item.name}} |
| | | </td> |
| | | <td> |
| | | <a href="javascript:void(0);" onclick="layui.coreHelper.viewImage('{{item.imageUrl}}')"><image style="max-width: 30px; max-height: 30px;" src="{{item.imageUrl}}" /></a> |
| | | </td> |