【修复】修复仿点餐模式下子列表数据上拉加载失败的问题。

This commit is contained in:
大灰灰
2022-11-21 21:59:22 +08:00
parent 53a367eb27
commit 7d239ebdac

View File

@@ -62,7 +62,7 @@
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'"> <scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'" @scrolltolower="scrolltolower">
<u-sticky v-if="menuChilds"> <u-sticky v-if="menuChilds">
<view class="coreshop-bg-white coreshop-padding-left-10"> <view class="coreshop-bg-white coreshop-padding-left-10">
<u-tabs :list="menuChilds" :current="childCurrent" :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',fontSize:'14px'}" :inactiveStyle="{color: '#606266',transform: 'scale(1)',fontSize:'14px'}" @change="childIdCheck"></u-tabs> <u-tabs :list="menuChilds" :current="childCurrent" :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',fontSize:'14px'}" :inactiveStyle="{color: '#606266',transform: 'scale(1)',fontSize:'14px'}" @change="childIdCheck"></u-tabs>
@@ -93,7 +93,7 @@
</view> </view>
</view> </view>
</view> </view>
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" /> <u-loadmore :status="loadStatus" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@@ -214,7 +214,6 @@
this.scorllH = e.windowHeight - e.statusBarHeight - 50; this.scorllH = e.windowHeight - e.statusBarHeight - 50;
} }
}) })
// 获取购物车数量 // 获取购物车数量
if (this.$store.state.config.cateStyle == 4) { if (this.$store.state.config.cateStyle == 4) {
this.goodsList = []; this.goodsList = [];
@@ -232,11 +231,6 @@
this.getCartNums(); this.getCartNums();
} }
}, },
onReachBottom() {
if (this.loadStatus != 'nomore') {
this.getGoods();
}
},
methods: { methods: {
// 点击左边的栏目切换 // 点击左边的栏目切换
async swichMenu(index) { async swichMenu(index) {
@@ -297,9 +291,11 @@
} }
} }
this.currentCateId = res.data[0].id; this.currentCateId = res.data[0].id;
this.needCurrentCateId = res.data[0].id;
this.menuChilds = res.data[0].child; this.menuChilds = res.data[0].child;
this.getGoods();
} }
this.getGoods();
} }
} }
}); });
@@ -468,7 +464,12 @@
this.goodsList = []; this.goodsList = [];
this.getGoods(); this.getGoods();
}, },
scrolltolower() {
console.log("触底了");
if (this.loadStatus != 'nomore') {
this.getGoods();
}
},
//取得商品数据 //取得商品数据
getGoods: function () { getGoods: function () {
uni.showLoading({ uni.showLoading({
@@ -487,7 +488,7 @@
if (res.status) { if (res.status) {
const _list = res.data.list; const _list = res.data.list;
_this.goodsList = [..._this.goodsList, ..._list]; _this.goodsList = [..._this.goodsList, ..._list];
if (res.data.totalCount > _this.goodsList.length) { if (res.data.totalPages >= _this.page) {
_this.loadStatus = 'loadmore'; _this.loadStatus = 'loadmore';
_this.page++; _this.page++;
} else { } else {