mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:03:27 +08:00
【修复】修复不同地区使用不同价格配送费用失效的问题。
This commit is contained in:
@@ -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
|
||||
/// <param name="ship">配送方式内容</param>
|
||||
/// <param name="weight">订单总重</param>
|
||||
/// <param name="totalmoney">商品总价</param>
|
||||
/// <param name="firstunitAreaPrice"></param>
|
||||
/// <param name="firstunitAreaPrice">单独地区首重</param>
|
||||
/// <param name="continueunitAreaPrice">单独地区续重</param>
|
||||
/// <param name="isInChild">是否在地区内</param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user