Authored by xuqi

order opt confirm

@@ -26,6 +26,8 @@ var inAjax = false; @@ -26,6 +26,8 @@ var inAjax = false;
26 26
27 var loading = require('../plugin/loading'); 27 var loading = require('../plugin/loading');
28 28
  29 +var dialog = require('./dialog');
  30 +
29 var orderHammer; 31 var orderHammer;
30 32
31 //加载订单 33 //加载订单
@@ -110,36 +112,52 @@ orderHammer.on('tap', function(e) { @@ -110,36 +112,52 @@ orderHammer.on('tap', function(e) {
110 if ($cur.closest('.del').length > 0) { 112 if ($cur.closest('.del').length > 0) {
111 113
112 //Order delete 114 //Order delete
113 - $.ajax({  
114 - type: 'GET',  
115 - url: '/home/delOrder',  
116 - data: {  
117 - id: id  
118 - },  
119 - success: function(data) {  
120 - if (data.code === 200) {  
121 -  
122 - //删除订单页面刷新  
123 - location.href = location.href;  
124 - } 115 + dialog.showDialog({
  116 + dialogText: '确定删除订单吗?',
  117 + hasFooter: {
  118 + leftBtnText: '取消',
  119 + rightBtnText: '确定'
125 } 120 }
  121 + }, function() {
  122 + $.ajax({
  123 + type: 'GET',
  124 + url: '/home/delOrder',
  125 + data: {
  126 + id: id
  127 + },
  128 + success: function(data) {
  129 + if (data.code === 200) {
  130 +
  131 + //删除订单页面刷新
  132 + location.href = location.href;
  133 + }
  134 + }
  135 + });
126 }); 136 });
127 } else if ($cur.closest('.cancel').length > 0) { 137 } else if ($cur.closest('.cancel').length > 0) {
128 138
129 //Order cancel 139 //Order cancel
130 - $.ajax({  
131 - type: 'GET',  
132 - url: '/home/cancelOrder',  
133 - data: {  
134 - id: id  
135 - },  
136 - success: function(data) {  
137 - if (data.code === 200) {  
138 -  
139 - //取消订单页面刷新  
140 - location.href = location.href;  
141 - } 140 + dialog.showDialog({
  141 + dialogText: '确定取消订单吗?',
  142 + hasFooter: {
  143 + leftBtnText: '取消',
  144 + rightBtnText: '确定'
142 } 145 }
  146 + }, function() {
  147 + $.ajax({
  148 + type: 'GET',
  149 + url: '/home/cancelOrder',
  150 + data: {
  151 + id: id
  152 + },
  153 + success: function(data) {
  154 + if (data.code === 200) {
  155 +
  156 + //取消订单页面刷新
  157 + location.href = location.href;
  158 + }
  159 + }
  160 + });
143 }); 161 });
144 } else { 162 } else {
145 163