Authored by 王洪广

add delete order

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