...
|
...
|
@@ -7,8 +7,6 @@ |
|
|
var dialog = require('../plugins/dialog');
|
|
|
var _dialog = dialog.Dialog;
|
|
|
|
|
|
// var camelCase = require('yoho-node-lib').lib.camelCase;
|
|
|
|
|
|
var expressTpl = require('../../tpl/me/express.hbs');
|
|
|
|
|
|
// 更新表格
|
...
|
...
|
@@ -125,25 +123,6 @@ function getQueryString() { |
|
|
return query;
|
|
|
}
|
|
|
|
|
|
// 绑定分页点击事件
|
|
|
function bindPaginationClick() {
|
|
|
$('.blk-pagination li').off('click').on('click', function(e) {
|
|
|
var $this = $(this);
|
|
|
var page = $this.find('a').attr('href').split('=')[1];
|
|
|
var type = getQueryString().type;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
if (!$this.hasClass('active')) {
|
|
|
$('.blk-pagination li.active').removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
$(window).scrollTop(0);
|
|
|
|
|
|
getOrderList(type, page);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取订单总数
|
|
|
function getOrderTotal(type, key) {
|
...
|
...
|
@@ -157,6 +136,8 @@ function getOrderTotal(type, key) { |
|
|
|
|
|
if (!$navItme.hasClass('active') && result.total !== 0) {
|
|
|
$navItme.find('.badge').text(result.total);
|
|
|
} else if (!$navItme.hasClass('active')) {
|
|
|
$navItme.find('.badge').text('');
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -172,29 +153,72 @@ function setOrderTotal() { |
|
|
}
|
|
|
}
|
|
|
|
|
|
function updateTableContent($el) {
|
|
|
$el.find('.status .status-str').text('已取消');
|
|
|
$el.find('.pay-operation').remove();
|
|
|
$el.find('.buy-operation').removeClass('hide');
|
|
|
setOrderTotal();
|
|
|
}
|
|
|
|
|
|
// 绑定分页点击事件
|
|
|
function bindPaginationClick() {
|
|
|
$('.blk-pagination li').off('click').on('click', function(e) {
|
|
|
var $this = $(this);
|
|
|
var page = $this.find('a').attr('href').split('=')[1];
|
|
|
var type = getQueryString().type;
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
if (!$this.hasClass('active')) {
|
|
|
$('.blk-pagination li.active').removeClass('active');
|
|
|
$this.addClass('active');
|
|
|
$(window).scrollTop(0);
|
|
|
|
|
|
getOrderList(type, page);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 删除订单
|
|
|
function deleteOrder(code) {
|
|
|
function deleteOrder(code, $el) {
|
|
|
$.ajax({
|
|
|
url: 'deleteOrder',
|
|
|
data: {
|
|
|
orderCode: code
|
|
|
}
|
|
|
}).done(function(result) {
|
|
|
console.log(result);
|
|
|
}).done(function() {
|
|
|
$el.remove();
|
|
|
}).fail(function(err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 取消订单
|
|
|
function cancelOrder(code) {
|
|
|
function cancelOrder(code, $el) {
|
|
|
$.ajax({
|
|
|
url: 'cancelOrder',
|
|
|
data: {
|
|
|
orderCode: code
|
|
|
}
|
|
|
}).done(function(result) {
|
|
|
console.log(result);
|
|
|
}).done(function() {
|
|
|
var tip = new _dialog({
|
|
|
className: 'order-dialog',
|
|
|
content: '<h1>订单修改</h1>' +
|
|
|
'<span>您已成功取消了该订单</span>',
|
|
|
closeCb: updateTableContent.bind(null, $el.closest('.order')),
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-complete',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确定',
|
|
|
cb: function() {
|
|
|
tip.close(updateTableContent.bind(null, $el.closest('.order')));
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}).show();
|
|
|
|
|
|
}).fail(function(err) {
|
|
|
console.log(err);
|
|
|
});
|
...
|
...
|
@@ -224,6 +248,8 @@ function getExpressInfo(code, $el) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// tab切换处理
|
|
|
$('.tabs li').on('click', function() {
|
|
|
var $this = $(this);
|
...
|
...
|
@@ -252,9 +278,10 @@ $('.tabs li').on('click', function() { |
|
|
|
|
|
function bindDeleteEvent() {
|
|
|
$('.delete').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var $this = $(this);
|
|
|
var code = $this.closest('.order').data('code');
|
|
|
var tip = new _dialog({
|
|
|
className: 'delete-dialog',
|
|
|
className: 'order-dialog delete-dialog',
|
|
|
content: '<h1>您确定要永久删除该订单么</h1>' +
|
|
|
'<p>永久删除后,订单将无法恢复,</p>' +
|
|
|
'<p>您将无法对该订单的商品申请售后服务,请谨慎操作。</p>',
|
...
|
...
|
@@ -264,13 +291,13 @@ function bindDeleteEvent() { |
|
|
btnClass: ['confirm'],
|
|
|
name: '确认',
|
|
|
cb: function() {
|
|
|
deleteOrder(code);
|
|
|
deleteOrder(code, $this.closest('.order'));
|
|
|
tip.close();
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'delete-cancel',
|
|
|
btnClass: ['cancel'],
|
|
|
btnClass: ['cancel-btn'],
|
|
|
name: '取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
...
|
...
|
@@ -283,9 +310,11 @@ function bindDeleteEvent() { |
|
|
|
|
|
function bindCancelEvent() {
|
|
|
$('.cancel').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var $this = $(this);
|
|
|
var code = $this.closest('.order').data('code');
|
|
|
|
|
|
var tip = new _dialog({
|
|
|
className: 'cancel-dialog',
|
|
|
className: 'order-dialog cancel-dialog',
|
|
|
content: '<h1>取消订单</h1>' +
|
|
|
'<span class="tip">您取消订单的原因是:</span>' +
|
|
|
'<div class="reason">' +
|
...
|
...
|
@@ -314,22 +343,22 @@ function bindCancelEvent() { |
|
|
'</div>' +
|
|
|
'</div>' +
|
|
|
'<span class="tip">温馨提示:</span>' +
|
|
|
'<p><span>*</span>订单成功取消后无法恢复</p>' +
|
|
|
'<p><span>*</span>该订单已付金额将原路返回</p>' +
|
|
|
'<p><span>*</span>取消订单后,存在促销关系的子订单及优惠可能会一并取消</p>',
|
|
|
'<p class="tip-item"><span class="asterisk">*</span>订单成功取消后无法恢复</p>' +
|
|
|
'<p class="tip-item"><span class="asterisk">*</span>该订单已付金额将原路返回</p>' +
|
|
|
'<p class="tip-item"><span class="asterisk">*</span>取消订单后,存在促销关系的子订单及优惠可能会一并取消</p>',
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-confirm',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确定并取消订单',
|
|
|
cb: function() {
|
|
|
cancelOrder(code);
|
|
|
cancelOrder(code, $this.closest('.order'));
|
|
|
tip.close();
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel-stop',
|
|
|
btnClass: ['cancel'],
|
|
|
btnClass: ['cancel-btn'],
|
|
|
name: '暂不取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
...
|
...
|
@@ -342,11 +371,12 @@ function bindCancelEvent() { |
|
|
type: 'radio',
|
|
|
group: 'reason',
|
|
|
onChange: function(ele, checked) {
|
|
|
var $this = $(ele);
|
|
|
var $ele = $(ele);
|
|
|
var $input = $('.cancel-dialog .reason input');
|
|
|
|
|
|
if (checked && $this.parent('.other').length) {
|
|
|
if (checked && $ele.parent('.other').length) {
|
|
|
$input.prop('disabled', false);
|
|
|
$input.focus();
|
|
|
} else {
|
|
|
$input.val('');
|
|
|
$input.prop('disabled', true);
|
...
|
...
|
@@ -359,7 +389,7 @@ function bindCancelEvent() { |
|
|
function bindExpressEvent() {
|
|
|
$('.express').on('click', function() {
|
|
|
var $this = $(this);
|
|
|
var code = $this.data('code');
|
|
|
var code = $this.closest('.order').data('code');
|
|
|
var $info = $this.find('.express-info');
|
|
|
|
|
|
if ($info.length) {
|
...
|
...
|
|