|
|
@ -9,23 +9,41 @@ |
|
|
|
|
|
|
|
<!-- 搜索栏 --> |
|
|
|
<view class="search"> |
|
|
|
<uv-search placeholder="搜你喜欢的产品" bgColor="#fff" @search="getData" @custom="getData" |
|
|
|
v-model="queryParams.title"></uv-search> |
|
|
|
<uv-search placeholder="搜你喜欢的产品" bgColor="#fff" |
|
|
|
@search="search" |
|
|
|
@change="search" |
|
|
|
@custom="search" |
|
|
|
v-model="queryParams.title"></uv-search> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 商品列表 --> |
|
|
|
<view style="position: 20rpx;" |
|
|
|
v-if="queryParams.title"> |
|
|
|
<productList :list="list" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 分类商品列表 --> |
|
|
|
<view class="category"> |
|
|
|
<view class="category" |
|
|
|
v-else> |
|
|
|
<uv-vtabs |
|
|
|
:list="category" |
|
|
|
:current="current" |
|
|
|
keyName="title" |
|
|
|
keyName="name" |
|
|
|
@change="change"> |
|
|
|
<view class="list"> |
|
|
|
<uv-vtabs-item> |
|
|
|
<productItem v-for="(item, index) in list" :key="index" :item="item" |
|
|
|
@click="$utils.navigateTo(`/pages_order/product/productDetail?id=${item.id}`)" /> |
|
|
|
<view class="category-item" |
|
|
|
v-for="(item, index) in category[current].children" :key="index"> |
|
|
|
<view class="category-title"> |
|
|
|
{{ item.name }} |
|
|
|
</view> |
|
|
|
|
|
|
|
<productItem :item="pro" |
|
|
|
v-for="(pro, i) in item.shopList" :key="i" |
|
|
|
@click="$utils.navigateTo(`/pages_order/product/productDetail?id=${pro.id}`)" /> |
|
|
|
</view> |
|
|
|
|
|
|
|
<uv-empty mode="list" v-if="list.length == 0"></uv-empty> |
|
|
|
<uv-empty mode="list" v-if="category[current].children.length == 0"></uv-empty> |
|
|
|
</uv-vtabs-item> |
|
|
|
</view> |
|
|
|
</uv-vtabs> |
|
|
@ -43,11 +61,13 @@ |
|
|
|
mapState |
|
|
|
} from 'vuex' |
|
|
|
import tabber from '@/components/base/tabbar.vue' |
|
|
|
import productList from '@/components/user/productList.vue' |
|
|
|
export default { |
|
|
|
mixins: [mixinsList], |
|
|
|
components: { |
|
|
|
productItem, |
|
|
|
tabber, |
|
|
|
productList, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -65,21 +85,28 @@ |
|
|
|
if (search) { |
|
|
|
this.queryParams.title = search |
|
|
|
} |
|
|
|
this.$store.commit('getCategoryList') |
|
|
|
// this.$store.commit('getCategoryList') |
|
|
|
if(this.category.length > 0 && cid){ |
|
|
|
this.category.forEach((n, i) => { |
|
|
|
if(n.id == cid){ |
|
|
|
this.current = i |
|
|
|
} |
|
|
|
}) |
|
|
|
this.queryParams.classId = cid |
|
|
|
// this.queryParams.classId = cid |
|
|
|
}else if (this.category.length > 0) { |
|
|
|
this.queryParams.classId = this.category[0].id |
|
|
|
// this.queryParams.classId = this.category[0].id |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
change(e) { |
|
|
|
this.queryParams.classId = this.category[e].id |
|
|
|
// this.queryParams.classId = this.category[e].id |
|
|
|
this.current = e |
|
|
|
}, |
|
|
|
search(){ |
|
|
|
for(let i = 0;i < 10;i++){ |
|
|
|
delete this.queryParams[i] |
|
|
|
} |
|
|
|
this.queryParams.pageSize = 10 |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
} |
|
|
@ -126,6 +153,30 @@ |
|
|
|
.category { |
|
|
|
font-size: 30rpx; |
|
|
|
color: #333; |
|
|
|
.category-title{ |
|
|
|
position: relative; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
height: 120rpx; |
|
|
|
|
|
|
|
&::before, |
|
|
|
&::after { |
|
|
|
position: absolute; |
|
|
|
top: 50%; |
|
|
|
content: ''; |
|
|
|
width: 10%; |
|
|
|
border-top: 2rpx solid black; |
|
|
|
} |
|
|
|
|
|
|
|
&::before { |
|
|
|
left: 25%; |
|
|
|
} |
|
|
|
|
|
|
|
&::after { |
|
|
|
right: 25%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
&::v-deep .uv-vtabs { |
|
|
|
width: 750rpx; |
|
|
|