Authored by Rock Zhang

当只有失效商品时,购物车的显示逻辑的判断

@@ -80,19 +80,21 @@ class CartModel @@ -80,19 +80,21 @@ class CartModel
80 80
81 $ordinaryCount = strval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']); 81 $ordinaryCount = strval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']);
82 $advanceCount = strval($cart['advance_cart_data']['shopping_cart_data']['goods_count']); 82 $advanceCount = strval($cart['advance_cart_data']['shopping_cart_data']['goods_count']);
  83 + $ordinarySoldOut = empty($cart['ordinary_cart_data']['sold_out_goods_list']);
  84 + $advanceSoldOut = empty($cart['advance_cart_data']['sold_out_goods_list']);
83 // 普通购物车和预售购物车都为空 85 // 普通购物车和预售购物车都为空
84 - if ($ordinaryCount === '0' && $advanceCount === '0') { 86 + if ($ordinaryCount === '0' && $advanceCount === '0' && $ordinarySoldOut && $advanceSoldOut) {
85 $result['isEmptyCart'] = true; 87 $result['isEmptyCart'] = true;
86 break; 88 break;
87 } 89 }
88 90
89 // 普通购物车空,则显示预售购物车 91 // 普通购物车空,则显示预售购物车
90 - if ($ordinaryCount === '0') { 92 + if ($ordinaryCount === '0' && $ordinaryCount) {
91 $result['cartNav'] = false; 93 $result['cartNav'] = false;
92 $result['cartType'] = 'advance'; 94 $result['cartType'] = 'advance';
93 } 95 }
94 // 预售购物车空,则显示普通购物车 96 // 预售购物车空,则显示普通购物车
95 - elseif ($advanceCount === '0') { 97 + elseif ($advanceCount === '0' && $advanceSoldOut) {
96 $result['cartNav'] = false; 98 $result['cartNav'] = false;
97 $result['cartType'] = 'ordinary'; 99 $result['cartType'] = 'ordinary';
98 } 100 }
@@ -734,7 +736,7 @@ class CartModel @@ -734,7 +736,7 @@ class CartModel
734 736
735 do { 737 do {
736 // 数据为空时返回空的标志 738 // 数据为空时返回空的标志
737 - if (empty($data['goods_list'])) { 739 + if (empty($data['goods_list']) && empty($data['sold_out_goods_list'])) {
738 break; 740 break;
739 } 741 }
740 742