Authored by Rock Zhang

修复结算页中价格为0时不显示为0.00的bug

Code Review By Rock Zhang
... ... @@ -186,11 +186,12 @@ class Helpers
* 转换价格
*
* @param float|string $price 价格
* @param boolean $isSepcialZero 是否需要特殊的0,默认否
* @return float|string 转换之后的价格
*/
public static function transPrice($price)
public static function transPrice($price, $isSepcialZero = false)
{
return !empty($price) ? number_format($price, 2, '.', '') : 0;
return (!empty($price) || $isSepcialZero) ? number_format($price, 2, '.', '') : 0;
}
/**
... ...
... ... @@ -518,7 +518,7 @@ class CartModel
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
$result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['price'] = Helpers::transPrice($price);
$result['price'] = Helpers::transPrice($price, true);
// 订单商品数
$result['num'] = $payReturn['shopping_cart_data']['selected_goods_count'];
// 商品金额
... ...