Authored by 郭成尧

'gulpge'

... ... @@ -10174,6 +10174,7 @@ define("js/home/order-block", ["jquery","handlebars","source-map"], function(req
*/
var $ = require("jquery");
var Handlebars = require("handlebars");
var dialog = require("js/common/dialog");
... ... @@ -10181,7 +10182,16 @@ var Dialog = dialog.Dialog;
var Confirm = dialog.Confirm;
var $tpl = $('#cancel-dialog-tpl');
var deleteDialog = '<div class="order-delete-confirm">' +
'<div class="header">' +
'<p>删除订单</p>' +
'<a href="javascript:;" title="关闭"></a>' +
'</div>' +
'<div class="body">' +
'<p class="confirm-tip"><i class="icon-doubt"></i>{{deleteMessage}}</p>' +
'<p class="delete-tip">{{deleteTip}}</p>' +
'</div>' +
'</div>';
var html = $tpl.html();
var active;
... ... @@ -10194,7 +10204,7 @@ function cancelFactory(id) {
id: 'cancel-sure',
name: '确定并取消订单',
btnClass: ['cancel-sure'],
cb: function() {
cb: function () {
var $checked = $('.cancel-dialog :checked');
var $tip = $('.cancel-dialog .cancel-tip');
... ... @@ -10210,7 +10220,7 @@ function cancelFactory(id) {
orderCode: id,
reason: $checked.val()
}
}).then(function(data) {
}).then(function (data) {
if (data.code === 200) {
active.close();
history.go(0);
... ... @@ -10224,7 +10234,7 @@ function cancelFactory(id) {
id: 'cancel-no',
name: '取消',
btnClass: ['cancel-no'],
cb: function() {
cb: function () {
active.close();
}
}
... ... @@ -10239,34 +10249,34 @@ function cancelFactory(id) {
$tpl.remove();
//查看物流
$('.check-logistics').click(function() {
$('.check-logistics').click(function () {
$(this).siblings('.logistics').removeClass('hide');
});
$('.close-logistics').click(function() {
$('.close-logistics').click(function () {
$(this).closest('.logistics').addClass('hide');
});
//订单列表&订单详情【取消订单和确认收货】
$('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
$('.me-orders, .order-detail').on('click', '.cancel-order', function (e) {
//取消订单
active = cancelFactory($(this).closest('.order, .order-detail').data('id'));
active.show();
}).on('click', '.confirm-received', function(e) {
}).on('click', '.confirm-received', function (e) {
var id = $(this).closest('.order, .order-detail').data('id');
//确认收货
active = new Confirm({
cb: function() {
cb: function () {
$.ajax({
type: 'POST',
url: '/home/orders/confirmorder',
data: {
orderCode: id
}
}).then(function(data) {
}).then(function (data) {
if (data.code === 200) {
active.close();
history.go(0);
... ... @@ -10276,7 +10286,60 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
content: '您确定要确认收货吗?'
});
active.show();
}).on('click', '.order-delete', function () {
var id = $(this).closest('.order, .order-detail').data('id');
active = deleteOrder(id, this);
active.show();
});
function deleteOrder(id, obj) {
// 是否为彻底删除
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 options = {
mask: false,
btns: [
{
id: 'delete-sure',
name: '确定',
btnClass: ['delete-sure'],
cb: function () {
$.ajax({
type: 'POST',
url: '/home/orders/delOrder',
data: {
orderCode: id,
isFullyDelete: isFullyDelete,
}
}).then(function (data) {
if (data.code === 200) {
active.close();
$order.remove();
$order.addClass("deleted-easeout");//执行动画后移除元素
setTimeout(function(){
$order.remove();
},2e2)
}
});
}
},
{
id: 'delete-no',
name: '取消',
btnClass: ['delete-no'],
cb: function () {
active.close();
}
}
],
content: html,
className: 'delete-dialog',
};
return new Dialog(options);
}
});
define("js/home/orders", ["jquery","handlebars","source-map"], function(require, exports, module){
/**
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.