暂存code
This commit is contained in:
+72
-51
@@ -7,10 +7,10 @@
|
||||
<view>分类</view>
|
||||
<view v-if="selCategory === 1" class="category_item_sel_but"></view>
|
||||
</view>
|
||||
<view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
|
||||
<!-- <view :class="selCategory === 2 ? 'category_item category_item_sel':'category_item'" @click="checkCategory(2)">
|
||||
<view>品牌</view>
|
||||
<view v-if="selCategory === 2" class="category_item_sel_but"></view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- 搜索 -->
|
||||
<view style="width: 200rpx;" @click="jumpSearch">
|
||||
@@ -32,54 +32,53 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 商品类别数据 -->
|
||||
<block>
|
||||
<scroll-view scroll-y class="right-box">
|
||||
<!-- banner图 -->
|
||||
<view style="padding: 0rpx 20rpx;">
|
||||
<up-swiper
|
||||
:list="bannerList"
|
||||
height="80px"
|
||||
></up-swiper>
|
||||
</view>
|
||||
<view class="page-view">
|
||||
<!-- 这里还有一层循环 -->
|
||||
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
|
||||
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
|
||||
<view class="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<view class="item-container" v-if="item.foods && item.foods.length !==0">
|
||||
<view
|
||||
class="thumb-box"
|
||||
v-for="(item1, index1) in item.foods"
|
||||
:key="index1"
|
||||
@click="jumpProduct(item1)"
|
||||
>
|
||||
<image class="item-menu-image" :src="item1.icon?item1.icon:'/static/common/def_img.jpg'" mode=""></image>
|
||||
<view class="item-menu-name">{{item1.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="not_order_warp">
|
||||
<view class="not_order_warp_img"><up-image src="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
|
||||
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
|
||||
<scroll-view scroll-y class="right-box">
|
||||
<!-- banner图 -->
|
||||
<view style="padding: 0rpx 20rpx;">
|
||||
<up-swiper
|
||||
:list="bannerList"
|
||||
height="80px"
|
||||
></up-swiper>
|
||||
</view>
|
||||
<view class="page-view">
|
||||
<!-- 这里还有一层循环 -->
|
||||
<up-loading-page :loading="tabbarContentLoading"></up-loading-page>
|
||||
<view class="class-item" v-for="(item,index) in tabbarContentList" :key="index">
|
||||
<view class="item-title">
|
||||
<text>{{item.name}}</text>
|
||||
</view>
|
||||
<view class="item-container" v-if="item.foods && item.foods.length !==0">
|
||||
<view
|
||||
class="thumb-box"
|
||||
v-for="(item1, index1) in item.foods"
|
||||
:key="index1"
|
||||
@click="jumpSearch(item1)"
|
||||
>
|
||||
<image class="item-menu-image" :src="item1.icon?item1.icon:'/static/common/def_img.jpg'" mode=""></image>
|
||||
<view class="item-menu-name">{{item1.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="not_order_warp">
|
||||
<view class="not_order_warp_img"><up-image src="/static/common/not_shopping.png" width="100" height="100" bgColor="#f1f6ff00"></up-image></view>
|
||||
<view class="not_order_msg_warp">暂无分类,快去添加吧~</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<CustomTabBar :tabIndex="1"/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import classifyData from '@/common/classify.data.js';
|
||||
import { getCascadeCategory } from '@/api/common.js';
|
||||
import CustomTabBar from '@/components/custom-tab-bar.vue';
|
||||
|
||||
export default {
|
||||
components:{CustomTabBar},
|
||||
data() {
|
||||
return {
|
||||
selCategory:1,
|
||||
tabbar: classifyData,
|
||||
scrollTop: 0, //tab标题的滚动条位置
|
||||
current: null, // 预设当前项的值
|
||||
menuHeight: 0, // 左边菜单的高度
|
||||
@@ -94,13 +93,36 @@
|
||||
tabbarContentLoading:false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
onShow() {
|
||||
/*#ifdef APP-PLUS*/
|
||||
uni.hideTabBar({
|
||||
animation: false
|
||||
})
|
||||
/*#endif*/
|
||||
},
|
||||
onShow() {
|
||||
const then = this;
|
||||
this.getSort(0).then(resp=>{
|
||||
if(resp && resp.length !==0){
|
||||
const fData = resp[0];
|
||||
this.tabbarList = resp;
|
||||
this.swichMenu(fData,0);
|
||||
const sortId = uni.getStorageSync('sortId');
|
||||
// 如果有默认的参数就默认选中参数
|
||||
if(sortId && sortId !==0){
|
||||
let fData = {};
|
||||
let currentIndex = 0;
|
||||
resp.map((item,index)=>{
|
||||
if(item.id === sortId){
|
||||
fData = item;
|
||||
currentIndex = index;
|
||||
return;
|
||||
}
|
||||
})
|
||||
this.swichMenu(fData,currentIndex);
|
||||
}else{
|
||||
const fData = resp[0];
|
||||
// 否则就选中第一个
|
||||
this.swichMenu(fData,0);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -108,9 +130,13 @@
|
||||
checkCategory(val){
|
||||
this.selCategory = val;
|
||||
},
|
||||
jumpSearch(){
|
||||
jumpSearch(item){
|
||||
let path = "/pages/search/search";
|
||||
if(item && Object.keys(item).length !==0){
|
||||
path = path+"?keyword="+item.name;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:'/pages/search/search',
|
||||
url:path,
|
||||
})
|
||||
},
|
||||
// 查询分类
|
||||
@@ -164,20 +190,14 @@
|
||||
}).exec();
|
||||
})
|
||||
},
|
||||
// 跳转到搜索页面
|
||||
jumpProduct(item){
|
||||
uni.navigateTo({
|
||||
url:'/pages/search/search?categoryId='+item.id,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sort_warp{
|
||||
padding: 130rpx 0rpx 0rpx;
|
||||
height: calc(100vh - 130rpx);
|
||||
height: calc(100vh - 270rpx);// 130 上边的导航栏,140下边的导航栏
|
||||
}
|
||||
.sort_header{
|
||||
display: flex;
|
||||
@@ -215,7 +235,7 @@
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
margin-top: 20rpx;
|
||||
height: calc(100vh - 216rpx);
|
||||
height: calc(100vh - 356rpx);
|
||||
}
|
||||
|
||||
.u-search-inner {
|
||||
@@ -235,11 +255,12 @@
|
||||
.u-tab-view {
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.u-tab-item {
|
||||
height: 110rpx;
|
||||
background: #f6f6f6;
|
||||
// background: #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user