Authored by 陈峰

merge

... ... @@ -90,7 +90,7 @@ const component = {
saveRecentGoodInCookies(req.cookies._browseskn_h5, res, result[0].data.product_skn);
}
if (result[0].data.vip) {
if (result[0].data && result[0].data.vip) {
for (let val of result[0].data.vip) {
vipPrice.push({
level: vipLe(val.caption),
... ... @@ -179,6 +179,24 @@ const component = {
}).catch(next);
},
isFavorite(req, res, next) {
if (!req.user.uid) {
return res.json({
code: 401,
message: '用户未登录'
});
}
let params = {
id: req.params.id,
uid: req.user.uid
};
model.isFavorite(params).then(result => {
res.json(result);
}).catch(next);
},
/**
* 获取购物车数量
*
... ...
... ... @@ -12,8 +12,9 @@ const _ = require('lodash');
exports.index = (req, res, next) => {
const params = req.query;
params.order = '';
params.page = 1;
params.limit = 4;
searchModel.products(params).then(result => {
let list = result && result.data ? result.data.product_list : [];
... ... @@ -44,4 +45,3 @@ exports.fetchProducts = (req, res, next) => {
.then(result => res.json(result))
.catch(next);
};
... ...
... ... @@ -80,6 +80,16 @@ const model = {
},
/**
* 判断是否收藏
* @param params
*/
isFavorite(params){
return api.get('/favorite', Object.assign({
method: 'app.favorite.isFavoriteNew'
}, params));
},
/**
* 获取购物车数量
*
* @param params
... ...
... ... @@ -48,6 +48,7 @@ router.get(/\/product\/product_([\d]+)\.json/, detail.product);
router.get(/\/product\/intro_([\d]+)\.json/, detail.intro);
router.get('/product/refundExchange/:skn', detail.supportRefundExchange); // 是否支持7天无理由退换货
router.get('/product/mightLike', detail.mightLike); // 猜你喜欢
router.get('/product/isFavorite/:id', detail.isFavorite); // 判断是否收藏
router.post(/\product\/cart.json/, detail.addToCart);
router.post(/\product\/favorite.json/, auth, detail.favorite);
router.get(/\/product\/cart-count.json/, detail.getCartCount);
... ...
... ... @@ -33,10 +33,11 @@
<h2 class="card-label">
<a href="{{goodsUrl this}}" class="line-clamp-1">{{product_name}}</a>
</h2>
<span class="good-price {{#if market_price}}sale-price{{/if}}">¥ {{toFixed sales_price}}</span>
{{#if marketPrice}}
<span class="good-price" class="old-price">
¥ {{toFixed market_price}}
<span class="good-price {{#if market_price}}sale-price{{/if}}">¥ {{toFixed sales_price
2}}</span>
{{#if market_price}}
<span class="good-price old-price">
¥ {{toFixed market_price 2}}
</span>
{{/if}}
</div>
... ...
... ... @@ -18,8 +18,8 @@ module.exports = {
app_type: 1
},
domains: {
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// api: 'http://api-test2.yohops.com:9999/',
// service: 'http://service-test2.yohops.com:9999/',
... ... @@ -28,8 +28,8 @@ module.exports = {
// service: 'http://dev-service.yohops.com:9999/',
// singleApi: 'http://192.168.102.27:8092/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
},
subDomains: {
... ...
... ... @@ -2,7 +2,7 @@
<div class="ft-item">
<div class="title" @click="toggleExpand(name)">
<span class="t-text">{{name}}</span>
<i class="t-icon icon icon-add"></i>
<i class="t-icon icon" :class="{'icon-add': !show, 'icon-minus': show}"></i>
<span class="t-val ellipsis">{{chosenVal}}</span>
</div>
<div class="choices" v-show="show">
... ... @@ -169,13 +169,19 @@ export default {
.t-icon {
float: right;
margin-top: 28px;
margin-top: 30px;
font-size: 24px;
font-weight: bold;
&.icon-minus {
margin-right: -10px;
margin-top: 20px;
font-size: 55px;
}
}
.choices {
padding: 1px 30px 0!important;
padding: 1px 30px 0;
overflow: hidden;
}
... ...
... ... @@ -198,7 +198,6 @@
}
}
.filter-sort {
.cate-container {
margin-top: 0 !important;
... ...
<template>
<div class="top-filter clearfix" :class="{'search-page': searchPage}">
<v-touch class="filter-overlay" v-show="layFlag" @tap="close"></v-touch>
<div class="filter-overlay" v-show="layFlag" @click="close"></div>
<div class="filter-content">
<ul class="filter-type">
<li class="type-item" @click="toggleRec">{{activeSort.text}}<i class="icon" :class="recClass"></i></li>
... ... @@ -221,7 +221,8 @@ export default {
},
close(){
this.layFlag = false;
this.toggleFilter();
this.recDown = true;
this.filterDown = true;
this.bodyElStyle.position = 'static';
this.bodyElStyle.overflow = 'auto';
},
... ... @@ -341,6 +342,7 @@ export default {
font-size: 0;
list-style: none;
height: 79px;
text-align: center;
background-color: #fff;
padding: 16px 30px 0;
border-bottom: 1px solid #eee;
... ... @@ -403,78 +405,9 @@ export default {
right: 0;
height: auto;
max-height: 950px;
overflow: auto;
background-color: #fff;
.ft-item {
color: $black;
border-bottom: 1px solid #eee;
.title {
height: 89px;
padding: 0 30px;
font-size: 32px;
line-height: 89px;
}
.t-val {
float: right;
max-width: 280px;
font-size: 24px;
margin-right: 10px;
}
.t-text {
float: left;
}
.t-icon {
float: right;
margin-top: 28px;
font-size: 24px;
font-weight: bold;
}
.choices {
padding: 0 30px;
overflow: hidden;
}
.choice {
position: relative;
float: left;
height: 50px;
width: 150px;
padding: 0 5px;
margin-left: 30px;
margin-bottom: 30px;
font-size: 24px;
line-height: 48px;
text-align: center;
border: 1px solid #000;
&:nth-child(4n+1) {
margin-left: 0;
}
&.active {
color: #fff;
background-color: #000;
&:after {
content: '';
width: 22px;
height: 22px;
top: 24px;
right: 0;
position: absolute;
display: inline-block;
background: resolve("product/active-mark.png");
background-size: cover;
}
}
}
}
.action {
padding: 0 30px;
... ... @@ -486,7 +419,6 @@ export default {
}
}
.action-btn {
display: block;
font-size: 28px;
... ...
... ... @@ -113,17 +113,58 @@
</p>
</div>
<div class="group-list swiper-area" v-if="floor.length > 0">
<swipe class="swipe" :style="{height: floorHeight + 'px'}">
<swipe-item v-for="item in floor" :key="item.url" :style="{backgroundColor: item.bgColor}">
<a :href="item.url | transformBlk" :title="item.title">
<img v-img-src="{src: item.src, width: floorImgW, height: floorImgH}">
</a>
</swipe-item>
</swipe>
</div>
<channel :class="{'bg-animation': isShowChannel}" @cv="changeChannel"></channel>
<!--<div class="group-list">
<a class="glist-item auth" href="/me/collection">
我的收藏
<span class="num">商品/品牌/资讯 <span class="icon icon-right"></span></span>
</a>
<a class="glist-item auth" href="/me/records?type={{recordNum}}">
浏览记录
<span class="num">{{recordNum}}<span class="icon icon-right"></span></span>
</a>
</div>-->
<!--<div class="group-list">
<a class="glist-item auth" href="/me/mycurrency">
有货币
<span class="num">{{data.yoho_coin_num}} <span class="icon icon-right"></span></span>
</a>
</div>-->
<div class="group-list address-item">
<a class="glist-item auth" id="address" v-if="data.nickName">
地址管理
<span class="num">{{data.address_num}} <span class="icon icon-right"></span></span>
</a>
<p class="glist-item auth" v-else>
地址管理
</p>
</div>
<div class="group-list">
<a class="glist-item" href="/help">
帮助中心
<span class="num"><span class="icon icon-right"></span></span>
</a>
<p class="glist-item">
电话客服
<span class="num tel" @click="goTel">400-889-9646<span class="icon icon-right"></span></span>
</p>
<p class="glist-item ghost" id="setting">
设置
<span class="num"><span class="icon icon-right"></span></span>
</p>
</div>
<div class="group-list swiper-area" v-if="floor.length > 0">
<swipe class="swipe" :style="{height: floorHeight + 'px'}">
<swipe-item v-for="item in floor" :key="item.src" :style="{backgroundColor: item.bgColor}">
<a :href="item.url | transformBlk" :title="item.title" v-if="item.url">
<img v-img-src="{src: item.src, width: floorImgW, height: floorImgH}">
</a>
<img v-img-src="{src: item.src, width: floorImgW, height: floorImgH}" v-else>
</swipe-item>
</swipe>
</div>
</div>
</template>
<script>
... ...
... ... @@ -71,16 +71,8 @@
},
methods: {
showcase: function() {
let index;
const len =this.goods.length;
const realIndex = this.swiper.realIndex;
if (len < 4) {
index = realIndex;
} else {
index = realIndex - 4 > -1 ?
realIndex - 4 : len + realIndex - 4;
}
const index = this.calcIndex(realIndex);
const opts = {
index,
... ... @@ -92,16 +84,28 @@
yoho.goImageBrowser(opts);
},
setActiveSlide(idx){
let index;
this.activeIndex = this.calcIndex(idx);
},
calcIndex(realIdx){
const len = this.goods.length;
if (len < 4) {
index = idx;
} else {
index = idx - 4 > -1 ?
idx - 4 : len + idx - 4;
if (len >= 4) {
if (realIdx === len -1) {
realIdx = 0;
} else {
realIdx += 1;
}
if (realIdx < len -2) {
realIdx += 2;
} else if (realIdx === len -2) {
realIdx = 0;
} else {
realIdx = 1;
}
}
this.activeIndex = index;
return realIdx;
}
}
};
... ...
... ... @@ -439,6 +439,15 @@
this.$set(this.intro, 'supportRefundExchange', support);
});
// 是否收藏
$.get(`/product/isFavorite/${data.product_id}`).then(fav => {
if (fav.code === 200) {
this.$set('entity.is_collect', fav.data ? 'Y' : 'N');
} else {
this.$set('entity.is_collect', 'N');
}
});
});
}
})
... ... @@ -458,6 +467,10 @@
<style>
.product-page {
background: #f6f6f6;
hr {
margin: 25px 0!important;
}
}
.show-box.brand {
... ... @@ -583,14 +596,14 @@
.item-price {
text-align: left;
margin-top: 45px;
margin-bottom: 40px;
max-height: 195px;
margin-top: 35px;
margin-bottom: 30px;
.price {
color: #b0b0b0;
font-size: 32px;
font-style: normal;
line-height: 1;
font-family: "BrownStd-Regular";
&.line-through {
... ... @@ -600,13 +613,16 @@
}
&.highlight {
color: #b0021b;
line-height: 1;
color: #b0021b;
}
}
.product-name {
font-size: 24px;
margin-top: 15px;
color: #000;
font-size: 24px;
line-height: 1.2;
}
.vip-level {
... ...