Authored by 毕凯

添加订单提交 loading

@@ -9,6 +9,7 @@ var $ = require('jquery'), @@ -9,6 +9,7 @@ var $ = require('jquery'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
10 Handlebars = require('yoho.handlebars'), 10 Handlebars = require('yoho.handlebars'),
11 tip = require('../plugin/tip'), 11 tip = require('../plugin/tip'),
  12 + loading = require('../plugin/loading'),
12 orderInfo = require('./order-info').orderInfo; 13 orderInfo = require('./order-info').orderInfo;
13 14
14 var dispatchModeHammer, 15 var dispatchModeHammer,
@@ -94,6 +95,7 @@ function orderCompute() { @@ -94,6 +95,7 @@ function orderCompute() {
94 } 95 }
95 96
96 function submitOrder() { 97 function submitOrder() {
  98 + loading.showLoadingMask();
97 $.ajax({ 99 $.ajax({
98 method: 'POST', 100 method: 'POST',
99 url: '/shoppingCart/orderSub', 101 url: '/shoppingCart/orderSub',
@@ -114,6 +116,7 @@ function submitOrder() { @@ -114,6 +116,7 @@ function submitOrder() {
114 var url; 116 var url;
115 117
116 if (!res) { 118 if (!res) {
  119 + loading.hideLoadingMask();
117 tip.show('网络出错'); 120 tip.show('网络出错');
118 return; 121 return;
119 } 122 }
@@ -128,9 +131,11 @@ function submitOrder() { @@ -128,9 +131,11 @@ function submitOrder() {
128 window.setCookie('order-info', ''); 131 window.setCookie('order-info', '');
129 window.location.href = url; 132 window.location.href = url;
130 } else { 133 } else {
  134 + loading.hideLoadingMask();
131 tip.show(res.messege || '网络出错'); 135 tip.show(res.messege || '网络出错');
132 } 136 }
133 }).fail(function() { 137 }).fail(function() {
  138 + loading.hideLoadingMask();
134 tip.show('网络出错'); 139 tip.show('网络出错');
135 }); 140 });
136 } 141 }