Authored by xuqi

order opt

... ... @@ -10,20 +10,38 @@ var $ = require('jquery'),
var orderId = $('#order-detail').data('id');
var delHammer;
var optHammer;
lazyLoad();
//订单删除
delHammer = new Hammer(document.getElementsByClassName('btn-del')[0]);
delHammer.on('tap', function() {
if (confirm('确定删除订单吗?')) {
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: orderId
}
});
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
optHammer.on('tap', function(e) {
var $cur = $(e.target);
if ($cur.hasClass('btn-del')) {
//删除订单
if (confirm('确定删除订单吗?')) {
$.ajax({
type: 'GET',
url: '/home/delOrder',
data: {
id: orderId
}
});
}
} else if ($cur.hasClass('btn-cancel')) {
//取消订单
if (confirm('确定取消订单吗?')) {
$.ajax({
type: 'GET',
url: '/home/cancelOrder',
data: {
id: orderId
}
});
}
}
});
\ No newline at end of file
... ...