Commit 68a0e950 authored by 吴春's avatar 吴春
parents 1e0c950a 85b7290a
......@@ -248,7 +248,7 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 赠送类型 1固定值 2百分比
/// 赠送类型 2固定值 1百分比
/// </summary>
public int? IntegralPresentType
{
......@@ -264,7 +264,7 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 抵扣类型 1固定值 2百分比
/// 抵扣类型 2固定值 1百分比
/// </summary>
public int? PointsDeductionType
{
......
......@@ -72,6 +72,10 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 规格key
/// </summary>
public string SpecificationSort { get; set; }
/// <summary>
/// 货号
/// </summary>
public string ProductCode
......
using Mall.Common.AOP;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.Product
{
/// <summary>
/// 商品购物车表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_ShoppingCart
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId
{
get;
set;
}
/// <summary>
/// 商品数量
/// </summary>
public int? Number
{
get;
set;
}
/// <summary>
/// SpecificationSort
/// </summary>
public string SpecificationSort
{
get;
set;
}
/// <summary>
/// 状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
......@@ -14,5 +14,10 @@ namespace Mall.Model.Extend.BaseSetUp
public class RB_Logistics_RulesPrice_Extend : RB_Logistics_RulesPrice
{
public List<RB_Logistics_RulesRegion_Extend> List { get; set; }
/// <summary>
/// 规格ids
/// </summary>
public string RulesIds { get; set; }
}
}
......@@ -16,5 +16,9 @@ namespace Mall.Model.Extend.BaseSetUp
{
public List<RB_Logistics_RulesPrice_Extend> Detail { get; set; }
public List<RB_Logistics_RulesRegion_Extend> List { get; set; }
/// <summary>
/// 规格的ids
/// </summary>
public string RulesIds { get; set; }
}
}
......@@ -13,6 +13,18 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Extend : RB_Goods
{
/// <summary>
/// 推荐商品类型 1商品详情页 2订单完成后 3评论后
/// </summary>
public int? RecommendType { get; set; }
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId { get; set; }
/// <summary>
/// 视频播放方向 1向下 2向上
/// </summary>
public int? SelectVideoDirection { get; set; }
/// <summary>
/// 小程序名称
/// </summary>
......@@ -22,6 +34,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public int? UserId { get; set; }
/// <summary>
/// 值查询有视频的
/// </summary>
public int? IsSelectVideo { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderBy { get; set; }
......@@ -82,6 +98,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public List<RB_Goods_Specification_Extend> SpecificationList { get; set; }
/// <summary>
/// 规格值名称列表
/// </summary>
public List<string> SpecificationNameList { get; set; }
/// <summary>
/// 规格价格列表
/// </summary>
public List<RB_Goods_SpecificationPrice_Extend> SpecificationPriceList { get; set; }
......@@ -107,5 +127,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public decimal MaxShare { get; set; }
/// <summary>
/// 会员价格
/// </summary>
public decimal MemberPrice { get; set; }
}
}
......@@ -13,6 +13,14 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Order_Extend : RB_Goods_Order
{
/// <summary>
/// 商品id
/// </summary>
public int? GoodsId { get; set; }
/// <summary>
/// 商品订单数量
/// </summary>
public int? OrderNum { get; set; }
/// <summary>
/// 开始时间
/// </summary>
......
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
namespace Mall.Model.Extend.Product
{
/// <summary>
/// 商品购物车表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_ShoppingCart_Extend : RB_Goods_ShoppingCart
{
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 商品状态 1销售中 2下架中 3 失效
/// </summary>
public int? GoodsStatus
{
get;
set;
}
/// <summary>
/// 轮播图 json 格式 第一张为封面图
/// </summary>
public string CarouselImage
{
get;
set;
}
/// <summary>
/// 规格列表
/// </summary>
public List<string> SpecificationList { get; set; }
/// <summary>
/// 售价
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 默认规格名称
/// </summary>
public string DefaultSpecificationName { get; set; }
/// <summary>
/// 是否开启自定义规格
/// </summary>
public int? IsCustomSpecification { get; set; }
/// <summary>
/// 封面图
/// </summary>
public string CoverImage { get; set; }
/// <summary>
/// 是否享受会员
/// </summary>
public int? EnjoyMember { get; set; }
/// <summary>
/// 是否制定会员价格
/// </summary>
public int? SeparateSetMember { get; set; }
/// <summary>
/// 库存数量
/// </summary>
public int? InventoryNum { get; set; }
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -71,7 +71,7 @@ namespace Mall.Repository.BaseSetUp
{
builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.TenantId)}={query.TenantId}");
}
if (query.TenantId > 0)
if (query.MallBaseId > 0)
{
builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.MallBaseId)}={query.MallBaseId}");
}
......@@ -83,6 +83,12 @@ namespace Mall.Repository.BaseSetUp
{
builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.RulesType)}={(int)query.RulesType}");
}
if (query.IsDefault > 0) {
builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.IsDefault)}={query.IsDefault}");
}
if (!string.IsNullOrEmpty(query.RulesIds)) {
builder.Append($" AND {nameof(RB_Logistics_Rules_Extend.ID)} in({query.RulesIds})");
}
}
return Get<RB_Logistics_Rules_Extend>(builder.ToString()).ToList();
}
......
......@@ -190,6 +190,22 @@ where {where} group by g.Id order by g.CreateDate desc";
//销量高-低
orderBy = $" order by g.{nameof(RB_Goods_Extend.SalesNum)} desc";
}
if (dmodel.IsSelectVideo == 1) {
where += $@" and g.{nameof(RB_Goods_Extend.VideoAddress)} !=''";
}
if (dmodel.GoodsId > 0)
{
if (dmodel.SelectVideoDirection == 1)
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)}>={dmodel.Id}";
orderBy = $" order by g.{nameof(RB_Goods_Extend.Id)} asc";
}
else
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)}<={dmodel.Id}";
orderBy = $" order by g.{nameof(RB_Goods_Extend.Id)} desc";
}
}
string sql = $@"select g.* from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
......
......@@ -304,6 +304,63 @@ where {where} group by o.OrderId order by o.CreateDate desc";
return Execute(sql) > 0;
}
/// <summary>
/// 根据商品id 获取其订单相关统计
/// </summary>
/// <param name="payment_amount"></param>
/// <param name="payment_num"></param>
/// <param name="payment_order"></param>
/// <param name="payment_people"></param>
/// <param name="goodsId"></param>
public void GetGoodsOrderPeopleInfo(out decimal payment_amount, out int payment_num, out int payment_order, out int payment_people, int goodsId)
{
payment_amount = 0;
payment_num = payment_order = payment_people = 0;
string sql1 = $@"SELECT SUM(t.Income) as Income,COUNT(0) as OrderNum FROM(
SELECT o.OrderId,o.Income FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.OrderId)t";
string sql2 = $@"
SELECT SUM(od.Number) as GoodsNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7";
string sql3 = $@"SELECT COUNT(UserId) AS OrderNum FROM(
SELECT o.UserId FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId={goodsId} and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.UserId)t";
var model1 = Get<RB_Goods_Order_Extend>(sql1).FirstOrDefault();
var model2 = Get<RB_Goods_Order_Extend>(sql2).FirstOrDefault();
var model3 = Get<RB_Goods_Order_Extend>(sql3).FirstOrDefault();
if (model1 != null)
{
payment_amount = model1.Income ?? 0;
payment_order = model1.OrderNum ?? 0;
}
if (model2 != null)
{
payment_num = model2.OrderNum ?? 0;
}
if (model3 != null)
{
payment_people = model3.OrderNum ?? 0;
}
}
/// <summary>
/// 根据商品ids 获取商品的订单销量
/// </summary>
/// <param name="goodsIds"></param>
/// <returns></returns>
public List<RB_Goods_Order_Extend> GetGoodsOrderNum(string goodsIds)
{
string sql2 = $@"
SELECT od.GoodsId ,SUM(od.Number) as GoodsNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId in({goodsIds}) and o.`Status`=0 and o.OrderStatus <> 7 group by od.GoodsId";
return Get<RB_Goods_Order_Extend>(sql2).ToList();
}
#region 数据统计-数据概况
......@@ -541,7 +598,6 @@ as t GROUP BY t.CreateDate desc";
return GetPage<DataStatistics_Query>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 销售统计导出
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品购物车仓储层
/// </summary>
public class RB_Goods_ShoppingCartRepository : RepositoryBase<RB_Goods_ShoppingCart>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Goods_ShoppingCart_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend dmodel)
{
string where = $" 1=1 and sc.{nameof(RB_Goods_ShoppingCart.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and sc.{nameof(RB_Goods_ShoppingCart.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0) {
where += $@" and sc.{nameof(RB_Goods_ShoppingCart.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0) {
where += $@" and sc.{nameof(RB_Goods_ShoppingCart.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds)) {
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and g.{nameof(RB_Goods_Extend.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.GoodsStatus > 0) {
where += $@" and g.{nameof(RB_Goods_Extend.GoodsStatus)}={dmodel.GoodsStatus}";
}
string sql = $@"select sc.*,g.Name,g.GoodsStatus,g.CarouselImage,g.SellingPrice as Price,g.IsCustomSpecification,g.DefaultSpecificationName,
g.EnjoyMember,g.SeparateSetMember,g.InventoryNum from RB_Goods_ShoppingCart sc
inner join RB_Goods g on sc.GoodsId=g.Id
where {where} order by g.GoodsStatus asc,sc.CreateDate desc";
return GetPage<RB_Goods_ShoppingCart_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
public List<RB_Goods_ShoppingCart_Extend> GetList(RB_Goods_ShoppingCart_Extend dmodel) {
string where = $" 1=1 and {nameof(RB_Goods_ShoppingCart.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_ShoppingCart.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_ShoppingCart.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Goods_ShoppingCart.UserId)}={dmodel.UserId}";
}
if (dmodel.GoodsId > 0)
{
where += $@" and {nameof(RB_Goods_ShoppingCart.GoodsId)}={dmodel.GoodsId}";
}
if (!string.IsNullOrEmpty(dmodel.SpecificationSort))
{
where += $@" and {nameof(RB_Goods_ShoppingCart.SpecificationSort)}='{dmodel.SpecificationSort}'";
}
string sql = $@"SELECT * FROM RB_Goods_ShoppingCart where {where} order by Id asc";
return Get<RB_Goods_ShoppingCart_Extend>(sql).ToList();
}
}
}
......@@ -37,7 +37,7 @@ namespace Mall.Repository.Product
where += $@" and {nameof(RB_Goods_Specification.GoodsId)} in({dmodel.GoodsIds})";
}
string sql = $@"select * from RB_Goods_Specification where {where} order by Id desc";
string sql = $@"select * from RB_Goods_Specification where {where} order by Id asc";
return Get<RB_Goods_Specification_Extend>(sql).ToList();
}
}
......
......@@ -40,7 +40,7 @@ namespace Mall.Repository.Product
where += $@" and {nameof(RB_Goods_SpecificationValue.GoodsId)} in({dmodel.GoodsIds})";
}
string sql = $@"select * from RB_Goods_SpecificationValue where {where} order by Id desc";
string sql = $@"select * from RB_Goods_SpecificationValue where {where} order by Id asc";
return Get<RB_Goods_SpecificationValue_Extend>(sql).ToList();
}
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.Product;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
using Mall.Model.Extend.User;
namespace Mall.WebApi.Controllers.MallBase
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletOrderController : BaseController
{
private readonly OrderModule orderModule = new OrderModule();
#region 购物车
/// <summary>
/// 获取用户购物车
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetGoodsShoppingCartPageList() {
var parms = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
var list = orderModule.GetGoodsShoppingCartPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.GoodsId,
x.GoodsName,
x.CoverImage,
x.Price,
x.InventoryNum,
x.SpecificationList,
x.Number,
x.GoodsStatus,
x.TenantId,
x.MallBaseId,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 加入购物车
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsShoppingCartInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_ShoppingCart_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_ShoppingCart_Extend>(req.msg.ToString());
if ((demodel.GoodsId??0) <= 0) {
return ApiResult.ParamIsNull("请传递商品id");
}
if ((demodel.Number ?? 0) <= 0) {
return ApiResult.ParamIsNull("数量必须大于0");
}
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
demodel.SpecificationSort ??= "";
return orderModule.SetGoodsShoppingCartGetInfo(demodel);
}
/// <summary>
/// 设置购物车数量
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetGoodsShoppingCartNumGetInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject prams = JObject.Parse(req.msg.ToString());
int ShoppingCartId = prams.GetInt("ShoppingCartId", 0);
int Number = prams.GetInt("Number", 0);
if (ShoppingCartId <= 0 || Number <= 0) {
return ApiResult.ParamIsNull();
}
bool flag = orderModule.SetGoodsShoppingCartNumGetInfo(ShoppingCartId, Number, userInfo.TenantId, userInfo.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
/// <summary>
/// 删除购物车
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelGoodsShoppingCartInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject prams = JObject.Parse(req.msg.ToString());
string ShoppingCartIds = prams.GetStringValue("ShoppingCartIdList");
if (string.IsNullOrEmpty(ShoppingCartIds))
{
return ApiResult.ParamIsNull();
}
try
{
List<int> scList = JsonConvert.DeserializeObject<List<int>>(ShoppingCartIds);
ShoppingCartIds = string.Join(",", scList);
}
catch (Exception)
{
return ApiResult.ParamIsNull("");
}
bool flag = orderModule.DelGoodsShoppingCartInfo(ShoppingCartIds, userInfo.TenantId, userInfo.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 订单管理
/// <summary>
/// 结算页面详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsSettlementInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(req.msg.ToString());
if (demodel.DetailList == null || !demodel.DetailList.Any())
{
return ApiResult.ParamIsNull("请传递商品信息");
}
foreach (var item in demodel.DetailList)
{
if ((item.GoodsId ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品id");
}
if ((item.Number ?? 0) <= 0)
{
return ApiResult.ParamIsNull("请传递商品数量");
}
}
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
return orderModule.GetAppletGoodsSettlementInfo(demodel);
}
/// <summary>
/// 下单
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetAppletGoodsOrderInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Goods_Order_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Order_Extend>(req.msg.ToString());
if (string.IsNullOrEmpty(demodel.Consignee)) {
return ApiResult.ParamIsNull("请传递收件人");
}
if (string.IsNullOrEmpty(demodel.Mobile)) {
return ApiResult.ParamIsNull("请传递收件人手机号码");
}
if (demodel.DeliveryMethod != Common.Enum.Goods.OrderDeliveryMethodEnum.VerificationShop) {
if ((demodel.District ?? 0) <= 0) {
return ApiResult.ParamIsNull("收货地址有误");
}
}
if (demodel.DetailList == null || !demodel.DetailList.Any()) {
return ApiResult.ParamIsNull("请传递商品信息");
}
foreach (var item in demodel.DetailList) {
if ((item.GoodsId ?? 0) <= 0) {
return ApiResult.ParamIsNull("请传递商品id");
}
if ((item.Number ?? 0) <= 0) {
return ApiResult.ParamIsNull("请传递商品数量");
}
}
return ApiResult.Success();
}
#endregion
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@
<TargetFramework>netcoreapp3.0</TargetFramework>
<ProjectGuid>ad842a33-b1df-4360-ae06-536353f0276c</ProjectGuid>
<SelfContained>false</SelfContained>
<publishUrl>F:\网站发布\Mall.oytour.com</publishUrl>
<publishUrl>E:\LDWork\LiuDongWork\MallFB</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
......
......@@ -6,7 +6,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<_PublishTargetUrl>F:\网站发布\Mall.oytour.com</_PublishTargetUrl>
<_PublishTargetUrl>E:\LDWork\LiuDongWork\MallFB</_PublishTargetUrl>
</PropertyGroup>
<ItemGroup>
<File Include="run.cmd">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment