diff --git a/framework b/framework index e9d066d..75bbc3b 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 diff --git a/static/js/shopping-cart/order-ensure.js b/static/js/shopping-cart/order-ensure.js index 60c6e34..3f44e01 100644 --- a/static/js/shopping-cart/order-ensure.js +++ b/static/js/shopping-cart/order-ensure.js @@ -15,6 +15,7 @@ var dispatchModeHammer, dispatchTimeHammer, $invoice = $('.invoice'), $price = $('.price-cal'), + payType, priceTmpl = Handlebars.compile($('#tmpl-price').html()); lazyLoad(); @@ -109,7 +110,24 @@ function submitOrder() { yohoCoin: orderInfo('yohoCoin') } }).then(function(res) { - console.log(res); + var url; + + if (!res) { + tip.show('网络出错'); + return; + } + if (res.code === 200) { + if (payType === 2) { + + // 货到付款的进入订单页面 + url = '/home/orderDetail?order_code=' + res.data.order_code; + } else { + url = '/home/pay?order_code=' + res.data.order_code; + } + window.location.href = url; + } else { + tip.show(res.messege || '网络出错'); + } }).fail(function() { tip.show('网络出错'); }); @@ -155,7 +173,10 @@ $('#msg').find('input').on('blur', function() { }); $('.pay-mode').on('click', 'li', function() { - orderInfo('paymentTypeId', $(this).data('pay-id')); - orderInfo('paymentType', $(this).data('pay-type')); + var $this = $(this); + + orderInfo('paymentTypeId', $this.data('pay-id')); + orderInfo('paymentType', $this.data('pay-type')); + payType = $this.data('pay-type'); submitOrder(); }); diff --git a/template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml b/template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml index 4289ae2..f7ee8ce 100644 --- a/template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml +++ b/template/m.yohobuy.com/actions/index/shoppingCart/order-ensure.phtml @@ -67,16 +67,14 @@ </li> {{/if}} - {{# yohoCoin}} - <li class="coin" data-yoho-coin="{{.}}"> - <span class="title">YOHO币</span> - <span class="desc">可抵用¥{{.}}</span> - <span class="coin-check"> - <em>- ¥ {{.}}</em> - <i class="iconfont checkbox icon-cb-checked"></i> - </span> - </li> - {{/ yohoCoin}} + <li class="coin" data-yoho-coin="{{yohoCoin}}"> + <span class="title">YOHO币</span> + <span class="desc">可抵用¥{{yohoCoin}}</span> + <span class="coin-check"> + <em>- ¥ {{yohoCoin}}</em> + <i class="iconfont checkbox icon-cb-checked"></i> + </span> + </li> {{#if invoice}} <li class="invoice {{#if needInvoice}}focus{{/if}}"> diff --git a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php index 206daff..4037175 100644 --- a/yohobuy/m.yohobuy.com/application/models/Index/Cart.php +++ b/yohobuy/m.yohobuy.com/application/models/Index/Cart.php @@ -586,7 +586,7 @@ class CartModel $result['message'] = '请选择配送方式'; } else { $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin); - if ($orderSubRes && isset($orderSubRes['code'])) { + if ($orderSubRes && isset($orderSubRes['code'])) { $result = $orderSubRes; } }