...
|
...
|
@@ -73,49 +73,47 @@ function cancelFactory(id) { |
|
|
return new Dialog(options);
|
|
|
}
|
|
|
|
|
|
function shwoRefundDialog(orderId) {
|
|
|
var refundHtml = '';
|
|
|
var options = {
|
|
|
mask: false,
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-sure',
|
|
|
name: '确定并取消订单',
|
|
|
btnClass: ['cancel-sure'],
|
|
|
cb: function() {
|
|
|
var $checked = $('.cancel-dialog :checked');
|
|
|
var $tip = $('.cancel-dialog .cancel-tip');
|
|
|
function showRefundDialog(orderId) {
|
|
|
return ordersApi.refundReason().then(function(result) {
|
|
|
var options = {
|
|
|
mask: false,
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-sure',
|
|
|
name: '确定并取消订单',
|
|
|
btnClass: ['cancel-sure'],
|
|
|
cb: function() {
|
|
|
var $checked = $('.cancel-dialog :checked');
|
|
|
var $tip = $('.cancel-dialog .cancel-tip');
|
|
|
|
|
|
if ($checked.length === 0) {
|
|
|
$tip.html('请选择要取消订单的原因');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($checked.length === 0) {
|
|
|
$tip.html('请选择要取消订单的原因');
|
|
|
return;
|
|
|
ordersApi.refund(orderId, $checked.val()).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
active.close();
|
|
|
history.go(0);
|
|
|
} else {
|
|
|
$tip.html(data.message);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel-no',
|
|
|
name: '取消',
|
|
|
btnClass: ['cancel-no'],
|
|
|
cb: function() {
|
|
|
active.close();
|
|
|
}
|
|
|
|
|
|
ordersApi.refund(orderId, $checked.val()).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
active.close();
|
|
|
history.go(0);
|
|
|
} else {
|
|
|
$tip.html(data.message);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel-no',
|
|
|
name: '取消',
|
|
|
btnClass: ['cancel-no'],
|
|
|
cb: function() {
|
|
|
active.close();
|
|
|
}
|
|
|
}
|
|
|
],
|
|
|
content: refundHtml,
|
|
|
className: 'cancel-dialog'
|
|
|
};
|
|
|
],
|
|
|
content: refundDialogTpl(result),
|
|
|
className: 'cancel-dialog'
|
|
|
};
|
|
|
|
|
|
return ordersApi.refundReason(function(result) {
|
|
|
refundHtml = refundDialogTpl(result.data);
|
|
|
active = new Dialog(options);
|
|
|
active.show();
|
|
|
});
|
...
|
...
|
@@ -157,7 +155,7 @@ function buyAgain(id) { |
|
|
data: {orderCode: id}
|
|
|
}).then(function(d) {
|
|
|
if (d.code === 200) {
|
|
|
location.href = '/shopping/cart';
|
|
|
location.href = '/cart/cart';
|
|
|
} else {
|
|
|
new dialog.Alert(d.message).show();
|
|
|
}
|
...
|
...
|
@@ -647,5 +645,5 @@ $('.check-logistics').click(function() { |
|
|
});
|
|
|
|
|
|
$('.refund-apply').on('click', function() {
|
|
|
shwoRefundDialog($(this).closest('.order, .order-detail').data('id'));
|
|
|
showRefundDialog($(this).closest('.order, .order-detail').data('id'));
|
|
|
}); |
...
|
...
|
|