mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:03:27 +08:00
# 2022-02-12
### 1.3.5 开源社区版: 无 ### 0.1.7 会员专业版: 【新增】表【CoreCmsUserShip】增加【精度longitude】【纬度latitude】【街道street】三字段。 【新增】用户地址新增及编辑增加地图选择获取街道及经纬度坐标功能。 【新增】【平台设置-订单管理】,新增【同城配送运费设置】,可设置2公里内,5公里内,10公里内,15公里内,20公里内不同距离运费。根据用户地址坐标与门店坐标进行计算。 【新增】商品详情轮播图增加视频图片混播结合功能,类似淘宝打开商品详情后显示视频并支持播放,左右滑动切换图片,实现混播。 【新增】商品添加/删除面板增加视频上传功能。
This commit is contained in:
@@ -19,8 +19,8 @@ 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.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -55,7 +55,8 @@ namespace CoreCms.Net.Services
|
||||
private readonly ICoreCmsGoodsServices _goodsServices;
|
||||
private readonly ICoreCmsGoodsCategoryServices _goodsCategoryServices;
|
||||
private readonly ICoreCmsSolitaireServices _solitaireServices;
|
||||
|
||||
private readonly ICoreCmsUserShipServices _userShipServices;
|
||||
private readonly ICoreCmsStoreServices _storeServices;
|
||||
|
||||
public CoreCmsCartServices(
|
||||
ICoreCmsCartRepository dal
|
||||
@@ -68,7 +69,7 @@ namespace CoreCms.Net.Services
|
||||
, ICoreCmsUserServices userServices
|
||||
, ICoreCmsSettingServices settingServices
|
||||
, ICoreCmsProductsServices productsServices
|
||||
, ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices)
|
||||
, ICoreCmsPinTuanGoodsServices pinTuanGoodsServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsGoodsServices goodsServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsPromotionResultServices promotionResultServices, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsSolitaireServices solitaireServices, ICoreCmsUserShipServices userShipServices, ICoreCmsStoreServices storeServices)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
@@ -89,6 +90,8 @@ namespace CoreCms.Net.Services
|
||||
_promotionResultServices = promotionResultServices;
|
||||
_pinTuanRecordServices = pinTuanRecordServices;
|
||||
_solitaireServices = solitaireServices;
|
||||
_userShipServices = userShipServices;
|
||||
_storeServices = storeServices;
|
||||
}
|
||||
|
||||
#region 设置购物车商品数量====================================================
|
||||
@@ -162,6 +165,7 @@ namespace CoreCms.Net.Services
|
||||
#endregion
|
||||
|
||||
#region 添加单个货品到购物车
|
||||
|
||||
/// <summary>
|
||||
/// 添加单个货品到购物车
|
||||
/// </summary>
|
||||
@@ -514,7 +518,6 @@ namespace CoreCms.Net.Services
|
||||
return solitaireInfo;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
jm.msg = GlobalErrorCodeVars.Code10000;
|
||||
@@ -541,11 +544,11 @@ namespace CoreCms.Net.Services
|
||||
/// <param name="areaId">收货地址id</param>
|
||||
/// <param name="point">消费的积分</param>
|
||||
/// <param name="couponCode">优惠券码</param>
|
||||
/// <param name="freeFreight">是否免运费</param>
|
||||
/// <param name="deliveryType">关联上面的是否免运费/1=快递配送(要去算运费)生成订单记录快递方式 2=门店自提(不需要计算运费)生成订单记录门店自提信息</param>
|
||||
/// <param name="userShipId">用户收货地址</param>
|
||||
/// <param name="objectId">关联非普通订单营销类型序列</param>
|
||||
/// <returns></returns>
|
||||
public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, bool freeFreight = false, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int objectId = 0)
|
||||
public async Task<WebApiCallBack> GetCartInfos(int userId, int[] ids, int orderType, int areaId, int point, string couponCode, int deliveryType = (int)GlobalEnumVars.OrderReceiptType.Logistics, int userShipId = 0, int objectId = 0)
|
||||
{
|
||||
var jm = new WebApiCallBack() { methodDescription = "获取处理后的购物车信息" };
|
||||
var cartDto = new CartDto(); //必须初始化
|
||||
@@ -583,17 +586,26 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
|
||||
//门店订单,强制无运费
|
||||
if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService || deliveryType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
|
||||
if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
|
||||
{
|
||||
freeFreight = true;
|
||||
cartDto.costFreight = 0;
|
||||
}
|
||||
//运费判断
|
||||
if (CartFreight(cartDto, areaId, freeFreight) == false)
|
||||
else if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.Logistics)
|
||||
{
|
||||
jm.data = cartDto;
|
||||
jm.msg = "运费判断";
|
||||
return jm;
|
||||
// 运费判断
|
||||
if (CartFreight(cartDto, areaId) == false)
|
||||
{
|
||||
jm.data = cartDto;
|
||||
jm.msg = "运费判断";
|
||||
return jm;
|
||||
}
|
||||
}
|
||||
else if (deliveryType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService)
|
||||
{
|
||||
await CartFreightByIntraCityService(cartDto, userShipId);
|
||||
}
|
||||
|
||||
|
||||
//接下来算订单促销金额,有些模式不需要计算促销信息,这里就增加判断
|
||||
if (orderType == (int)GlobalEnumVars.OrderType.Common)
|
||||
{
|
||||
@@ -651,17 +663,83 @@ namespace CoreCms.Net.Services
|
||||
/// </summary>
|
||||
/// <param name="cartDto">购物车信息</param>
|
||||
/// <param name="areaId">收货地址id</param>
|
||||
/// <param name="freeFreight">是否包邮,默认false</param>
|
||||
/// <returns></returns>
|
||||
public bool CartFreight(CartDto cartDto, int areaId, bool freeFreight = false)
|
||||
public bool CartFreight(CartDto cartDto, int areaId)
|
||||
{
|
||||
if (freeFreight == false)
|
||||
if (areaId > 0)
|
||||
{
|
||||
if (areaId > 0)
|
||||
cartDto.costFreight = _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount);
|
||||
cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据经纬度算运费
|
||||
|
||||
/// <summary>
|
||||
/// 根据经纬度算运费
|
||||
/// </summary>
|
||||
/// <param name="cartDto">购物车信息</param>
|
||||
/// <param name="userShipId">用户地址信息</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> CartFreightByIntraCityService(CartDto cartDto, int userShipId)
|
||||
{
|
||||
if (userShipId > 0)
|
||||
{
|
||||
var userShip = await _userShipServices.QueryByClauseAsync(p => p.id == userShipId);
|
||||
if (userShip == null)
|
||||
{
|
||||
cartDto.costFreight = _shipServices.GetShipCost(areaId, cartDto.weight, cartDto.goodsAmount);
|
||||
cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2);
|
||||
return true;
|
||||
}
|
||||
var store = await _storeServices.QueryByClauseAsync(p => p.isDefault == true);
|
||||
if (store == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(userShip.longitude) || string.IsNullOrEmpty(userShip.latitude) || string.IsNullOrEmpty(store.longitude) || string.IsNullOrEmpty(store.latitude))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//第一种调用方法
|
||||
var result = MapHelper.GetDistance(Convert.ToDouble(userShip.latitude.Trim()), Convert.ToDouble(userShip.longitude.Trim()), Convert.ToDouble(store.latitude.Trim()), Convert.ToDouble(store.longitude.Trim()));
|
||||
|
||||
var allConfigs = await _settingServices.GetConfigDictionaries();
|
||||
var intraCityServiceBy2Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy2KM).ObjectToDecimal(0);
|
||||
var intraCityServiceBy5Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy5KM).ObjectToDecimal(0);
|
||||
var intraCityServiceBy10Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy10KM).ObjectToDecimal(0);
|
||||
var intraCityServiceBy15Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy15KM).ObjectToDecimal(0);
|
||||
var intraCityServiceBy20Km = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.IntraCityServiceBy20KM).ObjectToDecimal(0);
|
||||
|
||||
if (0 <= result && result <= 2)
|
||||
{
|
||||
cartDto.costFreight = intraCityServiceBy2Km;
|
||||
}
|
||||
else if (result > 2 && result <= 5)
|
||||
{
|
||||
cartDto.costFreight = intraCityServiceBy5Km;
|
||||
}
|
||||
else if (result > 5 && result <= 10)
|
||||
{
|
||||
cartDto.costFreight = intraCityServiceBy5Km;
|
||||
}
|
||||
else if (result > 10 && result <= 15)
|
||||
{
|
||||
cartDto.costFreight = intraCityServiceBy5Km;
|
||||
}
|
||||
else if (result > 15 && result <= 20)
|
||||
{
|
||||
cartDto.costFreight = intraCityServiceBy5Km;
|
||||
}
|
||||
else
|
||||
{
|
||||
cartDto.costFreight = 0;
|
||||
}
|
||||
cartDto.amount = Math.Round(cartDto.amount + cartDto.costFreight, 2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -760,7 +838,6 @@ namespace CoreCms.Net.Services
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据提交的数据判断哪些购物券可以使用
|
||||
/// <summary>
|
||||
/// 根据提交的数据判断哪些购物券可以使用
|
||||
|
||||
Reference in New Issue
Block a user