Authored by Rock Zhang

修复预售商品结算时,选择地址之后会变为普通购物车的bug

... ... @@ -313,10 +313,10 @@ class CartModel
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param null|string $cookieData cookie中记录的一些订单有关数据
* @param array $orderInfo cookie中记录的一些订单有关数据
* @return array 接口返回的数据
*/
public static function cartPay($uid, $cartType, $cookieData)
public static function cartPay($uid, $cartType, $orderInfo)
{
$result = array();
... ... @@ -324,13 +324,11 @@ class CartModel
if ($pay && isset($pay['code']) && $pay['code'] === 200) {
$payReturn = $pay['data'];
$orderInfo = array();
$address = array();
$orderCompute = array();
// cookie保存的数据
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
if (!empty($orderInfo)) {
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
}
... ...
... ... @@ -277,6 +277,12 @@ class IndexController extends AbstractAction
// 购物车商品为空跳转到购物车页面
$cartType = $this->get('cartType', 'ordinary');
$cookieData = $this->getCookie('order-info', null);
$orderInfo = array();
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$cartType = $orderInfo['cartType'];
}
$cartKey = 'commonCart';
if ($cartType === 'advance') {
$cartKey = 'preSellCart';
... ... @@ -289,12 +295,10 @@ class IndexController extends AbstractAction
$this->go(Helpers::url('/cart/index/index'));
}
$cookieData = $this->getCookie('order-info', null);
$uid = $this->getUid(true);
$data = array(
'orderEnsurePage' => true,
'isOrdinaryCart' => ($cartType !== 'advance'),
'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
'orderEnsure' => CartModel::cartPay($uid, $cartType, $orderInfo)
);
$this->_view->display('order-ensure', $data);
... ...