You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
3.7 KiB
174 lines
3.7 KiB
<template>
|
|
<view class="page">
|
|
<view class="pageMain">
|
|
<view class="topBox">
|
|
<view class="bg-2f9 padding-lr-30">
|
|
<ty-bar-search :value.sync="keyword" @search="search" @clear="clear" :autofocus="false"
|
|
:clearable="true" :placeholder="'请输入商品关键词'" :bgColor="'#F5F5F5'">
|
|
</ty-bar-search>
|
|
</view>
|
|
<view class="bg-ff flex tabBox">
|
|
<view class="eveTab line-height-90 position-relative" v-for="(item,index) in tabs" :key="index"
|
|
:class="tabIndex == index ? 'text-28 text-bold' : 'text-33 text-26'"
|
|
:style="index == (tabs.length - 1) ? '' : 'margin-right: 70rpx;'" @click="changeTab(index)">
|
|
{{item.name}}
|
|
<view class="activeTabLine" v-if="tabIndex == index"></view>
|
|
</view>
|
|
<view class="width-50" style="flex-shrink: 0;"></view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="listBox">
|
|
<ty-list-list :status="load_status">
|
|
<view class="eveList flex" v-for="(item,index) in list" :key="index"
|
|
@click="go('/pages/material/detail?id=' + item.id)">
|
|
<view class="goodsImg">
|
|
<image :src="item.cover_img" class="width-100p height-100p block" mode="aspectFill"></image>
|
|
</view>
|
|
<view class="flex-one margin-left-15">
|
|
<view class="line-45 height-90 text-cut-two text-30 text-99 margin-bottom-90">{{item.name}}
|
|
</view>
|
|
<view class="line-30 text-cut-one">
|
|
<text class="icon-icon-gongsi iconfont text-24 text-ff85"></text>
|
|
<text class="text-24 text-77 margin-left-5 ">{{item.company_name}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</ty-list-list>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
tabs: [],
|
|
tabIndex: 0,
|
|
keyword: "",
|
|
load_status: '',
|
|
list: [],
|
|
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.getCates()
|
|
},
|
|
onPullDownRefresh() {
|
|
this.loadList(1)
|
|
},
|
|
onReachBottom() {
|
|
this.loadList(2)
|
|
},
|
|
onShow() {
|
|
if (this.cn.isLogin()) {
|
|
this.getBottomTabRed()
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取底部导航栏红点是否显示
|
|
getBottomTabRed() {
|
|
this.rq.getData('chat/api/FriendsChat/getNoReadNumber').then((res) => {
|
|
if (res.code == 0) {
|
|
if (res.data.number > 0) {
|
|
uni.showTabBarRedDot({
|
|
index: 1
|
|
})
|
|
}else{
|
|
uni.removeTabBarBadge({ index: 1 })
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getCates() {
|
|
this.rq.getData('fire/api/Fire/getProductCategory').then(res => {
|
|
if (res.code == 0) {
|
|
this.tabs = res.data.category;
|
|
this.loadList(1)
|
|
}
|
|
})
|
|
},
|
|
loadList(first_page) {
|
|
this.rq.getList('fire/api/Fire/getProductList', {
|
|
category_id: this.tabs[this.tabIndex].id,
|
|
keyword: this.keyword,
|
|
}, {
|
|
that: this,
|
|
first_page
|
|
}).then(() => {
|
|
uni.stopPullDownRefresh()
|
|
})
|
|
},
|
|
search() {
|
|
this.loadList(1)
|
|
},
|
|
clear() {
|
|
this.keyword = '';
|
|
this.search()
|
|
},
|
|
changeTab(i) {
|
|
if (this.tabIndex == i) {
|
|
return;
|
|
} else {
|
|
this.tabIndex = i;
|
|
this.loadList(1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.topBox {
|
|
width: 100vw;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 10;
|
|
}
|
|
|
|
.tabBox {
|
|
width: 100vw;
|
|
padding-left: 50rpx;
|
|
box-sizing: border-box;
|
|
overflow-x: scroll;
|
|
}
|
|
|
|
.tabBox .eveTab {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.activeTabLine {
|
|
width: 40rpx;
|
|
height: 4rpx;
|
|
background: #2F97FF;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 20rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.pageMain {
|
|
padding-top: calc(var(--headerHeight) + 110rpx);
|
|
padding-bottom: 30rpx;
|
|
}
|
|
|
|
.eveList {
|
|
width: 100%;
|
|
background: #fff;
|
|
padding: 20rpx 45rpx 20rpx 30rpx;
|
|
box-sizing: border-box;
|
|
border-radius: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.goodsImg {
|
|
width: 240rpx;
|
|
height: 240rpx;
|
|
border-radius: 10rpx;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|