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.
128 lines
2.9 KiB
128 lines
2.9 KiB
1 year ago
|
<template>
|
||
|
<view class="page flex-col" style="">
|
||
|
<view class="block_1 flex-row">
|
||
|
<view class="box_1 flex-col justify-end">
|
||
|
<view class="input_1 flex-row">
|
||
|
<image class="icon_1" referrerpolicy="no-referrer"
|
||
|
src="/static/lanhu_gongyinglian/0debd1cd292419106182a61d790f584a.png"
|
||
|
@click="changeTab('search')" />
|
||
|
<input class="text_1" placeholder="请输入供应链商品名称进行检索" v-model="search"></input>
|
||
|
</view>
|
||
|
|
||
|
<view class="text-wrapper flex-row justify-between" style="display: '';overflow-x: auto;">
|
||
|
<text class="text_3" :class="{ active: activeTab === '0' }" @click="changeTab('0')">全部</text>
|
||
|
<text class="text_3" :class="{ active: activeTab === item.id }" @click="changeTab(item.id)"
|
||
|
v-for="(item, index) in fenlei" :key="index">{{item.name}}</text>
|
||
|
</view>
|
||
|
|
||
|
|
||
|
<view class="group_2 flex-row justify-between" @click="go(item.id)" v-for="(item, index) in goods"
|
||
|
:key="index" style="border-bottom: 1px solid lightgray;width:95%;padding-bottom: 200rpx;">
|
||
|
<image class="box_2 flex-col" :src="item.image"></image>
|
||
|
<view class="box_3 flex-col justify-between" style="margin-left: 10rpx;width: 60%;">
|
||
|
<text class="text_6">{{item.title}}</text>
|
||
|
<view class="text-wrapper_2 flex-row justify-between">
|
||
|
<text class="text_7">{{item.price}}</text>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
<script>
|
||
|
import {
|
||
|
mapState
|
||
|
} from 'vuex';
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
activeTab: '0',
|
||
|
search: '',
|
||
|
fenlei: [],
|
||
|
goods: []
|
||
|
};
|
||
|
},
|
||
|
computed: {
|
||
|
...mapState(['user', 'statistics', 'common'])
|
||
|
},
|
||
|
onLoad() {
|
||
|
this.getData()
|
||
|
this.getData2()
|
||
|
uni.setNavigationBarColor({
|
||
|
backgroundColor: '#802931', // 背景颜色
|
||
|
frontColor: '#ffffff' // 前景颜色(包括标题、返回图标等)
|
||
|
})
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
getData() {
|
||
|
this.$api.get({
|
||
|
url: '/wanlshop/data/getFenLei',
|
||
|
success: res => {
|
||
|
this.fenlei = res
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
|
||
|
getData2() {
|
||
|
this.$api.get({
|
||
|
url: '/wanlshop/data/getGoodsList',
|
||
|
data: {
|
||
|
'id': this.activeTab,
|
||
|
'search': this.search
|
||
|
},
|
||
|
success: res => {
|
||
|
this.goods = res
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
|
||
|
go(id) {
|
||
|
if (!this.user.id) {
|
||
|
this.$wanlshop.msg('请先登录');
|
||
|
return false
|
||
|
}
|
||
|
uni.navigateTo({
|
||
|
url: '/pages/product/goods?id=' + id
|
||
|
});
|
||
|
},
|
||
|
changeTab(tab) {
|
||
|
console.log(tab)
|
||
|
this.activeTab = tab;
|
||
|
this.getData2()
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
</script>
|
||
|
<style lang='css'>
|
||
|
@import '../common/common.css';
|
||
|
@import './assets/style/index.rpx.css';
|
||
|
|
||
|
|
||
|
.text-wrapper {
|
||
|
width: 100%;
|
||
|
padding: 20px 0;
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
.text-wrapper .text_3 {
|
||
|
width: auto;
|
||
|
padding: 0 20rpx;
|
||
|
|
||
|
height: 40rpx;
|
||
|
margin: 0 3%;
|
||
|
|
||
|
text-align: center;
|
||
|
text-decoration: none;
|
||
|
}
|
||
|
|
||
|
.text-wrapper .active {
|
||
|
color: black;
|
||
|
font-size: 15px;
|
||
|
font-weight: 900;
|
||
|
border-bottom: 3px solid #802931;
|
||
|
}
|
||
|
</style>
|