diff --git a/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs b/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
index a273303a..987bbfda 100644
--- a/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
+++ b/CoreCms.Net.IServices/Shop/ICoreCmsShipServices.cs
@@ -68,9 +68,11 @@ namespace CoreCms.Net.IServices
/// 配送方式内容
/// 订单总重
/// 商品总价
- ///
+ /// 单独地区首重
+ /// 单独地区续重
+ /// 是否在地区内
///
- decimal calculate_fee(CoreCmsShip ship, decimal weight, decimal totalmoney = 0, decimal firstunitAreaPrice = 0);
+ decimal calculate_fee(CoreCmsShip ship, decimal weight, decimal totalmoney = 0, decimal firstunitAreaPrice = 0, decimal continueunitAreaPrice = 0, bool isInChild = false);
///
/// 根据地区获取配送方式
diff --git a/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs b/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
index 47bc27ba..11962bca 100644
--- a/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
+++ b/CoreCms.Net.Services/Shop/CoreCmsShipServices.cs
@@ -123,8 +123,8 @@ namespace CoreCms.Net.Services
var idStr = areaId.ToString();
//先判断是否子地区满足条件
var def = await _dal.QueryByClauseAsync(p =>
- p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
- p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
+ p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
+ p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
//没有子地区取默认
if (def == null)
{
@@ -157,13 +157,14 @@ namespace CoreCms.Net.Services
//if (item.Property("area") == null) continue;
var area = item["area"].ObjectToString();
var firstunitAreaPrice = item["firstunitAreaPrice"].ObjectToInt(0);
+ var continueunitAreaPrice = item["continueunitAreaPrice"].ObjectToInt(0);
if (!string.IsNullOrEmpty(area))
{
var areaArr = CommonHelper.StringToIntArray(area);
if (areaArr.Contains(areaId))
{
isIn = true;
- var total = calculate_fee(def, weight, totalmoney, firstunitAreaPrice);
+ var total = calculate_fee(def, weight, totalmoney, firstunitAreaPrice, continueunitAreaPrice, true);
postfee = Math.Round(total, 2);
break;
}
@@ -195,9 +196,11 @@ namespace CoreCms.Net.Services
/// 配送方式内容
/// 订单总重
/// 商品总价
- ///
+ /// 单独地区首重
+ /// 单独地区续重
+ /// 是否在地区内
///
- public decimal calculate_fee(CoreCmsShip ship, decimal weight, decimal totalmoney = 0, decimal firstunitAreaPrice = 0)
+ public decimal calculate_fee(CoreCmsShip ship, decimal weight, decimal totalmoney = 0, decimal firstunitAreaPrice = 0, decimal continueunitAreaPrice = 0, bool isInChild = false)
{
//满多少免运费
if (ship.goodsMoney > 0 && totalmoney >= ship.goodsMoney)
@@ -205,22 +208,21 @@ namespace CoreCms.Net.Services
return 0;
}
- if (weight > 0 && weight > ship.firstUnit)
+ if (isInChild)
{
- decimal shipMoney = ship.firstunitPrice + (Math.Ceiling(Math.Abs(weight - ship.firstUnit) / ship.continueUnit) * ship.continueunitPrice);
+ if (weight <= 0 || weight <= ship.firstUnit) return firstunitAreaPrice;
+ var shipMoney = firstunitAreaPrice + (Math.Ceiling(Math.Abs(weight - ship.firstUnit) / ship.continueUnit) * continueunitAreaPrice);
return shipMoney;
+
}
else
{
- if (ship.firstunitPrice > 0)
- {
- return ship.firstunitPrice;
- }
- else
- {
- return firstunitAreaPrice;
- }
+ if (weight <= 0 || weight <= ship.firstUnit) return ship.firstunitPrice;
+ var shipMoney = ship.firstunitPrice + (Math.Ceiling(Math.Abs(weight - ship.firstUnit) / ship.continueUnit) * ship.continueunitPrice);
+ return shipMoney;
}
+
+
}
///