Showing
1 changed file
with
29 additions
and
11 deletions
@@ -10,20 +10,38 @@ var $ = require('jquery'), | @@ -10,20 +10,38 @@ 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() { | ||
20 | - if (confirm('确定删除订单吗?')) { | ||
21 | - $.ajax({ | ||
22 | - type: 'GET', | ||
23 | - url: '/home/delOrder', | ||
24 | - data: { | ||
25 | - id: orderId | ||
26 | - } | ||
27 | - }); | 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 | + //删除订单 | ||
25 | + if (confirm('确定删除订单吗?')) { | ||
26 | + $.ajax({ | ||
27 | + type: 'GET', | ||
28 | + url: '/home/delOrder', | ||
29 | + data: { | ||
30 | + id: orderId | ||
31 | + } | ||
32 | + }); | ||
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 | + } | ||
28 | } | 46 | } |
29 | }); | 47 | }); |
-
Please register or login to post a comment