Showing
1 changed file
with
21 additions
and
3 deletions
@@ -10,13 +10,18 @@ var $ = require('jquery'), | @@ -10,13 +10,18 @@ var $ = require('jquery'), | ||
10 | 10 | ||
11 | var orderId = $('#order-detail').data('id'); | 11 | var orderId = $('#order-detail').data('id'); |
12 | 12 | ||
13 | -var delHammer; | 13 | +var optHammer; |
14 | 14 | ||
15 | lazyLoad(); | 15 | lazyLoad(); |
16 | 16 | ||
17 | //订单删除 | 17 | //订单删除 |
18 | -delHammer = new Hammer(document.getElementsByClassName('btn-del')[0]); | ||
19 | -delHammer.on('tap', function() { | 18 | +optHammer = new Hammer(document.getElementsByClassName('opt')[0]); |
19 | +optHammer.on('tap', function(e) { | ||
20 | + var $cur = $(e.target); | ||
21 | + | ||
22 | + if ($cur.hasClass('btn-del')) { | ||
23 | + | ||
24 | + //删除订单 | ||
20 | if (confirm('确定删除订单吗?')) { | 25 | if (confirm('确定删除订单吗?')) { |
21 | $.ajax({ | 26 | $.ajax({ |
22 | type: 'GET', | 27 | type: 'GET', |
@@ -26,4 +31,17 @@ delHammer.on('tap', function() { | @@ -26,4 +31,17 @@ delHammer.on('tap', function() { | ||
26 | } | 31 | } |
27 | }); | 32 | }); |
28 | } | 33 | } |
34 | + } else if ($cur.hasClass('btn-cancel')) { | ||
35 | + | ||
36 | + //取消订单 | ||
37 | + if (confirm('确定取消订单吗?')) { | ||
38 | + $.ajax({ | ||
39 | + type: 'GET', | ||
40 | + url: '/home/cancelOrder', | ||
41 | + data: { | ||
42 | + id: orderId | ||
43 | + } | ||
44 | + }); | ||
45 | + } | ||
46 | + } | ||
29 | }); | 47 | }); |
-
Please register or login to post a comment