Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
3 changed files
with
11 additions
and
9 deletions
@@ -106,7 +106,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | @@ -106,7 +106,7 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { | ||
106 | }); | 106 | }); |
107 | orderInfo('couponCode', null); | 107 | orderInfo('couponCode', null); |
108 | orderInfo('couponName', null); | 108 | orderInfo('couponName', null); |
109 | - history.go(0); | 109 | + window.location.href = '/cart/index/index?cartType=' + $('#cartType').val(); |
110 | } else { | 110 | } else { |
111 | tip.show(data.message); | 111 | tip.show(data.message); |
112 | } | 112 | } |
@@ -313,10 +313,10 @@ class CartModel | @@ -313,10 +313,10 @@ class CartModel | ||
313 | * | 313 | * |
314 | * @param int $uid 用户ID | 314 | * @param int $uid 用户ID |
315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 | 315 | * @param string $cartType 购物车类型,ordinary表示普通购物车 |
316 | - * @param null|string $cookieData cookie中记录的一些订单有关数据 | 316 | + * @param array $orderInfo cookie中记录的一些订单有关数据 |
317 | * @return array 接口返回的数据 | 317 | * @return array 接口返回的数据 |
318 | */ | 318 | */ |
319 | - public static function cartPay($uid, $cartType, $cookieData) | 319 | + public static function cartPay($uid, $cartType, $orderInfo) |
320 | { | 320 | { |
321 | $result = array(); | 321 | $result = array(); |
322 | 322 | ||
@@ -324,13 +324,11 @@ class CartModel | @@ -324,13 +324,11 @@ class CartModel | ||
324 | 324 | ||
325 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { | 325 | if ($pay && isset($pay['code']) && $pay['code'] === 200) { |
326 | $payReturn = $pay['data']; | 326 | $payReturn = $pay['data']; |
327 | - $orderInfo = array(); | ||
328 | $address = array(); | 327 | $address = array(); |
329 | $orderCompute = array(); | 328 | $orderCompute = array(); |
330 | 329 | ||
331 | // cookie保存的数据 | 330 | // cookie保存的数据 |
332 | - if (!empty($cookieData)) { | ||
333 | - $orderInfo = json_decode($cookieData, true); | 331 | + if (!empty($orderInfo)) { |
334 | $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); | 332 | $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']); |
335 | } | 333 | } |
336 | 334 |
@@ -277,6 +277,12 @@ class IndexController extends AbstractAction | @@ -277,6 +277,12 @@ class IndexController extends AbstractAction | ||
277 | 277 | ||
278 | // 购物车商品为空跳转到购物车页面 | 278 | // 购物车商品为空跳转到购物车页面 |
279 | $cartType = $this->get('cartType', 'ordinary'); | 279 | $cartType = $this->get('cartType', 'ordinary'); |
280 | + $cookieData = $this->getCookie('order-info', null); | ||
281 | + $orderInfo = array(); | ||
282 | + if (!empty($cookieData)) { | ||
283 | + $orderInfo = json_decode($cookieData, true); | ||
284 | + $cartType = $orderInfo['cartType']; | ||
285 | + } | ||
280 | $cartKey = 'commonCart'; | 286 | $cartKey = 'commonCart'; |
281 | if ($cartType === 'advance') { | 287 | if ($cartType === 'advance') { |
282 | $cartKey = 'preSellCart'; | 288 | $cartKey = 'preSellCart'; |
@@ -289,12 +295,10 @@ class IndexController extends AbstractAction | @@ -289,12 +295,10 @@ class IndexController extends AbstractAction | ||
289 | $this->go(Helpers::url('/cart/index/index')); | 295 | $this->go(Helpers::url('/cart/index/index')); |
290 | } | 296 | } |
291 | 297 | ||
292 | - $cookieData = $this->getCookie('order-info', null); | ||
293 | - $uid = $this->getUid(true); | ||
294 | $data = array( | 298 | $data = array( |
295 | 'orderEnsurePage' => true, | 299 | 'orderEnsurePage' => true, |
296 | 'isOrdinaryCart' => ($cartType !== 'advance'), | 300 | 'isOrdinaryCart' => ($cartType !== 'advance'), |
297 | - 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) | 301 | + 'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo) |
298 | ); | 302 | ); |
299 | 303 | ||
300 | $this->_view->display('order-ensure', $data); | 304 | $this->_view->display('order-ensure', $data); |
-
Please register or login to post a comment