Authored by 毕凯

修正订单确认提交数据

framework @ 75bbc3b0
1 -Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -15,6 +15,7 @@ var dispatchModeHammer, @@ -15,6 +15,7 @@ var dispatchModeHammer,
15 dispatchTimeHammer, 15 dispatchTimeHammer,
16 $invoice = $('.invoice'), 16 $invoice = $('.invoice'),
17 $price = $('.price-cal'), 17 $price = $('.price-cal'),
  18 + payType,
18 priceTmpl = Handlebars.compile($('#tmpl-price').html()); 19 priceTmpl = Handlebars.compile($('#tmpl-price').html());
19 20
20 lazyLoad(); 21 lazyLoad();
@@ -109,7 +110,24 @@ function submitOrder() { @@ -109,7 +110,24 @@ function submitOrder() {
109 yohoCoin: orderInfo('yohoCoin') 110 yohoCoin: orderInfo('yohoCoin')
110 } 111 }
111 }).then(function(res) { 112 }).then(function(res) {
112 - console.log(res); 113 + var url;
  114 +
  115 + if (!res) {
  116 + tip.show('网络出错');
  117 + return;
  118 + }
  119 + if (res.code === 200) {
  120 + if (payType === 2) {
  121 +
  122 + // 货到付款的进入订单页面
  123 + url = '/home/orderDetail?order_code=' + res.data.order_code;
  124 + } else {
  125 + url = '/home/pay?order_code=' + res.data.order_code;
  126 + }
  127 + window.location.href = url;
  128 + } else {
  129 + tip.show(res.messege || '网络出错');
  130 + }
113 }).fail(function() { 131 }).fail(function() {
114 tip.show('网络出错'); 132 tip.show('网络出错');
115 }); 133 });
@@ -155,7 +173,10 @@ $('#msg').find('input').on('blur', function() { @@ -155,7 +173,10 @@ $('#msg').find('input').on('blur', function() {
155 }); 173 });
156 174
157 $('.pay-mode').on('click', 'li', function() { 175 $('.pay-mode').on('click', 'li', function() {
158 - orderInfo('paymentTypeId', $(this).data('pay-id'));  
159 - orderInfo('paymentType', $(this).data('pay-type')); 176 + var $this = $(this);
  177 +
  178 + orderInfo('paymentTypeId', $this.data('pay-id'));
  179 + orderInfo('paymentType', $this.data('pay-type'));
  180 + payType = $this.data('pay-type');
160 submitOrder(); 181 submitOrder();
161 }); 182 });
@@ -67,16 +67,14 @@ @@ -67,16 +67,14 @@
67 </li> 67 </li>
68 {{/if}} 68 {{/if}}
69 69
70 - {{# yohoCoin}}  
71 - <li class="coin" data-yoho-coin="{{.}}">  
72 - <span class="title">YOHO币</span>  
73 - <span class="desc">可抵用¥{{.}}</span>  
74 - <span class="coin-check">  
75 - <em>- ¥ {{.}}</em>  
76 - <i class="iconfont checkbox icon-cb-checked"></i>  
77 - </span>  
78 - </li>  
79 - {{/ yohoCoin}} 70 + <li class="coin" data-yoho-coin="{{yohoCoin}}">
  71 + <span class="title">YOHO币</span>
  72 + <span class="desc">可抵用¥{{yohoCoin}}</span>
  73 + <span class="coin-check">
  74 + <em>- ¥ {{yohoCoin}}</em>
  75 + <i class="iconfont checkbox icon-cb-checked"></i>
  76 + </span>
  77 + </li>
80 78
81 {{#if invoice}} 79 {{#if invoice}}
82 <li class="invoice {{#if needInvoice}}focus{{/if}}"> 80 <li class="invoice {{#if needInvoice}}focus{{/if}}">
@@ -586,7 +586,7 @@ class CartModel @@ -586,7 +586,7 @@ class CartModel
586 $result['message'] = '请选择配送方式'; 586 $result['message'] = '请选择配送方式';
587 } else { 587 } else {
588 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin); 588 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
589 - if ($orderSubRes && isset($orderSubRes['code'])) { 589 + if ($orderSubRes && isset($orderSubRes['code'])) {
590 $result = $orderSubRes; 590 $result = $orderSubRes;
591 } 591 }
592 } 592 }