Browse Source

修改拼团列表分页无法使用的问题

master
Gao xiaosong 5 years ago
parent
commit
3cb20117b0
  1. 350
      pages/activity/GoodsGroup/index.vue
  2. 2
      pages/shop/Live/LiveList/index.vue

350
pages/activity/GoodsGroup/index.vue

@ -9,14 +9,8 @@
</view> </view>
<view class="group-box"> <view class="group-box">
<view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id"> <view class="goods-item" v-for="(groupon, index) in grouponList" :key="groupon.id">
<activity-card <activity-card :cId="groupon.id" :title="groupon.title" :info="groupon.info" :img="groupon.image"
:cId="groupon.id" :price="groupon.price" :productPrice="groupon.productPrice">
:title="groupon.title"
:info="groupon.info"
:img="groupon.image"
:price="groupon.price"
:productPrice="groupon.productPrice"
>
<block slot="tag"> <block slot="tag">
<view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view> <view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
</block> </block>
@ -29,200 +23,210 @@
<text class="group-num">{{ groupon.people || 0 }}人团</text> <text class="group-num">{{ groupon.people || 0 }}人团</text>
</view> </view>
</block> </block>
<block slot="btn"><button class="cu-btn buy-btn" @tap.stop="jump('/pages/activity/GroupDetails/index', { id: groupon.id })">马上拼</button></block> <block slot="btn"><button class="cu-btn buy-btn"
@tap.stop="jump('/pages/activity/GroupDetails/index', { id: groupon.id })">马上拼</button></block>
</activity-card> </activity-card>
</view> </view>
</view> </view>
</view> </view>
<!-- 空白 -->
<!-- <Shop-empty v-if="!grouponList.length && !isLoading" :emptyData="emptyData"></Shop-empty>-->
<!-- 加载更多 -->
<view v-if="grouponList.length" class="cu-load text-gray" :class="loadStatus"></view>
<!-- loading -->
<Shop-load v-model="isLoading"></Shop-load>
</scroll-view> </scroll-view>
</view> </view>
<!-- 自定义底部导航 --> <Loading :loaded="loaded" :loading="loading"></Loading>
<Shop-tabbar></Shop-tabbar>
</view> </view>
</template> </template>
<script> <script>
import activityCard from './children/activity-card.vue'; import activityCard from './children/activity-card.vue';
import { getCombinationList } from "@/api/activity"; import Loading from "@/components/Loading";
export default {
components: {
activityCard import {
}, getCombinationList
data() { } from "@/api/activity";
return { export default {
emptyData: { components: {
img: '/static/imgs/empty/empty_goods.png', activityCard,
tip: '还没有拼团商品噢,去首页看看吧~', Loading
path: '/pages/index/index', },
pathText: '去首页逛逛' data() {
}, return {
status:'', emptyData: {
isLoading: true, img: '/static/imgs/empty/empty_goods.png',
loadStatus: '', //loading,over tip: '还没有拼团商品噢,去首页看看吧~',
lastPage: 0, path: '/pages/index/index',
currentPage: 1, pathText: '去首页逛逛'
grouponList: [] },
}; loaded: false,
}, loading: false,
onLoad() { lastPage: 0,
this.getGrouponList(); currentPage: 1,
}, limit: 10,
onPullDownRefresh() {}, grouponList: []
computed: {}, };
methods: { },
// onLoad() {
jump(path, parmas) { this.getGrouponList();
this.$yrouter.push({
path: path,
query: parmas
});
}, },
// onPullDownRefresh() {},
loadMore() { computed: {},
if (this.currentPage < this.lastPage) { methods: {
this.currentPage += 1; //
this.getGrouponList(); jump(path, parmas) {
this.$yrouter.push({
path: path,
query: parmas
});
},
//
loadMore() {
},
//
getGrouponList() {
let that = this;
if (this.loading || this.loaded) return;
this.loading = true;
getCombinationList({
page: that.currentPage,
limit: this.limit
}).then(res => {
that.grouponList = that.grouponList.concat(res.data.storeCombinationQueryVos)
this.currentPage++;
this.loaded = res.data.storeCombinationQueryVos.length < this.limit;
this.loading = false;
});
// that.$api('goods.grouponList', {
// page: that.currentPage
// }).then(res => {
// if (res.code === 1) {
// that.isLoading = false;
// that.grouponList = [...that.grouponList, ...res.data.data];
// // that.grouponList=[];
// that.lastPage = res.data.last_page;
// if (that.currentPage < res.data.last_page) {
// that.loadStatus = '';
// } else {
// that.loadStatus = 'over';
// }
// }
// });
} }
}, },
// onReachBottom() {
getGrouponList() { !this.loading && this.getGrouponList();
let that = this;
that.isLoading = true;
that.loadStatus = 'loading';
getCombinationList({ page:that.currentPage, limit: 10 }).then(res => {
that.status = res.data.length < 10;
that.grouponList.push.apply(that.grouponList, res.data);
that.lastPage = res.data.last_page;
if (that.currentPage < res.data.last_page) {
that.loadStatus = '';
} else {
that.loadStatus = 'over';
}
that.loading = false;
});
// that.$api('goods.grouponList', {
// page: that.currentPage
// }).then(res => {
// if (res.code === 1) {
// that.isLoading = false;
// that.grouponList = [...that.grouponList, ...res.data.data];
// // that.grouponList=[];
// that.lastPage = res.data.last_page;
// if (that.currentPage < res.data.last_page) {
// that.loadStatus = '';
// } else {
// that.loadStatus = 'over';
// }
// }
// });
} }
} };
};
</script> </script>
<style lang="scss"> <style lang="scss">
.group-wrap { .group-wrap {
background: url('~@/static/images/index-bg.png') no-repeat; background: url('~@/static/images/index-bg.png') no-repeat;
background-size: 100% 374rpx; background-size: 100% 374rpx;
}
.group-head {
padding: 0 25rpx;
height: 100rpx;
.group-head__title {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: rgba(255, 255, 255, 1);
} }
.group-head__notice {
font-size: 26rpx; .group-head {
font-family: PingFang SC; padding: 0 25rpx;
font-weight: 500; height: 100rpx;
color: rgba(255, 255, 255, 1);
} .group-head__title {
} font-size: 32rpx;
.group-box {
width: 710rpx;
background: linear-gradient(#fff, #f5f5f5);
border-radius: 20rpx;
margin: 0 auto;
min-height: 1000rpx;
.goods-item {
border-radius: 20rpx;
overflow: hidden;
position: relative;
margin-bottom: 20rpx;
.tag {
position: absolute;
left: 0;
top: 10rpx;
z-index: 2;
line-height: 35rpx;
background: linear-gradient(132deg, rgba(255, 153, 93, 1), rgba(255, 99, 97, 1));
border-radius: 0px 18rpx 18rpx 0px;
padding: 0 10rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(255, 255, 255, 0.8);
}
/deep/.goods-right {
width: 460rpx;
.title {
width: 460rpx;
}
.tip {
width: 460rpx;
}
}
.buy-btn {
position: absolute;
right: 0;
bottom: -10rpx;
width: 160rpx;
height: 60rpx;
background: linear-gradient(90deg, rgba(254, 131, 42, 1), rgba(255, 102, 0, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(255, 104, 4, 0.22);
border-radius: 30rpx;
font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #fff; color: rgba(255, 255, 255, 1);
padding: 0;
} }
.group-num {
font-size: 20rpx; .group-head__notice {
font-size: 26rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: rgba(153, 153, 153, 1); color: rgba(255, 255, 255, 1);
margin-left: 20rpx;
} }
.sell-box { }
background: rgba(255, 224, 226, 0.3);
border-radius: 16rpx; .group-box {
line-height: 32rpx; width: 710rpx;
padding: 0 10rpx; background: linear-gradient(#fff, #f5f5f5);
.sell-num { border-radius: 20rpx;
margin: 0 auto;
min-height: 1000rpx;
.goods-item {
border-radius: 20rpx;
overflow: hidden;
position: relative;
margin-bottom: 20rpx;
.tag {
position: absolute;
left: 0;
top: 10rpx;
z-index: 2;
line-height: 35rpx;
background: linear-gradient(132deg, rgba(255, 153, 93, 1), rgba(255, 99, 97, 1));
border-radius: 0px 18rpx 18rpx 0px;
padding: 0 10rpx;
font-size: 24rpx;
font-family: PingFang SC;
font-weight: bold;
color: rgba(255, 255, 255, 0.8);
}
/deep/.goods-right {
width: 460rpx;
.title {
width: 460rpx;
}
.tip {
width: 460rpx;
}
}
.buy-btn {
position: absolute;
right: 0;
bottom: -10rpx;
width: 160rpx;
height: 60rpx;
background: linear-gradient(90deg, rgba(254, 131, 42, 1), rgba(255, 102, 0, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(255, 104, 4, 0.22);
border-radius: 30rpx;
font-size: 28rpx;
font-family: PingFang SC;
font-weight: 500;
color: #fff;
padding: 0;
}
.group-num {
font-size: 20rpx; font-size: 20rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 400; font-weight: 500;
color: rgba(247, 151, 156, 1); color: rgba(153, 153, 153, 1);
margin-left: 20rpx;
} }
.cuIcon-hotfill { .sell-box {
font-size: 26rpx; background: rgba(255, 224, 226, 0.3);
color: #e1212b; border-radius: 16rpx;
margin-right: 8rpx; line-height: 32rpx;
padding: 0 10rpx;
.sell-num {
font-size: 20rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(247, 151, 156, 1);
}
.cuIcon-hotfill {
font-size: 26rpx;
color: #e1212b;
margin-right: 8rpx;
}
} }
} }
} }
}
</style> </style>

2
pages/shop/Live/LiveList/index.vue

@ -94,7 +94,7 @@
page: that.currentPage, page: that.currentPage,
size: that.size size: that.size
}).then(res => { }).then(res => {
that.liveList = [...that.liveList, ...res.data.content]; that.liveList = that.liveList.concat(res.data.content)
this.currentPage++; this.currentPage++;
this.loaded = res.data.content.length < that.size; this.loaded = res.data.content.length < that.size;
this.loading = false; this.loading = false;

Loading…
Cancel
Save