Authored by 毕凯

订单列表 删除订单优化

@@ -99,3 +99,7 @@ exports.showDialog = function(data, callback, callbackForLeft) { @@ -99,3 +99,7 @@ exports.showDialog = function(data, callback, callbackForLeft) {
99 event.srcEvent.stopPropagation(); 99 event.srcEvent.stopPropagation();
100 }); 100 });
101 }; 101 };
  102 +
  103 +exports.hideDialog = function() {
  104 + $('.dialog-wrapper').remove();
  105 +};
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 6
7 var $ = require('jquery'), 7 var $ = require('jquery'),
8 Hammer = require('yoho.hammer'), 8 Hammer = require('yoho.hammer'),
9 - lazyLoad = require('yoho.lazyload'); 9 + lazyLoad = require('yoho.lazyload'),
  10 + tip = require('../plugin/tip');
10 11
11 var $navLi = $('#order-nav > li'), 12 var $navLi = $('#order-nav > li'),
12 $orderContainer = $('#order-container'); 13 $orderContainer = $('#order-container');
@@ -132,23 +133,18 @@ orderHammer.on('tap', function(e) { @@ -132,23 +133,18 @@ orderHammer.on('tap', function(e) {
132 id: id 133 id: id
133 }, 134 },
134 success: function(data) { 135 success: function(data) {
  136 + dialog.hideDialog();
  137 + if (data.message) {
  138 + tip.show(data.message);
  139 + }
135 if (data.code === 200) { 140 if (data.code === 200) {
136 - dialog.showDialog({  
137 - dialogText: '删除订单成功',  
138 - autoHide: true,  
139 - fast: true  
140 - });  
141 141
142 //删除订单页面刷新 142 //删除订单页面刷新
143 - history.go(0); 143 + window.location.reload();
144 } 144 }
145 }, 145 },
146 error: function() { 146 error: function() {
147 - dialog.showDialog({  
148 - dialogText: '删除订单失败',  
149 - autoHide: true,  
150 - fast: true  
151 - }); 147 + tip.show('取消订单失败');
152 } 148 }
153 }); 149 });
154 }); 150 });
@@ -169,23 +165,17 @@ orderHammer.on('tap', function(e) { @@ -169,23 +165,17 @@ orderHammer.on('tap', function(e) {
169 id: id 165 id: id
170 }, 166 },
171 success: function(data) { 167 success: function(data) {
  168 + if (data.message) {
  169 + tip.show(data.message);
  170 + }
172 if (data.code === 200) { 171 if (data.code === 200) {
173 - dialog.showDialog({  
174 - dialogText: '取消订单成功',  
175 - autoHide: true,  
176 - fast: true  
177 - });  
178 172
179 //取消订单页面刷新 173 //取消订单页面刷新
180 - history.go(0); 174 + window.location.reload();
181 } 175 }
182 }, 176 },
183 error: function() { 177 error: function() {
184 - dialog.showDialog({  
185 - dialogText: '取消订单失败',  
186 - autoHide: true,  
187 - fast: true  
188 - }); 178 + tip.show('取消订单失败');
189 } 179 }
190 }); 180 });
191 }); 181 });