116 lines
3.2 KiB
Plaintext
116 lines
3.2 KiB
Plaintext
<template>
|
|
<view>
|
|
<view class="pl-20 pr-20 bgff">
|
|
<uni-search-bar v-model="keyword" @confirm="search()"></uni-search-bar>
|
|
</view>
|
|
<v-tabs height="76rpx" activeFontSize="26rpx" fontSize="26rpx" lineHeight="6rpx"
|
|
:lineScale=".5" lineColor="#fa3326" activeColor="#000"
|
|
scroll :tabs="cateList" v-model="current"></v-tabs>
|
|
<view class="h-84 rows rowsm tct fs-28">
|
|
<view class="w-160" @tap="swtichMode(1)" :class="{'active':paiType==1}">默认</view>
|
|
<view @tap="swtichMode(2)" class="rowsc rowsm w-180">
|
|
<text :class="{'active':paiType==2||paiType==3}" class="mr-10">销量</text>
|
|
<view class="relative" style="top: 4rpx;">
|
|
<image v-if="paiType != 2&&paiType != 3" src="/static/drgth.png" class="w-24 h-26"></image>
|
|
<image v-if="paiType == 2" src="/static/drgtsdgh.png" class="w-24 h-26"></image>
|
|
<image v-if="paiType == 3" src="/static/drgt.png" class="w-24 h-26"></image>
|
|
</view>
|
|
</view>
|
|
<view @tap="swtichMode(4)" class="w-180 rowsc">
|
|
<text :class="{'active':paiType==4||paiType==5}" class="mr-10">价格</text>
|
|
<view class="relative" style="top: 4rpx;">
|
|
<image v-if="paiType != 4&&paiType != 5" src="/static/drgth.png" class="w-24 h-26"></image>
|
|
<image v-if="paiType == 4" src="/static/drgtsdgh.png" class="w-24 h-26"></image>
|
|
<image v-if="paiType == 5" src="/static/drgt.png" class="w-24 h-26"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="pl-20 pr-20">
|
|
<goodslist :type="2" :goodslist="goodslist"></goodslist>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
paiType: 2,
|
|
|
|
cateList: ['分类A','分类B','分类C'],
|
|
current: 0,
|
|
goodslist: [{},{}],
|
|
keyword: '',
|
|
isPush: true,
|
|
pages: 1,
|
|
}
|
|
},
|
|
onLoad(e) {
|
|
this.type = e.type || 1
|
|
if (e.title) {
|
|
uni.setNavigationBarTitle({
|
|
title: e.title
|
|
})
|
|
}
|
|
// this.getCateList()
|
|
this.getGoodsList()
|
|
},
|
|
onReachBottom() {
|
|
this.getGoodsList()
|
|
},
|
|
methods: {
|
|
swtichMode(index) {//切换排序模式
|
|
if (index == 2 || index == 3) {
|
|
this.paiType = this.paiType == 2?3:2
|
|
} else if (index == 4 || index == 5) {
|
|
this.paiType = this.paiType == 4?5:4
|
|
} else {
|
|
this.paiType = index
|
|
}
|
|
},
|
|
search() {
|
|
this.isPush = true
|
|
this.pages = 1
|
|
this.goodslist = []
|
|
this.getGoodsList()
|
|
},
|
|
getGoodsList() {
|
|
if (!this.isPush) return this.showtt('暂无更多数据')
|
|
this.axiosFromToken('POST','index/business', {
|
|
page: this.pages,
|
|
pagenum: 10,
|
|
keyword: this.keyword,
|
|
type: this.type
|
|
}, '加载中').then(res => {
|
|
if (res.data.data&&res.data.data.length!==0) {
|
|
this.goodslist.push(...res.data.data)
|
|
this.pages++
|
|
} else {
|
|
this.isPush = false
|
|
if (this.pages !== 1) {
|
|
this.$tools.showtt('暂无更多数据')
|
|
}
|
|
}
|
|
})
|
|
},
|
|
getCateList() {//获取分类
|
|
let type = {'1':1,'2':2,'3':5}
|
|
this.axiosFromToken('POST', 'other/getClassification', {
|
|
type: type[this.type]
|
|
}, '加载中').then(res => {
|
|
this.cateList = res.data
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
page {
|
|
background: #f7f6fa;
|
|
}
|
|
.active {
|
|
font-weight: 600;
|
|
}
|
|
</style>
|