...
|
...
|
@@ -7,6 +7,9 @@ |
|
|
var dialog = require('../plugins/dialog');
|
|
|
var _dialog = dialog.Dialog;
|
|
|
|
|
|
// var camelCase = require('yoho-node-lib').lib.camelCase;
|
|
|
|
|
|
var expressTpl = require('../../tpl/me/express.hbs');
|
|
|
|
|
|
// 更新表格
|
|
|
var tableOperation = {
|
...
|
...
|
@@ -100,7 +103,7 @@ function getOrderList(type, page) { |
|
|
}
|
|
|
}).done(function(res) {
|
|
|
tableOperation.appendBody(res);
|
|
|
bindPaginationClick(); // eslint-disable-line
|
|
|
bindEvent(); // eslint-disable-line
|
|
|
countDown.start();
|
|
|
}).fail(function(err) {
|
|
|
console.log(err);
|
...
|
...
|
@@ -198,14 +201,24 @@ function cancelOrder(code) { |
|
|
}
|
|
|
|
|
|
// 取消订单
|
|
|
function getExpressInfo(code) {
|
|
|
function getExpressInfo(code, $el) {
|
|
|
$.ajax({
|
|
|
url: 'getExpressInfo',
|
|
|
data: {
|
|
|
orderCode: code
|
|
|
}
|
|
|
}).done(function(result) {
|
|
|
console.log(result);
|
|
|
var tpl;
|
|
|
var data = {};
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
data = result.data;
|
|
|
|
|
|
data.sub_express_deatil = data.express_detail.slice(0, 2);
|
|
|
|
|
|
tpl = expressTpl(data);
|
|
|
$(tpl).appendTo($el);
|
|
|
}
|
|
|
}).fail(function(err) {
|
|
|
console.log(err);
|
|
|
});
|
...
|
...
|
@@ -237,116 +250,135 @@ $('.tabs li').on('click', function() { |
|
|
|
|
|
});
|
|
|
|
|
|
$('.delete').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var tip = new _dialog({
|
|
|
className: 'delete-dialog',
|
|
|
content: '<h1>您确定要永久删除该订单么</h1>' +
|
|
|
'<p>永久删除后,订单将无法恢复,</p>' +
|
|
|
'<p>您将无法对该订单的商品申请售后服务,请谨慎操作。</p>',
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'delete-confirm',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确认',
|
|
|
cb: function() {
|
|
|
deleteOrder(code);
|
|
|
tip.close();
|
|
|
function bindDeleteEvent() {
|
|
|
$('.delete').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var tip = new _dialog({
|
|
|
className: 'delete-dialog',
|
|
|
content: '<h1>您确定要永久删除该订单么</h1>' +
|
|
|
'<p>永久删除后,订单将无法恢复,</p>' +
|
|
|
'<p>您将无法对该订单的商品申请售后服务,请谨慎操作。</p>',
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'delete-confirm',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确认',
|
|
|
cb: function() {
|
|
|
deleteOrder(code);
|
|
|
tip.close();
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'delete-cancel',
|
|
|
btnClass: ['cancel'],
|
|
|
name: '取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'delete-cancel',
|
|
|
btnClass: ['cancel'],
|
|
|
name: '取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}).show();
|
|
|
});
|
|
|
]
|
|
|
}).show();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$('.cancel').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var tip = new _dialog({
|
|
|
className: 'cancel-dialog',
|
|
|
content: '<h1>取消订单</h1>' +
|
|
|
'<span class="tip">您取消订单的原因是:</span>' +
|
|
|
'<div class="reason">' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido checked"></span>支付不成功</p>' +
|
|
|
'<p><span class="iconfont raido"></span>现在不想购买</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>订单架构有问题</p>' +
|
|
|
'<p><span class="iconfont raido"></span>修改订单信息</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>错误或重复下单</p>' +
|
|
|
'<p><span class="iconfont raido"></span>忘记使用优惠券或YOHO币</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>等待发货时间过长</p>' +
|
|
|
'<p><span class="iconfont raido"></span>商品价格较贵</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>运费较高</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row other">' +
|
|
|
'<p><span class="iconfont raido"></span>其他原因</p>' +
|
|
|
'<input type="text" disabled placeholder="50个字以内"/>' +
|
|
|
'</div>' +
|
|
|
'</div>' +
|
|
|
'<span class="tip">温馨提示:</span>' +
|
|
|
'<p><span>*</span>订单成功取消后无法恢复</p>' +
|
|
|
'<p><span>*</span>该订单已付金额将原路返回</p>' +
|
|
|
'<p><span>*</span>取消订单后,存在促销关系的子订单及优惠可能会一并取消</p>',
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-confirm',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确定并取消订单',
|
|
|
cb: function() {
|
|
|
cancelOrder(code);
|
|
|
tip.close();
|
|
|
function bindCancelEvent() {
|
|
|
$('.cancel').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
var tip = new _dialog({
|
|
|
className: 'cancel-dialog',
|
|
|
content: '<h1>取消订单</h1>' +
|
|
|
'<span class="tip">您取消订单的原因是:</span>' +
|
|
|
'<div class="reason">' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido checked"></span>支付不成功</p>' +
|
|
|
'<p><span class="iconfont raido"></span>现在不想购买</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>订单架构有问题</p>' +
|
|
|
'<p><span class="iconfont raido"></span>修改订单信息</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>错误或重复下单</p>' +
|
|
|
'<p><span class="iconfont raido"></span>忘记使用优惠券或YOHO币</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>等待发货时间过长</p>' +
|
|
|
'<p><span class="iconfont raido"></span>商品价格较贵</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row">' +
|
|
|
'<p><span class="iconfont raido"></span>运费较高</p>' +
|
|
|
'</div>' +
|
|
|
'<div class="row other">' +
|
|
|
'<p><span class="iconfont raido"></span>其他原因</p>' +
|
|
|
'<input type="text" disabled placeholder="50个字以内"/>' +
|
|
|
'</div>' +
|
|
|
'</div>' +
|
|
|
'<span class="tip">温馨提示:</span>' +
|
|
|
'<p><span>*</span>订单成功取消后无法恢复</p>' +
|
|
|
'<p><span>*</span>该订单已付金额将原路返回</p>' +
|
|
|
'<p><span>*</span>取消订单后,存在促销关系的子订单及优惠可能会一并取消</p>',
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'cancel-confirm',
|
|
|
btnClass: ['confirm'],
|
|
|
name: '确定并取消订单',
|
|
|
cb: function() {
|
|
|
cancelOrder(code);
|
|
|
tip.close();
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel-stop',
|
|
|
btnClass: ['cancel'],
|
|
|
name: '暂不取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel-stop',
|
|
|
btnClass: ['cancel'],
|
|
|
name: '暂不取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
]
|
|
|
}).show();
|
|
|
|
|
|
$('.cancel-dialog .reason p').check({
|
|
|
type: 'radio',
|
|
|
group: 'reason',
|
|
|
onChange: function(ele, checked) {
|
|
|
var $this = $(ele);
|
|
|
var $input = $('.cancel-dialog .reason input');
|
|
|
|
|
|
if (checked && $this.parent('.other').length) {
|
|
|
$input.prop('disabled', false);
|
|
|
} else {
|
|
|
$input.val('');
|
|
|
$input.prop('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}).show();
|
|
|
|
|
|
$('.cancel-dialog .reason p').check({
|
|
|
type: 'radio',
|
|
|
group: 'reason',
|
|
|
onChange: function(ele, checked) {
|
|
|
var $this = $(ele);
|
|
|
var $input = $('.cancel-dialog .reason input');
|
|
|
|
|
|
if (checked && $this.parent('.other').length) {
|
|
|
$input.prop('disabled', false);
|
|
|
} else {
|
|
|
$input.val('');
|
|
|
$input.prop('disabled', true);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$('.express').on('click', function() {
|
|
|
var code = $(this).data('code');
|
|
|
function bindExpressEvent() {
|
|
|
$('.express').on('click', function() {
|
|
|
var $this = $(this);
|
|
|
var code = $this.data('code');
|
|
|
var $info = $this.find('.express-info');
|
|
|
|
|
|
getExpressInfo(code);
|
|
|
});
|
|
|
if ($info.length) {
|
|
|
$info.toggleClass('hide');
|
|
|
} else {
|
|
|
getExpressInfo(code, $this);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function bindEvent() {
|
|
|
bindPaginationClick();
|
|
|
bindDeleteEvent();
|
|
|
bindCancelEvent();
|
|
|
bindExpressEvent();
|
|
|
}
|
|
|
|
|
|
bindPaginationClick();
|
|
|
bindEvent();
|
|
|
countDown.start();
|
|
|
setOrderTotal();
|
|
|
|
...
|
...
|
|