mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 05:19:49 +08:00
【修复】修复不同地区使用不同价格配送费用失效的问题。
This commit is contained in:
@@ -68,9 +68,11 @@ namespace CoreCms.Net.IServices
|
|||||||
/// <param name="ship">配送方式内容</param>
|
/// <param name="ship">配送方式内容</param>
|
||||||
/// <param name="weight">订单总重</param>
|
/// <param name="weight">订单总重</param>
|
||||||
/// <param name="totalmoney">商品总价</param>
|
/// <param name="totalmoney">商品总价</param>
|
||||||
/// <param name="firstunitAreaPrice"></param>
|
/// <param name="firstunitAreaPrice">单独地区首重</param>
|
||||||
|
/// <param name="continueunitAreaPrice">单独地区续重</param>
|
||||||
|
/// <param name="isInChild">是否在地区内</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据地区获取配送方式
|
/// 根据地区获取配送方式
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ namespace CoreCms.Net.Services
|
|||||||
var idStr = areaId.ToString();
|
var idStr = areaId.ToString();
|
||||||
//先判断是否子地区满足条件
|
//先判断是否子地区满足条件
|
||||||
var def = await _dal.QueryByClauseAsync(p =>
|
var def = await _dal.QueryByClauseAsync(p =>
|
||||||
p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
|
p.status == (int)GlobalEnumVars.ShipStatus.Yes &&
|
||||||
p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
|
p.areaType == (int)GlobalEnumVars.ShipAreaType.Part && p.areaFee.Contains(idStr));
|
||||||
//没有子地区取默认
|
//没有子地区取默认
|
||||||
if (def == null)
|
if (def == null)
|
||||||
{
|
{
|
||||||
@@ -157,13 +157,14 @@ namespace CoreCms.Net.Services
|
|||||||
//if (item.Property("area") == null) continue;
|
//if (item.Property("area") == null) continue;
|
||||||
var area = item["area"].ObjectToString();
|
var area = item["area"].ObjectToString();
|
||||||
var firstunitAreaPrice = item["firstunitAreaPrice"].ObjectToInt(0);
|
var firstunitAreaPrice = item["firstunitAreaPrice"].ObjectToInt(0);
|
||||||
|
var continueunitAreaPrice = item["continueunitAreaPrice"].ObjectToInt(0);
|
||||||
if (!string.IsNullOrEmpty(area))
|
if (!string.IsNullOrEmpty(area))
|
||||||
{
|
{
|
||||||
var areaArr = CommonHelper.StringToIntArray(area);
|
var areaArr = CommonHelper.StringToIntArray(area);
|
||||||
if (areaArr.Contains(areaId))
|
if (areaArr.Contains(areaId))
|
||||||
{
|
{
|
||||||
isIn = true;
|
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);
|
postfee = Math.Round(total, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -195,9 +196,11 @@ namespace CoreCms.Net.Services
|
|||||||
/// <param name="ship">配送方式内容</param>
|
/// <param name="ship">配送方式内容</param>
|
||||||
/// <param name="weight">订单总重</param>
|
/// <param name="weight">订单总重</param>
|
||||||
/// <param name="totalmoney">商品总价</param>
|
/// <param name="totalmoney">商品总价</param>
|
||||||
/// <param name="firstunitAreaPrice"></param>
|
/// <param name="firstunitAreaPrice">单独地区首重</param>
|
||||||
|
/// <param name="continueunitAreaPrice">单独地区续重</param>
|
||||||
|
/// <param name="isInChild">是否在地区内</param>
|
||||||
/// <returns></returns>
|
/// <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)
|
if (ship.goodsMoney > 0 && totalmoney >= ship.goodsMoney)
|
||||||
@@ -205,22 +208,21 @@ namespace CoreCms.Net.Services
|
|||||||
return 0;
|
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;
|
return shipMoney;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ship.firstunitPrice > 0)
|
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 ship.firstunitPrice;
|
return shipMoney;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return firstunitAreaPrice;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user