Authored by OF1706

Merge branch 'feature/shoppingCart' of http://git.yoho.cn/fe/yohobuy-node into feature/shoppingCart

... ... @@ -278,9 +278,74 @@ const getTogetherProduct = (req, res) => {
message: '凑单商品'
};*/
let ret = yield service.getTogetherProduct(page);
// let ret = yield service.getTogetherProduct(page);
return res.send(ret);
// return res.send(ret);
// test
return res.send({
'code': 200,
'message': '',
'data': {
'header': '\u51d1\u5355\u5546\u54c1',
'hasPrev': true,
'hasNext': true,
'item': [{
'id': 675944,
'skn': 51486050,
'href': '\/\/item.yohobuy.com\/product\/pro_675944_831288\/MYFUN yinliaopingxiuhuanvmianwa 1611DPA0195.html',
'title': 'MY FUN \u996e\u6599\u74f6\u7ee3\u82b1\u5973\u68c9\u889c',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2017\/01\/12\/08\/01fcff8810cf74104dcb166d971a3fca91.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MY FUN \u996e\u6599\u74f6\u7ee3\u82b1\u5973\u68c9\u889c',
'price': '19.00',
'marketPrice': '49.00'
}, {
'id': 675942,
'skn': 51486048,
'href': '\/\/item.yohobuy.com\/product\/pro_675942_831286\/MYFUN siyecaoxiuhuanvmianwa 1611DPA0194.html',
'title': 'MY FUN \u56db\u53f6\u8349\u7ee3\u82b1\u5973\u68c9\u889c',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2017\/01\/12\/08\/01b5f0a983a76de8fe730e67247cdac0e6.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MY FUN \u56db\u53f6\u8349\u7ee3\u82b1\u5973\u68c9\u889c',
'price': '19.00',
'marketPrice': '49.00'
}, {
'id': 675876,
'skn': 51485982,
'href': '\/\/item.yohobuy.com\/product\/pro_675876_831220\/MYFUN caitiaowennanshizhangtongwa 1611DPA0045.html',
'title': 'MYFUN \u5f69\u6761\u7eb9\u7537\u58eb\u957f\u7b52\u889c',
'img': '\/\/img12.static.yhbimg.com\/goodsimg\/2017\/01\/12\/10\/0290b5aafe4137bc7c5ec90f3963546cb9.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MYFUN \u5f69\u6761\u7eb9\u7537\u58eb\u957f\u7b52\u889c',
'price': '19.00',
'marketPrice': '39.00'
}, {
'id': 675874,
'skn': 51485980,
'href': '\/\/item.yohobuy.com\/product\/pro_675874_831218\/MYFUN caitiaowennanshizhangtongwa 1611DPA0043.html',
'title': 'MY FUN \u5f69\u6761\u7eb9\u7537\u58eb\u957f\u7b52\u889c',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2017\/01\/12\/10\/01604804248080b4c8cd60dd623e569d24.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MY FUN \u5f69\u6761\u7eb9\u7537\u58eb\u957f\u7b52\u889c',
'price': '19.00',
'marketPrice': '39.00'
}, {
'id': 675872,
'skn': 51485978,
'href': '\/\/item.yohobuy.com\/product\/pro_675872_831216\/MYFUN ertiaogangnanshizhongtongwa 1611DPA0034.html',
'title': 'MY FUN \u7537\u58eb\u4e2d\u7b52\u889c',
'img': '\/\/img12.static.yhbimg.com\/goodsimg\/2017\/01\/12\/10\/02888bca5ef68cb669a0c47ae31232d87e.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MY FUN \u7537\u58eb\u4e2d\u7b52\u889c',
'price': '15.00',
'marketPrice': '29.00'
}, {
'id': 675870,
'skn': 51485976,
'href': '\/\/item.yohobuy.com\/product\/pro_675870_831214\/MYFUN ertiaogangnanshizhongtongwa 1611DPA0033.html',
'title': 'MY FUN \u7537\u58eb\u4e2d\u7b52\u889c',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2017\/01\/12\/10\/015ef2fb172c81a128b8c6603f89671f03.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'MY FUN \u7537\u58eb\u4e2d\u7b52\u889c',
'price': '15.00',
'marketPrice': '29.00'
}]
}
});
})();
};
... ... @@ -300,9 +365,72 @@ const getRecommendProductAction = (req, res) => {
page = 1;
}
let ret = yield service.getRecommendProduct(channel, uid, udid, page);
// let ret = yield service.getRecommendProduct(channel, uid, udid, page);
res.send(ret);
// res.send(ret);
res.send({
'code': 200,
'message': '',
'data': {
'header': '\u4e3a\u60a8\u4f18\u9009',
'hasPrev': false,
'hasNext': true,
'item': [{
'id': 493102,
'skn': 51295054,
'href': '\/\/item.yohobuy.com\/product\/pro_493102_450622\/LIFEAFTERLIFEDaYiLALA603WO97.html',
'title': 'Life\u00b7After Life \u6e14\u592b\u6263\u5927\u8863\u3010\u591a\u8272\u53ef\u9009\u3011',
'img': '\/\/img11.static.yhbimg.com\/goodsimg\/2016\/10\/08\/17\/01a6ac4cfb94fc6ca1bf4c8450ab7828c9.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'Life\u00b7After Life \u6e14\u592b\u6263\u5927\u8863\u3010\u591a\u8272\u53ef\u9009\u3011',
'price': '589.00',
'marketPrice': '1389.00'
}, {
'id': 599258,
'skn': 51404992,
'href': '\/\/item.yohobuy.com\/product\/pro_599258_575876\/VEIL KEIOS x GARFIELD Sports Cap: Monday landicixiudiandaojiafei heisewanyanmao GFK-007.html',
'title': 'keios under the veil \u84dd\u5e95\u523a\u7ee3\u985b\u5012\u52a0\u83f2 \u9ed1\u8272\u5f2f\u6a90\u5e3d',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2016\/10\/08\/14\/01816e75629f40c58a138a30aee2a9eca6.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'keios under the veil \u84dd\u5e95\u523a\u7ee3\u985b\u5012\u52a0\u83f2 \u9ed1\u8272\u5f2f\u6a90\u5e3d',
'price': '248.00'
}, {
'id': 494118,
'skn': 51296096,
'href': '\/\/item.yohobuy.com\/product\/pro_494118_451958\/PHANTACIPH16LTT02TXu.html',
'title': '\u3010JAY CHOU\u5730\u8868\u6700\u5f3a\u6f14\u5531\u4f1a\u7ebf\u4e0a\u72ec\u5bb6\u4e13\u5c5e\u3011PHANTACi X LOONEYTUNES X THEINVINCIBLE TEE-White',
'img': '\/\/img12.static.yhbimg.com\/goodsimg\/2016\/10\/12\/09\/022e6b74072cdce1c4df430707905fc4c6.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': '\u3010JAY CHOU\u5730\u8868\u6700\u5f3a\u6f14\u5531\u4f1a\u7ebf\u4e0a\u72ec\u5bb6\u4e13\u5c5e\u3011PHANTACi X LOONEYTUNES X THEINVINCIBLE TEE-White',
'price': '119.00',
'marketPrice': '300.00'
}, {
'id': 657894,
'skn': 51466614,
'href': '\/\/item.yohobuy.com\/product\/pro_657894_644268\/converse JACK PURCELL MODERN 155020Cnan.html',
'title': 'converse JACK PURCELL MODERN Man',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2016\/12\/18\/14\/01cb0aef0bd168ebcb1de93cefc0d2e376.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'converse JACK PURCELL MODERN Man',
'price': '989.00',
'marketPrice': '1099.00'
}, {
'id': 646540,
'skn': 51454606,
'href': '\/\/item.yohobuy.com\/product\/pro_646540_631202\/5cm MEN SWEAT SHIRT 5CXSWX3503W67BKX.html',
'title': '5cm X KYE \u540e\u80cc\u5370\u82b1\u8fde\u5e3d\u536b\u8863',
'img': '\/\/img11.static.yhbimg.com\/goodsimg\/2016\/12\/08\/10\/0116d5eb256f45a66f082ab54d9ed7926f.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': '5cm X KYE \u540e\u80cc\u5370\u82b1\u8fde\u5e3d\u536b\u8863',
'price': '1099.00'
}, {
'id': 496860,
'skn': 51298904,
'href': '\/\/item.yohobuy.com\/product\/pro_496860_454976\/INTOTHERAINBOWDuanXiuTXuITRMA603TE103.html',
'title': 'Into The Rainbow \u7f8e\u56fd\u961f\u957f75\u5468\u5e74 \u77ed\u8896T\u6064',
'img': '\/\/img10.static.yhbimg.com\/goodsimg\/2016\/07\/18\/16\/01497d761773446050fcc57c414bee4653.jpg?imageMogr2\/thumbnail\/100x100\/extent\/100x100\/background\/d2hpdGU=\/position\/center\/quality\/80',
'alt': 'Into The Rainbow \u7f8e\u56fd\u961f\u957f75\u5468\u5e74 \u77ed\u8896T\u6064',
'price': '89.00',
'marketPrice': '299.00'
}]
}
});
})();
};
... ...
... ... @@ -348,7 +348,7 @@
<div class="individual-slide">
<div data-role="together-slide"></div>
<div data-role="recommend-slide"></div>
<div data-role="fine-slide"></div>
<div data-role="latestWalk-slide"></div>
... ...
... ... @@ -31,7 +31,7 @@
{{#if isAdvance}}<span class="incentive">预售</span>{{/if}}
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank"><code class="good-mark">7777{{tag}}</code>{{productTitle}}</a>
<a href="{{link}}" target="_blank">{{#if tag}}<code class="good-mark">{{tag}}</code>{{/if}}{{productTitle}}</a>
<em class="pay-pro-detail"><span><b title="{{productColor}}">颜色:{{productColor}}</b> 尺码:{{productSize}}<i class="iconfont">&#xe6c7;</i></span></em>
</p>
</div>
... ...
... ... @@ -215,6 +215,10 @@ var Cart = {
promotion_id: $item.data('promotionid') ? $item.data('promotionid') : 0
};
if ($this.hasClass('has-col-btn')) {
return;
}
capi.cartItemDel(item);
},
toFavAll: function() {
... ...
... ... @@ -294,24 +294,15 @@ function getProductByPromotionId(promotionId) {
function getFineProduct(page) {
$.ajax({
return $.ajax({
type: 'GET',
dataType: 'json',
url: '/cart/data/recommendProduct',
data: page
}).then(function(d) {
return d;
/* if (d.code === 200 && d.data.item.length > 0) {
$obj.html(' ');
togetherProductStr = togetherProductTemplate(d.data);
$obj.append($(togetherProductStr));
$('#orderProduct li:last').addClass('end');
$('.gift').removeClass('none');
//为您优选埋点
if ($obj.hasClass('givePoint')) {
// 为您优选埋点
/* if ($obj.hasClass('givePoint')) {
$.each(d.data.item, function(key, val) {
PRDID.push(val.id);
});
... ... @@ -334,12 +325,13 @@ function getFineProduct(page) {
});
return true;
});
}
}*/
return d;
});
}
function getTogetherProduct(page) {
var PRDID = [];
// var PRDID = [];
return $.ajax({
type: 'GET',
... ...
... ... @@ -3,7 +3,7 @@
*/
var capi = require('./cart-api');
var togetherTpl = require('hbs/cart/cart-together-item');
var togetherTpl = require('hbs/cart/cart-together-item.hbs');
var $togetherSlide = $('[data-role=together-slide]');
var $fineSlide = $('[data-role=fine-slide]');
... ... @@ -92,7 +92,10 @@ loadSlideGoods();
function loadTogetherProduct(page) {
capi.getTogetherProduct(page).done(function(togetherInfo) {
$togetherSlide.html(togetherTpl(togetherInfo));
if (togetherInfo && togetherInfo.code === 200) {
$togetherSlide.html(togetherTpl(togetherInfo.data));
}
});/* .fail(function() {
});*/
... ... @@ -100,7 +103,9 @@ function loadTogetherProduct(page) {
function loadFineProduct(page) {
capi.getFineProduct(page).done(function(fineInfo) {
$fineSlide.html(togetherTpl(fineInfo));
if (fineInfo && fineInfo.code === 200) {
$fineSlide.html(togetherTpl(fineInfo.data));
}
});/* .fail(function() {
});*/
... ... @@ -110,3 +115,27 @@ setTimeout(function() {
loadTogetherProduct(1);
loadFineProduct(1);
}, 0);
// 凑单商品翻页
$togetherSlide.on('click', '.pagenext, .pageprev', function() {
loadTogetherProduct(Math.ceil(Math.random() * 100) + 1);
});
// 为您优选翻页
$fineSlide.on('click', '.pagenext, .pageprev', function() {
var pageNum = Number($fineSlide.data('pagenum') || 1);
if ($(this).hasClass('pagenext')) {
if (pageNum !== 5) {
pageNum++;
} else {
pageNum = 1;
}
} else {
--pageNum > 0 || (pageNum = 1);
}
$fineSlide.data('pagenum', pageNum);
loadFineProduct(pageNum);
});
... ...
... ... @@ -57,7 +57,7 @@ function isCheckFav() {
data: {
pidList: pidArray.join(',')
}
}).then(function(result) {
}).done(function(result) {
$.each(result.data, function(pid, obj) {
if (obj.code !== 200) {
... ... @@ -66,7 +66,6 @@ function isCheckFav() {
if (obj.data) {
$sellBox.each(function() {
if (String($(this).data('pid')) === String(pid)) {
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
return false;
... ...