Authored by Rock Zhang

修复加价购数目显示的问题,修复购物车商品价格显示的问题

... ... @@ -197,7 +197,7 @@ class Helpers
* 格式化商品信息
*
* @param array $productData 需要格式化的商品数据
* @param bool $showTag 控制是否显示标签
* @param bool $showTags 控制是否显示标签
* @param bool $showNew 控制是否显示NEW图标
* @param bool $showSale 控制是否显示SALE图标
* @param int $width 图片的宽度
... ... @@ -522,6 +522,7 @@ class Helpers
* @param array $orderGoods 订单
* @param int $count 计订单件数
* @param bool $haveLink 控制是否需要商品链接
* @return array $arr 处理之后的订单商品数据
*/
public static function formatOrderGoods($orderGoods, &$count = 0, $haveLink = false)
{
... ... @@ -560,6 +561,7 @@ class Helpers
*
* @param array $cartGoods 购物车商品列表
* @param bool $haveLink 控制是否需要商品链接
* @return array 处理之后的购物车商品数据
*/
public static function formatCartGoods($cartGoods, $haveLink = false)
{
... ... @@ -573,8 +575,7 @@ class Helpers
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = $value['real_price'];
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['count'] = $value['buy_number'];
$oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']);
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
... ... @@ -604,13 +605,13 @@ class Helpers
* 格式化加价购商品
*
* @param array $advanceGoods 加价购商品列表
* @param bool $haveLink 控制是否需要商品链接
* @param int $count 计商品件数
* @return array $arr 处理之后的加价购商品数据
*/
public static function formatAdvanceGoods($advanceGoods)
public static function formatAdvanceGoods($advanceGoods, &$count = 0)
{
$arr = array();
$gift = array();
$oneGoods = array();
foreach ($advanceGoods as $value) {
... ... @@ -630,6 +631,9 @@ class Helpers
}
$arr[] = $gift;
// 计算加价购商品数目
$count += count($value['goods_list']);
}
return $arr;
... ...
... ... @@ -21,7 +21,7 @@
<span class="iconfont">&#xe61b;</span>
加价购
<a>
<span class="count">{{count}}</span>
<span class="count">{{advanceBuyCount}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
</li>
... ...
... ... @@ -619,12 +619,13 @@ class CartModel
(count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true;
$result['freebie'] = $data['gift_list'];
// 加价购
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
$result['advanceBuyCount'] = 0;
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift'], $result['advanceBuyCount']);
// 结算数据
$result['price'] = $data['shopping_cart_data']['order_amount'];
$result['activityPrice'] = $data['shopping_cart_data']['discount_amount'];
$result['price'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
$result['activityPrice'] = Helpers::transPrice($data['shopping_cart_data']['discount_amount']);
$result['count'] = $data['shopping_cart_data']['goods_count'];
$result['sumPrice'] = $data['shopping_cart_data']['order_amount'];
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['order_amount']);
return $result;
}
... ...