Browse Source

分类完善

master
453530270@qq.com 2 years ago
parent
commit
cd43fa7223
  1. 90
      pages/category/index.vue

90
pages/category/index.vue

@ -14,10 +14,10 @@
<!-- 右侧 二级分类 -->
<scroll-view class="cate-right" :scroll-top="scrollTop" :scroll-y="true" :style="{ height: `${scrollHeight}px` }">
<view v-if="list" class="cate-right-cont">
<view v-if="list.length>0" class="cate-right-cont">
<view class="cate-two-box">
<view class="cate-cont-box">
<view class="flex-two" v-for="(item, idx) in list" :key="idx" @click="onTargetGoods(item)">
<view class="flex-two" v-for="(item, idx) in list" :key="idx" @click="onTargetGoods(item.goods_islicode)">
<view class="cate-img-padding">
<view v-if="item.goods_image" class="cate-img">
<image class="image" mode="scaleToFill" :src="item.goods_image"></image>
@ -28,9 +28,22 @@
</view>
</view>
</view>
<!-- 空白提示 -->
<view v-else class="cate-right-cont">
<view class="empty-content">
<view class="empty-icon">
<image class="image" src="/static/empty.png" mode="widthFix"></image>
</view>
<view class="tips">暂无数据</view>
</view>
</view>
</scroll-view>
</view>
<empty v-if="!list.length" />
</view>
</view>
@ -38,10 +51,9 @@
<script>
import MescrollCompMixin from '@/components/mescroll-uni/mixins/mescroll-comp'
import { setCartTabBadge } from '@/core/app'
import SettingKeyEnum from '@/common/enum/setting/Key'
import { PageCategoryStyleEnum } from '@/common/enum/store/page/category'
import SettingModel from '@/common/model/Setting'
import * as CategoryApi from '@/api/category'
import * as GoodsApi from '@/api/goods'
import Empty from '@/components/empty'
@ -52,13 +64,13 @@
// ()
const menus = [
{ id: 'all', name: '全部标的数据', icon: 'qpdingdan' },
{ id: 'rs', name: '文化资源数据', icon: 'daifukuan', count: 0 },
{ id: 'rd', name: '文化数字内容', icon: 'daifahuo', count: 0 },
{ id: 'all', name: '全部标的数据', type:0},
{ id: 'rs', name: '文化资源数据', type: 1 },
{ id: 'rd', name: '文化数字内容', type: 2 },
]
//
let limit=24;
let limit=2;
//
let lastRefreshTime;
@ -129,6 +141,8 @@
lastRefreshTime = new Date().getTime()
//
this.getPageData()
//
this.getCatList()
},
@ -160,9 +174,8 @@
handleSelectNav(index) {
this.curIndex = index
this.scrollTop = 0
//
this.getCatList(this.curIndex)
//
this.getCatList()
},
//
@ -172,23 +185,34 @@
},
//
getCatList(type){
this.$toast(type)
getCatList(){
console.log("curindex",this.curIndex)
let item = menus[this.curIndex]
console.log(item)
let type= item.type
if(type>0){
let rd={"record_type":type,"goods_status":1,"page":this.page,"limit":limit}
this.bindData(rd)
}else{
this.getAllGoods()
}
// if(type>0){
// let rd={"record_type":type,"goods_status":1,"page":this.page,"limit":limit}
// this.bindData(rd)
// }else{
// this.getAllGoods()
// }
},
//
onTargetGoods(gislicode){
// this.$toast(goodsId)
this.$navTo('pages/goods/detail', { gislicode })
},
//
bindData(rd){
GoodsApi.soglist(rd).then(res=>{
this.list = res.data.data
this.page=res.data.current_page
console.log("res",res)
});
},
@ -203,6 +227,7 @@
<style>
page {
background: #fff;
position: relative;
}
</style>
<style lang="scss" scoped>
@ -217,7 +242,7 @@
//
.secondary{
z-index: 6;
z-index: 19;
border-top: 1rpx solid #444;
height: 100vh;
}
@ -233,7 +258,7 @@
// + 20
.cate-left {
height: 100%;
// height: 100%;
display: flex;
flex-direction: column;
flex: 0 0 26%;
@ -264,6 +289,25 @@
width: 100%;
padding: 0 10px;
}
//
.empty-content {
box-sizing: border-box;
width: 100%;
padding: 140rpx 50rpx;
text-align: center;
.tips {
font-size: 28rpx;
color: gray;
margin: 50rpx 0;
}
.empty-icon .image {
width: 280rpx;
}
}
}
}

Loading…
Cancel
Save