Authored by lijing

开发完成

... ... @@ -8,7 +8,12 @@ exports.index = (req, res, next) => {
module: 'activity',
page: 'user-recommend',
width750: true,
localCss: true
localCss: true,
loadJs: [
{
src: global.yoho.config.jsSdk
}
]
};
let params = {
... ...
... ... @@ -56,8 +56,8 @@ module.exports = class extends global.yoho.BaseModel {
};
if (result) {
if (result[0] && result[0].data && result[0].data.list) {
if (result[0].data.list[0] && result[0].data.list[0].data && result[0].data.list[0].data[0]) {
if (_.get(result, '[0].data.list', false)) {
if (_.get(result[0].data.list[0], 'data[0]', false)) {
let val = result[0].data.list[0].data[0];
resu.bigPic = {
... ... @@ -67,22 +67,36 @@ module.exports = class extends global.yoho.BaseModel {
}
}
if (result[1] && result[1].data && result[1].data.product_list) {
if (_.get(result, '[1].data.product_list', false)) {
let build = [];
let data = result[1].data.product_list;
_.forEach(data, (val) => {
let discount = this.getDiscound(val.sales_price, val.market_price);
build.push({
productName: val.product_name,
salesPrice: val.sales_price,
marketPrice: val.market_price,
marketPrice: val.market_price === val.sales_price ? '' : val.market_price,
defaultImages: val.default_images ? val.default_images.split(',')[0] : '',
productSkn: val.product_skn
productSkn: val.product_skn,
discount: discount
});
});
resu.goodList = build;
}
if (_.get(result, '[1].data.coupon_list', false)) {
let couponNum = result[1].data.coupon_list.length;
if (couponNum % 2 !== 0) {
resu.odd = true;
} else {
resu.odd = false;
}
resu.couponList = result[1].data.coupon_list;
}
}
return resu;
});
... ... @@ -96,17 +110,20 @@ module.exports = class extends global.yoho.BaseModel {
goodList: []
};
if (result[0] && result[0].data && result[0].data.product_list) {
if (_.get(result, '[0].data.product_list', false)) {
let build = [];
let data = result[0].data.product_list;
_.forEach(data, (val) => {
let discount = this.getDiscound(val.sales_price, val.market_price);
build.push({
productName: val.product_name,
salesPrice: val.sales_price,
marketPrice: val.market_price,
marketPrice: val.market_price === val.sales_price ? '' : val.market_price,
defaultImages: val.default_images ? val.default_images.split(',')[0] : '',
productSkn: val.product_skn
productSkn: val.product_skn,
discount: discount
});
});
... ... @@ -115,4 +132,47 @@ module.exports = class extends global.yoho.BaseModel {
return resu;
});
}
getDiscound(salesPrice, marketPrice) {
let dis = Math.ceil(parseInt(salesPrice, 10) / parseInt(marketPrice, 10) * 10);
let disMes = '';
switch (dis) {
case 0:
disMes = '<span>1</span>折';
break;
case 1:
disMes = '<span>1</span>折';
break;
case 2:
disMes = '<span>2</span>折';
break;
case 3:
disMes = '<span>3</span>折';
break;
case 4:
disMes = '<span>4</span>折';
break;
case 5:
disMes = '<span>5</span>折';
break;
case 6:
disMes = '<span>6</span>折';
break;
case 7:
disMes = '<span>7</span>折';
break;
case 8:
disMes = '<span>8</span>折';
break;
case 9:
disMes = '<span>9</span>折';
break;
default:
disMes = '热卖';
break;
}
return disMes;
}
};
... ...
... ... @@ -5,48 +5,22 @@
</a>
{{/ bigPic}}
<div class="big-title">领取优惠卷
<a class="more">
<a class="more" href='//m.yohobuy.com/coupon/floor?title=领券中心&share_id=1037&code=b78b32ed81b18dde8ac84fd33602b88b&type=5&openby:yohobuy={"action":"go.couponCenter", "params":{"share":"/operations/api/v5/webshare/getShare","share_id":"1037","title":"领券中心"}}'>
更多优惠卷
<span class="iconfont">&#xe604;</span>
</a>
</div>
<div class="ticket-c clearfix">
<div class="ticket-item">
<div class="ticket-c clearfix{{#if odd}} odd{{/if}}">
{{# couponList}}
<a class="ticket-item yoho-conpon" data-token="{{id}}:0" href="javascript:;">
<div class="tip">
<div class="price">
<span class="ico">¥</span>50
<span class="ico">¥</span>{{couponAmount}}
</div>
<div class="name">VANS.品牌卷</div>
<div class="num">满399减50</div>
<div class="name line-clamp-2">{{couponName}}</div>
</div>
</div>
<div class="ticket-item disable">
<div class="tip">
<div class="price">
<span class="ico">¥</span>50
</div>
<div class="name">VANS.品牌卷</div>
<div class="num">满399减50</div>
</div>
</div>
<div class="ticket-item">
<div class="tip">
<div class="price">
<span class="ico">¥</span>50
</div>
<div class="name">VANS.品牌卷</div>
<div class="num">满399减50</div>
</div>
</div>
<div class="ticket-item">
<div class="tip">
<div class="price">
<span class="ico">¥</span>50
</div>
<div class="name">VANS.品牌卷</div>
<div class="num">满399减50</div>
</div>
</div>
</a>
{{/ couponList}}
</div>
<div class="big-title">潮流优选</div>
<div class="goods clearfix">
... ... @@ -56,7 +30,9 @@
<img src="{{image2 defaultImages w=330 h=379 q=90}}" />
</div>
<div class="price">¥{{salesPrice}}
{{#if marketPrice}}
<span>¥{{marketPrice}}</span>
{{/if}}
</div>
<div class="tip">
<div class="tip-c">
... ... @@ -64,7 +40,7 @@
</div>
<div class="ico"></div>
</div>
<div class="discount"></div>
<div class="discount">{{{discount}}}</div>
</a>
{{/ goodList}}
</div>
... ...
... ... @@ -99,7 +99,8 @@ module.exports = {
notifyUrl: domains.service + 'payment/weixin_notify',
},
maxQps: 1200,
geetestJs: '//static.geetest.com/static/tools/gt.js'
geetestJs: '//static.geetest.com/static/tools/gt.js',
jsSdk: '//cdn.yoho.cn/js-sdk/1.2.2/jssdk.js'
};
if (isProduction) {
... ...
... ... @@ -4,7 +4,9 @@
<img src="{{image2 defaultImages w=330 h=379 q=90}}" />
</div>
<div class="price">¥{{salesPrice}}
{{#if marketPrice}}
<span>¥{{marketPrice}}</span>
{{/if}}
</div>
<div class="tip">
<div class="tip-c">
... ... @@ -12,6 +14,6 @@
</div>
<div class="ico"></div>
</div>
<div class="discount"></div>
<div class="discount">{{{discount}}}</div>
</a>
{{/ goodList}}
... ...

3.29 KB | W: | H:

4.49 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

19.2 KB | W: | H:

14.8 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

13.2 KB | W: | H:

11.4 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -12,6 +12,8 @@ import {
moreGoods as getMore
} from './model';
let $ = require('yoho-jquery');
let goodContent = require('activity/user-recommend/recommend-goods.hbs');
class ActController extends Controller {
... ... @@ -21,6 +23,7 @@ class ActController extends Controller {
this.more.on('more', this.doMore.bind(this));
this.page = 1;
this.loading = false;
global.jQuery = $;
}
doMore() {
... ...
... ... @@ -44,7 +44,7 @@
height: 154px;
float: left;
background-image: resolve("activity/user-recommend/ticket-1.jpg");
background-size: 100%;
background-size: 100% 100%;
margin-bottom: 30px;
&:nth-child(odd) {
... ... @@ -60,7 +60,6 @@
}
.tip {
width: 226px;
height: 154px;
padding: 0 30px;
color: #fff;
... ... @@ -89,6 +88,12 @@
}
}
.odd {
.ticket-item:last-child {
width: 100%;
}
}
.goods {
padding: 0 30px;
... ... @@ -176,6 +181,16 @@
position: absolute;
top: -9px;
left: 20px;
color: #fff;
text-align: center;
line-height: 63px;
padding-left: 8px;
font-size: 20px;
span {
font-size: 30px;
font-weight: bold;
}
}
}
}
... ...