Authored by 郝肖肖

无优惠券提示

... ... @@ -21,11 +21,9 @@ const index = (req, res, next) => {
title: '优惠券',
pageFooter: true,
list: result,
used: req.body.status === '1' ? true : false,
localCss: true
};
req.body.page && (req.body.page !== '1' || req.body.status === '1') && (options.layout = false);
res.render('coupons', options);
}).catch(next);
};
... ...
... ... @@ -43,7 +43,7 @@
<p>限品类:{{sortLimit}}</p>
{{/if}}
<p>特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</p>
<p>说明:金卡用户专用</p>
{{#if explains}}<p>说明:{{explains}}</p>{{/if}}
</div>
</div>
{{/each}}
... ...
<div class="coupon-not-result">
<i></i>
<p>您还没有优惠券!</p>
<a href="/product/new">随便逛逛</a>
</div>
... ...
... ... @@ -33,7 +33,7 @@
<p>限品类:{{sortLimit}}</p>
{{/if}}
<p>特例商品(秒杀、限定、境外、预售等)暂不支持使用优惠券。</p>
<p>说明:金卡用户专用</p>
{{#if explains}}<p>说明:{{explains}}</p>{{/if}}
</div>
</div>
{{/each}}
... ...
// 不要使用es6
'use strict';
var $ = require('yoho-jquery');
var couponsListHbs = require('home/coupons-list.hbs');
var $ = require('yoho-jquery'),
couponsListHbs = require('home/coupons-list.hbs'),
notResultHbs = require('home/coupon-not-result.hbs');
var $couponTab1 = $('.coupon-tab1'),
$couponTab2 = $('.coupon-tab2'),
... ... @@ -46,29 +47,28 @@ couponFun = function() {
page: page
},
success: function(data) {
if (data.length <= 0) {
var $activeDom;
if (indexNum === 1) {
$activeDom = $couponTab2;
} else if (indexNum === 2) {
$activeDom = $couponTab3;
} else {
$activeDom = $couponTab1;
}
if (page <= 1 && data.length <= 0) {
$activeDom.html(notResultHbs());
return false;
}
if (page === 0 && data.length <= 0) {
if (data.length <= 0) {
return false;
}
$tabDom.data('page', ++page);
$tabDom.data('AjaxFlag', false);
switch (indexNum * 1) {
case 0:
$couponTab1.append(couponsListHbs({list: data}));
break;
case 1:
$couponTab2.append(couponsListHbs({list: data}));
break;
case 2:
$couponTab3.append(couponsListHbs({list: data}));
break;
default: break;
}
$activeDom.append(couponsListHbs({list: data}));
window.rePosFooter(); // 重新计算底部位置
}
});
... ... @@ -105,3 +105,11 @@ $('.coupon-list').on('click', '.info-btn', function() {
$this.closest('.coupon-group').find('.coupon-footer').addClass('hide');
}
});
$('body').css({'background-color': '#f2f2f2'});
// 首屏渲染无结果判断
if ($('.coupon-tab1').find('.coupon-group').length <= 0) {
$('.coupon-tab1').html(notResultHbs());
window.rePosFooter(); // 重新计算底部位置
}
... ...
.my-coupon-page {
background-color: #f2f2f2;
.coupon-tab {
height: 90px;
line-height: 90px;
... ... @@ -140,4 +138,47 @@
border-top: 1px dashed #fff;
}
}
.coupon-not-result {
width: 100%;
height: auto;
overflow: hidden;
position: fixed;
left: 0;
top: 50%;
margin-top: -162px;
i {
width: 100%;
height: 120px;
overflow: hidden;
display: block;
background: resolve("home/employ/not.png") center top no-repeat;
background-size: auto 100%;
}
p {
width: 100%;
height: auto;
overflow: hidden;
padding: 20px 0 0;
font-size: 32px;
text-align: center;
color: #444;
}
a {
width: 73.75%;
height: 80px;
overflow: hidden;
font-size: 36px;
line-height: 80px;
display: block;
background: #444;
color: #fff;
text-align: center;
margin: 60px auto 0;
border-radius: 0.2rem;
}
}
}
... ...