Authored by 郭成尧

goods-list-add

... ... @@ -31,7 +31,15 @@ module.exports = {
brandModel.getBrandData(params).then(result => {
res.json(result);
});
},
/* 获取商品列表 */
getBrandShopGoods: (req, res) => {
let params = req.query;
brandModel.getBrandShopGoodsData(params).then(result => {
res.json(result);
});
},
/* 品牌列表页 */
... ...
... ... @@ -13,7 +13,17 @@ module.exports = {
* 从接口获取品牌店铺数据
* @returns {*}
*/
getBrandOriginData() {
getBrandOriginData(params) {
return api.get('', {
method: ''
});
},
/**
* 从接口获取品牌店铺商品数据
* @returns {*}
*/
getBrandShopGoodsOriginData(params) {
return api.get('', {
method: ''
});
... ... @@ -23,7 +33,7 @@ module.exports = {
* 从接口获取品牌列表页数据
* @returns {*}
*/
getBrandListOriginData() {
getBrandListOriginData(params) {
return api.get('', {
method: ''
});
... ... @@ -33,7 +43,7 @@ module.exports = {
* 从接口获取全部分类数据
* @returns {*}
*/
getCateListData() {
getCateListData(params) {
return api.get('', {
method: ''
});
... ...
... ... @@ -16,7 +16,7 @@ const brandApi = require('./brand-api');
const getBrandData = params => {
let finalResult = {};
return api.all([brandApi.getBrandOriginData()]).then(result => {
return api.all([brandApi.getBrandOriginData(params)]).then(result => {
// 待处理,拼接输出模拟数据
Object.assign(finalResult, {
... ... @@ -33,13 +33,26 @@ const getBrandData = params => {
};
/**
* 获取品牌店铺商品数据
* @param params
* @returns {*|Promise.<TResult>}
*/
const getBrandShopGoodsData = params => {
let finalResult = {};
return api.all([brandApi.getBrandShopGoodsOriginData(params)]).then(result => {
});
};
/**
* 获取品牌列表页数据
* @param params
*/
const getBrandListData = params => {
let finalResult = {};
return api.all([brandApi.getBrandListOriginData()]).then(result => {
return api.all([brandApi.getBrandListOriginData(params)]).then(result => {
Object.assign(finalResult, {
brandList: [
{
... ... @@ -117,7 +130,7 @@ const getBrandListData = params => {
const getCateListData = params => {
let finalResult = {};
return api.all([brandApi.getCateListData()]).then(result => {
return api.all([brandApi.getCateListData(params)]).then(result => {
// 待处理,拼接输出模拟数据
Object.assign(finalResult, {
... ... @@ -134,6 +147,7 @@ const getCateListData = params => {
module.exports = {
getBrandData,
getBrandShopGoodsData,
getBrandListData,
getCateListData
};
... ...
... ... @@ -17,6 +17,7 @@ router.get('/', channel.index); // 首页
router.get('/resources', channel.resources); // 资源位接口
router.get('/brand', brand.index); // 店铺首页
router.get('/get-brand-intro', brand.getBrandIntro); // 店铺介绍
router.get('/get-brand-shop-goods', brand.getBrandShopGoods); // 店铺介绍
router.get('/brand-list', brand.brandList); // 品牌列表页
router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据
router.get('/cate', brand.cate); // 全部分类
... ...
<template>
<brand-top-cmpnt v-bind:share-Link="shareLink"></brand-top-cmpnt>
<brand-shop-top-cmpnt v-bind:domain="'nike'"></brand-shop-top-cmpnt>
<goods-list v-bind:data="productList"></goods-list>
</template>
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
const brandTopCmpnt = require('channel/brand-top.vue');
const brandShopTopCmpnt = require('channel/brand-shop-top.vue');
const goodsList = require('product/list.vue');
// TODO 确定分享页面后需要添加拼接分享链接的公共方法
let shareLink = 'http://www.yohobuy.com';
... ... @@ -13,12 +17,28 @@
module.exports = {
data() {
return {
shareLink: shareLink
shareLink: shareLink,
productList: []
};
},
methods: {
getProductList(){
let data = {};
$.ajax({
url: '/get-brand-shop-goods',
data: data
}).done(result => {
this.productList = result.productList;
}).fail(() => {
tip('网络错误');
});
}
},
components: {
brandTopCmpnt,
brandShopTopCmpnt
brandShopTopCmpnt,
goodsList
}
};
</script>
... ...