diff --git a/static/js/cart/order-ensure.js b/static/js/cart/order-ensure.js index 4fddb94..44847aa 100644 --- a/static/js/cart/order-ensure.js +++ b/static/js/cart/order-ensure.js @@ -95,12 +95,13 @@ function orderCompute() { } if (res.discount_amount) { res.discount_amount = (+res.discount_amount).toFixed(2); - } + }*/ if (res.last_order_amount) { res.last_order_amount = (+res.last_order_amount).toFixed(2); - }*/ + } priceHtml = priceTmpl({ - cartPayData: res.promotion_formula_list + cartPayData: res.promotion_formula_list, + price: res.last_order_amount }); $price.html(priceHtml); diff --git a/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml b/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml index 33d8308..a769454 100644 --- a/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml +++ b/template/m.yohobuy.com/actions/cart/index/order-ensure.phtml @@ -104,6 +104,9 @@ {{promotion_amount}} </li> {{/cartPayData}} + <li class="cost"> + 应付金额: <em>¥{{price}}</em> + </li> </ul> </section> @@ -131,6 +134,9 @@ \{{promotion_amount}} </li> \{{/cartPayData}} + <li class="cost"> + 应付金额: <em>¥\{{price}}</em> + </li> </ul> </script> {{> layout/footer}} diff --git a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php index 51305bc..31f8769 100644 --- a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php +++ b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php @@ -451,6 +451,8 @@ 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); /*$sumPrice = isset($orderCompute['order_amount']) ? $orderCompute['order_amount'] : $payReturn['shopping_cart_data']['order_amount']; @@ -569,17 +571,21 @@ class CartModel $coupons = CartData::getCouponList($uid); do { - if ($onlyTotal) { - $result['count'] = count($coupons['data']['couponList']); - break; - } - if (isset($coupons['data']['couponList'])) { - foreach ($coupons['data']['couponList'] as &$val) { - $val['notAvailable'] = $val['isValidity'] === 'N'; + foreach ($coupons['data']['couponList'] as $val) { + $notAvailableRes = self::searchCoupon($uid, $val['couponCode']); + // 处理可用的优惠券 + if ($val['isValidity'] === 'N' || (isset($notAvailableRes['code']) && $notAvailableRes['code'] !== 200)) { +// $val['notAvailable'] = true; + continue; + } + $result[] = $val; } + } - $result = $coupons['data']['couponList']; + if ($onlyTotal) { + $count = count($result); + $result = array('count' => $count); } }while(0);