Authored by 毕凯

订单列表 删除订单优化

... ... @@ -99,3 +99,7 @@ exports.showDialog = function(data, callback, callbackForLeft) {
event.srcEvent.stopPropagation();
});
};
exports.hideDialog = function() {
$('.dialog-wrapper').remove();
};
... ...
... ... @@ -6,7 +6,8 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
lazyLoad = require('yoho.lazyload'),
tip = require('../plugin/tip');
var $navLi = $('#order-nav > li'),
$orderContainer = $('#order-container');
... ... @@ -132,23 +133,18 @@ orderHammer.on('tap', function(e) {
id: id
},
success: function(data) {
dialog.hideDialog();
if (data.message) {
tip.show(data.message);
}
if (data.code === 200) {
dialog.showDialog({
dialogText: '删除订单成功',
autoHide: true,
fast: true
});
//删除订单页面刷新
history.go(0);
window.location.reload();
}
},
error: function() {
dialog.showDialog({
dialogText: '删除订单失败',
autoHide: true,
fast: true
});
tip.show('取消订单失败');
}
});
});
... ... @@ -169,23 +165,17 @@ orderHammer.on('tap', function(e) {
id: id
},
success: function(data) {
if (data.message) {
tip.show(data.message);
}
if (data.code === 200) {
dialog.showDialog({
dialogText: '取消订单成功',
autoHide: true,
fast: true
});
//取消订单页面刷新
history.go(0);
window.location.reload();
}
},
error: function() {
dialog.showDialog({
dialogText: '取消订单失败',
autoHide: true,
fast: true
});
tip.show('取消订单失败');
}
});
});
... ...