...
|
...
|
@@ -6,7 +6,9 @@ |
|
|
|
|
|
var $ = require('jquery'),
|
|
|
lazyLoad = require('yoho.lazyload'),
|
|
|
Hammer = require('yoho.hammer');
|
|
|
Hammer = require('yoho.hammer'),
|
|
|
dialog = require('./dialog'),
|
|
|
tip = require('../plugin/tip');
|
|
|
|
|
|
var orderId = $('#order-detail').data('id');
|
|
|
|
...
|
...
|
@@ -24,26 +26,64 @@ optHammer.on('tap', function(e) { |
|
|
if ($cur.hasClass('btn-del')) {
|
|
|
|
|
|
//删除订单
|
|
|
if (confirm('确定删除订单吗?')) {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '确定删除订单吗?',
|
|
|
hasFooter: {
|
|
|
leftBtnText: '取消',
|
|
|
rightBtnText: '确定'
|
|
|
}
|
|
|
}, function() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/home/delOrder',
|
|
|
data: {
|
|
|
id: orderId
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
$('#dialog-wrapper').hide();
|
|
|
if (!res) {
|
|
|
tip.show('网络错误');
|
|
|
}
|
|
|
if (res.code === 200) {
|
|
|
tip.show('删除成功');
|
|
|
} else {
|
|
|
tip.show(res.message || '网络错误');
|
|
|
}
|
|
|
window.location.href = '/home/orders';
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
} else if ($cur.hasClass('btn-cancel')) {
|
|
|
|
|
|
//取消订单
|
|
|
if (confirm('确定取消订单吗?')) {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '确定取消订单吗?',
|
|
|
hasFooter: {
|
|
|
leftBtnText: '取消',
|
|
|
rightBtnText: '确定'
|
|
|
}
|
|
|
}, function() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/home/cancelOrder',
|
|
|
data: {
|
|
|
id: orderId
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
$('#dialog-wrapper').hide();
|
|
|
if (!res) {
|
|
|
tip.show('网络错误');
|
|
|
}
|
|
|
if (res.code === 200) {
|
|
|
tip.show('取消成功');
|
|
|
} else {
|
|
|
tip.show(res.message || '网络错误');
|
|
|
}
|
|
|
window.location.reload();
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}); |
|
|
\ No newline at end of file |
|
|
}); |
...
|
...
|
|