分类页面优化-0714

master
Lee-1203 2022-07-14 11:09:02 +08:00
parent 514308d783
commit 313fb2ac8d
34 changed files with 75 additions and 57 deletions

View File

@ -328,7 +328,8 @@ page {background-color: #eaeaea;}
width: 0; width: 0;
height: 0; height: 0;
} }
.shop-list-bg .tips{ .shop-list-bg .tips,
.cate-nothing-tips{
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
line-height: 2; line-height: 2;

View File

@ -11,7 +11,7 @@
</view> </view>
</view> </view>
<!-- 一级分类列表 --> <!-- 一级分类列表 -->
<view class="cate-nav-bg" :style="{'height':scrollHeight+'px','top':topHieght+'px'}" :class="businessId==0?'':'to-top'"> <view class="cate-nav-bg" :style="{'height':scrollHeight+'px','top':topHieght+'px'}" :class="businessId==0?'':'to-top'" v-if="cateList.length>0">
<view class="cate-nav"> <view class="cate-nav">
<view class="cate-nav-item" :class="cateIndex == index?'active':''" @tap="changeCate(index,item.id)" v-for="(item,index) in cateList" :key="index">{{item.title}}</view> <view class="cate-nav-item" :class="cateIndex == index?'active':''" @tap="changeCate(index,item.id)" v-for="(item,index) in cateList" :key="index">{{item.title}}</view>
</view> </view>
@ -26,6 +26,7 @@
</view> </view>
<view class="tips" v-if="secondList.length==0 && isTips">------</view> <view class="tips" v-if="secondList.length==0 && isTips">------</view>
</scroll-view> </scroll-view>
<view class="cate-nothing-tips" v-if="cateList.length==0">------</view>
<!-- 购物车btn --> <!-- 购物车btn -->
<enter-cart></enter-cart> <enter-cart></enter-cart>
<!-- 底部tab --> <!-- 底部tab -->
@ -162,25 +163,32 @@
getCateList(pid){ getCateList(pid){
this.$requst.get('/api/spu/category',{business_id:pid}).then(res=>{ this.$requst.get('/api/spu/category',{business_id:pid}).then(res=>{
if(res.code==0) { if(res.code==0) {
if(res.data.length>0){
uni.setStorageSync('companyIndex',this.companyIndex); //index
uni.setStorageSync('businessId',this.businessId); //id uni.setStorageSync('businessId',this.businessId); //id
this.cateIndex = 0; this.cateIndex = 0;
this.cateList = []; this.cateList = [];
this.cateList = res.data; // this.cateList = res.data; //
// //
this.getSecondList(this.cateIndex); this.getSecondList(this.cateIndex);
}else{ // if(res.data.length>0){
this.$toolAll.tools.showToast('该商户不能选择'); // uni.setStorageSync('companyIndex',this.companyIndex); //index
this.companyIndex = uni.getStorageSync('companyIndex'); //index // uni.setStorageSync('businessId',this.businessId); //id
this.businessId = uni.getStorageSync('businessId'); //id // this.cateIndex = 0;
} // this.cateList = [];
// this.cateList = res.data; //
// //
// this.getSecondList(this.cateIndex);
// }else{
// this.$toolAll.tools.showToast('');
// this.companyIndex = uni.getStorageSync('companyIndex'); //index
// this.businessId = uni.getStorageSync('businessId'); //id
// }
} }
uni.hideLoading(); uni.hideLoading();
}) })
}, },
// //
getSecondList(index){ getSecondList(index){
this.secondList=[];
if(this.cateList[index].has_children){ if(this.cateList[index].has_children){
this.secondList = this.cateList[index].children; this.secondList = this.cateList[index].children;
}else{ }else{

BIN
static/public/图层44.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -890,7 +890,8 @@ page {background-color: #eaeaea;}
width: 0; width: 0;
height: 0; height: 0;
} }
.shop-list-bg .tips{ .shop-list-bg .tips,
.cate-nothing-tips{
font-size: 24rpx; font-size: 24rpx;
color: #999; color: #999;
line-height: 2; line-height: 2;

View File

@ -194,6 +194,7 @@ __webpack_require__.r(__webpack_exports__);
var _publicApi = __webpack_require__(/*! @/jsFile/public-api.js */ 9); var _publicApi = __webpack_require__(/*! @/jsFile/public-api.js */ 9);
@ -320,25 +321,32 @@ var _default = {
getCateList: function getCateList(pid) {var _this4 = this; getCateList: function getCateList(pid) {var _this4 = this;
this.$requst.get('/api/spu/category', { business_id: pid }).then(function (res) { this.$requst.get('/api/spu/category', { business_id: pid }).then(function (res) {
if (res.code == 0) { if (res.code == 0) {
if (res.data.length > 0) {
uni.setStorageSync('companyIndex', _this4.companyIndex); //工厂index
uni.setStorageSync('businessId', _this4.businessId); //工厂id uni.setStorageSync('businessId', _this4.businessId); //工厂id
_this4.cateIndex = 0; _this4.cateIndex = 0;
_this4.cateList = []; _this4.cateList = [];
_this4.cateList = res.data; //一级分类 _this4.cateList = res.data; //一级分类
// 查询二级 // 查询二级
_this4.getSecondList(_this4.cateIndex); _this4.getSecondList(_this4.cateIndex);
} else { // if(res.data.length>0){
_this4.$toolAll.tools.showToast('该商户不能选择'); // uni.setStorageSync('companyIndex',this.companyIndex); //工厂index
_this4.companyIndex = uni.getStorageSync('companyIndex'); //还原工厂index // uni.setStorageSync('businessId',this.businessId); //工厂id
_this4.businessId = uni.getStorageSync('businessId'); //还原工厂id // this.cateIndex = 0;
} // this.cateList = [];
// this.cateList = res.data; //一级分类
// // 查询二级
// this.getSecondList(this.cateIndex);
// }else{
// this.$toolAll.tools.showToast('该商户不能选择');
// this.companyIndex = uni.getStorageSync('companyIndex'); //还原工厂index
// this.businessId = uni.getStorageSync('businessId'); //还原工厂id
// }
} }
uni.hideLoading(); uni.hideLoading();
}); });
}, },
// 查询二级分类 // 查询二级分类
getSecondList: function getSecondList(index) { getSecondList: function getSecondList(index) {
this.secondList = [];
if (this.cateList[index].has_children) { if (this.cateList[index].has_children) {
this.secondList = this.cateList[index].children; this.secondList = this.cateList[index].children;
} else { } else {

View File

@ -1 +1 @@
<view class="pad-b150"><status-nav vue-id="c7684662-1" ifReturn="{{false}}" navBarTitle="分类" marginBottom="{{0}}" bind:__l="__l"></status-nav><view data-event-opts="{{[['tap',[['closeMore',['$event']]]]]}}" hidden="{{!(isShow)}}" class="pull-all-bg" bindtap="__e"></view><block wx:if="{{businessId==0}}"><view class="company-top"></view></block><block wx:if="{{businessId==0}}"><view class="company" style="{{'top:'+(topHieght+'px')+';'}}"><input type="text" data-event-opts="{{[['tap',[['openMore',['$event']]]]]}}" value="{{companyList[companyIndex].name?'工厂选择:'+companyList[companyIndex].name:''}}" bindtap="__e"/><block wx:if="{{isShow}}"><view class="company-list"><block wx:for="{{companyList}}" wx:for-item="item" wx:for-index="index"><view data-event-opts="{{[['tap',[['checkValue',[index,'$0'],[[['companyList','',index,'id']]]]]]]}}" class="{{['company-item',companyIndex==index?'cur':'']}}" bindtap="__e">{{item.name}}</view></block></view></block></view></block><view class="{{['cate-nav-bg',businessId==0?'':'to-top']}}" style="{{'height:'+(scrollHeight+'px')+';'+('top:'+(topHieght+'px')+';')}}"><view class="cate-nav"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['changeCate',[index,'$0'],[[['cateList','',index,'id']]]]]]]}}" class="{{['cate-nav-item',cateIndex==index?'active':'']}}" bindtap="__e">{{item.title}}</view></block></view></view><scroll-view class="{{['shop-list-bg',businessId==0?'':'to-top']}}"><view class="shop-list flex"><block wx:for="{{secondList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toShop',['$0'],[[['secondList','',index,'id']]]]]]]}}" class="shop-item" bindtap="__e"><view class="img flex"><image src="{{item.cover}}" mode="widthFix"></image></view><view class="txt clips1">{{item.title}}</view></view></block></view><block wx:if="{{secondList.length==0&&isTips}}"><view class="tips">---没有更多分类---</view></block></scroll-view><enter-cart vue-id="c7684662-2" bind:__l="__l"></enter-cart><foot-tab vue-id="c7684662-3" current="1" bind:__l="__l"></foot-tab></view> <view class="pad-b150"><status-nav vue-id="c7684662-1" ifReturn="{{false}}" navBarTitle="分类" marginBottom="{{0}}" bind:__l="__l"></status-nav><view data-event-opts="{{[['tap',[['closeMore',['$event']]]]]}}" hidden="{{!(isShow)}}" class="pull-all-bg" bindtap="__e"></view><block wx:if="{{businessId==0}}"><view class="company-top"></view></block><block wx:if="{{businessId==0}}"><view class="company" style="{{'top:'+(topHieght+'px')+';'}}"><input type="text" data-event-opts="{{[['tap',[['openMore',['$event']]]]]}}" value="{{companyList[companyIndex].name?'工厂选择:'+companyList[companyIndex].name:''}}" bindtap="__e"/><block wx:if="{{isShow}}"><view class="company-list"><block wx:for="{{companyList}}" wx:for-item="item" wx:for-index="index"><view data-event-opts="{{[['tap',[['checkValue',[index,'$0'],[[['companyList','',index,'id']]]]]]]}}" class="{{['company-item',companyIndex==index?'cur':'']}}" bindtap="__e">{{item.name}}</view></block></view></block></view></block><block wx:if="{{cateList.length>0}}"><view class="{{['cate-nav-bg',businessId==0?'':'to-top']}}" style="{{'height:'+(scrollHeight+'px')+';'+('top:'+(topHieght+'px')+';')}}"><view class="cate-nav"><block wx:for="{{cateList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['changeCate',[index,'$0'],[[['cateList','',index,'id']]]]]]]}}" class="{{['cate-nav-item',cateIndex==index?'active':'']}}" bindtap="__e">{{item.title}}</view></block></view></view></block><scroll-view class="{{['shop-list-bg',businessId==0?'':'to-top']}}"><view class="shop-list flex"><block wx:for="{{secondList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['toShop',['$0'],[[['secondList','',index,'id']]]]]]]}}" class="shop-item" bindtap="__e"><view class="img flex"><image src="{{item.cover}}" mode="widthFix"></image></view><view class="txt clips1">{{item.title}}</view></view></block></view><block wx:if="{{secondList.length==0&&isTips}}"><view class="tips">---没有更多分类---</view></block></scroll-view><block wx:if="{{cateList.length==0}}"><view class="cate-nothing-tips">---该商户没有分类---</view></block><enter-cart vue-id="c7684662-2" bind:__l="__l"></enter-cart><foot-tab vue-id="c7684662-3" current="1" bind:__l="__l"></foot-tab></view>

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB