...
|
...
|
@@ -4,24 +4,25 @@ |
|
|
* @date: 2015/11/16
|
|
|
*/
|
|
|
|
|
|
require('home/order-detail-index.page.css');
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
Hammer = require('yoho-hammer'),
|
|
|
dialog = require('../plugin/dialog'),
|
|
|
tip = require('../plugin/tip');
|
|
|
tip = require('../plugin/tip'),
|
|
|
Swiper = require('yoho-swiper');
|
|
|
|
|
|
var orderId = $('#order-detail').data('id'),
|
|
|
$countDownHours = $('.hours'),
|
|
|
$countdownContainer = $('.count-down'),
|
|
|
Swiper = require('yoho-swiper'),
|
|
|
$ownerInfo = $('.owner-info'),
|
|
|
$reaMask = $('.reason-mask'),
|
|
|
$refundReaMask = $('.refund-reason-mask'),
|
|
|
reasonSwiper,
|
|
|
refundReasonSwiper,
|
|
|
optHammer,
|
|
|
$createTime = new Date($('.createTime').text() * 1000);
|
|
|
|
|
|
require('home/order-detail-index.page.css');
|
|
|
require('../common');
|
|
|
|
|
|
lazyLoad({
|
...
|
...
|
@@ -48,8 +49,8 @@ function downCount(options) { |
|
|
seconds;
|
|
|
|
|
|
// calculate dates
|
|
|
hours = Math.floor((difference % _day) / _hour),
|
|
|
minutes = Math.floor((difference % _hour) / _minute),
|
|
|
hours = Math.floor((difference % _day) / _hour);
|
|
|
minutes = Math.floor((difference % _hour) / _minute);
|
|
|
seconds = Math.floor((difference % _minute) / _second);
|
|
|
|
|
|
// fix dates so that it will show two digets
|
...
|
...
|
@@ -117,6 +118,8 @@ optHammer.on('tap', function(e) { |
|
|
});
|
|
|
} else if ($cur.hasClass('btn-cancel')) {
|
|
|
$reaMask.css('visibility', 'visible');
|
|
|
} else if ($cur.hasClass('btn-refund')) {
|
|
|
$refundReaMask.css('visibility', 'visible');
|
|
|
} else if ($cur.hasClass('btn-rebuy')) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
...
|
...
|
@@ -148,7 +151,7 @@ $(function() { |
|
|
centeredSlides: true,
|
|
|
slidesPerView: 5,
|
|
|
direction: 'vertical',
|
|
|
onSlideChangeStart: function(reasonSwiper) {
|
|
|
onSlideChangeStart: function(reasonSwiper) {//eslint-disable-line
|
|
|
var activeIndex = reasonSwiper.activeIndex,
|
|
|
slides = reasonSwiper.slides,
|
|
|
i = 0;
|
...
|
...
|
@@ -174,9 +177,42 @@ $(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(e) {
|
|
|
$reaMask.find('.box-cmp').on('touchend', function() {
|
|
|
var selSolid = reasonSwiper.slides[reasonSwiper.activeIndex],
|
|
|
reason = $(selSolid).text(),
|
|
|
reasonId = $(selSolid).data('reasonId');
|
...
|
...
|
@@ -205,6 +241,36 @@ $reaMask.find('.box-cmp').on('touchend', function(e) { |
|
|
});
|
|
|
});
|
|
|
|
|
|
// 申请退款
|
|
|
$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: 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;
|
...
|
...
|
@@ -214,6 +280,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();
|
|
|
});
|
|
|
|
|
|
function formatDate(objD) {
|
|
|
var str,
|
|
|
yy = objD.getYear(),
|
...
|
...
|
|