Authored by 王洪广

add delete order

@@ -18,12 +18,8 @@ @@ -18,12 +18,8 @@
18 <p class="order-title"> 18 <p class="order-title">
19 订单编号:{{orderNum}} 19 订单编号:{{orderNum}}
20 <span class="order-time">下单时间:{{orderTime}}</span> 20 <span class="order-time">下单时间:{{orderTime}}</span>
21 - {{#if hasDelete}}  
22 - <a class="right order-delete" href="javascript:;" data-deleted="true">彻底删除</a>  
23 - {{^}}  
24 - {{#if canDelete}}  
25 - <a class="right order-delete" href="javascript:;">删除订单</a>  
26 - {{/if}} 21 + {{#if canDelete}}
  22 + <a class="right order-delete" href="javascript:;">删除订单</a>
27 {{/if}} 23 {{/if}}
28 </p> 24 </p>
29 <div class="order-wrap"> 25 <div class="order-wrap">
@@ -6,5 +6,4 @@ @@ -6,5 +6,4 @@
6 </li> 6 </li>
7 {{/ tabs}} 7 {{/ tabs}}
8 </ul> 8 </ul>
9 - <div class="recycle-bin"><a href=""><i></i>订单回收站</a></div>  
10 </div> 9 </div>
@@ -124,12 +124,12 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function (e) { @@ -124,12 +124,12 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function (e) {
124 }); 124 });
125 function deleteOrder(id, obj) { 125 function deleteOrder(id, obj) {
126 // 是否为彻底删除 126 // 是否为彻底删除
127 - var isFullyDelete = $(obj).data("deleted") || false;  
128 - var $order = $(obj).parents("order"); 127 + var isFullyDelete = true;
  128 + var $order = $(obj).parents(".order");
129 var deleteMessage = isFullyDelete ? "您确定要永久删除订单吗?" : "您确定要删除订单吗?"; 129 var deleteMessage = isFullyDelete ? "您确定要永久删除订单吗?" : "您确定要删除订单吗?";
130 var deleteTip = isFullyDelete ? "永久删除后,订单将无法恢复,您将无法对该订单的商品申请售后服务,请谨慎操作。" : "删除后,您可以在订单回收站找回该订单,也可以做永久删除。"; 130 var deleteTip = isFullyDelete ? "永久删除后,订单将无法恢复,您将无法对该订单的商品申请售后服务,请谨慎操作。" : "删除后,您可以在订单回收站找回该订单,也可以做永久删除。";
131 var insert = Handlebars.compile(deleteDialog); 131 var insert = Handlebars.compile(deleteDialog);
132 - var html = insert({deleteMessage: deleteMessage, deleteTip: deleteTip}) 132 + var html = insert({deleteMessage: deleteMessage, deleteTip: deleteTip});
133 var options = { 133 var options = {
134 mask: false, 134 mask: false,
135 btns: [ 135 btns: [
@@ -140,7 +140,7 @@ function deleteOrder(id, obj) { @@ -140,7 +140,7 @@ function deleteOrder(id, obj) {
140 cb: function () { 140 cb: function () {
141 $.ajax({ 141 $.ajax({
142 type: 'POST', 142 type: 'POST',
143 - url: '/home/orders/deleteOrder', 143 + url: '/home/orders/delOrder',
144 data: { 144 data: {
145 orderCode: id, 145 orderCode: id,
146 isFullyDelete: isFullyDelete, 146 isFullyDelete: isFullyDelete,
@@ -148,6 +148,7 @@ function deleteOrder(id, obj) { @@ -148,6 +148,7 @@ function deleteOrder(id, obj) {
148 }).then(function (data) { 148 }).then(function (data) {
149 if (data.code === 200) { 149 if (data.code === 200) {
150 active.close(); 150 active.close();
  151 + $order.remove();
151 $order.addClass("deleted-easeout");//执行动画后移除元素 152 $order.addClass("deleted-easeout");//执行动画后移除元素
152 setTimeout(function(){ 153 setTimeout(function(){
153 $order.remove(); 154 $order.remove();