shop_uniapp/pages/new_goods/index.vue

71 lines
1.5 KiB
Vue
Raw Normal View History

2024-08-01 09:05:48 +08:00
<template>
<view class="hot-list">
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
<view class="main">
<goods-list :list="goodsList" type="double" :price-type="price_type"></goods-list>
</view>
</mescroll-body>
<tabbar></tabbar>
</view>
</template>
<script>
import {
getNewGoods
} from '@/api/store';
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
export default {
mixins: [MescrollMixin],
data() {
return {
upOption: {
empty: {
icon: "https://zjeloong.oss-cn-hangzhou.aliyuncs.com/uniapp/goods_null.png",
tip: "暂无商品~"
}
},
hotList: [],
goodsList: [],
type: '',
price_type: 0
};
},
methods: {
upCallback(page) {
let pageNum = page.num;
let pageSize = page.size;
const params = {
page_no: pageNum,
page_size: pageSize,
p_id: this.$store.getters.hasPid,
set: this.$store.getters.hasSetId
}
params.type = 'all'
getNewGoods(params).then(res => {
if (res.code == 1) {
this.price_type = 0;
let curPageData = res.data.lists;
let curPageLen = curPageData.length;
let hasNext = !!res.data.more;
if (page.num == 1) {
this.goodsList = [];
}
this.goodsList = this.goodsList.concat(curPageData);
this.mescroll.endSuccess(curPageLen, hasNext);
}
}).catch(err => {
this.mescroll.endErr()
})
},
}
};
</script>
<style lang="scss">
.list-title {
margin: 27rpx 0 30rpx;
}
</style>