Authored by 周少峰

Merge branch 'release/4.4' of http://git.dev.yoho.cn/web/yohobuywap into release/4.4

... ... @@ -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();
... ...
... ... @@ -18,8 +18,7 @@ var $ = require('jquery'),
scH,
$nav1 = $('#pos-nav'),
$nav2 = $('#pos-list'),
sTop,
isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;//判断浏览器类型
sTop;
var tip = require('../plugin/tip'),
filter = require('../plugin/filter'),
... ... @@ -34,8 +33,6 @@ var $subNav = $('.home-sub-nav'),
$shopId = $('input[name="shop_id"]').val(),
$appVersion = $('input[name="app_version"]').val();
var swiper;
var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
... ... @@ -350,6 +347,10 @@ function search(opt) {
return;
}
if (!opt.url) {
opt.url = '/index/search/search';
}
//导航类别
if ($pre.hasClass('new')) {
navType = 'newest';
... ...
... ... @@ -37,8 +37,8 @@
<ul id="nav" class="nav">
<li class="active color buriedpoint" tab="home-page">首页</li>
<li tab="new-arrival buriedpoint">上新</li>
<li tab="popularity buriedpoint">人气</li>
<li tab="new-arrival" class="buriedpoint">上新</li>
<li tab="popularity" class="buriedpoint">人气</li>
<li class="all-goods buriedpoint">
<a href="{{allGoods}}">全部商品</a>
</li>
... ... @@ -119,8 +119,8 @@
{{/unless}}
<ul id="pos-nav" class="nav hide">
<li class="active color buriedpoint" tab="home-page">首页</li>
<li tab="new-arrival buriedpoint">上新</li>
<li tab="popularity buriedpoint">人气</li>
<li tab="new-arrival" class="buriedpoint">上新</li>
<li tab="popularity" class="buriedpoint">人气</li>
<li class="all-goods buriedpoint">
<a href="{{allGoods}}">全部商品</a>
</li>
... ...
... ... @@ -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按钮
... ...