Authored by cailing

确认订单页拆单商品运费修改

@@ -113,8 +113,18 @@ $invoice.on('touchend', '.checkbox', function() { @@ -113,8 +113,18 @@ $invoice.on('touchend', '.checkbox', function() {
113 } 113 }
114 }); 114 });
115 115
  116 +
  117 +function updateDeliverId(id) {
  118 + var $moreJit = $('.more-jit a').get(0),
  119 + url = $moreJit.href;
  120 +
  121 + $moreJit.href = url.replace(/deliveryId=(\d)/, 'deliveryId=' + id);
  122 +}
  123 +
116 function orderCompute() { 124 function orderCompute() {
117 var yohoCoin = orderInfo('yohoCoin'); 125 var yohoCoin = orderInfo('yohoCoin');
  126 +
  127 + var deliverId = orderInfo('deliveryId');
118 128
119 loading.showLoadingMask(); 129 loading.showLoadingMask();
120 $.ajax({ 130 $.ajax({
@@ -153,6 +163,8 @@ function orderCompute() { @@ -153,6 +163,8 @@ function orderCompute() {
153 $('.bill span').html('¥' + res.last_order_amount); 163 $('.bill span').html('¥' + res.last_order_amount);
154 $('.total').html(total); 164 $('.total').html(total);
155 } 165 }
  166 +
  167 + updateDeliverId(deliverId);
156 } 168 }
157 }).fail(function() { 169 }).fail(function() {
158 window.location.reload(); 170 window.location.reload();
@@ -344,7 +344,6 @@ class CartModel @@ -344,7 +344,6 @@ class CartModel
344 $result['isLimit'] = true; 344 $result['isLimit'] = true;
345 } 345 }
346 $pay = CartData::cartPay($uid, $cartType, 0, $skuList); 346 $pay = CartData::cartPay($uid, $cartType, 0, $skuList);
347 -// print_r($pay);  
348 347
349 do { 348 do {
350 if (!$pay || $pay['code'] != 200 || empty($pay['data']['goods_list'])) { 349 if (!$pay || $pay['code'] != 200 || empty($pay['data']['goods_list'])) {
@@ -524,11 +523,14 @@ class CartModel @@ -524,11 +523,14 @@ class CartModel
524 //判断是否为JIT商品 523 //判断是否为JIT商品
525 if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') { 524 if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
526 $result['isJit'] = true; 525 $result['isJit'] = true;
527 - $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList)); 526 + $jitInfo = array();
  527 + if(!empty($orderInfo)){
  528 + $jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType'=> $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']);
  529 + }
  530 + //传递相关参数
  531 + $param =array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo);
  532 + $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', $param);
528 } 533 }
529 - //测试  
530 -// $result['isJit'] = true;  
531 -// $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));  
532 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list']; 534 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
533 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; 535 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
534 $result['price'] = Helpers::transPrice($price, true); 536 $result['price'] = Helpers::transPrice($price, true);
@@ -991,18 +993,31 @@ class CartModel @@ -991,18 +993,31 @@ class CartModel
991 * @param type $skuList cookie中记录的一些订单有关数据 993 * @param type $skuList cookie中记录的一些订单有关数据
992 * @param type $orderCode 订单号 994 * @param type $orderCode 订单号
993 * @param type $sessionKey 用户会话 995 * @param type $sessionKey 用户会话
994 - * @return type 996 + * @param type $deliveryId 配送方式,1表示普通快递,2表示顺丰速运
  997 + * @param type $paymentType 支付方式,1表示在线支付,2表示货到付款
  998 + * @param type $couponCode 优惠券码
  999 + * @param type $yohoCoin 使用的YOHO币数量
  1000 + * @return type
995 */ 1001 */
996 - public static function getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey) 1002 + public static function getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey, $deliveryId, $paymentType, $couponCode, $yohoCoin)
997 { 1003 {
998 $result = array('jitDetailPage' => true, 'packages' => array()); 1004 $result = array('jitDetailPage' => true, 'packages' => array());
999 if ($cartType) { 1005 if ($cartType) {
1000 //购物车中结算页拆单 1006 //购物车中结算页拆单
1001 - $carpay = CartData::cartPay($uid, $cartType, 0, $skuList);  
1002 - if (isset($carpay['data']['shopping_cart_data']['package_list'])) {  
1003 - $packageList = $carpay['data']['shopping_cart_data']['package_list'];  
1004 - //返回地址跳转  
1005 - $result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType)); 1007 + if(isset($deliveryId) && !empty($deliveryId)){
  1008 + //购物车选择改变字段,重新运算订单数据
  1009 + $newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList);
  1010 + if(isset($newcar['data']['package_list'])){
  1011 + $packageList = $newcar['data']['package_list'];
  1012 + $result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
  1013 + }
  1014 + }else{
  1015 + $carpay = CartData::cartPay($uid, $cartType, 0, $skuList);
  1016 + if (isset($carpay['data']['shopping_cart_data']['package_list'])) {
  1017 + $packageList = $carpay['data']['shopping_cart_data']['package_list'];
  1018 + //返回地址跳转
  1019 + $result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
  1020 + }
1006 } 1021 }
1007 } 1022 }
1008 else { 1023 else {
@@ -315,7 +315,6 @@ class IndexController extends AbstractAction @@ -315,7 +315,6 @@ class IndexController extends AbstractAction
315 $uid = $this->getUid(true); 315 $uid = $this->getUid(true);
316 $isAjax = $this->isAjax(); 316 $isAjax = $this->isAjax();
317 $order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber, $isAjax); 317 $order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber, $isAjax);
318 -// print_r($order);  
319 if (isset($order['cartUrl'])) { // 普通或者预售商品为空时 318 if (isset($order['cartUrl'])) { // 普通或者预售商品为空时
320 $this->go($order['cartUrl']); 319 $this->go($order['cartUrl']);
321 } 320 }
@@ -545,7 +544,12 @@ class IndexController extends AbstractAction @@ -545,7 +544,12 @@ class IndexController extends AbstractAction
545 $skuList = $this->get('skuList', ''); //cookie中记录的一些订单有关数据 544 $skuList = $this->get('skuList', ''); //cookie中记录的一些订单有关数据
546 $orderCode = $this->get('orderCode', ''); //订单号 545 $orderCode = $this->get('orderCode', ''); //订单号
547 $sessionKey = $this->get('sessionKey', ''); //用户会话 546 $sessionKey = $this->get('sessionKey', ''); //用户会话
548 - $data = CartModel::getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey); 547 + $deliveryId = $this->get('deliveryId', ''); //配送方式,1表示普通快递,2表示顺丰速运
  548 + $paymentType = $this->get('paymentType', ''); //支付方式,1表示在线支付,2表示货到付款
  549 + $couponCode = $this->get('couponCode', ''); //优惠券码
  550 + $yohoCoin = $this->get('yohoCoin', ''); //使用的YOHO币数量
  551 +
  552 + $data = CartModel::getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey, $deliveryId, $paymentType, $couponCode, $yohoCoin);
549 553
550 $this->setTitle('配送信息'); 554 $this->setTitle('配送信息');
551 $this->setNavHeader('配送信息', $data['returnUrl'], false); // 不显示右上角home按钮 555 $this->setNavHeader('配送信息', $data['returnUrl'], false); // 不显示右上角home按钮