|
|
@@ -7,21 +7,21 @@
|
|
|
mode="aspectFill"></u-image>
|
|
|
</swiper-item>
|
|
|
</swiper>
|
|
|
- <goods :goodsList="goodsList" :activityId="activityId"></goods>
|
|
|
- <view style="height: 50rpx;">
|
|
|
-
|
|
|
- </view>
|
|
|
+ <meScroll :up="up" :down="down" @up="upFn" :fixed="false" @down="downFn" @init="initMeScroll">
|
|
|
+ <goods :goodsList="goodsList" :activityId="activityId"></goods>
|
|
|
+ </meScroll>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import meScroll from "../mescroll-body/mescroll-uni.vue"
|
|
|
import goods from "@/components/goods/goods.vue"
|
|
|
import {
|
|
|
wx_launch
|
|
|
} from "../../common/utils/wx_launch.js"; // 引入公共js文件
|
|
|
export default {
|
|
|
components: {
|
|
|
- goods
|
|
|
+ goods,meScroll
|
|
|
},
|
|
|
props: {
|
|
|
activityId: {
|
|
|
@@ -31,16 +31,40 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ status: 'loadmore',
|
|
|
+ current:1,
|
|
|
+
|
|
|
goodsList: [],
|
|
|
adsList: [],
|
|
|
- appletList: []
|
|
|
+ appletList: [],
|
|
|
+
|
|
|
+ isInit: false, // 是否初始化
|
|
|
+ goodsList: [], // 列表数据
|
|
|
+ mescroll: null, // mescroll 对象
|
|
|
+ // 上拉配置参数
|
|
|
+ up: {
|
|
|
+ noMoreSize: 3,
|
|
|
+ auto: true,
|
|
|
+ page: {
|
|
|
+ page: 0,
|
|
|
+ size: 10
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 下拉配置参数
|
|
|
+ down: {
|
|
|
+ use: false,
|
|
|
+ auto: false
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.fetchGoodsList();
|
|
|
+ // this.fetchGoodsList();
|
|
|
this.fetchAds()
|
|
|
},
|
|
|
methods: {
|
|
|
+ initMeScroll(mescroll) {
|
|
|
+ this.mescroll = mescroll
|
|
|
+ },
|
|
|
async fetchAds() {
|
|
|
let res = await this.$u.api.pointsGoods.ads({
|
|
|
activityId: this.activityId
|
|
|
@@ -48,10 +72,12 @@
|
|
|
this.adsList = res.records;
|
|
|
},
|
|
|
fetchGoodsList() {
|
|
|
- this.$u.api.pointsGoods.list({
|
|
|
- activityId: this.activityId
|
|
|
- }).then(res => {
|
|
|
- this.goodsList = res.records;
|
|
|
+ let params={
|
|
|
+ activityId: this.activityId,
|
|
|
+ current:this.current
|
|
|
+ }
|
|
|
+ this.$u.api.pointsGoods.list(params).then(res => {
|
|
|
+ this.goodsList =[...this.goodsList,...res.records]
|
|
|
})
|
|
|
},
|
|
|
jump(item) {
|
|
|
@@ -62,7 +88,23 @@
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/web-view/web-view?url=' + item.path
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ upFn(mescroll) {
|
|
|
+ let params={
|
|
|
+ activityId: this.activityId,
|
|
|
+ current:mescroll.num
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ this.$u.api.pointsGoods.list(params).then(res => {
|
|
|
+ let data=res.records
|
|
|
+ mescroll.endBySize(data.length, res.total);
|
|
|
+ if(mescroll.num == 1) this.goodsList = []; //如果是第一页需手动制空列表
|
|
|
+ this.goodsList=this.goodsList.concat(data); //追加新数据
|
|
|
+ })
|
|
|
+ }catch(e){
|
|
|
+ mescroll.endErr();
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|