提交 2d978d51 authored 作者: YunaiV's avatar YunaiV

前端 mobile :商品列表

上级 40e4236a
...@@ -8,4 +8,16 @@ export function getProductCategoryList(pid) { ...@@ -8,4 +8,16 @@ export function getProductCategoryList(pid) {
pid pid
} }
}); });
}
export function getProductSpuPage(cid, pageNo, pageSize) {
return request({
url: 'product-api/users/spu/page',
method: 'get',
params: {
cid,
pageNo: pageNo || 1,
pageSize: pageSize || 10,
}
});
} }
\ No newline at end of file
<template> <template>
<van-cell-group class="additional"> <router-link :to="'/product/' + product.id">
<van-card <van-cell-group class="additional">
:title="product.title" <van-card
:desc="product.desc" :title="product.name"
:num="(iscard?null:product.quantity)" :desc="product.sellPoint"
style="background:#fff" :num="(iscard?null:product.quantity)"
> style="background:#fff"
<template slot="thumb"> >
<img :src="product.imageURL" /> <template slot="thumb">
<p v-if="product.imageTag!=null&&product.imageTag!=''" class="image_tag">{{product.imageTag}}</p> <img :src="product.picUrls[0]"/>
</template> <p v-if="product.imageTag!=null&&product.imageTag!=''" class="image_tag">{{product.imageTag}}</p>
<template slot="tags"> </template>
<p class="price" v-if="product.price!=null&&product.price!=''" > <template slot="tags">
<span>{{product.price}}</span> <p class="price" v-if="product.price!=null&&product.price!=''">
<van-tag v-if="product.tags!=null" v-for="tag in product.tags" :key="tag" plain type="danger">{{tag}}</van-tag> <span>{{product.price}}</span>
</p> <van-tag v-if="product.tags!=null" v-for="tag in product.tags" :key="tag" plain type="danger">
<van-stepper v-if="iscard" v-model="product.quantity" :max="product.max" :min="product.min" /> {{tag}}
</template> </van-tag>
</van-card> </p>
<van-cell v-for="(gift,j) in product.gift" :key="j" :value="'x'+gift.quantity" > <van-stepper v-if="iscard" v-model="product.quantity" :max="product.max" :min="product.min"/>
<template slot="title"> </template>
<van-tag type="danger" v-if="j==0" >赠品</van-tag> </van-card>
<span class="van-cell-text" :style="(j>0?'margin-left: 35px;':'')" >{{gift.title}}</span> <!-- TODO 芋艿,暂时去掉赠品 -->
</template> <!--<van-cell v-for="(gift,j) in product.gift" :key="j" :value="'x'+gift.quantity" >-->
</van-cell> <!--<template slot="title">-->
<slot /> <!--<van-tag type="danger" v-if="j==0" >赠品</van-tag>-->
</van-cell-group> <!--<span class="van-cell-text" :style="(j>0?'margin-left: 35px;':'')" >{{gift.title}}</span>-->
<!--</template>-->
<!--</van-cell>-->
<slot/>
</van-cell-group>
</router-link>
</template> </template>
<script> <script>
export default { export default {
name:'product-card', name: 'product-card',
props:{ props: {
product:Object, product: Object,
iscard: { iscard: {
type: Boolean, type: Boolean,
default: false default: false
}, },
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
.additional { .additional {
.van-cell { .van-cell {
padding: 0 15px; padding: 0 15px;
font-size: 12px; font-size: 12px;
} }
.van-cell:not(:last-child)::after{
border:0; .van-cell:not(:last-child)::after {
} border: 0;
.van-card__title{ }
font-size: 14px;
} .van-card__title {
.van-cell__title { font-size: 14px;
flex: 10; }
overflow: hidden;
text-overflow: ellipsis; .van-cell__title {
white-space: nowrap; flex: 10;
} overflow: hidden;
.van-tag { text-overflow: ellipsis;
line-height: 12px; white-space: nowrap;
margin-right: 5px; }
}
.price { .van-tag {
color: #e93b3d; line-height: 12px;
font-size: 10px;
overflow: hidden;
height: 18px;
span {
font-size: 16px;
margin-right: 5px; margin-right: 5px;
}
.van-tag{
font-size: 12px;
}
}
.van-stepper{
position: absolute;
bottom: 5px;
right: 5px;
&__plus{
width: 30px;
} }
&__minus{
width: 30px; .price {
color: #e93b3d;
font-size: 10px;
overflow: hidden;
height: 18px;
span {
font-size: 16px;
margin-right: 5px;
}
.van-tag {
font-size: 12px;
}
}
.van-stepper {
position: absolute;
bottom: 5px;
right: 5px;
&__plus {
width: 30px;
}
&__minus {
width: 30px;
}
}
.image_tag {
position: absolute;
bottom: 0;
width: 90px;
height: 20px;
line-height: 20px;
font-size: 10px;
color: #fff;
text-align: center;
background-color: rgba(0, 0, 0, .7);
} }
} }
.image_tag{
position: absolute;
bottom: 0;
width: 90px;
height: 20px;
line-height: 20px;
font-size: 10px;
color: #fff;
text-align: center;
background-color: rgba(0,0,0,.7);
}
}
.additional::after{
border-color: #f7f7f7;
} .additional::after {
border-color: #f7f7f7;
}
</style> </style>
...@@ -151,7 +151,14 @@ const routes = [ ...@@ -151,7 +151,14 @@ const routes = [
} }
}, },
{ {
path: '/search', path: '/product/search',
component: () => import('../page/product/search'),
meta: {
title: '商品搜索'
}
},
{
path: '/products/list',
component: () => import('../page/product/list'), component: () => import('../page/product/list'),
meta: { meta: {
title: '商品列表' title: '商品列表'
......
...@@ -66,10 +66,10 @@ ...@@ -66,10 +66,10 @@
<!--<li><a ><img src="//img12.360buyimg.com/focus/s140x140_jfs/t1/345/33/944/5582/5b9236d2E62d8da2e/99f72d51b8f195ed.jpg"><span>电话手表</span></a></li>--> <!--<li><a ><img src="//img12.360buyimg.com/focus/s140x140_jfs/t1/345/33/944/5582/5b9236d2E62d8da2e/99f72d51b8f195ed.jpg"><span>电话手表</span></a></li>-->
<!--<li><a ><img src="//img30.360buyimg.com/focus/s140x140_jfs/t1/1446/14/631/8500/5b9237e5E0d1f9e16/b1a627b92323b5ed.png"><span>华为</span></a></li>--> <!--<li><a ><img src="//img30.360buyimg.com/focus/s140x140_jfs/t1/1446/14/631/8500/5b9237e5E0d1f9e16/b1a627b92323b5ed.png"><span>华为</span></a></li>-->
<li v-for="category in childCategories"> <li v-for="category in childCategories">
<a > <router-link :to="'/products/list?title=' + activeCategory.name + '&cidFirst=' + activeCategory.id + '&cidSecond=' + category.id">
<img :src="category.picUrl" /> <img :src="category.picUrl" />
<span>{{ category.name }}</span> <span>{{ category.name }}</span>
</a> </router-link>
</li> </li>
<div style="clear:both"> <div style="clear:both">
</div> </div>
...@@ -96,6 +96,7 @@ export default { ...@@ -96,6 +96,7 @@ export default {
rootCategories: [], rootCategories: [],
childCategories: [], childCategories: [],
activeKey: 0, activeKey: 0,
activeCategory: {}, // 选中的分类
fullHeight: document.documentElement.clientHeight - 93, fullHeight: document.documentElement.clientHeight - 93,
fullWidth: document.documentElement.clientWidth - 99 fullWidth: document.documentElement.clientWidth - 99
}; };
...@@ -113,7 +114,8 @@ export default { ...@@ -113,7 +114,8 @@ export default {
this.activeKey = key; this.activeKey = key;
// 读取子节点的分类 // 读取子节点的分类
if (this.rootCategories.length > key) { if (this.rootCategories.length > key) {
let response = getProductCategoryList(this.rootCategories[key].id); this.activeCategory = this.rootCategories[key];
let response = getProductCategoryList(this.activeCategory.id);
response.then(data => { response.then(data => {
this.childCategories = data; this.childCategories = data;
}); });
...@@ -129,6 +131,7 @@ export default { ...@@ -129,6 +131,7 @@ export default {
this.rootCategories = data; this.rootCategories = data;
// 获得首个根节点的分类 // 获得首个根节点的分类
if (data && data.length > 0) { if (data && data.length > 0) {
this.activeCategory = data[0];
let response = getProductCategoryList(data[0].id); let response = getProductCategoryList(data[0].id);
response.then(data => { response.then(data => {
this.childCategories = data; this.childCategories = data;
......
差异被折叠。
...@@ -28,6 +28,12 @@ public class UsersProductSpuVO { ...@@ -28,6 +28,12 @@ public class UsersProductSpuVO {
* 目前的计算方式是,以 Sku 最小价格为准 * 目前的计算方式是,以 Sku 最小价格为准
*/ */
private Integer price; private Integer price;
/**
* 库存数量
*
* 目前的计算方式是,以 Sku 库存累加为准
*/
private Integer quantity;
public Integer getId() { public Integer getId() {
return id; return id;
...@@ -82,4 +88,13 @@ public class UsersProductSpuVO { ...@@ -82,4 +88,13 @@ public class UsersProductSpuVO {
this.price = price; this.price = price;
return this; return this;
} }
public Integer getQuantity() {
return quantity;
}
public UsersProductSpuVO setQuantity(Integer quantity) {
this.quantity = quantity;
return this;
}
} }
\ No newline at end of file
...@@ -202,7 +202,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { ...@@ -202,7 +202,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
public CommonResult<ProductSpuPageBO> getProductSpuPage(ProductSpuPageDTO productSpuPageDTO) { public CommonResult<ProductSpuPageBO> getProductSpuPage(ProductSpuPageDTO productSpuPageDTO) {
ProductSpuPageBO productSpuPage = new ProductSpuPageBO(); ProductSpuPageBO productSpuPage = new ProductSpuPageBO();
// 查询分页数据 // 查询分页数据
int offset = productSpuPageDTO.getPageNo() * productSpuPageDTO.getPageSize(); int offset = (productSpuPageDTO.getPageNo() - 1) * productSpuPageDTO.getPageSize();
productSpuPage.setSpus(ProductSpuConvert.INSTANCE.convert(productSpuMapper.selectListByNameLikeOrderBySortAsc( productSpuPage.setSpus(ProductSpuConvert.INSTANCE.convert(productSpuMapper.selectListByNameLikeOrderBySortAsc(
productSpuPageDTO.getName(), productSpuPageDTO.getCid(), productSpuPageDTO.getVisible(), productSpuPageDTO.getName(), productSpuPageDTO.getCid(), productSpuPageDTO.getVisible(),
offset, productSpuPageDTO.getPageSize()))); offset, productSpuPageDTO.getPageSize())));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论