Authored by 张孝茹

兑换

... ... @@ -170,7 +170,9 @@ exports.getList = (req, res, next) => {
uid: req.user.uid,
type: req.query.type,
page: req.query.page,
limit: req.query.limit
limit: req.query.limit,
isMarsApp: req.yoho.isMarsApp,
isNowApp: req.yoho.isNowApp
};
req.ctx(family).getList(params).then((result) => {
... ...
... ... @@ -624,6 +624,17 @@ class familyModel extends global.yoho.BaseModel {
if (_.get(result, 'data.list')) {
resu.list = result.data.list;
}
_.forEach(resu.list, function(val) {
if (params.isMarsApp && params.type === 'mars') {
val.usable = true;
}
if (params.isNowApp && params.type === 'now') {
val.usable = true;
}
});
return resu;
});
}
... ...
... ... @@ -25,8 +25,7 @@
<div class="remain">仅剩{{#if stock}}{{stock}}{{/if}}{{#if num}}{{num}}{{/if}}</div>
</div>
<div class="right">
<a class="go-btn yohonow" href="yohoefashion4In1://yoho.cn/">兑换</a>
<a class="go-btn mars" href="yohomars://yohomars.com/goapp?openby:mars=">兑换</a>
<span class="go-btn{{#if usable}} usable{{/if}}" data-id="{{id}}" data-level="{{level}}">兑换</span>
</div>
</div>
</div>
... ...
... ... @@ -74,6 +74,10 @@ class IconMall extends Page {
this.selector.$marsTab.append($result);
}
this.loading = false;
this.selector.$goBtn = $('.go-btn');
this.selector.$goBtn.on('click', this.goConversion.bind(this));
lazyLoad($result.find('img.lazy'));
} else {
this.end = true;
... ... @@ -148,6 +152,28 @@ class IconMall extends Page {
yoho.invokeMethod('go.point_detail');
}
}
goConversion(e) {
let $this = $(e.currentTarget);
let type = $this.closest('.tab-item-c').attr('id');
let goodId = $this.data('id');
let goodsLevel = $this.data('level');
if ($this.hasClass('usable')) {
if (yoho && yoho.isMarsApp) {
yoho.invokeMethod('go.mars_point', {goodId: goodId, goods_level: goodsLevel});
} else if (yoho && yoho.isNowApp) {
yoho.invokeMethod('go.yohoCoins', {goodId: goodId});
}
} else {
if (type === 'yohonow-tab') {
tip.show('请到yohonowapp打开');
} else if (type === 'mars-tab') {
tip.show('请到mars打开');
}
}
}
}
$(() => {
... ...
... ... @@ -220,10 +220,14 @@ html {
text-align: center;
color: #fff;
font-size: 28px;
background-color: #000;
background-color: #b0b0b0;
display: block;
margin-top: 25px;
}
.usable {
background-color: #000;
}
}
}
}
... ...