Authored by cailing

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

... ... @@ -113,8 +113,18 @@ $invoice.on('touchend', '.checkbox', function() {
}
});
function updateDeliverId(id) {
var $moreJit = $('.more-jit a').get(0),
url = $moreJit.href;
$moreJit.href = url.replace(/deliveryId=(\d)/, 'deliveryId=' + id);
}
function orderCompute() {
var yohoCoin = orderInfo('yohoCoin');
var deliverId = orderInfo('deliveryId');
loading.showLoadingMask();
$.ajax({
... ... @@ -153,6 +163,8 @@ function orderCompute() {
$('.bill span').html('¥' + res.last_order_amount);
$('.total').html(total);
}
updateDeliverId(deliverId);
}
}).fail(function() {
window.location.reload();
... ...
... ... @@ -344,7 +344,6 @@ class CartModel
$result['isLimit'] = true;
}
$pay = CartData::cartPay($uid, $cartType, 0, $skuList);
// print_r($pay);
do {
if (!$pay || $pay['code'] != 200 || empty($pay['data']['goods_list'])) {
... ... @@ -524,11 +523,14 @@ class CartModel
//判断是否为JIT商品
if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
$result['isJit'] = true;
$result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
$jitInfo = array();
if(!empty($orderInfo)){
$jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType'=> $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']);
}
//传递相关参数
$param =array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo);
$result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', $param);
}
//测试
// $result['isJit'] = true;
// $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
$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, true);
... ... @@ -991,18 +993,31 @@ class CartModel
* @param type $skuList cookie中记录的一些订单有关数据
* @param type $orderCode 订单号
* @param type $sessionKey 用户会话
* @return type
* @param type $deliveryId 配送方式,1表示普通快递,2表示顺丰速运
* @param type $paymentType 支付方式,1表示在线支付,2表示货到付款
* @param type $couponCode 优惠券码
* @param type $yohoCoin 使用的YOHO币数量
* @return type
*/
public static function getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey)
public static function getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey, $deliveryId, $paymentType, $couponCode, $yohoCoin)
{
$result = array('jitDetailPage' => true, 'packages' => array());
if ($cartType) {
//购物车中结算页拆单
$carpay = CartData::cartPay($uid, $cartType, 0, $skuList);
if (isset($carpay['data']['shopping_cart_data']['package_list'])) {
$packageList = $carpay['data']['shopping_cart_data']['package_list'];
//返回地址跳转
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
if(isset($deliveryId) && !empty($deliveryId)){
//购物车选择改变字段,重新运算订单数据
$newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList);
if(isset($newcar['data']['package_list'])){
$packageList = $newcar['data']['package_list'];
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
}
}else{
$carpay = CartData::cartPay($uid, $cartType, 0, $skuList);
if (isset($carpay['data']['shopping_cart_data']['package_list'])) {
$packageList = $carpay['data']['shopping_cart_data']['package_list'];
//返回地址跳转
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
}
}
}
else {
... ...
... ... @@ -315,7 +315,6 @@ class IndexController extends AbstractAction
$uid = $this->getUid(true);
$isAjax = $this->isAjax();
$order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber, $isAjax);
// print_r($order);
if (isset($order['cartUrl'])) { // 普通或者预售商品为空时
$this->go($order['cartUrl']);
}
... ... @@ -545,7 +544,12 @@ class IndexController extends AbstractAction
$skuList = $this->get('skuList', ''); //cookie中记录的一些订单有关数据
$orderCode = $this->get('orderCode', ''); //订单号
$sessionKey = $this->get('sessionKey', ''); //用户会话
$data = CartModel::getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey);
$deliveryId = $this->get('deliveryId', ''); //配送方式,1表示普通快递,2表示顺丰速运
$paymentType = $this->get('paymentType', ''); //支付方式,1表示在线支付,2表示货到付款
$couponCode = $this->get('couponCode', ''); //优惠券码
$yohoCoin = $this->get('yohoCoin', ''); //使用的YOHO币数量
$data = CartModel::getPackageInfo($uid, $cartType, $skuList, $orderCode, $sessionKey, $deliveryId, $paymentType, $couponCode, $yohoCoin);
$this->setTitle('配送信息');
$this->setNavHeader('配送信息', $data['returnUrl'], false); // 不显示右上角home按钮
... ...