...
|
...
|
@@ -32,7 +32,9 @@ var dialog = require('../plugin/dialog'); |
|
|
|
|
|
var orderHammer,
|
|
|
$reaMask = $('.reason-mask'),
|
|
|
reasonSwiper;
|
|
|
$refundReaMask = $('.refund-reason-mask'),
|
|
|
reasonSwiper,
|
|
|
refundReasonSwiper;
|
|
|
|
|
|
// 首屏加载标志
|
|
|
var firstScreen = $('.firstscreen-orders').children().size() > 0;
|
...
|
...
|
@@ -110,14 +112,13 @@ function getOrders(option) { |
|
|
type: activeType,
|
|
|
page: order.page + 1
|
|
|
};
|
|
|
var show = option && !option.noLoadingMask;
|
|
|
|
|
|
if (firstScreen) {
|
|
|
// 如果首屏加载了,则去掉10条记录
|
|
|
opt.start = 10;
|
|
|
}
|
|
|
|
|
|
var show = option && !option.noLoadingMask;
|
|
|
|
|
|
if (inAjax) {
|
|
|
return;
|
|
|
}
|
...
|
...
|
@@ -155,7 +156,8 @@ function getOrders(option) { |
|
|
if (opt.page > 1) {
|
|
|
return;
|
|
|
}
|
|
|
$curContainer.html('<div class="no-order"><div class="icon"></div><span>你还没有订单!</span><a class="walk-way" href="//m.yohobuy.com/product/new">随便逛逛</a></div>');
|
|
|
$curContainer.html('<div class="no-order"><div class="icon"></div><span>' +
|
|
|
'你还没有订单!</span><a class="walk-way" href="//m.yohobuy.com/product/new">随便逛逛</a></div>');
|
|
|
order.end = true;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -203,6 +205,7 @@ orderHammer.on('tap', function(e) { |
|
|
id = $order.data('id');
|
|
|
|
|
|
$reaMask.data('orderId', id);
|
|
|
$refundReaMask.data('orderId', id);
|
|
|
|
|
|
if ($cur.closest('.del').length > 0) {
|
|
|
|
...
|
...
|
@@ -237,7 +240,11 @@ orderHammer.on('tap', function(e) { |
|
|
});
|
|
|
});
|
|
|
} else if ($cur.closest('.cancel').length > 0) {
|
|
|
// 取消订单
|
|
|
$reaMask.css('visibility', 'visible');
|
|
|
} else if ($cur.closest('.refund').length > 0) {
|
|
|
// 申请退款
|
|
|
$refundReaMask.css('visibility', 'visible');
|
|
|
} else if ($cur.closest('.order-goods').length > 0) {
|
|
|
|
|
|
// Location to order detail
|
...
|
...
|
@@ -287,7 +294,7 @@ $(function() { |
|
|
centeredSlides: true,
|
|
|
initialSlide: 0,
|
|
|
onSlideChangeStart: function(reasonSwiper) {//eslint-disable-line
|
|
|
var activeIndex = reasonSwiper.activeIndex,
|
|
|
let activeIndex = reasonSwiper.activeIndex,
|
|
|
slides = reasonSwiper.slides,
|
|
|
i = 0;
|
|
|
|
...
|
...
|
@@ -312,10 +319,43 @@ $(function() { |
|
|
$(slides[activeIndex]).css('transform', '');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 申请退款 Swiper
|
|
|
refundReasonSwiper = new Swiper('.refund-box-main', {
|
|
|
direction: 'vertical',
|
|
|
slidesPerView: 5,
|
|
|
centeredSlides: true,
|
|
|
initialSlide: 0,
|
|
|
onSlideChangeStart: function(refundReasonSwiper) {//eslint-disable-line
|
|
|
let activeIndex = refundReasonSwiper.activeIndex,
|
|
|
slides = refundReasonSwiper.slides,
|
|
|
i = 0;
|
|
|
|
|
|
if (slides.length !== 1) {
|
|
|
if (activeIndex === 0) {
|
|
|
for (i = 1; i < slides.length; i++) {
|
|
|
$(slides[i]).css('transform', '');
|
|
|
}
|
|
|
} else if (activeIndex === slides.length - 1) {
|
|
|
for (i = 0; i < activeIndex; i++) {
|
|
|
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
|
|
|
}
|
|
|
} else {
|
|
|
for (i = 0; i < activeIndex; i++) {
|
|
|
$(slides[i]).css('transform', 'rotateX(' + (30 + (activeIndex - i) * 12) + 'deg)');
|
|
|
}
|
|
|
for (i = activeIndex + 1; i < slides.length; i++) {
|
|
|
$(slides[i]).css('transform', '');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$(slides[activeIndex]).css('transform', '');
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$reaMask.find('.box-cmp').on('touchend', function() {
|
|
|
var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
|
|
|
let selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
|
|
|
reason = $(selSolid).text(),
|
|
|
reasonId = $(selSolid).data('reasonId');
|
|
|
|
...
|
...
|
@@ -343,6 +383,36 @@ $reaMask.find('.box-cmp').on('touchend', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
// 申请退款
|
|
|
$refundReaMask.find('.box-cmp').on('touchend', function() {
|
|
|
let selSolid = refundReasonSwiper.slides[refundReasonSwiper.activeIndex],
|
|
|
reason = $(selSolid).text(),
|
|
|
reasonId = $(selSolid).data('reasonId');
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/home/refundApply',
|
|
|
data: {
|
|
|
id: $refundReaMask.data('orderId'),
|
|
|
reason: reason,
|
|
|
reasonId: reasonId
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
$refundReaMask.fadeOut();
|
|
|
if ($.type(res) !== 'object') {
|
|
|
return;
|
|
|
}
|
|
|
if (res.message) {
|
|
|
tip.show(res.message);
|
|
|
}
|
|
|
setTimeout(function() {
|
|
|
window.location.href = '/home/orders';
|
|
|
}, 2000);
|
|
|
}).fail(function() {
|
|
|
tip.show('网络错误');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$reaMask.on('touchend', function(event) {
|
|
|
if (event.target.className !== 'reason-mask') {
|
|
|
return false;
|
...
|
...
|
@@ -352,6 +422,16 @@ $reaMask.on('touchend', function(event) { |
|
|
event.stopPropagation();
|
|
|
});
|
|
|
|
|
|
// 申请退款
|
|
|
$refundReaMask.on('touchend', function(event) {
|
|
|
if (event.target.className !== 'reason-mask') {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
$refundReaMask.css('visibility', 'hidden');
|
|
|
event.stopPropagation();
|
|
|
});
|
|
|
|
|
|
$('.nav-tap').on('click', function(e) {
|
|
|
var $cur = $(e.target);
|
|
|
|
...
|
...
|
|