Authored by 周少峰

cart students

@@ -711,7 +711,8 @@ class Helpers @@ -711,7 +711,8 @@ class Helpers
711 $oneGoods['productSize'] = $value['size_name']; 711 $oneGoods['productSize'] = $value['size_name'];
712 $oneGoods['productPrice'] = self::transPrice($value['last_vip_price']); //self::transPrice($value['real_price']); 712 $oneGoods['productPrice'] = self::transPrice($value['last_vip_price']); //self::transPrice($value['real_price']);
713 $oneGoods['productNum'] = $value['buy_number']; 713 $oneGoods['productNum'] = $value['buy_number'];
714 - $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price']; 714 + $oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price'] && $value['discount_tag'] === 'V';
  715 + $oneGoods['isStuPrice'] = $value['sales_price'] !== $value['last_vip_price'] && $value['discount_tag'] === 'S';
715 $oneGoods['yohoIcon'] = isset($value['get_yoho_coin']) ? $value['get_yoho_coin'] : 0; 716 $oneGoods['yohoIcon'] = isset($value['get_yoho_coin']) ? $value['get_yoho_coin'] : 0;
716 $oneGoods['productSubtotal'] = self::transPrice( floatval($value['last_vip_price']) * intval($value['buy_number']) ); 717 $oneGoods['productSubtotal'] = self::transPrice( floatval($value['last_vip_price']) * intval($value['buy_number']) );
717 $oneGoods['promotionId'] = empty($value['promotion_id']) ? '0' : $value['promotion_id']; 718 $oneGoods['promotionId'] = empty($value['promotion_id']) ? '0' : $value['promotion_id'];
@@ -162,6 +162,10 @@ @@ -162,6 +162,10 @@
162 {{#isVipPrice}} 162 {{#isVipPrice}}
163 <span class="vipPrice">(VIP)</span> 163 <span class="vipPrice">(VIP)</span>
164 {{/isVipPrice}} 164 {{/isVipPrice}}
  165 +
  166 + {{#isStuPrice}}
  167 + <span class="vipPrice">(学生价)</span>
  168 + {{/isStuPrice}}
165 </td> 169 </td>
166 <td>{{yohoIcon}}个</td> 170 <td>{{yohoIcon}}个</td>
167 <td class="adjust-cart-num"> 171 <td class="adjust-cart-num">
@@ -55,6 +55,7 @@ class CartModel @@ -55,6 +55,7 @@ class CartModel
55 // 调用接口,获取购物车数据 55 // 调用接口,获取购物车数据
56 $cartData = CartData::cartData($uid, $shoppingKey); 56 $cartData = CartData::cartData($uid, $shoppingKey);
57 57
  58 +// print_r($cartData); exit;
58 // 接口异常时,购物车置为空 59 // 接口异常时,购物车置为空
59 if (empty($cartData['data'])) { 60 if (empty($cartData['data'])) {
60 $result['isEmpty'] = true; 61 $result['isEmpty'] = true;
@@ -1393,17 +1394,23 @@ class CartModel @@ -1393,17 +1394,23 @@ class CartModel
1393 private static function genProductAmount($promotionList, $default) 1394 private static function genProductAmount($promotionList, $default)
1394 { 1395 {
1395 $result = $default; 1396 $result = $default;
1396 - 1397 + // VIP价格
1397 $vipAmount = null; 1398 $vipAmount = null;
  1399 + // 学生价
  1400 + $stuAmount = null;
1398 foreach ($promotionList as $value) { 1401 foreach ($promotionList as $value) {
1399 if ($value['promotion'] === 'VIP优惠') { 1402 if ($value['promotion'] === 'VIP优惠') {
1400 $vipAmount = strtr($value['promotion_amount'], array('¥' => '', '-' => '', '+' => '')); 1403 $vipAmount = strtr($value['promotion_amount'], array('¥' => '', '-' => '', '+' => ''));
1401 - break; 1404 + } elseif ($value['promotion'] === '学生优惠') {
  1405 + $stuAmount = strtr($value['promotion_amount'], array('¥' => '', '-' => '', '+' => ''));
1402 } 1406 }
1403 } 1407 }
1404 if (null !== $vipAmount) { 1408 if (null !== $vipAmount) {
1405 $result = floatval($default) - floatval($vipAmount); 1409 $result = floatval($default) - floatval($vipAmount);
1406 } 1410 }
  1411 + if (null !== $stuAmount) {
  1412 + $result = floatval($default) - floatval($stuAmount);
  1413 + }
1407 $result = Helpers::transPrice($result); 1414 $result = Helpers::transPrice($result);
1408 1415
1409 return $result; 1416 return $result;