master
wangdong 4 months ago
parent c3b82b31f1
commit e72c9e2641
  1. 2
      pages/shopList/index.vue
  2. 56
      pages/shopList/shopPage.vue

@ -142,6 +142,7 @@
return; return;
} }
this.loadTitle = ""; this.loadTitle = "";
uni.showLoading();
Api.getShopList({ Api.getShopList({
sort: this.activeFilter, sort: this.activeFilter,
page: this.page++, page: this.page++,
@ -150,6 +151,7 @@
}) })
.then(result => { .then(result => {
console.log(result); console.log(result);
uni.hideLoading();
const data = result.data.data; const data = result.data.data;
this.shopsList = this.shopsList.concat(data); this.shopsList = this.shopsList.concat(data);
this.finished = data.length < this.limit; this.finished = data.length < this.limit;

@ -78,6 +78,8 @@
:class="{ on: activeFilter === 'price' && filterDirection === 'ASC'}"></text> :class="{ on: activeFilter === 'price' && filterDirection === 'ASC'}"></text>
</view> </view>
</view> </view>
<view class="content-list">
<scroll-view :scroll-top="scrollTop" class="scroll-goods-list" scroll-y="true" @scrolltolower="loadMore" @scroll="goodsListScroll">
<view class="goods-list"> <view class="goods-list">
<view v-for="(item, index) in goods" :key="index" class="good" <view v-for="(item, index) in goods" :key="index" class="good"
@click="onGoodDetail(item.goods_id)"> @click="onGoodDetail(item.goods_id)">
@ -96,6 +98,8 @@
<image mode="aspectFill" src="@/static/empty.png" alt="暂无商品" /> <image mode="aspectFill" src="@/static/empty.png" alt="暂无商品" />
<view>暂无商品</view> <view>暂无商品</view>
</view> </view>
</scroll-view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -148,6 +152,8 @@
} }
], ],
isTop: false, isTop: false,
scrollTop: 0,
oldScrollTop: 0,
page: 1, page: 1,
limit: 10, limit: 10,
loadTitle: '', loadTitle: '',
@ -184,13 +190,6 @@
this.getGoodsList(); this.getGoodsList();
}, },
}, },
onPageScroll(e) {
if (e.scrollTop <= 200) { // true
this.isTop = false
} else {
this.isTop = true
}
},
onLoad({ onLoad({
id id
}) { }) {
@ -198,10 +197,10 @@
this.getShopDetail() this.getShopDetail()
this.getGoodsTypeList(); this.getGoodsTypeList();
}, },
onReachBottom() { methods: {
loadMore() {
this.getGoodsList(); this.getGoodsList();
}, },
methods: {
back() { back() {
let pages = getCurrentPages(); let pages = getCurrentPages();
if (pages.length > 1) { if (pages.length > 1) {
@ -231,10 +230,24 @@
this.finished = false; this.finished = false;
this.getGoodsList(); this.getGoodsList();
}, },
goodsListScroll(e) {
this.oldScrollTop = e.detail.scrollTop;
if (this.oldScrollTop <= 200) { // true
this.isTop = false
} else {
this.isTop = true
}
},
openScrollTo() { openScrollTo() {
uni.pageScrollTo({ // uni.pageScrollTo({
scrollTop: 0 // scrollTop: 0
}) // })
//
this.scrollTop = this.oldScrollTop
// 0
this.$nextTick(() =>{
this.scrollTop = 0
});
}, },
toCer() { toCer() {
uni.navigateTo({ uni.navigateTo({
@ -246,7 +259,6 @@
id: this.id id: this.id
}) })
.then(result => { .then(result => {
console.log(result);
this.shopDetail = result.data.detail; this.shopDetail = result.data.detail;
}) })
.finally(() => this.loading = false) .finally(() => this.loading = false)
@ -292,7 +304,6 @@
.then(result => { .then(result => {
// //
const data = result.data.list.data; const data = result.data.list.data;
console.log(data);
this.goods = this.goods.concat(data); this.goods = this.goods.concat(data);
this.finished = data.length < 10; this.finished = data.length < 10;
this.loadTitle = this.finished ? "我是有底线的哦~" : "上拉加载更多"; this.loadTitle = this.finished ? "我是有底线的哦~" : "上拉加载更多";
@ -350,6 +361,7 @@
flex-direction: column; flex-direction: column;
background: url(https://www.royaum.com.cn/static/shop/shop-page-bg.png) center top no-repeat; background: url(https://www.royaum.com.cn/static/shop/shop-page-bg.png) center top no-repeat;
background-size: 100% auto; background-size: 100% auto;
overflow-y: hidden;
.navbarContent { .navbarContent {
display: flex; display: flex;
@ -390,6 +402,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: 30rpx; padding-top: 30rpx;
overflow-y: hidden;
.shop-tip { .shop-tip {
padding: 0 24rpx; padding: 0 24rpx;
@ -508,6 +521,7 @@
margin-top: 30rpx; margin-top: 30rpx;
background: #F0F4F3; background: #F0F4F3;
border-radius: 20rpx 20rpx 0 0; border-radius: 20rpx 20rpx 0 0;
overflow-y: hidden;
// padding-top: 24rpx; // padding-top: 24rpx;
.second-cate { .second-cate {
@ -548,15 +562,16 @@
.goods-content { .goods-content {
flex: 1; flex: 1;
display: flex; display: flex;
overflow-y: hidden;
.first-cate { .first-cate {
height: 100%;
width: 120rpx; width: 120rpx;
.first-cate-tabs { .first-cate-tabs {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
background: #fff; background: #fff;
height: 100%;
.cate-item { .cate-item {
width: 100%; width: 100%;
@ -600,6 +615,7 @@
width: calc(100% - 108rpx); width: calc(100% - 108rpx);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: hidden;
.filter-box { .filter-box {
height: 88rpx; height: 88rpx;
@ -607,6 +623,7 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
flex-shrink: 0;
.filter-item { .filter-item {
color: #333; color: #333;
@ -644,11 +661,14 @@
} }
} }
} }
.content-list {
height: calc(100% - 88rpx);
.scroll-goods-list {
height: 100%;
}
}
.goods-list { .goods-list {
padding: 0 20rpx; padding: 0 20rpx;
overflow-x: hidden;
overflow-y: auto;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;

Loading…
Cancel
Save