Authored by Rock Zhang

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/cart

framework @ 75bbc3b0
1 -Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -98,8 +98,8 @@ function submitOrder() { @@ -98,8 +98,8 @@ function submitOrder() {
98 data: { 98 data: {
99 addressId: orderInfo('addressId'), 99 addressId: orderInfo('addressId'),
100 cartType: orderInfo('cartType'), 100 cartType: orderInfo('cartType'),
101 - deliveryId: orderInfo('deliveryId'),  
102 - deliveryTimeId: orderInfo('deliveryTimeId'), 101 + deliveryId: orderInfo('deliveryId') || 1,
  102 + deliveryTimeId: orderInfo('deliveryTimeId') || 1,
103 invoiceText: orderInfo('invoiceText'), 103 invoiceText: orderInfo('invoiceText'),
104 invoiceType: orderInfo('invoiceType'), 104 invoiceType: orderInfo('invoiceType'),
105 msg: orderInfo('msg'), 105 msg: orderInfo('msg'),
@@ -109,13 +109,24 @@ function submitOrder() { @@ -109,13 +109,24 @@ function submitOrder() {
109 yohoCoin: orderInfo('yohoCoin') 109 yohoCoin: orderInfo('yohoCoin')
110 } 110 }
111 }).then(function(res) { 111 }).then(function(res) {
112 - console.log(res); 112 + if (!res) {
  113 + tip.show('网络出错');
  114 + }
  115 + if (res.code !== 200) {
  116 + tip.show(res.message || '网络出错');
  117 + } else {
  118 + console.log(1);
  119 + }
113 }).fail(function() { 120 }).fail(function() {
114 tip.show('网络出错'); 121 tip.show('网络出错');
115 }); 122 });
116 } 123 }
117 124
118 // 界面点击,状态存 cookie 125 // 界面点击,状态存 cookie
  126 +if (!orderInfo('addressId')) {
  127 + orderInfo('addressId', $('.address-wrap').data('address-id'));
  128 +}
  129 +
119 $('.dispatch-mode').on('touchend', 'li', function() { 130 $('.dispatch-mode').on('touchend', 'li', function() {
120 orderInfo('deliveryId', $(this).data('id')); 131 orderInfo('deliveryId', $(this).data('id'));
121 orderCompute(); 132 orderCompute();
@@ -22,6 +22,7 @@ try { @@ -22,6 +22,7 @@ try {
22 invoiceType: null, 22 invoiceType: null,
23 msg: null 23 msg: null
24 }; 24 };
  25 + window.setCookie('order-info', JSON.stringify(info));
25 } 26 }
26 27
27 exports.orderInfo = function(key, value) { 28 exports.orderInfo = function(key, value) {
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="order-ensure-page yoho-page"> 2 <div class="order-ensure-page yoho-page">
3 {{# orderEnsure}} 3 {{# orderEnsure}}
4 - <a class="address-wrap block" href="/shoppingCart/selectAddress"> 4 + <a class="address-wrap block" href="/shoppingCart/selectAddress" data-address-id="{{addressId}}">
5 <p class="infos"> 5 <p class="infos">
6 收货地址 6 收货地址
7 <span class="per-info">{{name}} {{phoneNum}}</span> 7 <span class="per-info">{{name}} {{phoneNum}}</span>
@@ -195,7 +195,7 @@ class ShoppingCartController extends AbstractAction @@ -195,7 +195,7 @@ class ShoppingCartController extends AbstractAction
195 'orderEnsurePage' => true, 195 'orderEnsurePage' => true,
196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData) 196 'orderEnsure' => CartModel::cartPay($uid, $cartType, $cookieData)
197 ); 197 );
198 - 198 + // var_dump($data);
199 $this->_view->display('order-ensure', $data); 199 $this->_view->display('order-ensure', $data);
200 } 200 }
201 201