Authored by 沈志敏

channel剩余部分

... ... @@ -8,7 +8,6 @@
const brandApi = require('./brand-api');
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
/**
* 处理品牌一览品牌列表数据
... ... @@ -114,7 +113,7 @@ const getBrandListData = params => {
* @returns {*|Promise.<TResult>}
*/
const getCateListData = params => {
return brandApi.getCateListData(params).then(camelCase);
return brandApi.getCateListData(params);
};
module.exports = {
... ...
... ... @@ -22,7 +22,7 @@ let channel = {
return service.get('operations/api/v6/category/getCategory', {}, {
cache: true,
code: 200
}).then(global.yoho.camelCase);
});
},
getGoodsData(params) {
if (!params.productSkn || !params.productSkn.length) {
... ...
... ... @@ -16,20 +16,20 @@ exports.index = (req, res) => {
res.render('new', view);
};
/* 获取 筛选配置 */
exports.fetchFilters = (req, res, next) => {
const params = Object.assign({
uid: req.user.uid || 0,
page: 1,
order: 1,
yh_channel: 'all',
channel: 'all',
}, req.query);
// /* 获取 筛选配置 */
// exports.fetchFilters = (req, res, next) => {
// const params = Object.assign({
// uid: req.user.uid || 0,
// page: 1,
// order: 1,
// yh_channel: 'all',
// channel: 'all',
// }, req.query);
newModel.getNewData(params).then(result => {
res.json(result);
}).catch(next);
};
// newModel.getNewData(params).then(result => {
// res.json(result);
// }).catch(next);
// };
/* 查询 产品列表 */
exports.fetchProducts = (req, res, next) => {
... ...
... ... @@ -27,26 +27,26 @@ exports.getNewData = (params) => {
});
};
/* 查询最新产品筛选条件 */
exports.getNewFilterData = (params) => {
params = Object.assign({
method: 'app.search.newProduct',
}, params);
return api.post('', params, {
cache: true,
code: 200
}).then(result => {
let filterConfig = {};
if (result.data) {
prettyFilter(result.data.filter);
filterConfig = camelCase(result.data.filter);
}
return {
code: result.code,
data: filterConfig
};
});
};
// /* 查询最新产品筛选条件 */
// exports.getNewFilterData = (params) => {
// params = Object.assign({
// method: 'app.search.newProduct',
// }, params);
// return api.post('', params, {
// cache: true,
// code: 200
// }).then(result => {
// let filterConfig = {};
// if (result.data) {
// prettyFilter(result.data.filter);
// filterConfig = camelCase(result.data.filter);
// }
// return {
// code: result.code,
// data: filterConfig
// };
// });
// };
... ...
... ... @@ -62,9 +62,9 @@ module.exports = (Vue) => {
cnAlphabet = product.cn_alphabet;
break;
default:
productId = product.productId;
goodsId = product.goodsList[0].goodsId;
cnAlphabet = product.cnAlphabet;
productId = product.product_id;
goodsId = product.goods_list.length ? product.goods_list[0].goods_id : '';
cnAlphabet = product.cn_alphabet;
}
return `/product/pro_${productId}_${goodsId}/${cnAlphabet}.html`;
... ...
... ... @@ -3,8 +3,8 @@
<div class="cate-container clearfix">
<div class="content">
<ul class="primary-level">
<li v-for="(index, ca) in cateNavLeftData" class="ellipsis" :class="{focus: index === leftcurrent}" class="p-level-item" @click='cateNavLeftFun(index, ca.relationParameter.sort, ca.categoryName)'>
{{ca.categoryName}}
<li v-for="(index, ca) in cateNavLeftData" class="ellipsis" :class="{focus: index === leftcurrent}" class="p-level-item" @click='cateNavLeftFun(index, ca.relation_parameter.sort, ca.category_name)'>
{{ca.category_name}}
</li>
</ul>
<div class="sub-level-container">
... ... @@ -16,8 +16,8 @@
</ul>
<ul class="sub-level">
<li v-for="sub in cateNavRightData" class="ellipsis">
<a v-if="jump" href="/product/list?sort={{sub.relationParameter.sort}}&sort_name={{sub.categoryName}}&gender={{gender}}">{{sub.categoryName}}</a>
<a v-else @click="noJumpReturn(sub.relationParameter.sort, sub.categoryName)">{{sub.categoryName}}</a>
<a v-if="jump" href="/product/list?sort={{sub.relation_parameter.sort}}&sort_name={{sub.category_name}}&gender={{gender}}">{{sub.category_name}}</a>
<a v-else @click="noJumpReturn(sub.relation_parameter.sort, sub.category_name)">{{sub.category_name}}</a>
</li>
</ul>
</div>
... ... @@ -267,11 +267,11 @@
this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
let allSorts = this.cateNavLeftData[0].sub ?
this.cateNavLeftData[0].sub.map(sort=>sort.relationParameter.sort).join(',') : '';
this.cateNavLeftData[0].sub.map(sort=>sort.relation_parameter.sort).join(',') : '';
this.$set('rightAll', this.cateNavLeftData ? {
sortId: allSorts,
categoryName: this.cateNavLeftData[0].categoryName
categoryName: this.cateNavLeftData[0].category_name
} : {});
}
},
... ...
<template>
<div class="sidebar">
<template v-for="(index, item) in list">
<template v-if="item.separativeSign === 'Y'">
<template v-if="item.separative_sign === 'Y'">
<div class="sep">
<!-- 分割线 -->
</div>
</template>
<span class="item ellipsis" :class="{'selected': selectedIndex === index}"
@click="select(index, item)">
<span class="en">{{(item.sortNameEn || '').trim()}}</span>
<span class="cn">{{item.sortName}}</span>
<span class="en">{{(item.sort_name_en || '').trim()}}</span>
<span class="cn">{{item.sort_name}}</span>
</span>
</template>
</div>
... ... @@ -36,7 +36,7 @@
methods: {
select(index, item) {
this.selectedIndex = index;
interceptClick.intercept(item.sortUrl);
interceptClick.intercept(item.sort_url);
}
}
... ...
... ... @@ -4,15 +4,15 @@
<li class="card" v-for="item in data">
<div class="card-pic">
<a href="{{item | goodsUrl}}">
<img v-bind:src="item.defaultImages | resize 372 499" alt="{{item.productName}}">
<img v-bind:src="item.default_images | resize 372 499" alt="{{item.product_name}}">
</a>
</div>
<div class="card-bd">
<h2 class="card-label">
<a href="{{item | goodsUrl}}" class="line-clamp-2">{{item.productName}}</a>
<a href="{{item | goodsUrl}}" class="line-clamp-2">{{item.product_name}}</a>
</h2>
<span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice | toFixed}}</span>
<span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice | toFixed}}</span>
<span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥ {{item.market_price | toFixed}}</span>
<span class="good-price" :class="{'sale-price': item.market_price}">¥ {{item.sales_price | toFixed}}</span>
</div>
</li>
</ul>
... ...
... ... @@ -6,7 +6,6 @@
<script>
const $ = require('jquery');
const titleFloor = require('component/resources/title-floor.vue');
const productList = require('component/product/list.vue');
const bus = require('common/vue-bus');
... ... @@ -21,7 +20,6 @@
},
props: ['floor'],
components: {
titleFloor,
productList
},
methods: {
... ...
<template>
<div class="resources">
<template v-for="floor in resources">
<focus v-if="floor.focus && floor.focusType === '1'" :floor="floor.data" :style="{height: '9.1rem'}">
<focus v-if="floor.focus && floor.focus_type === '1'" :floor="floor.data" :style="{height: '9.1rem'}">
<!-- 轮播图,通栏 -->
</focus>
<focus-left-right v-if="floor.focus && floor.focusType === '2'" :floor="floor.data">
<focus-left-right v-if="floor.focus && floor.focus_type === '2'" :floor="floor.data">
<!-- 轮播图,左右滑动 -->
</focus-left-right>
<title-image v-if="floor.titleImage" :floor="floor.data">
... ...
... ... @@ -2,9 +2,9 @@
<div class="floor-header">
{{title.name}}
<a class="more" href="{{title.moreUrl}}">
<span v-if="title.moreName === '···'" class="icon icon-more"></span>
<span v-else>{{{title.moreName}}}</span>
<a class="more" href="{{title.more_url}}">
<span v-if="title.more_name === '···'" class="icon icon-more"></span>
<span v-else>{{{title.more_name}}}</span>
</a>
</div>
</template>
... ...
<template>
<div class="title-image">
<title-floor :title="{name: floor.title, moreName: floor.moreName, moreUrl: floor.moreUrl}"></title-floor>
<title-floor :title="{name: floor.title, more_name: floor.more_name, more_url: floor.more_url}"></title-floor>
<a class="image" :href="floor.image.url">
<img v-bind:src="floor.image.src | resize 750 364">
</a>
... ...
'use strict';
const path = require('path');
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const utilsPath = path.join(global.utils, '/constant');
const genderMap = require(utilsPath).genderMap;
... ... @@ -14,13 +13,13 @@ const _procProductImg = (product, genderVal) => {
switch (genderVal) {
case genderMap.men:
defaultImages = product.cover1 || product.imagesUrl;
defaultImages = product.cover_1 || product.images_url;
break;
case genderMap.women:
defaultImages = product.cover2 || product.imagesUrl;
defaultImages = product.cover_2 || product.images_url;
break;
default:
defaultImages = product.imagesUrl || product.cover1 || product.cover2;
defaultImages = product.images_url || product.cover_1 || product.cover_2;
break;
}
... ... @@ -52,7 +51,6 @@ module.exports = (list, options) => {
gender: '',
yhChannel: ''
}, options);
list = camelCase(list);
let genderVal = options.gender.split(',');
... ... @@ -64,69 +62,69 @@ module.exports = (list, options) => {
_.forEach(list, (product) => {
// 商品信息有问题,则不显示
if (!product || !product.productId || !product.goodsList || !product.goodsList.length) {
if (!product || !product.product_id || !product.goods_list || !product.goods_list.length) {
return;
}
// 如果库存为0,显示已抢完
if (product.storageNum === 0) {
product.noStorage = true;
if (product.storage_num === 0) {
product.no_storage = true;
}
// 市场价和售价一样,则不显示市场价
if (product.marketPrice === product.salesPrice) {
product.marketPrice = false;
if (product.market_price === product.sales_price) {
product.market_price = false;
}
// 判别默认的商品是否将默认的图片URL赋值到skn
let flag = false;
// 如果设置了默认图片,就取默认的图片
_.forEach(product.goodsList, (goods) => {
_.forEach(product.goods_list, (goods) => {
if (flag) {
return false;
}
if (goods.isDefault === 'Y') {
product.defaultImages = _procProductImg(goods, genderVal);
if (goods.is_default === 'Y') {
product.default_images = _procProductImg(goods, genderVal);
flag = true;
}
});
// 如果还未赋值,则取第一个skc产品的默认图片
if (!flag) {
product.defaultImages = _procProductImg(product.goodsList[0], genderVal);
product.default_images = _procProductImg(product.goods_list[0], genderVal);
}
product.isSoonSoldOut = product.isSoonSoldOut === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.productId}_${product.goodsList[0].goodsId}/${product.cnAlphabet}.html`); // eslint-disable-line
product.is_soon_sold_out = product.is_soon_sold_out === 'Y';
product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`); // eslint-disable-line
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if (options.isApp) {
product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'${product.productId}'}}`; // eslint-disable-line
product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'${product.product_id}'}}`; // eslint-disable-line
}
if (options.showTags) {
product.tags = {};
product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品
product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
product.tags.isLimited = product.isLimited === 'Y'; // 限量
product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD
product.tags.midYear = product.midYear === 'Y'; // 年中
product.tags.yearEnd = product.yearEnd === 'Y'; // 年末
product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着
product.tags.is_new = options.showNew && product.is_new === 'Y'; // 新品
product.tags.is_discount = options.showSale && product.is_discount === 'Y'; // 在售
product.tags.is_limited = product.is_limited === 'Y'; // 限量
product.tags.is_yohood = product.is_yohood === 'Y'; // YOHOOD
product.tags.mid_year = product.mid_year === 'Y'; // 年中
product.tags.year_end = product.year_end === 'Y'; // 年末
product.tags.is_advance = product.is_advance === 'Y'; // 再到着
// 打折与即将售完组合显示打折
if (product.isSoonSoldOut && product.tags.isDiscount) {
product.tags.isNew = false;
} else if (product.tags.isDiscount &&
(product.tags.isNew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {
if (product.isSoonSoldOut && product.tags.is_discount) {
product.tags.is_new = false;
} else if (product.tags.is_discount &&
(product.tags.is_new || product.tags.is_limited || product.tags.is_yohood || product.tags.is_advance)) {
// 打折与其它组合则隐藏打折
product.tags.isDiscount = false;
} else if (product.tags.isYohood && product.tags.isNew) {
product.tags.is_discount = false;
} else if (product.tags.is_yohood && product.tags.is_new) {
// YOHOOD和新品组合显示YOHOOD
product.tags.isNew = false;
product.tags.is_new = false;
}
}
... ...
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
/**
* 处理楼层数据
... ... @@ -10,10 +9,9 @@ module.exports = (list) => {
const formatData = [];
list = list || [];
list = camelCase(list);
_.forEach(list, (floor) => {
floor[_.camelCase(floor.templateName)] = true;
floor[_.camelCase(floor.template_name)] = true;
// 特殊资源位处理
... ...